0% found this document useful (0 votes)
31 views27 pages

Outline: - First-Order Inference Rules: Modus Ponens, Modus Tollens - Resolution

The document discusses various first-order logic inference rules including modus ponens, modus tollens, resolution, and rules for quantifiers such as universal and existential instantiation and generalization. It provides examples of applying each rule to deduce logical conclusions from premises. Key inference rules like modus ponens and resolution are generalized to handle first-order logic statements.

Uploaded by

Bony Rocker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views27 pages

Outline: - First-Order Inference Rules: Modus Ponens, Modus Tollens - Resolution

The document discusses various first-order logic inference rules including modus ponens, modus tollens, resolution, and rules for quantifiers such as universal and existential instantiation and generalization. It provides examples of applying each rule to deduce logical conclusions from premises. Key inference rules like modus ponens and resolution are generalized to handle first-order logic statements.

Uploaded by

Bony Rocker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 27

Outline

• First-order inference rules: Modus


Ponens, Modus Tollens
• Resolution

Dr. M. S. Uddin, CSE Dept, JU


1
Modus Ponens
• Assume you are given the following two statements:
– “you are in this class”
– “if you are in this class, you will get a grade”

• Let p = “you are in this class”


• Let q = “you will get a grade”

• By Modus Ponens, you can conclude that you will get a grade

p
pq
q

Dr. M. S. Uddin, CSE Dept, JU


2
Modus Ponens
• Consider (p  (p→q)) → q
p q p→q p(p→q)) (p(p→q)) → q
T T T T T
T F F F T
F T T F T
F F T F T
p
pq
q
Dr. M. S. Uddin, CSE Dept, JU
3
Chain Rule
From p  q, and q  r, we can infer p  r

pq
qr
pr

Dr. M. S. Uddin, CSE Dept, JU


4
Modus Tollens
• Assume that we know: ¬q and p → q
– Recall that p → q = ¬q → ¬p
• Thus, we know ¬q and ¬q → ¬p
• We can conclude ¬p

q
pq
p

Dr. M. S. Uddin, CSE Dept, JU


5
Modus Tollens
• Assume you are given the following two
statements:
– “you will not get a grade”
– “if you are in this class, you will get a grade”

• Let p = “you are in this class”


• Let q = “you will get a grade”

• By Modus Tollens, you can conclude that you


are not in this class

Dr. M. S. Uddin, CSE Dept, JU


6
Addition and Simplification
• Addition: If you know that p is true, then p  q will
ALWAYS be true
p
pq
• Simplification: If p  q is true, then p will ALWAYS
be true
pq
 p

Dr. M. S. Uddin, CSE Dept, JU


7
Rules of inference for the universal
quantifier
• Assume that we know that x P(x) is true
– Then we can conclude that P(c) is true
• Here c stands for some specific constant
– This is called “universal instantiation”

• Assume that we know that P(c) is true for


any value of c
– Then we can conclude that x P(x) is true
– This is called “universal generalization”
Dr. M. S. Uddin, CSE Dept, JU
8
Rules of inference for the existential
quantifier
• Assume that we know that x P(x) is true
– Then we can conclude that P(c) is true for
some value of c
– This is called “existential instantiation”

• Assume that we know that P(c) is true for


some value of c
– Then we can conclude that x P(x) is true
– This is called “existential generalization”

Dr. M. S. Uddin, CSE Dept, JU


9
Anatomy of a propositional function

P(x) = x + 5 > x

variable predicate

Dr. M. S. Uddin, CSE Dept, JU


10
Universal instantiation (UI)
• A predicate that has no variables is called a ground atom.
• Every instantiation of a universally quantified sentence is entailed by it:
v 

Subst({v/g}, )
for any variable v and ground term g (Subst(x,y) = substitution of y by x)

• E.g., x King(x)  Greedy(x)  Evil(x) yields:


King(John)  Greedy(John)  Evil(John)
King(Richard)  Greedy(Richard)  Evil(Richard)
King(Father(John))  Greedy(Father(John))  Evil(Father(John))
.
.
.

