Presentation is loading. Please wait.

Presentation is loading. Please wait.

9/30/98 Prof. Richard Fikes Inference In First Order Logic Computer Science Department Stanford University CS222 Fall 1998.

Similar presentations


Presentation on theme: "9/30/98 Prof. Richard Fikes Inference In First Order Logic Computer Science Department Stanford University CS222 Fall 1998."— Presentation transcript:

1 9/30/98 Prof. Richard Fikes Inference In First Order Logic Computer Science Department Stanford University CS222 Fall 1998

2 2 Knowledge Systems Laboratory, Stanford University KR Language Components logical formalism u A logical formalism ä Syntax for wffs ä Vocabulary of logical symbols ä Interpretation semantics for the logical symbols E.g., (=> (Person ?x) (= (Gender (Mother ?x)) Female))) ontology u An ontology ä Vocabulary of non-logical symbols › Relations, functions, constants ä Axioms restricting the interpretations of the symbols E.g., (=> (Person ?x) (= (Gender (Mother ?x)) Female))) proof theory u A proof theory ä Specification of the reasoning steps that are logically sound E.g., (=> S 1 S 2 ) and S 1 entails S 2

3 3 Knowledge Systems Laboratory, Stanford University Logical Entailment u Logical Satisfaction Interpretation I logically satisfies a sentence S if and only if T IV (S) is true for all V. E.g., (=> (Block ?b1) (or (On ?b1 table) (exists ?b2 (On ?b1 b2)))) u Models Interpretation I is a model of a sentence S if and only if I logically satisfies S. u Logical Entailment Sentence S1 logically entails sentence S2 if and only if every model of S1 is also a model of S2. E.g., (and S3 (=> S3 S4)) logically entails S4

4 4 Knowledge Systems Laboratory, Stanford University InferenceInference u Inference - Determining conclusions logically entailed by premises u Patterns of inference represented as inference rules u Example inference rules - Modus Ponens Modus Tollens (implies S 1 S 2 ), S 1 (implies S 1 S 2 ), (not S 2 )  S 2 (not S 1 ) u An inference rule can be verified using a truth table S 1 S 2 (not S 1 )(not S 2 )(implies S 1 S 2 ) _____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ TrueTrueFalseFalseTrue TrueFalseFalseTrueFalse FalseTrueTrueFalseTrue FalseFalseTrueTrueTrue

