Slide 1 Propositional Logic Intro, Syntax Jim Little UBC CS 322 – CSP October 17, 2014 Textbook § 5.1- 5.1.1 – 5.2.

Slides:



Advertisements
Similar presentations
Department of Computer Science Undergraduate Events More
Advertisements

Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Computer Science CPSC 322 Lecture 22 Finish Planning as CSP and Planning Wrap-up (Ch 8.4)
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) Sept, 11, 2013.
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
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.
CPSC 322, Lecture 4Slide 1 Search: Intro Computer Science cpsc322, Lecture 4 (Textbook Chpt ) January, 12, 2009.
CPSC 322, Lecture 18Slide 1 Planning: Heuristics and CSP Planning Computer Science cpsc322, Lecture 18 (Textbook Chpt 8) February, 12, 2010.
CPSC 322, Lecture 11Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Computer Science cpsc322, Lecture 11 (Textbook Chpt 4.0 – 4.2) January,
CPSC 322, Lecture 20Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Computer Science cpsc322, Lecture 20 (Textbook.
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.
CPSC 322, Lecture 21Slide 1 Bottom Up: Soundness and Completeness Computer Science cpsc322, Lecture 21 (Textbook Chpt 5.2) March, 5, 2010.
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.
CPSC 322, Lecture 24Slide 1 Finish Logics… Reasoning under Uncertainty: Intro to Probability Computer Science cpsc322, Lecture 24 (Textbook Chpt 6.1, 6.1.1)
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 322 Lecture 3 AI Applications 1.
Slide 1 Constraint Satisfaction Problems (CSPs) Introduction Jim Little UBC CS 322 – CSP 1 September 27, 2014 Textbook §
Computer Science CPSC 502 Lecture 6 Finish Planning Start Logic (Ch 5)
Computer Science CPSC 322 Lecture 4 Search: Intro (textbook Ch: ) 1.
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.
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.
CPSC 322, Lecture 6Slide 1 Planning + Intro Logics Computer Science cpsc322, Lecture 6 (Textbook Chpt , 8.4) May, 23, 2012.
CPSC 322, Lecture 18Slide 1 Planning: Heuristics and CSP Planning Jim Little UBC CS 322 October 15, 2014 Textbook §8.
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)
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
Logic: Proof procedures, soundness and correctness CPSC 322 – Logic 2 Textbook §5.2 March 7, 2011.
CPSC 322, Lecture 2Slide 1 Representational Dimensions Computer Science cpsc322, Lecture 2 (Textbook Chpt1) Sept, 7, 2012.
Domain Splitting, Local Search CPSC 322 – CSP 4 Textbook §4.6, §4.8 February 4, 2011.
Artificial Intelligence Logical Agents Chapter 7.
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
Planning: Forward Planning and CSP Planning
Planning + Intro Logics Computer Science cpsc322, Lecture 6
Planning: Heuristics and CSP Planning
Planning: Heuristics and CSP Planning
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Planning: Heuristics and CSP Planning
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
Computer Science cpsc322, Lecture 20
Bottom Up: Soundness and Completeness
Bottom Up: Soundness and Completeness
Domain Splitting CPSC 322 – CSP 4 Textbook §4.6 February 4, 2011.
Representations & Reasoning Systems (RRS) (2.2)
Bottom Up: Soundness and Completeness
Presentation transcript:

Slide 1 Propositional Logic Intro, Syntax Jim Little UBC CS 322 – CSP October 17, 2014 Textbook § – 5.2

Slide 2 Lecture Overview Recap Planning Logic Intro Propositional Definite Clause Logic: Syntax

Slide 3 Recap Planning Represent possible actions with ….. Plan can be found by….. Or can be found by mapping planning problem into… STRIPS CSP search

Solve planning as CSP: pseudo code Slide 4 solved = false for horizon h=0,1,2,… map STRIPS into a CSP csp with horizon h solve that csp if solution exists then return solution else horizon = horizon + 1 end

Planning as CSP Slide 5

