78
Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction CITS2211 Discrete Structures Proofs Unit coordinator: Rachel Cardell-Oliver August 13, 2017

CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

CITS2211 Discrete StructuresProofs

Unit coordinator: Rachel Cardell-Oliver

August 13, 2017

Page 2: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Highlights

1 Arguments vs Proofs.

2 Proof strategies

3 Famous proofs

Page 3: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Reading

Chapter 1: What is a proof?“Mathematics for Computer Science” by Lehman, Leighton and Meyer

http://courses.csail.mit.edu/6.042/spring17/mcs.pdf

Page 4: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Why

1 Theoretical Computer Science based on Mathematics.

2 Most famous problem about proofs: P=NP?

3 Automatic proofs = AI?https://www.umsu.de/logik/trees/

4 Critical Thinking.

Page 5: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Notes and examples selected by Profs Reynolds and Cardell-Oliverfrom Introductory Logic and Sets for Computer Scientists, N.Nissanke, Addison Wesley

Page 6: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proofs in logic and maths

A proof is a really good argument that something is true.

In this unit we will see two different main sorts of proofs.

In today’s lecture we will see (formal) proofs by logical deduction.

Then we will see rigorous (but informal) mathematical proofs.

There are similarities and differences.

Page 7: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Direct Proof by Logical Deduction

Definition: An axiom is a proposition that is simply accepted astrue.Definition: A proof is a sequence of logical deductions fromaxioms and previously-proved statements that concludes with theproposition in question.Definition: Logical deductions or inference rules are used toprove new propositions using previously proved ones.

Page 8: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Inference Rules

Inference rules are sometimes written using this notation:

P,P → Q

Q

When the statements above the line, called the antecedents, areproved, then we can consider the statement below the line, calledthe conclusion or consequent, to also be proved.Definition: The turnstile symbol, `, means “infer that”.

We write p, p → q ` q instead of the fraction notation above.

Page 9: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Soundness and Completeness

A key requirement of an inference rule is that it must be sound:any assignment of truth values that makes all the antecedents truemust also make the consequent true.Definition: Soundness: Any statement you get by following therules is true.

Definition: Completeness: Any statement that is true, you can getby following the rules.

Page 10: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Arguments in Propositional Logic

Definition: An argument is a collection of propositions, one ofwhich, referred to as the conclusion is justified by the others,referred to as the premises.Definition: A valid argument is a set of propositions, the last ofwhich follows from—or is implied by—the rest.Definition: All other arguments are invalid

Page 11: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Arguments in Propositional Logic

Example:

1 If the patient has a pulse then the patient’s heart is pumping.

2 The patient has a pulse.

3 Therefore, the patient’s heart is pumping.

The conclusion (3) is true whenever the premises are true.The argument is therefore valid.

Page 12: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Arguments in Propositional Logic

Example:

1 If I win the lottery then I am lucky.

2 I do not win the lottery.

3 Therefore, I am unlucky.

This argument is invalid. Can you see why?

Because the conclusion (3) does not follow whenever the premises(1,2) are true. Suppose W is false and L is true. Then W → L istrue and ¬W is true. So both premises are true. But theconclusion, ¬L, is false.It is possible that I am lucky, but I did not win the lottery.

Page 13: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Arguments in Propositional Logic

Example:

1 If I win the lottery then I am lucky.

2 I do not win the lottery.

3 Therefore, I am unlucky.

This argument is invalid. Can you see why?Because the conclusion (3) does not follow whenever the premises(1,2) are true. Suppose W is false and L is true. Then W → L istrue and ¬W is true. So both premises are true. But theconclusion, ¬L, is false.It is possible that I am lucky, but I did not win the lottery.

Page 14: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Inference Rules

Definition: An inference rule is a primitive valid argument form.Each inference rule enables the elimination or introduction of alogical connective.

Page 15: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Some example rules

Modus ponens {p → q, p} ` q

Modus tollens {p → q,¬q} ` ¬p

Double negation ¬¬p ` p

Contradiction p,¬p ` q

Conjunction introduction {p, q} ` (p ∧ q)

Conjunction elimination (p ∧ q) ` p, (p ∧ q) ` q

Disjunction introduction p ` (p ∨ q), q ` (p ∨ q)

Disjunction elimination {p ∨ q, p → r , q → r} ` r

