Transcript
Page 1: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Discrete Mathematics & Mathematical ReasoningPredicates, Quantifiers and Proof Techniques

Colin Stirling

Informatics

Some slides based on ones by Myrto Arapinis

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 1 / 25

Page 2: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Recall propositional logic from last year (in Inf1CL)

Propositions can be constructed from other propositions using logicalconnectives

Negation: ¬Conjunction: ∧Disjunction: ∨Implication: →Biconditional: ↔

The truth of a proposition is defined by the truth values of itselementary propositions and the meaning of connectives

The meaning of logical connectives can be defined using truth tables

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 2 / 25

Page 3: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Recall propositional logic from last year (in Inf1CL)

Propositions can be constructed from other propositions using logicalconnectives

Negation: ¬Conjunction: ∧Disjunction: ∨Implication: →Biconditional: ↔

The truth of a proposition is defined by the truth values of itselementary propositions and the meaning of connectives

The meaning of logical connectives can be defined using truth tables

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 2 / 25

Page 4: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Recall propositional logic from last year (in Inf1CL)

Propositions can be constructed from other propositions using logicalconnectives

Negation: ¬Conjunction: ∧Disjunction: ∨Implication: →Biconditional: ↔

The truth of a proposition is defined by the truth values of itselementary propositions and the meaning of connectives

The meaning of logical connectives can be defined using truth tables

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 2 / 25

Page 5: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Recall propositional logic from last year (in Inf1CL)

Propositions can be constructed from other propositions using logicalconnectives

Negation: ¬Conjunction: ∧Disjunction: ∨Implication: →Biconditional: ↔

The truth of a proposition is defined by the truth values of itselementary propositions and the meaning of connectives

The meaning of logical connectives can be defined using truth tables

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 2 / 25

Page 6: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Propositional logic is not enough

In propositional logic, from

All men are mortalSocrates is a man

we cannot derive

Socrates is mortal

We need a language to talk about objects, their properties and theirrelations

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 3 / 25

Page 7: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Propositional logic is not enough

In propositional logic, from

All men are mortalSocrates is a man

we cannot derive

Socrates is mortal

We need a language to talk about objects, their properties and theirrelations

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 3 / 25

Page 8: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Propositional logic is not enough

In propositional logic, from

All men are mortalSocrates is a man

we cannot derive

Socrates is mortal

We need a language to talk about objects, their properties and theirrelations

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 3 / 25

Page 9: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Predicate logic

Extends propositional logic by the new featuresVariables: x , y ,z, . . .Predicates: P(x), Q(x), R(x , y), M(x , y , z), . . .Quantifiers: ∀, ∃

Predicates are a generalisation of propositionsCan contain variables M(x , y , z)

Variables stand for (and can be replaced by) elements from theirdomainThe truth value of a predicate depends on the values of itsvariables

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 4 / 25

Page 10: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Predicate logic

Extends propositional logic by the new featuresVariables: x , y ,z, . . .Predicates: P(x), Q(x), R(x , y), M(x , y , z), . . .Quantifiers: ∀, ∃

Predicates are a generalisation of propositionsCan contain variables M(x , y , z)

Variables stand for (and can be replaced by) elements from theirdomainThe truth value of a predicate depends on the values of itsvariables

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 4 / 25

Page 11: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Examples

P(x) is “x > 5” and x ranges over Z (integers)P(8) is trueP(5) is false

Q(x) is “x is irrational” and x ranges over R (real numbers)Q(√

2) is trueQ(√

4) is false

R(x , y) is “x divides y” and x , y range over Z+ (positive integers)R(3, 9) is trueR(2, 9) is false

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 5 / 25

Page 12: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Examples

P(x) is “x > 5” and x ranges over Z (integers)P(8) is trueP(5) is false

Q(x) is “x is irrational” and x ranges over R (real numbers)Q(√

2) is trueQ(√

4) is false

