(0) Obligation:

Clauses:

duplicate([], []).
duplicate(X, .(H, .(H, Z))) :- ','(no(empty(X)), ','(head(X, H), ','(tail(X, T), duplicate(T, Z)))).
head([], X1).
head(.(H, X2), H).
tail([], []).
tail(.(X3, T), T).
empty([]).
no(X) :- ','(X, ','(!, failure(a))).
no(X4).
failure(b).

Queries:

duplicate(g,a).

(1) CutEliminatorProof (SOUND transformation)

Eliminated all cuts by simply ignoring them[PROLOG].

(2) Obligation:

Clauses:

duplicate([], []).
duplicate(X, .(H, .(H, Z))) :- ','(no(empty(X)), ','(head(X, H), ','(tail(X, T), duplicate(T, Z)))).
head([], X1).
head(.(H, X2), H).
tail([], []).
tail(.(X3, T), T).
empty([]).
no(X) :- ','(X, failure(a)).
no(X4).
failure(b).

Queries:

duplicate(g,a).