STRIPS to CSP applet Slide 6 Allows you: to specify a planning problem in STRIPS to map it into a CSP for a given horizon the CSP translation is automatically loaded into the CSP applet where it can be solved Practice exercise using STRIPS to CSP is available on AIspace

West North East South Q Q  J 6  5  9  7  A K 5 3 A  9   Slide 7 Now, do you know how to implement a planner for…. Emergency Evacuation? Robotics? Space Exploration? Manufacturing Analysis? Games (e.g., Bridge)? Generating Natural language Product Recommendations ….

Slide 8 No , but you (will) know the key ideas ! Ghallab, Nau, and Traverso Automated Planning: Theory and Practice Morgan Kaufmann, May 2004 ISBN Web site:

Slide 9 Lecture Overview Recap Planning Logic Intro Propositional Definite Clause Logic: Syntax

Lecture Overview Recap of Lecture 6 Planning as CSP Logic Intro Propositional Definite Clause Logic (PDCL) Logical Consequences and Proof Procedures Bottom Up Proof Procedure Slide 10

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 First Part of the Course Slide 11

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 12

Logics in AI: Similar slide to the one for planning Propositional Logics First-Order Logics Propositional Definite Clause Logics Semantics and Proof Theory Satisfiability Testing (SAT) Description Logics Cognitive Architectures Video Games Ontologies Semantic Web Information Extraction Summarization Production Systems Tutoring Systems Hardware Verification Product Configuration Software Verification Applications Slide 13

Logics in AI: Similar slide to the one for planning Propositional Logics First-Order Logics Propositional Definite Clause Logics Semantics and Proof Theory Description Logics Cognitive Architectures Video Games Hardware Verification Product Configuration Ontologies Semantic Web Information Extraction Summarization Production Systems Tutoring Systems Software Verification You will know You will know a little Applications Satisfiability Testing (SAT) Slide 14

What you already know about logic... From programming: Some logical operators If ((amount > 0) && (amount < 1000)) || !(age < 30)... Logic is the language of Mathematics. To define formal structures (e.g., sets, graphs) and to prove statements about those You know what they mean in a “procedural” way We use logic as a Representation and Reasoning System that can be used to formalize a domain and to reason about it Slide 15

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 ( ) Logic and AI “The Advice Taker” Coined “Artificial Intelligence”. Dartmouth W’shop (1956) Slide 16

Why Logics? “Natural” to express knowledge about the world (more natural than a “flat” set of variables & constraints) e.g. “Every 101 student will pass the course” Course (c1) Name-of (c1, 101) It is easy to incrementally add knowledge It is easy to check and debug knowledge Provides language for asking complex queries Well understood formal properties Slide 17

Logic: A general framework for reasoning General problem: Query answering tell the computer how the world works tell the computer some facts about the world ask a yes/no question about whether other facts must be true Solving it with Logic 1.Begin with a task domain. 2.Distinguish those things you want to talk about (the ontology) 3.Choose symbols in the computer to denote elements of your ontologyChoose 4.Tell the system knowledge about the domainTell 5.Ask the system whether new statements about the domain are true or false live_w 4 ? lit_l 2 ? Slide 18

Example: Electrical Circuit / up /down Slide 19

/ up /down Syntax: are these sentences that a reasoning procedure can process? Semantics: what do these statements say about the world I need to represent? Slide 20

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 21

Propositional Definite Clauses 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 Why only propositions? We can exploit the Boolean nature for efficient reasoning Starting point for more complex logics We need to specify: syntax, semantics, proof procedure Slide 22

Lecture Overview Recap of Lecture 6 Planning as CSP Logic Intro Propositional Definite Clause Logic (PDCL) Syntax and Semantics Logical Consequences and Proof Procedures Bottom Up Proof Procedure Slide 23

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 24

atoms rules definite clauses, KB Slide 25

