BACK Mascot image.
← MA0 1 · Introduction to University Mathematics (Proofs)

Lesson 6

Relations and Order

Taught

Relations and Order

People classify: we decide which things belong together, and mathematics does this on every page. This chapter covers relations in general, then the two most important kinds, orders and equivalences, and finally the way an equivalence cuts a set into pieces.

Relations

A relation records, for each pair of elements, whether the two stand in a given relationship. Since a pair with an order to it is an ordered pair, and the set of all of them is a Cartesian product, no new definitions are needed.

Definition 6.1 (Binary relation).

A relation RR on a set SS is a set of ordered pairs of elements of SS, that is, a subset R⊂S×SR \subset S \times S. We abbreviate (x,y)∈R(x, y) \in R to xRyx \mathbin{R} y, and say xx is related to yy by RR; if (x,y)∉R(x, y) \notin R we write xR̸yx \not\mathbin{R} y.

Putting the symbol between the two elements is infix notation; writing R(x,y)R(x, y) instead is prefix notation. For equivalence relations we usually take a symbol such as ≡\equiv or ∼\sim, and for strict orders the symbol <<.

Two relations are distinguished exactly by the pairs belonging to one and not the other, since a relation is its set of pairs. At the two extremes, S×SS \times S is the universal relation on SS and ∅\emptyset is the empty relation. Neither is of much interest: if everything is related to everything then being related is no mark of distinction, and if nothing is related to anything there is nothing to say.

Definition 6.2 (Reflexive, symmetric, transitive).

Let RR be a relation on a set SS. Then RR is

  1. reflexive if xRxx \mathbin{R} x for every x∈Sx \in S;
  2. symmetric if xRy  ⟹  yRxx \mathbin{R} y \implies y \mathbin{R} x for all x,y∈Sx, y \in S;
  3. transitive if (xRy∧yRz)  ⟹  xRz(x \mathbin{R} y \land y \mathbin{R} z) \implies x \mathbin{R} z for all x,y,z∈Sx, y, z \in S.

Example 6.3.

From a familiar children’s game, let S={rock,scissors,paper}S = \{\text{rock}, \text{scissors}, \text{paper}\} and let BB, read “beats”, be

B={(rock,scissors),(scissors,paper),(paper,rock)}.B = \bigl\{(\text{rock}, \text{scissors}), (\text{scissors}, \text{paper}), (\text{paper}, \text{rock})\bigr\}.

This BB is none of the three: rock does not beat itself, rock beats scissors while scissors does not beat rock, and rock beats scissors and scissors beats paper while rock does not beat paper.

Definition 6.4 (Equivalence relation).

A relation is an equivalence relation if it is reflexive, symmetric and transitive. When ∼\sim is an equivalence relation and x∼yx \sim y, we say xx and yy are equivalent with respect to ∼\sim.

Example 6.5.

On S={1,2,3,4}S = \{1, 2, 3, 4\} the relation R={(1,2),(2,1),(1,1),(2,2)}R = \{(1,2), (2,1), (1,1), (2,2)\} is symmetric and transitive but not reflexive, since 3R̸33 \not\mathbin{R} 3. Adjoining exactly what is missing gives R1=defR∪{(3,3),(4,4)}R_1 \defeq R \cup \{(3,3), (4,4)\}, which is reflexive, inherits symmetry and transitivity, and is therefore an equivalence relation. We call R1R_1 the reflexive closure of RR: it adds to RR only the pairs that reflexivity requires.

Example 6.6.

Transitivity is the condition that most often fails. Let SS be the partially exposed stones in a stream you wish to cross, and for x,y∈Sx, y \in S let x∼yx \sim y mean that you can step directly from xx to yy without getting wet. This is reflexive, since once on a stone you can hop on the spot, and symmetric, since a step you can take one way you can take back. It is not generally transitive: that you can reach yy from xx and zz from yy says nothing about reaching zz from xx in one step.

Problem 6.1.

Check that the relation R={(1,2),(2,1),(1,1),(2,2)}R = \{(1,2), (2,1), (1,1), (2,2)\} above is symmetric and transitive, working from the definitions rather than from the picture.

Problem 6.2.

Let AA and BB be sets. Many texts call a subset R⊂A×BR \subset A \times B a relation from AA to BB. Show that every such RR is a relation on A∪BA \cup B in the sense of Definition 6.1 .

Problem 6.3.

Let RR be a symmetric and transitive relation on a set SS, and put T=def{x∈S∣xRx}T \defeq \{x \in S \mid x \mathbin{R} x\}. Show that xRyx \mathbin{R} y implies x,y∈Tx, y \in T, and that RR is an equivalence relation on TT.

Order Relations

Orders are the second of the two kinds of relation we shall need. We isolate the properties an order has, so that when we later build one on the natural numbers out of addition alone we know exactly what has to be checked.

Definition 6.7 (Strict linear order).

A strict linear order on a set SS is a relation, commonly written <<, satisfying

  1. the transitivity law: for all x,y,z∈Sx, y, z \in S, if x<yx < y and y<zy < z then x<zx < z;
  2. the trichotomy law: for all x,y∈Sx, y \in S, exactly one of x<yx < y, x=yx = y, y<xy < x holds.

When x<yx < y holds we say xx is strictly less than yy. Strict linear orders are also called strict total orders, in contrast with the partial orders of the next section. The word exactly in the trichotomy law says two things: any two elements can be compared, and no two of the alternatives hold at once. Proofs use the second far more often than the first, so we isolate it.

Proposition 6.8 (Anti-reflexivity).

Let << be a strict linear order on a set SS. Then ¬(x<x)\neg(x < x) for every x∈Sx \in S.

Discussion.

The statement is a universally quantified negation, so we fix an arbitrary xx and rule out x<xx < x. Only the trichotomy law says anything about a single pair, so we apply it to the pair xx and xx. It offers three alternatives, x<xx < x, x=xx = x and x<xx < x, and exactly one of them holds. The middle one holds, since equality is reflexive, which rules out the other two; and each of those is the statement we wish to deny.

Proof.

Let x∈Sx \in S. Trichotomy applied to xx and xx says that exactly one of x<xx < x, x=xx = x, x<xx < x holds. Since x=xx = x holds, neither occurrence of x<xx < x can, so ¬(x<x)\neg(x < x).

Trichotomy can be traded for the weaker demand that at least one alternative hold, provided we also assume anti-reflexivity.

Proposition 6.9 (Characterising strict linear orders).

Let << be a relation on a set SS such that

  1. for all x,y,z∈Sx, y, z \in S, if x<yx < y and y<zy < z then x<zx < z;
  2. for all x,y∈Sx, y \in S, (x<y)∨(x=y)∨(y<x)(x < y) \lor (x = y) \lor (y < x);
  3. for all x∈Sx \in S, ¬(x<x)\neg(x < x).

Then << is a strict linear order on SS.

Discussion.

The definition asks for two laws, and the first is the first hypothesis verbatim, so only trichotomy needs proof. It splits in two: that at least one alternative holds is the second hypothesis, again verbatim, and it remains to show that no two hold together. There are three possible pairs, the two strict comparisons together or either strict comparison alongside x=yx = y, and we take them in turn. Two opposite strict comparisons feed into transitivity and produce x<xx < x; a strict comparison alongside an equality lets us substitute one letter for the other and produce x<xx < x again. Each case gives x<xx < x, which the third hypothesis forbids.

Proof.

The first hypothesis is the transitivity law. For trichotomy, let x,y∈Sx, y \in S. The second hypothesis gives at least one of x<yx < y, x=yx = y, y<xy < x.

If both x<yx < y and y<xy < x held, transitivity would give x<xx < x, against the third hypothesis. If x<yx < y and x=yx = y held, substitution gives x<xx < x; and y<xy < x with x=yx = y gives x<xx < x likewise. So no two of the alternatives hold together, exactly one holds, and that is the trichotomy law.

A strict order says which of two elements comes first. For bounds, minima and induction it is more convenient to use the relation that also allows equality.

Definition 6.10 (Associated non-strict order).

Let << be a strict linear order on a set SS. The associated non-strict order ⩽\leqslant is defined by: x⩽yx \leqslant y holds if and only if (x<y)∨(x=y)(x < y) \lor (x = y) holds. When x⩽yx \leqslant y we say xx is less than or equal to yy.

Proposition 6.11 (Laws of the associated order).

Let << be a strict linear order on SS with associated ⩽\leqslant. For all x,y∈Sx, y \in S:

  1. (x⩽y)∨(y⩽x)(x \leqslant y) \lor (y \leqslant x);
  2. if x⩽yx \leqslant y and y⩽xy \leqslant x then x=yx = y;
  3. ¬(x⩽y)\neg(x \leqslant y) if and only if y<xy < x;
  4. ¬(x<y)\neg(x < y) if and only if y⩽xy \leqslant x.

Discussion.

All four come from the list of three alternatives in trichotomy, so in each we go through the list and see which entries remain. The first is a disjunction and every entry produces one of its halves: x<yx < y gives x⩽yx \leqslant y, y<xy < x gives y⩽xy \leqslant x, and x=yx = y gives both. The second is a conditional whose conclusion is an equality, so we suppose x≠yx \neq y and derive a contradiction: the definition turns both hypotheses into strict comparisons, transitivity gives x<xx < x, and anti-reflexivity forbids it. The last two are biconditionals, proved by crossing entries off the list. Denying x⩽yx \leqslant y deletes the first two entries and leaves y<xy < x; conversely y<xy < x deletes those same two, since trichotomy allows only one. Denying x<yx < y deletes just the first entry, leaving x=yx = y or y<xy < x, and that pair is what y⩽xy \leqslant x abbreviates.

Proof.

For the first, trichotomy gives x<yx < y, x=yx = y or y<xy < x, and in each case the definition gives x⩽yx \leqslant y or y⩽xy \leqslant x.

For the second, suppose x⩽yx \leqslant y and y⩽xy \leqslant x, and suppose x≠yx \neq y. Then the definition gives x<yx < y and y<xy < x, so transitivity gives x<xx < x, contradicting anti-reflexivity. Hence x=yx = y.

For the third, if ¬(x⩽y)\neg(x \leqslant y) then neither x<yx < y nor x=yx = y holds, so trichotomy leaves y<xy < x. Conversely y<xy < x excludes both x<yx < y and x=yx = y, so ¬(x⩽y)\neg(x \leqslant y).

For the fourth, trichotomy says ¬(x<y)\neg(x < y) holds precisely when x=yx = y or y<xy < x, which by the definition is precisely y⩽xy \leqslant x.

From transitivity of << we get two further transitivity laws, one for each way of mixing the two relations.

Proposition 6.12 (Mixed transitivity).

Let << be a strict linear order on SS with associated ⩽\leqslant, and let x,y,z∈Sx, y, z \in S. Then

  1. if x<yx < y and y⩽zy \leqslant z then x<zx < z;
  2. if x⩽yx \leqslant y and y<zy < z then x<zx < z.

Discussion.

Each part has one strict hypothesis and one non-strict one, and the definition of ⩽\leqslant splits the non-strict hypothesis into two cases, so each part has two cases. In the equality case no order reasoning is needed at all: the conclusion is the strict hypothesis with one letter renamed. In the strict case both hypotheses are strict, so the transitivity law applies.

Proof.

For the first, if y=zy = z then x<zx < z is the hypothesis x<yx < y with zz written for yy; and if y<zy < z then transitivity gives x<zx < z.

For the second, if x=yx = y then x<zx < z is the hypothesis y<zy < z with xx written for yy; and if x<yx < y then transitivity again gives x<zx < z.

Corollary 6.13 (Transitivity of the non-strict order).

Let << be a strict linear order on SS with associated ⩽\leqslant. If x⩽yx \leqslant y and y⩽zy \leqslant z then x⩽zx \leqslant z.

Proof.

If x=yx = y and y=zy = z then x=zx = z. If x=yx = y and y<zy < z then x<zx < z; if x<yx < y and y=zy = z then x<zx < z; and if x<yx < y and y<zy < z then mixed transitivity gives x<zx < z. In every case the definition of ⩽\leqslant gives x⩽zx \leqslant z.

Definition 6.14 (Reverse orders).

Let << be a strict linear order on SS. We write x>yx > y to mean y<xy < x, and say xx is strictly greater than yy; and x⩾yx \geqslant y to mean (x>y)∨(x=y)(x > y) \lor (x = y), and say xx is greater than or equal to yy.

Since << and ⩽\leqslant are transitive, so are >> and ⩾\geqslant.

Definition 6.15 (Chains).

The notation a<b<ca < b < c abbreviates (a<b)∧(b<c)(a < b) \land (b < c), and similarly for >>, ⩽\leqslant and ⩾\geqslant, for more than three terms, and for mixtures: a⩽b<c<da \leqslant b < c < d abbreviates (a⩽b)∧(b<c)∧(c<d)(a \leqslant b) \land (b < c) \land (c < d).

