Logic: Proof procedures, soundness and correctness CPSC 322 – Logic 2 Textbook §5.2 March 7, 2011.

Slides:



Advertisements
Similar presentations
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Advertisements

Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
CPSC 322, Lecture 21Slide 1 Bottom Up: Soundness and Completeness Computer Science cpsc322, Lecture 21 (Textbook Chpt 5.2) February, 27, 2009.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
CPSC 322, Lecture 19Slide 1 Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19 (Textbook Chpt ) February, 23, 2009.
Decision Theory: Single Stage Decisions Computer Science cpsc322, Lecture 33 (Textbook Chpt 9.2) March, 30, 2009.
CPSC 322, Lecture 20Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Computer Science cpsc322, Lecture 20 (Textbook.
CPSC 322 Introduction to Artificial Intelligence September 20, 2004.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 9 Jim Martin.
Knowledge Representation I (Propositional Logic) CSE 473.
CPSC 322, Lecture 21Slide 1 Bottom Up: Soundness and Completeness Computer Science cpsc322, Lecture 21 (Textbook Chpt 5.2) March, 5, 2010.
Knoweldge Representation & Reasoning
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) March, 8, 2010.
CPSC 322, Lecture 24Slide 1 Reasoning under Uncertainty: Intro to Probability Computer Science cpsc322, Lecture 24 (Textbook Chpt 6.1, 6.1.1) March, 15,
Logic: Datalog wrap-up CPSC 322 – Logic 5 Textbook §12.3 March 14, 2011.
Slide 1 Logic: TD as search, Datalog (variables) Jim Little UBC CS 322 – CSP October 24, 2014 Textbook §5.2 and 12.
Planning: Wrap up CSP Planning. Logic: Intro CPSC 322 – Planning 3 Textbook §8.4, §5.1 March 2, 2011.
Computer Science CPSC 322 Lecture 25 Logic Wrap Up Intro to Probability Slide 1.
Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Jim Little UBC CS 322 – CSP October 22, 2014.
Computer Science CPSC 502 Lecture 6 Finish Planning Start Logic (Ch 5)
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) Oct, 26, 2010.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part A Knowledge Representation and Reasoning.
Logic: Intro & Propositional Definite Clause Logic CPSC 322 – Logic 1 Textbook §5.1 March 4, 2011.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
Reasoning Under Uncertainty: Conditioning, Bayes Rule & the Chain Rule Jim Little Uncertainty 2 Nov 3, 2014 Textbook §6.1.3.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
LECTURE LECTURE Propositional Logic Syntax 1 Source: MIT OpenCourseWare.
A Logic of Partially Satisfied Constraints Nic Wilson Cork Constraint Computation Centre Computer Science, UCC.
CS6133 Software Specification and Verification
CPSC 322, Lecture 19Slide 1 (finish Planning) Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19 (Textbook Chpt – 5.2) Oct,
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
Computer Science CPSC 322 Lecture 22 Logical Consequences, Proof Procedures (Ch 5.2.2)
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Slide 1 Propositional Logic Intro, Syntax Jim Little UBC CS 322 – CSP October 17, 2014 Textbook § – 5.2.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
Domain Splitting, Local Search CPSC 322 – CSP 4 Textbook §4.6, §4.8 February 4, 2011.
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Computer Science CPSC 322 Lecture 14 Intro to Logic (5.1, 5.1.1) 1.
CPSC 322, Lecture 22Slide 1 Logic: Domain Modeling /Proofs + Top-Down Proofs Computer Science cpsc322, Lecture 22 (Textbook Chpt 5.2) Oct, 30, 2013.
Logic: TD as search, Datalog (variables)
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Computer Science cpsc322, Lecture 20
Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19
Propositional Logic Intro, Syntax Computer Science cpsc322, Lecture 19
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Propositional Definite Clause Logic: Syntax, Semantics, R&R and Proofs
Reasoning Under Uncertainty: Conditioning, Bayes Rule & Chain Rule
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Logic: Top-down proof procedure and Datalog
Assignment-2 due now Enterprise Architecture Conference Sat. Oct 27
Logic: Domain Modeling /Proofs + Computer Science cpsc322, Lecture 22
Knowledge Representation I (Propositional Logic)
Computer Science cpsc322, Lecture 20
Bottom Up: Soundness and Completeness
Bottom Up: Soundness and Completeness
Representations & Reasoning Systems (RRS) (2.2)
Bottom Up: Soundness and Completeness
Presentation transcript:

Logic: Proof procedures, soundness and correctness CPSC 322 – Logic 2 Textbook §5.2 March 7, 2011

Lecture Overview Recap: Propositional Definite Clause Logic (PDCL) -Syntax -Semantics More on PDCL Semantics Proof procedures -Soundness, Completeness, example -Bottom-up proof procedure Pseudocode and example Time-permitting: Soundness Time-permitting: Completeness 2

