Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)

Similar presentations


Presentation on theme: "Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)"— Presentation transcript:

1 Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)

2 Announcements Practice Exercise on Planning as CSP (can help with Assign 3 Q2 Practice exercise on logic is available on the class syllabus Pay special attention to “Directed Questions”. They can really help you do well on the conceptual questions part of the final Show you how to be precise when you define concepts After today you can do Q3a in assign 3 Slide 2

3 Lecture Overview Recap Lecture 21 Logical Consequences Proof Procedures Bottom-Up Proof Procedure Slide 3

4 Where Are We? Environment Problem Type Query Planning Deterministic Stochastic Constraint Satisfaction Search Arc Consistency Search Logics STRIPS Vars + Constraints Value Iteration Variable Elimination Belief Nets Decision Nets Markov Processes Static Sequential Representation Reasoning Technique Variable Elimination Back to static problems, but with richer representation Slide 4

5 Logic: a framework for representation & reasoning When we represent a domain about which we have only partial (but certain) information, we need to represent…. Objects, properties, sets, groups, actions, events, time, space, … All these can be represented as Objects Relationships between objects Logic is the language to express knowledge about the world this way 5 We will start with a simple logic Primitive elements are propositions: Boolean variables that can be {true, false} Two kinds of statements: that a proposition is true that a proposition is true if one or more other propositions are true

6 To Define a Logic We Need Syntax: specifies the symbols used, and how they can be combined to form legal sentences Knowledge base is a set of sentences in the language Semantics: specifies the meaning of symbols and sentences Reasoning theory or proof procedure: a specification of how an answer can be produced. Sound: only generates correct answers with respect to the semantics Complete: Guaranteed to find an answer if it exists Slide 6

7 Propositional Definite Clauses: Syntax Definition (atom) An atom is a symbol starting with a lower case letter Definition (body) A body is an atom or is of the form b 1 ∧ b 2 where b 1 and b 2 are bodies. Definition (definite clause) A definite clause is - an atom or - a rule of the form h ← b where h is an atom (“head”) and b is a body. (Read this as “h if b”.) Definition (KB) A knowledge base (KB) is a set of definite clauses Examples: p 1 ; live_l 1 Examples: p 1 ∧ p 2 ; ok_w 1 ∧ live_w 0 Examples: p 1 ← p 2 ; live_w 0 ← live_w 1 ∧ up_s 2 Slide 7

8 Propositional Definite Clauses: Semantics 8 Definition (interpretation) An interpretation I assigns a truth value to each atom. Definition (truth values of statements) A body b 1 ∧ b 2 is true in I if and only if b 1 is true in I and b 2 is true in I. A rule h ← b is false in I if and only if b is true in I and h is false in I. A knowledge base KB is true in I if and only if every clause in KB is true in I.

9 PDC Semantics: Knowledge Base (KB) pqrs I1I1 true false p r s ← q ∧ p p q s ← q p q ← r ∧ s A. KB 1 B. KB 2 C. KB 3 Which of the three KB above is True in I 1 A knowledge base KB is true in I if and only if every clause in KB is true in I. Slide 9

10 Slide 10 PDC Semantics: Knowledge Base (KB) pqrs I1I1 true false p q ← r ∧ s KB 3 Which of the three KB above are True in I 1 ?KB 3 A knowledge base KB is true in I if and only if every clause in KB is true in I.

11 Propositional Definite Clauses: Semantics 11 Definition (model) A model of a knowledge base KB is an interpretation in which KB is true. Similar to CSPs: a model of a set of clauses is an interpretation that makes all of the clauses true Definition (interpretation) An interpretation I assigns a truth value to each atom. Definition (truth values of statements) A body b 1 ∧ b 2 is true in I if and only if b 1 is true in I and b 2 is true in I. A rule h ← b is false in I if and only if b is true in I and h is false in I. A knowledge base KB is true in I if and only if every clause in KB is true in I.

12 PDC Semantics: Example for models p ← q KB = q r ← s Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. pqrs I1I1 TTTT I2I2 FFFF I3I3 TTFF I4I4 TTTF I5I5 FTFT Which of the interpretations below are models of KB? B. I 1, I 3 C. I 1, I 3, I 4 D. All of them A. I 3 Slide 12

13 PDC Semantics: Example for models pqrs p ← q q r ← s KB I1I1 TTTTTTTT I2I2 FFFFTFTF I3I3 TTFFTTTT I4I4 TTTFTTTT I5I5 FTFTFTFF Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. p ← q KB = q r ← s Which of the interpretations below are models of KB? All interpretations where KB is true: I 1, I 3, and I 4 Slide 13

14 Slide 14 OK but…. …. Who cares? Where are we going with this? Remember what we want to do with Logic 1) Tell the system knowledge about a task domain. This is your KB which expresses true statements about the world 2) Ask the system whether new statements about the domain are true or false. We want the system responses to be –Sound: only generates correct answers with respect to the semantics –Complete: Guaranteed to find an answer if it exists