By transitivity, a<b<ca < b < c gives a<ca < c.

Problem 6.4.

What is the difference between the trichotomy law and the weak trichotomy law? Which of the two implies the other?

Problem 6.5.

Show that a strict linear order is not symmetric on any set with at least two elements, and decide whether the associated ⩽\leqslant can ever be symmetric.

Partial Orders and Extrema

The order relations of the previous section were strict and linear: transitive and trichotomous, with the non-strict ⩽\leqslant built afterwards. There is a second tradition, equally common, which takes the non-strict relation as primitive and weakens trichotomy so that incomparable pairs are allowed. That is the language of partial orders, and it is what one wants for inclusion of sets.

Definition 6.16 (Partial order).

A relation RR on a set MM is a partial order, and MM is then ordered by RR, if RR is

  1. reflexive: aRaa \mathbin{R} a for every a∈Ma \in M;
  2. antisymmetric: aRba \mathbin{R} b and bRab \mathbin{R} a imply a=ba = b;
  3. transitive: aRba \mathbin{R} b and bRcb \mathbin{R} c imply aRca \mathbin{R} c.

We usually write a⩽ba \leqslant b for aRba \mathbin{R} b, and then a<ba < b for (a⩽b)∧(a≠b)(a \leqslant b) \land (a \neq b), with b⩾ab \geqslant a and b>ab > a as before.

Definition 6.17 (Comparable elements and total orders).

Let MM be partially ordered. Elements a,b∈Ma, b \in M are comparable if a⩽ba \leqslant b or b⩽ab \leqslant a. The order is a total order, or linear order, if every two elements are comparable.

Example 6.18.

The power set P(M)\mathcal{P}(M) is partially ordered by ⊂\subset, and also by the reverse inclusion. It is not totally ordered as soon as MM has two elements aa and bb, since {a}\{a\} and {b}\{b\} are incomparable: neither contains the other. The natural numbers will turn out to be totally ordered, once we put an order on them below.

Remark (Partial versus strict).

The two languages agree on total orders. If << is a strict linear order and ⩽\leqslant is the associated relation, then ⩽\leqslant is a total order in the present sense: reflexivity is immediate, antisymmetry is one of the laws proved above, and transitivity is its corollary. Conversely, from a total order ⩽\leqslant the relation a<b  ⟺  (a⩽b)∧(a≠b)a < b \iff (a \leqslant b) \land (a \neq b) is a strict linear order. What partial orders add is the possibility that some pairs are incomparable.

Definition 6.19 (Minimal and maximal elements).

Let MM be partially ordered and A⊂MA \subset M non-empty. An element a0∈Aa_0 \in A is minimal in AA if no element of AA is strictly smaller, that is, {a∈A∣a<a0}=∅\{a \in A \mid a < a_0\} = \emptyset; and a1∈Aa_1 \in A is maximal in AA if no element of AA is strictly larger.

A bound of a set need not lie in the set; a minimum or maximum must.

Definition 6.20 (Bounds, minima, maxima).

Let SS be a subset of a partially ordered set UU.

  1. An element b∈Ub \in U is a lower bound of SS if b⩽xb \leqslant x for every x∈Sx \in S, and B∈UB \in U is an upper bound if x⩽Bx \leqslant B for every x∈Sx \in S.
  2. An element m∈Sm \in S is a minimum, or least element, of SS if m⩽xm \leqslant x for every x∈Sx \in S; and M∈SM \in S is a maximum, or greatest element, if x⩽Mx \leqslant M for every x∈Sx \in S.

The difference is membership: a minimum is a lower bound that happens to lie in SS. Not every subset has either, as the natural numbers will shortly illustrate: they have a least element and no greatest one.

Proposition 6.21 (A bound inside the set is an extremum).

Let SS be a subset of a partially ordered set. If bb is a lower bound of SS and b∈Sb \in S, then bb is a minimum of SS; and if BB is an upper bound of SS with B∈SB \in S, then BB is a maximum.

Discussion.

The two halves are dual, so it is enough to plan the first and reverse the inequalities for the second. What we are given is a lower bound of SS that also lies in SS. The bound hypothesis is b⩽xb \leqslant x for every x∈Sx \in S, which is the inequality a minimum must satisfy, and the membership is precisely the extra clause the definition of a minimum asks for. Together these are the claim; the two definitions differ only by that clause.

Proof.

If bb is a lower bound of SS then b⩽xb \leqslant x for every x∈Sx \in S, and b∈Sb \in S by hypothesis; those two together are the definition of a minimum. The argument for maxima is the same with the inequalities reversed.

Existence may fail, but uniqueness does not.

Proposition 6.22 (Uniqueness of extrema).

Let SS be a subset of a partially ordered set. The minimum of SS, if it exists, is unique, and likewise the maximum.

Discussion.

Suppose two elements are both minima. Each, being a minimum, is below every element of SS, and each, being a minimum, lies in SS; so applying the defining property of the first to the second and of the second to the first gives the two inequalities antisymmetry needs. The argument for maxima is identical with the inequalities reversed. The proposition does not say that a minimum exists, only that there cannot be two. Bounds outside SS are under no such restriction, since a set may have many lower bounds.

Proof.

Let m1m_1 and m2m_2 both be minima of SS. Then m1⩽m2m_1 \leqslant m_2, since m1m_1 is a minimum and m2∈Sm_2 \in S; and m2⩽m1m_2 \leqslant m_1 for the same reason with the roles exchanged. Antisymmetry gives m1=m2m_1 = m_2. The argument for maxima is identical.

Problem 6.6.

For P(M)\mathcal{P}(M) ordered by inclusion, identify the minimum and the maximum. In P(M)∖{∅}\mathcal{P}(M) \setminus \{\emptyset\}, show that every singleton is minimal, and decide whether there is a minimum.

Problem 6.7.

Let AA and BB be totally ordered sets and let f:A→Bf : A \to B be a bijection with f(a)<f(b)f(a) < f(b) whenever a<ba < b. Show that a<ba < b whenever f(a)<f(b)f(a) < f(b), and deduce that f−1f^{-1} has the same property.

Partitions

Consider a three-piece jigsaw. How many states of assembly are there, counting two states as different when one has two pieces interlocked that the other does not? The answer is five. Representing each cluster of interlocked pieces by the set of its numbers, each state becomes a family of such sets:

ΠA={{1,2,3}},ΠB={{1,2},{3}},ΠC={{2,3},{1}},ΠD={{1,3},{2}},ΠE={{1},{2},{3}}.\begin{aligned} \Pi_A &= \bigl\{\{1,2,3\}\bigr\}, & \Pi_B &= \bigl\{\{1,2\}, \{3\}\bigr\}, & \Pi_C &= \bigl\{\{2,3\}, \{1\}\bigr\}, \\ \Pi_D &= \bigl\{\{1,3\}, \{2\}\bigr\}, & \Pi_E &= \bigl\{\{1\}, \{2\}, \{3\}\bigr\}. \end{aligned}

Each is a family of non-empty sets whose union is {1,2,3}\{1,2,3\}, no two of which share an element.

Definition 6.23 (Partition).

Let SS be a non-empty set. A partition Π\Pi of SS is an indexed family Π=def{Ai}i∈I\Pi \defeq \{A_i\}_{i \in I} of non-empty subsets of SS with

⋃i∈IAi=S,Ai∩Aj=∅  whenever i≠j.\bigcup_{i \in I} A_i = S, \qquad A_i \cap A_j = \emptyset \ \text{ whenever } i \neq j.

The AiA_i are the blocks of the partition.

Example 6.24.

The set S={1,2,3,4}S = \{1,2,3,4\} has {{1,2,3,4}}\bigl\{\{1,2,3,4\}\bigr\} as its only one-block partition, and seven with two blocks:

{{1},{2,3,4}},{{2},{1,3,4}},{{3},{1,2,4}},{{4},{1,2,3}},{{1,2},{3,4}},{{1,3},{2,4}},{{1,4},{2,3}}.\begin{aligned} &\bigl\{\{1\}, \{2,3,4\}\bigr\}, \quad \bigl\{\{2\}, \{1,3,4\}\bigr\}, \quad \bigl\{\{3\}, \{1,2,4\}\bigr\}, \quad \bigl\{\{4\}, \{1,2,3\}\bigr\}, \\ &\bigl\{\{1,2\}, \{3,4\}\bigr\}, \quad \bigl\{\{1,3\}, \{2,4\}\bigr\}, \quad \bigl\{\{1,4\}, \{2,3\}\bigr\}. \end{aligned}

It has six with three blocks, and its only four-block partition is {{1},{2},{3},{4}}\bigl\{\{1\},\{2\},\{3\},\{4\}\bigr\}.

A partition is how we get a handle on a large set: cut it into blocks, deal with the blocks one at a time, and put the pieces back together. The blocks are usually chosen by a shared feature.

Example 6.25 (Informal).

Assuming you know the real numbers, let SS be a set of them and suppose a calculation requires that we treat numbers differently according to sign. Take the three blocks

A1=def{x∈S∣x>0},A2=def{x∈S∣x<0},A3=def{0}.A_1 \defeq \{x \in S \mid x > 0\}, \qquad A_2 \defeq \{x \in S \mid x < 0\}, \qquad A_3 \defeq \{0\}.

This is a partition only if SS holds a positive number, a negative number and zero, since blocks are required to be non-empty. Without that requirement every family of conditions would partition every set.

Problem 6.8.

List the six three-block partitions of {1,2,3,4}\{1,2,3,4\}.

Equivalence Classes

Fix an equivalence relation ∼\sim on a set SS. We cut SS into pieces by grouping together everything related to a given element.

Definition 6.26 (Equivalence class).

Let ∼\sim be an equivalence relation on a set SS and let x∈Sx \in S. The equivalence class of xx is

[x]=def{s∈S∣s∼x},[x] \defeq \{s \in S \mid s \sim x\},

and the set of all equivalence classes is

S/∼=def{[x]∣x∈S}⊂P(S),S/{\sim} \defeq \bigl\{[x] \mid x \in S\bigr\} \subset \mathcal{P}(S),

called SS modulo ∼\sim, or the quotient of SS by ∼\sim.

Example 6.27.

On S={1,2,3,4}S = \{1,2,3,4\} with the equivalence relation R1R_1 above, [1]=[2]={1,2}[1] = [2] = \{1,2\}, [3]={3}[3] = \{3\} and [4]={4}[4] = \{4\}. Distinct classes here do not meet, and the next proposition shows this always happens.

Proposition 6.28 (Characterising equivalence classes).

Let ∼\sim be an equivalence relation on a set SS and let a,b∈Sa, b \in S. The following are equivalent.

  1. a∼ba \sim b;
  2. [a]∩[b]≠∅[a] \cap [b] \neq \emptyset;
  3. [a]=[b][a] = [b].

Discussion.

Three statements would ordinarily need six implications, but a cycle is enough: we prove 1  ⟹  3  ⟹  2  ⟹  11 \implies 3 \implies 2 \implies 1 and let each statement reach every other by going round. For 1  ⟹  31 \implies 3 we assume a∼ba \sim b and aim at an equality of sets, so we chase an element: c∈[a]c \in [a] means c∼ac \sim a, and the chain c∼a∼bc \sim a \sim b closes by transitivity, with symmetry supplying whichever direction the chain needs; the reverse inclusion is the same argument with aa and bb exchanged. For 3  ⟹  23 \implies 2 reflexivity puts aa in [a][a], so if the classes agree then aa itself witnesses that they meet. For 2  ⟹  12 \implies 1 a shared element cc gives c∼ac \sim a and c∼bc \sim b, and symmetry with transitivity gives a∼ba \sim b. Only the three defining properties are used.

Proof.

1  ⟹  31 \implies 3. Suppose a∼ba \sim b and let c∈[a]c \in [a], so c∼ac \sim a. With a∼ba \sim b transitivity gives c∼bc \sim b, that is c∈[b]c \in [b]; hence [a]⊂[b][a] \subset [b]. Symmetry gives b∼ab \sim a, and the same argument with aa and bb exchanged gives [b]⊂[a][b] \subset [a]. So [a]=[b][a] = [b].

3  ⟹  23 \implies 2. Reflexivity gives a∼aa \sim a, so a∈[a]a \in [a]. If [a]=[b][a] = [b] then a∈[a]∩[b]a \in [a] \cap [b], which is therefore non-empty.

2  ⟹  12 \implies 1. Let c∈[a]∩[b]c \in [a] \cap [b]. Then c∼ac \sim a and c∼bc \sim b. Symmetry gives a∼ca \sim c, and transitivity with c∼bc \sim b gives a∼ba \sim b.

Remark (Disjoint decomposition).

It follows that SS is the union of the classes and that distinct classes are disjoint:

