Ciao Preprocessor (integrated Alpha version)
 | This is an alpha distribution, meant only for testing. Please do let us 
 | know at ciaopp-bugclip.dia.fi.upm.es any problems you may have.

{loaded in 3412.213 msec.}
{preprocessed for plai in 0.0 msec.}
{analyzed by plai using det with local-control off in 20.001 msec.}
{written file /tmp/tmp6trzrj/mergesort_det_co.pl}
:- module(_1,[mergesort/2],[assertions]).

:- entry mergesort(A,B)
         : ground(A).

:- true pred mergesort(A,B)
         : ( native_props:mshare([[B]]), ground([A]), gnd(A), term(B) )
        => ( ground([A,B]), rt57(A), rt61(B) )
         + ( is_det, mut_exclusive ).

:- true pred mergesort(A,B)
         : ( native_props:mshare([[B]]), var(B), ground([A]), rt20(A), term(B) )
        => ( ground([A,B]), rt26(A), rt27(B) )
         + ( is_det, mut_exclusive ).

:- true pred mergesort(A,B)
         : ( native_props:mshare([[B]]), var(B), ground([A]), rt22(A), term(B) )
        => ( ground([A,B]), rt40(A), rt38(B) )
         + ( is_det, mut_exclusive ).

mergesort([],[]).
mergesort([X],[X]).
mergesort([X,Y|Xs],Ys) :-
        split([X,Y|Xs],X1s,X2s),
        mergesort(X1s,Y1s),
        mergesort(X2s,Y2s),
        merge(Y1s,Y2s,Ys).

:- true pred split([_2,_3|_4],_1,Zs)
         : ( native_props:mshare([[_1],[Zs]]), var(_1), var(Zs), ground([_2,_3,_4]), term(_1), term(Zs), gnd(_2), gnd(_3), gnd(_4) )
        => ( ground([_1,Zs,_2,_3,_4]), rt22(_1), rt20(Zs), gnd(_2), gnd(_3), rt17(_4) )
         + ( is_det, mut_exclusive ).

:- true pred split(_1,_2,Zs)
         : ( native_props:mshare([[_2],[Zs]]), var(_2), var(Zs), ground([_1]), rt6(_1), term(_2), term(Zs) )
        => ( ground([_1,_2,Zs]), rt21(_1), rt20(_2), rt15(Zs) )
         + ( is_det, mut_exclusive ).

:- true pred split(_1,_2,Zs)
         : ( native_props:mshare([[_2],[Zs]]), var(_2), var(Zs), ground([_1]), rt7(_1), term(_2), term(Zs) )
        => ( ground([_1,_2,Zs]), rt17(_1), rt15(_2), rt19(Zs) )
         + ( is_det, mut_exclusive ).

split([],[],[]).
split([X|Xs],[X|Ys],Zs) :-
        split(Xs,Zs,Ys).

:- true pred merge(_1,Xs,_2)
         : ( native_props:mshare([[_2]]), ground([_1,Xs]), rt38(_1), rt27(Xs), term(_2) )
        => ( ground([_1,Xs,_2]), rt50(_1), rt51(Xs), rt49(_2) )
         + ( is_det, mut_exclusive ).

:- true pred merge([_2|_3],Xs,_1)
         : ( native_props:mshare([[_1]]), ground([Xs,_2,_3]), rt44(Xs), term(_1), gnd(_2), rt45(_3) )
        => ( ground([Xs,_1,_2,_3]), rt48(Xs), rt47(_1), gnd(_2), rt45(_3) )
         + ( is_det, mut_exclusive ).

:- true pred merge(_1,Xs,_2)
         : ( native_props:mshare([[_2]]), var(_2), ground([_1,Xs]), rt24(_1), rt27(Xs), term(_2) )
        => ( ground([_1,Xs,_2]), rt33(_1), rt34(Xs), rt32(_2) )
         + ( is_det, mut_exclusive ).

:- true pred merge([_2|_3],Xs,_1)
         : ( native_props:mshare([[_1]]), var(_1), ground([Xs,_2,_3]), rt29(Xs), term(_1), gnd(_2), rt28(_3) )
        => ( ground([Xs,_1,_2,_3]), rt31(Xs), rt30(_1), gnd(_2), rt28(_3) )
         + ( is_det, mut_exclusive ).