15 For Instance 1) Tell the system knowledge about a task domain. 2) Ask the system whether new statements about the domain are true or false live_w 4 ? lit_l 2 ? Slide 15

16 Slide 16 To Obtain This We Need One More Definition

17 Lecture Overview Recap Lecture 21 Logical Consequences Proof Procedures Bottom-Up Proof Procedure Slide 17

18 Slide 18 To Obtain This We Need One More Definition Definition (logical consequence) If KB is a set of clauses and G is a conjunction of atoms, G is a logical consequence of KB, written KB ⊧ G, if G is true in every model of KB. we also say that G logically follows from KB, or that KB entails G. In other words, KB ⊧ G if there is no interpretation in which KB is true and G is false. when KB is TRUE, then G must be TRUE We want a reasoning procedure that can find all and only the logical consequences of a knowledge base

19 Example of Logic Entailment How many models are there? A. 1B. 2C. 3D. 4 E. 5 Slide 19

20 Interpretations rqp TTT TTF TFT TFF FTT FTF FFT FFF Example of Logic Entailment How many models are there? A. 1B. 2C. 3D. 4 E. 5 Slide 20

21 Interpretations rqp TTT TTF TFT TFF FTT FTF FFT FFF Models Which atoms are logically entailed? q Example of Logic Entailment We want a reasoning procedure that can find all and only the logical consequences of a knowledge base Slide 21

22 Example: Logical Consequences pqrs I1I1 true I2I2 false I3I3 true false I4I4 true falsetrue I5I5 falsetrue I6I6 falsetrue false I7I7 truefalse I8I8 truefalsetrue I9I9 falsetrue I 10 truefalsetruefalse I 11 truefalse I 12 truefalse …..………..…………. Which of the following is true? A. KB ⊧ q and KB ⊧ r B. KB ⊧ q, and KB ⊧ s C. KB ⊧ q, and KB ⊧ p D. KB ⊧ r, KB ⊧ s, E. None of the above

23 Example: Logical Consequences pqrs I1I1 true I2I2 false I3I3 true false I4I4 true falsetrue I5I5 falsetrue I6I6 falsetrue false I7I7 truefalse I8I8 truefalsetrue I9I9 falsetrue I 10 truefalsetruefalse I 11 truefalse I 12 truefalse …..………..…………. Which of the following is true? KB ⊧ q, KB ⊧ p, KB ⊧ s, KB ⊧ r Slide 23

24 Example: Logical Consequences pqrs I1I1 true I2I2 false I3I3 true false I4I4 true falsetrue I5I5 falsetrue I6I6 falsetrue false I7I7 truefalse I8I8 truefalsetrue I9I9 falsetrue I 10 truefalsetruefalse I 11 truefalse I 12 truefalse …..………..…………. Which of the following is true? KB ⊧ q, KB ⊧ p, KB ⊧ s, KB ⊧ r T T F F Slide 24

25 Example: Logical Consequences pqrs I1I1 true I2I2 false I3I3 true false I4I4 true falsetrue I5I5 falsetrue I6I6 falsetrue false I7I7 truefalse I8I8 truefalsetrue I9I9 falsetrue I 10 truefalsetruefalse I 11 truefalse I 12 truefalse …..………..…………. Which of the following is true? C. KB ⊧ q, and KB ⊧ p

26 User’s View of Semantics Choose a task domain: intended interpretation. For each proposition you want to represent, associate a proposition symbol in the language. Tell the system clauses that are true in the intended interpretation: axiomatize the domain. Ask questions about the intended interpretation. If KB |= g, then g must be true in the intended interpretation. Slide 26

27 Computer’s View of Semantics The computer doesn’t have access to the intended interpretation. All it knows is the knowledge base. The computer can determine if a formula is a logical consequence of KB. If KB |= g then g must be true in the intended interpretation. Otherwise, there is a model of KB in which g is false. This could be the intended interpretation. The computer wouldn't know! Slide 27

28 Computer’s View of Semantics Otherwise, there is a model of KB in which g is false. This could be the intended interpretation. The computer wouldn't know pqrs I1I1 true I2I2 false Slide 28

29 To Define a Logic We Need Syntax: specifies the symbols used, and how they can be combined to form legal sentences Knowledge base is a set of sentences in the language Semantics: specifies the meaning of symbols and sentences Reasoning theory or proof procedure: a specification of how an answer can be produced ( sound and complete) Bottom-up and Top-Down Proof Procedure for Finding Logical Consequence Slide 29