S=⋃A∈S/∼A,A1∩A2=∅  whenever A1≠A2 in S/∼.S = \bigcup_{A \in S/\sim} A, \qquad A_1 \cap A_2 = \emptyset \ \text{ whenever } A_1 \neq A_2 \text{ in } S/{\sim}.

An equivalence relation therefore breaks SS into pairwise disjoint non-empty pieces. Some authors write S=⨆A∈S/∼AS = \bigsqcup_{A \in S/\sim} A for a union whose parts are known to be disjoint.

Problem 6.9.

Let ∼\sim be an equivalence relation on SS. Show that x∈[x]x \in [x] for every x∈Sx \in S, and that if y∈[x]y \in [x] then [y]=[x][y] = [x].

Problem 6.10 (Informal).

Assuming you know the real numbers and the whole numbers, let x∼yx \sim y mean that x−yx - y is a whole number. Check that ∼\sim is an equivalence relation on the real numbers, and describe [0][0] and [12]\bigl[\tfrac{1}{2}\bigr].

Problem 6.11.

Let f:S→Tf : S \to T be a map and declare x∼yx \sim y on SS when f(x)=f(y)f(x) = f(y). Show that ∼\sim is an equivalence relation, and that S/∼S/{\sim} is in bijection with the image f(S)f(S).

From Equivalence Relations to Partitions

An equivalence relation gives a partition, and a partition gives an equivalence relation. We prove each direction in turn.

Theorem 6.29 (Equivalence relations induce partitions).

Let ∼\sim be an equivalence relation on a non-empty set SS. Then the family of its equivalence classes is a partition of SS, called the partition induced by ∼\sim.

Discussion.

We check the three conditions in the definition of a partition: blocks non-empty, blocks pairwise disjoint, blocks covering SS. Non-emptiness is immediate, since reflexivity puts xx in [x][x]. Disjointness is the previous proposition read contrapositively: if two classes meet they are equal, so distinct classes cannot meet. For the cover, the same reflexivity observation puts every ss in the block [s][s], while the reverse inclusion is automatic because every class is a subset of SS. One class may have many labels, since [x]=[y][x] = [y] whenever x∼yx \sim y, so we index the family by the distinct classes and do not count one block twice.

Proof.

Write the distinct classes as an indexed family {Ci}i∈I\{C_i\}_{i \in I}.

Each CiC_i is non-empty: if Ci=[x]C_i = [x] then x∈[x]x \in [x] by reflexivity. If i≠ji \neq j then Ci≠CjC_i \neq C_j, so Ci∩Cj=∅C_i \cap C_j = \emptyset by the previous proposition. Every CiC_i is a subset of SS, so the union of the CiC_i is contained in SS; and if s∈Ss \in S then s∈[s]s \in [s] by reflexivity, and [s][s] is one of the CiC_i, so ss lies in the union. Hence the union is SS, and the family is a partition.

Example 6.30.

The relation R1R_1 on {1,2,3,4}\{1,2,3,4\} induces the partition {{1,2},{3},{4}}\bigl\{\{1,2\}, \{3\}, \{4\}\bigr\}, which is the list of classes computed above.

Theorem 6.31 (Partitions induce equivalence relations).

Let Π\Pi be a partition of a set SS, and for x,y∈Sx, y \in S declare x∼yx \sim y to mean that xx and yy lie in the same block of Π\Pi. Then ∼\sim is an equivalence relation on SS, and the partition it induces is Π\Pi itself.

Discussion.

There are two claims. For the first, the three properties come from the three conditions on a partition. Reflexivity uses the cover, since every xx lies in some block. Symmetry is immediate, since “same block” does not depend on which element is named first. Transitivity uses disjointness: if xx and yy share a block and yy and zz share a block, then yy lies in both, so the two blocks meet and are therefore the same block, which then holds xx and zz. For the second claim, fix xx and let AA be the block holding it. Then y∈[x]y \in [x] exactly when yy shares a block with xx, which is exactly when y∈Ay \in A; so the class [x][x] is the block AA, and the family of classes is Π\Pi.

Proof.

Write Π={Ai}i∈I\Pi = \{A_i\}_{i \in I}, so the AiA_i are non-empty, pairwise disjoint, and their union is SS.

For reflexivity, an x∈Sx \in S lies in some AiA_i by the cover, so x∼xx \sim x. For symmetry, if x∼yx \sim y then both lie in some AiA_i, so both lie in it in the other order and y∼xy \sim x. For transitivity, if x∼yx \sim y and y∼zy \sim z then x,y∈Aix, y \in A_i and y,z∈Ajy, z \in A_j for some i,ji, j; then y∈Ai∩Ajy \in A_i \cap A_j, so i=ji = j since distinct blocks are disjoint, and x,z∈Aix, z \in A_i gives x∼zx \sim z. So ∼\sim is an equivalence relation.

For the second claim, let x∈Sx \in S and let AA be the block holding xx, unique because distinct blocks are disjoint. Then y∈[x]y \in [x] if and only if y∼xy \sim x, which holds if and only if y∈Ay \in A. So [x]=A[x] = A, and the family of classes is exactly Π\Pi.

Problem 6.12.

Take the partition {{1,2},{3},{4}}\bigl\{\{1,2\}, \{3\}, \{4\}\bigr\} of {1,2,3,4}\{1,2,3,4\} and write down every pair in the equivalence relation it induces. Check that you recover R1R_1.

Problem 6.13.

How many equivalence relations are there on a set with three elements? Count the partitions, then appeal to the two theorems.

The Order on the Natural Numbers

We now define the order on the natural numbers from addition. Throughout this section we work in N0\mathbb{N}_0, which is a Peano system under ss, so all five conditions and the recursion theorem apply. Addition already suggests the order: nn lies beyond mm when it is reached from mm by adding something positive.

Definition 6.32 (Order on the natural numbers).

For m,n∈N0m, n \in \mathbb{N}_0 we define m<nm < n to hold if and only if there is a b∈Nb \in \mathbb{N} with n=m+bn = m + b; in symbols,

m<n  ⟺  ∃b∈N (n=m+b).m < n \iff \exists b \in \mathbb{N}\,(n = m + b).

Since 0∉N0 \notin \mathbb{N}, the difference bb is required to be positive. Admitting b=0b = 0 would make every number less than itself and break trichotomy.

Corollary 6.33 (Adding a positive element moves you up).

If x∈N0x \in \mathbb{N}_0 and y∈Ny \in \mathbb{N} then x<x+yx < x + y. In particular m<s(m)m < s(m) for every m∈N0m \in \mathbb{N}_0.

Proof.

Take n=x+yn = x + y in the definition. For the second claim take y=1y = 1, which lies in N\mathbb{N}, and recall m+1=s(m)m + 1 = s(m).

The definition is stated in terms of differences, so we first show that a difference is unique.

Proposition 6.34 (Uniqueness of differences).

Let a,b∈N0a, b \in \mathbb{N}_0. Then a+x=ba + x = b has at most one solution x∈N0x \in \mathbb{N}_0.

Discussion.

Uniqueness statements are proved by assuming two solutions and forcing them to agree, so we let A(a)A(a) be the statement that any two solutions for that aa coincide, and induct on aa. The base case is immediate, since 0+x=b0 + x = b reads x=bx = b by addition from the left. For the step we take s(a)+x1=b=s(a)+x2s(a) + x_1 = b = s(a) + x_2; both sides are successors, of a+x1a + x_1 and of a+x2a + x_2, and the third Peano condition strips a successor from an equation, leaving an equation the inductive hypothesis handles.

Proof.

We induct on aa. For a=0a = 0, the equation 0+x=b0 + x = b gives x=bx = b by addition from the left, so there is at most one solution.

Suppose the claim holds for aa and that s(a)+x1=b=s(a)+x2s(a) + x_1 = b = s(a) + x_2. By addition from the left, s(a)+xi=s(a+xi)s(a) + x_i = s(a + x_i), so s(a+x1)=s(a+x2)s(a + x_1) = s(a + x_2); the third Peano condition gives a+x1=a+x2a + x_1 = a + x_2, and the inductive hypothesis gives x1=x2x_1 = x_2. Induction completes the proof.

To decide whether m⩽nm \leqslant n we do not need the case split in the definition of the associated order: one difference is enough, provided we now allow it to be 00.

Proposition 6.35 (The associated order on the natural numbers).

For m,n∈N0m, n \in \mathbb{N}_0 we have m⩽nm \leqslant n if and only if n=m+bn = m + b for some b∈N0b \in \mathbb{N}_0.

Discussion.

The statement is a biconditional, so there are two conditionals. Going forwards, the definition of ⩽\leqslant unfolds m⩽nm \leqslant n into the two cases m<nm < n and m=nm = n, and we must produce a difference in each: the first hands us one directly, and in the second b=0b = 0 works. Going backwards we are given a difference and must decide which half of ⩽\leqslant holds, so we split on whether bb is 00; if it is then m=nm = n, and if it is not then b∈Nb \in \mathbb{N} and the definition of << applies. Either way m⩽nm \leqslant n.

Proof.

Suppose m⩽nm \leqslant n. Then m<nm < n or m=nm = n. In the first case the definition of << supplies b∈Nb \in \mathbb{N} with n=m+bn = m + b; in the second, b=0b = 0 serves, since m+0=m=nm + 0 = m = n. Either way b∈N0b \in \mathbb{N}_0.

Conversely suppose n=m+bn = m + b with b∈N0b \in \mathbb{N}_0. If b=0b = 0 then m=nm = n, so m⩽nm \leqslant n. If b≠0b \neq 0 then b∈Nb \in \mathbb{N}, so m<nm < n and again m⩽nm \leqslant n.

When m⩽nm \leqslant n the bb with m+b=nm + b = n is unique, by the proposition on differences, and we write it n−mn - m. So subtraction is defined exactly when the answer lies in N0\mathbb{N}_0.

Proposition 6.36 (Positive means greater than zero).

Let n∈N0n \in \mathbb{N}_0. Then n>0n > 0 if and only if n∈Nn \in \mathbb{N}. Consequently 0⩽n0 \leqslant n for every n∈N0n \in \mathbb{N}_0.

Discussion.

Both directions run through the one equation n=0+bn = 0 + b. Going forwards we must produce a difference witnessing 0<n0 < n, and b=nb = n satisfies the equation, lying in N\mathbb{N} because that is the hypothesis. Going backwards the definition hands us a b∈Nb \in \mathbb{N} with n=0+bn = 0 + b, so nn and bb are the same element and the hypothesis transfers. The consequence follows: an element of N0\mathbb{N}_0 is either 00, where equality serves, or lies in N\mathbb{N}, where the biconditional gives 0<n0 < n.

Proof.

Suppose n∈Nn \in \mathbb{N}. Then n=0+nn = 0 + n by addition from the left, and n∈Nn \in \mathbb{N}, so 0<n0 < n by the definition of <<.

Conversely suppose 0<n0 < n. The definition gives b∈Nb \in \mathbb{N} with n=0+bn = 0 + b, so n=b∈Nn = b \in \mathbb{N}.

Finally, an n∈N0n \in \mathbb{N}_0 is either 00 or a member of N\mathbb{N}; in the first case 0=n0 = n and in the second 0<n0 < n, so 0⩽n0 \leqslant n in both.

The proof that << is an order splits N0\mathbb{N}_0 at a chosen element, and we use the same splitting later for the induction variants and for well-ordering, so we give it a name.

Definition 6.37 (Cuts).

For a∈N0a \in \mathbb{N}_0 we write

La=def{x∈N0∣x<a},Ra=def{x∈N0∣x⩾a}.L_a \defeq \{x \in \mathbb{N}_0 \mid x < a\}, \qquad R_a \defeq \{x \in \mathbb{N}_0 \mid x \geqslant a\}.

Theorem 6.38 (The natural numbers are strictly ordered).

The relation of the definition above is a strict linear order on N0\mathbb{N}_0.

Discussion.

The definition of a strict linear order wants transitivity and trichotomy, and the characterisation proved earlier lets us replace the second by weak trichotomy and anti-reflexivity, so there are three things to prove. Transitivity is a calculation: two positive differences add up to a single one, which is positive by closure. Anti-reflexivity follows from uniqueness of differences, since a<aa < a would exhibit aa as a+xa + x with xx positive while a=a+0a = a + 0 exhibits it with difference 00, and only one difference is permitted. Weak trichotomy is the main part; in terms of the cuts it is the set equation La∪Ra=N0L_a \cup R_a = \mathbb{N}_0, which we prove by induction on aa. The base case is the proposition just proved, since every element is at least 00, so R0R_0 is everything. For the step we take an arbitrary xx, use the hypothesis to place it on one side of aa, and then place it relative to s(a)s(a): an xx below aa stays below s(a)s(a), an xx equal to aa falls below s(a)s(a), and for an xx above aa the positive difference has a predecessor, which gives s(a)⩽xs(a) \leqslant x.

