(0) Obligation:

Clauses:

flatten(atom(X), Y) :- ','(!, eq(Y, .(X, []))).
flatten(L, Y) :- ','(head(L, atom(H)), ','(!, ','(eq(Y, .(H, Z)), ','(tail(L, T), flatten(T, Z))))).
flatten(L, X) :- ','(head(L, cons(U, V)), ','(tail(L, W), flatten(cons(U, cons(V, W)), X))).
head(nil, X1).
head(cons(H, X2), H).
tail(nil, nil).
tail(cons(X3, T), T).
eq(X, X).

Query: flatten(g,a)

(1) PrologDeterminacyProcessorProof (EQUIVALENT transformation)

The root node satisfies the determinacy criterion.

(2) YES