What would result from something like the following:
p(X,Y) :- q(X).
p(X,Y) :- r(Y).
q(a).
r(b).
I don't have a Prolog compiler handy, so I can't test what would happen if you then asked p(X,Y)
. Would the code even compile? Would p
return two answers, each with one of the variables unbound?
In a real world scenario, I don't think p(X,Y)
would make much sense (one would probably rather want p(X)
to follow from either q(X)
or r(X)
), but I'm interested in what actually happens here, and peripherally, what should happen in such a degenerate case.