Download presentation
Presentation is loading. Please wait.
Published byDoris Briggs Modified over 9 years ago
1
Propositional Logic
2
Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume a value of T or F Propositional constants: T or F Atomic proposition: A proposition consisting of only a single propositional variable or constant Logical connectives: logical operators
3
Truth Table Gives the values of a proposition under all possible assignments of its variables Used to define connectives P PP TF FT
4
FF TF FT TT QP T F F T P Q Biconditional “equivalent” T T F T P Q Conditional “implies” F T T T P Q Disjunction “or” F F F T P Q Conjunction “and” Connectives P implies Q if P then Q Q if P (e.g., Q :- P) P only if Q P is sufficient for Q Q is necessary for P P is equivalent to Q P if and only if Q P is necessary and sufficient for Q P iff Q
5
Compound Propositions Also called logical expressions, formulas, and well-formed formulas (wffs) Well-formed formulas are defined inductively: – Basis: T and F are wffs (these are the constants) P, Q, … are wffs (these are the variables) – Induction: if A and B are wffs, then so are: ( A) (A B), (A B), (A B), (A B)
6
Parentheses Well-formed formulas are fully parenthesized: ((( (P Q)) (( P) Q)) R) We can remove some parentheses: – Outside parentheses can be removed – Use precedence: – Use associativity always left associative
7
Evaluating Logical Expressions F T T T T T F F FF TF FT TT (( P) Q) QP P Q
8
T T T T T T F T 6 F F T T F F F F 4 T T T T F F F F 2 T T T T T T F F 5 F F F F F F T T 1 T T T T T T F F 3 FFF TFF FTF TTF FFT TFT FTT TTT R Q PP) PQPQ (( RQP (P Q) P Q R Evaluating Logical Expressions
9
In general… – To evaluate expressions using truth tables with k variables and n operations is O(2 k n). – If we have one operator (n = 1) and if we can substitute in T or F and evaluate in 1 sec, then ktime 3020 minutes 4014 days 5040 years 6040,000 years! Not practical to use truth tables for “large” k! Evaluating with Truth Tables
10
Logical Expressions Tautology – a logical expression that is true for all variable assignments – The symbol |= (read “ entails ” ) denotes that what follows holds or is true, so long as what precedes it is true – Since tautologies are always true, we sometimes write “ |= B ” to denote that B is a tautology independent of what precedes it Contradiction – a logical expression that is false for all variable assignments Contingent – a logical expression that is neither a tautology nor a contradiction
11
F F T T T F F T (P P)P P PP P T T T T T T T F F F F T FF TF FT TT (P Q) Q (P Q)P Q QP Sample Tautologies
12
Sound Reasoning A logical argument has the form: A 1 A 2 … A n B and is sound if when A i = T for all i, B = T (i.e., if the premises are all true, then the conclusion is also true) This happens when A 1 A 2 … A n B is a tautology
13
Logical Arguments Consider the following statements 1.if you study then you succeed 2.you study 3.you succeed These three statements create a logical argument – Lines 1 and 2 are the premises – Line 3 is the conclusion This logical argument is sound… 1. If P then Q 2. P ------------------ 3. Q ( ( P Q ) P ) Q
14
Modus Ponens T T T T F F F T T T F T FF TF FT TT ((A B) A) B(A B) A(A B) BA AB A B T?T Hence, modus ponens is sound! A B A B
15
Important! We are dealing with the validity of an argument, NOT with the validity of the result! In logic, it doesn’t matter if a logical statement makes sense or not What does matter is that: – IF the premises are correct – THEN so is the conclusion 1. If P then Q 2. P ------------------ 3. Q
16
P:I study hard Q:I do well on my exam P:cows give milk Q:doors open P:I obey Q:I am happy P:I sail past the end of the world Q:I will fall off Makes sense Doesn’t make sense Makes sense Doesn’t make sense Valid Logical Arguments
17
Disjunctive Syllogism T T F F T T T T F T F F F T T T AA FF TF FT TT (A B) A B(A B) AA B BA Hence, disjunctive syllogism is sound! A B A B
18
Logical Implication If A and B are two logical expressions and if A B is a tautology, we say that A logically implies B, and we write A > B > is a meta-symbol to say a logical argument is sound (P Q) P > Q (P Q) P > Q If A B is a tautology, then A > B Modus ponens Disjunctive syllogism
19
Logical Equivalence If A and B are two logical expressions and if A and B always have the same truth value, then A and B are said to be logically equivalent, and we write A B is a meta-symbol to say that A B is a tautology. T T F T F T AA A A Thus, A A A Which means, you can replace A A with A. A B if and only if A B is a tautology
20
Laws of , , and Excluded middle law Contradiction law P P T P P F NameLaw Identity laws P F P P T P Domination laws P T T P F F Idempotent laws P P P P P P Double-negation law ( P) P
21
Commutative laws P Q Q P P Q Q P NameLaw Associative laws (P Q) R P (Q R) (P Q) R P (Q R) Distributive laws (P Q) (P R) P (Q R) (P Q) (P R) P (Q R) De Morgan’s laws (P Q) P Q (P Q) P Q Absorption laws P (P Q) P P (P Q) P
22
Can prove all laws by truth tables… T F T F T T T F T T F F T T T T F F F T T T T F FF TF FT TT QQ PP (P Q) QP De Morgan’s law holds!
23
Two Other Useful Laws Law of implication – P Q P Q Law of contrapositive – P Q Q P Note that the converse of P Q is Q P, and the two are NOT equivalent
24
Duals To create the dual of a logical expression 1) swap propositional constants T and F 2) swap connective operators and P P TExcluded Middle P P FContradiction The dual of a law is always a law! Thus, most laws come in pairs pairs of duals
25
Normal Forms Normal forms are standard forms, sometimes called canonical or accepted forms A logical expression is said to be in disjunctive normal form (DNF) if it is written as a disjunction, in which all terms are conjunctions of literals Similarly, a logical expression is said to be in conjunctive normal form (CNF) if it is written as a conjunction of disjunctions of literals
26
Disjunctive Normal Form (DNF) (.. .. .. ) (.. .. .. ) … (.. .. ) Term Literal, i.e. P or P Conjunctive Normal Form (CNF) (.. .. .. ) (.. .. .. ) … (.. .. ) Examples:(P Q) (P Q) P (Q R) DNF and CNF Examples:(P Q) (P Q) P (Q R)
27
Converting Expressions to DNF or CNF The following procedure converts an expression to DNF or CNF: 1.Remove all and 2.Move inside (use De Morgan’s law) 3.Use distributive laws to get proper form Simplify as you go (e.g., double-neg., idemp., comm., assoc.)
28
CNF Conversion Example (.. .. .. ) (.. .. .. ) … (.. .. ) (( P Q) R (P Q)) (( P Q) R ( P Q)) impl. ( P Q) R ( P Q) deM. ( P Q) R ( P Q) deM. (P Q) R (P Q) double neg. (P Q) (P Q) R comm. (P Q) R idemp. (P R) ( Q R) distr. (DNF) (CNF)
29
DNF Expression Generation F T F F F T T F FFF TFF FTF TTF FFT TFT FTT TTT RQP (P Q R) (P Q R) ( P Q R) (P Q R) (P Q R) ( P Q R) minterms The only definition of is the truth table
30
CNF Expression Generation 1.Find . 2.Find the DNF of . 3.Then, use De Morgan’s law to get the CNF of (i.e. ( ) ) T F T F FFF TTF FFT TTT QP (P Q) ( P Q) ( P Q) (P Q) (P Q) ( P Q) DNF of f ((P Q) ( P Q)) (P Q) ( P Q) DeM. ( P Q) (P Q) DeM., double neg. max terms } Form a conjunction of max terms
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.