Proof.

For transitivity, suppose a+x=ba + x = b and b+y=cb + y = c with x,y∈Nx, y \in \mathbb{N}. Then a+(x+y)=(a+x)+y=b+y=ca + (x + y) = (a + x) + y = b + y = c by the laws of addition, and x+y∈Nx + y \in \mathbb{N} by closure; hence a<ca < c.

For anti-reflexivity, a<aa < a would give a+x=a=a+0a + x = a = a + 0 with x∈Nx \in \mathbb{N}, and uniqueness of differences forces x=0x = 0, contradicting x∈Nx \in \mathbb{N}.

For weak trichotomy, fix aa and consider the cuts. We show La∪Ra=N0L_a \cup R_a = \mathbb{N}_0 by induction on aa. For a=0a = 0, every element satisfies 0⩽x0 \leqslant x by the proposition above, so R0=N0R_0 = \mathbb{N}_0.

Suppose La∪Ra=N0L_a \cup R_a = \mathbb{N}_0 and let x∈N0x \in \mathbb{N}_0. If x∈Lax \in L_a then x<a<s(a)x < a < s(a) by the corollary above, so x∈Ls(a)x \in L_{s(a)} by transitivity. If x∈Rax \in R_a there are two cases. If x=ax = a then x<s(a)x < s(a), so x∈Ls(a)x \in L_{s(a)}. If a<xa < x then x=a+bx = a + b with b∈Nb \in \mathbb{N}, and bb has a predecessor by the theorem on predecessors, say b=s(c)=c+1b = s(c) = c + 1; then x=a+(1+c)=s(a)+cx = a + (1 + c) = s(a) + c, so s(a)⩽xs(a) \leqslant x and x∈Rs(a)x \in R_{s(a)}. Induction gives La∪Ra=N0L_a \cup R_a = \mathbb{N}_0 for every aa, which is weak trichotomy.

The characterisation of strict linear orders now applies.

Nothing lies strictly between nn and its successor. This looks obvious, but it has to be proved from the definition.

Proposition 6.39 (Nothing between n and its successor).

Let n∈N0n \in \mathbb{N}_0. There is no x∈N0x \in \mathbb{N}_0 with n<x<s(n)n < x < s(n).

Discussion.

This is a non-existence claim, so we suppose such an xx exists and derive a contradiction. The two strict inequalities give two positive differences, x=n+bx = n + b and s(n)=x+cs(n) = x + c, and we eliminate nn between them. Since bb is positive it has a predecessor, so b=1+db = 1 + d, so the s(n)s(n) of the second equation appears inside the first. Substituting turns xx into x+(c+d)x + (c + d), so xx carries the two differences 00 and c+dc + d; uniqueness forces c+d=0c + d = 0, and a sum is zero only when both parts are, so c=0c = 0, contradicting the choice of cc as positive.

Proof.

Suppose n<xn < x and x<s(n)x < s(n). The first gives b∈Nb \in \mathbb{N} with x=n+bx = n + b, the second gives c∈Nc \in \mathbb{N} with s(n)=x+cs(n) = x + c. Since b≠0b \neq 0 it has a predecessor, so b=1+db = 1 + d for some d∈N0d \in \mathbb{N}_0. Then

x=n+b=n+(1+d)=(n+1)+d=s(n)+d=(x+c)+d=x+(c+d).x = n + b = n + (1 + d) = (n + 1) + d = s(n) + d = (x + c) + d = x + (c + d).

So x+0=x+(c+d)x + 0 = x + (c + d), and uniqueness of differences gives c+d=0c + d = 0; hence c=0c = 0, contradicting c∈Nc \in \mathbb{N}.

Problem 6.14.

Show that the only x∈N0x \in \mathbb{N}_0 with x<2x < 2 are x=0x = 0 and x=1x = 1.

Problem 6.15.

Prove that m<nm < n if and only if s(m)⩽ns(m) \leqslant n, for all m,n∈N0m, n \in \mathbb{N}_0.

Problem 6.16.

Let x,y,z∈N0x, y, z \in \mathbb{N}_0, with multiplication as in the problems of the last chapter.

  1. If x⩽yx \leqslant y then x+z⩽y+zx + z \leqslant y + z, and x<yx < y if and only if x+z<y+zx + z < y + z.
  2. If x⩽yx \leqslant y then x⋅z⩽y⋅zx \cdot z \leqslant y \cdot z; and if moreover z>0z > 0 and x<yx < y, then x⋅z<y⋅zx \cdot z < y \cdot z.
  3. If x⋅z<y⋅zx \cdot z < y \cdot z then x<yx < y.
  4. If x⋅z=y⋅zx \cdot z = y \cdot z and z≠0z \neq 0, then x=yx = y.

Problem 6.17.

Suppose m1<m2m_1 < m_2 and n1<n2n_1 < n_2 in N0\mathbb{N}_0. Show that m1+n1<m2+n2m_1 + n_1 < m_2 + n_2.

Problem 6.18.

Show that n−n=0n - n = 0 and n−0=nn - 0 = n for every n∈N0n \in \mathbb{N}_0, and that n−m=0n - m = 0 implies n=mn = m for all m,n∈N0m, n \in \mathbb{N}_0 with m⩽nm \leqslant n.

Problem 6.19.

Let x,y,z,c∈N0x, y, z, c \in \mathbb{N}_0.

  1. If y⩽xy \leqslant x and z⩽xz \leqslant x, then x−y=zx - y = z if and only if x−z=yx - z = y.
  2. If z⩽yz \leqslant y then (x+y)−z=x+(y−z)(x + y) - z = x + (y - z).
  3. If y⩽xy \leqslant x then x−y=(x+c)−(y+c)x - y = (x + c) - (y + c).

Problem 6.20.

State the hypotheses on a,b,c∈N0a, b, c \in \mathbb{N}_0 under which each of

a+(b−a)=b,(b−a)+(c−b)=c−a,c(b−a)=cb−caa + (b - a) = b, \qquad (b - a) + (c - b) = c - a, \qquad c(b - a) = cb - ca

is defined, and prove all three.

Problem 6.21.

  1. Determine all x,y,z∈N0x, y, z \in \mathbb{N}_0 for which (x−y)−z(x - y) - z and x−(y−z)x - (y - z) are both defined, and decide whether the two agree whenever both are.
  2. Decide whether x−(y+z)=(x−y)−zx - (y + z) = (x - y) - z whenever the left-hand side is defined.

Well-Ordering and Induction Variants

With the order we can prove the form of induction that starts at an arbitrary natural number.

Theorem 6.40 (Induction from an arbitrary starting point).

Let n0∈N0n_0 \in \mathbb{N}_0 and let AA be a predicate on N0\mathbb{N}_0. If A(n0)A(n_0) holds, and if A(n)  ⟹  A(s(n))A(n) \implies A(s(n)) for every n⩾n0n \geqslant n_0, then A(n)A(n) holds for every n⩾n0n \geqslant n_0.

Discussion.

Ordinary induction starts at 00, and the hypotheses say nothing below n0n_0, so we enlarge the set where AA holds until the fifth Peano condition applies. Let MM be that set and put M′=defM∪Ln0M' \defeq M \cup L_{n_0}, adding everything strictly below the starting point. We may assume n0>0n_0 > 0, since at n0=0n_0 = 0 ordinary induction already applies, and then 0∈Ln0⊂M′0 \in L_{n_0} \subset M' settles the base case without appealing to AA at all. For the step we take n∈M′n \in M' and compare s(n)s(n) with n0n_0, which trichotomy resolves into three cases: below n0n_0 it lies in the padding, equal to n0n_0 it lies in MM by the base hypothesis, and above n0n_0 it forces nn itself to be at or above n0n_0, so nn lies in MM and the given step applies. Induction then gives M′=N0M' = \mathbb{N}_0; since the two cuts are disjoint and exhaust everything, the added part Ln0L_{n_0} has nothing at or above n0n_0, and Rn0⊂MR_{n_0} \subset M is what remains.

Proof.

Let M=def{n∈N0∣A(n)}M \defeq \{n \in \mathbb{N}_0 \mid A(n)\} and put M′=defM∪Ln0M' \defeq M \cup L_{n_0}. It is enough to prove M′=N0M' = \mathbb{N}_0, for then Ln0∪Rn0=N0L_{n_0} \cup R_{n_0} = \mathbb{N}_0 and Ln0∩Rn0=∅L_{n_0} \cap R_{n_0} = \emptyset give Rn0⊂MR_{n_0} \subset M, which is the assertion.

We may assume n0>0n_0 > 0, since n0=0n_0 = 0 is ordinary induction. Then 0∈Ln0⊂M′0 \in L_{n_0} \subset M'. Let n∈M′n \in M' and compare s(n)s(n) with n0n_0.

If s(n)<n0s(n) < n_0 then s(n)∈Ln0⊂M′s(n) \in L_{n_0} \subset M'. If s(n)=n0s(n) = n_0 then s(n)∈Ms(n) \in M by the base hypothesis. If s(n)>n0s(n) > n_0 then n⩾n0n \geqslant n_0, since n<n0n < n_0 would put n0n_0 strictly between nn and s(n)s(n); hence n∉Ln0n \notin L_{n_0}, so n∈Mn \in M, and the induction hypothesis gives s(n)∈Ms(n) \in M.

In every case s(n)∈M′s(n) \in M', so the fifth Peano condition gives M′=N0M' = \mathbb{N}_0.

Theorem 6.41 (Well-ordering of the natural numbers).

Every non-empty subset M⊂N0M \subset \mathbb{N}_0 has a smallest element: there is m0∈Mm_0 \in M with m0⩽mm_0 \leqslant m for every m∈Mm \in M. We write m0=min⁡Mm_0 = \min M.

Discussion.

A non-empty MM may be unbounded, so we first cut it down to a bounded piece. Choose any a∈Ma \in M and put M′=defLs(a)∩MM' \defeq L_{s(a)} \cap M, which holds aa and so is non-empty. A smallest element of M′M' is already smallest in MM, since everything in MM outside Ls(a)L_{s(a)} is at least s(a)s(a) and therefore above it. So we may assume M⊂Ls(a)M \subset L_{s(a)} and induct on aa, taking for A(a)A(a) the statement that every non-empty subset of Ls(a)L_{s(a)} has a smallest element. The base case can be checked directly: L1L_1 is {0}\{0\}, so the only non-empty subset is {0}\{0\}. For the step, take a non-empty subset of Ls(s(a))L_{s(s(a))} and intersect it with Ls(a)L_{s(a)}; if the intersection is empty then nothing between s(a)s(a) and its successor leaves only {s(a)}\{s(a)\}, and otherwise the hypothesis supplies a smallest element of the intersection, which by the cutting-down argument is smallest in the whole set.

Proof.

Choose a∈Ma \in M and put M′=defLs(a)∩MM' \defeq L_{s(a)} \cap M; since a<s(a)a < s(a) we have a∈M′a \in M', so M′M' is non-empty. If m0m_0 is smallest in M′M' then m0⩽am_0 \leqslant a, while every member of M∖M′M \setminus M' is at least s(a)s(a) and hence above m0m_0; so m0m_0 is smallest in MM. It therefore suffices to show, by induction on aa, that every non-empty subset of Ls(a)L_{s(a)} has a smallest element.

For a=0a = 0, the cut L1L_1 is {0}\{0\}: an x<1x < 1 cannot be positive, since 0<x<10 < x < 1 would put xx strictly between 00 and its successor. So the only non-empty subset of L1L_1 is {0}\{0\}, whose smallest element is 00.

Suppose every non-empty subset of Ls(a)L_{s(a)} has a smallest element, and let N≠∅N \neq \emptyset be contained in Ls(s(a))L_{s(s(a))}. If N∩Ls(a)=∅N \cap L_{s(a)} = \emptyset then every element of NN is at least s(a)s(a) and below s(s(a))s(s(a)), so N={s(a)}N = \{s(a)\} and s(a)s(a) is its smallest element. Otherwise N∩Ls(a)N \cap L_{s(a)} has a smallest element m0m_0, and the argument of the first paragraph shows m0m_0 is smallest in NN. Induction completes the proof.

Corollary 6.42 (Method of infinite descent).

No non-empty subset M⊂N0M \subset \mathbb{N}_0 has the property that every a∈Ma \in M admits an a′∈Ma' \in M with a′<aa' < a.

Proof.

If such an MM existed, well-ordering would give it a smallest element a0a_0, and the hypothesis would supply a0′∈Ma_0' \in M with a0′<a0a_0' < a_0, contradicting minimality.

One cannot descend for ever through a non-empty set of natural numbers. The Greeks already used this as a proof technique, and we shall use it when we come to the numbers that are not fractions.

Theorem 6.43 (Strong induction).

