0% found this document useful (0 votes)
14 views

Predicate Logic

This document discusses first order predicate logic and how it can be used to represent knowledge. It defines the basic concepts and notation of predicate logic, including predicates, terms, variables, and quantifiers. It also discusses how predicate logic can be used to represent relationships between entities and derive new facts through inference.

Uploaded by

itsdurgesh1oo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Predicate Logic

This document discusses first order predicate logic and how it can be used to represent knowledge. It defines the basic concepts and notation of predicate logic, including predicates, terms, variables, and quantifiers. It also discusses how predicate logic can be used to represent relationships between entities and derive new facts through inference.

Uploaded by

itsdurgesh1oo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 60

First order Predicate Logic

One particular way of representing facts- The language of


logic.
It immediately suggest a powerful way of deriving new
knowledge from old- mathematical Deduction.

A new statement is true by proving that it follows from the


statements that are already known.

To include deduction as a way of deriving answers to questions


and solutions to problems
Mathematics is no different from any other complex
intellectual endeavor in requiring both reliable deductive
mechanisms and a mass of heuristic knowledge to control what
would otherwise be a completely intractable search problem.
First order Predicate Logic
The FOPL is used as a way of representing knowledge
because it permits representations of things that cannot
There do
reasonably beexist procedure
represented that will find
in propositional a proof of a
logic.
A
Aproposed
majorsimple
theorem
motivationsuch
if procedure
forindeed it istoa use
choosing theorem.is istothat if we
logic
use logical statement as a way of representing knowledge, then
use the rules of inference to
we have available a good way of reasoning with that knowledge.
But these
generate procedures
theorems from arethe
Determining the validity of a proposition in propositional
not guaranteed to Truth
logicaxioms halt Tableif
in some
is straightforward.
FOPL orderly
is fashion,
not
But the the proposed
predicate statement
logic does not involve is any decision
testing
procedure for each
the to
decidable,
not a theorem.
quantified see
Wff’s. if
it it
is is the
one for which
semi a
decidable proof is
sought.
First order Predicate Logic
The first order predicate calculus is a formal language in
which a wide variety of statements can be expressed.
Thesuch as
A language atomic formulas
the predicate in
calculus, is defined by its
Syntax. predicate are composed
Predicate Symbol Variable Symbols of
The syntax is specified by the alphabet of symbols to be
predicate symbols and terms.
used in the language and how these symbols are to be put
together Like;
to form legitimate expressions in the language.
A predicate
P(x)
The legitimate Termsymbol
expressions Symbol is usedcalculus
of the predicate to are
called therepresent a (wffs).
Well-formed formula relation in a
domain ofsymbol
Predicate
The elementary
discourse.
components of the predicate calculus
Function Symbol Constant symbol
language are:
Basic concepts:
In propositional logic:
The alphabet: 
connectors
weather_is_rainy punctuation
  ~
joe_has_an_umbrella
  ( )
Atomic propositions

Well-formed formulas:

~ weather_is_rainy
joe_has_an_umbrella  weather_is_rainy

Notation: p, q, r : atomic propositions.


Semantics (meaning)
 In general (for all knowledge representation formalisms):

 2 approaches to define semantics:

1. Intuitive (natural) semantics:


 Describe the meaning by means of a natural language
 Exs. (propositional logic):
  : “implies”
 ~ : “not true that”
  : “or”
 p  q : “p if and only if q”
 ~ p  r : “not p and r”
 every symbol and every well-formed formula gets
meaning through the associated natural language
Semantics (meaning)
 In general (for all knowledge representation formalisms):

 2 approaches to define semantics:

1. Intuitive (natural) semantics:


 Describe the meaning by means of a natural language
 Exs. (propositional logic):
  : “implies”
 ~ : “not true that”
  : “or”
 p  q : “p if and only if q”
 ~ p  r : “not p and r”
 every symbol and every well-formed formula gets
meaning through the associated natural language
Connectives
John likes mary, and John likes Sue

John lives in yellow house


Lives(John, House)∧Color(House, Yellow)

John plays centerfield or shortstop


Play(John, Centerfield) ⋁Play(John, Shortstop)

If the car belongs to john, then it is green.


