Propositional logic & inference
Click here to load reader
-
Upload
slideshare -
Category
Education
-
view
556 -
download
7
Transcript of Propositional logic & inference
Propositional Logic
V.SaranyaAP/CSESri Vidya College of Engineering and Technology,Virudhunagar
Definition
• a branch of symbolic logic dealing with propositions (proposal, scheme, plan) as units and with their combinations and the connectives that relate them.
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]
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]
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
• 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
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}
• Atomic sentences are easy– True is true in every model– False is false in every model.
• Complex Sentence– Using “ Truth Table”
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.
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)
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]
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
• 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
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
Truth table for the given KB
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]
Truth Table Enumeration Algorithm
• 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
Equivalence• 2 sentences are logically true in the same set of models then P Q.• Also P ˄Q and Q ˄ P are logically equivalence
Validity • A sentence is valid if it is true in all the modelsExample:• P ˅ ¬P is valid.• Valid is also know as tautologies.
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
• Validity and satisfiability are connected.
• α is valid if α is satisfiable.• α is valid if ¬α is unsatisfiable.• ¬α is satisfiable if ¬α is not valid