%one level stratification
%one stable model
%does not pass finite domain check
%returns stable model only if function depth bound is given

a(a).
s(b,c).

r(X,f(X)):- a(X), not rec(X).
r(X,g(X)):- a(X), not rec(X).
s(f(X),g(X)):- a(X), not rec(X).
d(f(X)):- a(X), not rec(X).
d(g(X)):- a(X), not rec(X).

r(h(X,Y),X):- s(X,Y), not d(X), not d(Y).
r(h(X,Y),Y):- s(X,Y), not d(X), not d(Y).
a(h(X,Y)):- s(X,Y), not d(X), not d(Y).
rec(h(X,Y)):- s(X,Y), not d(X), not d(Y).
