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 3328.208 msec.}
{preprocessed for plai in 0.0 msec.}
{analyzed by plai using det with local-control off in 44.002 msec.}
{written file /tmp/tmpEvfgGj/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]), rt107(A), rt111(B) )
         + ( non_det, mut_exclusive ).

:- true pred mergesort(A,B)
         : ( native_props:mshare([[B]]), var(B), ground([A]), rt20(A), term(B) )
        => ( ground([A,B]), rt61(A), rt62(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]), rt54(A), rt58(B) )
         + ( non_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 ).

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]), rt63(_1), rt66(Xs), term(_2) )
        => ( ground([_1,Xs,_2]), rt98(_1), rt100(Xs), rt95(_2) )
         + ( non_det, not_mut_exclusive ).

:- true pred merge([_2|_3],Xs,_1)
         : ( native_props:mshare([[_1]]), ground([Xs,_2,_3]), rt83(Xs), term(_1), arithexpression(_2), rt82(_3) )
        => ( ground([Xs,_1,_2,_3]), rt85(Xs), rt84(_1), arithexpression(_2), rt82(_3) )
         + ( is_det, mut_exclusive ).

:- true pred merge(_1,[_2|_3],Xs)
         : ( native_props:mshare([[Xs]]), ground([_1,_2,_3]), rt68(_1), term(Xs), arithexpression(_2), rt70(_3) )
        => ( ground([_1,Xs,_2,_3]), rt78(_1), rt80(Xs), arithexpression(_2), rt88(_3) )
         + ( non_det, not_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]), rt45(_1), rt47(Xs), rt42(_2) )
         + ( non_det, not_mut_exclusive ).

:- true pred merge([_2|_3],Xs,_1)
         : ( native_props:mshare([[_1]]), var(_1), ground([Xs,_2,_3]), rt36(Xs), term(_1), arithexpression(_2), rt35(_3) )
        => ( ground([Xs,_1,_2,_3]), rt38(Xs), rt37(_1), arithexpression(_2), rt35(_3) )
         + ( is_det, mut_exclusive ).

:- true pred merge(_1,[_2|_3],Xs)
         : ( native_props:mshare([[Xs]]), var(Xs), ground([_1,_2,_3]), rt28(_1), term(Xs), arithexpression(_2), rt29(_3) )
        => ( ground([_1,Xs,_2,_3]), rt31(_1), rt30(Xs), arithexpression(_2), rt29(_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 rt110/1.

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


:- regtype rt109/1.

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


:- regtype rt108/1.

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


:- regtype rt107/1.

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


:- regtype rt113/1.

rt113([]).
rt113([A|B]) :-
        arithexpression(A),
        rt97(B).


:- regtype rt112/1.

rt112([]).
rt112([A|B]) :-
        arithexpression(A),
        rt113(B).


:- regtype rt111/1.

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


:- regtype rt65/1.

rt65([]).
rt65([A|B]) :-
        arithexpression(A),
        rt65(B).


:- regtype rt64/1.

rt64([]).
rt64([A|B]) :-
        arithexpression(A),
        rt65(B).


:- regtype rt63/1.

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


:- regtype rt67/1.

rt67([]).


:- regtype rt66/1.

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


:- regtype rt99/1.

rt99([]).
rt99([A|B]) :-
        arithexpression(A),
        rt99(B).


:- regtype rt98/1.

rt98([A|B]) :-
        arithexpression(A),
        rt99(B).


:- regtype rt101/1.

rt101([]).


:- regtype rt100/1.

rt100([A|B]) :-
        arithexpression(A),
        rt101(B).


:- regtype rt97/1.

rt97([]).
rt97([A|B]) :-
        arithexpression(A),
        rt97(B).


:- regtype rt96/1.

rt96([A|B]) :-
        arithexpression(A),
        rt97(B).


:- regtype rt95/1.

rt95([A|B]) :-
        arithexpression(A),
        rt96(B).


:- regtype rt83/1.

rt83([]).


:- regtype rt82/1.

rt82([]).
rt82([A|B]) :-
        arithexpression(A),
        rt82(B).


:- regtype rt85/1.

rt85([]).


:- regtype rt84/1.

rt84([A|B]) :-
        arithexpression(A),
        rt82(B).


:- regtype rt69/1.

rt69([]).
rt69([A|B]) :-
        arithexpression(A),
        rt69(B).


:- regtype rt68/1.

rt68([]).
rt68([A|B]) :-
        arithexpression(A),
        rt69(B).


:- regtype rt70/1.

rt70([]).


:- regtype rt79/1.

rt79([]).
rt79([A|B]) :-
        arithexpression(A),
        rt79(B).


:- regtype rt78/1.

rt78([]).
rt78([A|B]) :-
        arithexpression(A),
        rt79(B).


:- regtype rt81/1.

rt81([]).
rt81([A|B]) :-
        arithexpression(A),
        rt81(B).


:- regtype rt80/1.

rt80([A|B]) :-
        arithexpression(A),
        rt81(B).


:- regtype rt88/1.

rt88([]).


:- regtype rt20/1.

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


:- regtype rt61/1.

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


:- regtype rt62/1.

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


:- regtype rt22/1.

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


:- regtype rt57/1.

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


:- regtype rt56/1.

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


:- regtype rt55/1.

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


:- regtype rt54/1.

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


:- regtype rt60/1.

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


:- regtype rt59/1.

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


:- regtype rt58/1.

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


:- regtype rt24/1.

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


:- regtype rt27/1.

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


:- regtype rt46/1.

rt46([]).


:- regtype rt45/1.

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


:- regtype rt48/1.

rt48([]).


:- regtype rt47/1.

rt47([A|B]) :-
        arithexpression(A),
        rt48(B).


:- regtype rt44/1.

rt44([]).
rt44([A|B]) :-
        arithexpression(A),
        rt44(B).


:- regtype rt43/1.

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


:- regtype rt42/1.

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


:- regtype rt36/1.

rt36([]).


:- regtype rt35/1.

rt35([]).


:- regtype rt38/1.

rt38([]).


:- regtype rt37/1.

rt37([A|B]) :-
        arithexpression(A),
        rt35(B).


:- regtype rt28/1.

rt28([]).


:- regtype rt29/1.

rt29([]).


:- regtype rt31/1.

rt31([]).


:- regtype rt30/1.

rt30([A|B]) :-
        arithexpression(A),
        rt29(B).


:- regtype rt26/1.

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


:- 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([]).