Let AA be a predicate on N0\mathbb{N}_0 with A(0)A(0) true, and suppose that for every n∈N0n \in \mathbb{N}_0 the truth of A(m)A(m) for all m⩽nm \leqslant n implies A(s(n))A(s(n)). Then A(n)A(n) holds for every n∈N0n \in \mathbb{N}_0.

Discussion.

In ordinary induction the step uses only the previous case; here it may use all earlier cases at once, and we prove this from well-ordering. Instead of building up the set where AA holds we look at the set where it fails: assume it non-empty and let n0n_0 be its smallest element. The base hypothesis rules out n0=0n_0 = 0, so n0n_0 has a predecessor pp. Minimality says A(m)A(m) holds for every m<n0m < n_0, and since nothing lies strictly between pp and n0n_0, those mm are precisely the m⩽pm \leqslant p, which is what the step needs at pp. The step therefore yields A(s(p))A(s(p)), that is A(n0)A(n_0), and n0n_0 was chosen to make AA fail.

Proof.

Let M=def{n∈N0∣A(n) fails}M \defeq \{n \in \mathbb{N}_0 \mid A(n) \text{ fails}\} and suppose M≠∅M \neq \emptyset. Well-ordering gives it a smallest element n0n_0, so A(n0)A(n_0) fails while A(n)A(n) holds for every n<n0n < n_0.

Since A(0)A(0) holds, n0≠0n_0 \neq 0, so the theorem on predecessors gives n0=s(p)n_0 = s(p) for some pp. Every m⩽pm \leqslant p satisfies m<n0m < n_0, since p<s(p)=n0p < s(p) = n_0 and nothing lies strictly between; hence A(m)A(m) holds for every such mm. The hypothesis then gives A(s(p))A(s(p)), that is A(n0)A(n_0), a contradiction. So M=∅M = \emptyset.

Problem 6.22.

Deduce the fifth Peano condition from strong induction, so that the two induction principles are equivalent.

Problem 6.23.

Show that strong induction can be proved without well-ordering, by applying ordinary induction to the set B=def{n∈N0∣A(m) holds for every m⩽n}B \defeq \{n \in \mathbb{N}_0 \mid A(m) \text{ holds for every } m \leqslant n\}.

Problem 6.24.

Let f:N0→N0f : \mathbb{N}_0 \to \mathbb{N}_0.

  1. Show that f(s(n))<f(n)f(s(n)) < f(n) cannot hold for every n∈N0n \in \mathbb{N}_0.
  2. Show that if f(s(n))⩽f(n)f(s(n)) \leqslant f(n) for every n∈N0n \in \mathbb{N}_0, then there is an NN with f(n)=f(N)f(n) = f(N) for every n⩾Nn \geqslant N.

Problem 6.25.

Let n∈N0n \in \mathbb{N}_0. Show that there is exactly one m∈N0m \in \mathbb{N}_0 with m⋅m⩽n<s(m)⋅s(m)m \cdot m \leqslant n < s(m) \cdot s(m).

Division with Remainder

A first use of well-ordering: dividing one natural number by another leaves a quotient and a remainder, both determined by the two numbers.

Theorem 6.44 (Division with remainder).

Let n∈N0n \in \mathbb{N}_0 and m∈Nm \in \mathbb{N}. Then there is exactly one pair q,r∈N0q, r \in \mathbb{N}_0 with

n=q⋅m+r,r<m.n = q \cdot m + r, \qquad r < m.

Discussion.

An “exactly one” claim asks for existence and uniqueness, and the two need different arguments. For existence we look for the remainder rather than the quotient: the set of numbers of the form n−q⋅mn - q \cdot m that remain in N0\mathbb{N}_0 is non-empty, since q=0q = 0 leaves nn itself, so well-ordering gives us its least member rr, and minimality forces r<mr < m: were rr at least mm we could subtract one more mm and get something smaller still. For uniqueness we assume two decompositions and show that a certain multiple of mm must be 00. Subtracting gives a multiple of mm equal to a difference of two remainders, and that difference is below mm because each remainder is; but a non-zero multiple of mm is at least mm, so the multiple is 00, the quotients agree, and the remainders follow.

Proof.

For existence, let R=def{r∈N0∣n=q⋅m+r for some q∈N0}R \defeq \{r \in \mathbb{N}_0 \mid n = q \cdot m + r \text{ for some } q \in \mathbb{N}_0\}. Taking q=0q = 0 gives n∈Rn \in R, so RR is non-empty and well-ordering supplies r=defmin⁡Rr \defeq \min R, with n=q⋅m+rn = q \cdot m + r for some qq.

Suppose r⩾mr \geqslant m. Then r=m+r′r = m + r' for some r′∈N0r' \in \mathbb{N}_0, so n=q⋅m+m+r′=s(q)⋅m+r′n = q \cdot m + m + r' = s(q) \cdot m + r', putting r′∈Rr' \in R; and r′<rr' < r, since mm is positive. That contradicts minimality, so r<mr < m.

For uniqueness, suppose q1⋅m+r1=q2⋅m+r2q_1 \cdot m + r_1 = q_2 \cdot m + r_2 with r1,r2<mr_1, r_2 < m, and take q1⩾q2q_1 \geqslant q_2 without loss. Then q1=q2+dq_1 = q_2 + d for some d∈N0d \in \mathbb{N}_0, and cancelling gives d⋅m+r1=r2d \cdot m + r_1 = r_2, so d⋅m⩽r2<md \cdot m \leqslant r_2 < m. If dd were positive then d⩾1d \geqslant 1 and d⋅m⩾md \cdot m \geqslant m, a contradiction; so d=0d = 0, whence q1=q2q_1 = q_2 and then r1=r2r_1 = r_2.

Corollary 6.45 (Remainder classes).

Let m∈Nm \in \mathbb{N}. Every n∈N0n \in \mathbb{N}_0 has exactly one of the mm forms k⋅mk \cdot m, k⋅m+1k \cdot m + 1, …, k⋅m+(m−1)k \cdot m + (m-1) with k∈N0k \in \mathbb{N}_0.

Proof.

The theorem gives exactly one pair k,rk, r with n=k⋅m+rn = k \cdot m + r and r<mr < m, and the values available to rr are precisely 0,1,…,m−10, 1, \ldots, m-1.

Taking m=2m = 2 splits N0\mathbb{N}_0 into the even numbers, those of the form 2k2k, and the odd ones, those of the form 2k+12k + 1; the corollary says every natural number is one or the other and none is both.

Problem 6.26.

Let n,m∈N0n, m \in \mathbb{N}_0 with mm positive. Show that mm divides nn, in the sense that n=k⋅mn = k \cdot m for some k∈N0k \in \mathbb{N}_0, exactly when the remainder of the theorem is 00.

Problem 6.27.

Show that divisibility orders N\mathbb{N} as a partial order in the sense of Definition 6.16 , and find the minimum and the maximum, if they exist, of {n∈N∣n divides 12}\{n \in \mathbb{N} \mid n \text{ divides } 12\} in that order.

Descent in Action

Here is an application of infinite descent.

Proposition 6.46 (Odd squares are odd).

Let n∈N0n \in \mathbb{N}_0. If n⋅nn \cdot n is even then nn is even.

Discussion.

We prove the contrapositive, which is the easier direction to compute with: an odd nn is 2k+12k+1 by the remainder classes, and squaring it and collecting terms exhibits the result as twice something plus one. Only the laws of addition and multiplication are needed; the remainder classes turn “not even” into the usable form 2k+12k + 1.

Proof.

Suppose nn is odd, so n=2k+1n = 2k + 1 for some k∈N0k \in \mathbb{N}_0 by the remainder classes. Then

n⋅n=(2k+1)(2k+1)=2(2⋅k⋅k+k+k)+1,n \cdot n = (2k + 1)(2k + 1) = 2\bigl(2 \cdot k \cdot k + k + k\bigr) + 1,

which is odd. So an even n⋅nn \cdot n forces nn to be even.

Theorem 6.47 (Two is not a ratio of squares).

There are no d,a∈Nd, a \in \mathbb{N} with d⋅d=2⋅(a⋅a)d \cdot d = 2 \cdot (a \cdot a).

Discussion.

We argue by contradiction, using infinite descent, so we build a non-empty set in which every member has a smaller member. Suppose some pair works and let MM be the set of all a∈Na \in \mathbb{N} admitting a partner dd; the supposition puts something in MM. The descent comes from using parity twice. From d⋅d=2(a⋅a)d \cdot d = 2(a \cdot a) the square d⋅dd \cdot d is even, so dd is even by the proposition above; writing d=2d′d = 2d' and substituting makes a⋅aa \cdot a even, hence aa even too, say a=2a′a = 2a'. Cancelling a factor of four leaves d′⋅d′=2(a′⋅a′)d' \cdot d' = 2(a' \cdot a'), which puts a′a' in MM as well, and a′<aa' < a because halving a positive number decreases it. Infinite descent forbids this.

In terms of fractions, which we have not built yet, this says that no fraction squares to two.

Proof.

Suppose such a pair exists and let M=def{a∈N∣d⋅d=2⋅(a⋅a) for some d∈N}M \defeq \{a \in \mathbb{N} \mid d \cdot d = 2 \cdot (a \cdot a) \text{ for some } d \in \mathbb{N}\}, which is then non-empty.

Let a∈Ma \in M with partner dd. Then d⋅dd \cdot d is even, so d=2d′d = 2d' by the proposition above. Substituting gives 4(d′⋅d′)=2(a⋅a)4(d' \cdot d') = 2(a \cdot a), so a⋅a=2(d′⋅d′)a \cdot a = 2(d' \cdot d'); hence a⋅aa \cdot a is even and a=2a′a = 2a' for some a′a'. Substituting again gives 4(d′⋅d′)=2⋅4(a′⋅a′)4(d' \cdot d') = 2 \cdot 4 (a' \cdot a'), so d′⋅d′=2(a′⋅a′)d' \cdot d' = 2(a' \cdot a'), putting a′∈Ma' \in M. Since a=2a′=a′+a′a = 2a' = a' + a' with a′a' positive, we have a′<aa' < a.

So every member of MM has a smaller member, which infinite descent forbids. Hence no such pair exists.

Problem 6.28.

Show that there are no d,a∈Nd, a \in \mathbb{N} with d⋅d=3⋅(a⋅a)d \cdot d = 3 \cdot (a \cdot a), and decide whether the same argument rules out d⋅d=4⋅(a⋅a)d \cdot d = 4 \cdot (a \cdot a).

Expansions in a Base

Writing a number in base gg is repeated division with remainder, and the digits are the remainders.

Theorem 6.48 (Expansion in a base).

Let g∈Ng \in \mathbb{N} with g⩾2g \geqslant 2. For every n∈Nn \in \mathbb{N} there are uniquely determined r∈N0r \in \mathbb{N}_0 and a0,…,ar∈N0a_0, \ldots, a_r \in \mathbb{N}_0 with ar≠0a_r \neq 0 and aρ<ga_\rho < g for each ρ\rho, such that

n=a0+a1g+a2g2+⋯+argr=∑ρ=0raρgρ.n = a_0 + a_1 g + a_2 g^2 + \cdots + a_r g^r = \sum_{\rho = 0}^{r} a_\rho g^\rho.

Discussion.

The digits come from dividing repeatedly: set q0=nq_0 = n, divide by gg to leave the lowest digit a0a_0 and a quotient q1q_1, divide that to leave a1a_1, and so on. Two things must be checked. It stops because g⩾2g \geqslant 2 makes each non-terminal quotient strictly smaller than the number it came from, and a scheme that never halted would descend for ever through N0\mathbb{N}_0, which descent forbids. The digits add back to nn because each equation expresses one quotient in terms of the next, so substituting upwards leaves the displayed sum. Uniqueness runs the same divisions in reverse: division with remainder determines a0a_0 and q1q_1 from nn, then a1a_1 and q2q_2 from q1q_1, and so on, fixing the leading digit and the final index along with the rest.

Proof.

Put q0=defnq_0 \defeq n and apply division with remainder repeatedly:

q0=q1g+a0,a0<g,q1=q2g+a1,a1<g,  ⋮qr−1=qrg+ar−1,ar−1<g,qr=ar,0<ar<g.\begin{aligned} q_0 &= q_1 g + a_0, & a_0 &< g, \\ q_1 &= q_2 g + a_1, & a_1 &< g, \\ &\ \,\vdots \\ q_{r-1} &= q_r g + a_{r-1}, & a_{r-1} &< g, \\ q_r &= a_r, & 0 < a_r &< g. \end{aligned}

Each line is division with remainder applied to qρq_\rho and gg. Since g⩾2g \geqslant 2, a non-zero quotient satisfies qρ+1<qρq_{\rho+1} < q_\rho, so the scheme cannot run for ever without contradicting infinite descent; it therefore halts at some rr with qr<gq_r < g.