3 Course Overview Environment Problem Type Logic Planning Deterministic Stochastic Constraint Satisfaction Search Arc Consistency Search Logics STRIPS Variables + Constraints Variable Elimination Bayesian Networks Decision Networks Markov Processes Static Sequential Representation Reasoning Technique Uncertainty Decision Theory Course Module Variable Elimination Value Iteration Planning Static problems, but with richer representation As CSP (using arc consistency)

Representation and Reasoning System (RRS) Propositional definite clause logic (PDCL) is one such Representation and Reasoning System 4 Definition (RRS) A Representation and Reasoning System (RRS) consists of: syntax: specifies the symbols used, and how they can be combined to form legal sentences semantics: specifies the meaning of the symbols reasoning theory or proof procedure: a (possibly nondeterministic) specification of how an answer can be produced.

Example: Electrical Circuit

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 is 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. ok_w 1  live_w 0. p 1  p 2  p 3  p 4 Examples: p. p 1 ← p 2  p 3  p 4. live_w 0 ← live_w 1  up_s 2 Example: {p 2. p 3. p 4. p 1 ← p 2  p 3  p 4. live_l 1 }

atoms rules definite clauses, KB

Lecture Overview Recap: Propositional Definite Clause Logic (PDCL) -Syntax -Semantics More on PDCL Semantics Proof procedures -Soundness, Completeness, example -Bottom-up proof procedure Pseudocode and example Time-permitting: Soundness Time-permitting: Completeness 8

Propositional Definite Clauses: Semantics Semantics allows you to relate the symbols in the logic to the domain you're trying to model. 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.

PDC Semantics: Example 10 a1a1 a2a2 a1 ∧ a2a1 ∧ a2 I1I1 FFF I2I2 FTF I3I3 TFF I4I4 TTT Truth values under different interpretations F=false, T=true hb bb  b  h h ← bh ← b I1I1 FFTTT I2I2 FTFFF I3I3 TFTTT I4I4 TTFTT h ← b (“h if b”) is only false if b is true and h is false

PDC Semantics: Example for models p ← q KB = q r ← s 11 Which of the interpretations below are models of KB? pqrs p ← q q r ← s Model of KB I1I1 TTTTTTT I2I2 FFFFTFT I3I3 TTFFTTT I4I4 FTTFFTT I5I5 TTFTTTF Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. yes no yesno

PDC Semantics: Example for models 12 pqrs p ← q q r ← s Model of KB I1I1 TTTTTTTyes I2I2 FFFFTFTno I3I3 TTFFTTTyes I4I4 FTTFFTTno I5I5 TTFTTTF p ← q KB = q r ← s Which of the interpretations below are models of KB? Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true.

Lecture Overview Recap: Propositional Definite Clause Logic (PDCL) -Syntax -Semantics More on PDCL Semantics Proof procedures -Soundness, Completeness, example -Bottom-up proof procedure Pseudocode and example Time-permitting: Soundness Time-permitting: Completeness 13

PDCL Semantics: Logical Consequence Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. 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

PDCL Semantics: Logical Consequence Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. 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 p ← q KB = q r ← s Which of the following are true? KB ⊧ pKB ⊧ qKB ⊧ rKB ⊧ s

PDCL Semantics: Logical Consequence Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. 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 p ← q KB = q r ← s If KB is true, then q is true. Thus KB ⊧ q. If KB is true then both q and p ← q are true, so p is true (“p if q”). Thus KB ⊧ p. There is a model where r is false, likewise for s (but there is no model where s is true and r is false)

Motivation for Proof Procedure We want a proof procedure that can find all and only the logical consequences of a knowledge base Why? 17

User’s View of Semantics 1.Choose a task domain: intended interpretation. 2.Associate an atom with each proposition you want to represent. 3.Tell the system clauses that are true in the intended interpretation: axiomatizing the domain. 4.Ask questions about the intended interpretation. –If KB ⊧ g, then g must be true in the intended interpretation. –The user can interpret the answer using their intended interpretation of the symbols. 18

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. 19

Role of semantics In user's mind: l2_broken: light l2 is broken sw3_up: switch is up power: there is power in the building unlit_l2: light l2 isn't lit lit_l1: light l1 is lit In computer: l2_broken ← sw3_up ∧ power ∧ unlit_l2. sw3_up. power ← lit_l1. unlit_l2. lit_l1. 20 Conclusion: l2_broken -The computer doesn’t know the meaning of the symbols -The user can interpret the symbols using their meaning

Lecture Overview Recap: Propositional Definite Clause Logic (PDCL) -Syntax -Semantics More on PDCL Semantics Proof procedures -Soundness, Completeness, example -Bottom-up proof procedure Pseudocode and example Time-permitting: Soundness Time-permitting: Completeness 21

Proofs A proof 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. Recall KB ⊧ g means g is true in all models of KB. Example: simple proof procedure S –Enumerate all interpretations –For each interpretation I, check whether all clauses in KB hold If all clauses are true, I is a model KB ⊦ S g if g holds in all such models 22

Soundness of a proof procedure Soundness of some proof procedure P: need to prove that Example: simple proof procedure S –For each interpretation I, check whether all clauses in KB hold If all clauses are true, I is a model KB ⊦ S g if g holds in all such models The simple proof procedure S is sound: 23 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: everything it derives follows logically from KB (i.e. is true in every model) If KB ⊦ S g, then it is true in all models, i.e. KB ⊧ g

