0% found this document useful (0 votes)
25 views41 pages

Lecture 5 - Applying The Rules and Formal Proofs

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

Lecture 5 - Applying The Rules and Formal Proofs

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

CSC510

Lecture 5: Applying
Discrete Structures The Rules and Formal Proofs
Rules Of Inference
Basic Concepts

We have the two premises:


🠶 “All men are mortal.”
🠶 “Socrates is a man.”

And the conclusion:


🠶 “Socrates is mortal.”
🠶 How do we get the conclusion from the premises?
Basic Concepts
🠶 We can express the premises (above the line) and the conclusion (below the line) in predicate logic as an
argument:

🠶 We will see shortly that this is a valid argument.


Basic Concepts
Important Rules

🠶 Rules of inference: logically valid inference patterns


i. Modus Ponens, or the Law of Detachment
Example:
p
Let p be “It is snowing.”
p→q Let q be “I will study discrete math.”

∴q “If it is snowing, then I will study discrete math.”


“It is snowing.”

“Therefore , I will study discrete math.”

• Given p is true and the implication p → q is true then q is true.


Important Rules(cont.)
🠶 Given p is true and the implication p → q is true then q is true
🠶 Prove this rule using truth table
🠶 The only position p TRUE and p → q TRUE is q
p q p→q
1 1 1
1 0 0
0 1 1
0 0 1

Tautology Form: (p ∧ (p → q)) → q


Important Rules(cont.)

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

🠶 Assume the following statements (hypotheses):


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

🠶 Show that all these lead to a conclusion:


• We will be home by sunset.
Applying the Rules(cont.)

🠶 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:

🠶 P: Leila receives allowance on Saturday


🠶 Q: Leila will go out to have dinner with her friends
🠶 R: Emily is a good cook
🠶 S: Emily will cook for Leila
🠶 (4 marks)

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

Example: Prove that “If n is odd, then n x n is odd.”

🠶 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

• To show p → q prove its contrapositive ¬q → ¬p


• Why? Because p → q and ¬q → ¬p are equivalent !!!
• Hence, we assume ¬q is true, show that ¬p is true

How to do it?

1. Assume the negation of the conclusion (~q)


2. Then proof the negation of the hypothesis (~p)

Let’s try with the example:

Prove If 3n + 2 is odd then n is odd


Indirect proof/Proof by Contraposition

Prove If 3n + 2 is odd then n is odd

🠶 Let:
p: 3n + 2 is odd
q: n is odd

• Assume n is even, that is n = 2k, where k is an integer.


• Then:
3n + 2 = 3(2k) + 2
= 6k + 2
= 2(3k+1) Everything that is multiplied by 2 is even
• Therefore 3n + 2 is even.
• We proved ¬ “n is odd” → ¬ “3n + 2 is odd”. This is equivalent to “3n + 2 is odd”
→ “n is odd”.
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 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

using contradiction p ∧ ¬q,


¬q: n is even, where is n = 2k, where k an integer.

Then: 3n + 2 = 3(2k) + 2
= 6k + 2
= 2(3k+1)
Thus 3n + 2 is even.

This is a contradiction with the assumption that 3n + 2 is odd.


Therefore, n is odd.
Proof by Contradiction: Exercise 1
If x + 10 is odd, then x is odd
Proof
1. Let x + 10 be odd.
2. By way of contradiction (BWOC), suppose x is not odd (or x is even)
3. Then by definition, integer k such that x = 2k

Then
x + 10 = 2k + 10
= 2(k + 5)

Assume that (k +5) is any integer such as j, then x + 10 = 2j

Thus, x + 10 is even which is contradiction to x + 10 is odd.


Therefore, x must be odd.
Proof by contradiction(cont.)
We want to prove p → q by contradiction with the mechanism of:
• To reject p → q show that (p ∧ ¬q ) can be true
• To reject (p ∧ ¬q ) show that either q or ¬ p is True

Steps:

1. Let the hypothesis as p and conclusion as q


2. Contradict the conclusion by assuming (p ∧ ¬q )
3. Prove that with ¬q, we will get ¬ p
4. Therefore, it is proved that the ¬ p is the contradiction of p
Proof by Contradiction: Exercise 2 (Oct 2020)
Consider the following statement: If n3 + 6 is even then n is even. Give a proof by contradiction.