Substituting each line into the one above it gives n=a0+a1g+⋯+argrn = a_0 + a_1 g + \cdots + a_r g^r. Uniqueness of the quotient and remainder at each step gives uniqueness of the list of digits, and of rr.

We write n=(ar…a0)gn = (a_r \ldots a_0)_g, and call the cases g=2g = 2 and g=10g = 10 the binary and decimal expansions. The value can be recovered by a recursion which never computes a power separately:

n=(⋯((arg+ar−1)g+ar−2)g+⋯+a1)g+a0.n = \Bigl(\cdots\bigl((a_r g + a_{r-1})g + a_{r-2}\bigr)g + \cdots + a_1\Bigr)g + a_0.

This is Horner’s scheme for base gg. It uses one multiplication by gg at each stage, rr in all, where computing every power first and then forming every term uses up to twice as many.

Problem 6.29.

Write 10001000 in base 77, and write (110 1101)2(110\,1101)_2 in base 1010.

Problem 6.30.

Let n∈Nn \in \mathbb{N} and let rr be as in the theorem. Show that gr⩽n<gs(r)g^r \leqslant n < g^{s(r)}.

The Maximum Principle

Well-ordering says every non-empty subset of N0\mathbb{N}_0 has a minimum. The dual statement is false as it stands, since N0\mathbb{N}_0 itself has no maximum, but it becomes true once an upper bound is present.

Theorem 6.49 (Maximum principle).

Let W⊂N0W \subset \mathbb{N}_0 be non-empty with an upper bound in N0\mathbb{N}_0. Then WW has a maximum.

Discussion.

We cannot induct on WW, which is an arbitrary set, so we induct on the bound instead: let TT be the set of those BB such that every non-empty subset bounded above by BB has a maximum, and aim at T=N0T = \mathbb{N}_0; once that is known, any upper bound of the given WW lies in TT and gives WW a maximum. The base case can be checked directly, since a set bounded above by 00 can only be {0}\{0\}, every element being at least 00. For the step we take a non-empty SS bounded above by s(n)s(n) and split on whether s(n)s(n) belongs to SS: if it does, it is a bound lying in the set and the previous proposition finishes at once; if it does not, then nn is itself an upper bound, because an element strictly above nn and at or below s(n)s(n) but different from it would sit strictly between nn and its successor, which nothing does.

Proof.

Let TT be the set of B∈N0B \in \mathbb{N}_0 such that every non-empty S⊂N0S \subset \mathbb{N}_0 with upper bound BB has a maximum.

For 0∈T0 \in T: let SS be non-empty with upper bound 00, and take k∈Sk \in S. Then k⩽0k \leqslant 0, while 0⩽k0 \leqslant k, so k=0k = 0 by antisymmetry. Hence S={0}S = \{0\}, and 00 is a bound lying in SS, so it is the maximum.

Suppose n∈Tn \in T and let SS be non-empty with upper bound s(n)s(n). If s(n)∈Ss(n) \in S then s(n)s(n) is an upper bound lying in SS, hence the maximum. If s(n)∉Ss(n) \notin S, we claim nn bounds SS: an element k∈Sk \in S with n<kn < k satisfies k⩽s(n)k \leqslant s(n) and k≠s(n)k \neq s(n), so n<k<s(n)n < k < s(n), which nothing does. So nn is an upper bound of SS, and n∈Tn \in T supplies a maximum. Hence s(n)∈Ts(n) \in T.

By induction T=N0T = \mathbb{N}_0. Given WW non-empty with upper bound BB, we have B∈TB \in T, so WW has a maximum.

A partially ordered set in which every non-empty subset has a minimum is called well-ordered. By the theorem above N0\mathbb{N}_0 is well-ordered, and so is N\mathbb{N}, whose non-empty subsets are non-empty subsets of N0\mathbb{N}_0. N0\mathbb{N}_0 has two further order properties: every element beyond the minimum has an immediate predecessor, and there is no greatest element. Together with well-ordering these determine the order completely.

Theorem 6.50 (Characterisation of the natural numbers).

Let MM be a non-empty well-ordered set in which every element other than min⁡M\min M has an immediate predecessor, meaning an element p<ap < a with nothing of MM strictly between, and which has no greatest element. Then there is an order-preserving bijection from N0\mathbb{N}_0 to MM.

Discussion.

The conclusion asks for the order of N0\mathbb{N}_0 inside MM, so the plan is to build a successor map on MM from the three hypotheses and then check that it reaches everything. In N0\mathbb{N}_0 the successor of nn is the least element above nn, and that phrase makes sense in MM: the absence of a greatest element keeps the set of elements above aa non-empty, and well-ordering gives it a minimum, which we call ν(a)\nu(a). The predecessor hypothesis makes ν\nu behave like a successor map, since nothing is reached from below except through an immediate predecessor, so min⁡M\min M is never a value of ν\nu and two elements cannot share one. With ν\nu in hand the recursion theorem builds the candidate: start at min⁡M\min M and keep applying ν\nu. As ν(a)>a\nu(a) > a, the values climb, which already gives order-preservation and injectivity; the main work is surjectivity, where we take the least element never reached, which cannot exist because its immediate predecessor is reached and ν\nu carries that to it.

Proof.

Write m0=defmin⁡Mm_0 \defeq \min M and for a∈Ma \in M put ν(a)=defmin⁡{m∈M∣a<m}\nu(a) \defeq \min\{m \in M \mid a < m\}, which exists because MM has no greatest element and is well-ordered. By construction ν(a)>a\nu(a) > a and nothing of MM lies strictly between aa and ν(a)\nu(a).

An element c≠m0c \neq m_0 has exactly one immediate predecessor: two of them, say p<qp < q, would put qq strictly between pp and cc. Hence ν\nu is injective, since ν(a)=ν(b)=c\nu(a) = \nu(b) = c makes aa and bb both immediate predecessors of cc; and m0m_0 is not a value of ν\nu, since ν(a)>a⩾m0\nu(a) > a \geqslant m_0.

The recursion theorem, applied with a=m0a = m_0 and g=νg = \nu, gives exactly one f:N0→Mf : \mathbb{N}_0 \to M with f(0)=m0f(0) = m_0 and f(s(n))=ν(f(n))f(s(n)) = \nu(f(n)). Since ν(x)>x\nu(x) > x for every xx, induction gives f(a)<f(b)f(a) < f(b) whenever a<ba < b; in particular ff is injective.

For surjectivity, let AA be the range of ff. Then m0∈Am_0 \in A, and AA is closed under ν\nu, since ν(f(n))=f(s(n))\nu(f(n)) = f(s(n)). Suppose M∖AM \setminus A is non-empty and let cc be its least element. Since m0∈Am_0 \in A we have c≠m0c \neq m_0, so cc has an immediate predecessor pp; by minimality of cc we have p∈Ap \in A, and c=ν(p)c = \nu(p) because nothing lies strictly between. Closure of AA under ν\nu gives c∈Ac \in A, a contradiction. Hence ff is a bijection.

Remark.

The proof never carries out an induction inside MM: surjectivity uses well-ordering through a least counterexample, and ff itself comes from the recursion theorem on N0\mathbb{N}_0. One may therefore take well-ordering, the predecessor property and the absence of a greatest element as axioms in place of Peano’s; the theorem says the two systems describe the same ordered set.

Problem 6.31.

Let S⊂N0S \subset \mathbb{N}_0 be non-empty. Prove that SS has a minimum by applying the maximum principle to the set of lower bounds of SS, rather than by appealing to well-ordering.

Problem 6.32.

State and prove the maximum principle for non-empty subsets of N\mathbb{N} bounded above in N\mathbb{N}, starting the induction at 11.

Problem 6.33.

Let MM be an ordered set in which every two-element subset has a minimum. Show that the order is total, and deduce that every well-ordered set is totally ordered.

Problem 6.34.

Let S⊂N0S \subset \mathbb{N}_0 be such that for every c∈N0c \in \mathbb{N}_0 there is an s∈Ss \in S with s>cs > c. Prove that there is exactly one bijection f:N0→Sf : \mathbb{N}_0 \to S with f(m)<f(n)f(m) < f(n) whenever m<nm < n.

Problem 6.35.

Order N0×N0\mathbb{N}_0 \times \mathbb{N}_0 by declaring (a,b)<(c,d)(a, b) < (c, d) when a<ca < c, or when a=ca = c and b<db < d. Show that this is a strict linear order in which every non-empty subset has a least element.

Problem 6.36.

Theorem 6.50 asks three things of MM. Exhibit a well-ordered set with no greatest element in which some element other than the minimum has no immediate predecessor, and a well-ordered set in which every element other than the minimum has an immediate predecessor but a greatest element exists. For the first, name the element that has no immediate predecessor.

Problem 6.37.

  1. Exhibit a totally ordered set LL with no greatest element in which every element has an immediate predecessor, and which is not well-ordered.
  2. Show that there is no bijection f:N0→Lf : \mathbb{N}_0 \to L with f(m)<f(n)f(m) < f(n) whenever m<nm < n, and say where the proof of Theorem 6.50 uses the hypothesis that LL fails.
  3. Order L×N0L \times \mathbb{N}_0 as in Problem 6.35 . Show that the result is totally ordered but not well-ordered.

Sequences

A list is a function whose inputs are positions. The cuts defined for the natural numbers give us the positions, so nothing new is needed.

Definition 6.51 (Sequence).

Let AA be a set. A finite sequence in AA of length nn is a function from LnL_n to AA, written (ai)i<n(a_i)_{i < n} or (a0,a1,…)(a_0, a_1, \ldots), in the notation already used for tuples; the unique sequence of length 00 is the empty function, written ( )(\,). An infinite sequence in AA is a function from N0\mathbb{N}_0 to AA. We write

Seq⁡(A)=def⋃n∈N0ALn\operatorname{Seq}(A) \defeq \bigcup_{n \in \mathbb{N}_0} A^{L_n}

for the set of all finite sequences in AA, using the Cartesian power of the last chapter but one.

That Seq⁡(A)\operatorname{Seq}(A) is a set takes a moment. Each ALnA^{L_n} consists of functions from LnL_n to AA, hence of subsets of N0×A\mathbb{N}_0 \times A, so all of them lie inside P(N0×A)\mathcal{P}(\mathbb{N}_0 \times A); comprehension collects them and the union axiom pools them.

Remark.

Some texts say instead that a finite sequence is a function whose domain is a natural number. That is the same definition read through the construction of the last chapter, where nn was built as the set holding exactly its predecessors, so that n=Lnn = L_n. We use the cut, which says the same thing without leaning on which sets the numerals happen to be.

Restriction gives the initial pieces of a sequence: for ff defined on N0\mathbb{N}_0 and n∈N0n \in \mathbb{N}_0, the restriction f∣Lnf|_{L_n} is the finite sequence (f0,…)(f_0, \ldots) of length nn, recording everything before position nn and nothing else.

The General Recursion Theorem

The recursion theorem of the last chapter lets the next value depend on the previous one, and its parametrised form lets it depend on the index as well. Neither is enough when the next value depends on all the earlier ones at once. With sequences we can state such a rule, and with the order we can prove that it defines a function.

Theorem 6.52 (General recursion).

Let SS be a set and let g:Seq⁡(S)→Sg : \operatorname{Seq}(S) \to S. Then there is exactly one f:N0→Sf : \mathbb{N}_0 \to S with

f(n)=g(f∣Ln)for every n∈N0.f(n) = g\bigl(f|_{L_n}\bigr) \quad\text{for every } n \in \mathbb{N}_0.

Discussion.

The rule wants the whole history at each step, so we recurse on histories rather than on values: instead of building ff directly we build the sequence of its initial pieces. Let GG send a pair (t,n)(t, n) to tt extended by the value g(t)g(t) at position nn, whenever tt has length nn, and to the empty sequence otherwise; that second clause is bookkeeping only, since the case never arises. Parametrised recursion then gives a map FF on N0\mathbb{N}_0 with F(0)F(0) the empty sequence and F(s(n))=G(F(n),n)F(s(n)) = G(F(n), n), and an induction shows F(n)F(n) has length exactly nn, so the bookkeeping clause is never reached. Each F(n)F(n) extends its predecessors, so their union is a single function ff on N0\mathbb{N}_0 whose restriction to LnL_n is F(n)F(n), and reading the construction back gives the required identity. Uniqueness uses strong induction: two solutions agreeing everywhere below nn have the same restriction to LnL_n, so gg returns the same value at nn, and ordinary induction would not deliver that hypothesis.

Proof.

Define G:Seq⁡(S)×N0→Seq⁡(S)G : \operatorname{Seq}(S) \times \mathbb{N}_0 \to \operatorname{Seq}(S) by

