Existential instantiation (EI) For any sentence α , variable v , and constant symbol k that does not appear elsewhere in the knowledge base : ∃ v α Inference in first-order logic Subst ( { v/k } , α ) E.g., ∃ x Crown ( x ) ∧ OnHead ( x, John ) yields Crown ( C 1 ) ∧ OnHead ( C 1 , John ) Chapter 9 provided C 1 is a new constant symbol, called a Skolem constant Another example: from ∃ x d ( x y ) /dy = x y we obtain d ( e y ) /dy = e y provided e is a new constant symbol Chapter 9 1 Chapter 9 4 Outline Existential instantiation contd. ♦ Reducing first-order inference to propositional inference UI can be applied several times to add new sentences; the new KB is logically equivalent to the old ♦ Unification EI can be applied once to replace the existential sentence; ♦ Generalized Modus Ponens the new KB is not equivalent to the old, but is satisfiable iff the old KB was satisfiable ♦ Forward and backward chaining ♦ Resolution Chapter 9 2 Chapter 9 5 Universal instantiation (UI) Reduction to propositional inference Suppose the KB contains just the following: Every instantiation of a universally quantified sentence is entailed by it: ∀ v α ∀ x King ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) King ( John ) Subst ( { v/g } , α ) Greedy ( John ) for any variable v and ground term g Brother ( Richard, John ) E.g., ∀ x King ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) yields Instantiating the universal sentence in all possible ways, we have King ( John ) ∧ Greedy ( John ) ⇒ Evil ( John ) King ( John ) ∧ Greedy ( John ) ⇒ Evil ( John ) King ( Richard ) ∧ Greedy ( Richard ) ⇒ Evil ( Richard ) King ( Richard ) ∧ Greedy ( Richard ) ⇒ Evil ( Richard ) King ( Father ( John )) ∧ Greedy ( Father ( John )) ⇒ Evil ( Father ( John )) King ( John ) . . . Greedy ( John ) Brother ( Richard, John ) The new KB is propositionalized: proposition symbols are King ( John ) , Greedy ( John ) , Evil ( John ) , King ( Richard ) etc. Chapter 9 3 Chapter 9 6
Reduction contd. Unification Claim: a ground sentence ∗ is entailed by new KB iff entailed by original KB 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 ) Claim: every FOL KB can be propositionalized so as to preserve entailment θ = { x/John, y/John } works Idea: propositionalize KB and query, apply resolution, return result Unify ( α, β ) = θ if αθ = βθ Problem: with function symbols, there are infinitely many ground terms, e.g., Father ( Father ( Father ( John ))) p q θ Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, Knows ( John, x ) Knows ( John, Jane ) { x/Jane } it is entailed by a finite subset of the propositional KB Knows ( John, x ) Knows ( y, OJ ) Idea: For n = 0 to ∞ do Knows ( John, x ) Knows ( y, Mother ( y )) create a propositional KB by instantiating with depth- n terms Knows ( John, x ) Knows ( x, OJ ) see if α is entailed by this KB Problem: works if α is entailed, loops if α is not entailed Theorem: Turing (1936), Church (1936), entailment in FOL is semidecidable Chapter 9 7 Chapter 9 10 Problems with propositionalization Unification Propositionalization seems to generate lots of irrelevant sentences. 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 ) E.g., from ∀ x King ( x ) ∧ Greedy ( x ) ⇒ Evil ( x ) θ = { x/John, y/John } works King ( John ) Unify ( α, β ) = θ if αθ = βθ ∀ y Greedy ( y ) Brother ( Richard, John ) it seems obvious that Evil ( John ) , but propositionalization produces lots of p q θ facts such as Greedy ( Richard ) that are irrelevant 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 ) Chapter 9 8 Chapter 9 11 Unification Unification We can get the inference immediately if we can find a substitution θ 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 ) such that King ( x ) and Greedy ( x ) match King ( John ) and Greedy ( y ) θ = { x/John, y/John } works θ = { x/John, y/John } works Unify ( α, β ) = θ if αθ = βθ Unify ( α, β ) = θ if αθ = βθ p q θ p q θ Knows ( John, x ) Knows ( John, Jane ) Knows ( John, x ) Knows ( John, Jane ) { x/Jane } Knows ( John, x ) Knows ( y, OJ ) Knows ( John, x ) Knows ( y, OJ ) { x/OJ, y/John } Knows ( John, x ) Knows ( y, Mother ( y )) Knows ( John, x ) Knows ( y, Mother ( y )) { y/John, x/Mother ( John ) } Knows ( John, x ) Knows ( x, OJ ) Knows ( John, x ) Knows ( x, OJ ) Chapter 9 9 Chapter 9 12
Unification Example knowledge base contd. We can get the inference immediately if we can find a substitution θ . . . it is a crime for an American to sell weapons to hostile nations: 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 ) Chapter 9 13 Chapter 9 16 Generalized Modus Ponens (GMP) Example knowledge base contd. . . . it is a crime for an American to sell weapons to hostile nations: American ( x ) ∧ Weapon ( y ) ∧ Sells ( x, y, z ) ∧ Hostile ( z ) ⇒ Criminal ( x ) p 1 ′ , p 2 ′ , . . . , p n ′ , ( p 1 ∧ p 2 ∧ . . . ∧ p n ⇒ q ) ′ θ = p i θ for all i where p i Nono . . . has some missiles qθ p 1 ′ is King ( John ) p 1 is King ( x ) p 2 ′ is Greedy ( y ) p 2 is Greedy ( x ) θ is { x/John, y/John } q is Evil ( x ) qθ is Evil ( John ) GMP used with KB of definite clauses ( exactly one positive literal) All variables assumed universally quantified Chapter 9 14 Chapter 9 17 Example knowledge base Example knowledge base contd. The law says that it is a crime for an American to sell weapons to hostile . . . it is a crime for an American to sell weapons to hostile nations: nations. The country Nono, an enemy of America, has some missiles, and American ( x ) ∧ Weapon ( y ) ∧ Sells ( x, y, z ) ∧ Hostile ( z ) ⇒ Criminal ( x ) all of its missiles were sold to it by Colonel West, who is American. Nono . . . has some missiles, i.e., ∃ x Owns ( Nono, x ) ∧ Missile ( x ) : Owns ( Nono, M 1 ) and Missile ( M 1 ) Prove that Col. West is a criminal . . . all of its missiles were sold to it by Colonel West Chapter 9 15 Chapter 9 18
Example knowledge base contd. Forward chaining algorithm . . . it is a crime for an American to sell weapons to hostile nations: function FOL-FC-Ask ( KB , α ) returns a substitution or false American ( x ) ∧ Weapon ( y ) ∧ Sells ( x, y, z ) ∧ Hostile ( z ) ⇒ Criminal ( x ) repeat until new is empty Nono . . . has some missiles, i.e., ∃ x Owns ( Nono, x ) ∧ Missile ( x ) : new ← { } Owns ( Nono, M 1 ) and Missile ( M 1 ) for each sentence r in KB do . . . all of its missiles were sold to it by Colonel West ( p 1 ∧ . . . ∧ p n ⇒ q ) ← Standardize-Apart ( r ) Missile ( x ) ∧ Owns ( Nono, x ) ⇒ Sells ( West, x, Nono ) for each θ such that ( p 1 ∧ . . . ∧ p n ) θ = ( p ′ 1 ∧ . . . ∧ p ′ n ) θ Missiles are weapons: for some p ′ 1 , . . . , p ′ n in KB q ′ ← Subst ( θ , q ) if q ′ is not a renaming of a sentence already in KB or new then do add q ′ to new φ ← Unify ( q ′ , α ) if φ is not fail then return φ add new to KB return false Chapter 9 19 Chapter 9 22 Example knowledge base contd. Forward chaining proof . . . it is a crime for an American to sell weapons to hostile nations: American ( x ) ∧ Weapon ( y ) ∧ Sells ( x, y, z ) ∧ Hostile ( z ) ⇒ Criminal ( x ) Nono . . . has some missiles, i.e., ∃ x Owns ( Nono, x ) ∧ Missile ( x ) : Owns ( Nono, M 1 ) and Missile ( M 1 ) . . . all of its missiles were sold to it by Colonel West Missile ( x ) ∧ Owns ( Nono, x ) ⇒ Sells ( West, x, Nono ) Missiles are weapons: Missile ( x ) ⇒ Weapon ( x ) An enemy of America counts as “hostile”: American(West) Missile(M1) Owns(Nono,M1) Enemy(Nono,America) Chapter 9 20 Chapter 9 23 Example knowledge base contd. Forward chaining proof . . . it is a crime for an American to sell weapons to hostile nations: American ( x ) ∧ Weapon ( y ) ∧ Sells ( x, y, z ) ∧ Hostile ( z ) ⇒ Criminal ( x ) Nono . . . has some missiles, i.e., ∃ x Owns ( Nono, x ) ∧ Missile ( x ) : Owns ( Nono, M 1 ) and Missile ( M 1 ) . . . all of its missiles were sold to it by Colonel West Missile ( x ) ∧ Owns ( Nono, x ) ⇒ Sells ( West, x, Nono ) Weapon(M1) Sells(West,M1,Nono) Hostile(Nono) Missiles are weapons: Missile ( x ) ⇒ Weapon ( x ) An enemy of America counts as “hostile”: Enemy ( x, America ) ⇒ Hostile ( x ) American(West) Missile(M1) Owns(Nono,M1) Enemy(Nono,America) West, who is American . . . American ( West ) The country Nono, an enemy of America . . . Enemy ( Nono, America ) Chapter 9 21 Chapter 9 24
Recommend
More recommend