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 3432.214 msec.}
{preprocessed for plai in 0.0 msec.}
{analyzed by plai using det with local-control off in 4.001 msec.}
{written file /tmp/tmpnvZTIx/duplicate2_det_co.pl}
:- module(_1,[duplicate/2],[assertions]).

:- entry duplicate(A,B)
         : ground(A).

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

duplicate([],[]).
duplicate(X,[H,H|Z]) :-
        no(empty(X)),
        head(X,H),
        tail(X,T),
        duplicate(T,Z).

:- true pred head(_2,_1)
         : ( native_props:mshare([[_1]]), ground([_2]), gnd(_2), term(_1) )
        => ( native_props:mshare([[_1]]), ground([_2]), rt6(_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]), rt6(_1), term(T) )
        => ( ground([_1,T]), rt10(_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 rt14/1.

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


:- regtype rt13/1.

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


:- regtype rt16/1.

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


:- regtype rt15/1.

rt15([]).
rt15([A,B|C]) :-
        term(A),
        term(B),
        rt16(C).


:- regtype rt6/1.

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


:- regtype rt10/1.

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