Download presentation
Presentation is loading. Please wait.
1
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9
2
CSE 471/598, CBS 598 by H. Liu2 Inference with quantifiers Previous Rules for propositional logic Modus Ponens (p 211) And-Elimination, plus Fig 7.11 (p 210) Resolution (p 213) What’s new now are variables and quantifiers How can we reuse the above rules? By introducing more rules to remove V’s and Q’s More rules with SUBST( , ) - binding list, - sentence SUBST({x/Sam}, …) Sibling(x,John)) = Sibling(Sam,John)
3
CSE 471/598, CBS 598 by H. Liu3 Inference rules for quantifiers Universal Instantiation (UI) For any sentence , variable v, and ground term g, E.g., for all greedy kings are evil {x/John}, {x/Father(Richard)} Existential Instantiation (EI) For any , v, and constant k new to KB, E.g., John has a crown on his head {x/C1}
4
CSE 471/598, CBS 598 by H. Liu4 UI and EI The new k in EI is used to name a specific object and called a Skolem constant in logic If it’s not new, what would happen? UI and EI are different in inference UI can be applied many times EI can be applied once, then the sentence with EQ can be removed Is the new KB logically equivalent to the old KB? They are only inferentially equivalent Propositionalization – reducing to propositions
5
CSE 471/598, CBS 598 by H. Liu5 Generalized Modus Ponens It raises Modus Ponens from Prop Logic to FOL – lifting with n atomic sentences p i ’ It takes bigger steps in inference It’s focused - not randomly trying UIs If we know King(John) – p1’, Greedy(y) – p2’, and King(x) ^ Greddy(x) => Evil(x), we can apply GMP with Θ is {y/John, x/John}, q is Evil(x), and SUBST(Θ, q) = Evil(John)
6
CSE 471/598, CBS 598 by H. Liu6 Unification UNIFY (p,q)= (unifier - the binding list) where SUBST( ,p) = SUBST( ,q) p, q are two sentences Some examples: Unifying Knows(Jo,x) with Knows(Jo,Ja) =?Knows(y,Bi) =? Knows(y,Mother(y)) = ? Knows(x,Elizabeth) =? Standardizing apart: Rename one sentence to avoid name clashes Most general unifier when more than one sentence can be unified (e.g., Knows(Jo,x), Knows(y,z)) Finding MGU algorithm in Fig 9.1
7
CSE 471/598, CBS 598 by H. Liu7 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) Knows(John,x)Knows(y,OJ) Knows(John,x) Knows(y,Mother(y)) Knows(John,x)Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g., Knows(z 17,OJ)
8
CSE 471/598, CBS 598 by H. Liu8 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/Jane}} Knows(John,x)Knows(y,OJ) Knows(John,x) Knows(y,Mother(y)) Knows(John,x)Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g., Knows(z 17,OJ)
9
CSE 471/598, CBS 598 by H. Liu9 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/Jane}} Knows(John,x)Knows(y,OJ) {x/OJ,y/John}} Knows(John,x) Knows(y,Mother(y)) Knows(John,x)Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g., Knows(z 17,OJ)
10
CSE 471/598, CBS 598 by H. Liu10 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/Jane}} Knows(John,x)Knows(y,OJ) {x/OJ,y/John}} Knows(John,x) Knows(y,Mother(y)){y/John,x/Mother(John)}} Knows(John,x)Knows(x,OJ) Standardizing apart eliminates overlap of variables, e.g., Knows(z 17,OJ)
11
CSE 471/598, CBS 598 by H. Liu11 Unification We can get the inference immediately if we can find a substitution θ such that King(x) and Greedy(x) match King(John) and Greedy(y) θ = {x/John,y/John} works Unify(α,β) = θ if αθ = βθ p q θ Knows(John,x) Knows(John,Jane) {x/Jane}} Knows(John,x)Knows(y,OJ) {x/OJ,y/John}} Knows(John,x) Knows(y,Mother(y)){y/John,x/Mother(John)}} Knows(John,x)Knows(x,OJ) {fail} Standardizing apart eliminates overlap of variables, e.g., Knows(z 17,OJ)
12
CSE 471/598, CBS 598 by H. Liu12 An example proof The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. (p 280) To prove (infer) that West is a criminal. FOL, using these predicates: American(x), Weapon(y), Sells(x,y,z), Hostile(z), Criminal(x), Owns(x,y), Missile(y), Enemy(x,America) Datalog knowledge bases – FO definite clauses with no function symbols How do you prove it?
13
CSE 471/598, CBS 598 by H. Liu13 Example (continued) The proof can be very LONG for such a simple problem if using UI (substituting with a ground term). The branching factor increases as KB grows. Universal Instantiation has an enormous branching factor. We need more principled ways for proofs Combining atomic sentences to conjunctions, instantiating universal rules to match, then applying Generalized Modus Ponens Two ways to proceed: forward and backward
14
CSE 471/598, CBS 598 by H. Liu14 Forward chaining A first-order definite clause either is atomic or is an implication p1^p2^…^p3 p p’s are positive literals Start with the KB and generate new conclusions using Modes Ponens FC is usually used when a new fact is added into the KB, check if there are any new consequences An example of answering who is criminal - Criminal(x) (Fig 9.4) Algorithm FOL-FC-ASK (Fig 9.3) How fast is it? What are side effects?
15
CSE 471/598, CBS 598 by H. Liu15 Forward chaining algorithm
16
CSE 471/598, CBS 598 by H. Liu16 Forward chaining proof
17
CSE 471/598, CBS 598 by H. Liu17 Forward chaining proof
18
CSE 471/598, CBS 598 by H. Liu18 Forward chaining proof
19
CSE 471/598, CBS 598 by H. Liu19 Properties of forward chaining Sound and complete for first-order definite clauses May not terminate in general if α is not entailed This is unavoidable: entailment with definite clauses is semidecidable Forward chaining is widely used in deductive databases Incremental forward chaining: no need to match a rule on iteration k if a premise wasn't added on iteration k-1 match each rule whose premise contains a newly added positive literal Matching itself can be expensive
20
CSE 471/598, CBS 598 by H. Liu20 Backward chaining Start with something to be proved and find implication sentences to conclude it The list of goals is a stack waiting to be worked on When all goals are satisfied, the proof succeeds BC is used when there is a goal to be proved Algorithm FOL-BC-ASK (Fig 9.6) An example of answering who is criminal -Criminal(x) (Fig 9.7) BC is a depth-first search algorithm that suffers from problems with repeated states and incompleteness Which chaining method should be used (FC or BC)? Any suggestion?
21
CSE 471/598, CBS 598 by H. Liu21 Backward chaining algorithm SUBST(COMPOSE(θ 1, θ 2 ), p) = SUBST(θ 2, SUBST(θ 1, p))
22
CSE 471/598, CBS 598 by H. Liu22 Backward chaining example
23
CSE 471/598, CBS 598 by H. Liu23 Backward chaining example
24
CSE 471/598, CBS 598 by H. Liu24 Backward chaining example
25
CSE 471/598, CBS 598 by H. Liu25 Backward chaining example
26
CSE 471/598, CBS 598 by H. Liu26 Backward chaining example
27
CSE 471/598, CBS 598 by H. Liu27 Backward chaining example
28
CSE 471/598, CBS 598 by H. Liu28 Backward chaining example
29
CSE 471/598, CBS 598 by H. Liu29 Backward chaining example
30
CSE 471/598, CBS 598 by H. Liu30 Properties of backward chaining Depth-first recursive proof search: space is linear in size of proof Incomplete due to infinite loops fixed by checking current goal against every goal on stack Inefficient due to repeated subgoals (both success and failure) fixed using caching of previous results (extra space) Widely used for logic programming
31
CSE 471/598, CBS 598 by H. Liu31 Completeness An incomplete proof procedure there are sentences entailed by the KB, the procedure cannot find them (the path examples Fig 9.10) Significance of completeness (Math) All conjectures can be established mechanically We only need a set of fundamental axioms Significance to AI - a machine can solve any problem that can be stated in FOL Looking for a complete proof procedure
32
CSE 471/598, CBS 598 by H. Liu32 Completeness theorem If KB , then KB R - Godel’s completeness theorem Or any entailed sentence has a finite proof What’s the procedure R ? “There exists one” does NOT tell us which one Resolution algorithm is one such procedure Refutation-complete: if a sentence is unsatisfiable, resolution will derive a contradiction Entailment in FOL is semidecidable: We can show that sentences follow, if they do; but we can’t always show if they don’t.
33
CSE 471/598, CBS 598 by H. Liu33 Resolution A refutation complete inference procedure Algorithm (Fig. 7.12): the same for both logics Resolution proves KB by proving KB^! unsatisfiable, or by deriving the empty clause Conjunctive normal form for FOL Resolution inference rule where UNIFY(l i, ¬m j ) = First-order literals are complementary if one unifies with the negation of the other
34
CSE 471/598, CBS 598 by H. Liu34 Canonical forms for resolution Conjunctive normal form (CNF) CNF: Conjunction of disjunctions of literals The KB is one big, implicit conjunctions Implicative normal form (INF) CNF and INF are notational variants Skolemization Eliminate existential quantifiers It is not as straightforward to replace with a new constant Skolem functions The arguments of the Skolem function are all universally quantified variables
35
CSE 471/598, CBS 598 by H. Liu35 Conversion to normal form 1. Eliminate implications 2. Move NOT inwards 3. Standardize variables 4. Skolemize - removing E-Quantifier introducing a function associated with the variable 5. Drop universal quantifiers 6. Distribute ^ over v An example Everyone is loved by someone Everyone loves all animals Everyone who loves all animals is loved by someone
36
CSE 471/598, CBS 598 by H. Liu36 Proof revisit: Prove Criminal(West) Negate it first, !Criminal(West)
37
CSE 471/598, CBS 598 by H. Liu37 Proof revisit: Prove Criminal(West), negate it first, !Criminal(West)
38
CSE 471/598, CBS 598 by H. Liu38 Another example proof Everyone who loves all animals is loved by someone. Anyone who kills an animal is loved by no one. Jack loves all animals. Either Jack or Curiosity killed the cat, who is named Tuna. Did Curiosity kill the cat?
39
CSE 471/598, CBS 598 by H. Liu39 Resolution strategies To guide the fast proof using refutation Unit preference Prefer inferences that produce shorter sentences Set of support A subset of sentences identified first Work on this set Use the negated query as the set of support Input resolution Combines one of the input sentences (from KB or Q) with some other sentence (forming a single spine) Subsumption Keeps KB small by eliminating all sentences that are subsumed by an existing sentence
40
CSE 471/598, CBS 598 by H. Liu40 Summary Simple FOL proofs using UI and EI are complex and long Generalized Modus Ponens is natural and powerful, used in forward or backward chaining Forward chaining is complete but slow Backward chaining is focused but incomplete Resolution with refutation is complete There are strategies to guide search
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.