Completeness of a proof procedure Completeness of some proof procedure P: need to prove that Example: simple proof procedure S –For each interpretation I, check whether all clauses in KB hold If all clauses are true, I is a model KB ⊦ S g if g holds in all such models The simple proof procedure S is complete: 24 If g is true in all models of KB (KB ⊧ g) then g is derived by the procedure (KB ⊦ P g) If KB ⊧ g, i.e. g is true in all models, then KB ⊦ S g Definition (completeness) A proof procedure P is complete if KB ⊧ g implies KB ⊦ P g. complete: everything that logically follows from KB is derived

Another example for a proof procedure Unsound proof procedure U: –U derives every atom: for any g, KB ⊦ U g Proof procedure U is complete: Proof procedure U is not sound: 25 If KB ⊧ g, then KB ⊦ S g (because KB ⊦ U g for any g) Proof by counterexample: KB = {a ← b.} KB ⊦ U a, but not KB ⊧ a (a is false in some model, e.g. a=false, b=false)

Problem of the simplistic proof procedure Simple proof procedure: enumerate all interpretations –For each interpretation, check whether all clauses in KB hold If all clauses hold, the interpretation is a model KB ⊦ g if g holds in all such models What’s the problem with this approach? 26 Space complexityTime complexityNot soundNot complete

Problem of the simplistic proof procedure Enumerate all interpretations –For each interpretation, check whether all clauses of the knowledge base hold –If all clauses hold, the interpretation is a model Very much like the generate-and-test approach for CSPs Sound and complete, but there are a lot of interpretations –For n propositions, there are 2 n interpretations 27

Lecture Overview Recap: Propositional Definite Clause Logic (PDCL) -Syntax -Semantics More on PDCL Semantics Proof procedures -Soundness, Completeness, example -Bottom-up proof procedure Pseudocode and example Time-permitting: Soundness Time-permitting: Completeness 28

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. 29

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. 30

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 31 a ← b  c a ← e  f b ← f  k c ← e d ← k e. f ← j  e f ← c j ← c {}

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 32 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} {a,c,e,f,j} Done.

Lecture Overview Recap: Propositional Definite Clause Logic (PDCL) -Syntax -Semantics More on PDCL Semantics Proof procedures -Soundness, Completeness, example -Bottom-up proof procedure Pseudocode and example Time-permitting: Soundness Time-permitting: Completeness 33

Soundness of bottom-up proof procedure BU 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. For soundness of bottom-up proof procedure BU: prove 34 Definition (soundness) A proof procedure P is sound if KB ⊦ P g implies KB ⊧ g. sound: everything it derives follows logically from KB (i.e. is true in every model) If g  C at the end of BU procedure, then g is true in all models of KB (KB ⊧ g)

Soundness of bottom-up proof procedure BU 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. For soundness of bottom-up proof procedure BU: prove By contradiction: Suppose there is a g such that KB ⊦ g but not KB ⊧ g. –Let h be first atom added to C that's not true in every model of KB In particular, suppose I is a model of KB in which h isn't true. –There must be a clause in KB of form h ← b 1  …  b m –Each b i is true in I. h is false in I. So this clause is false in I. –Thus, I is not a model of KB. Contradiction: thus no such g exists If g  C at the end of BU procedure, then g is true in all models of KB (KB ⊧ g)

Lecture Overview Recap: Propositional Definite Clause Logic (PDCL) -Syntax -Semantics More on PDCL Semantics Proof procedures -Soundness, Completeness, example -Bottom-up proof procedure Pseudocode and example Time-permitting: Soundness Time-permitting: Completeness 36

Minimal Model Observe that the C generated at the end of the bottom-up algorithm is a fixed point –Further applications of our rule of derivation will not change C! Lemma: MM is a model of KB. –Proof by contradiction. Assume that MM is not a model of KB. Then there must exist some clause of the form h ← b 1  …  b m in KB (with m  0) which is false in MM. This can only occur when h is false and each b i is true in MM. Since each b i belonged to C, we would have added h to C as well. But MM is a fixed point, so nothing else gets added. Contradiction! 37 Definition (minimal model) The minimal model MM is the interpretation in which every element of BU’s fixed point C is true and every other atom is false.

Completeness of bottom-up procedure For completeness of BU, we need to prove: Direct proof based on Lemma about minimal model: Suppose KB ⊧ g. Then g is true in all models of KB. Thus g is true in the minimal model. Thus g is generated by the bottom up algorithm. Thus KB ⊦ BU g. 38 Definition (completeness) A proof procedure is complete if KB ⊧ g implies KB ⊦ g. If g is true in all models of KB (KB ⊧ g) then g is derived by the BU procedure (KB ⊦ BU g) complete: everything that logically follows from KB is derived

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 bases Bottom-up proof procedure Define/read/write/trace/debug the Bottom Up (BU) proof procedure Prove that the BU proof procedure is sound and complete