G(t,n)=def{t∪{(n,g(t))}if t has length n,( )otherwise.G(t, n) \defeq \begin{cases} t \cup \bigl\{(n, g(t))\bigr\} & \text{if } t \text{ has length } n, \\ (\,) & \text{otherwise.} \end{cases}

By parametrised recursion there is a unique F:N0→Seq⁡(S)F : \mathbb{N}_0 \to \operatorname{Seq}(S) with F(0)=( )F(0) = (\,) and F(s(n))=G(F(n),n)F(s(n)) = G(F(n), n).

We claim F(n)F(n) has length nn. This holds at 00. If F(n)F(n) has length nn, then F(s(n))=F(n)∪{(n,g(F(n)))}F(s(n)) = F(n) \cup \{(n, g(F(n)))\}, whose domain is Ln∪{n}L_n \cup \{n\}; and Ln∪{n}=Ls(n)L_n \cup \{n\} = L_{s(n)}, since x<s(n)x < s(n) holds exactly when x<nx < n or x=nx = n, nothing lying strictly between nn and s(n)s(n). So F(s(n))F(s(n)) has length s(n)s(n), and induction gives the claim.

Each F(n)F(n) is therefore a function extending all the earlier ones, so their union f=def⋃n∈N0F(n)f \defeq \bigcup_{n \in \mathbb{N}_0} F(n) is a function on N0\mathbb{N}_0 with f∣Ln=F(n)f|_{L_n} = F(n) for every nn. Then

f(n)=F(s(n))(n)=g(F(n))=g(f∣Ln),f(n) = F(s(n))(n) = g\bigl(F(n)\bigr) = g\bigl(f|_{L_n}\bigr),

which is the required identity.

For uniqueness, let hh also satisfy the identity, and suppose f(m)=h(m)f(m) = h(m) for every m<nm < n. Then f∣Ln=h∣Lnf|_{L_n} = h|_{L_n}, so f(n)=g(f∣Ln)=g(h∣Ln)=h(n)f(n) = g(f|_{L_n}) = g(h|_{L_n}) = h(n). Strong induction gives f=hf = h.

Problem 6.38.

Show that the recursion theorem of the last chapter is a special case of this one: given a∈Sa \in S and γ:S→S\gamma : S \to S, exhibit a g:Seq⁡(S)→Sg : \operatorname{Seq}(S) \to S whose solution is the map with f(0)=af(0) = a and f(s(n))=γ(f(n))f(s(n)) = \gamma(f(n)).

Problem 6.39.

Let SS be a set and g:Seq⁡(S)→Sg : \operatorname{Seq}(S) \to S. Show that the finite sequences F(n)F(n) built in the proof satisfy F(m)⊂F(n)F(m) \subset F(n) whenever m<nm < n, and explain where that is used.

General Associativity

We can now prove something used without proof earlier. Addition was defined for two arguments and proved associative and commutative for two and three; the notation a1+⋯+ana_1 + \cdots + a_n assumes more, namely that the brackets and the order may be chosen freely. With finite sequences and induction in hand we can say what that means and prove it.

Fix a left-associated reading once and for all: for a finite sequence aa of length nn in a Peano system with addition, define

p(a)=def{0if n=0,p(a∣Lk)+akif n=s(k).p(a) \defeq \begin{cases} 0 & \text{if } n = 0, \\ p\bigl(a|_{L_{k}}\bigr) + a_{k} & \text{if } n = s(k). \end{cases}

So pp of the sequence (a0,a1,a2)(a_0, a_1, a_2) is (0+a0+a1)+a2(0 + a_0 + a_1) + a_2, brackets to the left. A full bracketing of a0+⋯+an−1a_0 + \cdots + a_{n-1} is either the single term, when n=1n = 1, or a sum L+RL + R in which LL is a full bracketing of an initial piece and RR is a full bracketing of the rest.

Theorem 6.53 (General associativity and neighbour swaps).

Let aa be a finite sequence of length nn in a Peano system with addition.

  1. Every full bracketing of a0+⋯+an−1a_0 + \cdots + a_{n-1} equals p(a)p(a).
  2. If bb is obtained from aa by exchanging two neighbouring entries, then p(b)=p(a)p(b) = p(a).

Discussion.

The first part is an induction on nn, but a bracketing may split the sum anywhere, so the step needs one auxiliary fact: the left-associated sum of the whole is the left-associated sum of the first kk entries added to that of the rest. That splitting identity is itself a short induction on the length of the second block, using nothing but binary associativity, and with it the step applies the hypothesis to the two halves of the bracketing and adds the results.

Once every bracketing is identified with pp, the second part may ignore brackets altogether. Exchanging neighbours rearranges a two-term middle and nothing else, so binary commutativity sorts that middle and the splitting identity puts the rest of the list back around it.

Proof.

We first record the splitting identity: for k<nk < n,

p(a)=p(a∣Lk)+p((ak,…,an−1)).p(a) = p\bigl(a|_{L_k}\bigr) + p\bigl((a_k, \ldots, a_{n-1})\bigr).

Fix kk and induct on the length mm of the second block. If m=1m = 1 this is the defining clause of pp. If it holds at mm, then appending one more entry gives

p(a)=p(a∣Ln−1)+an−1=(p(a∣Lk)+p((ak,…,an−2)))+an−1,p(a) = p\bigl(a|_{L_{n-1}}\bigr) + a_{n-1} = \Bigl(p\bigl(a|_{L_k}\bigr) + p\bigl((a_k, \ldots, a_{n-2})\bigr)\Bigr) + a_{n-1},

and associativity of addition regroups this as p(a∣Lk)+p((ak,…,an−1))p(a|_{L_k}) + p((a_k, \ldots, a_{n-1})), which is the identity at m+1m + 1.

For the first part, induct on nn. The case n=1n = 1 is immediate. Let PP be a full bracketing of a0+⋯+an−1a_0 + \cdots + a_{n-1}, so P=L+RP = L + R where LL brackets the first kk entries and RR the rest. The inductive hypothesis gives L=p(a∣Lk)L = p(a|_{L_k}) and R=p((ak,…,an−1))R = p((a_k, \ldots, a_{n-1})), so P=p(a)P = p(a) by the splitting identity.

For the second part, let bb exchange the entries at positions kk and s(k)s(k). The two-term identity ak+as(k)=as(k)+aka_k + a_{s(k)} = a_{s(k)} + a_k is commutativity. If the exchanged pair is the whole sequence we are done; otherwise two applications of the splitting identity write p(a)p(a) as a sum in which that pair appears as a single middle block, and the same decomposition of p(b)p(b) differs only in that block, which commutativity identifies with it.

Brackets therefore no longer matter, and neighbouring summands may be exchanged at will. Any rearrangement of a finite list can be reached by a string of neighbour exchanges, moving each entry past its neighbours until it sits where it should, so the value of a finite sum depends on neither the bracketing nor the order of its terms.

Problem 6.40.

Carry out the same argument for multiplication: define the left-associated product π\pi by the clauses π(( ))=def1\pi((\,)) \defeq 1 and π(a)=defπ(a∣Lk)⋅ak\pi(a) \defeq \pi(a|_{L_k}) \cdot a_k when aa has length s(k)s(k), and prove both parts of the theorem for it. Which laws replace associativity and commutativity of addition at each step?

Problem 6.41.

Show that any rearrangement of a finite sequence is a string of neighbour exchanges, so that the last sentence above is a theorem rather than an appeal to intuition. (Harder.)

Zorn’s Lemma

Finally, two statements equivalent to the axiom of choice, and the reason some mathematicians do not accept it.

Definition 6.54 (Chains and inductively ordered sets).

Let MM be a partially ordered set. A subset A⊂MA \subset M is a chain if the order MM induces on AA is a total order, that is, if any two elements of AA are comparable. The set MM is inductively ordered if every chain in MM has an upper bound in MM.

Remark.

An inductively ordered set is never empty. The empty subset is a chain, vacuously, so it too must have an upper bound, and an upper bound is an element of MM.

Theorem 6.55 (Zorn's lemma).

Every inductively ordered set has at least one maximal element.

Discussion.

We state this without proof. It is not a theorem of the axioms we have listed: on the basis of the rest, Zorn’s lemma is equivalent to the axiom of choice, so proving it would amount to deriving one from the other, and the derivation is long enough to belong to a course in set theory rather than here. Note the form of the statement. The hypothesis is about chains, which are the totally ordered pieces of MM, and the conclusion is about a maximal element, which need not be a maximum: nothing says the element found is comparable with everything, only that nothing strictly exceeds it. In a partial order a maximal element need not be a maximum, which is why the conclusion is stated this way.

Remark.

The result is due to Kuratowski, though it carries Zorn’s name; Zorn proved the equivalence with choice and was the first to put the statement to work on algebraic questions.

Theorem 6.56 (Well-ordering theorem).

Every non-empty set can be ordered so that every non-empty subset has a least element.

Discussion.

Again we state without proof, for the same reason: on the basis of the other axioms the well-ordering theorem, Zorn’s lemma and the axiom of choice are all equivalent to one another. Of the three it is the hardest to believe. Well-ordering of N0\mathbb{N}_0 was a theorem we proved, resting on the successor structure; here the claim is that any set whatever admits such an order, however little structure it carries and however unlike the natural numbers it looks.

Remark (Informal).

Assuming you know the real numbers, they are not well-ordered by their usual order: the set of those greater than 00 has no least element, since any candidate is beaten by something smaller still above 00. The well-ordering theorem nevertheless asserts that some other order on them is a well-order. No such order has ever been exhibited, and none can be described explicitly; the theorem asserts that one exists and offers no way to find it.

That gap between existence and construction is what leads some mathematicians to reject the axiom of choice. Our position is to accept it, and to say plainly when we use it.

Problem 6.42.

Show that a maximal element need not be a maximum, by exhibiting a partially ordered set with two maximal elements. Show also that in a total order the two notions coincide.

Problem 6.43.

Let MM be a set and consider P(M)∖{M}\mathcal{P}(M) \setminus \{M\} ordered by inclusion. Show that it is inductively ordered when MM is non-empty, and identify its maximal elements.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 6.1.

Let S={1,2,3}S = \{1, 2, 3\}. Which of the three properties of Definition 6.2 does each relation on SS have?

R1=def{(1,1),(2,2),(3,3)}R_1 \defeq \{(1,1), (2,2), (3,3)\}.

answer one of these

R2=def{(1,2),(2,3)}R_2 \defeq \{(1,2), (2,3)\}.

answer one of these

R3=def{(1,2),(2,1)}R_3 \defeq \{(1,2), (2,1)\}.

answer one of these

R4=def(S×S)∖{(1,1)}R_4 \defeq (S \times S) \setminus \{(1,1)\}.

answer one of these

R5=def∅R_5 \defeq \emptyset.

answer one of these

Exercise 6.2.

Keep S={1,2,3}S = \{1,2,3\} and write RR for the relation R2R_2 above. In each line, the smallest relation on SS containing RR and having the stated property is:

Transitive.

answer one of these

Symmetric.

answer one of these

Reflexive. Its number of pairs is:

answer one of these

An equivalence relation.

answer one of these

Exercise 6.3.

Each line below is a relation on N0\mathbb{N}_0. Decide which are equivalence relations and which are strict linear orders.

m⩽nm \leqslant n.

answer one of these

m<nm < n.

answer one of these

m⋅m=n⋅nm \cdot m = n \cdot n.

answer one of these

mm and nn leave the same remainder on division by 33.

answer one of these

Exercise 6.4.

Let ∼\sim be an equivalence relation on {1,2,3}\{1, 2, 3\}.

Suppose ∼\sim has exactly three ordered pairs. Then ∼\sim is:

answer one of these

Can ∼\sim have exactly four ordered pairs?

answer one of these

The largest number of ordered pairs ∼\sim can have is:

answer one of these

For that ∼\sim, the induced partition is:

answer one of these

Exercise 6.5.

On {1,2,3,4}\{1,2,3,4\} take R=def{(1,1),(2,2),(3,3),(4,4),(1,3),(3,1),(2,4),(4,2)}R \defeq \{(1,1), (2,2), (3,3), (4,4), (1,3), (3,1), (2,4), (4,2)\}, which is an equivalence relation.

The class [1][1] is:

answer one of these

The quotient {1,2,3,4}/R\{1,2,3,4\}/R is:

answer one of these

Exercise 6.6.

Which of these are equivalence relations?

On the set of human beings, x∼yx \sim y when xx and yy weigh within one pound of each other.

answer one of these

On N\mathbb{N}, m∼nm \sim n when mm divides nn.

answer one of these

On N0\mathbb{N}_0, m∼nm \sim n when m⋅nm \cdot n is even.

answer one of these

On N0×N0\mathbb{N}_0 \times \mathbb{N}_0, (a,b)∼(c,d)(a, b) \sim (c, d) when b=db = d. This is an equivalence relation, and its blocks are:

answer one of these

On the set CC of solid-colour cars, x∼yx \sim y when xx and yy have the same colour. This is:

answer one of these

Exercise 6.7.

The order of Definition 6.32 and the cuts of Definition 6.37 .

The cut L0L_0 is:

answer one of these

The number of elements of L5L_5 is:

answer one of these

For a∈N0a \in \mathbb{N}_0, the set La∩RaL_a \cap R_a is:

answer one of these

The difference 3−73 - 7:

answer one of these

Exercise 6.8.

For each subset of N0\mathbb{N}_0 below, the minimum and the maximum, in the sense of Definition 6.20 , are:

{3,5,7}\{3, 5, 7\}.

answer one of these

The set of even numbers.

answer one of these

The set of odd numbers.

answer one of these

{n∈N0∣n⩾17}\{n \in \mathbb{N}_0 \mid n \geqslant 17\}.

answer one of these

{n∈N0∣n⩽100}\{n \in \mathbb{N}_0 \mid n \leqslant 100\}.

answer one of these

The set of multiples of 55.

answer one of these

Exercise 6.9.

Keep {3,5,7}\{3, 5, 7\} and {n∈N0∣n⩽100}\{n \in \mathbb{N}_0 \mid n \leqslant 100\} from the last exercise, with all bounds taken in N0\mathbb{N}_0.

The lower bounds of {3,5,7}\{3, 5, 7\} are:

answer one of these

Its upper bounds are:

answer one of these

The lower bounds of {n∈N0∣n⩽100}\{n \in \mathbb{N}_0 \mid n \leqslant 100\} are:

answer one of these

And its upper bounds are:

answer one of these

Exercise 6.10.

Let A=def{2,3,4,6,12}A \defeq \{2, 3, 4, 6, 12\}, ordered by divisibility, so that a⩽ba \leqslant b means that aa divides bb.

The minimal elements of AA are:

answer one of these

The maximal elements are:

answer one of these

As for a minimum and a maximum:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last sheet gave the checker a Peano system to compute in. This chapter needs two more things of it, and only one of them is new. A relation is a set of ordered pairs, and pairs, products and sets are all already there; the order on N0\mathbb{N}_0 is not, and arrives as notation below.

Relations

A relation on SS is a subset of S×SS \times S, so xRyx \mathbin{R} y is typed as the membership it abbreviates, (x, y) ∈ R. The three properties of Definition 6.2 are not names the checker knows; they are written out as the statements they are, so symmetry of RR enters a problem as the hypothesis

hs : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R

and is used by applying it to two objects and a membership, left to right: hs x y h.

One piece of notation is new. The separation axiom carves a subset out of a set by a criterion, and it is written {x ∈ A | p x}, with the membership criterion the axiom gives: y ∈ {x ∈ A | p x} is y ∈ A ∧ p y, in the way that x ∈ A ∩ B was a conjunction on an earlier sheet. So ⟨_, _⟩ builds a membership and .left and .right take one apart. This is what lets an equivalence class be written down: [a][a] of Definition 6.26 is {s ∈ S | (s, a) ∈ R}.

Example.

The universal relation on SS is reflexive. Membership in a product is a conjunction, and here both halves are the same hypothesis.

lean worked
1example (S x : Obj) (h : x ∈ S) : (x, x) ∈ S × S := by
verified
goalGoals accomplished.

Example.

Reflexivity puts aa in its own class. The two halves of the criterion are the two things the class asks of aa.

lean worked
1example (S R a : Obj) (hr : ∀ x : Obj, x ∈ S → (x, x) ∈ R) (ha : a ∈ S) :2    a ∈ {s ∈ S | (s, a) ∈ R} := by
verified
goalGoals accomplished.

Exercise 6.11.

The empty relation is symmetric and transitive.

lean proof
1example (x y z : Obj) :2    ((x, y) ∈ ∅ → (y, x) ∈ ∅) ∧ ((x, y) ∈ ∅ → (y, z) ∈ ∅ → (x, z) ∈ ∅) := by
goalx y z : Obj ⊢ ((x, y) ∈ ∅ → (y, x) ∈ ∅) ∧ ((x, y) ∈ ∅ → (y, z) ∈ ∅ → (x, z) ∈ ∅)

Exercise 6.12.

And the universal relation is transitive.

lean proof
1example (S x y z : Obj) (h1 : (x, y) ∈ S × S) (h2 : (y, z) ∈ S × S) : (x, z) ∈ S × S := by
goalS x y z : Obj h1 : (x, y) ∈ S × S h2 : (y, z) ∈ S × S ⊢ (x, z) ∈ S × S

Exercise 6.13.

Symmetry and transitivity give reflexivity, but only at the elements the relation already reaches.

lean proof
1example (R x y : Obj)2    (hs : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R)3    (ht : ∀ a b c : Obj, (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R)4    (h : (x, y) ∈ R) : (x, x) ∈ R ∧ (y, y) ∈ R := by
goalR x y : Obj hs : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ R → (b, a) ∈ R ht : ∀ (a : Obj), ∀ (b : Obj), ∀ (c : Obj), (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R h : (x, y) ∈ R ⊢ (x, x) ∈ R ∧ (y, y) ∈ R

Exercise 6.14.

The first half of Problem 6.3 , with TT written out.

lean proof
1example (S R x y : Obj)2    (hs : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R)3    (ht : ∀ a b c : Obj, (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R)4    (hx : x ∈ S) (h : (x, y) ∈ R) : x ∈ {t ∈ S | (t, t) ∈ R} := by
goalS R x y : Obj hs : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ R → (b, a) ∈ R ht : ∀ (a : Obj), ∀ (b : Obj), ∀ (c : Obj), (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R hx : x ∈ S h : (x, y) ∈ R ⊢ x ∈ {t ∈ S | (t, t) ∈ R}

Exercise 6.15.

Symmetry survives intersection.

lean proof
1example (R Q x y : Obj)2    (hR : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R)3    (hQ : ∀ a b : Obj, (a, b) ∈ Q → (b, a) ∈ Q)4    (h : (x, y) ∈ R ∩ Q) : (y, x) ∈ R ∩ Q := by
goalR Q x y : Obj hR : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ R → (b, a) ∈ R hQ : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ Q → (b, a) ∈ Q h : (x, y) ∈ R ∩ Q ⊢ (y, x) ∈ R ∩ Q

Exercise 6.16.

Proposition 6.22 , with the order written as a relation LL and antisymmetry as a hypothesis.

lean proof
1example (S L m n : Obj)2    (hanti : ∀ a b : Obj, (a, b) ∈ L → (b, a) ∈ L → a = b)3    (hm : m ∈ S ∧ ∀ x : Obj, x ∈ S → (m, x) ∈ L)4    (hn : n ∈ S ∧ ∀ x : Obj, x ∈ S → (n, x) ∈ L) : m = n := by
goalS L m n : Obj hanti : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ L → (b, a) ∈ L → a = b hm : m ∈ S ∧ (∀ (x : Obj), x ∈ S → (m, x) ∈ L) hn : n ∈ S ∧ (∀ (x : Obj), x ∈ S → (n, x) ∈ L) ⊢ m = n

Exercise 6.17.

The step 2  ⟹  12 \implies 1 of Proposition 6.28 : classes that meet come from related elements.

lean proof
1example (S R a b c : Obj)2    (hs : ∀ x y : Obj, (x, y) ∈ R → (y, x) ∈ R)3    (ht : ∀ x y z : Obj, (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R)4    (h : c ∈ {s ∈ S | (s, a) ∈ R} ∩ {s ∈ S | (s, b) ∈ R}) : (a, b) ∈ R := by
goalS R a b c : Obj hs : ∀ (x : Obj), ∀ (y : Obj), (x, y) ∈ R → (y, x) ∈ R ht : ∀ (x : Obj), ∀ (y : Obj), ∀ (z : Obj), (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R h : c ∈ {s ∈ S | (s, a) ∈ R} ∩ {s ∈ S | (s, b) ∈ R} ⊢ (a, b) ∈ R

Exercise 6.18.

And the step 1  ⟹  31 \implies 3, which is an equality of sets.

lean proof
1example (S R a b : Obj)2    (hs : ∀ x y : Obj, (x, y) ∈ R → (y, x) ∈ R)3    (ht : ∀ x y z : Obj, (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R)4    (h : (a, b) ∈ R) : {s ∈ S | (s, a) ∈ R} = {s ∈ S | (s, b) ∈ R} := by
goalS R a b : Obj hs : ∀ (x : Obj), ∀ (y : Obj), (x, y) ∈ R → (y, x) ∈ R ht : ∀ (x : Obj), ∀ (y : Obj), ∀ (z : Obj), (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R h : (a, b) ∈ R ⊢ {s ∈ S | (s, a) ∈ R} = {s ∈ S | (s, b) ∈ R}

The order on the natural numbers

ℕ is the carrier of the last sheet, and the order is written ≤ and <, typed \le and <. Neither is a name in the library: they are the definitions of Definition 6.32 and Proposition 6.35 outright, so

m ≤ n   is   ∃ b : ℕ, n = m + b
m < n   is   ∃ b : ℕ, b ≠ 0 ∧ n = m + b

and every tactic for an existential acts on them unchanged: use supplies the difference, obtain ⟨b, hb, he⟩ takes a strict inequality apart into a positive bb and the equation it satisfies, and obtain ⟨b, he⟩ does the same for a non-strict one. The reverse orders > and ≥ are these two read backwards, as Definition 6.14 has them. Numerals are still spelled as the last sheet spelled them, so 11 is succ 0.

Example.

The difference that makes an element reach itself is 00, and the first clause of addition checks it.

lean worked
1example (n : ℕ) : n ≤ n := by
verified
goalGoals accomplished.

Example.

Corollary 6.33 . Once the difference is named, one half is the hypothesis and the other holds of itself.

lean worked
1example (x y : ℕ) (h : y ≠ 0) : x < x + y := by
verified
goalGoals accomplished.

Exercise 6.19.

The second half of Proposition 6.36 .

lean proof
1example (n : ℕ) : 0 ≤ n := by
goaln : ℕ ⊢ 0 ≤ n

Exercise 6.20.

Every element is below its successor.

lean proof
1example (n : ℕ) : n < succ n := by
goaln : ℕ ⊢ n < succ n

Exercise 6.21.

A positive difference is a difference.

lean proof
1example (m n : ℕ) : m < n → m ≤ n := by
goalm n : ℕ ⊢ m < n → m ≤ n

Exercise 6.22.

Proposition 6.8 , proved here from uniqueness of differences rather than from trichotomy.

lean proof
1example (n : ℕ) : ¬(n < n) := by
goaln : ℕ ⊢ ¬n < n

Exercise 6.23.

Transitivity: two positive differences compose into one.

lean proof
1example (m n p : ℕ) : m < n → n < p → m < p := by
goalm n p : ℕ ⊢ m < n → n < p → m < p

Exercise 6.24.

Antisymmetry, which is the second law of Proposition 6.11 .

lean proof
1example (m n : ℕ) : m ≤ n → n ≤ m → m = n := by
goalm n : ℕ ⊢ m ≤ n → n ≤ m → m = n

Exercise 6.25.

No comparison points both ways.

lean proof
1example (m n : ℕ) : m < n → ¬(n < m) := by
goalm n : ℕ ⊢ m < n → ¬n < m

Exercise 6.26.

The first part of Problem 6.16 .

lean proof
1example (x y z : ℕ) : x ≤ y → x + z ≤ y + z := by
goalx y z : ℕ ⊢ x ≤ y → x + z ≤ y + z

Exercise 6.27.

And the second, with the factor on the left so that distributivity applies as it stands.

lean proof
1example (x y z : ℕ) : x ≤ y → z * x ≤ z * y := by
goalx y z : ℕ ⊢ x ≤ y → z * x ≤ z * y

Exercise 6.28.

Problem 6.15 . Both directions move a successor between the two sides of a sum.

lean proof
1example (m n : ℕ) : m < n ↔ succ m ≤ n := by
goalm n : ℕ ⊢ m < n ↔ succ m ≤ n

Exercise 6.29.

Problem 6.17 .

lean proof
1example (m n p q : ℕ) : m < n → p < q → m + p < n + q := by
goalm n p q : ℕ ⊢ m < n → p < q → m + p < n + q

Exercise 6.30.

Proposition 6.39 . (Harder.)

lean proof
1example (n x : ℕ) : n < x → ¬(x < succ n) := by
goaln x : ℕ ⊢ n < x → ¬x < succ n
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor
Nat.add_right_cancel ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet
Nat.add_eq_zero ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet
Nat.mul_comm ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet
Nat.mul_add ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet
Nat.mul_assoc ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter
Nat.add_mul ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side
Nat.add_left_cancel ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences
Nat.lt_trichotomy ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b