Existential instantiation (EI) For any sentence α, variable v, and constant symbol k that does not appear elsewhere in the knowledge base: Inference in first-order logic ∃ v α Subst({v/k}, α) E.g., ∃ x Crown(x) ∧ OnHead(x, John) yields Chapter 9 Crown(C1) ∧ OnHead(C1, John) provided C1 is a new constant symbol, called a Skolem constant Another example: from ∃ x d(xy)/dy = xy we obtain d(ey)/dy = ey 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, ♦ Forward and backward chaining but is satisfiable iff the old KB was satisfiable ♦ Resolution Chapter 9 2 Chapter 9 5 Universal instantiation (UI) Reduction to propositional inference Every instantiation of a universally quantified sentence is entailed by it: Suppose the KB contains just the following: ∀ v α ∀ x King(x) ∧ Greedy(x) ⇒ Evil(x) Subst({v/g}, α) King(John) 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(F ather(John)) ∧ Greedy(F ather(John)) ⇒ Evil(F ather(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., F ather(F ather(F ather(John))) Theorem: Herbrand (1930). If a sentence α is entailed by an FOL KB, p q θ it is entailed by a finite subset of the propositional KB Knows(John, x) Knows(John, Jane) {x/Jane} 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 θ E.g., from such that King(x) and Greedy(x) match King(John) and Greedy(y) ∀ x King(x) ∧ Greedy(x) ⇒ Evil(x) θ = {x/John, y/John} works King(John) Unify ∀ y Greedy(y) (α, β)= θ if αθ = βθ 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(z17, 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: ′ ′ ′ p1 , p2 , ..., p , (p1 ∧ p2 ∧ ... ∧ p ⇒ q) American(x)∧W eapon(y)∧Sells(x,y,z)∧Hostile(z) ⇒ Criminal(x) n n where p ′θ = p θ for all i qθ i i Nono ... has some missiles ′ 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) 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)∧W eapon(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, M1) and Missile(M1) 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)∧W eapon(y)∧Sells(x,y,z)∧Hostile(z) ⇒ Criminal(x) Nono ... has some missiles, i.e., ∃ x Owns(Nono, x) ∧ Missile(x): repeat until new is empty new ←{} Owns(Nono, M1) and Missile(M1) for each sentence r in KB do ... all of its missiles were sold to it by Colonel West ( p1 ∧ . ∧ pn ⇒ q) ← Standardize-Apart(r) ′ ′ Missile(x) ∧ Owns(Nono, x) ⇒ Sells(W est, x, Nono) for each θ such that (p1 ∧ . ∧ pn)θ = (p1 ∧ . ∧ pn)θ ′ ′ Missiles are weapons: for some p1,..., pn 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)∧W eapon(y)∧Sells(x,y,z)∧Hostile(z) ⇒ Criminal(x) Nono ... has some missiles, i.e., ∃ x Owns(Nono, x) ∧ Missile(x): Owns(Nono, M1) and Missile(M1) ... all of its missiles were sold to it by Colonel West Missile(x) ∧ Owns(Nono, x) ⇒ Sells(W est, x, Nono) Missiles are weapons: Missile(x) ⇒ W eapon(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)∧W eapon(y)∧Sells(x,y,z)∧Hostile(z) ⇒ Criminal(x) Nono ... has some missiles, i.e., ∃ x Owns(Nono, x) ∧ Missile(x): Owns(Nono, M1) and Missile(M1) ... all of its missiles were sold to it by Colonel West Missile(x) ∧ Owns(Nono, x) ⇒ Sells(W est, x, Nono) Weapon(M1) Sells(West,M1,Nono) Hostile(Nono) Missiles are weapons: Missile(x) ⇒ W eapon(x) An enemy of America counts as “hostile”: Enemy(x, America) ⇒ Hostile(x) West, who is American ... American(West) Missile(M1) Owns(Nono,M1) Enemy(Nono,America) American(W est) The country Nono, an enemy of America ... Enemy(Nono, America) Chapter 9 21 Chapter 9 24 Forward chaining proof Backward chaining example Criminal(West) Criminal(West) Weapon(M1) Sells(West,M1,Nono) Hostile(Nono) American(West) Missile(M1) Owns(Nono,M1) Enemy(Nono,America) Chapter 9 25 Chapter 9 28 Properties of forward chaining Backward chaining example Sound and complete for first-order definite clauses Criminal(West) {x/West} (proof similar to propositional proof) Datalog = first-order definite clauses + no functions (e.g., crime KB) FC terminates for Datalog in poly iterations: at most p · nk literals May not terminate in general (with functions) if α is not entailed American(x) Weapon(y) Sells(x,y,z) Hostile(z) This is unavoidable: entailment with definite clauses is semidecidable Chapter 9 26 Chapter 9 29 Backward chaining algorithm Backward chaining example function FOL-BC-Ask(KB, goals, θ) returns a set of substitutions Criminal(West) {x/West} 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 {θ} American(West) Weapon(y) Sells(x,y,z) Hostile(z) ′ Subst First q ← (θ, (goals)) { } for each sentence r in KB where Standardize-Apart(r) = ( p1 ∧ .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages7 Page
-
File Size-