02_Propositional_Logic
02_Propositional_Logic
Propositional Logic
Rosen 1.1 – 1.3
Lecture 2: Aug 19
Logic
• Crucial for mathematical reasoning
• Used for designing electronic circuitry
• ¬ or ~ Negation (not)
• ∧, &, · Conjunction (and)
• ∨ Disjunction (or)
Exclusive or (xor)
• →, ⇒, or ⊃ Implication (if…then)
• ↔, ≡, or =Bi-conditional (if and only if)
• Bi-implication (iff)
Truth Tables
• Negation (NOT)
• Unary Operator, Symbol:
P P
True False
False True
Conjunction (AND)
• Binary Operator, Symbol:
P Q PQ
T T T
T F F
F T F
F F F
Disjunction (OR)
• Binary Operator, Symbol:
P Q PQ
T T T
T F T
F T T
F F F
Exclusive Or (XOR)
• Binary Operator, Symbol:
P Q P Q
T T F
T F T
F T T
F F F
Conditional Statement
If p then q
he department says:
“If your GPA is 4.0, then you don’t need to pay tuition fee.”
• It is false when your GPA is 4.0 but you still have to pay tuition fee.
• But it is not false if your GPA is below 4.0.
::IMPLIES
P Q P Q
T T T
T F F
F T T
F F T
onvention: if we don’t say anything wrong, then it is not false, and thus true.
If-Then as Or
T T T (P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P
∧ ¬Q)
≡ (P ∧ Q) ∨ [¬P ∧ (Q ∨
T F F
¬Q)]
≡ (P ∧ Q) ∨ [¬P ∧ T]
F T T
≡ (P ∧ Q) ∨ ¬P
F F T
≡ (P ∨ ¬P ) ∧ (Q ∨ ¬P)
≡ T ∧ (Q ∨ ¬P)
≡ Q ∨ ¬P
If-Then as Or
T F F
F T T
F F T
• If you don’t give me all your money, then I will kill you.
• Either you give me all your money or I will kill you (or both).
• If your GPA is 4.0, then you don’t need to pay tuition fee.
• Your term GPA is 4.0 and you still need to pay tuition fee.
previous slide
DeMorgan
Precedence of Logic Operators
Operator Precedence
¬ 1
∧ 2
∨ 3
→ 4
↔ 5
Converse , contrapositive and inverse
• For conditional statement p → q
¬q → ¬p
– Converse: q→p
¬p → ¬q
– Contrapositive:
– Inverse:
• Contrapositive and conditional statements
are equivalent
14
Contrapositive
Statement: If P, then Q
Contrapositive: If Q, then P.
T T T F F T
T F F T F F
F T T F T T
F F T T T T
If, Only-If
Parent: if you don’t clean your room, then you can’t watch a DVD.
C D
ing an odd number > 2 is a necessary condition for this number to be prime.
ing a prime number > 2 is a sufficient condition for this number to be odd.
Necessary AND Sufficient Condition
::IFF
P Q P Q
T T T
T F F
F T F
F F T
Note: P Q is equivalent to (P Q) (Q P)
Note: P Q is equivalent to (P Q) ( P Q)
whenever all the assumptions are true, then the conclusion is true.
Today is Monday.
Yesterday is Sunday.
Modus Ponens
assumptions conclusion
p q p→q p q
T T T T T
T F F T F
F T T F T
F F T F F
assumptions conclusion
p q p→q ~q ~p
T T T F F
T F F T F
F T T F T
F F T T T
( P Q), (Q R ), ( R P ) Is it valid?
P Q R
conclusion
Valid Argument?
( P Q), (Q R ), ( R P ) Is it valid?
P Q R
assumptions conclusion
P Q R OK?
T T T T T T T yes
T T F T F T F yes
T F T F T T F yes
T F F F T T F yes
F T T T T F F yes
F T F T F T F yes
F F T T T F F yes
F F F T T T F no
p q p→q q p
T T T T T
If p then q.
q T F F F T
p
F T T T F
F F T F F
p q p→q ~p ~q
T T T F F
If p then q.
~p T F F F T
~q
F T T T F
F F T T T
A says: B is a knight.
B says: A and I are of opposite type.
Suppose A is a knight.
Then B is a knight (because what A says is true).
Then A is a knave (because what B says is true)
A contradiction.
So A must be a knave.
So B must be a knave (because what A says is false).
Which is true?
Which is false?