Discrete Maths Objectives to introduce proofs: assumptions, conclusions, rules of inference;...
73
Discrete Maths • Objectives to introduce proofs: assumptions, conclusions, rules of inference; different ways of proving if-then statements 242-213, Semester 2, 2014-2015 4. Proofs 1
Discrete Maths Objectives to introduce proofs: assumptions, conclusions, rules of inference; different ways of proving if- then statements 242-213, Semester
Discrete Maths Objectives to introduce proofs: assumptions,
conclusions, rules of inference; different ways of proving if- then
statements 242-213, Semester 2, 2014-2015 4. Proofs 1
Slide 2
Overview 1. What is a Proof? 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 2
Slide 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. 3 assumptions conclusion proof the steps in
going from assumptions to a conclusion is called a proof
Slide 4
In Logic 4 Rules of inference are used to create a proof most
rules work with both propositional and predicate logic assumptions
conclusion how do we prove this? how do we prove this? Pred. Sec
4.1
Slide 5
2. Rules of Inference For proofs using propositional logic: 1.
Modus Ponens 2. Modus Tollens 3. Transitivity 4. Disjunctive
Syllogism 5. Addition 6. Simplification 7. Conjunction 8.
Resolution 5 rules involving (used a lot) used in the Prolog logic
programming language used in the Prolog logic programming
language
Slide 6
2.1. Modus Ponens 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. 6 assumptions
conclusion
Slide 7
Why does Modus Ponens work? Look at the truth table for 7
assumptions p q T p T q ? There is only one possible value for q,
true.
Slide 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. 8
Slide 9
Why does Modus Tollens work? Look at the truth table for 9
assumptions p q T qq T ? There is only one possible value for p,
false. This means p == T p (i.e. q == F)
Slide 10
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. 10 2.3. Transitivity (chaining) pqr
assumptions conclusion This may be why math people use the symbol
This may be why math people use the symbol
Slide 11
11 R R p q T q r T possible values for p, r p r ? This shows
why using truth tables for proofs does not scale up.
Slide 12
2.4. Disjunctive Syllogism 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. 12 p q T pp T q ?? the get part of
rule
Slide 13
2.5. Addition 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. 13 p q T p ?? the add
anything rule
Slide 14
2.6. Simplification 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. 14 p p q T ? q Two
rules ? p the get part of rule
Slide 15
2.7. Conjunction 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. 15 p q T ? p T q the combine two statements with rule
-- useful the combine two statements with rule -- useful
Slide 16
2.8. Resolution 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. 16
Graphically: p r p q q r
Slide 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.
S 1 S 2. S n C 17 assumptions or new statements and conclusion this
sequence of statements is the proof
Slide 18
Example 1 Assumption: Show that q is a conclusion. 18
Simplification
Slide 19
Example 2 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. 19 continued a q if p example a q if p example
Slide 20
1. 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. 2. Translation problem
into propositional logic: Four assumptions: p qr p r ss t
Conclusion: t 20
Slide 21
3. Construct the proof 21
Slide 22
4. More Inference Rules Rules using variables and
quantification: 1. Universal Instantiation (UI) 2. Universal
Generalization (UG) 3. Existential Instantiation (EI) 4.
Existential Generalization (EG) 5. Universal Modus Ponens (MP) 6.
Universal Modus Tollens (MT) 22 for predicate logic proofs versions
of same-named propositional rules involving involving
Slide 23
4.1. Universal Instantiation (UI) Example The domain U is all
dogs. x P(x):All dogs are cute. P(c):Dog c is cute. 23 U P a b c...
all elements are in P; nothing outside the choose any element
rule
Slide 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) 24
Slide 25
4.2. Universal Generalization (UG) 25 If you always choose a
dog that is cute. Therefore, all dogs are cute. any c U P a b c...
all elements are in P; nothing outside
Slide 26
4.3. Existential Instantiation (EI) 26 U P a b c... some
elements are in P; others are outside d... the choose an element
carefully rule
Slide 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) 27
Slide 28
4.4. Existential Generalization (EG) Example: P(c):Student c
got an A in the class. x P(x):Someone got an A in the class. 28 U P
a b c... some elements are in P; others are outside d...
Slide 29
4.5. Universal Modus Ponens (MP) 29 See the Socrates example,
in the next few slides. x (P(x) Q(x) P(a) Q(a) U a must be in here
according to the assumptions P Q a
Slide 30
4.6. Universal Modus Tollens (MT) 30 x (P(x) Q(x) Q(a) P(a) U a
must be in here according to the assumptions P Q a
Slide 31
5. More Examples Example 1 : Prove the conclusion 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. 31 continued x M(x) L(x)
Pred. Sec 4.1 M(J) L(J)
Slide 32
Proof: 32 U M L J
Slide 33
Example 2 Prove the conclusion 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. 33 continued
Slide 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: 34 continued Pred. Sec 4.3 Pred. Sec
4.1
Slide 35
Proof 35
Slide 36
Socrates Example 36 Proof "All men are mortal" "Socrates is a
man" "Socrates is mortal" Pred. Sec 4.1
Slide 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. 37
Slide 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. 38 p q this
statement (p q) is true look at the cases in the truth table p
doesn't affect the truth of (p q) p doesn't affect the truth of (p
q)
Slide 39
2. Vacuous Proof: if p is false then p q is true e.g. If I am
both rich and poor, then 2 + 2 = 5. 39 look at the cases in the
truth table p q this statement (p q) is true q doesn't affect the
truth of (p q) q doesn't affect the truth of (p q)
Slide 40
8. More Advanced Proofs of (p q) There are three main advanced
techniques: 1. direct proof 2. proof by contrapositive
(contraposition) 3. proof by contradiction 40
Slide 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 41 look at the cases in the truth table
Slide 42
Example DP-1 Prove If n is an odd integer, then n 2 is odd.
Assume that n is odd (i.e. p is true). Then n = 2 k + 1 for some
integer k. Squaring both sides: n 2 = ( 2 k + 1) 2 = 4 k 2 + 4k +1
= 2(2 k 2 + 2k) + 1= 2r + 1 So n 2 is an odd integer (i.e. q is
true). This means that p q is true. 42 p q
Slide 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). 43 pq continued
Slide 44
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 p q is true. 44 where v = pu + qt w
= qu 0
Slide 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). 45
Slide 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 46
Slide 47
Example CP-1 Prove that if n is an integer and 3 n + 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) 47 continued pq qq pp qq pp
Slide 48
Assume n is even (i.e. that q is true). So, n = 2 k for some
integer k. Thus 3 n + 2 = 3(2k) + 2 =6k +2 = 2(3k + 1) = 2j
Therefore 3 n + 2 is even (i.e. p is true). We have shown (q p ) is
true, so ( p q) is true. 48
Slide 49
Example CP-2 Prove that if n 2 is odd, then n is odd. Prove the
contrapositive ( q p ) is true This is: if (n is not odd) then (n 2
is not odd) Simplify using the mathematical meaning of odd/even: if
(n is even) then (n 2 is even) 49 p q qq pp qq pp continued
Slide 50
Assume n is even (i.e. q is true). Therefore, there is an
integer k such that n = 2 k. Square both sides to get n 2 = 4 k 2 =
2 ( 2 k 2 ) This means that n 2 is even (i.e. p is true) We have
shown (q p ) is true, so ( p q) is true. 50
Slide 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. 51
Slide 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) 52 p
q continued
Slide 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 53
Slide 54
Example CD-2 Prove that 2 is irrational. This famous problem is
not of the form (p q), 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 54 p continued
Slide 55
If 2 is rational then 2 = a/b, where b 0 and a and b have no
common factors (see slide 43). Then: Therefore a 2 is even. If a 2
is even then a is even (we should really prove this). Since a is
even, a = 2c for some integer c. Then: Therefore b 2 is even. So b
is even. 55 continued
Slide 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. 56
Slide 57
9. Proving a Biconditional (p q) 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) 57 pq pqpqqpqpp q q p p q TTTTTT
TFFTFF FTTFFF FFTTTT As shown in the truth table
Slide 58
For each of the two cases, you can use any proof technique you
like: e.g. trivial, vacuous, direct, contrapositive, contradiction
58
Slide 59
Example Prove n is odd if and only if n 2 is odd. Two cases: p
q:if (n is odd) then (n 2 is odd) q p:if (n 2 is odd) then (n is
odd) we proved this case in example CP-2 59 p q
Slide 60
10. Proof by Cases We want to prove the complex implication: We
can rewrite this as a conjunction (and) of simple implications: ((p
1 q) (p 2 q) ... (p n q)) Each of the implications is a case that
needs to be proved: show (p 1 q) is true, show (p 2 q) is true,
etc. 60
Slide 61
How to rewrite: Remember that (p q) ( p q) (p 1 p 2 ... p n ) q
(p 1 p 2 ... p n ) q ( p 1 p 2 ... p n ) q // De Morgan's ( p 1 q)
( p 2 q) ... ( p n q) // distribution (p 1 q) (p 2 q) ... (p n q)
61
Slide 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. p 1, p 2,..p n )? They are all the
different possible values for a, b, and c. 62 continued q p
(complex)
Slide 63
There are only 6 p cases that we need to look at: 1. a b c 2. a
c b 3. b a c 4. b c a 5. c a b 6. c b a 63 cases p1, p2,...,
p6
Slide 64
In other words, we must prove: (p 1 q)if (a b c) then max(
max(a,b), c) == max(a, max(b, c)) (p 2 q)if (a c b) then max(
max(a,b), c) == max(a, max(b, c)) : (p 6 q)if (c b a) then max(
max(a,b), c) == max(a, max(b, c)) 64 and
Slide 65
Case 1 Proof I'll just look at case 1 (p 1 q), since the other
cases are similar. Use direct proof: Assume that p 1 is true. Use
rules of inference to show that q is true. If p 1 and q are true
then (p 1 q) is true 65
Slide 66
Assume a b c (i.e. p 1 is true) Plug this information into
max(): max(a, b) = a max(a, c) = amax(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 p 1 q is true. 66
Slide 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
67 Does an element exist?
Slide 68
Constructive Existence Proof Find an element c, for which P(c)
is true. Then is true by Existential Generalization (EG). 68 U P a
b c... some elements are in P; others are outside d... Proof by
Example
Slide 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: 1729 because 1729 = 10 3 + 9 3 = 12 3 + 1 3 69
Slide 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. 70 U P a b
c... show that P is not empty i.e. that is has some elements
d...
Slide 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. 71 U P a b c... show
that this area is not empty
Slide 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. 72
Slide 73
13. More Information Discrete Mathematics and its Applications
Kenneth H. Rosen McGraw Hill, 2007, 7th edition chapter 1, sections
1.6 1.8 73