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

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

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

goal(A,B,C) :-
        s2l(A,D),
        applast(D,B,C).

:- true pred applast(L,X,Last)
         : ( native_props:mshare([[L],[X],[X,Last],[Last]]), rt10(L), term(X), term(Last) )
        => ( native_props:mshare([[L],[L,X],[L,X,Last],[L,Last],[X],[X,Last],[Last]]), rt33(L), term(X), term(Last) )
         + ( is_det, mut_exclusive ).

applast(L,X,Last) :-
        app(L,[X],LX),
        last(Last,LX).

:- true pred last(X,Y)
         : ( native_props:mshare([[X],[X,Y],[Y]]), term(X), rt35(Y) )
        => ( native_props:mshare([[X,Y],[Y]]), term(X), rt42(Y) )
         + ( is_det, mut_exclusive ).

:- true pred last(X,Y)
         : ( native_props:mshare([[X],[X,Y],[Y]]), term(X), rt36(Y) )
        => ( native_props:mshare([[X,Y],[Y]]), term(X), rt40(Y) )
         + ( is_det, mut_exclusive ).

last(X,[X]) :- !.
last(X,Y) :-
        tail(Y,T),
        last(X,T).

:- true pred app(X,[_1],Z)
         : ( native_props:mshare([[X],[Z],[_1]]), var(Z), rt10(X), term(Z), term(_1) )
        => ( native_props:mshare([[X],[X,Z],[Z],[Z,_1]]), rt33(X), rt35(Z), term(_1) )
         + ( is_det, mut_exclusive ).

:- true pred app(X,Y,Z)
         : ( native_props:mshare([[X],[Y],[Z]]), var(Z), rt11(X), rt14(Y), term(Z) )
        => ( native_props:mshare([[X],[X,Z],[Y,Z],[Z]]), rt28(X), rt12(Y), rt26(Z) )
         + ( is_det, mut_exclusive ).

app([],Y,Z) :-
        !,
        eq(Y,Z).
app(X,Y,[H|Z]) :-
        head(X,H),
        tail(X,T),
        app(T,Y,Z).

:- true pred s2l(X,L)
         : ( native_props:mshare([[L]]), var(L), ground([X]), gnd(X), term(L) )
        => ( native_props:mshare([[L]]), ground([X]), rt8(X), rt10(L) )
         + ( is_det, mut_exclusive ).

s2l(0,L) :-
        !,
        eq(L,[]).
s2l(X,[_1|Xs]) :-
        p(X,P),
        s2l(P,Xs).

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

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

:- true pred tail(_1,Xs)
         : ( native_props:mshare([[_1],[Xs]]), var(Xs), rt17(_1), term(Xs) )
        => ( native_props:mshare([[_1],[_1,Xs]]), rt21(_1), rt11(Xs) )
         + ( is_det, mut_exclusive ).

:- true pred tail(_1,Xs)
         : ( native_props:mshare([[_1],[Xs]]), var(Xs), rt35(_1), term(Xs) )
        => ( native_props:mshare([[_1],[_1,Xs]]), rt38(_1), rt36(Xs) )
         + ( is_det, mut_exclusive ).

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

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

p(0,0).
p(s(X),X).

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

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

eq(X,X).


:- regtype rt9/1.

rt9(0).
rt9(A) :-
        gnd(A).
rt9(s(A)) :-
        rt9(A).


:- regtype rt8/1.

rt8(0).
rt8(s(A)) :-
        rt9(A).


:- regtype rt10/1.

rt10([]).
rt10([A|B]) :-
        term(A),
        rt11(B).


:- regtype rt34/1.

rt34([]).
rt34([A|B]) :-
        term(A),
        rt34(B).


:- regtype rt33/1.

rt33([]).
rt33([A|B]) :-
        term(A),
        rt34(B).


:- regtype rt35/1.

rt35([A|B]) :-
        term(A),
        rt36(B).


:- regtype rt43/1.

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


:- regtype rt42/1.

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


:- regtype rt36/1.

rt36([]).
rt36([A|B]) :-
        term(A),
        rt36(B).


:- regtype rt41/1.

rt41([]).
rt41([A|B]) :-
        term(A),
        rt41(B).


:- regtype rt40/1.

rt40([]).
rt40([A|B]) :-
        term(A),
        rt41(B).


:- regtype rt17/1.

rt17([]).
rt17([A|B]) :-
        term(A),
        rt11(B).


:- regtype rt21/1.

rt21([]).
rt21([A|B]) :-
        term(A),
        rt11(B).


:- regtype rt11/1.

rt11([]).
rt11([A|B]) :-
        term(A),
        rt11(B).


:- regtype rt38/1.

rt38([A|B]) :-
        term(A),
        rt36(B).


:- regtype rt14/1.

rt14([A]) :-
        term(A).


:- regtype rt29/1.

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


:- regtype rt28/1.

rt28([]).
rt28([A|B]) :-
        term(A),
        rt29(B).


:- regtype rt12/1.

rt12([A]) :-
        term(A).


:- regtype rt27/1.

rt27([]).
rt27([A|B]) :-
        term(A),
        rt27(B).


:- regtype rt26/1.

rt26([A|B]) :-
        term(A),
        rt27(B).


:- regtype rt5/1.

rt5(0).
rt5(s(A)) :-
        gnd(A).


:- regtype rt0/1.

rt0([]).