7 FirstOrderLogic
7 FirstOrderLogic
7 FirstOrderLogic
subst(θ, P1 v ... v Pj-1 v Pj+1 v ... v Pn v Q1 v ... Qk-1 v Qk+1 v ... V Qm)
Example: Resolution
• Given: P(x, f(a)) v P(x, f(y)) v Q(y) and
P(z, f(a)) v Q(z),
• Given: Rich(ken)
Rich(x) v unhappy(x)
using θ = {x/ken}
we can conclude that:
unhappy(ken)
Generalized Resolution
• Generalized Resolution inference rule provides a
complete system for proof by refutation.
–Resolution is a generalization of modus ponens
–It requires a normal form, but any sentence can be put into
CNF
• Conjunctive normal form (CNF)
–Each individual sentence is a disjunction of literals. This
form is CNF
–CNF is more common
Example: P(x) v R(x)
Q(y) v S(y)
• Conversion to CNF:
–any FOL sentence can be put into normal form
Steps to convert a FOL sentence to CNF
• Eliminate all connectives: replace (P Q) by ((P Q) ^ (Q P))
• Eliminate all connectives: replace each instance (P Q) by (P v Q)
• Reduce the scope of each negation symbol to a single predicate:
P to P; (P v Q) to P ^ Q; (P ^ Q) to P v Q; (x) P to (x) P,
and (x) P to (x) P
• Eliminate by introducing Skolem symblos/function.
x P(x) converted to P(c) where c is a brand new Skolem constant
symbol that is not used in any other sentence.
– If is within the scope of a universal quantified variable, then introduce a
Skolem function (f). Example, (x)(y)P(x,y) is converted to (x)P(x,
f(x)).
E.g.: x y loves(x,y) converted to x loves(x,f(x)) where f(x) specifies the
person that x loves. (If everyone loved their mother, then f could be
mother_of function)
• Remove by moving quantifiers to the left end and making the
scope of each the entire sentence.
For example, convert x P(x) to P(x).
• Distribute "and" over "or" to get conjunctive normal form.
Convert (P ^ Q) v R to (P v R) ^ (Q v R), and (P v Q) v R to (P v Q v R).
• Split each conjunct into a separate clause, which is just a disjunction
("or") of negated and un-negated predicates, called literals.
Example
Convert the following sentence to CNF
x (P(x) (y (P(y) P(f(x,y))) ^ y(Q(x,y) P(y)))
• Eliminate :
(x)(P(x) v ((y)(P(y) v P(f(x,y))) ^ (y)(Q(x,y) v P(y))))
• Reduce scope of :
(x)(P(x) v ((y)(P(y) v P(f(x,y))) ^ (y)(Q(x,y) ^ P(y))))
• Standardize variables:
(x)(P(x) v ((y)(P(y) v P(f(x,y))) ^ (z)(Q(x,z) ^ P(z))))
• Eliminate :
(x)(P(x) v ((y)(P(y) v P(f(x,y))) ^ (Q(x,g(x)) ^ P(g(x)))))
• Drop universal quantification
(P(x) v ((P(y) v P(f(x,y))) ^ (Q(x,g(x)) ^ P(g(x)))))
• Distribute " ^ " over " v " to get conjunctive normal form
(P(x) v P(y) v P(f(x,y))) ^ (P(x) v Q(x,g(x))) ^ (P(x) v P(g(x)))
• Create separate clauses
P(x) v P(y) v P(f(x,y)), P(x) v Q(x,g(x)), P(x) v P(g(x))
• Standardize variables
P(x) v P(y) v P(f(x,y)), P(z) v Q(z,g(z)), P(w) v P(g(w))
More Example:
Convert the following sentence to CNF
• Everyone who loves all animals is loved by
someone.