R(x , y) is “x divides y” and x , y range over Z+ (positive integers)R(3, 9) is trueR(2, 9) is false

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 5 / 25

Page 13: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Examples

P(x) is “x > 5” and x ranges over Z (integers)P(8) is trueP(5) is false

Q(x) is “x is irrational” and x ranges over R (real numbers)Q(√

2) is trueQ(√

4) is false

R(x , y) is “x divides y” and x , y range over Z+ (positive integers)R(3, 9) is trueR(2, 9) is false

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 5 / 25

Page 14: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Quantifiers

Universal quantifier, “For all”: ∀∀x P(x) asserts that P(x) is true for every x in the assumeddomain

Existential quantifier, “There exists”: ∃∃x P(x) asserts that P(x) is true for some x in the assumeddomain

The quantifiers are said to bind the variable x in theseexpressions. Variables in the scope of some quantifier are calledbound variables. All other variables in the expression are calledfree variables

A formula that does not contain any free variables is a propositionand has a truth value

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 6 / 25

Page 15: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Quantifiers

Universal quantifier, “For all”: ∀∀x P(x) asserts that P(x) is true for every x in the assumeddomain

Existential quantifier, “There exists”: ∃∃x P(x) asserts that P(x) is true for some x in the assumeddomain

The quantifiers are said to bind the variable x in theseexpressions. Variables in the scope of some quantifier are calledbound variables. All other variables in the expression are calledfree variables

A formula that does not contain any free variables is a propositionand has a truth value

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 6 / 25

Page 16: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Quantifiers

Universal quantifier, “For all”: ∀∀x P(x) asserts that P(x) is true for every x in the assumeddomain

Existential quantifier, “There exists”: ∃∃x P(x) asserts that P(x) is true for some x in the assumeddomain

The quantifiers are said to bind the variable x in theseexpressions. Variables in the scope of some quantifier are calledbound variables. All other variables in the expression are calledfree variables

A formula that does not contain any free variables is a propositionand has a truth value

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 6 / 25

Page 17: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Quantifiers

Universal quantifier, “For all”: ∀∀x P(x) asserts that P(x) is true for every x in the assumeddomain

Existential quantifier, “There exists”: ∃∃x P(x) asserts that P(x) is true for some x in the assumeddomain

The quantifiers are said to bind the variable x in theseexpressions. Variables in the scope of some quantifier are calledbound variables. All other variables in the expression are calledfree variables

A formula that does not contain any free variables is a propositionand has a truth value

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 6 / 25

Page 18: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

First, notice the quantifier is implicit

Let P(n) mean n is odd where n is an integer (in Z)

So is: ∀x (if P(x) then P(x2))

∀x(P(x)→ P(x2))

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 7 / 25

Page 19: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

First, notice the quantifier is implicit

Let P(n) mean n is odd where n is an integer (in Z)

So is: ∀x (if P(x) then P(x2))

∀x(P(x)→ P(x2))

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 7 / 25

Page 20: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

First, notice the quantifier is implicit

Let P(n) mean n is odd where n is an integer (in Z)

So is: ∀x (if P(x) then P(x2))

∀x(P(x)→ P(x2))

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 7 / 25

Page 21: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

First, notice the quantifier is implicit

Let P(n) mean n is odd where n is an integer (in Z)

So is: ∀x (if P(x) then P(x2))

∀x(P(x)→ P(x2))

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 7 / 25

Page 22: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Direct proof of ∀x (P(x)→ Q(x))

Assume c is an arbitrary element of the domain

Prove that P(c)→ Q(c)

That is, assume P(c) then show Q(c)

