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.
{Reading /tmp/tmpZxNI2M/flatten_phd.pl
}
{loaded in 3376.211 msec.}
{preprocessed for plai in 0.0 msec.}
{analyzed by plai using det with local-control off in 24.002 msec.}
{written file /tmp/tmpZxNI2M/flatten_phd_det_co.pl}
:- module(_1,[count/2],[assertions]).
:- true pred flatten(cons(cons(_2,_3),_1),X)
: ( native_props:mshare([[X]]), var(X), ground([_1,_2,_3]), term(X), gnd(_1), gnd(_2), gnd(_3) )
=> ( ground([X,_1,_2,_3]), rt76(X), rt78(_1), rt44(_2), rt80(_3) )
+ ( non_det, mut_exclusive ).
:- true pred flatten(cons(_1,cons(_2,_3)),X)
: ( native_props:mshare([[X]]), var(X), ground([_1,_2,_3]), term(X), gnd(_1), gnd(_2), gnd(_3) )
=> ( ground([X,_1,_2,_3]), rt76(X), rt44(_1), rt80(_2), rt78(_3) )
+ ( non_det, not_mut_exclusive ).
flatten(atom(X),[X]).
flatten(cons(atom(X),U),[X|Y]) :-
flatten(U,Y).
flatten(cons(cons(U,V),W),X) :-
flatten(cons(U,cons(V,W)),X).
:- entry count(A,B)
: ground(A).
:- true pred count(A,B)
: ( native_props:mshare([[B]]), ground([A]), gnd(A), term(B) )
=> ( ground([A,B]), rt7(A), rt9(B) )
+ ( is_det, mut_exclusive ).
:- true pred count(A,B)
: ( native_props:mshare([[B]]), ground([A]), rt76(A), term(B) )
+ fails.
count(atom(X),s(0)).
count(cons(atom(X),Y),s(Z)) :-
count(Y,Z).
count(cons(cons(U,V),W),Z) :-
flatten(cons(cons(U,V),W),X),
count(X,Z).
:- regtype rt8/1.
rt8(atom(A)) :-
gnd(A).
rt8(cons(atom(A),B)) :-
gnd(A),
rt8(B).
:- regtype rt7/1.
rt7(atom(A)) :-
gnd(A).
rt7(cons(atom(A),B)) :-
gnd(A),
rt8(B).
:- regtype rt10/1.
rt10(0).
rt10(s(A)) :-
rt10(A).
:- regtype rt9/1.
rt9(s(A)) :-
rt10(A).
:- regtype rt23/1.
rt23([]).
rt23([A|B]) :-
gnd(A),
rt23(B).
:- regtype rt31/1.
rt31([A|B]) :-
gnd(A),
rt23(B).
:- regtype rt77/1.
rt77([A|B]) :-
gnd(A),
rt31(B).
:- regtype rt76/1.
rt76([A|B]) :-
gnd(A),
rt77(B).
:- regtype rt79/1.
rt79(atom(A)) :-
gnd(A).
:- regtype rt78/1.
rt78(atom(A)) :-
gnd(A).
rt78(cons(A,B)) :-
rt79(A),
rt78(B).
:- regtype rt46/1.
rt46(atom(A)) :-
gnd(A).
rt46(cons(A,B)) :-
rt46(A),
rt45(B).
:- regtype rt45/1.
rt45(atom(A)) :-
gnd(A).
:- regtype rt44/1.
rt44(atom(A)) :-
gnd(A).
rt44(cons(A,B)) :-
rt46(A),
rt45(B).
:- regtype rt80/1.
rt80(atom(A)) :-
gnd(A).