merge([],Xs,Xs).
merge(Xs,[],Xs).
merge([X|Xs],[Y|Ys],[X|Zs]) :-
        X=Y,
        merge([X|Xs],Ys,Zs).


:- regtype rt60/1.

rt60([]).
rt60([A|B]) :-
        gnd(A),
        rt60(B).


:- regtype rt59/1.

rt59([]).
rt59([A|B]) :-
        gnd(A),
        rt60(B).


:- regtype rt58/1.

rt58([]).
rt58([A|B]) :-
        gnd(A),
        rt59(B).


:- regtype rt57/1.

rt57([]).
rt57([A|B]) :-
        gnd(A),
        rt58(B).


:- regtype rt63/1.

rt63([]).
rt63([A|B]) :-
        gnd(A),
        rt63(B).


:- regtype rt62/1.

rt62([]).
rt62([A|B]) :-
        gnd(A),
        rt63(B).


:- regtype rt61/1.

rt61([]).
rt61([A|B]) :-
        gnd(A),
        rt62(B).


:- regtype rt39/1.

rt39([]).
rt39([A|B]) :-
        gnd(A),
        rt28(B).


:- regtype rt38/1.

rt38([A|B]) :-
        gnd(A),
        rt39(B).


:- regtype rt27/1.

rt27([A]) :-
        gnd(A).


:- regtype rt50/1.

rt50([A|B]) :-
        gnd(A),
        rt45(B).


:- regtype rt51/1.

rt51([A|B]) :-
        gnd(A),
        rt48(B).


:- regtype rt49/1.

rt49([A|B]) :-
        gnd(A),
        rt47(B).


:- regtype rt44/1.

rt44([]).


:- regtype rt46/1.

rt46([]).
rt46([A|B]) :-
        gnd(A),
        rt46(B).


:- regtype rt45/1.

rt45([]).
rt45([A|B]) :-
        gnd(A),
        rt46(B).


:- regtype rt48/1.

rt48([]).


:- regtype rt47/1.

rt47([A|B]) :-
        gnd(A),
        rt45(B).


:- regtype rt20/1.

rt20([A|B]) :-
        gnd(A),
        rt19(B).


:- regtype rt26/1.

rt26([A]) :-
        gnd(A).


:- regtype rt22/1.

rt22([A|B]) :-
        gnd(A),
        rt15(B).


:- regtype rt43/1.

rt43([]).
rt43([A|B]) :-
        gnd(A),
        rt43(B).


:- regtype rt42/1.

rt42([]).
rt42([A|B]) :-
        gnd(A),
        rt43(B).


:- regtype rt41/1.

rt41([]).
rt41([A|B]) :-
        gnd(A),
        rt42(B).


:- regtype rt40/1.

rt40([A|B]) :-
        gnd(A),
        rt41(B).


:- regtype rt24/1.

rt24([A]) :-
        gnd(A).


:- regtype rt33/1.

rt33([A|B]) :-
        gnd(A),
        rt28(B).


:- regtype rt34/1.

rt34([A|B]) :-
        gnd(A),
        rt31(B).


:- regtype rt32/1.

rt32([A|B]) :-
        gnd(A),
        rt30(B).


:- regtype rt29/1.

rt29([]).


:- regtype rt28/1.

rt28([]).


:- regtype rt31/1.

rt31([]).


:- regtype rt30/1.

rt30([A|B]) :-
        gnd(A),
        rt28(B).


:- regtype rt18/1.

rt18([]).
rt18([A|B]) :-
        gnd(A),
        rt18(B).


:- regtype rt17/1.

rt17([]).
rt17([A|B]) :-
        gnd(A),
        rt18(B).


:- regtype rt6/1.

rt6([A|B]) :-
        gnd(A),
        gnd(B).


:- regtype rt21/1.

rt21([A|B]) :-
        gnd(A),
        rt17(B).


:- regtype rt16/1.

rt16([]).
rt16([A|B]) :-
        gnd(A),
        rt16(B).


:- regtype rt15/1.

rt15([]).
rt15([A|B]) :-
        gnd(A),
        rt16(B).


:- regtype rt7/1.

rt7(A) :-
        gnd(A).


:- regtype rt19/1.

rt19([]).