Owns(John, Car)⟹Color(Car, Green)
Voltaire did not write Computer Chess
~Write(Voltaire, Computer_Chess)
QUANTIFICATION
Sometimes an atomic formula, like P(x), has value T no
matter what assignment is given to the variable x.

Or, Such an atomic formula may have value T for


at least one value of x.
In the predicate calculus these properties are used in
establishing the truth values of formulas containing
constructs called quantifiers.

All elephants are black

Some one wrote Gita.


QUANTIFICATION
Using the syntactic rules we can build arbitrarily complex
Wffs, and we can compute whether or not an arbitrary
expression is a wff.

(∃x){(∀y)[(P(x, y) ∧Q(y, x))⟹R(x)]}


~(∀q){(∃x)[P(x)⋁R(q)]}
~p[A, g(A,B,A)]
{~[p(A) ⟹P(B)]} ⟹P(B)

Some examples of expressions that are not wffs are:


~f(A)
f[P(A)]
Q{f(A),[P(B) ⟹Q(c)]}
Interpretation:
= a function that assigns a truth value to each
“atomic” formula

Also provides (indirectly) truth values for each


well-formed formula

p q ~p pq pq pq pq


T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T

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)]

(∀x)[p(x)∧Q(x)] is equivalent to (∀x)p(x) ∧ (∀y)Q(y)

(∃x)[p(x)∧Q(x)] is equivalent to (∃x)p(x) ∧ (∃y)Q(y)


(∀x)p(x) is equivalent to (∀y)p(y)
(∃x) p(x) is equivalent to (∃y) p(y)
Predicate calculus
Rules of inference,
Theorems and proofs
Every city has a dogcatcher who has been bitten by every
dog in city.

(∀x){City(x)⟹(∃y){Dogcatcher(y) ∧ Lives_in (x , y) (∀z)


{[Dog(z)∧ Lives_in (x, z)] ⟹ Bit (y , z)}}}
Univer
Modus
sal
ponen Special
s ization
VALIDITY AND SATISFIABILITY
If
 a same
If the Wffinterpretation
has the makesValuewffTin for all wfffs
a set of possible
have
the
Rule of
interpretations, it say
value T, then we
set of wffs.
is called Valid
that this . Tautologies
interpretation satisfies the

Thus, by the truth • derivable


inference table,
interpretation satisfying S•Logically
the Wff P(A) ⟹[P(A) ⋁
A wff X logically follows from a set of wffs S if every
P(B)] has the value T ; Therefore, it isfollows
also satisfies X.
valid.

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.

inference •Logically follows


Or, (∀x)Q(x) logically follows from the set {( ∀x)[~P(x) ⋁ Q(x)],
(∀But it will not possible for the case where we have
x)P(x)}.
are
the quantifiers. •Derivable
complete
Predicate logic In AI Systems
So despite the theoretical un-decidability of predicate
logic, it can serve as a useful way of representing and
manipulating some of the kinds of knowledge that an AI
system need.

Let’s now explore the use of predicate logic as a way


of representing knowledge by looking at a specific
example.
Example:
 The following knowledge is given :
1. Marcus was a man.
2. Marcus was a Pompeian.
3. All Pompeians were Romans.
4. Caesar was a ruler.
5. All Romans were either loyal to Caesar or hated him.
6. Everyone is loyal to someone.
7. People only try to assassinate rulers to whom they are not
loyal.
8. Marcus tried to assassinate Caesar.

 Can we automatically answer the following questions?


 Was Marcus loyal to Caesar?
 Did Marcus hate Caesar?
Conversion to
the First Order Logic:
 Representation of facts:

1. Marcus was a man.


man(Marcus)

2. Marcus was a Pompeian.


Pompeian(Marcus)

4. Caesar was a ruler.


ruler(Caesar)

8. Marcus tried to assassinate Caesar.


try_assassinate(Marcus,
Caesar)
Conversion to
the First Order Logic (2):
 General representation (representation of rules):
3. All Pompeians were Romans.
x Pompeian(x)  Roman(x)

5. All Romans were either loyal to Caesar or hated him.


x Roman(x)  (loyal_to(x,Caesar)  hates(x,Caesar) )

6. Everyone is loyal to someone.


