computi ting logical consequences
play

Computi ting logical consequences Inference in First- t-Order - PowerPoint PPT Presentation

CSE E 3401: Intr tro to to AI & LP Computi ting logical consequences Inference in First- t-Order Logic We want procedures for computing logical consequences that can be implemented in our Required Readings: R & N 9.1, 9.2,


  1. CSE E 3401: Intr tro to to AI & LP 
 Computi ting logical consequences Inference in First- t-Order Logic ● We want procedures for computing logical consequences that can be implemented in our ● Required Readings: R & N 9.1, 9.2, and 9.5 programs. ● Resolution Proofs. ■ Part t I: Convert t to to clausal form ● This would allow us to reason with our knowledge ■ Part t II: De Dealing with th variables (unificati tion). ■ Represent the knowledge as logical formulas ■ Part t III: Constr tructi ting Resoluti tion Proofs. ■ Apply procedures for generating logical consequences ● These procedures are called proof procedures. 1 1 2 2 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance Pr Proof f Pr Proced edur ures es Properti ties of Proof Procedures ● Interesting, proof procedures work by simply ● Before presenting the details of resolution, we manipulating formulas. They do not know or want to look at properties we would like to care anything about interpretations. have in a (any) proof procedure. ● Nevertheless they respect the semantics of ● We write KB ⊢ f to indicate that f can be proved interpretations! from KB (the proof procedure used is implicit). ● We will develop a proof procedure for first- order logic called resolution. ■ Resolution is the mechanism used by PROLOG 3 3 4 4 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance 1

  2. Properti ties of Proof Procedures Resoluti tion ● Soundness ● Clausal form. ■ KB ⊢ f → KB ⊨ f ■ Resolution works with formulas expressed in clausal i.e all conclusions arrived at via the proof procedure are correct: form. they are logical consequences. ■ A literal is an atomic formula or the negation of an atomic formula. dog(fido), ¬cat(fido) ● Completeness ■ A clause is a disjunction of literals: ■ KB ⊨ f → KB ⊢ f ● ¬owns(fido,fred) ∨ ¬dog(fido) ∨ person(fred) i.e. every logical consequence can be generated by the proof procedure. ● We write 
 (¬owns(fido,fred), ¬dog(fido), person(fred)) ● Note proof procedures are computable, but they might ■ A clausal theory is a conjunction of clauses. have very high complexity in the worst case. So completeness is not necessarily achievable in practice. 5 5 6 6 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance Resoluti tion Resoluti tion Rule for Ground Clauses ● Prolog Programs ● The resolution proof procedure consists of only one simple rule: ■ Prolog programs are clausal theories. ■ However, each clause in a Prolog program is Horn. ■ From the two clauses ■ A horn clause contains at most one positive literal. ● (P, Q1, Q2, …, Qk) ● The horn clause ● (¬P, R1, R2, …, Rn) ¬q1 ∨ ¬q2 ∨ … ∨ ¬qn ∨ p ■ We infer the new clause ● (Q1, Q2, …, Qk, R1, R2, …, Rn) is equivalent to q1 ∧ q2 ∧ … ∧ qn ⇒ p ■ Example: ● (¬largerThan(clyde,cup), ¬fitsIn(clyde,cup) and is written as the following rule in Prolog: p :- q1 , q2 ,… ,qn ● (fitsIn(clyde,cup)) ⇒ ¬largerThan(clyde,cup) 7 7 8 8 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance 2

  3. Resoluti tion Proof: Forward chaining Resoluti tion Proof: Refuta tati tion proofs 2. Refutation proofs. ● Logical consequences can be generated from ● We determine if KB ⊢ f by showing that a the resolution rule in two ways: contradiction can be generated from KB Λ ¬f. 1. Forward Chaining inference. ● In this case a contradiction is an empty clause (). ● If we have a sequence of clauses C1, C2, …, Ck ● We employ resolution to construct a sequence of ● Such that each Ci is either in KB or is the result of clauses C1, C2, …, Cm such that a resolution step involving two prior clauses in the ■ Ci is in KB Λ ¬f, or is the result of resolving two sequence. previous clauses in the sequence. ● We then have that KB ⊢ Ck. ■ Cm = () i.e. its the empty clause. Forward chaining is sound so we also have KB ⊨ Ck 9 9 10 10 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance Resoluti tion Proof: Refuta tati tion proofs Resoluti tion Proofs Ex Example Want to prove likes(clyde,peanuts) from: ● If we can find such a sequence C1, C2, …, Cm=(), we have that 1. (elephant(clyde), giraffe(clyde)) 2. (¬elephant(clyde), likes(clyde,peanuts)) ■ KB ⊢ f. ■ Furthermore, this procedure is sound so 3. (¬giraffe(clyde), likes(clyde,leaves)) ● KB ⊨ f 4. ¬likes(clyde,leaves) ● And the procedure is also complete so it is capable of finding a proof of any f that is a Forward Chaining Proof: logical consequence of KB. I.e. ● 3&4 → ¬giraffe(clyde) [5.] ● If KB ⊨ f then we can generate a refutation from ● 5&1 → elephant(clyde) [6.] KB Λ ¬f ● 6&2 → likes(clyde,peanuts) [7.] ü 11 11 12 12 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance 3

  4. Resoluti tion Proofs Ex Example Resoluti tion Proofs 1. (elephant(clyde), giraffe(clyde)) Proofs by refutation have the advantage that they are ● 2. (¬elephant(clyde), likes(clyde,peanuts)) easier to find. 3. (¬giraffe(clyde), likes(clyde,leaves)) They are more focused to the particular conclusion we are ■ trying to reach. 4. ¬likes(clyde,leaves) To develop a complete resolution proof procedure for ● Refutation Proof: First-Order Logic we need : First add negation of query to KB: A way of converting KB and f (the query) into clausal form. 1. 5. ¬likes(clyde,peanuts) [we focus on this in the rest of this lecture] ● 5&2 → ¬elephant(clyde) [6.] ● 6&1 → giraffe(clyde) [7.] A way of doing resolution even when we have variables 2. ● 7&3 → likes(clyde,leaves) [8.] (unification). [this will be covered in the next lecture] ● 8&4 → () ü 13 13 14 14 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance Conversion to to Clausal Form C-T-C-F: El C-T-C-F: Eliminate te implicati tions To convert the KB into Clausal form we perform We use this example to show each step: the following 8-step procedure: ∀ X.p(X) → ( ∀ Y.p(Y) → p(f(X,Y) ) 
 Λ ¬ ( ∀ Y. ¬q(X,Y) Λ p(Y) ) ) El Eliminate te Implicati tions. 1. 1. Move Negati tions inwards (and simplify ¬¬) ¬¬). 2. 2. Sta tandardize Variables. 1. Eliminate implications: A → B è ¬A ∨ B 3. 3. Skolemi Sk mize. 4. 4. Convert t to to Prenix Form. 5. 5. ∀ X. ¬p(X) 
 Di Distr tribute te conjuncti tions over disjuncti tions. 6. 6. ∨ ( ∀ Y.¬p(Y) ∨ p(f(X,Y)) 
 Flatte tten neste ted conjuncti tions and disjuncti tions. 7. 7. Λ ¬( ∀ Y. ¬q(X,Y) Λ p(Y)) ) Convert t to to Clauses. 8. 8. 15 15 16 16 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance 4

  5. C-T-C-F: Mov C-T-C-F: Move e ¬ In Inwards ards C-T-C-F: C-T-C-F: : ¬ conti tinue… … ∀ X. ¬p(X) 
 Rules for moving negations inwards ∨ ( ∀ Y.¬p(Y) ∨ p(f(X,Y)) 
 ● ¬(A Λ B) è ¬A ∨ ¬B Λ ¬( ∀ Y. ¬q(X,Y) Λ p(Y)) ) ● ¬(A ∨ B) è ¬A Λ ¬B ● ¬ ∀ X. f è ∃ X. ¬f 2. Move Negations Inwards (and simplify ¬¬) ● ¬ ∃ X. f è ∀ X. ¬f ● ¬¬A è A ∀ X. ¬p(X) 
 ∨ ( ∀ Y.¬p(Y) ∨ p(f(X,Y)) 
 Λ ∃ Y. q(X,Y) ∨ ¬p(Y) ) 17 17 18 18 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance C-T-C-F: Sta C-T-C-F: tandardize Variables C-T-C-F: Sk C-T-C-F: Skolemi mize ∀ X. ¬p(X) 
 ∀ X. ¬p(X) 
 ∨ ( ∀ Y.¬p(Y) ∨ p(f(X,Y)) 
 ∨ ( ∀ Y.¬p(Y) ∨ p(f(X,Y)) 
 Λ ∃ Y.q(X,Y) ∨ ¬p(Y) ) Λ ∃ Z.q(X,Z) ∨ ¬p(Z) ) 3. Standardize Variables (Rename variables so that each quantified variable is unique) 4. Skolemize (Remove existential quantifiers by introducing new function symbols). ∀ X. ¬p(X) 
 ∀ X. ¬p(X) 
 ∨ ( ∀ Y.(¬p(Y) ∨ p(f(X,Y)) 
 ∨ ( ∀ Y.¬p(Y) ∨ p(f(X,Y)) 
 Λ ∃ Z.q(X,Z) ∨ ¬p(Z) ) Λ q(X,g(X)) ∨ ¬p(g(X)) ) 19 19 20 20 EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance EECS3401 W 2017 Fahiem Bacchus & Yves Lesperance 5

Recommend


More recommend