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 3456.216 msec.}
{preprocessed for plai in 0.0 msec.}
{analyzed by plai using det with local-control off in 8.001 msec.}
{written file /tmp/tmp5nv10w/gopher2_det_co.pl}
:- module(_1,[gopher/2],[assertions]).
:- entry gopher(A,B)
: ground(A).
:- true pred gopher(A,B)
: ( native_props:mshare([[B]]), ground([A]), gnd(A), term(B) )
=> ( ground([A,B]), rt14(A), rt15(B) )
+ ( is_det, mut_exclusive ).
:- true pred gopher(cons(_1,cons(_2,_3)),B)
: ( native_props:mshare([[B],[_1],[_1,_2],[_2]]), ground([_3]), term(B), term(_1), term(_2), gnd(_3) )
+ fails.
gopher(nil,nil).
gopher(X,cons(nil,T)) :-
no(empty(X)),
head(X,nil),
tail(X,T).
gopher(X,Y) :-
no(empty(X)),
head(X,H),
no(empty(H)),
head(H,U),
tail(H,V),
tail(X,W),
gopher(cons(U,cons(V,W)),Y).
:- true pred head(_2,_1)
: ( native_props:mshare([[_2],[_1]]), var(_1), rt32(_2), term(_1) ).
:- true pred head(_1,nil)
: ( native_props:mshare([[_1]]), rt32(_1) ).
:- true pred head(_2,_1)
: ( native_props:mshare([[_2],[_1]]), var(_1), term(_2), term(_1) )
=> ( native_props:mshare([[_2],[_2,_1],[_1]]), rt23(_2), term(_1) )
+ ( is_det, mut_exclusive ).
:- true pred head(_2,_1)
: ( native_props:mshare([[_1]]), var(_1), ground([_2]), gnd(_2), term(_1) )
=> ( native_props:mshare([[_1]]), ground([_2]), rt18(_2), term(_1) )
+ ( is_det, mut_exclusive ).
:- true pred head(_1,nil)
: ( ground([_1]), gnd(_1) )
=> ( ground([_1]), rt8(_1) )
+ ( is_det, mut_exclusive ).
head([],_1).
head([X|_1],X).
:- true pred tail(_1,X)
: ( native_props:mshare([[X]]), var(X), ground([_1]), rt18(_1), term(X) )
=> ( ground([_1,X]), rt31(_1), gnd(X) )
+ ( is_det, mut_exclusive ).
:- true pred tail(_1,X)
: ( native_props:mshare([[_1],[X]]), var(X), rt23(_1), term(X) )
=> ( native_props:mshare([[_1],[_1,X]]), rt27(_1), term(X) )
+ ( is_det, mut_exclusive ).
:- true pred tail(_1,X)
: ( native_props:mshare([[X]]), ground([_1]), rt8(_1), term(X) )
=> ( ground([_1,X]), rt12(_1), gnd(X) )
+ ( is_det, mut_exclusive ).
tail([],[]).
tail([_1|X],X).
empty([]).
:- true pred no(empty(_1))
: ( native_props:mshare([[_1]]), rt32(_1) )
=> ( native_props:mshare([[_1]]), rt32(_1) )
+ ( is_det, mut_exclusive ).
:- true pred no(empty(_1))
: ( native_props:mshare([[_1]]), term(_1) )
=> ( native_props:mshare([[_1]]), term(_1) )
+ ( is_det, mut_exclusive ).
:- 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 rt14/1.
rt14([]).
rt14(nil).
rt14([A|B]) :-
rt6(A),
gnd(B).
:- regtype rt15/1.
rt15(nil).
rt15(cons(nil,A)) :-
gnd(A).
:- regtype rt32/1.
rt32(cons(A,cons(B,C))) :-
term(A),
term(B),
gnd(C).
:- regtype rt18/1.
rt18([]).
rt18([A|B]) :-
gnd(A),
gnd(B).
:- regtype rt31/1.
rt31([]).
rt31([A|B]) :-
gnd(A),
gnd(B).
:- regtype rt23/1.
rt23([]).
rt23([A|B]) :-
term(A),
term(B).
:- regtype rt27/1.
rt27([]).
rt27([A|B]) :-
term(A),
term(B).
:- regtype rt8/1.
rt8([]).
rt8([A|B]) :-
rt6(A),
gnd(B).
:- regtype rt6/1.
rt6(nil).
:- regtype rt12/1.
rt12([]).
rt12([A|B]) :-
rt6(A),
gnd(B).