30 Lecture Overview Recap Lecture 21 Logical Consequences Proof Procedures Bottom-Up Proof Procedure Slide 30

31 Proof Procedures A proof procedure is a mechanically derivable demonstration that a formula logically follows from a knowledge base. Given a proof procedure P, KB ⊦ P g means g can be derived from knowledge base KB with the proof procedure. If I tell you I have a proof procedure for PDCL What do I need to show you in order for you to trust my procedure? That is sound and complete Slide 31

32 Soundness and Completeness Completeness of proof procedure P: need to prove that If g is true in all models of KB (KB ⊧ g) then g is derived by the procedure (KB ⊦ P g) Definition (completeness) A proof procedure P is complete if KB ⊧ g implies KB ⊦ P g. complete: every atom that logically follows from KB is derived by P Soundness of proof procedure P: need to prove that Definition (soundness) A proof procedure P is sound if KB ⊦ P g implies KB ⊧ g. If g can be derived by the procedure (KB ⊦ P g) then g is true in all models of KB (KB ⊧ g) sound: every atom derived by P follows logically from KB (i.e. is true in every model) Slide 32

33 Simple Proof Procedure problem with this approach? If there are n propositions in the KB, must check all the interpretations! Goal of proof theory find sound and complete proof procedures that allow us to prove that a logical formula follows from a KB avoiding to do the above Simple proof procedure S Enumerate all interpretations For each interpretation I, check whether it is a model of KB i.e., check whether all clauses in KB are true in I KB ⊦ S g if g holds in all such models Slide 33

34 Simple Proof Procedure problem with this approach? If there are n propositions in the KB, must check all the interpretations! Goal of proof theory find sound and complete proof procedures that allow us to prove that a logical formula follows from a KB avoiding to do the above Simple proof procedure S Enumerate all interpretations For each interpretation I, check whether it is a model of KB i.e., check whether all clauses in KB are true in I KB ⊦ S g if g holds in all such models Slide 34

35 Lecture Overview Recap Lecture 21 Logical Consequences Proof Procedures Bottom-Up Proof Procedure Slide 35

36 Bottom-up proof procedure One rule of derivation, a generalized form of modus ponens: If “h ← b 1  …  b m " is a clause in the knowledge base, and each b i has been derived, then h can be derived. This rule also covers the case when m = 0. Slide 36

37 Bottom-up proof procedure C :={}; repeat select clause “h ← b 1 ∧ … ∧ b m ” in KB such that b i ∈ C for all i, and h ∉ C; C := C ∪ { h } until no more clauses can be selected. KB ⊦ G if G ⊆ C at the end of this procedure Slide 37 The C at the end of BU procedure is a fixed point: Further applications of our rule of derivation will not change C!

38 C := {}; repeat select clause h ← b 1  …  b m in KB such that b i  C for all i, and h  C; C := C  {h} until no more clauses can be selected. Bottom-up proof procedure: example a ← b  c a ← e  f b ← f  k c ← e d ← k e. f ← j  e f ← c j ← c {} Slide 38

39 C := {}; repeat select clause h ← b 1  …  b m in KB such that b i  C for all i, and h  C; C := C  {h} until no more clauses can be selected. Bottom-up proof procedure: example a ← b  c a ← e  f b ← f  k c ← e d ← k e. f ← j  e f ← c j ← c {} {e} {c,e} {c,e,f} {c,e,f,j} {c,e,f,j, a} Done. Slide 39

40 Bottom-up proof procedure: Example z ← f ∧ e q ← f ∧ g ∧ z e ← a ∧ b a b r f A. KB ⊦ {z, q, a} KB C := {}; repeat select clause h ← b 1  …  b m in KB such that b i  C for all i, and h  C; C := C  {h} until no more clauses can be selected. Which of the following is true? B. KB ⊦ {r, z, b} C. KB ⊦ {q,a} Slide 40

41 Bottom-up proof procedure: Example z ← f ∧ e q ← f ∧ g ∧ z e ← a ∧ b a b r f KB C := {}; repeat select clause h ← b 1  …  b m in KB such that b i  C for all i, and h  C; C := C  {h} until no more clauses can be selected. Which of the following is true? B. KB ⊦ {r, z, b} Slide 41

42 Learning Goals Up To Here PDCL syntax & semantics - Verify whether a logical statement belongs to the language of propositional definite clauses ‾Verify whether an interpretation is a model of a PDCL KB. ‾Verify when a conjunction of atoms is a logical consequence of a knowledge base Bottom-up proof procedure Define/read/write/trace/debug the Bottom Up (BU) proof procedure Next Time: we will prove soundness and completeness Slide 42


Download ppt "Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)"

Similar presentations


Ads by Google