5 5 Knowledge Systems Laboratory, Stanford University Inference Rules u Transitivity of Equal  Unit Resolution (= T1 T2), (= T1 T3)(or S1 S2), (not S1)  (= T2 T3) S2 u Modus Tollens  Universal Elimination (=> S1 S2), (not S2) (forall ?var S)  (not S1) Subst({?var/g}, S) u And Elimination  And Introduction (and S1 … Sn) S1, …, Sn Si (and S1 … Sn) u Existential Introduction Given sentence S in which variable ?var does not occur: S  (exists ?var Subst({?var/C}, S)

6 6 Knowledge Systems Laboratory, Stanford University ProofsProofs u Proof of sentence S n in knowledge base KB ä Sentence sequence S 1, S 2, …, S n such that each S i is › A sentence in KB, or › Inferable from sentences occurring previously in the proof u Standard proof techniques ä Deduction Theorem › If KB  S1 |– S2, then KB |– (implies S1 S2) › To prove (implies S1 S2): Assume S1. Derive S2. ä Refutation Theorem › If KB  (not S) |– false, then KB |– S › To prove S: Assume (not S). Prove false.

7 7 Knowledge Systems Laboratory, Stanford University Sample Query u Do inputs (On, On, Off) produce outputs (Off, On)? u Prove: (=> (= (Signal (In 1 C1)) On) (= (Signal (In 2 C1)) On) (= (Signal (In 3 C1)) Off) (and (= (Signal (Out 1 C1)) Off) (= (Signal (Out 2 C1)) On))) u Using the Deduction Theorem - ä Assume: (= (Signal (In 1 C1)) On) (= (Signal (In 2 C1)) On) (= (Signal (In 3 C1)) Off) ä Prove: (and (= (Signal (Out 1 C1)) Off) (= (Signal (Out 2 C1)) On)

8 8 Knowledge Systems Laboratory, Stanford University The Inputs of X 1 are Equal [1](=> (Connected ?t1 ?t2) (= (Signal ?t1) (Signal ?t2))){Given} [2](=> (Connected (In 1 C 1 ) (In 1 X 1 )) (= (Signal (In 1 C 1 )) (Signal (In 1 X 1 )))){[1]: Univ. Elim.} [3](Connected (In 1 C 1 ) (In 1 X 1 )){Given} [4](= (Signal (In 1 C 1 )) (Signal (In 1 X 1 ))){[2],[3]: Modus Ponens} [5](= (Signal (In 1 C 1 )) On){Given} [6](= (Signal (In 1 X 1 )) On){[4],[5]: Trans. Of =} … [12](= (Signal (In 2 X 1 )) On){[10],[11]: Trans. Of =} [13](= (Signal (In 1 X 1 )) (Signal (In 2 X 1 ))){[6],[12]: Trans. Of =}

9 9 Knowledge Systems Laboratory, Stanford University The Output of X 1 is Off [21](=> (= (Type ?g) XOR) ( (= (Signal (Out 1 ?g)) On) (not (= (Signal (In 1 ?g) (Signal (In 2 ?g)))))){Given} [22](=> (= (Type X 1 ) XOR) ( (= (Signal (Out 1 X 1 )) On) (not (= (Signal (In 1 X 1 ) (Signal (In 2 X 1 )))))){[21]: Univ. Elim.} [23](= (Type X 1 ) XOR){Given} [24]( (= (Signal (Out 1 X 1 )) On) (not (= (Signal (In 1 X 1 ) (Signal (In 2 X 1 ))))){[22],[23]; M. P.} [25](=> (= (Signal (Out 1 X 1 )) On) (not (= (Signal (In 1 X 1 ) (Signal (In 2 X 1 ))))){[24]: And Elim.} [26](not (= (Signal (Out 1 X 1 )) On)){[13],[25]: M. T.} [27](or (= (Signal ?t) On) (= (Signal ?t) Off)){Given} [28](or (= (Signal X 1 ) On) (= (Signal X 1 ) Off)){[27]: Univ. Elim.} [29](= (Signal (Out 1 X 1 )) Off){[26],[28]: U. Res.}

10 10 Knowledge Systems Laboratory, Stanford University Generalized Modus Ponens u Example inference ä Given – › (Missile M1) › (Owns Nono M1) › (=> (Missile ?x) (Owns Nono ?x) (Sold West Nono ?x)) ä Infer in one proof step: (Sold West Nono M1) u Needed: an inference rule combining – ä And Introduction ä Universal Elimination ä Modus Ponens

11 11 Knowledge Systems Laboratory, Stanford University Generalized Modus Ponens u := | (not ) | u Subst( , S) – result of applying substitution  to sentence S E.g., Subst({?x/Sam, ?y/Pam}, (Likes ?x ?y)) = (Likes Sam Pam) u Inference rule – For literals p 1, …, p n, p 1 ’, …, p n ’, and q, where there is a substitution  such that Subst( , p 1 ’) = Subst( , p 1 ), …, Subst( , p n ’) = Subst( , p n ): p 1 ’, …, p n ’, (=> p 1 … p n q)  Subst( , q)

12 12 Knowledge Systems Laboratory, Stanford University Generalized Modus Ponens u Inference rule – p 1 ’, …, p n ’, (=> p 1 … p n q)  Subst( , q) u Example inference ä p 1 ’: (Missile M1) ä p 2 ’: (Owns Nono M1) ä (=> (Missile ?x) (Owns Nono ?x) (Sold West Nono ?x)) › p 1 : (Missile ?x) › p 2 : (Owns Nono ?x) › q: (Sold West Nono ?x) ä Subst({?x/M1}, (Sold West Nono ?x) ): (Sold West Nono M1)

13 13 Knowledge Systems Laboratory, Stanford University The Inputs of X 1 are Equal [1](=> (Connected ?t1 ?t2) (= (Signal ?t1) (Signal ?t2))){Given} [2](=> (Connected (In 1 C 1 ) (In 1 X 1 )) (= (Signal (In 1 C 1 )) (Signal (In 1 X 1 )))){[1]: Univ. Elim.} [3](Connected (In 1 C 1 ) (In 1 X 1 )){Given} [4](= (Signal (In 1 C 1 )) (Signal (In 1 X 1 ))){[1],[3]: Gen. Modus Ponens} [5](= (Signal (In 1 C 1 )) On){Given} [6](= (Signal (In 1 X 1 )) On){[4],[5]: Trans. Of =} … [12](= (Signal (In 2 X 1 )) On){[10],[11]: Trans. Of =} [13](= (Signal (In 1 X 1 )) (Signal (In 2 X 1 ))){[6],[12]: Trans. Of =}

14 14 Knowledge Systems Laboratory, Stanford University Canonical Form u GMP requires all sentences to be: ä Literals or ä Implications of the form (=> p 1 … p n q), where p 1, …, p n, and q are literals (called Implicative Normal Form) u Any sentence can be converted into those forms E.g., (=> (Type ?g OR) ( (Signal (Out 1 ?g) On) (exists ?i (Signal (In ?i ?g) On)))) can be converted to: ä (=> (Type ?g OR) (Signal (Out 1 ?g) On) (Signal (In (Sk1 ?g) ?g) On)) ä (=> (Type ?g OR) (Signal (In (Sk1 ?g) ?g) On) (Signal (Out 1 ?g) On))

15 15 Knowledge Systems Laboratory, Stanford University Canonical Form u Implications can be redundantly expressed with each primitive sentence as the consequent E.g., (=> (Type ?g OR) (Signal (Out 1 ?g) On) (Signal (In (Sk1 ?g) ?g) On)) can be also be expressed as: ä (=> (Type ?g) OR) (not (Signal (In (Sk1 ?g) ?g) On)) (not (Signal (Out 1 ?g) On))) and ä (=> (not (Signal (In (Sk1 ?g) ?g) On)) (Signal (Out 1 ?g) On) (not (Type ?g OR)))

16 16 Knowledge Systems Laboratory, Stanford University ReadingsReadings u For 10/5 ä Proofs and inference rules for first order logic ä Primary readings › Russell and Norvig 9.1-4 - Inference in First-Order Logic u For 10/7 ä Model elimination proof procedure ä Primary readings › Russell and Norvig 10.4 - Theorem Provers


Download ppt "9/30/98 Prof. Richard Fikes Inference In First Order Logic Computer Science Department Stanford University CS222 Fall 1998."

Similar presentations


Ads by Google