Use the definition/properties of P(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 8 / 25

Page 23: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Direct proof of ∀x (P(x)→ Q(x))

Assume c is an arbitrary element of the domain

Prove that P(c)→ Q(c)

That is, assume P(c) then show Q(c)

Use the definition/properties of P(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 8 / 25

Page 24: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Direct proof of ∀x (P(x)→ Q(x))

Assume c is an arbitrary element of the domain

Prove that P(c)→ Q(c)

That is, assume P(c) then show Q(c)

Use the definition/properties of P(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 8 / 25

Page 25: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Direct proof of ∀x (P(x)→ Q(x))

Assume c is an arbitrary element of the domain

Prove that P(c)→ Q(c)

That is, assume P(c) then show Q(c)

Use the definition/properties of P(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 8 / 25

Page 26: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

∀x (P(x)→ P(x2)) where P(n) is n is odd

Assume n is arbitrary odd integer; what does that mean?

that for some k , n = 2k + 1

Show n2 is odd

n2 = (2k + 1)2

So, n2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

n2 has the form for some m, n2 = 2m + 1; so n2 is odd

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 9 / 25

Page 27: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

∀x (P(x)→ P(x2)) where P(n) is n is odd

Assume n is arbitrary odd integer; what does that mean?

that for some k , n = 2k + 1

Show n2 is odd

n2 = (2k + 1)2

So, n2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

n2 has the form for some m, n2 = 2m + 1; so n2 is odd

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 9 / 25

Page 28: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

∀x (P(x)→ P(x2)) where P(n) is n is odd

Assume n is arbitrary odd integer; what does that mean?

that for some k , n = 2k + 1

Show n2 is odd

n2 = (2k + 1)2

So, n2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

n2 has the form for some m, n2 = 2m + 1; so n2 is odd

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 9 / 25

Page 29: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

∀x (P(x)→ P(x2)) where P(n) is n is odd

Assume n is arbitrary odd integer; what does that mean?

that for some k , n = 2k + 1

Show n2 is odd

n2 = (2k + 1)2

So, n2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

n2 has the form for some m, n2 = 2m + 1; so n2 is odd

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 9 / 25

Page 30: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

∀x (P(x)→ P(x2)) where P(n) is n is odd

Assume n is arbitrary odd integer; what does that mean?

that for some k , n = 2k + 1

Show n2 is odd

n2 = (2k + 1)2

So, n2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

n2 has the form for some m, n2 = 2m + 1; so n2 is odd

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 9 / 25

Page 31: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

∀x (P(x)→ P(x2)) where P(n) is n is odd

Assume n is arbitrary odd integer; what does that mean?

that for some k , n = 2k + 1

Show n2 is odd

n2 = (2k + 1)2

So, n2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

n2 has the form for some m, n2 = 2m + 1; so n2 is odd

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 9 / 25

Page 32: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Example: If n is an odd integer then n2 is odd

∀x (P(x)→ P(x2)) where P(n) is n is odd

Assume n is arbitrary odd integer; what does that mean?

that for some k , n = 2k + 1

Show n2 is odd

n2 = (2k + 1)2

So, n2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

n2 has the form for some m, n2 = 2m + 1; so n2 is odd

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 9 / 25

Page 33: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Any odd integer is the difference of two squares

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 10 / 25

Page 34: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Nested quantifiers

Every real number has an inverse w.r.t additionThe domain is R

∀x ∃y (x + y = 0)

Every real number except zero has an inverse w.r.t multiplicationThe domain is R

∀x (x 6= 0 → ∃y (x × y = 1)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 11 / 25

Page 35: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proving ∀x (P(x)→ Q(x)) by contraposition

Uses equivalence of (p → q) and (¬q → ¬p)

Assume c is an arbitrary element of the domain

Prove that ¬Q(c)→ ¬P(c)

That is, assume ¬Q(c) then show ¬P(c)

Use the definition/properties of ¬Q(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 12 / 25

Page 36: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proving ∀x (P(x)→ Q(x)) by contraposition

Uses equivalence of (p → q) and (¬q → ¬p)

Assume c is an arbitrary element of the domain

Prove that ¬Q(c)→ ¬P(c)

That is, assume ¬Q(c) then show ¬P(c)

Use the definition/properties of ¬Q(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 12 / 25

Page 37: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proving ∀x (P(x)→ Q(x)) by contraposition

Uses equivalence of (p → q) and (¬q → ¬p)

Assume c is an arbitrary element of the domain

Prove that ¬Q(c)→ ¬P(c)

That is, assume ¬Q(c) then show ¬P(c)

Use the definition/properties of ¬Q(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 12 / 25

Page 38: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proving ∀x (P(x)→ Q(x)) by contraposition

Uses equivalence of (p → q) and (¬q → ¬p)

Assume c is an arbitrary element of the domain

Prove that ¬Q(c)→ ¬P(c)

That is, assume ¬Q(c) then show ¬P(c)

Use the definition/properties of ¬Q(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 12 / 25

Page 39: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proving ∀x (P(x)→ Q(x)) by contraposition

Uses equivalence of (p → q) and (¬q → ¬p)

Assume c is an arbitrary element of the domain

Prove that ¬Q(c)→ ¬P(c)

That is, assume ¬Q(c) then show ¬P(c)

Use the definition/properties of ¬Q(c)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 12 / 25

Page 40: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

if x + y is even, then x and y have the same parity

Proof Let n, m ∈ Z be arbitrary. We will prove that if n and m do nothave the same parity then n + m is odd. Without loss of generality weassume that n is odd and m is even, that is n = 2k + 1 for some k ∈ Z,and m = 2` for some ` ∈ Z. But thenn + m = 2k + 1 + 2` = 2(k + `) + 1. And thus n + m is odd. Now byequivalence of a statement with it contrapositive derive that if n + m iseven, then n and m have the same parity.

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 13 / 25

Page 41: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

if x + y is even, then x and y have the same parity

Proof Let n, m ∈ Z be arbitrary. We will prove that if n and m do nothave the same parity then n + m is odd. Without loss of generality weassume that n is odd and m is even, that is n = 2k + 1 for some k ∈ Z,and m = 2` for some ` ∈ Z. But thenn + m = 2k + 1 + 2` = 2(k + `) + 1. And thus n + m is odd. Now byequivalence of a statement with it contrapositive derive that if n + m iseven, then n and m have the same parity.

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 13 / 25

Page 42: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

If n = ab where a, b are positive integers, then a ≤√

nor b ≤

√n

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 14 / 25

Page 43: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proof by contradiction

Want to prove that P is true

Assume ¬P

Derive both R and ¬R (a contradiction equivalent to False)

Therefore, ¬¬P which is equivalent to P

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 15 / 25

Page 44: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proof by contradiction

Want to prove that P is true

Assume ¬P

Derive both R and ¬R (a contradiction equivalent to False)

Therefore, ¬¬P which is equivalent to P

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 15 / 25

Page 45: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proof by contradiction

Want to prove that P is true

Assume ¬P

Derive both R and ¬R (a contradiction equivalent to False)

Therefore, ¬¬P which is equivalent to P

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 15 / 25

Page 46: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proof by contradiction

Want to prove that P is true

Assume ¬P

Derive both R and ¬R (a contradiction equivalent to False)

Therefore, ¬¬P which is equivalent to P

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 15 / 25

Page 47: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

√2 is irrational

Proof Assume towards a contradiction that√

2 is rational, that is thereare integers a and b with no common factor other than 1, such that√

2 = a/b. In that case 2 = a2/b2. Multiplying both sides by b2, wehave a2 = 2b2. Since b is an integer, so is b2, and thus a2 is even. Aswe saw previously this implies that a is even, that is there is an integerc such that a = 2c. Hence 2b2 = 4c2, hence b2 = 2c2. Now, since c isan integer, so is c2, and thus b2 is even. Again, we can conclude that bis even. Thus a and b have a common factor 2, contradicting theassertion that a and b have no common factor other than 1. Thisshows that the original assumption that

√2 is rational is false, and that√

2 must be irrational.

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 16 / 25

Page 48: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

√2 is irrational

Proof Assume towards a contradiction that√

2 is rational, that is thereare integers a and b with no common factor other than 1, such that√

2 = a/b. In that case 2 = a2/b2. Multiplying both sides by b2, wehave a2 = 2b2. Since b is an integer, so is b2, and thus a2 is even. Aswe saw previously this implies that a is even, that is there is an integerc such that a = 2c. Hence 2b2 = 4c2, hence b2 = 2c2. Now, since c isan integer, so is c2, and thus b2 is even. Again, we can conclude that bis even. Thus a and b have a common factor 2, contradicting theassertion that a and b have no common factor other than 1. Thisshows that the original assumption that

√2 is rational is false, and that√

2 must be irrational.

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 16 / 25

Page 49: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There are infinitely many primes

Lemma Every natural number greater than one is either prime or it hasa prime divisor

Proof Suppose towards a contradiction that there are only finitely manyprimes p1, p2, p3, . . . , pk . Consider the number q = p1p2p3 . . . pk + 1,the product of all the primes plus one. By hypothesis q cannot beprime because it is strictly larger than all the primes. Thus, by thelemma, it has a prime divisor, p. Because p1, p2, p3, . . . , pk are all theprimes, p must be equal to one of them, so p is a divisor of theirproduct. So we have that p divides p1p2p3 . . . pk , and p divides q, butthat means p divides their difference, which is 1. Therefore p ≤ 1.Contradiction. Therefore there are infinitely many primes.

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 17 / 25

Page 50: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There are infinitely many primes

Lemma Every natural number greater than one is either prime or it hasa prime divisor

Proof Suppose towards a contradiction that there are only finitely manyprimes p1, p2, p3, . . . , pk . Consider the number q = p1p2p3 . . . pk + 1,the product of all the primes plus one. By hypothesis q cannot beprime because it is strictly larger than all the primes. Thus, by thelemma, it has a prime divisor, p. Because p1, p2, p3, . . . , pk are all theprimes, p must be equal to one of them, so p is a divisor of theirproduct. So we have that p divides p1p2p3 . . . pk , and p divides q, butthat means p divides their difference, which is 1. Therefore p ≤ 1.Contradiction. Therefore there are infinitely many primes.

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 17 / 25

Page 51: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There are infinitely many primes

Lemma Every natural number greater than one is either prime or it hasa prime divisor

Proof Suppose towards a contradiction that there are only finitely manyprimes p1, p2, p3, . . . , pk . Consider the number q = p1p2p3 . . . pk + 1,the product of all the primes plus one. By hypothesis q cannot beprime because it is strictly larger than all the primes. Thus, by thelemma, it has a prime divisor, p. Because p1, p2, p3, . . . , pk are all theprimes, p must be equal to one of them, so p is a divisor of theirproduct. So we have that p divides p1p2p3 . . . pk , and p divides q, butthat means p divides their difference, which is 1. Therefore p ≤ 1.Contradiction. Therefore there are infinitely many primes.

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 17 / 25

Page 52: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Proof by cases

To prove a conditional statement of the form

(p1 ∨ · · · ∨ pk )→ q

Use the tautology

((p1 ∨ · · · ∨ pk )→ q)↔ ((p1 → q) ∧ · · · ∧ (pk → q))

Each of the implications pi → q is a case

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 18 / 25

Page 53: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

If n is an integer then n2 ≥ n

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 19 / 25

Page 54: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Constructive proof of ∃x P(x)

Exhibit an actual witness w from the domain such that P(w) istrue

Therefore, ∃x P(x)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 20 / 25

Page 55: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Constructive proof of ∃x P(x)

Exhibit an actual witness w from the domain such that P(w) istrue

Therefore, ∃x P(x)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 20 / 25

Page 56: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Constructive proof of ∃x P(x)

Exhibit an actual witness w from the domain such that P(w) istrue

Therefore, ∃x P(x)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 20 / 25

Page 57: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There exists a positive integer that can be written asthe sum of cubes of positive integers in two differentways

1729 is such a number because

103 + 93 = 1729 = 123 + 13

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 21 / 25

Page 58: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There exists a positive integer that can be written asthe sum of cubes of positive integers in two differentways

1729 is such a number because

103 + 93 = 1729 = 123 + 13

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 21 / 25

Page 59: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There exists a positive integer that can be written asthe sum of cubes of positive integers in two differentways

1729 is such a number because

103 + 93 = 1729 = 123 + 13

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 21 / 25

Page 60: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Nonconstructive proof of ∃x P(x)

Show that there must be a value v such that P(v) is true

but we don’t know what this value v is

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 22 / 25

Page 61: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Nonconstructive proof of ∃x P(x)

Show that there must be a value v such that P(v) is true

but we don’t know what this value v is

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 22 / 25

Page 62: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Nonconstructive proof of ∃x P(x)

Show that there must be a value v such that P(v) is true

but we don’t know what this value v is

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 22 / 25

Page 63: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There exist irrational numbers x and y such that xy isrational

Proof We need only prove the existence of at least one example.Consider the case x =

√2 and y =

√2. We distinguish two cases:

Case√

2√

2is rational. In that case we have shown that for the

irrational numbers x = y =√

2, we have that xy is rational

Case√

2√

2is irrational. In that case consider x =

√2√

2and y =

√2.

We then have that

xy = (√

2√

2)√

2 =√

2√

2√

2=√

22

= 2

But since 2 is rational, we have shown that for x =√

2√

2and y =

√2,

we have that xy is rationalWe have thus shown that in any case there exist some irrationalnumbers x and y such that xy is rational

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 23 / 25

Page 64: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

There exist irrational numbers x and y such that xy isrational

Proof We need only prove the existence of at least one example.Consider the case x =

√2 and y =

√2. We distinguish two cases:

Case√

2√

2is rational. In that case we have shown that for the

irrational numbers x = y =√

2, we have that xy is rational

Case√

2√

2is irrational. In that case consider x =

√2√

2and y =

√2.

We then have that

xy = (√

2√

2)√

2 =√

2√

2√

2=√

22

= 2

But since 2 is rational, we have shown that for x =√

2√

2and y =

√2,

we have that xy is rationalWe have thus shown that in any case there exist some irrationalnumbers x and y such that xy is rational

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 23 / 25

Page 65: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Disproving ∀x P(x) with a counter-example

¬∀x P(x) is equivalent to ∃x ¬P(x)

To establish that ¬∀x P(x) is true find a w such that P(w) is false

So, w is a counterexample to the assertion ∀x P(x)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 24 / 25

Page 66: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Disproving ∀x P(x) with a counter-example

¬∀x P(x) is equivalent to ∃x ¬P(x)

To establish that ¬∀x P(x) is true find a w such that P(w) is false

So, w is a counterexample to the assertion ∀x P(x)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 24 / 25

Page 67: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Disproving ∀x P(x) with a counter-example

¬∀x P(x) is equivalent to ∃x ¬P(x)

To establish that ¬∀x P(x) is true find a w such that P(w) is false

So, w is a counterexample to the assertion ∀x P(x)

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 24 / 25

Page 68: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Every positive integer is the sum of the squares of 3integers

The integer 7 is a counterexample. So the claim is false

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 25 / 25

Page 69: Discrete Mathematics & Mathematical Reasoning Predicates ... · Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques Colin Stirling Informatics

Every positive integer is the sum of the squares of 3integers

The integer 7 is a counterexample. So the claim is false

Colin Stirling (Informatics) Discrete Mathematics (Chap 1) Today 25 / 25


Top Related