x y loyal_to(x,y)

7. People only try to assassinate rulers to whom they are not


loyal.
xy person(x)  ruler(y)  try_assassinate(x,y) 
~loyal_to(x,y)
The “theorem” ?
Was Marcus loyal to Caesar?

Try, for example, to prove that he was not :


~loyal_to(Marcus,Caesar)

Did Marcus hate Caesar?

Prove that he did:


hates(Marcus,Caesar)
A proof using backward-
reasoning problem-reduction:
~loyal_to(Marcus,Caesar)
xy person(x)  ruler(y) 
try_assassinate(x,y)  ~loyal_to(x,y)
+ substitution: x/Marcus
y/Caesar
AND
person(Marcus)  ruler(Caesar)  try_assassi-
nate(Marcus,Caesar)  ~loyal_to(Marcus,Caesar)
+ Modus ponens
person(Marcus)
try_assassinate(Marcus, Caesar)
Extra rule:
x man(x)
 person(x)
ruler(Cesar)
8.
4.
man(Marcus) 1.
Done! Done! Done!
Three important issues:
 Many English sentences are ambiguous. Choosing
the correct interpretation may be difficult.

 There is often a choice of how to represent the


knowledge. Simple representations are desirable,
but they may preclude certain kind of reasoning.
The expedient representation for a particular set
of sentences depends on use to which the
knowledge contained in the sentences will be put.
Even in very simple situations, a set of sentences is unlikely to
contain all the information necessary to reason about the topic
at hand. In order to be able to use set of statements
effectively, it is usually necessary to have access to another
set of statements that represent facts that people consider
too obvious to mention.
Problems:
2) Problem solving:
 We do not know in advance which statements to
deduce.

 What deduction rules are needed in general?


 Example: prove “ hates(Marcus,Caesar) “
The only applicable rule is:
x Roman(x)  loyal_to(x,Caesar)  hates(x,Caesar)

Modus ponens???

 How do we handle x and y ?


Problems:
2) Problem solving (2):
 How to compute substitutions in the general case ?
xy person(x)  ruler(y) 
try_assassinate(x,y)  ~loyal_to(x,y)
In general: + substitution: x/Marcus
more complex y/Caesar

 Which theorem do we try to prove?


 Ex.: loyal_to(Marcus,Caesar) or ~loyal_to(Marcus,Caesar)

 How to handle equality of objects?


 Problem: combinatorial explosion of the derived equalities
(reflexivity, symmetry, transitivity, …)

 How to guarantee correctness/completeness?


Computable Functions and
predicates
Whatever proof procedure we use, when it comes upon
one of these predicates, instead of searching for it
explicitly in the database or attempting to deduce it by
further reasoning, we can simply invoke a procedure,
which we will specify in addition to our regular rules,
that will evaluate it and return true or false.

1. Pattern matching
2. Uniform consistence substitution.
Example:
 The following knowledge is given :

1. Marcus was a man.


2. Marcus was a Pompeian.
3. Marcus was born in 40 A. D.
4. All men are mortal
5. All Pompeians died when the volcano erupted in 79 A.D.
6. No mortal lives longer than 150 years.
7. It is now 2011
8. Alive means not dead
9. If someone dies, then he is dead at all later times

 Can we automatically answer the following questions?


 Is Marcus alive?
important issues:
 The two things should be clear in backward reasoning
method:

Even very simple conclusions can require many steps to prove

A variety of processes, such as matching, substitution and application of


modus ponens are involved in the production of proof.

• 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.

(a) Translate these sentences into Wffs of predicate


logic.
(b) Prove that Amit likes peanuts using backward
chaining.
Resolution
 It is a proof procedure that carried out in a single operation
the variety of processes involved in reasoning with
statement in predicate logic.
 Resolution is such a procedure, which gains its efficiency
from the fact that it operates on statement that have been
converted to a very convenient standard from known as
Clause form.
 Clause form is the disjunction of literals.
 It can be derived from the Conjunctive normal form of the
predicate wff’s or It is consider as the conjunction of
disjunctions.
 Resolution produces proofs by the principle of Refutation.
Conversion to Clause Form
“All Romans who know Marcus either hate Caesar or think that anyone
who hats someone is crazy.”

