Lecture 5: negation, contradiction, natural numbers, monoids [01BL]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
These lecture notes were prepared by Jon Sterling using Marcelo Fiore’s lectures as source material. Any mistakes were introduced by Jon Sterling. Generative AI was not used to write these lecture notes.
Understanding falsehood [01BO]
- September 29, 2026
- Jon Sterling
One of the simplest statements is the falsum, which may be written \mathbf {false} or \bot . There is no way to prove \bot except by using an assumption.
If you have assumed \bot , you may use it to deduce anything you want, including other false statements. This is called the principle of explosion.
It is unusual to use falsehood directly, but it will come up organically as part of the definition of negation.
Understanding negation [01BN]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Negations are statements of the form “not P”. You will see many ways of phrasing negative statements:
- “P is false”
- “P is not the case”
- “It is not the case that P holds”
- “P is absurd”
- “P leads to absurdity”
- “P leads to contradiction”
- “P is contradictory”
- \lnot P
The meaning of \lnot P is simply that P implies falsehood.
Observation [01BP]
- September 29, 2026
- Jon Sterling
For any statement P, we have \lnot P if and only if P\Longleftrightarrow \bot .
Proof.
- September 29, 2026
- Jon Sterling
Because \lnot P is defined to be P\implies \bot , we may clearly deduce \lnot P from the bi-implication P\Longleftrightarrow \bot . Conversely, assume \lnot P; to prove P\Longleftrightarrow \bot it suffices to prove \bot \implies P, which is the principle of explosion: from \bot anything follows.
Derived rules proving and using for negations [01BQ]
- September 29, 2026
- Jon Sterling
From Observation [01BP] we obtain basic rules for proving negations and for using assumptions of negation as a special case of the rules for proving and using implications and falsehood.
- To prove a negation \lnot P, assume P and prove \bot .
- To use an assumption \lnot P to prove Q, simply prove P.
The derived rules for proving negations and using negated assumptions are fundamental, but we can establish some very convenient identities (bi-implications) that will make negation easier to use in practice.
Identities involving negation; the law of the excluded middle [01BR]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We have the following bi-implications for statements involving negation; you may use these to simplify your goals or your assumptions at will.
The following are the constructive laws of negation:
\begin {aligned} \lnot (\exists x:\tau \mathpunct {.} P(x)) &\Longleftrightarrow \forall x:\tau \mathpunct {.} P(x) \\ \lnot (P\lor Q) &\Longleftrightarrow \lnot P\land \lnot Q \\ \lnot (P\Longleftrightarrow Q) &\Longleftrightarrow (P \Longleftrightarrow \lnot Q) \end {aligned}The first two above are called De Morgan laws. You can prove these identities (and you should!) using nothing more than the basic laws of existential quantification, universal quantification, disjunction, biimplication, and negation.
Classical logic supports the following additional laws, which can be proved if you additionally assume the law of the excluded middle, i.e. P\lor \lnot P:
\begin {aligned} \lnot \forall x:\tau \mathpunct {.} P(x) &\Longleftrightarrow \exists x:\tau \mathpunct {.} \lnot P(x) \\ \lnot (P\land Q) &\Longleftrightarrow \lnot P \lor \lnot Q \\ \lnot \lnot P &\Longleftrightarrow P \end {aligned}The first two identities above are also called De Morgan laws. The third identity is called double negation elimination.
In this course, we do freely use the law of the excluded middle, but students tend to overuse it; if you find yourself using it, you should pause and take note. Often there is a simpler and more elegant constructive proof of a statement that avoids P\lor \lnot P.
Theorem Contrapositive of implication [01BS]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all statements P and Q, we have (P\implies Q) \implies (\lnot Q \implies \lnot P)\text {.}
Try this one yourself first before clicking here to reveal a proof.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Assume P\implies Q and \lnot Q; to prove \lnot P, we assume P and need to prove \bot . Using our negated assumption \lnot Q it suffices to prove Q. To that end we use our assumption P\implies Q with our other assumption P.
The contrapositive identity [01BU]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all statements P and Q we have (P \implies Q) \Longleftrightarrow (\lnot Q \implies \lnot P)\text {.}
Try this one yourself before clicking here to reveal a proof.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
One direction is already proved in Theorem [01BS]. It remains to show that \lnot Q \implies \lnot P implies P\implies Q.
We assume \lnot Q\implies \lnot P and P, and our goal is to prove Q. By double negation elimination it suffices to prove \lnot \lnot Q. We assume \lnot Q, and our goal is to prove \bot ; then we use our assumption \lnot Q\implies \lnot P to deduce \lnot P, which we use with our assumption P to reach a contradiction.
We are almost in a position that we can prove the irrationality of \sqrt 2. We will need a lemma first.
Lemma Rationals in terms of proper fractions [01BV]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
A positive real number x is rational if and only if there exist positive integers m,n such that x=m/n and there exists no prime p dividing both m and n.
Interpretation.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
The statement is rendered symbolically as follows:
If we knew how to compute greatest common divisors, we could give a very direct and constructive proof. For the sake of the game, however, we will give a proof by contradiction.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We fix a positive real number x. The backward direction holds trivially, so we only need to prove the forwards direction.
To that end, we assume that x is rational, i.e. that there are some integers a_0,b_0 such that x=a_0/b_0; because x is positive, we may assume without generality that a_0,b_0 are both positive.
We wish to prove \exists m,n:\mathbb {Z}^+\mathpunct {.} x=m/n \land \lnot \exists p:\mathbb {Z}\mathpunct {.} \mathsf {isPrime}(p)\land p \mid m \land p \mid n\text {,} and by double negation elimination it suffices to prove \lnot \lnot \exists m,n:\mathbb {Z}^+\mathpunct {.} x=m/n \land \lnot \exists p:\mathbb {Z}\mathpunct {.} \mathsf {isPrime}(p)\land p \mid m \land p \mid n\text {,} which we may calculate using the classical negation identities in the following way:
\begin {aligned} & \lnot \lnot \exists m,n:\mathbb {Z}^+\mathpunct {.} x=m/n \land \lnot \exists p:\mathbb {Z}\mathpunct {.} \mathsf {isPrime}(p)\land p \mid m \land p \mid n \\ &\Longleftrightarrow \lnot \forall m,n:\mathbb {Z}^+\mathpunct {.} x\not = m/n \lor \exists p:\mathbb {Z}\mathpunct {.} \mathsf {isPrime}(p)\land p \mid m \land p \mid n \\ &\Longleftrightarrow \lnot \forall m,n:\mathbb {Z}^+\mathpunct {.} x= m/n \implies \exists p:\mathbb {Z}\mathpunct {.} \mathsf {isPrime}(p)\land p \mid m \land p \mid n \end {aligned}To prove this negation, we therefore assume that for any representation of x by a positive fraction m/n there exists a prime dividing both m and n, and we must now prove \bot .
We consider in particular the fractional representation x=a_0/b_0 that we started with; from this we may assume some prime p_0 such that both p_0\mid a_0 and p_0\mid b_0. Hence we may assume integers a_1, b_1 such that a_0 = p_0 a_1 and b_0 = p_0 b_1.
x = \frac {a_0}{b_0} = \frac {p_0a_1}{p_0b_1} = \frac {a_1}{b_1}Iterating this process any number of times, say l, we have a = p_0 \ldots p_l a_{l+1} and b = p_0\cdots p_lb_{l+1}. If we choose l \coloneqq \lfloor \log _2 a_0\rfloor we would have a_0 = p_0\cdots p_1 a_{l+1} \geq 2^{l+1} > a_0 because all the primes p_i are at least 2 by definition. Of course, a_0>a_0 is contradictory so we are done.
Remark. But which fraction? [01EA]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
The proof we have given above is extremely classical. First of all, we admittedly used the classical negation identities. Mathematicians are not afraid of using these axioms, but it is worth considering whether a simpler and more concrete proof is available. The proof that we have given above contains no hint whatsoever of the specific representation x=m/n that we should obtain for a rational number x; later on, we will learn how to use Euclid’s algorithm to give a direct and constructive argument that explicitly finds co-prime m,n such that x=m/n.
Lemma Squaring preserves and reflects evenness [01BW]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
An integer is even if and only if its square is even.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
In the forward direction, to show \mathsf {isEven}(n)\implies \mathsf {isEven}(n^2) we use the fact that even numbers are closed under multiplication (which you may check for yourself as an exercise.)
In the backward direction, suppose that n^2 is even. To show that n is even is equivalent to showing that n is not odd. Therefore, we assume that n is odd and attempt to derive a contradiction. It would be enough to show that n^2 is odd.
To that end, since we assumed n is odd, we may find some integer k with n = 2k+1. Now we calculate the square:
n^2 = (2k+1)^2 = 4k^2 + 4k +1 = 2(2k^2 + 2k) + 1Hence n^2 is odd, and we are done.
Theorem Irrationality of \sqrt 2 [01BT]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
The real number \sqrt 2 is irrational.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We are asked to show \lnot (\mathsf {isRational}(\sqrt 2)). To that end, we assume that \sqrt 2 is rational, and we must prove \bot .
By Lemma [01BV], we may assume a fractional representation \sqrt 2 = m/n for some positive m,n with no prime factors in common. To get a contradiction, we are going to show that under the assumptions m and n are actually both even and therefore both divisible by 2, a prime. First we calculate:
\begin {aligned} \sqrt 2 &= \frac {m}{n} \\ 2 &= \frac {m^2}{n^2} \\ 2n^2 &= m^2 \end {aligned}It follows that m^2 is even; because squaring reflects evenness, m is even.
Because 2n^2 = m^2 and m^2 is even, we have some integer l with m = 2l. Therefore:
2n^2 = m^2 = (2l)^2 = 4l^2Hence we have n^2 = 2l^2, so n^2 is even and by another application of the lemma we conclude that n is even too.
Therefore, m and n are both divisible by the prime 2, which contradicts our assumption that m and n share no prime factors in common.
Proof by contradiction, proof by contrapositive [01BX]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
From double negation elimination to proof by contradiction [01BZ]
- September 30, 2026
- Jon Sterling
We have used the law of double negation elimination P \Leftrightarrow \lnot \lnot P several times in proofs with the following structure:
We want to prove P. By double negation elimination it suffices to prove \lnot \lnot P, i.e. \lnot P \implies \bot . To that end, we assume \lnot P and try to prove \bot . [blah blah blah]
This style of argument is called proof by contradiction, and it is not usually as belaboured as the above. A mathematician would simply write something like the following:
We want to prove P. Assume for the sake of contradiction that P is false. [blah blah blah].
Once we have reached a contradiction, we will make it clear to the reader that why we are done:
…This is a contradiction, so we are finished.
Revisiting the converse of the contrapositive [01BY]
- September 30, 2026
- Jon Sterling
We might rewrite our explicit proof of the converse of the contrapositive (\lnot Q\implies \lnot P)\implies (P\implies Q) to use proof by contradiction in the following way:
Proof.
- September 30, 2026
- Jon Sterling
Assume \lnot Q\implies \lnot P and P. To prove Q, we assume for the sake of contradiction that Q is false. Using our first assumption \lnot Q\implies \lnot P, we obtain \lnot P which contradicts our second assumption P.
Proof by contrapositive [01C0]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
The contrapositive identity (\lnot Q \implies \lnot P)\Longleftrightarrow (P \implies Q) is particularly useful: if you are trying to prove an implication P \implies Q, it suffices to prove its contrapositive \lnot Q \implies \lnot P. As a proof technique, this is called proof by contrapositive.
Natural numbers and monoids [01C1]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
Objectives [01C2]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
In this course, we are studying numbers with the following goals in mind:
- To get an appreciation for the abstract notion of number system, considering four examples: natural numbers, integers, rationals, and modular integers.
- To prove the correctness of three basic algorithms in the theory of numbers: the division algorithm, Euclid’s algorithm, and the Extended Euclid’s algorithm.
- To exemplify the use of the mathematical theory surrounding Euclid’s algorithm and Fermat’s Little Theorem in the context of public-key cryptography.
- To understand and be able to proficiently use the Principle of Mathematical Induction in its various forms.
Natural numbers [01C3]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
In the beginning there were the natural numbers 0, 1, 2, 3, \ldots \text {.}
We write \mathbb {N} for the set of all natural numbers. In school math, you probably learned that the natural numbers are a certain subset of the integers, or a certain subset of the reals. Indeed, we have ourselves already promoted this viewpoint in an earlier lecture. But at times, we may wish to understand the naturals without reference to any other number system on their own terms. From this more abstract point of view, what matters about the naturals is not the specific way of embedding them into the reals, but rather the way that they are generated.
In particular, the natural numbers are generated by starting from a lowest natural number (conventionally called zero), and repeatedly applying a successor operation. In IA Foundations of Mathematics you may have already seen how such definitions are given in functional programming languages like OCaml:
type nat = zero | succ of nat
We will consider this viewpoint much more deeply later in the course.
As a mere matter of notation, we write the lowest natural number as 0 and the successors as 1,2,3,\ldots and so on, but it is really important to understand that this notation is independent of any particular embedding into the integers or the reals. The reason for privileging the standard embeddings of the naturals into the integers and the reals is that these embeddings are special in the sense that they preserve the additive and multiplicative structure of the naturals, meaning (for example) that i(m+n) = i(m)+i(n) where i\colon \mathbb {N}\hookrightarrow \mathbb {R} is the standard embedding.
Basic structure of the natural number system [01C5]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
The basic operations of the natural number system are divided into additive and multiplicative structure.
Additive structure of the naturals [01C4]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
The additive structure (\mathbb {N},+,0) of the natural numbers with zero and addition satisfies the following laws:
-
The monoid laws:
- The neutral element laws: 0+n=n=n+0
- The associativity law: (l+m)+n = l+(m+n)
- The commutativity law: m+n = n+m
In the mathematical jargon, the laws of addition together make (\mathbb {N},+,0) what is called a commutative monoid, an abstraction that we will define momentarily. 0 is called the neutral element or unit of the monoid; sometimes the neutral element laws are referred to as unit laws.
Multiplicative structure of the naturals [01C6]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
The multiplicative structure (\mathbb {N},\cdot ,1) of the natural numbers with one and multiplication satisfies the following laws:
-
The monoid laws:
- The neutral element laws: 1\cdot n=n=n\cdot 1
- The associativity law: (l\cdot m)\cdot n = l\cdot (m\cdot n)
- The commutativity law: m\cdot n = n\cdot m
So, by the same token as the additive structure, the natural numbers under multiplication form a commutative monoid with neutral element 1\in \mathbb {N}.
Definition Monoid [01C7]
- September 30, 2026
- Marcelo Fiore, Jon Sterling
A monoid is a set M together with
- a binary operation, say \bullet \colon M\times M\to M,
- a neutral element, say e: M,
- the neutral element laws: e\bullet x = x = x \bullet e, and
- the associativity law: (x\bullet y)\bullet z = x \bullet (y\bullet z).
A monoid (M,\bullet ,e) is called commutative when the commutativity law x\bullet y = y \bullet x is satisfied.