Inference in first-order logic
Chapter 9
1
Inference in first-order logic Chapter 9 1 Outline Reducing - - PowerPoint PPT Presentation
Inference in first-order logic Chapter 9 1 Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward and backward chaining Logic programming Resolution 2 Reasoning in
1
2
– ∃x Crown(x) ∧ OnHead(x, John)
– There is some literal in the world for which this is true. – But for which literal? What if we don’t know it yet? Or anonymous: mom(Kate)
– So: Crown(C1) ∧ OnHead(C1, John), where C1 is a new Skolem symbol
– UI can be applied several times to add new sentences
– EI can be applied once to replace the existential sentence
satisfiable
For any sentence α, variable v, and constant symbol k that does not appear elsewhere in the knowledge base
– Can refer to infinitely many entities, e.g., Father(Father(Father(John))) – Propositionalized KB is essentially infinite!
– If a sentence α is entailed by an FOL KB, it is entailed by a finite subset of the propositional KB
– create a propositional KB by instantiating with depth-n terms – see if α is entailed by this KB
– Theorem: Turing (1936), Church (1936), entailment in FOL is semidecidable
– Given previous KB, we can get the inference Evil(John) immediately... if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y)
– Two terms α and β unify, if you can find a variable binding θ that, when substituted in, makes the terms identical
– The ‘x’ in Knows(John,x) is not necessarily same as ‘x’ in Knows(x,OJ)
– Standardize apart: Variables in each clause made unique: Knows(John, x217)
α ⇒ β, α β p1, p2, p3...pn, (p1 ∧ p2 ∧ ... ∧pn) ⇒ q) q Or, more generally: p’1, p’2, p’3...p’n, (p1 ∧ p2 ∧ ... ∧pn) ⇒ q) subst(θ,q) where subst(θ,pi’) = subst(θ,pi) for all i King(John), Greedy(y), (King(x) ∧Greedy(y)) ⇒ Evil(x)) Evil(John) for θ={x/John, y/John}
11
12
13
14
15
16
17
18
19
Enemy(Nono,America) Owns(Nono,M1) Missile(M1) American(West)
Owns(Nono,M1) Missile(M1) American(West) Weapon(M1) Sells(West,M1,Nono)
20
Hostile(Nono) Enemy(Nono,America)
Owns(Nono,M1) Missile(M1) American(West) Weapon(M1) Criminal(West) Sells(West,M1,Nono)
21
Hostile(Nono) Enemy(Nono,America)
added on iteration k − 1 ⇒ match only those rules whose premise contains a newly added literal
23
function FOL-BC-Ask(KB, goals, θ) returns a set of substitutions inputs: KB, a knowledge base goals, a list of conjuncts forming a query (θ already applied)
θ, the current substitution, initially the empty substitution { }
local variables: answers, a set of substitutions, initially empty if goals is empty then return {θ} ;; if I’ve proven everything, I’m done q t ← Subst(θ, First(goals)) ;; else grab the first goal in list and try to prove for each sentence r in KB where Standardize-Apart(r) = ( p1 ∧ . . . ∧ pn ⇒ q) and θt ← Unify(q, q t) succeeds ;; unify goal with head of rule new goals ← [ p1, . . . , pn|Rest(goals)] ;; add RHS of rule to goal stack
;; now plug latest bindings made into goal stack and call recursively...
answers ← FOL-BC-Ask(KB, new goals, Compose(θt, θ)) ∪ answers return answers
24
Criminal(West)
American(x)∧W eapon(y)∧Sells(x, y, z)∧Hostile(z) ⇒ Criminal(x) Owns(Nono, M1) and Missile(M1) ∀x Missile(x) ∧ Owns(Nono, x) ⇒ Sells(West, x, Nono) Missile(x) ⇒ Weapon(x) Enemy(x, America) ⇒ Hostile(x) American(West) Enemy(Nono, America)
Criminal(West) Weapon(y) American(x) Sells(x,y,z)
25
Hostile(z) {x/West}
American(x)∧W eapon(y)∧Sells(x, y, z)∧Hostile(z) ⇒ Criminal(x) Owns(Nono, M1) and Missile(M1) ∀x Missile(x) ∧ Owns(Nono, x) ⇒ Sells(West, x, Nono) Missile(x) ⇒ Weapon(x) Enemy(x, America) ⇒ Hostile(x) American(West) Enemy(Nono, America)
Criminal(West) Weapon(y) Sells(x,y,z) Hostile(z)
26
{x/West}
American(West)
American(x)∧W eapon(y)∧Sells(x, y, z)∧Hostile(z) ⇒ Criminal(x) Owns(Nono, M1) and Missile(M1) ∀x Missile(x) ∧ Owns(Nono, x) ⇒ Sells(West, x, Nono) Missile(x) ⇒ Weapon(x) Enemy(x, America) ⇒ Hostile(x) American(West) Enemy(Nono, America)
Hostile(Nono) Criminal(West) Weapon(y) Missile(y) Sells(West,M1,z) American(West)
Sells(x,y,z) Hostile(z)
27
{x/West}
American(x)∧W eapon(y)∧Sells(x, y, z)∧Hostile(z) ⇒ Criminal(x) Owns(Nono, M1) and Missile(M1) ∀x Missile(x) ∧ Owns(Nono, x) ⇒ Sells(West, x, Nono) Missile(x) ⇒ Weapon(x) Enemy(x, America) ⇒ Hostile(x) American(West) Enemy(Nono, America)
Hostile(Nono) Criminal(West) Weapon(y) Missile(y) Sells(West,M1,z) American(West)
Sells(x,y,z) Hostile(z)
28
{x/West, y/M1}
American(x)∧W eapon(y)∧Sells(x, y, z)∧Hostile(z) ⇒ Criminal(x) Owns(Nono, M1) and Missile(M1) ∀x Missile(x) ∧ Owns(Nono, x) ⇒ Sells(West, x, Nono) Missile(x) ⇒ Weapon(x) Enemy(x, America) ⇒ Hostile(x) American(West) Enemy(Nono, America)
Owns(Nono,M1) Missile(M1) Criminal(West) Weapon(y) Missile(y) American(West)
29
Sells(West,M1,z) z/Nono
Hostile(z) {x/West, y/M1, z/Nono}
American(x)∧W eapon(y)∧Sells(x, y, z)∧Hostile(z) ⇒ Criminal(x) Owns(Nono, M1) and Missile(M1) ∀x Missile(x) ∧ Owns(Nono, x) ⇒ Sells(West, x, Nono) Missile(x) ⇒ Weapon(x) Enemy(x, America) ⇒ Hostile(x) American(West) Enemy(Nono, America)
Hostile(Nono) Enemy(Nono,America) Owns(Nono,M1) Missile(M1) Criminal(West) Weapon(y) Missile(y) American(West)
30
Sells(West,M1,z) z/Nono
{x/West, y/M1, z/Nono}
American(x)∧W eapon(y)∧Sells(x, y, z)∧Hostile(z) ⇒ Criminal(x) Owns(Nono, M1) and Missile(M1) ∀x Missile(x) ∧ Owns(Nono, x) ⇒ Sells(West, x, Nono) Missile(x) ⇒ Weapon(x) Enemy(x, America) ⇒ Hostile(x) American(West) Enemy(Nono, America)
32
36
37
universally quantified variables:
38
– Use of Universal Instantiation and Existential Instantiation – Works...but is slow for all but the smallest domains.
– Can be seen as a “goal-focused instantiation” – Then can just use generalized Modus Ponens for inference – Forward and Backward chaining algorithms implement this approach in two different ways
– Forward chaining is complete for datalog à runs in polynomial time
– Used in logic programming systems like Prolog – Suffers from typical DFS issues: infinite loops and incompleteness