Conjunctive normal form has both of these properties:


~Roman(x)
∀x:[Roman (x)∧know(x,
⋁ ~know(x, Marcus)Marcus)]
⋁ hate⟹(x,[hate(x,
Caesar) ⋁
Caesar)⋁(~hate
∀y:∃z:hate
(y, z) ⋁(y, z) ⟹ think_crazy
think_crazy (x, y) (x, y))]

It were flatter, i.e. there was less embedding of


Itcomponents.
is necessary To to
make theright
do the process easier,
thing with the
the formula should
rest of the formula
including the be
The quantifiers in the
pieces easier
inwere form. The easier
whichseparated
the matched partform
from the of the
rest of the
is embedded and those
informula
which it issonot.
that they did formula
not will
need be to
if: be considered.
Algorithm: Convert to clause Form
(∀x){P (x) ⟹ {(∀y)[ P (y) ⟹ P(f (x, y))] ∧ ~ ( ∀y)[ Q(x, y) ⟹ P(y)]}}

1. Eliminate implication symbols.

After Step 1
(∀x){~P (x) ⋁ {(∀y)[~ P (y) ⋁ P(f (x, y))] ∧ ~ ( ∀y)[~Q(x, y) ⋁ P(y)]}}

2. Reduce the scope of negation symbols.

After Step 2

(∀x){~P (x) ⋁ {(∀y)[~ P (y) ⋁ P(f (x, y))] ∧ ( ∃y)[Q(x, y) ∧ ~P(y)]}}


Algorithm: Convert to clause Form
(∀x){P (x) ⟹ {(∀y)[ P (y) ⟹ P(f (x, y))] ∧ ~ ( ∀y)[ Q(x, y) ⟹ P(y)]}}

3. Standardize variable so that each quantifier binds unique variable.

After Step 3

(∀x){~P (x) ⋁ {(∀y)[~ P (y) ⋁ P(f (x, y))] ∧ ( ∃w)[Q(x, w) ∧ ~P(w)]}}

4. Eliminate existential quantifiers (Skolem Function or Skolem Constant)

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)]}}

5. Convert to prenex form

After Step 5

(∀x) (∀y){~P (x) ⋁ {[~ P (y) ⋁ P(f (x, y))] ∧ [Q(x, g (x)) ∧ ~P(g (x))]}}

6. Drop the prefix

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)]}}

7. Convert the matrix into a conjunction of disjuncts.

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(W8 ⋁S) ∧ (W ⋁ Ws) ∧ (We ⋁


S) ∧ (We ⋁ Ws)
1. {~P (x) ⋁ ~ P (y) ⋁ P(f (x, y))]
2. [~P (x) ⋁ Q(x, g (x))
3. [~P(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)]}}

9. Standardize apart the variables in the set of clauses. So that no variable


symbol appears in more than one clause.

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:

Algorithm: Propositional Resolution


1. Convert all the propositions of F to clause form

2. Negate P and convert the result to clause form. Add it to


the set of clauses obtained in step 1.

3. Repeat until either a contradiction is found or no progress


can be made:
Resolution in Propositional Logic
Algorithm: Propositional Resolution
(a) Select two clauses. Call these the parent clauses.

(b) Resolve them together. The resulting clause, called


resolvent, will be the disjunction of all of the literals of both of
the parent clauses with the following exception:
If there are any pairs of literals L and ~L such that one of
the parent clauses contains L and the other contains ~L,
then select one such pair and eliminate both L and ~L from
the resolvent.
(c) If the resolvent is the empty clause, then a contradiction
has been found. If it is not, then add it to the set of clauses
available to the procedure.
Example
Given Axioms:
P
(P ∧Q) ⟹ R ~p ⋁ ~Q ⋁ RConverted to~Rclause form
(S ⋁ T) ⟹ Q Question:
P
T Given Axioms: ~P V ~Q ⋁ R
~p ⋁ ~Q P
Theorem:TR ~S ⋁ Q
(T ∧Q) ⟹ R ~T ⋁ Q
(S ⋁ P) ⟹ ~TQ ⋁Q T ~Q
P
Theorem: R
~T T
More Examples:
Show by a resolution refutation that the following formula
P
is a tautology: Modus Ponens
P
(P⟹⟹QQ) ⟹ (~Q ⟹ ~P)
P⟹Q Merge
~P ⟹ Q