Let

P: n3 + 6 is even
Q: n is even

Proof using contradiction P ˄ ¬ Q

Assume n3 + 6 is even and n is odd, that is n = 2k+1, where k an integer.

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

using contradiction p ∧ ¬q,


¬q: n is even, where is n = 2k, where k an integer.

Then: 2n + 1 = 2(2k)+ 1
= 4k + 1

Here we proved that ~q lead to ~p


Thus 2n + 1 is odd.

This is a contradiction with the assumption that 2n + 1 is even.


Therefore, n is odd.
Proof by Contradiction: Exercise 4
Use proof by contradiction to prove each of the following true statements.

x 2 + y2 ≥ 2xy for all x, y ∈ R


Proof by cases/Proof by Induction

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

🠶 Example: Show that |x||y|=|xy|.


🠶 Proof:
• 4 cases:
• x >=0, y>=0 ; xy >0 and |xy|=xy=|x||y|
• x>= 0, y <0 ; xy < 0 and |xy|=-xy =x (-y)=|x||y|
• x<0, y>=0 ; xy < 0 and |xy|=-xy =(-x) y=|x||y|
• x<0, y <0 ; xy >0 and |xy|= (-x)(-y) =|x||y|
• All cases proved.
Prove by Contrapositive vs Contradiction
Contrapositive Contradiction

To show p → q prove its contrapositive ¬q → ¬p To show that the contradiction of (p → q ) using it


negation
~(p → q ) =(p ∧ ¬q )
Proving starts with assuming what will happen if we use Proving starts with assuming what will happen if we use
~p and ~q ~q only
With ~q, prove that the solution could lead to ~p With ~q, prove that the solution could lead to ~p

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

p: 3n+5 is odd p: 3n+5 is odd


q: n is even q: n is even

¬ p : 3n +5 is even Proof using contradiction P ˄ ¬ Q


¬ q : n is odd
Assume 3n+5 is odd, and n is odd, that is n = 2k+1,
Using contrapositive ¬q → ¬ p where k an integer.

Assume n is odd, then n = 2k+1, where k is an integer Then:


3n + 5 = 3(2k+1) +5
Then, = 6k + 3+ 5
3n + 5 = 3(2k+1) +5 = 2(3k +4) -> EVEN
= 6k + 3+ 5
= 2(3k +4) -> EVEN Thus, 3n + 5 is even. This is a contradiction with the
assumption that 3n + 5 is odd.
Thus, 3n + 5 is even. Therefore, proven ¬q → ¬ p which is
equivalent to p → q Therefore, n is even
Prove by Contrapositive vs Contradiction
Consider the following statement: If n3 + 6 is even then n is even

Contrapositive Contradiction

Let Let

p: n3 + 6 is even p: n3 + 6 is even
q: n is even q: n is even

¬ p : n3 + 6 is odd Proof using contradiction P ˄ ¬ Q


¬ q : n is odd
Assume n3 + 6 is even, and n is odd, that is n = 2k+1,
Using contrapositive ¬q → ¬ p where k an integer.

Assume n is odd, then n = 2k+1, where k is an integer Then:


n3 + 6 = (2k+1)3 + 6
Then, = (2k+1) (2k+1) (2k+1) + 6
n3 + 6 = (2k+1)3 + 6 = 8k3 + 12k2 + 6k + 1 + 6
= (2k+1) (2k+1) (2k+1) + 6 = 2(4k3 + 6k2 + 3k + 3) + 1 -> ODD
= 8k3 + 12k2 + 6k + 1 + 6
= 2(4k3 + 6k2 + 3k + 3) + 1 -> ODD Thus, n3 + 6 is odd. This is a contradiction with the
assumption that n3 + 6 is even.
Thus, n3 + 6 is odd. Therefore, proven ¬q → ¬ p which is
equivalent to p → q Therefore, n is even
Prove by Contrapositive vs Contradiction
If n and m are integers and n*m are odd, then n and m are odd. (TEST 1 20222)

Contrapositive Contradiction

Let Let

p: n*m are odd p: n*m are odd


q: n and m are odd q: n and m are odd

¬ p : n*m are even Proof using contradiction P ˄ ¬ Q


¬ q : n and m are even

Using contrapositive ¬q → ¬ p

You might also like