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 3408.213 msec.}
{preprocessed for plai in 0.0 msec.}
{analyzed by plai using det with local-control off in 8.001 msec.}
{written file /tmp/tmp9rXHTa/fold1_det_co.pl}
:- module(_1,[fold/3],[assertions]).

:- entry fold(A,B,C)
         : ( ground(A), ground(B) ).

:- true pred fold(A,B,C)
         : ( native_props:mshare([[C]]), ground([A,B]), gnd(A), gnd(B), term(C) )
        => ( ground([A,B,C]), gnd(A), rt12(B), gnd(C) )
         + ( is_det, mut_exclusive ).

:- true pred fold(A,B,C)
         : ( native_props:mshare([[C]]), ground([A,B]), rt10(A), gnd(B), term(C) )
        => ( ground([A,B,C]), rt10(A), rt11(B), rt10(C) )
         + ( is_det, mut_exclusive ).

fold(X,[],Z) :-
        !,
        eq(X,Z).
fold(X,Y,Z) :-
        head(Y,H),
        tail(Y,T),
        myop(X,H,V),
        fold(V,T,Z).

:- true pred myop(_1,_2,_3)
         : ( native_props:mshare([[_2],[_3]]), var(_3), ground([_1]), rt10(_1), term(_2), term(_3) ).

:- true pred myop(_1,_2,_3)
         : ( native_props:mshare([[_2],[_3]]), var(_3), ground([_1]), gnd(_1), term(_2), term(_3) )
        => ( ground([_1,_2,_3]), rt8(_1), rt9(_2), rt10(_3) )
         + ( is_det, mut_exclusive ).

myop(a,b,c).

:- true pred head(_2,_1)
         : ( native_props:mshare([[_1]]), var(_1), ground([_2]), gnd(_2), term(_1) )
        => ( native_props:mshare([[_1]]), ground([_2]), rt3(_2), term(_1) )
         + ( is_det, mut_exclusive ).

head([],_1).
head([H|_1],H).

:- true pred tail(_1,T)
         : ( native_props:mshare([[T]]), var(T), ground([_1]), rt3(_1), term(T) )
        => ( ground([_1,T]), rt7(_1), gnd(T) )
         + ( is_det, mut_exclusive ).

tail([],[]).
tail([_1|T],T).

:- true pred eq(X,_1)
         : ( native_props:mshare([[_1]]), ground([X]), rt10(X), term(_1) )
        => ( ground([X,_1]), rt10(X), rt10(_1) )
         + ( is_det, mut_exclusive ).

:- true pred eq(X,_1)
         : ( native_props:mshare([[_1]]), ground([X]), gnd(X), term(_1) )
        => ( ground([X,_1]), gnd(X), gnd(_1) )
         + ( is_det, mut_exclusive ).

eq(X,X).


:- regtype rt13/1.

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


:- regtype rt12/1.

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


:- regtype rt10/1.

rt10(c).


:- regtype rt11/1.

rt11([]).


:- regtype rt3/1.

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


:- regtype rt7/1.

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


:- regtype rt8/1.

rt8(a).


:- regtype rt9/1.

rt9(b).