propositional logic
DESCRIPTION
Propositional Logic. Reading: C. 7.4-7.8, C. 8. Logic: Outline. Propositional Logic Inference in Propositional Logic First-order logic. Agents that reason logically. A logic is a: Formal language in which knowledge can be expressed A means of carrying out reasoning in the language - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/1.jpg)
Propositional Logic
Reading: C. 7.4-7.8, C. 8
![Page 2: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/2.jpg)
2
Logic: Outline
• Propositional Logic
• Inference in Propositional Logic
• First-order logic
![Page 3: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/3.jpg)
3
Agents that reason logically
• A logic is a:• Formal language in which knowledge can be
expressed• A means of carrying out reasoning in the language
• A Knowledge base agent• Tell: add facts to the KB• Ask: query the KB
![Page 4: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/4.jpg)
4
Towards General-Purpose AI
• Problem-specific AI (e.g., Roomba)• Specific data structure• Need special implementation• Can be fast
• General –purpose AI (e.g., logic-based)• Flexible and expressive• Generic implementation possible• Can be slow
![Page 5: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/5.jpg)
5
Language Examples
• Programming languages• Formal, not ambiguous• Lacks expressivity (e.g., partial information)
• Natural Language• Very expressive, but ambiguous:
– Flying planes can be dangerous.– The teacher gave the boys an apple.
• Inference possible, but hard to automate
• Good representation language• Both formal and can express partial information• Can accommodate inference
![Page 6: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/6.jpg)
6
Components of a Formal Logic
• Syntax: symbols and rules for combining themWhat you can say
• Semantics: Specification of the way symbols (and sentences) relate to the world
What it means
• Inference Procedures: Rules for deriving new sentences (and therefore, new semantics) from existing sentences
Reasoning
![Page 7: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/7.jpg)
7
![Page 8: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/8.jpg)
8
![Page 9: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/9.jpg)
9
![Page 10: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/10.jpg)
10
![Page 11: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/11.jpg)
11
![Page 12: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/12.jpg)
12
Semantics
• A possible world (also called a model) is an assignment of truth values to each propositional symbol
• The semantics of a logic defines the truth of each sentence with respect to each possible world
• A model of a sentence is an interpretation in which the sentence evaluates to True
• E.g., TodayIsTuesday -> ClassAI is true in model {TodayIsTuesday=True, ClassAI=True}
• We say {TodayIsTuesday=True, ClassAI=True} is a model of the sentence
![Page 13: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/13.jpg)
13
Exercise: Semantics
What is the meaning of these two sentences?
• If Shakespeare ate Crunchy-Wunchies for breakfast, then Sally will go to Harvard
• If Shakespeare ate Cocoa-Puffs for breakfast, then Sally will go to Columbia
![Page 14: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/14.jpg)
14
Examples
• What are the models of the following sentences?
• KB1: TodayIsTuesday -> ClassAI
• KB2: TodayIsTuesday -> ClassAI, TodayIsTuesday
![Page 15: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/15.jpg)
15
![Page 16: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/16.jpg)
16
![Page 17: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/17.jpg)
17
![Page 18: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/18.jpg)
18
Proof by refutation
• A complete inference procedure
• A single inference rule, resolution
• A conjunctive normal form for the logic
![Page 19: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/19.jpg)
19
![Page 20: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/20.jpg)
20
![Page 21: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/21.jpg)
21
![Page 22: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/22.jpg)
22
![Page 23: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/23.jpg)
23
![Page 24: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/24.jpg)
24
![Page 25: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/25.jpg)
25
![Page 26: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/26.jpg)
26
Example: Wumpus World
• Agent in [1,1] has no breeze
• KB = R2 Λ R4 = (B1,1<->(P1,2 V P2,1)) Λ⌐B1,1
• Goal: show ⌐P1,2
![Page 27: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/27.jpg)
27
Conversion Example
![Page 28: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/28.jpg)
28
![Page 29: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/29.jpg)
29
Resolution of Example
![Page 30: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/30.jpg)
30
Inference Properties
• Inference method A is sound (or truth-preserving) if it only derives entailed sentences
• Inference method A is complete if it can derive any sentence that is entailed
• A proof is a record of the progress of a sound inference algorithm.
![Page 31: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/31.jpg)
31
![Page 32: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/32.jpg)
32
![Page 33: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/33.jpg)
33
Other Types of Inference
• Model Checking
• Forward chaining with modus ponens
• Backward chaining with modus ponens
![Page 34: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/34.jpg)
34
Model Checking
• Enumerate all possible worlds
• Restrict to possible worlds in which the KB is true
• Check whether the goal is true in those worlds or not
![Page 35: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/35.jpg)
35
Wumpus Reasoning
• Percepts: {nothing in 1,1; breeze in 2,1}
• Assume agent has moved to [2,1]
• Goal: where are the pits?
• Construct the models of KB based on rules of world
• Use entailment to determine knowledge about pits
![Page 36: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/36.jpg)
36
![Page 37: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/37.jpg)
37
Constructing the KB
![Page 38: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/38.jpg)
38
![Page 39: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/39.jpg)
39
Properties of Model Checking
• Sound because it directly implements entailment
• Complete because it works for any KB and sentence to prove α and always terminates
• Problem: there can be way too many worlds to check
• O(2n) when KB and α have n variables in total
![Page 40: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/40.jpg)
40
Inference as Search
• State: current set of sentences• Operator: sound inference rules to derive new
entailed sentences from a set of sentences
• Can be goal directed if there is a particular goal sentence we have in mind
• Can also try to enumerate every entailed sentence
![Page 41: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/41.jpg)
41
![Page 42: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/42.jpg)
42
![Page 43: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/43.jpg)
43
![Page 44: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/44.jpg)
44
![Page 45: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/45.jpg)
45
![Page 46: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/46.jpg)
46
![Page 47: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/47.jpg)
47
![Page 48: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/48.jpg)
48
Example
![Page 49: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/49.jpg)
49
Complexity
• N propositions; M rules
• Every possible fact can be establisehd with at most N linear passes over the database
• Complexity O(NM)
• Forward chaining with Modus Ponens is complete for Horn logic
![Page 50: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/50.jpg)
50
![Page 51: Propositional Logic](https://reader036.vdocuments.mx/reader036/viewer/2022081505/56815a7d550346895dc7e6de/html5/thumbnails/51.jpg)
51
Example