0% found this document useful (0 votes)
19 views36 pages

02 Propositional Logic

Uploaded by

Ronnie Atuhaire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views36 pages

02 Propositional Logic

Uploaded by

Ronnie Atuhaire
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 36

MTH 3105: Discrete Mathematics

Propositional Logic
Rosen 1.1 – 1.3

Lecture 2: Aug 19
Logic
• Crucial for mathematical reasoning
• Used for designing electronic circuitry

• Logic is a system based on propositions.


• A proposition is a statement that is either true or
false (but not both).
• We say that the truth value of a proposition is
either true (T) or false (F).

• Corresponds to 1 and 0 in digital circuits


Common connectives

• ¬ 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 PQ
T T T
T F F
F T F
F F F
Disjunction (OR)
• Binary Operator, Symbol: 

P Q PQ
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

p is called the hypothesis; q is called the conclusion

he department says:
“If your GPA is 4.0, then you don’t need to pay tuition fee.”

When is the above sentence false?

• 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.

Another example: “If there is typhoon T8 today, then there is no class.”

When is the above sentence false?


Logic Operator

 ::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

Idea 1: Look at the truth rows,


P Q P Q and take the “and”.

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

P Q P Q Idea 2: Look at the false rows,


T T T negate and take the “and”.

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 you talk to her, then you can never talk to me.


• Either you don’t talk to her or you can never talk to me (or both).
Negation of If-Then

• 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.

• If my computer is not working, then I cannot finish my homework.


• My computer is not working but I can finish my homework.

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

The contrapositive of “if p then q” is “if ~q then ~p”.

Statement: If you are a CS year 2 student,


then you are taking MTH 3105.

Contrapositive: If you are not taking MTH 3105,


then you are not a CS year 2 student.

Statement: If x2 is an even number,


then x is an even number.

Contrapositive: If x is an odd number,


then x2 is an odd number.

Fact: A conditional statement is logically equivalent to its contrapositive.


Proofs

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

• You will succeed if you work hard.


• You will succeed only if you work hard.

r if s means “if s then r”

We also say s is a sufficient condition for r.

r only if s means “if r then s”

We also say s is a necessary condition for r.

You will succeed if and only if you work hard.

p if and only if (iff) q means p and q are logically equivalent.


Math vs English

Parent: if you don’t clean your room, then you can’t watch a DVD.

C D

This sentence says


So
In real life it also means

Mathematician: if a number x greater than 2 is not an odd number,


then x is not a prime number.

This sentence says

But of course it doesn’t mean


Necessary, Sufficient Condition

Mathematician: if a number x greater than 2 is not an odd number,


then x is not a prime number.

This sentence says

But of course it doesn’t mean

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)

he statement “x is an even number if and only if x2 is an even number” true?


Argument

An argument is a sequence of statements.


All statements but the final one are called assumptions or hypothesis.
The final statement is called the conclusion.
An argument is valid if:

whenever all the assumptions are true, then the conclusion is true.

If today is Monday, then yesterday is Sunday.

Today is Monday.

Yesterday is Sunday.
Modus Ponens

If p then q. If typhoon, then class cancelled.


p Typhoon.
q Class cancelled.

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

Modus ponens is Latin meaning “method of affirming”.


Modus Tollens

If p then q. If typhoon, then class cancelled.


~q Class not cancelled.
~p No typhoon.

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

Modus tollens is Latin meaning “method of denying”.


Equivalence

A student is trying to prove that propositions P, Q, and R are all


true.
She proceeds as follows.
First, she proves three facts:
• P implies Q
• Q implies R
• R implies P.
Then she concludes,
``Thus P, Q, and R are all true.''
Proposed argument: assumption

( 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

To prove an argument is not valid, we just need to find a counterexample.


Valid Arguments?
assumptions conclusion

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

Assumptions are true, but not the conclusion.

If you are a fish, then you drink water.


You drink water.
You are a fish.
Valid Arguments?
assumptions conclusion

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

If you are a fish, then you drink water.


You are not a fish.
You do not drink water.
Exercises
More Exercises

Valid argument True conclusion

True conclusion Valid argument


Tautologies and Contradictions

• A tautology is a statement that is always true.


• Examples:
• R(R)
 (PQ)(P)(Q)

• If ST is a tautology, we write ST.


• If ST is a tautology, we write ST.
Tautologies and Contradictions
• A contradiction is a statement that is always
false.
• Examples:
• R(R)
 ((PQ)(P)(Q))

• The negation of any tautology is a contradiction,


and the negation of any contradiction is a
tautology.
Contradiction

If you can show that the assumption that the statement


p is false leads logically to a contradiction,
then you can conclude that p is true.

You are working as a clerk.


If you have won Mark 6, then you would not work as a clerk.
You have not won Mark 6.
Logical Equivalences (1)
1. ¬¬p ⟺ p double negation
2a. (p ∨ q) ⟺ (q ∨ p) commutative laws
b. (p ∧ q) ⟺ (q ∧ p)
c. (p ⟷ q) ⟺ (q ⟷ p)
3a. [(p ∨ q) ∨ r] ⟺ [p ∨ (q ∨ r)] associative laws
b.[(p ∧ q) ∧ r] ⟺ [p ∧ (q ∧ r)]
4a. [p ∨ (q ∧ r)] ⟺ [(p ∨ q) ∧ (p ∨ distributive laws
r)] ∧ (q ∨ r)] ⟺ [(p ∧ q) ∨ (p ∧
b.[p
r)]
5a. (p ∨ p) ⟺ p idempotent laws
b.(p ∧ p) ⟺ p
6a. (p ∨ 0) ⟺ p identity laws (1-tautology, 0-
b.(p ∨ 1) ⟺ 1 contradiction)
c.(p ∧ 0) ⟺ 0
d.(p ∧ 1) ⟺ p
7a. (p ∨ ¬p) ⟺ 1
b.(p ∧ ¬p) ⟺ 0
Logical Equivalences (2)

8a. ¬(p ∨ q) ⟺ (¬p ∧ ¬q) DeMorgan laws


b.¬(p ∧ q) ⟺ (¬p ∨ ¬q)
c.(p ∨ q) ⟺ ¬ (¬p ∧ ¬q)
d.(p ∧ q) ⟺ ¬ (¬p ∨ ¬q)
9. (p ⟶ q) ⟺ (¬q ⟶ ¬p) contrapositive
10a. (p ⟶ q) ⟺ (¬p ∨ q) implication
b. (p ⟶ q) ⟺ ¬(p ∧ ¬q)
11a. (p ∨ q) ⟺ (¬p ⟶ q)
b. (p ∧ q) ⟺ ¬(p ⟶ ¬q)
12a. [(p ⟶ r) ∧ (q ⟶ r)] ⟺ [(p ∨
b.q)[(p
⟶⟶ r] q) ∧ (p ⟶ r)] ⟺ [p ⟶
13. (p(q⟷ ∧ r)]
q) ⟺ (p ⟶ q) ∧ (q ⟶ equivalence
14.p)
[(p ∧ q) ⟶ r] ⟺ [p ⟶ (q ⟶ exportation law
15.r)]
(p ⟶ q) ⟺ [(p ∧ ¬q) ⟶ 0)] reductio ad absurdum
Knights and Knaves

Knights always tell the truth.


Knaves always lie.

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?

“The sentence below is false.”

“The sentence above is true.”

You might also like