Dr. M. S. Uddin, CSE Dept, JU


11
Existential instantiation (EI)
• For any sentence , variable v, and constant symbol k that does not
appear elsewhere in the knowledge base:
v 

Subst({v/k}, )

• E.g., x Crown(x)  OnHead(x,John) yields:

Crown(C1)  OnHead(C1,John)

provided C1 is a new constant symbol, called a Skolem constant

Dr. M. S. Uddin, CSE Dept, JU


12
EI versus UI
• UI can be applied several times to add new
sentences; the new KB is logically equivalent
to the old.
• EI can be applied once to replace the
existential sentence; the new KB is not
equivalent to the old but is satisfiable if the
old KB was satisfiable.

Dr. M. S. Uddin, CSE Dept, JU


13
Reduction to propositional inference
• Suppose the KB contains just the following:
x King(x)  Greedy(x)  Evil(x)
King(John)
Greedy(John)
Brother(Richard,John)
• Instantiating the universal sentence in all possible ways, we
have:
King(John)  Greedy(John)  Evil(John)
King(Richard)  Greedy(Richard)  Evil(Richard)
King(John)
Greedy(John)
Brother(Richard,John)
• The new KB is propositionalized: proposition symbols are
John, Richard and also King(John), Greedy(John), Evil(John),
King(Richard), etc.

Dr. M. S. Uddin, CSE Dept, JU


14

Making modus ponens
Modus ponens is incomplete in a general KB
complete
– Need other inference rules
– E.g. KB = {AB}, we cannot infer anything with MP
• There is a (finite) set of inference rules such that repeatedly applying
them forms a complete inference procedure
– All valid sentences can be inferred in this way
• For each inference rule, we can associate the infinite set of logical
axioms (implications) that corresponds to each possible instantiation of
the rule
– E.g. and-elimination corresponds to all axioms of the form
AB=>A
– Note that the axioms are in our FOL language, whereas inference
rules are in a “meta-language”
• Modus ponens becomes complete if we add to our knowledge bases all
the logical axioms corresponding to the other inference rules

Dr. M. S. Uddin, CSE Dept, JU


15
Inference in FOL
• Entailment: KB  whenever every model
of KB is also a model of .

Inference procedures:
o propositionalization (Universal and Existential
elimination; convert to Propositional Logic; apply
prop logic inference)
o lifted inference rules, and in particular
refutation/resolution proof for FOL
o forward/backward chaining for definite clauses
Dr. M. S. Uddin, CSE Dept, JU
16
Propositionalization
• Problem: with function symbols, there are infinitely many ground
terms,
– e.g., Father(Father(Father(John)))
• Theorem: Herbrand (1930). If a sentence α is entailed by an FOL
KB, it is entailed by a finite subset of the propositionalized KB
• Idea: For n = 0 to ∞ do
– create a propositional KB by instantiating with depth-n terms
– see if α is entailed in this KB (e.g. using refutation)
• Problem: works if α is entailed, loops if α is not entailed
• Theorem: Turing (1936), Church (1936) Entailment for FOL is
semi-decidable (algorithms exist that say yes to every entailed
sentence, but no algorithm exists that also says no to every non-
entailed sentence.)

Dr. M. S. Uddin, CSE Dept, JU


17
Propositionalization: Example
 x King(x)  Greedy(x) => Evil(x)
King(John)
Hassan
Giro
Lukasz
Jacomo
John
 y Greedy(y)
Would like to conclude Evil(John).

By Propositionalization, write out:


King(John)  Greedy(John) => Evil(John)
King(Hassan)  Greedy(Hassan) => Evil(Hassan)
King(Giro)  Greedy(Giro) => Evil(Giro) finally, conclude
King(Jacomo)  Greedy(Jacomo) => Evil(Jacomo) Evil(John)
King(Lukasz)  Greedy(Lukasz) => Evil(Lukasz)
Greedy(John)
Greedy(Hassan) ….

Dr. M. S. Uddin, CSE Dept, JU


