Predicate Logic
Predicate Logic
Well-formed formulas:
~ weather_is_rainy
joe_has_an_umbrella weather_is_rainy
Truth table
Relationships
DeMorgan’s Laws
Commutative Laws
~(∃x)p(x) is equivalent to (∀x)[~p(x)]
Associative Law Contra positive
Contra positive LawX ⟹Y is equivalent to ~Y ⟹~X
~(∀x) p(x) is equivalent to (∃x) [~p(x)]
are
⋁
sound
Thus, (∀x)(∀y)[P(x) ⋁ Q(y) is logically follows from {(∀x)(∀y)[P(x)
The
Q(y)], truth table
(∀z) [R(z) method can always be used to
⋁ Q(A)]}
determine the validity of any wff that does not
Or,
Rule of
P(A) logically
contain follows from (∀x)P(x)
variables.
Modus ponens???
1. Pattern matching
2. Uniform consistence substitution.
Example:
The following knowledge is given :
• This is true only for the simple statements we are using. It would be worse if we
had implications with more than a single terms on the right or the complicated
expressions involving ands and ors on the left.
Assignment
Consider the following sentences:
• Amit likes all kinds of food.
• Apples are food.
• Chicken is food.
• Anything anyone eats and is not killed by is food.
• Arjun eats peanuts and is still alive.
• Sree eats everything Arjun eats.
After Step 1
(∀x){~P (x) ⋁ {(∀y)[~ P (y) ⋁ P(f (x, y))] ∧ ~ ( ∀y)[~Q(x, y) ⋁ P(y)]}}
After Step 2
After Step 3
After Step 4
(∀x){~P (x) ⋁ {(∀y)[~ P (y) ⋁ P(f (x, y))] ∧ [Q(x, g (x)) ∧ ~P(g (x))]}}
Algorithm: Convert to clause Form
(∀x){P (x) ⟹ {(∀y)[ P (y) ⟹ P(f (x, y))] ∧ ~ ( ∀y)[ Q(x, y) ⟹ P(y)]}}
After Step 5
(∀x) (∀y){~P (x) ⋁ {[~ P (y) ⋁ P(f (x, y))] ∧ [Q(x, g (x)) ∧ ~P(g (x))]}}
After Step 6
~P (x) ⋁ {[~ P (y) ⋁ P(f (x, y))] ∧ [Q(x, g (x)) ∧ ~P(g (x))]}
Algorithm: Convert to clause Form
(∀x){P (x) ⟹ {(∀y)[ P (y) ⟹ P(f (x, y))] ∧ ~ ( ∀y)[ Q(x, y) ⟹ P(y)]}}
After Step 7
Let us check how can we do
{~P (x) ⋁ ~ P (y) ⋁ P(f (x, y))] ∧ [~P (x) ⋁ Q(x, g (x)) ∧ [~P(x) ⋁ ~P(g (x))]}
this:
(W ∧ We) ⋁ (S ∧ Ws)=
8. Create a separate clause corresponding to each conjunct.
After Step 9
1.
2.
Assignment
{~P (x) ⋁ ~ P (y) ⋁ P(f (x, y))]
[~P (x1) ⋁ Q(x1, g (x1))
3. Convert
[~P(x2) ⋁the
~P(g (xfollowing
2))]}
wffs to clause form:
Each (∀x)(∃y){[P (x) ⟹ Q(y, x)] ∧[ Q(y, x) ⟹
clause
If terms notiscontaining
a separate variables
conjuct and aresince all the variables
substituted are universally
for the variables in an
quantified,
expression,there need bethe
we obtain noground
relationship between
instance of the the variables of two
literals.
S(x, y)]} ⟹ (∃x) (∀y)[ P(x, y) ⟹ S(x, y)]
clauses, even
Q(A,if f(g(B)))
they wereis agenerated from the
ground instance ofsame
Q(x, y)wff.
Resolution Procedure
The resolution procedure is a simple iterative process.
At each step, two clauses, called the Parent Clauses, are
• resolved
Resolutionyielding a new
operates byclause
takingthat hasclauses
two been inferred from
that each
them. the same literal.
contain
• The
The literals mustrepresents
new clause occur in positive
way thatform in one
the two clause
parent and
clauses
negative form in the other.
interact with each other.
• The resolvent is obtained by combining all of the literals
1. Winter ⋁ Summer
of two parent clauses expect the ones that cancel.
• If the clause that is ~ winter ⋁
2. produced is cold
the empty clause, then a
Thus, we
contradiction hassee that
been from these two clauses we
found.
can deduce:
•If contradiction exists, then eventually it will found.
•If no contradiction Summer ⋁ cold
exists, then it is possible that the
Thiswill
procedure is never
the deduction
terminate. that the resolution
procedure will make.
Resolution Procedure
The theoretical basis of the resolution procedure in
predicate logic is Herbrand’s theorem:
To show that a set of clauses S is un-satisfiable, it is
necessary to consider only interpretations over a particular
set
A set of clauses S is un-satisfiable if and only if a finite
subset of ground instances of S is un-satisfiable.
Resolution in Propositional Logic
The procedure for producing a proof by resolution of proposition
P with respect to a set of axioms F is as follows:
P ⟹ ~Q Tautologies
~P ⟹ Q
P⟹Q Chaining
Q⟹R
The Unification Algorithm
P (z, z)
P (z, z) It should
We write the
generate thecomposition
Most as:
The entire unification process has now succeeded
(z/y)(y/x)
with a substitutiongeneral Unifier
that is the composition of
substitutions.
The Unification Algorithm
P[z, f(w), B]
P [x, f(A), B] The ground instance is P[C, f(A), B]
P[g(z), f(A), B]
P[C, f(A), B]
To denote a substitution instance of an expression E, using
substitution s, we write Es:
P[z, f(w), B] = P[x, f(y), B]s1.
Unification Process
The composition of two substitutions S1 and S2 is denoted by S1S2, which
is that substitution obtained by applying S2 to the terms of S1 and then
adding any pairs of S2 having variables not occurring among the variables
of S1.
S = {A/x, B/y}
S1 =B],
{P[x, f(y), {g(x, y)/z}
P[x, f(B), B]}
S2 = {A/x, B/y, C/w, D/z}
It yield to substitution Instance as {P[A, f(B), B]}
Algorithm: Propositional
Thus, in order to use Resolution
1. resolution
Convert all the for predicate
propositions of F to clause form
logic, we use the unification
2. Negate P algorithm
and convert to locate pairs ofto clause form. Add it to
the result
literalsobtained
the set of clauses that cancel
in out.
step 1.
Control Strategies:
• Rule of Thumb
Only resolve
• Set - Whenever
of - support possible,
strategypairs of clauses
resolve that contain
with clauses that have a
complementary
Whenever
single literal.possible,
Suchliterals,
resolve
sinceeither
resolutions only such
withnew
generate resolutions
one clauses
of the
• Unit clauses
produce
– that
newisliterals
Preference
with fewer clauses
part ofthan
Strategy that
the statement
are harder
the larger wetothe
of are
satisfy
trying
than
parent to
their
refute
parents.
clauses or with
and Toaare
thus facilitate
clause generated
this,closer
probably index
bytoclauses
a the
resolution
byof
goal the
a
predicates they
withcontain,
resolvent such
withazero
clause.
combined
terms. with an
indication of whether the predicate is negated.
Control Strategies:
• Breadth – First Strategy
All–of
• Linear the first
input form –Strategy
level resolvents are computed first,
Example:
then the second – level reslovent and so on. A first
The linear-input form strategies are not complete;
–Inlevel
• Ancestry this
– resolvent
controlForm
Filtered strategy
is one between
at least one
Strategy twoparent
clausesclause
in the
There
A clause
The are cases
basein an
set in which
unsatisfiable
of the a
clausescontradiction
set that is exists
subsumed but by
The base
base set; an i-th set of
belongs the clauses
level relovent
to the base is one
set.whose deepest
Inanother
Anyparent
this clause
clause
control it isinnot
the
containing
strategy
Clauses
are: like:able
seta
each to
can find
be
literal
resloventit. its
eliminated
and hasnegationwithout
a parent
A clause {L are:
is an (i-1)th level resolvent.
• Elimination
“To see Of
affecting i} subsumes
that a clause
linear-input
Tautologies
the form
unsatisfiability {Mirefutation
}ofifthe
there exists
does a not
that
1.1. (Tautology)
Itis~I(z)
P(x) ⋁
either
Q(u)
is ⋁⋁ in
completeB(y) ⋁ may
thebut
P(A)
R(z) base be eliminated,
it isset
~B(y) is an ancestorset.
rest
since
or thatinefficient.
grossly of the
any of
always
substitution
the other
2. s~Q(w)
And such exist
that
“Eliminating
unsatsifiableparent.
⋁ for
P(w) unsatisfiable
{Lset
i}s clauses
This iscontrol
a subset
containing sets,
of
subsumed
a {M consider
i}. is
As
tautology
strategy by the
example
others
is still
complete.
2. I(A) P(x) subsumes P(y)⋁ Q(z)
example:”
• Elimination3.3.frequently
P(f(A))
~Q(x)
~R(x)
By ⋁ ⋁L(x)
Subsumptionleads
unsatisfiable
⋁ ~P(f(A))
~P(x) to substantial
P(x) subsumes P(A) reduction
after removing it. in the
4.4.number
May of
Q(y)be⋁eliminated
~D(y) resolutions
~P(y)
~L(x)
P(x) subsumes P(A) that need
⋁ Q(z) to be made in
5. P(x)
D (A) finding aP(f(A))refutation.”
• Combinations of⋁Q(A)
Strategiessubsumes ⋁Q(A) ⋁R(y)
Importance of standardize the variable
apart: Example
Given Axioms:
1. Father (x, y) ⟹ ~woman (x)
2. Mother(x, y) ⟹ woman (x)
3. Mother (Chirs, mary)
4. Father (Chirs, Bill)
The Correct clause form
1. ~father(x,
Converted y) ⋁ ~woman
to clause form (x)
1.2. ~father(x,
~mother(x 1, ⋁
y) ) ⋁ woman
y1~woman (x)(x1)
The Contradiction will not
2.3. ~mother(x,
Mother (chirs,
y) ⋁mary)
generate.woman
The need(x)
to
3.4. Mother
Father (chirs, Bill) Variables.
mary)
standardize
4. Father (chirs, Bill)
Examples:
Clause
1. Whoever can read is literate. form
(∀x)[R(x) ⟹ L (x)] ~ R(x) ⋁ L(x)
2. Dolphins are not literate.