P ⟹ ~Q Tautologies
~P ⟹ Q

P⟹Q Chaining
Q⟹R
The Unification Algorithm

In propositional logic, it is easy to determine that the


two literals cannot be true at the same time.
The matching process is more complicated since the
arguments of the predicates must be considered.
In order to determine contradiction, we need a
matching procedure that compare two literals and
discovers whether there exist a set of substitutions
that makes them identical.
There is a straightforward recursive procedure,
called unification algorithm.
The Unification Algorithm

The rules are as follows:


We first check if their initial predicates symbols are the same
Example:
or not. If same we proceed otherwise there is no way they can
be unified.
Tryassassinate (Marcus, Caesar)
Hate(Marcus,
If the predicated symbols match, then Caesar)
we must check the
arguments one pair at a time.
These two literals cannot
To test each argument pair, unify. we can call simply the
unification procedure recursively.
The Unification Algorithm

The rules of matching are as follows:


Different constants or predicates cannot match; identical
ones can.

A variable can match another variable, any constant, or a


predicate expression, with the restriction that the predicate
expression must not contain any instances of the variable
being matched.

There should be the consistent substitution for the entire


literal, not separate ones for each piece of it. So, consider the
substitution and apply it to the remainder of the literals
before we continue trying to unify them.
Examples of Unification Process

The objective of the unification procedure is to discover at


Pleast
(x, x)
one substitution that causes two literals to match.
y/x
P (y, z)
hate(x, y)
After unification of first literal
hate(Shyam, z)
f(x, x)
P (y, y) 1. (Shyam/x, z/y)
f(g(x), g(x))z/y
P (y, z) 2. (Shyam/x, y/z)
3. (Shaym/x, Mohan / y, Mohan / z)
After unification of second literal

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

We describe a procedure Unify (L1, L2), which


returns as its value a list representing the
compositions of the substitutions that were
performed during the match.
The empty list NIL, indicates that a match was found
without any substitutions.
The list consisting of the single value FAIL indicates
that the unification procedure failed.
Unification Algorithm

Algorithm: Unify (L1, L2)


5.
1.2.IfFor i the
L1Ifor =L21 to number
are both
initial of arguments
variables
predicates ininL1:
or constants,
symbols then:
L1 and L2
(a) (a)
If L1
are andCall
notL2Unify withidentical,
are not
identical, the ith
then argument
return then of L1
return
{FAIL}. NILand
the ith argument of L2, putting result
3. is
(b) S.If ifL1L1and
Else is aL2 have a different
variable, then if L1number
occurs inof L2 then
arguments, then return {FAIL}.
(b)
returnIf{FAIL},
S containselseFAIL
returnthen return {FAIL}.
(L2/L1).
(c) If S is not equal to NIL then:
4. Set SUBST to NIL. (At the end of this
(c) Else if L2 is (i) Applythen
a variable, S to ifthe
L2remainder
occurs in L1of then
procedure, SUBST will contain all the
return {FAIL},
substitutions usedelse both
return
to unify L1 L2.
and L2.
L1(L1/L2).
and
(ii) SUBST = APPEND(S, SUBST).
6.
(d) Return
Else return SUBST.{FAIL}
Unification Process
A substitution instance of an expression is obtained by substituting terms
for variables in the expression.

Four instances of P[x, f(y), B] are:

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]}

S1S2 = {g(A, B)/z, A/x, B/y, C/w}


E1S = E2S = ……….. In such a case, S is said to be unifier of
{Ei} since its use collapses the set to a singleton.
If a substitution S is applied to every member of a set {Ei} of
expressions as {Ei}S. We say that a set {Ei} of expression is
unifiable if there exists a substitution S such that :
Unification Examples:
Set of Literals {P(x), P(A)}

Most General Common P(A)


Substitution Instance

Set of Literals {P[f(x), y, g(y)], P[f(x), z, g(x)]}

Most General Common P[f(x), x, g(x)]


