Successfully reported this slideshow.

Propositional logic & inference


Published on

Published in: Education, Technology, Spiritual

Propositional logic & inference

  1. 1. PropositionalLogicV.SaranyaAP/CSESri Vidya College of Engineering andTechnology,Virudhunagar
  2. 2. Definition• a branch of symbolic logic dealing withpropositions (proposal, scheme, plan) as unitsand with their combinations and theconnectives that relate them.
  3. 3. 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]
  4. 4. 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]
  5. 5. BNF (Backus Naur Form)• Grammar of sentences in propositional logicSentence  Atomic Sentence | complex sentenceAtomic sentence  True|False|SymbolSymbol  P, Q,RComplex Sentence  ¬ sentence|Sentence ˄ Sentence|Sentence ˄ Sentence|Sentence  Sentence|Sentence  Sentence
  6. 6. • Every sentence constructed with binaryconnectives must be enclosed in parenthesis((A ˄B) C)  right formA ˄B C  wrong oneMultiplication has higher precedence than additionOrder of precedence is, ˄,V,  and (i) A ˄ B ˄ Cread as (A ˄B) ˄ C (or) A ˄(B ˄ C)(ii) ¬ P ˄Q˄ RS((¬ P) ˄(Q˄ R))S
  7. 7. Semantics• Defines the rules.• Model fixes truth vales true or false for everypropositional symbol.• Semantics  specify how to compute thetruth of sentences formed with each of 5connectives.• Ex; (Wumpus World)M1= { P1,2 = False, P2,2 = False, P3,1= True}
  8. 8. • Atomic sentences are easy– True is true in every model– False is false in every model.• Complex Sentence– Using “ Truth Table”
  9. 9. Example 1:• Evaluate the sentence¬ P1,2 ˄(P2,2 ˄ P3,1)  (True ˄ (False ˄ True)Result= TrueExample 2:5 is even implies sam is smartThis sentence will be true if sam is smartP => 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.
  10. 10. 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  FalseNowResult : TrueExample 3:• B1,1 (P1,2 ˄P2,1)• The result is true• But incomplete (violate the rules ofwumpus world)
  11. 11. 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]
  12. 12. KB1. There is no pit in [1,1] R1 : ¬P1,12. A square is breeze if and only if there is a pitin 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 wumpusworld. Now after visiting 2 squares R4 : ¬B1,1 R5 : B2,1
  13. 13. • KB consists of R1 to R5 Consider the allabove in 5 single sentences R1 ˄ R2 ˄ R3 ˄ R4 ˄ R5Concluded that all 5 sentences areTrue
  14. 14. Inference(conclusion, assumption..)• Used to decide whether α is true in everymodel in which KB is true.Example: Wumpus WorldB1,2 , B2,1 , P1,1 , P2,2 , P3,1, P1,2 , P2,1So totally 27=128 models are possible
  15. 15. Truth table for the given KB
  16. 16. 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]
  17. 17. Truth Table Enumeration Algorithm
  18. 18. • Here TT  truth table• This enumeration algorithm is sound andcomplete because it works for any KB andalpha and always terminates.• Complexity:– Time complexity  O(2 power n)– Space complexity  O(n)n symbols
  19. 19. Equivalence• 2 sentences are logically true in the same set of models then P  Q.• Also P ˄Q and Q ˄ P are logically equivalence
  20. 20. Validity• A sentence is valid if it is true in all the modelsExample:• P ˄ ¬P is valid.• Valid is also know as tautologies.
  21. 21. 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, CA sentence is unsatisfiable if it is true in no modelse.g., A  A
  22. 22. • Validity and satisfiability are connected.• α is valid if α is satisfiable.• α is valid if ¬α is unsatisfiable.• ¬α is satisfiable if ¬α is not valid