Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Slide 1 Propositional Logic Intro, Syntax Jim Little UBC CS 322 – CSP October 17, 2014 Textbook § 5.1- 5.1.1 – 5.2."— Presentation transcript:

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

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

3 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

4 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

5 Planning as CSP Slide 5

6 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

7 West North East South 6 2 8 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 ….

8 Slide 8 No , but you (will) know the key ideas ! Ghallab, Nau, and Traverso Automated Planning: Theory and Practice Morgan Kaufmann, May 2004 ISBN 1-55860-856-7 Web site: http://www.laas.fr/planning

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

10 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

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

12 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

13 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

14 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

15 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

16 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 http://en.wikipedia.org/wiki/John_McCarthy (1927 - 2011)http://en.wikipedia.org/wiki/John_McCarthy Logic and AI “The Advice Taker” Coined “Artificial Intelligence”. Dartmouth W’shop (1956) Slide 16

17 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

18 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

19 Example: Electrical Circuit / up /down Slide 19

20 / 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

21 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

22 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

23 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

24 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

25 atoms rules definite clauses, KB Slide 25

26 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

27 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

28 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

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 29

30 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

31 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

32 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

33 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

34 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

35 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

36 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

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 37

38 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

39 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

40 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

41 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

42 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

43 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

44 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

45 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

46 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

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


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

Similar presentations


Ads by Google