Substitution Instance
Assignment
Set of Literals
Find the mgu{P[f(x,of the
g(A, y)),set
g(A, y)], P[f(x, z), z]}
{P (x, z, y), P(w, u, w), P(A, u, u)}
Most General Common P[f(x, g(A, y)), g(A, y)]
Substitution Instance
Resolution in Predicate Logic
Assuming
We now have
a set an
of given
easy way
statement
to determining
F and a statement
that twotoliterals
be proved
are
contradictory: They are if one of them can be unified with the
P:
negation of the other.

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.

3. Repeat until either a contradiction is found or no progress


can be made:
Resolution in Predicate Logic
Algorithm: Predicate Resolution
(a) Select two clauses. Call these the parent clauses.

(b) Resolve them together. The resulting clause, called


resolvent, will be the disjunction of all of the literals of both of
the parent clauses with the following exception:
If there are any pairs of literals T1 and ~T2 such that one of
the parent clauses contains T1 and the other contains ~T2
and if T1 and T2 are unifiable, then neither T1 nor t2 should
appear in the resolvent. Use the substitution produced by
the unification to create the resolvent. If there is more than
one pair of complementary literals, only one pair should be
omitted from the resolvent.
Resolution in Predicate Logic
If the choice of clauses to resolve together at each step is made in
certain systematic ways, then the resolution procedure will find a
contradiction with speed if one exists.

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.

(∀x)[D(x) ⟹ ~L (x)] ~ D(y) ⋁ ~L(y)

3. Some Dolphins are intelligent.


(∃x)[D(x) ∧ I (x)] D(A) I(A)
Now, prove the statement.
3. Some who are intelligent cannot read
(∃x)[I(x) ∧ ~R(x)] ~ I(z) ⋁ R(z)
Assignment
Prove the
Find validity
a linear of the
input following
form wfffor
refutation using
the the
methodunsatisfiable
following of resolutionset
refutation.
of clauses:
(∃x){[P (x) ⟹ P(A)] ∧[P(x) ⟹ P(B)]}
~P ⋁~Q ⋁ R
~S⋁T
~T V P
S
~R
~S V U
~UVQ
Conversion to
the First Order Logic:
 Representation of facts: Clause
form
1. Marcus was a man.
man(Marcus)man(Marcus)

2. Marcus was a Pompeian.


Pompeian(Marcus)
Pompeian(Marcus)

3. All Pompeians were Romans.


Pompeian(x1) ⋁Roman(x1)
x Pompeian(x)  Roman(x)

4. Caesar was a ruler.


Ruler(Caesar)
ruler(Caesar)
Conversion to
the First Order Logic (2):
 General representation (representation of rules):
5. All Romans were either loyal to Caesar or hated him.
x Roman(x)  (loyalto(x,Caesar)  hates(x,Caesar))
Clause
form
~Roman(x2) ⋁loyalto(x2 , Caesar) ⋁ hate (x2 , Caesar)
6. Everyone is loyal to someone.
x y loyalto(x, y)
Clause
form
loyalto(x3 , f(x3))
Conversion to
the First Order Logic (2):
 General representation (representation of rules):
7. men only try to assassinate rulers to whom they are not
loyal.
xy man(x)  ruler(y)  tryassassinate(x, y) 
~loyalto(x, y)
Clause
form
~man(x4) ⋁ ~ruler(y1) ⋁ tryassassinate (x4, y1) ⋁
~loyalto (x4, y1)
8. Marcus tried to assassinate Caesar.
try_assassinate(Marcus,
Caesar)
Clause
tryassassinate(Marcus, Caesar)
form
The “theorem” ?
Was Marcus loyal to Caesar?

Try, for example, to prove that he was not :


~loyal_to(Marcus,Caesar)

Did Marcus hate Caesar?

Prove that he did:


hates(Marcus,Caesar)
Example:
 The following knowledge is given :
1. Marcus was a man.
2. Marcus was a Pompeian.
3. Marcus was born in 40 A. D.
4. All men are mortal
5. All Pompeians died when the volcano erupted in 79 A.D.
6. No mortal lives longer than 150 years.
7. It is now 2011
8. Alive means not dead
9. If someone dies, then he is dead at all later times

 Can we automatically answer the following questions?


 Is Marcus alive?

You might also like