18
Problems with propositionalization
• Propositionalization seems to generate lots of
irrelevant sentences
• E.g., from:
x King(x)  Greedy(x)  Evil(x)
King(John)
y Greedy(y)
Brother(Richard,John)
• It seems obvious that Evil(John), but
propositionalization produces lots of facts such as
Greedy(Richard) that are irrelevant
• With p k-ary predicates and n constants, there are
p·nk instantiations

Dr. M. S. Uddin, CSE Dept, JU


19
Generalized Modus Ponens
• Lifted version of the propositional Modus Ponens
• For atomic sentences pi, pi’, and q, where there is a
substitution  that satisfies Subst(,p’i)=Subst(,pi) for all i
p’1, p’2, …, p’n, (p1p2  …  pn => q)
Subst(, q)
•Example:
p1’ is King(John) p1 is King(x)
p2’ is Greedy(y) p2 is Greedy(x)
 is {x/ John, y/ John} q is Evil(x)
Subst(,q) is Evil(John)
we say  “unifies” p1’ and p1; and p2’ and p2.
Dr. M. S. Uddin, CSE Dept, JU
20
Soundness of GMP
• For any sentence p with universally quantified variables and
for any substitution , p Subst(,p)

• So, from (p1’,…,pn’) we can infer:


Subst(,p1’)  …  Subst(,pn’) (1)
• From the implication p1  …  pn => q we can infer:
Subst(,p1)  …  Subst(,pn) => Subst(,q) (2)

By the GMP rule, when the first sentence (1) matches the premise
of (2) exactly we can infer Subst(,q).
This follows immediately from Modus Ponens.

Dr. M. S. Uddin, CSE Dept, JU


21
Unification
• To apply GMP we need a substitution that unifies a
sentences in the KB with the premises, i.e. to find
Subst(,p’i)=Subst(,pi) for all i
p’1,p’2,…,p’n, (p1  p2  …  pn) q)
Subst(, q)
•Unification: find a substitution of variables for terms
that makes two sentences equivalent.
Example:
Unify(Knows(John,x); Knows(John,Jane)) = {x/Jane}
Unify(Knows(John,x); Knows(y,Bill)) = {x/Bill, y/John}

Write: unify(,) =  , to denote the unifier e.g.


=unify(,}={x/Jane}
Dr. M. S. Uddin, CSE Dept, JU
22
• Unifiers =unify(,), can:
– replace a variable by a constant term, e.g. {x/John}
– replace a variable with a variable, e.g. {x/y}
– replace a variable by a function expression,
e.g. {x / Mother(y)}
• CAREFUL: need to check variable (e.g. x) does not appear
inside the complex term
• “Occur check”
• makes complexity quadratic

Dr. M. S. Uddin, CSE Dept, JU


23
Examples
Find a unifier for the following sentences:
variable term

1 – unify(Knows(John,x), Knows(John,Jane))  = {x/Jane}

2 – unify(Knows(John,x), Knows(y,Bill))  = {x/Bill, y/John}

Dr. M. S. Uddin, CSE Dept, JU


24
Generalized Resolution
• Lifted version of resolution
p1  …  pm,  q1  …  qn , Unify(p1,  q1) = 
Subst(, p2  …  pm  q2  …  qn)

Example:
Animal(F(x))  Loves(G(x),x) and  Loves(u,v)   Kills(u,v)
take unifier ={u/G(x), v/x}, and get resolvent clause:
Animal(F(x))   Kills(G(x),x)

Dr. M. S. Uddin, CSE Dept, JU


25
Resolution Algorithm
• start with KB, add  
• while False  KB {
– find two sentences , KB that unify
– add resolvent(, ) to KB
}

Resolution is “refutation-complete:” will report “yes” (find


the empty clause) if sentence is entailed.

Dr. M. S. Uddin, CSE Dept, JU


26
Resolution Strategies
• Complete
– Breadth-first (slow)
– Set of Support
– Linear resolution
– Subsumption: remove all sentences in your KB that
are subsumed. (e.g. remove AB(k) if B(x) is in KB)
• Incomplete
– Unit resolution
– Input resolution

Dr. M. S. Uddin, CSE Dept, JU


27

You might also like