Download presentation
Presentation is loading. Please wait.
1
Discrete Maths 4. Proofs Objectives
, Semester 2, 4. Proofs Objectives to introduce proofs: assumptions, conclusions, rules of inference; different ways of proving if-then statements
2
Overview 1. What is a Proof? 9. Proving a Biconditional
2. Rules of Inference 3. Using Rules to Build a Proof 4. More Inference Rules 5. More Examples 6. More Proof Jargon 7. Two Simple Ways to Prove (p → q) 8. More Advanced Proofs of (p q) 9. Proving a Biconditional 10. Proof by Cases 11. Existence Proofs 12. Counter-examples 13. More Information
3
1. What is a Proof? Two assumptions /premises / statements:
“All men are mortal.” and “Socrates is a man.” Prove the conclusion: “Socrates is mortal.” the steps in going from assumptions to a conclusion is called a proof proof assumptions conclusion
4
In Logic Rules of inference are used to create a proof assumptions
Pred. Sec 4.1 assumptions how do we prove this? conclusion Rules of inference are used to create a proof most rules work with both propositional and predicate logic
5
2. Rules of Inference For proofs using propositional logic:
Modus Ponens Modus Tollens Transitivity Disjunctive Syllogism Addition Simplification Conjunction Resolution rules involving (used a lot) used in the Prolog logic programming language
6
2.1. Modus Ponens Example Let p be “It is snowing.”
assumptions conclusion Example Let p be “It is snowing.” Let q be “I study discrete math.” p q: “If it is snowing, then I study discrete math.” p: “It is snowing.” q: “I study discrete math.”
7
Why does Modus Ponens work?
Look at the truth table for assumptions T ? p q q T p There is only one possible value for q, true.
8
2.2. Modus Tollens Example Let p be “it is snowing.”
Let q be “I study discrete math.” p q: “If it is snowing, then I study discrete math.” q: “I do not study discrete math.” p: “It is not snowing.”
9
Why does Modus Tollens work?
Look at the truth table for assumptions T ? p q p T q There is only one possible value for p, false. This means p == T (i.e. q == F)
10
2.3. Transitivity (chaining)
This may be why math people use the symbol 2.3. Transitivity (chaining) assumptions p q r Example Let p be “it snows.” Let q be “I study discrete math.” Let r be “I will get an A.” p q: “If it snows, then I study discrete math.” q r: “If I study discrete math, then I will get an A.” p r: “If it snows, then I will get an A.” conclusion
11
T p q This shows why using truth tables for proofs does not scale up. T q r possible values for p, r R ? p r
12
2.4. Disjunctive Syllogism
p q T p ?? the “get part of “ rule q Example Let p be “I study discrete math.” Let q be “I study English literature.” p q: “I study discrete math or I study English literature.” p: “I do not study discrete math.” q: “I study English literature.”
13
2.5. Addition Example Let p be “I study discrete math.”
the “add anything “ rule ?? p q Example Let p be “I study discrete math.” Let q be “I will visit the Moon.” p: “I study discrete math.” p q: “I study discrete math or I will visit the Moon.”
14
2.6. Simplification p Example Let p be “I study discrete math.”
? 2.6. Simplification T q p q p ? Two rules p the “get part of “ rule Example Let p be “I study discrete math.” Let q be “I study English literature.” p q: “I study discrete math and English literature” q: “I study discrete math.”
15
2.7. Conjunction Example Let p be “I study discrete math.”
q ? p q the “combine two statements with “ rule -- useful Example Let p be “I study discrete math.” Let q be “I study English literature.” p: “I study discrete math.” q: “I study English literature.” p q: “I study discrete math and I study English literature.”
16
2.8. Resolution Graphically: p r p q q r Example
Let p be “I study discrete math.” Let r be “I study English.” Let q be “I study databases.” p r: “I do not study discrete math or I study English.” p q: “I study discrete math or I study databases.” q r: “I study databases or I study English.”
17
3. Using Rules to Build a Proof
Each statement (line) is either an assumption or a new statement made by using a rule of inference. S1 S2 . Sn C assumptions or new statements and this sequence of statements is the proof conclusion
18
Example 1 Simplification Simplification Assumption:
Show that q is a conclusion. Simplification Simplification
19
Example 2 continued Four Assumptions:
“It is not sunny and it is colder than yesterday.” “We will go swimming 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 night.” Show the conclusion: “We will be home by night.” a q if p example continued
20
Create propositional variables:
p: “It is sunny.” r: “We will go swimming.” t: “We will be home by night.” q: “It is colder than yesterday.” s: “We will take a canoe trip.” Translation problem into propositional logic: Four assumptions: p q r p r s s t Conclusion: t
21
3. Construct the proof Note that a truth table would have 32 rows since we have 5 propositional variables.
22
4. More Inference Rules Rules using variables and quantification:
for predicate logic proofs Rules using variables and quantification: Universal Instantiation (UI) Universal Generalization (UG) Existential Instantiation (EI) Existential Generalization (EG) Universal Modus Ponens (MP) Universal Modus Tollens (MT) involving involving versions of same-named propositional rules
23
4.1. Universal Instantiation (UI)
the “choose any element“ rule U P a b ... c Example The domain U is all dogs. x P(x): “All dogs are cute.” P(c): “Dog c is cute.” all elements are in P; nothing outside
24
Universial instantiation can be used on any expression surrounded by .
For example: x P(x) Q(x) y P(y) Q(y) P(c) Q(c) P(a) Q(a)
25
4.2. Universal Generalization (UG)
P a any c b ... c all elements are in P; nothing outside If you always choose a dog that is cute. “Therefore, all dogs are cute.”
26
4.3. Existential Instantiation (EI)
U P a b ... c d ... some elements are in P; others are outside the “choose an element carefully“ rule
27
Existential instantiation can be used on any expression surrounded by .
But you must be careful to select an element that is covered by the logic (i.e. inside the set). For example: x P(x) Q(x) y P(y) Q(y) P(c) Q(c) P(a) Q(a)
28
4.4. Existential Generalization (EG)
U P a b ... c d ... some elements are in P; others are outside Example: P(c): “Student c got an A in the class.” x P(x): “Someone got an A in the class.”
29
4.5. Universal Modus Ponens (MP)
x (P(x) Q(x) P(a) Q(a) P Q a ‘a’ must be in here according to the assumptions See the Socrates example , in the next few slides.
30
4.6. Universal Modus Tollens (MT)
x (P(x) Q(x) Q(a) P(a) P Q a ‘a’ must be in here according to the assumptions
31
5. More Examples Example 1: Prove the conclusion Assumptions:
“John Smith has two legs” Assumptions: “Every man has two legs.” “John Smith is a man.” Convert to predicate logic: M(x) is “x is a man” L(x) is “ x has two legs” John Smith (J) is in the domain. M(J) L(J) x M(x) L(x) Pred. Sec 4.1 continued
32
U M L J Proof:
33
Example 2 Prove the conclusion Assumptions:
“Someone who passed the first exam has not read the book.” Assumptions: “Some students in this class have not read the book.” “Everyone in this class passed the first exam.” continued
34
Convert to predicate logic: C(x) is “x is in this class”
B(x) is “x has read the book” P(x) is “x passed the first exam.” Translate assumptions and conclusion: Pred. Sec 4.3 Pred. Sec 4.1 continued
35
Proof
36
Socrates Example "All men are mortal" "Socrates is a man"
Pred. Sec 4.1 "All men are mortal" "Socrates is a man" "Socrates is mortal" Proof
37
6. More Proof Jargon A theorem is a conclusion shown to be true by writing a proof. A lemma is a statement that helps to prove a theorem. A corollary of a theorem is another statement that you can prove using the theorem. A conjecture is a conclusion that might be true. Once you have proved it, then it becomes a theorem.
38
7. Two Simple Ways to Prove (p → q)
1. Trivial Proof: if q is true, then p → q is true. e.g. “If it is raining then 1=1.” this statement (p q) is true p q look at the cases in the truth table p doesn't affect the truth of (p q)
39
2. Vacuous Proof: if p is false then p → q is true
e.g. “If I am both rich and poor, then = 5.” this statement (p q) is true q p q doesn't affect the truth of (p q) look at the cases in the truth table
40
8. More Advanced Proofs of (p q)
There are three main advanced techniques: direct proof proof by contrapositive (contraposition) proof by contradiction
41
8.1. Direct Proof of p → q Assume that p is true.
Use rules of inference to show that q is true. If p and q are true then (p q) is true look at the cases in the truth table
42
Example DP-1 Prove “If n is an odd integer, then n2 is odd.”
Assume that n is odd (i.e. p is true). Then n = 2k + 1 for some integer k. Squaring both sides: n2 = (2k + 1)2 = 4k2 + 4k +1 = 2(2k2 + 2k) + 1= 2r + 1 So n2 is an odd integer (i.e. q is true). This means that pq is true. p q
43
Example DP-2 Definition: A real number x is rational if there exists integers a and b where b≠0 such that x = a/b, and a and b have no common factors. Prove that the sum of two rational numbers is rational. As an if-then: if r is rational and s is rational then (r+s) is rational. Assume that r and s are rational (i.e. p is true). p q continued
44
This shows that the sum (r +s) is rational (i.e. that q is true)
Since r and s are rational, we can use the definition on the previous slide: This shows that the sum (r +s) is rational (i.e. that q is true) This means that pq is true. where v = pu + qt w = qu ≠ 0
45
8.2. Prove by Contrapositive
Instead of proving (p q), we prove its contrapositive, which is (q p) (p q) and (q p) are logically the same (look at their truth tables), but sometimes it is easier to build a proof for (q p).
46
Proof Steps for (q → p)
Assume that q is true. Use rules of inference to show that p is true. If q and p are true (i.e. that q and p are false) then (q → p) is true see the truth table on the previous slide
47
Example CP-1 Prove that if n is an integer and 3n + 2 is odd, then n is odd. Prove the contrapositive (q → p) is true This is: if (n is not odd) then (3n + 2 is not odd) Simplify using the mathematical meaning of odd/even: if (n is even) then (3n + 2 is even) p q q p q p continued
48
Assume n is even (i.e. that q is true). So, n = 2k for some integer k. Thus 3n + 2 = 3(2k) + 2 =6k +2 = 2(3k + 1) = 2j Therefore 3n + 2 is even (i.e. p is true). We have shown (¬q → ¬p ) is true, so (p → q) is true.
49
Example CP-2 Prove that if n2 is odd, then n is odd. continued
Prove the contrapositive (q → p) is true This is: if (n is not odd) then (n2 is not odd) Simplify using the mathematical meaning of odd/even: if (n is even) then (n2 is even) p q q p q p continued
50
Assume n is even (i. e. q is true)
Assume n is even (i.e. q is true). Therefore, there is an integer k such that n = 2k. Square both sides to get n2 = 4k2 = 2 (2k2) This means that n2 is even (i.e. p is true) We have shown (¬q → ¬p ) is true, so (p → q) is true.
51
8.3. Prove by Contradiction
Instead of proving that (p q) is true, prove the negative is false: i.e. prove that (p q) is false Transform: prove (p q) is false prove (p q) is false In words this means that we must show that p and q cannot both be true.
52
Example CD-1 Prove that if you pick 22 days from the calendar, at least 4 must fall on the same day of the week. p q: if (pick 22 days) then (≥ 4 are same day) Show that (p q) is false i.e. show that (p q) is false q = (≥ 4 are same day) = (≤ 3 are same day) p q continued
53
p = pick 22 days = 3 weeks + 1 day
If the pick includes 3 weeks then each day is repeated 3 times. "+ 1 day" means that one of the days occurs 4 times. This is not the same as q In other words, (p q) is false
54
Example CD-2 Prove that √2 is irrational.
This famous problem is not of the form (pq), but we can use a slight variation of proof by contradiction. We want to prove that p is true. Instead we will prove that the negative is false: i.e. prove that p is false Assume p: √2 is not irrational √2 is rational p continued
55
If √2 is rational then √2 = a/b, where b≠ 0 and a and b have no common factors (see slide 43).
Therefore a2 is even. If a2 is even then a is even (we should really prove this). Since a is even, a = 2c for some integer c. Therefore b2 is even. So b is even. continued
56
Since a and b are both even, then a and b have a common factor of 2
This contradicts p which includes the assumption that a and b have no common factors. So p is false, which means that p is true. Therefore, √2 is irrational.
57
9. Proving a Biconditional (pq)
Prove (p ↔ q) is true in two steps (cases): show that (p → q ) is true and show that (q →p) is true Why? Because (p ↔ q) (p → q) (q →p) As shown in the truth table p q pq qp pq p ↔q T F
58
For each of the two cases, you can use any proof technique you like:
e.g. trivial, vacuous, direct, contrapositive, contradiction
59
Example Prove “n is odd if and only if n2 is odd.” Two cases:
p q: if (n is odd) then (n2 is odd) q p: if (n2 is odd) then (n is odd) we proved this case in example CP-2 p q
60
10. Proof by Cases We want to prove the complex implication:
We can rewrite this as a conjunction (and) of simple implications: ((p1 q) (p2 q) (pn q)) Each of the implications is a case that needs to be proved: show (p1 q) is true, show (p2 q) is true, etc.
61
How to rewrite: Remember that (p q) (p q)
(p1 p2 ... pn) q (p1 p2 ... pn) q (p1 p2 ... pn) q // De Morgan's (p1 q) (p2 q) ... (pn q) // distribution (p1 q) (p2 q) ... (pn q)
62
Example Define max(a, b) = a if a ≥ b, otherwise = b if (a, b, c are real numbers) then max( max(a,b), c) == max(a, max(b, c)) Where are the cases inside p (i.e. p1, p2, ..pn)? They are all the different possible values for a, b, and c. p (complex) q continued
63
There are only 6 p cases that we need to look at: a ≥ b ≥ c a ≥ c ≥ b
b ≥ a ≥c b ≥ c ≥a c ≥ a ≥ b c ≥ b ≥ a cases p1, p2, ..., p6
64
In other words, we must prove:
(p1 q) if (a ≥ b ≥ c) then max( max(a,b), c) == max(a, max(b, c)) (p2 q) if (a ≥ c ≥ b) then max( max(a,b), c) == max(a, max(b, c)) : (p6 q) if (c ≥ b ≥ a) then max( max(a,b), c) == max(a, max(b, c)) and and
65
Case 1 Proof I'll just look at case 1 (p1 q), since the other cases are similar. Use direct proof: Assume that p1 is true. Use rules of inference to show that q is true. If p1 and q are true then (p1 q) is true
66
Assume a ≥ b ≥ c (i.e. p1 is true)
Plug this information into max(): max(a, b) = a max(a, c) = a max(b, c) = b This means that max(max(a, b), c) = max(a,c) = a and max(a, max(b, c)) = max(a, b) = a Therefore q is true. So p1 q is true.
67
11. Existence Proofs Prove statements like
e.g. is there a British person in this classroom? There are two main approaches: 1. Constructive existence proofs 2. Nonconstructive existence proofs Does an element exist?
68
Constructive Existence Proof
Proof by Example Find an element c, for which P(c) is true. Then is true by Existential Generalization (EG). U P a b ... c d ... some elements are in P; others are outside
69
Example Prove: “There is a positive integer that can be written as the sum of cubes of positive integers in two different ways.” Proof: because = =
70
Nonconstructive Existence Proof
Instead of proving x p(x) is true, we show that x p(x) is false Translate: prove x p(x) is false In words, we are trying to show that p() is not empty. U P a b ... c d ... show that P is not empty i.e. that is has some elements
71
12. Counter-examples A common problem is to show that a x P(x) statement is false: e.g. prove “All the planets in our solar system are made of cheese.” is false Logically: prove x P(x) is false x P(x) is true x P(x) is true In words, found an example that shows that P() is false – called a counter-example. show that this area is not empty U P a b ... c
72
Examples “All the planets in our solar system are made of cheese.” Counter-example: the Earth. So the statement is false. “Every positive integer is the sum of the squares of 3 integers.” Counter-example: 7. So the statement is false.
73
13. More Information Discrete Mathematics and its Applications Kenneth H. Rosen McGraw Hill, 2007, 7th edition chapter 1, sections 1.6 – 1.8
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.