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

:- true pred p(s(_2),_1)
         : ( native_props:mshare([[_1]]), var(_1), ground([_2]), term(_1), gnd(_2) )
        => ( ground([_1,_2]), rt2(_1), rt1(_2) )
         + ( is_det, mut_exclusive ).

:- true pred p(s(_1),s(_2))
         : ( native_props:mshare([[_2]]), var(_2), ground([_1]), gnd(_1), term(_2) )
         + fails.

p(s(0),0).
p(s(s(X)),s(s(Y))) :-
        p(s(X),s(Y)).

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

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

:- true pred plus(A,B,C)
         : ( native_props:mshare([[B],[B,C],[C]]), ground([A]), rt2(A), term(B), term(C) )
        => ( native_props:mshare([[B,C]]), ground([A]), rt3(A), term(B), term(C) )
         + ( is_det, mut_exclusive ).

plus(0,Y,Y).
plus(s(X),Y,s(Z)) :-
        p(s(X),U),
        plus(U,Y,Z).


:- regtype rt6/1.

rt6(0).
rt6(s(A)) :-
        rt1(A).


:- regtype rt2/1.

rt2(0).


:- regtype rt3/1.

rt3(0).


:- regtype rt1/1.

rt1(0).