Lecture 5 - Applying The Rules and Formal Proofs
Lecture 5 - Applying The Rules and Formal Proofs
Lecture 5: Applying
Discrete Structures The Rules and Formal Proofs
Rules Of Inference
Basic Concepts
ii. Addition : p → (p ∨ q)
p
∴p∨q
• Example: It is below freezing now. Therefore, it is below freezing or raining snow.
iii. Simplification : (p ∧ q) → p
p∧q
∴p
• Example: It is below freezing and snowing. Therefore, it is below freezing.
iv. Modus Tollens: [ ¬q ∧ (p → q)] → ¬p
¬q
p→q
∴ ¬p
v. Hypothetical Syllogism: [(p → q) ∧ (q → r)] → (p → r)
p→q
q→r
∴p→r
vi. Disjunctive Syllogism: [(p ∨ q) ∧ ¬p] → q
p∨q
¬p
∴q
🠶 A valid argument is one built using the rules of inference from premises (hypotheses).
When all premises are true the argument leads to a correct conclusion.
• (p1 ∧ p2 ∧ p3 ∧ … ∧pn ) → q
• However, if one or more of the premises is false the conclusion may be incorrect.
• How to use the rules of inference?
Applying the Rules
🠶 Text:
• It is not sunny this afternoon and it is colder than yesterday.
• We will go swimming only if it is sunny.
• If we do not go swimming then we will take a canoe trip.
• If we take a canoe trip, then we will be home by sunset.
🠶 Propositions:
• p = It is sunny this afternoon, q = it is colder than yesterday,
r = We will go swimming , s= we will take a canoe trip
• t= We will be home by sunset
🠶 Translation:
• Assumptions: ¬ p ∧ q, r → p, ¬ r → s, s→ t
• Hypothesis: t
Applying the Rules(cont.)
🠶 • Translations:
• p = It is sunny this afternoon, q = it is colder than yesterday,
r = We will go swimming , s= we will take a canoe trip
Conclusion t= We will be home by sunset
• Premises :
P1 ¬ p ∧ q
P2 r → p
P3 ¬ r → s,
P4 s→ t
• Conclusion : t
Applying the Rules(cont.)
🠶 Translations:
• Premises: P1 ¬ p ∧ q,P2 r → p, P3 ¬ r → s, P4 s→ t
• Conclusion: t
🠶 Proof:
• 1. ¬ p ∧ q Premise 1
• 2. ¬ p Simplification
• 3. r → p Premise 2
• 4. ¬ r Modus tollens (step 2 and 3)
• 5. ¬ r → s Premise 3
• 6. s Modus ponens (steps 4 and 5)
• 7. s→ t Premise 4
• 8. t Modus ponens (steps 6 and 7)
🠶 • end of proof
Applying the Rules(cont.)
🠶 Translations:
• Premises: P1 ¬ p ∧ q,P2 r → p, P3 ¬ r → s, P4 s→ t
• Conclusion: t
🠶 Proof:
🠶 • end of proof
Exercise (Dec 2018)
Exercise
“If policeman is able and willing to prevent crime, he would do so. If policeman is
unable to prevent crime, he would be ineffective. If he is unwilling to prevent crime, he
would be corrupted. If policeman exists, he is neither ineffective nor corrupted.
Policeman does not prevent crime” leads to conclusion “Policeman does not exist”.
Let:
P = “Policeman prevents crime”
🠶 A = “Policeman is able to prevent crime”
🠶 W = “Policeman is willing to prevent crime”
🠶 I = “Policeman is ineffective”
🠶 C = “Policeman is corrupted”
🠶 E = “Policeman exists”
a) If Leila receives her allowances on Saturday, she will go out to have dinner with her friends.
Leila does not get her allowances as usual this week, then her sister Emily will cook her
dinner. However, Emily is neither a good cook nor has the time to cook for Leila. Therefore,
Leila will go out with her friends.
i. Based on the situation above, convert the arguments into propositional logic statements.
Let:
i. From your answer above, use the Rule of Inference to check the conclusion’s validity.
🠶 (6 marks)
Methods of Proof
Proofs of equivalence
– previously we used the law of equivalence
p ↔ q is replaced with (p → q) ∧ (q → p)
🠶 General methods to prove the theorems:
i. Direct proof
– p → q is proved by showing that if p is true then q follows
ii. Indirect proof
– Show the contrapositive ¬q → ¬p. If ¬q holds then ¬p follows
iii. Proof by contradiction
– Show that (p ∧ ¬ q) contradicts the assumptions
iv. Proof by cases
🠶 Sometimes one method of proof does not go through as nicely as the other method.
🠶 You may need to try more than one approach.
Direct proof
• p → q is proved by showing that if p is true then q follows
🠶 Proof:
• Assume the hypothesis is true, i.e. suppose n is odd.
p: n is odd
q : n x n is odd
• Then n = 2k + 1, where k is an integer. n x n = (2k+1) x (2k + 1)
= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1
• Therefore, n x n is odd.
Indirect proof/Proof by Contraposition
How to do it?
🠶 Let:
p: 3n + 2 is odd
q: n is odd
Let
p: 3n+5 is odd
q: n is even
¬ p : 3n +5 is even
¬ q : n is odd
Using contrapositive ¬q → ¬ p
Assume n is odd, then n = 2k+1.
Then 3n + 5 = 3(2k+1) +5 = 6k + 3+ 5 = 2(3k +4) is EVEN
∴ 3n + 5 is even. Therefore, ¬q → ¬ p
Proof by Contrapositive: Exercise 1 (March 2021)
If 3n + 5 is odd then n is even. Give a proof by contrapositive.
Let
p: 3n+5 is odd
q: n is even
¬ p : 3n +5 is even
¬ q : n is odd
Using contrapositive ¬q → ¬ p
Assume n is odd, then n = 2k+1.
Then 3n + 5 = 3(2k+1) +5 = 6k + 3+ 5 = 2(3k +4) is EVEN
∴ 3n + 5 is even. Therefore, ¬q → ¬ p
Proof by contradiction(cont.)
Example:
Prove If 3n + 2 is odd, then n is odd.
Let: p: 3n + 2 is odd
q: n is odd
Then: 3n + 2 = 3(2k) + 2
= 6k + 2
= 2(3k+1)
Thus 3n + 2 is even.
Then
x + 10 = 2k + 10
= 2(k + 5)
Steps:
Let
P: n3 + 6 is even
Q: n is even
Then:
n3 + 6 = (2k+1)3 + 6
= (2k+1) (2k+1) (2k+1) + 6
= 8k3 + 12k2 + 6k + 1 + 6
= 2(4k3 + 6k2 + 3k + 3) + 1
Thus n3 + 6 is odd
This is a contradiction with the assumption that n3 + 6 is even.
Therefore n is even
Proof by Contradiction: Exercise 3
Prove If 2n + 1 is even, then n is odd.
Let: p: 2n + 1 is even
q: n is odd
Then: 2n + 1 = 2(2k)+ 1
= 4k + 1
🠶 We want to show p1 ∨ p2 ∨ … ∨ pn → q
• Note that this is equivalent to (p1 → q) ∧ (p2 → q) ∧ … ∧ (pn → q)
🠶 Why?
• p1 ∨ p2 ∨ … ∨ pn → q <=> (useful)
• ¬ (p1 ∨ p2 ∨ … ∨ pn) ∨ q <=> (De Morgan)
• (¬p1 ∧ ¬p2 ∧ … ∧ ¬pn) ∨ q <=> (distributive)
• (¬p1 ∨ q) ∧ (¬p2 ∨ q) ∧ …∧ (¬pn ∨ q) <=> (useful)
• (p1 → q) ∧ (p2 → q) ∧ … ∧ (pn → q)
Proof by cases(cont.)
🠶 We want to show p1 ∨ p2 ∨ … ∨ pn → q
• Equivalent to (p1 → q) ∧ (p2 → q) ∧ … ∧ (pn → q)
🠶 Prove individual cases as before. All of them must be true.
Conclusion, with ~q, we can get ~p. Complete! Conclusion, ~p is now contradicted with our initial
statement which is p
***Why? Because p → q and ¬q → ¬p are
equivalent !!! ***Why? Because we want to prove (p ∧ ¬q )
Hence, if we manage to prove ¬q → ¬p true , then p → Hence, since we manage to get ~p, it contradict with the
q is also true assumption that (p ∧ ¬q )
PROVING COMPLETE!
PROVING COMPLETE!
Prove by Contrapositive vs Contradiction
Consider the following statement: If 3n+5 is odd then n is even
Contrapositive Contradiction
Let Let
Contrapositive Contradiction
Let Let
p: n3 + 6 is even p: n3 + 6 is even
q: n is even q: n is even
Contrapositive Contradiction
Let Let
Using contrapositive ¬q → ¬ p