Lecture 4: disjunction; Fermat’s little theorem [01B2]
- September 25, 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 disjunction [01B3]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Disjunctive statements are of the form “P or Q”, which is written symbolically as P\lor Q.
Note: When a mathematician says “P or Q” they do not mean to rule out the possibility that both P and Q hold.
How to use a disjunctive assumption [01B7]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
To use a disjunctive assumption P_1\lor P_2 to establish a goal Q, you consider two cases in turn:
- You assume P_1 and then try to establish Q.
- You assume P_2 and then try to establish Q.
The idea of the above is that you are showing that Q holds if either P_1 holds or P_2 holds. You have to check both cases.
Using disjunctive assumptions in written proofs [01B8]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
In order to prove Q from some assumptions amonst which there is P_1\lor P_2, you should write something like the following:
We consider the following two cases licensed by our assumption P_1\lor P_2.
- Suppose on the one hand that P_1 holds. Then to prove Q we [blah blah blah]...
- Suppose on the other hand that P_2 holds. Then to prove Q we [blah blah blah]...
Lemma [01B9]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
For all positive integers p and natural numbers m, if m = 0 or m=p then {p \choose m} = 1.
Please attempt this yourself first, and once you’ve done that you may click here to reveal a possible proof.
Proof.
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Fix a positive integer p and natural number m such that either m=0 or m=p. We will establish {p\choose m} = 1 by cases on our assumption.
- Suppose first that m=0. Then {p\choose m}={p\choose 0}=1 because there is exactly one way to choose zero elements from a set. It follows, immediately, that {p\choose m}\equiv 1\mod p.
- Suppose on the other hand that m=p. Then {p\choose m} = {p\choose p} = 1 because there is exactly one way to choose p elements from a set with p elements.
How to prove a disjunction [01B4]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
The primary proof strategy for disjunction [01BC]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
To prove goal of the form P\lor Q, you have two choices:
- You try to prove P, and if you succeed, you are done.
- You try to prove Q, and if you succeed, you are done.
In the above, you have to make a choice. Sometimes you do not yet have enough assumptions to know whether you should attempt to prove P or attempt to prove Q! This is similar to our experience with existentials: before making an irrevocable choice, you may want to see if you can use any of your assumptions to get more information that would inform your choice.
Proposition [01BA]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
The square of any integer is congruent to either 0 or 1 modulo 4.
Interpretation.
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Scratch work.
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Given an integer n, we might try to prove the goal (n^2\equiv 0\mod 4) \lor (n^2\equiv 1\mod 4) right away. Unfortunately, we just don’t have enough information to proceed! Indeed, if we try to open “door #1” and prove n^2\equiv 0\mod 4, we are definitely going to go wrong because it’s not the case that 1^2 \equiv 0\mod 4. On the other hand, if we try to open “door #2” and prove n^2\equiv 1\mod 4, we are going to go wrong because it is not the case that 0^2 \equiv 1\mod 4.
So we need some additional information before we can make our choice. In the examples we considered, we note that 0 is even and 1 is odd. Could it be that we need to branch on whether n is even or odd?
We know, indeed, that every integer is either even or odd; so we may assume \mathsf {isEven}(n)\lor \mathsf {isOdd}(n) and then we may use this assumption and proceed by cases on whether n is even or odd: then, perhaps, when n is even we should try to show its square is congruent to 0, and when n is odd we should try to show that its square is congruent to 1. Before we try and write out the whole proof, let’s just try these cases and see if they work out.
Lemma [01B5]
- September 25, 2026
- Jon Sterling
The square of any even integer is congruent to 0 modulo 4.
Proof.
- September 25, 2026
- Jon Sterling
Let n be even so that we have some integer k with n=2k. We want to see that n^2\equiv 0\mod 4, which is to say that 4\mid n^2. We compute:
n^2 = (2k)^2 = 4k^2Evidently 4\mid 4k^2, so we are done.
Lemma [01B6]
- September 25, 2026
- Jon Sterling
The square of any odd integer is congruent to 1 modulo 4.
Proof.
- September 25, 2026
- Jon Sterling
Let n be odd so that we have some integer k with n=2k+1. We want to see that n^2 \equiv 1 \mod 4, which is to say that 4\mid n^2-1. We compute:
\begin {aligned} n^2-1 &= (2k+1)^2 - 1 \\ &= 4k^2 + 4k + 1 - 1 \\ &= 4k^2 + 4k \\ &= 4(k^2 + k) \end {aligned}4(k^2+k) is evidently divisible by 4, so we are done.
Since that worked, we can now proceed to write out a proper proof of the whole proposition.
Proof.
- September 25, 2026
- Marcelo Fiore, Jon Sterling
The “classical” proof strategy for disjunction [01BB]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
The primary proof strategy for disjunction requires us to choose between P and Q to prove P\lor Q. We have seen in Proposition [01BA] that sometimes we do not yet have enough information to make that choice, and we must split our proof on some assumptions before we know what to do. In classical logic, there is a general version of that strategy which relies on the fact that we always know that either P holds or its negation \lnot P holds. We haven’t studied negation formally yet, but we will work intuitively with it for now.
The classical strategy to prove a disjunction P\lor Q is to simply assume that P is false and then prove Q; or, equivalently, to assume that Q is false and then prove P. First we justify the strategy:
Justification.
- September 25, 2026
- Marcelo Fiore, Jon Sterling
We want to prove P\lor Q. We know that P\lor \lnot P, so we proceed by cases on this assumption. In the first case, we deduce P\lor Q trivially from an assumption P. The remaining case is to prove P\lor Q by assuming \lnot P.
Although the classical strategy can be very convenient, proofs that don’t use it end to be more elegant that proofs that do. Often times you reach for it prematurely and give a far more complicated proof than necessary. So we advise that you only use this strategy if nothing else works.
More arithmetic; towards Fermat’s little theorem [01BD]
- September 25, 2026
- Marcelo Fiore, Jon Sterling
Proposition [01BF]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all integers p and m, if p is prime and 0<m<p then {p \choose m} \equiv 0 \mod p.
Proof sketch.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We don‘t actually have the tools yet needed to complete the proof, but we can make some headway.
Let m and p be integers with p prime. Using the formula for binomial coefficients, we compute {p \choose m} below so as to factor out p:
{p \choose m} = \frac {p!}{ m!(p-m)! } = p\left ( \frac {(p-1)!}{m!(p-m)!} \right )Any multiple of p by a natural number is congruent to zero modulo p, so it suffices to argue that \frac {(p-1)!}{m!(p-m)!} is natural. You are going to have to take this on faith for now, but it will ultimately follow from p being prime and m being a positive integer strictly less than p. We will see how to deduce this in a later lecture once we have learned a bit more.
Proposition [01BE]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all prime numbers p and integers 0\leq m \leq p, either {p \choose m} \equiv 0 \mod p or {p \choose m}\equiv 1 \mod p.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We fix a prime p and a natural number m\leq p. We must show \left ({p \choose m}\equiv 0\mod p\right )\lor \left ({p \choose m}\equiv 1\mod p\right )\text {.} Before choosing which path to go down, we note that the following disjunction holds:
(m=0) \lor (m=p) \lor (0<m<p)We consider each of the three cases above:
We state but do not yet prove the binomial theorem below. To prove it, we would need induction (which we will learn in a later lecture), as well as a few additional insights.
Theorem The Binomial Theorem [01BG]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let x,y be elements of a commutative semiring {\mathopen {}\left (A,+,0,\cdot ,1\right )\mathclose {}}. For all n\in \mathbb {N}, we have {\mathopen {}\left (x+y\right )\mathclose {}}^n = \sum _{k=0}^n \binom {n}{k}\cdot x^{n-k}\cdot y^k \text {.}
Corollary The Freshman’s Dream [01BH]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers m,n and primes p we have (m+n)^p \equiv m^p + n^p \mod p \text {.}
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let m,n be natural numbers and let p be a prime. It suffices to show that the difference (m+n)^p - (m^p+n^p) is congruent to zero modulo p. First we calculate (m+n)^p using the Binomial theorem and extracting the first and last summands:
\begin {aligned} (m+n)^p &= \sum _{k=0}^p {p \choose k} m^{p-k} n^k \\ &= {p\choose 0}m^p + {p\choose p}n^p + \sum _{k=1}^{p-1} {p\choose k}m^{p-k} n^k \\ &= m^p + n^p + \sum _{k=1}^{p-1} {p\choose k}m^{p-k} n^k \end {aligned}Therefore we have:
(m+n)^p - (m^p +n^p) = \sum _{k=1}^{p-1} {p\choose k}m^{p-k} n^kBy Proposition [01BF], we know that {p\choose k} \equiv 0 \mod p when 0<k<p, so the sum above is itself congruent to 0 modulo p. (For this, we are using the fact that sums and products and powers preserve congruence, which we have technically not proved.)
Corollary The Dropout Lemma [01BI]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers m and primes p, we have (m+1)^p \equiv m^p + 1\mod p\text {.}
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let m be a natural number and p a prime. By the freshman’s dream, we have (m+1)^p \equiv m^p + 1^p \equiv m^p+1\mod p\text {.}
Proposition The Many Dropout Lemma [01BJ]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers m and i and primes p, we have (m+i)^p \equiv m^p+i\mod p\text {.}
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
We note that any natural number i may be rewritten as a sum of ones:
i = \sum _{k=1}^i 1Therefore by i-many applications of the dropout lemma, we have (m+i)^p \equiv m^p + \sum _{k=1}^i1 \equiv m^p + i \mod p\text {.}
(You might be a little skeptical about the part where we said ”i-many applications” in the proof of the many dropout lemma. We will return to that in the future with a more rigorous proof using mathematical induction!)
We now come to Fermat’s Little Theorem, the first part of which is the many dropout lemma. We do not actualy yet have the tools to deduce the second part from the first, but we will do that later.
Theorem Fermat’s Little Theorem [01BK]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
For all natural numbers i and primes p, we have the following:
- i^p \equiv i \mod p
- i^{p-1}\equiv 1 \mod p unless i is a multiple of p
Corollary Existence of reciprocals [01BM]
- September 29, 2026
- Marcelo Fiore, Jon Sterling
Let p be prime. Then every natural number i which is not a multiple of p has a reciprocal modulo p, i.e. some natural number \bar \imath _p such that i\cdot \bar \imath _p \equiv 1 \mod p.
Proof.
- September 29, 2026
- Marcelo Fiore, Jon Sterling
By Fermat’s Little Theorem, we know that i^{p-1}\equiv 1\mod p. Choosing \bar \imath _p \coloneqq i^{i-2}, we have i \cdot \bar \imath _p = i \cdot i^{p-2} = i^{p-1} \equiv 1 \mod p\text {.}