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 3444.216 msec.}
{preprocessed for plai in 0.0 msec.}
{analyzed by plai using det with local-control off in 4.0 msec.}
{written file /tmp/tmpnaLB_w/fold2_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), rt14(B), gnd(C) )
         + ( non_det, not_mut_exclusive ).

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

fold(X,[],X).
fold(X,Y,Z) :-
        no(empty(Y)),
        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]), rt12(_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]), rt10(_1), rt11(_2), rt12(_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]), rt5(_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]), rt5(_1), term(T) )
        => ( ground([_1,T]), rt9(_1), gnd(T) )
         + ( is_det, mut_exclusive ).

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

empty([]).

:- true pred no(empty(_1))
         : ( ground([_1]), gnd(_1) )
        => ( ground([_1]), gnd(_1) )
         + ( is_det, mut_exclusive ).

no(X) :-
        call(X),
        !,
        failure(a).
no(_1).

:- true pred failure(a).

failure(b).


:- regtype rt15/1.

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


:- regtype rt14/1.

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


:- regtype rt12/1.

rt12(c).


:- regtype rt13/1.

rt13([]).


:- regtype rt5/1.

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


:- regtype rt9/1.

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


:- regtype rt10/1.

rt10(a).


:- regtype rt11/1.

rt11(b).