propositional logic & inference
TRANSCRIPT
![Page 1: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/1.jpg)
Propositional Logic
V.SaranyaAP/CSESri Vidya College of Engineering and Technology,Virudhunagar
![Page 2: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/2.jpg)
Definition
• a branch of symbolic logic dealing with propositions (proposal, scheme, plan) as units and with their combinations and the connectives that relate them.
![Page 3: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/3.jpg)
Syntax• Defines the allowable sentences.• Atomic Sentence:– Consist of single proposition symbol.– Either TRUE or FALSE
• Rules:– Uppercase names used for symbols P,O,R– Names are arbitrary (uninformed or random)
»Example:»W[1,3] Wumpus in [1,3]
![Page 4: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/4.jpg)
Complex sentences• Constructed from simple sentences.• Using logical connectives.
...and [conjunction]
...or [disjunction]
...implies [implication / conditional]
..(if & only if)is equivalent [bi-conditional]
...not [negation]
![Page 5: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/5.jpg)
BNF (Backus Naur Form)• Grammar of sentences in propositional logic
Sentence Atomic Sentence | complex sentence
Atomic sentence True|False|Symbol
Symbol P, Q,R
Complex Sentence ¬ sentence
|Sentence ˄ Sentence
|Sentence ˅ Sentence
|Sentence Sentence
|Sentence Sentence
![Page 6: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/6.jpg)
• Every sentence constructed with binary connectives must be enclosed in parenthesis((A ˄B) C) right formA ˄B C wrong one
Multiplication has higher precedence than additionOrder of precedence isØ, ˄,V, and
(i) A ˄ B ˄ C read as (A ˄B) ˄ C (or) A ˄(B ˄ C)(ii) ¬ P ˅Q ˄ R S
((¬ P) ˅(Q˄ R)) S
![Page 7: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/7.jpg)
Semantics• Defines the rules.• Model fixes truth vales true or false for every
propositional symbol.• Semantics specify how to compute the
truth of sentences formed with each of 5 connectives.
• Ex; (Wumpus World)M1= { P1,2 = False, P2,2 = False, P3,1= True}
![Page 8: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/8.jpg)
• Atomic sentences are easy– True is true in every model– False is false in every model.
• Complex Sentence– Using “ Truth Table”
![Page 9: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/9.jpg)
Example 1:• Evaluate the sentence
¬ P1,2 ˄(P2,2 ˅ P3,1) (True ˄ (False ˅ True)
Result= TrueExample 2:5 is even implies sam is smartThis sentence will be true if sam is smart
P => Q is only FALSE when the Premise(p) is TRUE AND Consequence(Q) is FALSE.
P => Q is always TRUE when the Premise(P) is FALSE OR the Consequence(Q) is TRUE.
![Page 10: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/10.jpg)
Example 3:• B1,1 (P1,2 ˅ P2,1)– B1,1 means breeze in [1,1]
– P1,2 means pit in [1,2]
– P2,1 means pit in [2,1]– So False False
Now Result : True
Example 3:• B1,1 (P1,2 ˅ P2,1)• The result is true• But incomplete (violate the rules of
wumpus world)
![Page 11: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/11.jpg)
A Simple Knowledge Base
• Take Pits alone
• i,j values
• Let Pi,j be true if there is a pit in [i,j]
• Let Bi,j be true if there is a breeze in [i,j]
![Page 12: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/12.jpg)
KB
1. There is no pit in [1,1] R1 : ¬P1,1
2. A square is breeze if and only if there is a pit in a neighboring square. R2 : B1,1 (P1,2 ˅ P2,1) R3 : B2,1 (P1,1 ˅ P1,2 ˅ P3,1)
3. The above 2 sentences are true in all wumpus world. Now after visiting 2 squares R4 : ¬B1,1
R5 : B2,1
![Page 13: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/13.jpg)
• KB consists of R1 to R5 Consider the all above in 5 single sentences R1 ˄ R2 ˄ R3 ˄ R4 ˄ R5
Concluded that all 5 sentences are True
![Page 14: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/14.jpg)
Inference(conclusion, assumption..)
• Used to decide whether α is true in every model in which KB is true.
Example: Wumpus WorldB1,2 , B2,1 , P1,1 , P2,2 , P3,1, P1,2 , P2,1
So totally 27=128 models are possible
![Page 15: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/15.jpg)
Truth table for the given KB
![Page 16: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/16.jpg)
From the table KB is true if R1 through R5 is true in all 3 rows P1,2 is false so there is no pit in
[1,2].There may be or may not be pit in [2,2]
![Page 17: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/17.jpg)
Truth Table Enumeration Algorithm
![Page 18: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/18.jpg)
• Here TT truth table• This enumeration algorithm is sound and
complete because it works for any KB and alpha and always terminates.
• Complexity:– Time complexity O(2 power n)– Space complexity O(n)n symbols
![Page 19: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/19.jpg)
Equivalence• 2 sentences are logically true in the same set of models then P Q.• Also P ˄Q and Q ˄ P are logically equivalence
![Page 20: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/20.jpg)
Validity • A sentence is valid if it is true in all the modelsExample:• P ˅ ¬P is valid.• Valid is also know as tautologies.
![Page 21: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/21.jpg)
Satisfiability
• A sentence is true if it is true in some model.
A sentence is satisfiable if it is true in some modele.g., A B, C
A sentence is unsatisfiable if it is true in no modelse.g., A A
![Page 22: Propositional logic & inference](https://reader037.vdocuments.mx/reader037/viewer/2022100219/55629301d8b42a68128b4e8b/html5/thumbnails/22.jpg)
• Validity and satisfiability are connected.
• α is valid if α is satisfiable.• α is valid if ¬α is unsatisfiable.• ¬α is satisfiable if ¬α is not valid