PDCL Syntax: more examples a)ai_is_fun b)ai_is_fun ∨ ai_is_boring c)ai_is_fun ← learn_useful_techniques d)ai_is_fun ← learn_useful_techniques ∧ notTooMuch_work e)ai_is_fun ← learn_useful_techniques ∧  TooMuch_work f)ai_is_fun ← f(time_spent, material_learned) g)srtsyj ← errt ∧ gffdgdgd How many of the clauses below are legal PDCL clauses? 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.’) A body is an atom or is of the form b 1 ∧ b 2 where b 1 and b 2 are bodies B. 4 C. 5 A. 3 D. 6 E. 7 Slide 26

PDC Syntax: more examples a)ai_is_fun b)ai_is_fun ∨ ai_is_boring c)ai_is_fun ← learn_useful_techniques d)ai_is_fun ← learn_useful_techniques ∧ notTooMuch_work e)ai_is_fun ← learn_useful_techniques ∧  TooMuch_work f)ai_is_fun ← f(time_spent, material_learned) g)srtsyj ← errt ∧ gffdgdgd Do any of these statements mean anything? Syntax doesn't answer this question! Legal PDC clauseNot a legal PDC clause Slide 27

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 28

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

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

Propositional Definite Clauses: Semantics Semantics allows you to relate the symbols in the logic to the domain you're trying to model. We can use the interpretation to determine the truth value of clauses 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. Slide 31

hbh ← bh ← b I1I1 FFT I2I2 FTF I3I3 TFT I4I4 TTT PDC Semantics: Example a1a1 a2a2 a1 ∧ a2a1 ∧ a2 I1I1 FFF I2I2 FTF I3I3 TFF I4I4 TTT Truth values under different interpretations F=false, T=true Slide 32

PDC Semantics: Example Truth values under different interpretations F=false, T=true ha1a1 a2a2 h ← a1 ∧ a2h ← a1 ∧ a2 I1I1 FFF I2I2 FFT I3I3 FTF I4I4 FTT I5I5 TFF I6I6 TFT I7I7 TTF I8I8 TTT Slide 33

hbh ← bh ← b I1I1 FFT I2I2 FTF I3I3 TFT I4I4 TTT PDC Semantics: Example for truth values Truth values under different interpretations F=false, T=true h ← a 1 ∧ a 2 Body of the clause: a 1 ∧ a 2 Body is only true if both a 1 and a 2 are true in I ha1a1 a2a2 h ← a1 ∧ a2h ← a1 ∧ a2 I1I1 FFF T I2I2 FFT T I3I3 FTF T I4I4 FTT F I5I5 TFF T I6I6 TFT T I7I7 TTF T I8I8 TTT T Slide 34

Propositional Definite Clauses: Semantics Semantics allows you to relate the symbols in the logic to the domain you're trying to model. We can use the interpretation to determine the truth value of clauses 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. Slide 35

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

PDC Semantics: Knowledge Base (KB) pqrs I1I1 true false A knowledge base KB is true in I if and only if every clause in KB is true in I. Slide 37

PDC Semantics: Knowledge Base (KB) pqrs I1I1 true false A knowledge base KB is true in I if and only if every clause in KB is true in I. Slide 38

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 39

PDC Semantics: Example for models pqrs p ← q q r ← s KB I1I1 TTTT I2I2 FFFF I3I3 TTFF I4I4 TTTF I5I5 FTFT 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 40

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 41

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 Slide 42

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 p? r? s? Slide 43

Or, More Interestingly 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 44

To Obtain This We Need One More Definition We want a reasoning procedure that can find all and only the logical consequences of a knowledge base Slide 45

Slide 46 Study for midterm (Mon Oct 27) Midterm: ~6 short questions (10pts each) + 2 problems (20pts each) Study: textbook and slides Work on all practice exercises and revise assignments! While you revise the learning goals, work on practice questions Will post a couple of problems from previous offering (maybe slightly more difficult) … but I’ll give you the solutions

Slide 47 Next class Definite clauses Semantics and Proofs (textbook 5.1.2, 5.2.2)