2

Suppose we have the following query:

p(X) or q(Y)

After negating it (to perform resolution), we get (in Prolog notation):

:- p(X)

:- q(Y)

My question is that when performing resolution, is the above syntax the same as if I would write it as

:-p(X),q(Y)

It seems unclear when using the second syntax, that only one of the clauses need to be eliminated. But I need to check if it is correct. Thanks in advance

Melanie A
  • 133
  • I'm a Prolog fan, but it seems unclear whether you are asking about program behavior or some more abstract notion of performing resolution. Questions about Prolog syntax per se are better treated at StackOverflow. – hardmath Feb 23 '16 at 14:42
  • The two separate "negations" are more like a single "negation" :- p(X) | q(Y). – hardmath Feb 23 '16 at 14:45
  • @hardmath Thanks. I do not want to perform the resolution by Prolog. I will be doing it myself, but just wondering if the second notation has the same semantics as the first. – Melanie A Feb 23 '16 at 14:51

2 Answers2

0

It seems like you want to use negation to go from disjunctive to a conjunctive form: $$ p(X) \vee q(Y) = \neg(\neg p(X) \wedge \neg q(Y)) $$

mvw
  • 34,562
0

If you start with a logical query $p(X) \lor q(Y)$, this would correspond to a Prolog-style "goal clause":

:- p(X) ; q(Y).

From the standpoint of SLD resolution on Horn clauses, the above query can be interpreted as a logical proposition implying a contradiction or falsehood:

$$ (p(X) \lor q(Y)) \to \textit{false} $$

Reaching the contradiction corresponds in the Prolog programming to success of a goal clause/query.

Now in the context of Prolog programming it does not make sense to identify the single goal clause above to a pair of goal clauses:

:- p(X).
:- q(Y).

It is unclear what exactly you mean by this identification, since there can be only one goal at a time for the Prolog engine to pursue. Although resolution of one goal may lead to attempting subgoals, these are pursued serially.

On the other hand the goal clause:

:- p(X), q(Y).

would ask the Prolog engine to first attempt to satisfy p(X) and if successful, then to attempt to satisfy q(Y) (with the possibility of backtracking into the first goal p(X) if any choice-points are left open when it fails in trying q(Y)).

So the latter goal clause corresponds to the logical query $p(X) \land q(Y)$, not $p(X) \lor q(Y)$.

hardmath
  • 37,015