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

Slides:



Advertisements
Similar presentations
1 Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms Inference in propositional.
Advertisements

Department of Computer Science Undergraduate Events More
Decision Theory: Sequential Decisions Computer Science cpsc322, Lecture 34 (Textbook Chpt 9.3) Nov, 28, 2012.
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.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
CPSC 322, Lecture 30Slide 1 Reasoning Under Uncertainty: Variable elimination Computer Science cpsc322, Lecture 30 (Textbook Chpt 6.4) March, 23, 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.
CS 561, Sessions Knowledge and reasoning – second part Knowledge representation Logic and representation Propositional (Boolean) logic Normal forms.
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.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
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 31Slide 1 Probability and Time: Markov Models Computer Science cpsc322, Lecture 31 (Textbook Chpt 6.5) March, 25, 2009.
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,
Slide 1 Logic: TD as search, Datalog (variables) Jim Little UBC CS 322 – CSP October 24, 2014 Textbook §5.2 and 12.
Intro to Discrete Structures
Planning: Wrap up CSP Planning. Logic: Intro CPSC 322 – Planning 3 Textbook §8.4, §5.1 March 2, 2011.
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)
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.
CPSC 322, Lecture 23Slide 1 Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from.
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.
Slide 1 Propositional Logic Intro, Syntax Jim Little UBC CS 322 – CSP October 17, 2014 Textbook § – 5.2.
Logic: Proof procedures, soundness and correctness CPSC 322 – Logic 2 Textbook §5.2 March 7, 2011.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
Chapter 1 Logic and proofs
Computer Science CPSC 322 Lecture 14 Intro to Logic (5.1, 5.1.1) 1.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
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
Propositional Definite Clause Logic: Syntax, Semantics, R&R and Proofs
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
CS 416 Artificial Intelligence
Knowledge and reasoning – second part
Logic: Domain Modeling /Proofs + Computer Science cpsc322, Lecture 22
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:

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

Announcements Two sets of practice exercises on logic are now available (#8 and #9) Do them! Pay special attention to “Directed Questions”. They can really help you do well on the conceptual questions part of the final Can show you how to be precise when you define concepts After today’s class, you will know enough to do Q2 –a,b,c in Assignment 3 Perhaps d and e as well, depending on how far we get

Lecture Overview Recap Lecture 24 Bottom-Up Proof Procedure Soundness Completeness Intro to Top-Down Proof Procedure (time permitting)

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

Logic: a framework for representation & reasoning 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

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

Propositional Definite Clauses: Semantics 7 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.

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. Need a proof procedure that allows the system give responses that are –Sound: only generates correct answers with respect to the semantics –Complete: Guaranteed to find an answer if it exists

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 ?

PDCL Semantics: Logical Consequence Definition (model) A model of a knowledge base KB is an interpretation in which every clause in KB is true. In other words, KB ⊧ g if there is no interpretation in which KB is true and g is false We want a reasoning procedure that can find all and only the logical consequences of a knowledge base 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

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

Recap: proofs, soundness, completeness A proof is a mechanically derivable demonstration that a formula logically follows from a knowledge base. Definition (derivability with a proof procedure) Given a proof procedure P, KB ⊦ P g means g can be derived from knowledge base KB with proof procedure P. Definition (soundness) A proof procedure P is sound if KB ⊦ P g implies KB ⊧ g. sound: every atom g that P derives follows logically from KB Definition (completeness) A proof procedure P is complete if KB ⊧ g implies KB ⊦ P g. complete: every atom g that logically follows from KB is derived by P

Lecture Overview Recap Lecture 24 Bottom-Up Proof Procedure Soundness Completeness Intro to Top-Down Proof Procedure (time permitting)

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.

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

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 {}

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

Lecture Overview Recap Lecture 24 Bottom-Up Proof Procedure Soundness Completeness Top-Down Proof Procedure (time permitting)

Soundness of bottom-up proof procedure BU What do we need to prove to show that BU is sound ? sound: every atom g that P derives follows logically from KB Definition (soundness) A proof procedure P is sound if KB ⊦ P g implies KB ⊧ g. 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.

Soundness of bottom-up proof procedure BU What do we need to prove to show that BU is sound ? If g  C at the end of BU procedure, then g is true in all models of KB (KB ⊧ g) sound: every atom g that P derives follows logically from KB Definition (soundness) A proof procedure P is sound if KB ⊦ P g implies KB ⊧ g. 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.

Soundness of bottom-up proof procedure BU By contradiction: Suppose there is a g such that KB ⊦ g but not KB ⊧ g. If g  C at the end of BU procedure, then g is true in all models of KB (KB ⊧ g) What do we need to prove to show that BU is sound ? Let h be the first atom added to C that is 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 n where each b i is true in I. Because h is false in I, this clause is false in I. Therefore I is not a model of KB => Contradiction

Lecture Overview Recap Lecture 24 Bottom-Up Proof Procedure Soundness Completeness Top-Down Proof Procedure (time permitting)

We define a specific model of our KB, in which every atom in C at the end of BU is true every other atom is false This is called minimal model Using this model, we’ll then show that, if KB ⊧ G, then G must be in C, that is Proof: general idea If g is true in all models of KB (KB ⊧ g) then g  C at the end of BU procedure (KB ⊦ BU g)

Minimal Model The C at the end of BU procedure is a fixed point: Further applications of our rule of derivation will not change C! Definition (minimal model) The minimal model MM is the interpretation in which – -every element of BU’s fixed point C is true -every other atom is false. 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.

Minimal model MM is a model of KB Proof by contradiction. Assume that MM is not a model of KB. Then there must exist some clause in KB which is false in MM Like every clause in KB, it is of the form h ← b 1  …  b m (with m  0). h ← b 1  …  b m can only be false in MM if each b i is true in MM and h is false in MM. Since each b i is true in MM, each b i must be in C as well. BU would add h to C, so h would be true in MM Contradiction! Thus, MM is a model of KB Definition (minimal model) The minimal model MM is the interpretation in which -every element of BU’s fixed point C is true -every other atom is false.

Completeness of bottom-up procedure What do we need to prove to show that BU is complete? complete: everything that logically follows from KB is derived Definition (completeness) A proof procedure P is complete if KB ⊧ g implies KB ⊦ P g. If g is true in all models of KB (KB ⊧ g) then g  C at the end of BU procedure (KB ⊦ BU g)

Completeness of bottom-up procedure Direct proof based on minimal model: Suppose KB ⊧ g. Then g is true in all models of KB. Thus g is true in the minimal model. Thus g  C at the end of BU procedure. Thus KB ⊦ BU g. Done. KB ⊧ g implies KB ⊦ BU g If g is true in all models of KB (KB ⊧ g) then g  C at the end of BU procedure (KB ⊦ BU g)

Summary for bottom-up proof procedure BU BU is sound: it derives only atoms that logically follow from KB BU is complete: it derives all atoms that logically follow from KB Together: it derives exactly the atoms that logically follow from KB And, it is efficient! Linear in the number of clauses in KB Each clause is used maximally once by BU

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 Prove that the BU proof procedure is sound and complete

Bottom-up vs. Top-down KB g is proved if g  C When does BU look at the query? g Bottom-up At the beginning In every loop iterationNever At the end C

Bottom-up vs. Top-down Key Idea of top-down: search backward from a query g to determine if it can be derived from KB. KB C g is proved if g  C When does BU look at the query g? Never It derives the same C regardless of the query Bottom-up Top-down TD performs a backward search starting at g KB answer Query G