View source with formatted comments or as raw
    1-mutually_exclusive(S1, S2) :-
    2    segment(S1), segment(S2), S1 =\= S2, 
    3    intercept(S1, S2). 
    4
    5mutually_exclusive(S1, S2) :-
    6    not -mutually_exclusive(S1, S2). 
    7
    8intercept([X1, X2], [Y1, Y2]) :-
    9    Y1 #=< X1, X1 #=< Y2.  
   10intercept([X1, X2], [Y1, Y2]) :-
   11    Y1 #=< X2, X2 #=< Y2.
   12    
   13segment([1,2]).
   14segment([2,3]).
   15segment([3,4]). 
   16
   17?- mutually_exclusive(S1, S2).