Download presentation
Presentation is loading. Please wait.
Published byHoward Lindsey Modified over 8 years ago
1
Computer Science CPSC 322 Lecture 14 Intro to Logic (5.1, 5.1.1) 1
2
Announcements Assign 3 Posted on Connect last Friday Due Friday March 11, 12noon You can already do the first question (on planning as CSP) Practice Exercise on Planning as CSP can help with this question
3
3 Problem with the Coffee Devilery example from last class Problem: Location_s3 should include both “office” and “hallway” if the robot can either move to hallway or stay 3 With horizon 3 there are 2 solutions to the problem. In both, Rob moves to hallway, then to office. Then in one solution it delivers the coffee and stays; in the second it delivers the coffee and moves to hallway This happens because both Move_to_hallway and Del_Coffee have as precondition Loc = cs, and there are no mutex constraints that prevent them from happening at the same time
4
To Avoid the problem Issue is due to this spurious effect of DelC in the original STRIPS representation, forcing the position of the robot to stay in the office after giving the coffee away. Remove it (in create mode)
5
Horizon 3 5
6
DONE WITH PLANNING: Learning Goals STRIPS Represent a planning problem with the STRIPS representation Explain the STRIPS assumption Forward planning Solve a planning problem by search (forward planning). Specify states, successor function, goal test and solution. Construct and justify a heuristic function for forward planning CSP planning Translate a planning problem represented in STRIPS into a corresponding CSP problem (and vice versa) Solve a planning problem with CSP by expanding the horizon On to the next topic: logic!logic
7
Lecture Overview Intro to Logic Propositional Definite Clause: Syntax Semantics 7
8
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 8
9
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 9
10
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 10
11
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) 11
12
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 12
13
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) 13
14
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 14
15
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 ? 15
16
Example: Electrical Circuit / up /down 16
17
/ up /down 17
18
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 18
19
Lecture Overview Intro to Logic Propositional Definite Clause: Syntax Semantics
20
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 20
21
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 21
22
atoms rules definite clauses, KB 22
23
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.’) B. 4 C. 5 A. 3 D. 6 E. 7 23
24
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 24
25
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 25
26
Lecture Overview Intro to Logic Propositional Definite Clause: Syntax Semantics
27
Propositional Definite Clauses: Semantics Semantics allows you to relate the symbols in the logic to the domain you’re trying to model. If our domain has 5 atoms, how many interpretations are there? Definition (interpretation) An interpretation I assigns a truth value to each atom. B. 5*2 C. 5 2 A. 5+2D. 2 5 27
28
Propositional Definite Clauses: Semantics Semantics allows you to relate the symbols in the logic to the domain you're trying to model. If our domain has 5 atoms, how many interpretations are there? 2 values for each atom, so 2 5 combinations Similar to possible worlds in CSPs Definition (interpretation) An interpretation I assigns a truth value to each atom. 28
29
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. 29
30
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 30
31
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 true only 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 31
32
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. 32
33
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. 33
34
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. 34
35
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. 35
36
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 36
37
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 37
38
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 38
39
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? 39
40
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 ? 40
41
To Obtain This We Need One More Definition 41
42
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 42
43
Example of Logic Entailment How many models are there? A. 1B. 2C. 3D. 4 E. 5 43
44
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 44
45
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 45
46
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 46
47
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 47
48
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 48
49
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 49
50
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. 50
51
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! 51
52
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 52
53
Learning Goals for Logic 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 Next: Proof Procedures (5.2.2) 53
54
Lecture Overview Intro to Logic Propositional Definite Clause: Syntax Semantics Proof Procedures
55
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 55
56
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 56
57
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 57
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.