Biconditional introduction {p → q, q → p} ` (p ↔ q)

Biconditional elimination (p ↔ q) ` (p → q),(p ↔ q) ` (q → p)

Page 16: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof Example

Example: From the premise (p ∧ q) ∨ r , derive ¬p → r1 (p ∧ q) ∨ r premise2 r ∨ (p ∧ q) from 1, commutativity3 (r ∨ p) ∧ (r ∨ q) from 2, distributivity4 (r ∨ p) from 3, conjunction elimination5 p ∨ r from 4, commutativity6 ¬¬p ∨ r from 5, double negation7 ¬p → r from 6, implication law QED

Page 17: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof Example

Example: From the premises H → C , ¬(L ∧ Y ) and ¬Y → ¬C ,derive H → ¬L. Fill in the missing propositions and justificationsfrom the following proof.

1. H → C premise

2. ¬(L ∧ Y ) premise

3.

4. C → Y 3, contrapositive

5. ¬L ∨ ¬Y

6. 5, commutativity

7. Y → ¬L 6, implication law

8. 1,4, transitivity of implication

9. H → ¬L

QED.

Page 18: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

the complete proof

1. H → C premise

2. ¬(L ∧ Y ) premise

3. ¬Y → ¬C premise

4. C → Y 3, contrapositive

5. ¬L ∨ ¬Y 2, De Morgan

6. ¬Y ∨ ¬L 5, commutativity

7. Y → ¬L 6, implication law

8. H → Y 1,4, transitivity of implication

9. H → ¬L 8,7, transitivity of implication

QED.

Page 19: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proofs with Predicates - elim and intro laws

RTP

∃x .(P(x)→ Q(x)) ∧ ∀y .(Q(y)→ R(y)) ∧ ∀x .P(x)→ ∃x .R(x)

goal is to derive ∃x .R(x) from the premises.1. ∃x .(P(x)→ Q(x)) premise2. ∀y .(Q(y)→ R(y)) premise3. ∀x .P(x) premise4. P(a)→ Q(a) 1, exist elimination5. Q(a)→ R(a) 2, forall elimination6. P(a) 3, forall elimination7. Q(a) 6,4 modus ponens8. R(a) 5,7, modus ponens9. ∃x .R(x) 8, exist introductionQED

Page 20: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof Templates

In principle, a proof can be any sequence of logical deductionsfrom axioms and previously proved statements that concludes withthe proposition in question.

Fortunately, many proofs follow one of a handful of standardtemplates such as proof by contradiction, proof by cases, reductioad absurdum and proving the contrapositive. We will meet some ofthese when we study mathematical proofs.

Note on abbreviations used above: write RTP at the beginning ofproofs for “required to prove” and QED at the end for “quod eratdemonstrandum” meaning “which was to be demonstrated”, orend of proof.

Page 21: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proofs

A proof is a logical argument that demonstrates the truth of someproposition.

Ultimately, mathematics rests on a set of axioms, which are verysimple propositions that are simply accepted as being true.

Then a proof is a sequence of logical deductions using agreed-uponinference rules that leads from the axioms to the proposition inquestion.

In practice, a proof will lead from previously-proved statements tothe new proposition.

Page 22: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Axioms

The axioms that are most broadly used (ZFC) are very low-levelstatements that encapsulate what we would normally consider tobe “obvious” statements about sets.

For example, what does

∀x∀y [∀z(z ∈ x ⇔ z ∈ y)⇒ x = y ]

say?

It simply says that two sets x and y are equal if they have thesame elements!

Page 23: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Axioms

The axioms that are most broadly used (ZFC) are very low-levelstatements that encapsulate what we would normally consider tobe “obvious” statements about sets.

For example, what does

∀x∀y [∀z(z ∈ x ⇔ z ∈ y)⇒ x = y ]

say?

It simply says that two sets x and y are equal if they have thesame elements!

Page 24: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Inference Rules

Inference rules are sometimes written using this notation:

P,P → Q

Q

When the statements above the line, called the antecedents, areproved, then we can consider the statement below the line, calledthe conclusion or consequent, to also be proved.

Recall this inference rule is called modus ponens.

Page 25: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Modus tollens

Another frequently used inference rule is modus tollens

P → Q,¬Q

¬P

For example, if P is “It has rained recently” and Q is “The groundis wet”, then if you observe that the ground is dry, then you canconclude that it has not rained recently.

Page 26: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Logical fallacies

An incorrect rule of inference is

P → Q,¬P

¬Q

This is often called modus morons for obvious reasons.

“It has not rained recently and therefore the ground is not wet”.

Page 27: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Logical Proof

Hilbert asked whether it was possible to devise a (finite) set ofaxioms and inference rules such that

Everything that can be formally logically proved is a truestatement (Soundness)

Every true statement (in number theory) can be formallylogically proved from the axioms (Completeness)

In essence, he wondered whether mathematics could be completelyautomated as a complicated string manipulation exercise.

Godel proved that any logical system that is complicated enoughto formalise addition and multiplication cannot be proved to beconsistent within the system itself.

Or to put it another way, no such system can prove its ownconsistency.

Page 28: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Real world proofs

Despite Godel’s result, the quest for formal proofs is not entirelydead

Mathematicians and computer scientists are building systemssuch as HOL (hol-theorem-prover.org) and Coq(coq.inria.fr) to automate and validate proofs ofimportant results.

Computer scientists are working on systems to automaticallyreason about and prove program correctness.

However proofs are still mostly expressed at a higher level withlarger “steps” between each assertion.

Page 29: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The following sections describe some different proof strategies

Page 30: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proving implications

Many assertions are of the form P → Q, though usually stated “IfP, then Q”.

For example, consider these simple statements

If n is even, then n2 is even

If r is irrational, then r1/5 is irrational

Page 31: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Direct Proof

To prove that P → Q, you should

Start the proof with “Assume P holds”,

Make logical deductions for a few steps,

End the proof with “and hence Q follows”

Page 32: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof: If n is even, then n2 is even.

We use the definition of the word even: an integer multiple of 2,and then the proof proceeds:

Let n be an even integer (Assumption)

Then n = 2k for some integer k (Defn. of even)Then n2 = 4k2 (Arithmetic)Then n2 = 2(2k2) (Arithmetic)Then n2 = 2k ′ where k ′ = 2k2 is an integer (Arithmetic - twice)Therefore n2 is even (Defn. of even)

Page 33: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof: If n is even, then n2 is even.

We use the definition of the word even: an integer multiple of 2,and then the proof proceeds:

Let n be an even integer (Assumption)Then n = 2k for some integer k (Defn. of even)

Then n2 = 4k2 (Arithmetic)Then n2 = 2(2k2) (Arithmetic)Then n2 = 2k ′ where k ′ = 2k2 is an integer (Arithmetic - twice)Therefore n2 is even (Defn. of even)

Page 34: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof: If n is even, then n2 is even.

We use the definition of the word even: an integer multiple of 2,and then the proof proceeds:

Let n be an even integer (Assumption)Then n = 2k for some integer k (Defn. of even)Then n2 = 4k2 (Arithmetic)

Then n2 = 2(2k2) (Arithmetic)Then n2 = 2k ′ where k ′ = 2k2 is an integer (Arithmetic - twice)Therefore n2 is even (Defn. of even)

Page 35: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof: If n is even, then n2 is even.

We use the definition of the word even: an integer multiple of 2,and then the proof proceeds:

Let n be an even integer (Assumption)Then n = 2k for some integer k (Defn. of even)Then n2 = 4k2 (Arithmetic)Then n2 = 2(2k2) (Arithmetic)

Then n2 = 2k ′ where k ′ = 2k2 is an integer (Arithmetic - twice)Therefore n2 is even (Defn. of even)

Page 36: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof: If n is even, then n2 is even.

We use the definition of the word even: an integer multiple of 2,and then the proof proceeds:

Let n be an even integer (Assumption)Then n = 2k for some integer k (Defn. of even)Then n2 = 4k2 (Arithmetic)Then n2 = 2(2k2) (Arithmetic)Then n2 = 2k ′ where k ′ = 2k2 is an integer (Arithmetic - twice)

Therefore n2 is even (Defn. of even)

Page 37: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof: If n is even, then n2 is even.

We use the definition of the word even: an integer multiple of 2,and then the proof proceeds:

Let n be an even integer (Assumption)Then n = 2k for some integer k (Defn. of even)Then n2 = 4k2 (Arithmetic)Then n2 = 2(2k2) (Arithmetic)Then n2 = 2k ′ where k ′ = 2k2 is an integer (Arithmetic - twice)Therefore n2 is even (Defn. of even)

Page 38: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Contrapositive: If r is irrational, then r 1/5 is irrational

To prove the second statement, the direct proof technique doesn’twork as well – the reason is that the statement “Let r beirrational” is really a negative statement.

However, recall from propositional logic that the contrapositive ofP → Q, that is, the statement

¬Q → ¬P

is logically equivalent to P → Q.

Page 39: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Working the contrapositive

So the contrapositive statement is

“If r1/5 is rational, then r is rational”.

We use the definition of the word rational: a number of the formp/q where p and q are integers and q 6= 0.The proof proceeds:

Assume that r1/5 is rational (Assumption)

Then r1/5 = p/q for integers p, q 6= 0 (Defn. of rational)Then r = p5/q5 (Arithmetic)Then r = p′/q′ where p′ = p5, q′ = q5 6= 0 are integers (Arithm.)Therefore r is rational (Defn. of rational)

Page 40: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Working the contrapositive

So the contrapositive statement is

“If r1/5 is rational, then r is rational”.

We use the definition of the word rational: a number of the formp/q where p and q are integers and q 6= 0.The proof proceeds:

Assume that r1/5 is rational (Assumption)Then r1/5 = p/q for integers p, q 6= 0 (Defn. of rational)

Then r = p5/q5 (Arithmetic)Then r = p′/q′ where p′ = p5, q′ = q5 6= 0 are integers (Arithm.)Therefore r is rational (Defn. of rational)

Page 41: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Working the contrapositive

So the contrapositive statement is

“If r1/5 is rational, then r is rational”.

We use the definition of the word rational: a number of the formp/q where p and q are integers and q 6= 0.The proof proceeds:

Assume that r1/5 is rational (Assumption)Then r1/5 = p/q for integers p, q 6= 0 (Defn. of rational)Then r = p5/q5 (Arithmetic)

Then r = p′/q′ where p′ = p5, q′ = q5 6= 0 are integers (Arithm.)Therefore r is rational (Defn. of rational)

Page 42: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Working the contrapositive

So the contrapositive statement is

“If r1/5 is rational, then r is rational”.

We use the definition of the word rational: a number of the formp/q where p and q are integers and q 6= 0.The proof proceeds:

Assume that r1/5 is rational (Assumption)Then r1/5 = p/q for integers p, q 6= 0 (Defn. of rational)Then r = p5/q5 (Arithmetic)Then r = p′/q′ where p′ = p5, q′ = q5 6= 0 are integers (Arithm.)

Therefore r is rational (Defn. of rational)

Page 43: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Working the contrapositive

So the contrapositive statement is

“If r1/5 is rational, then r is rational”.

We use the definition of the word rational: a number of the formp/q where p and q are integers and q 6= 0.The proof proceeds:

Assume that r1/5 is rational (Assumption)Then r1/5 = p/q for integers p, q 6= 0 (Defn. of rational)Then r = p5/q5 (Arithmetic)Then r = p′/q′ where p′ = p5, q′ = q5 6= 0 are integers (Arithm.)Therefore r is rational (Defn. of rational)

Page 44: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

If and only if

Mathematicians are particularly fond of “if-and-only-if” statements

An integer is even if and only if its square is even.

A matrix is invertible if and only if its determinant is non-zero.

It is common to use the abbreviation iff instead of if and only if.

However P if and only if Q just means that both the implications

P → Q, Q → P

hold, and so you can simply provide proofs for each separately.

Page 45: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

If and only if

Lemma. An integer is even if and only if its square is even.Proof.(→) The forward implication is “n even implies that n2 is even”,and was proved earlier.(←) The reverse implication is “n2 even implies that n is even”,but for this we choose to prove the contrapositive, namely that “nodd implies that n2 is odd”.

Let n be an odd integer (Assumption)

Then n = 2k + 1 for some integer k (Defn. of odd)Then n2 = 4k2 + 4k + 1 (Arithmetic)Then n2 = 2(2k2 + 2k) + 1 (Arithmetic)Then n2 = 2k ′ + 1 where k ′ = 2k2 + 2k is an integer (Arithmetic)Therefore n2 is odd (Defn. of odd)

Page 46: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

If and only if

Lemma. An integer is even if and only if its square is even.Proof.(→) The forward implication is “n even implies that n2 is even”,and was proved earlier.(←) The reverse implication is “n2 even implies that n is even”,but for this we choose to prove the contrapositive, namely that “nodd implies that n2 is odd”.

Let n be an odd integer (Assumption)Then n = 2k + 1 for some integer k (Defn. of odd)

Then n2 = 4k2 + 4k + 1 (Arithmetic)Then n2 = 2(2k2 + 2k) + 1 (Arithmetic)Then n2 = 2k ′ + 1 where k ′ = 2k2 + 2k is an integer (Arithmetic)Therefore n2 is odd (Defn. of odd)

Page 47: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

If and only if

Lemma. An integer is even if and only if its square is even.Proof.(→) The forward implication is “n even implies that n2 is even”,and was proved earlier.(←) The reverse implication is “n2 even implies that n is even”,but for this we choose to prove the contrapositive, namely that “nodd implies that n2 is odd”.

Let n be an odd integer (Assumption)Then n = 2k + 1 for some integer k (Defn. of odd)Then n2 = 4k2 + 4k + 1 (Arithmetic)

Then n2 = 2(2k2 + 2k) + 1 (Arithmetic)Then n2 = 2k ′ + 1 where k ′ = 2k2 + 2k is an integer (Arithmetic)Therefore n2 is odd (Defn. of odd)

Page 48: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

If and only if

Lemma. An integer is even if and only if its square is even.Proof.(→) The forward implication is “n even implies that n2 is even”,and was proved earlier.(←) The reverse implication is “n2 even implies that n is even”,but for this we choose to prove the contrapositive, namely that “nodd implies that n2 is odd”.

Let n be an odd integer (Assumption)Then n = 2k + 1 for some integer k (Defn. of odd)Then n2 = 4k2 + 4k + 1 (Arithmetic)Then n2 = 2(2k2 + 2k) + 1 (Arithmetic)

Then n2 = 2k ′ + 1 where k ′ = 2k2 + 2k is an integer (Arithmetic)Therefore n2 is odd (Defn. of odd)

Page 49: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

If and only if

Lemma. An integer is even if and only if its square is even.Proof.(→) The forward implication is “n even implies that n2 is even”,and was proved earlier.(←) The reverse implication is “n2 even implies that n is even”,but for this we choose to prove the contrapositive, namely that “nodd implies that n2 is odd”.

Let n be an odd integer (Assumption)Then n = 2k + 1 for some integer k (Defn. of odd)Then n2 = 4k2 + 4k + 1 (Arithmetic)Then n2 = 2(2k2 + 2k) + 1 (Arithmetic)Then n2 = 2k ′ + 1 where k ′ = 2k2 + 2k is an integer (Arithmetic)

Therefore n2 is odd (Defn. of odd)

Page 50: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

If and only if

Lemma. An integer is even if and only if its square is even.Proof.(→) The forward implication is “n even implies that n2 is even”,and was proved earlier.(←) The reverse implication is “n2 even implies that n is even”,but for this we choose to prove the contrapositive, namely that “nodd implies that n2 is odd”.

Let n be an odd integer (Assumption)Then n = 2k + 1 for some integer k (Defn. of odd)Then n2 = 4k2 + 4k + 1 (Arithmetic)Then n2 = 2(2k2 + 2k) + 1 (Arithmetic)Then n2 = 2k ′ + 1 where k ′ = 2k2 + 2k is an integer (Arithmetic)Therefore n2 is odd (Defn. of odd)

Page 51: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof by cases

A common technique in proving is to divide the proof into separatecases and resolve each case separately.

Theorem If the 15 edges of the graph shown below are colouredred or blue then there will either be a red triangle or a blue triangle.

Page 52: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof

Consider an arbitrary vertex, and call it v .

Now look at the five edges leading from v and notice that by thePigeonhole Principle, either

Case 1: At least three of the edges are red, or

Case 2: At least three of the edges are blue.

Now consider each case separately.

Page 53: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Case 1

Consider any three vertices at the other end of red edges from v ,and consider the three edges joining them.

v

Then either :

Case 1.1 One of these three edges is red, in which case itforms a red triangle using v , or

Case 1.2 All of these three edges are blue, in which case theyform a blue triangle.

Page 54: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Case 2

Consider any three vertices at the other end of blue edges from v ,and consider the three edges joining them.

v

Then either :

Case 2.1 One of these three edges is blue, in which case itforms a blue triangle using v , or

Case 2.2 All of these three edges are red, in which case theyform a red triangle.

Page 55: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Proof by Contradiction

This is a type of indirect proof where you show that a propositionis true by demonstrating that its negation leads to somethingknown to be false.

Prove P by first assuming ¬P and then deriving false.Prove P → Q by first assuming P ∧ ¬Q and then deriving false.For example, to prove proposition P you start by saying

Write “Assume, for a contradiction, that ¬P holds”

Deduce something known to be false (which will take severalsteps)

Conclude with “This is a contradiction, and so ¬P is false andP is true”.

Page 56: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 57: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 58: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)

− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 59: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)

− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 60: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)

− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 61: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)

− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 62: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)

− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 63: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)

− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 64: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)

− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 65: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)

− This is a contradiction, and so ¬P is false and P is true

Page 66: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

The most famous example

Let P be the statement

“√

2 is irrational”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that

√2 is rational (Pf. by contradiction)

− Express√

2 = p/q in lowest terms (Defn. of rational)− Then p and q have no common factors (Defn of lowest terms)− Then p2/q2 = 2 (Arithmetic)− Then p2 = 2q2 (Arithmetic)− Then p is even (Earlier proof)− Then p2 is a multiple of 4 (Arithmetic)− Then q2 is even, so q is even (Earlier proof)− Then p and q do have a common factor (Arithmetic)− This is a contradiction, and so ¬P is false and P is true

Page 67: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)

− Then there are finitely many, say k, primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 68: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)

− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 69: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)

− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 70: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)

− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 71: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)

− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 72: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)

− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 73: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)

− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 74: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 75: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Another famous example

Let P be the statement

“There are infinitely many prime numbers”

and see how we can prove this by contradiction.

Proof− Assume, for a contradiction, that ¬P holds (Pf. by contradiction)− Then there are finitely many, say k , primes (Meaning of finite)− Let L = {p1, p2, . . . , pk} contain all primes (Using assumption)− Set n = p1p2 . . . pk + 1 (Using assumption)− Then n = p1K1 + 1, so p1 does not divide n (Arithmetic)− Then n = p2K2 + 1, so p2 does not divide n (Arithmetic)− None of the primes in L divide n (Simple generalisation)− Therefore n has a prime factor not in L (Property of integers)

− This is a contradiction, so ¬P is false and P is true

Page 76: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Strategies

Choosing what proof strategy to use is not always obvious.Try writing down what you do know: assumptions and relevantproperties.Then consider which proof strategies could be used.

Page 77: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Advice

Advice from the text “Mathematics for Computer Science” byLehman, Leighton and Meyer.

1 State your game plan

2 Keep a linear flow

3 A proof is an essay, not a calculation

4 Avoid excessive symbolism

5 Revise and simplify

6 Introduce notation thoughtfully

7 Structure long proofs

8 Be wary of the “obvious”

9 Finish

Page 78: CITS2211 Discrete Structures Proofs - Unit informationteaching.csse.uwa.edu.au/.../lectures/w03-cits2211lectures-proofs.pdf · Proofs in logic and maths A proof is a really good argument

Proof Templates Proofs PROOF TEMPLATES Direct Contrapositive If and only if Cases Contradiction

Exercise

If a, b are irrational numbers, then is it ever possible for ab to berational?

Surprisingly, the answer is YES! Try to prove the statement“There exist irrational numbers a and b such that ab is rational.”

Hint: consider c = d =√

2 and start a “proof-by-cases” based onwhether cd is rational or not.