Lesson 5
Natural Numbers
Taught
Natural Numbers
The Set of Natural Numbers
The starting point of our journey shall be the counting numbers, and so on. We are all convinced that such a collection exists, and yet a little reflection leads quickly to thoughtfulness. Do not some cosmological theories hold that our universe is finite? If so, and if every elementary particle occupies a non-vanishing, indivisible volume, must not the number of particles be finite? Where then is room for this obviously infinite set? Or, much more primitively, how does one so much as name
Following preliminary work by Dedekind, it was Peano who in 1889 codified our notion of the counting numbers as a successive progression from an origin. Rather than say what a number is, he left the first number and the successor rule undefined, and asked instead which conditions would force the resulting system to hold exactly the objects we want. We follow him, taking the distinguished first element to be .
The Axiom of Infinity
At the close of the last chapter we watched the passage from to generate
and noted that our axioms build each of these but no set holding all of them at once. That gap is closed by naming the property such a set would have. Throughout we write and call it the successor of .
Definition 5.1 (Inductive set).
A set is inductive if and for every .
An inductive set exists: .
The notation is meaningful by the pairing and union axioms. Note that what it asserts is also new: every earlier axiom builds a set from sets already held, and none guarantees the existence of a set with infinitely many members. An inductive set may be far larger than the chain above, holding all manner of things besides; in our case we want the chain, so we take the smallest inductive set there is.
Definition 5.3 (The natural numbers).
Let be an inductive set. We write for the intersection of all inductive subsets of ,
and . The elements of are the natural numbers.
The collection being intersected is a set by comprehension applied to , and it is non-empty, since is one of its members; the intersection of a system then does the rest. Writing , , and so on, we have
Remark (Where to start).
Whether counts as a natural number is a matter of convention rather than of mathematics, and both choices are in use. We keep as the first natural number, which is the older habit and the one that makes “natural number” mean “counting number”, and carry the zero explicitly when we need it. Peano’s system needs a distinguished element with no predecessor, so it is rather than that the axioms below describe.
Proposition 5.4 (Zero belongs to ).
.
Discussion.
Membership in is membership in every inductive subset of , so there is nothing to construct: we take an arbitrary such subset and read off what being inductive already says about it. The first clause of that definition puts in it, and since the subset was arbitrary the conclusion follows for the intersection.
Proof.
Let be an arbitrary inductive subset of . Then by the definition of an inductive set. Since was arbitrary, belongs to every inductive subset of , and so .
Proposition 5.5 (Closure under successors).
If , then .
Discussion.
The same move again, one step further along. Assuming and taking an arbitrary inductive subset of , the definition of the intersection puts in , and the second clause of inductiveness carries it to . As was arbitrary, lies in every inductive subset, which is membership in .
Proof.
Suppose and let be an arbitrary inductive subset of . Then , and so by the definition of an inductive set. Since was arbitrary, belongs to every inductive subset of , hence .
The two propositions together say that is itself inductive, and by its very definition it lies inside every inductive subset of . It is the smallest inductive set of all, and that is exactly what makes induction work.
Theorem 5.6 (Induction for sets).
Let with and whenever . Then .
Discussion.
We prove the equality by two inclusions, and one of them is the hypothesis. The two conditions on are word for word the definition of an inductive set, so is one of the subsets being intersected, and the intersection is contained in each of them; that gives and finishes it.
Proof.
The two hypotheses say precisely that is inductive, and , so is an inductive subset of . The intersection defining is contained in each set intersected, so . With from the hypothesis, mutual inclusion gives .
The theorem speaks about a subset, but an induction proof usually begins with a predicate. The two describe the same problem: membership in a fixed set is a predicate, and conversely a predicate determines the subset , so proving of every natural number is proving that this subset is everything.
Theorem 5.7 (Induction for predicates).
Let be a predicate on with true and for every . Then holds for every .
Discussion.
We pass from the predicate to the set it cuts out and apply the previous theorem. Put , a set by comprehension. The first hypothesis is and the second is closure of under , which are the two conditions the previous theorem asks for, so ; and that says holds everywhere.
Proof.
Let . By the first hypothesis . If , then holds, so holds by the second hypothesis and . The previous theorem forces , which says that holds for every .
Let and be inductive sets.
- Show that is inductive.
- Would your argument work for three inductive sets? For a thousand? For a family indexed by an arbitrary non-empty set?
The definition of began by choosing an inductive set , and nothing so far says the answer does not depend on that choice. It does not, and the reason is that is smaller than every inductive set, not merely than the inductive subsets of .
Proposition 5.8 (The least inductive set).
is inductive, and for every inductive set .
Discussion.
That is inductive is the two propositions above read together, one supplying and the other closure under . The second claim is the delicate half, since an arbitrary inductive need not be a subset of and so is not among the sets we intersected. The problem above repairs that: is inductive, and it is a subset of , so it is one of the sets intersected and therefore holds . Being inside puts inside .
Proof.
The propositions above give and closure under , which is what it means for to be inductive.
Now let be any inductive set. By the problem above is inductive, and , so is an inductive subset of and hence one of the sets whose intersection defines . An intersection is contained in each set intersected, so .
Corollary 5.9 (The construction does not depend on the choice).
Let and be inductive sets, and let and be built from them as above. Then .
Proof.
Both are inductive by the proposition, and both are contained in every inductive set, so and . Mutual inclusion gives the equality.
One more fact about the successor is worth having before we leave it, since it says exactly how much adds.
Proposition 5.10 (The successor is the next set up).
For every set we have , and there is no set with .
Discussion.
The inclusion is immediate, since is a union with as one of its parts. For the second claim we take any with and show it must be one of the two ends, which is the same thing as saying nothing sits strictly between them. Either adds nothing to , in which case the two inclusions make ; or it holds something outside , and that something has nowhere to be but itself, since the only element of outside is . Then , and with already in hand every element of lies in .
Proof.
Since , every element of lies in , so .
Now let satisfy . If , then with we get . Otherwise some has ; since , this forces , so . Together with this puts every element of in , that is, , and so . Hence is or , and no satisfies .
Peano Systems
Definition 5.11 (Peano system).
A Peano system is a set together with a distinguished element and a map , called the successor, satisfying
- ;
- whenever ;
- if , then ;
- for every ;
- if , , and whenever , then .
We write it .
The first two conditions are what it means for to be a function from to with a member of the domain; the third says is injective, and the fourth that lies outside its range.
In any Peano system we write , , , and so on, the symbols recording positions in the successor chain and nothing more.
The first two conditions let us start at and keep taking successors, producing , , , and so on. The last two prevent repetitions among what is produced: were two of them equal, repeated use of the third condition would strip successors from both sides until the fourth was contradicted. So holds infinitely many distinct elements. What we do not yet know is whether it holds anything else.
Reading the construction back gives the familiar symbols as sets:
and so on, each of these sets holding exactly its predecessors.
The fifth condition is not idle. Take to be the real numbers with , with the usual and . The first four conditions all hold, yet lies in and is reached by no finite string of successors from . It is the fifth that fails: the subset consisting of and the counting numbers holds , and holds whenever it holds , yet .
The fifth condition is the principle of induction, and Peano’s contribution was to place it inside the structure of the numbers rather than treat it as a proof technique arriving from outside. Its predicate form is the theorem proved above, transported to an arbitrary Peano system by the same passage from a predicate to the subset it cuts out.
Theorem 5.14 (The natural numbers form a Peano system).
is a Peano system.
Discussion.
Four of the five conditions are already in hand. The first two are the two propositions above, and the fifth is induction for sets. What is left is the third and fourth, and neither follows from minimality alone: they are claims about the particular successor , not about smallness. The fourth is quick, since always holds and so is never empty. The third asks that force , and the route to it runs through the observation that every element of is also a subset of it, which is itself proved by induction. Both are left to the problems below.
Proof.
The first condition is the proposition that , the second is closure under successors, and the fifth is induction for sets. The third and fourth are the two problems below.
Show that for every set , which is the fourth condition for .
Call a set transitive if every element of is also a subset of .
- Prove by induction that every element of is transitive.
- Deduce that if for , then , which is the third condition.
Let with distinguished, and define , , and . Which of the five conditions does this system satisfy? For each one that fails, exhibit the failure.
The numerals are nothing but names for positions in the chain, so even the most obvious-looking facts about them have to be earned from the five conditions. The next three propositions earn the first of them.
Proposition 5.15 (Three is a natural number).
.
Discussion.
There is nothing to do but walk along the chain. The first condition puts in , and the second carries membership from any element to its successor, so we apply it three times, at , at and at . Nothing else is available and nothing else is needed.
Proof.
By the first condition . By the second, . By the second again, , and once more, .
Proposition 5.16 (Four is not zero).
.
Discussion.
Do not laugh. Because of the way has been defined, as the successor of the successor of the successor of the successor of , it is not true a priori that it differs from , however obvious that looks; a system in which the chain closes back on itself would have , and the problems below give one. What rules it out here is the fourth condition, which says no element of has as its successor. To apply it we need to be an element of , which is the previous proposition.
Proof.
By definition , and by the previous proposition. The fourth condition gives , that is, .
Proposition 5.17 (Six is not two).
.
Discussion.
Here the fourth condition does not apply directly, since neither number is . Instead we work backwards down the chain with the third condition, which strips a successor from both sides of an equation: assuming gives , hence , hence , hence . That is what the previous proposition forbids, so the assumption cannot stand. This is the pattern promised earlier, that repeated use of the third condition drives any coincidence down to a contradiction with the fourth.
Proof.
Suppose, for contradiction, that . Then , so the third condition gives . Then , so the third condition gives , contradicting the previous proposition. Hence .
Predecessors
In a Peano system, . Consequently every element other than is the successor of exactly one element.
Discussion.
We prove the equality by two inclusions. The fourth condition gives at once, since no successor is . For the reverse inclusion we cannot chase an element directly, since being non-zero says nothing about where an element came from; instead we put and let induction do the work. This holds by construction and is closed under because every lies in , so the fifth condition forces , and every non-zero element is therefore a successor. The uniqueness of the predecessor is then the third condition.
Proof.
Let . Then , and if then , so by the fifth condition. Thus every lies in , while does not by the fourth, and so .
If , then by the third condition, so the element producing is unique.
The pairs of can therefore be read backwards. Regarded as a map onto , the successor is surjective by the theorem and injective by the third condition, so it is a bijection, and invertibility supplies an inverse
the predecessor map, satisfying and . This shortens the axiom list: in place of the second, third and fourth conditions we may simply demand that be a bijection.
Corollary 5.19 (No element is its own successor).
In a Peano system, for every .
Proof.
Let . By the fourth condition , so . Suppose . If , then by the third condition, contradicting ; hence . By the fifth condition, .
Induction Without Order
In the counting numbers we expect every non-empty subset to have a least element, but least is an order notion and a Peano system carries no order. The property can still be said without one: a non-empty subset ought to hold an element that the subset cannot reach by a successor step, an element where it starts.
Theorem 5.20 (Induction without order).
Let be a set with an element and let be a bijection. Then the following are equivalent.
- The only subset of holding and closed under is itself.
- Every non-empty subset holds an element with .
Discussion.
We prove both implications by contradiction, since each hypothesis is a statement about all subsets and offers nothing to build with directly. Suppose the first holds and the second fails. Then some non-empty satisfies , and we pass to the complement : the codomain of excludes , which puts in , and injectivity shows is closed under , so the first condition makes and empty. Conversely, suppose the second holds and some proper holds and is closed under . The complement is non-empty, so it has a starting element , which is not and is therefore for some by surjectivity. Asking where lives contradicts the choice of either way.
Proof.
Suppose the second statement fails for the non-empty set , so , and put . If , then , which is impossible since the codomain of is ; hence . Let and suppose . Then , so for some , and injectivity gives , contradicting . Thus holds and is closed under , so by the first statement and , a contradiction.
Conversely, let hold and be closed under , and suppose . Then is non-empty, and the second statement provides with . Since we have , so surjectivity gives for some . If , then , against the choice of ; if , then by closure, against . Neither is possible, so no such exists.
Note that
Guess the general law suggested here and prove it by induction.
Note that , that , and that . Guess the general law suggested here and prove it by induction.
Note that , that , and that . Guess the general law suggested here and prove it by induction.
For every with , guess a general law which simplifies the product
and prove it by induction.
Recursion
We now turn to a deeper question: in what sense are the natural numbers unique? The elements of two Peano systems may look completely different, yet the conditions pin down everything except the names. Any two are linked by a relabelling that respects the only structure present, the zero and the successor:
Whatever the relabelling is, it must send to , hence to , and so on down the ladder. What the picture does not show is that the instruction “start at and keep applying ” genuinely defines a map on all of . Turning such an instruction into a function is called recursion, or inductive definition.
One piece of language first. Given maps , , and , we draw
and call the square commutative if , that is, if the two routes from to agree. A larger diagram, like the ladder above, is commutative when every square inside it is.
Theorem 5.21 (Recursion theorem).
Let be a Peano system, let be a set with an element , and let . Then there is exactly one map with and ; that is, exactly one sending to and making the square
commute.
Discussion.
Pointwise the commuting square says , so the map is prescribed at and prescribed one step at a time thereafter. We must prove both uniqueness and existence, and they need different tools. Uniqueness is induction: for two candidates, the set where they agree holds and is closed under , so the fifth condition makes it all of . Existence cannot be induction, since there is no map yet to induct on; instead we build the map as a set of pairs. Call admissible when it holds and sends each to , and let be the intersection of all admissible subsets, which is admissible in its turn and sits inside every one of them. By the definition of a function it remains to show that each occurs in exactly one pair of , and both halves of that are inductions. The second half turns on a deletion argument: a pair not forced by the closure rule can be removed, leaving a smaller admissible set, which contradicts the minimality of ; the fourth and third conditions are what make the two deletions legitimate.
Proof.
For uniqueness, let and both satisfy the two requirements and put . Since we have , and if then , so . By the fifth condition , that is, .
For existence, call admissible if and whenever . The whole of is admissible, so the admissible sets form a non-empty collection, carved from by comprehension; let be its intersection, which is admissible in turn and lies inside every admissible set. We claim each appears in exactly one pair of ; by the definition of a function the claim makes a function , and admissibility then reads and .
That each appears in some pair is an induction on : admissibility puts , so , and if then , so is closed under .
That no appears twice is an induction on . The move throughout is that a pair not forced by the closure rule may be deleted from , leaving a set which is still admissible yet strictly smaller than the smallest admissible set, a contradiction.
For the base step, suppose with , and delete it. The set still holds , and it is still closed, since every pair the rule produces has first coordinate , which is never by the fourth condition. Hence no such exists and .
For the inductive step, let appear only in the pair , suppose with , and delete it. Again survives, by the fourth condition. For closure, take a surviving pair ; the rule demands , and this survived too: if it is not the deleted pair, while if then by the third condition, so by the choice of and . The same contradiction forbids , so appears only in and . By the fifth condition, .
Theorem 5.22 (Uniqueness of Peano systems).
Let and be Peano systems. Then there is exactly one bijection with making the square
commute.
Discussion.
The recursion theorem does the work, applied with , and : it hands us a unique map with and , and any bijection meeting the requirements must be that map, so only bijectivity is left to prove. We get it by producing an inverse rather than by checking injectivity and surjectivity separately. Applying the theorem again with the two systems exchanged gives , and the composite sends to and commutes with , so it solves the same recursion problem on as the identity does; uniqueness identifies the two. The same argument on the other side finishes it.
Proof.
Applying the recursion theorem with , and gives exactly one map with and ; it remains to prove bijective. Exchanging the systems gives likewise a unique with and .
Put . Then , and associativity of composition lets us compute without brackets:
So solves the recursion problem on with and ; so does ; and by the uniqueness clause . The same argument with the systems exchanged gives . Hence is an inverse of , and is bijective by invertibility.
The condition costs nothing, incidentally: any bijection with already sends to . Otherwise surjectivity would provide some with , the theorem on predecessors would write , and then would exhibit as a successor in , against the fourth condition.
So there is, up to relabelling, only one system of natural numbers. Whether we take the Hindu-Arabic symbols , the Roman ones augmented with a zero, or the nested empty sets of the example above, the arithmetic that follows is the same.
Arithmetic
The recursion theorem lets us define arithmetic inside any Peano system, with no arithmetic assumed from outside.
Anything worth calling addition should satisfy , should be associative, and should have as an identity. Those demands leave no room to manoeuvre, since the first two give
which determines for every once is fixed. Whether anything satisfies them is a separate question, and recursion answers it.
Let be a Peano system and let . The recursion theorem applied with , and yields exactly one map with and . We write , so that
The wish is granted: . The defining clauses absorb a or an on the right of a sum; the laws of addition will need the same moves on the left.
Proposition 5.24 (Addition from the left).
For all , we have and .
Discussion.
We induct on the right-hand variable in both, since that is the position the defining clauses speak about. For the first, the base case is the clause read at , and the step uses the other clause: . For the second, fix and take the statement . Its base case reduces both sides by the first clause. For the step, apply the successor clause on the left, replace by using the hypothesis, and apply the clause once more. As was arbitrary throughout, the result holds for all and .
Proof.
Let . Since we have , and if then , so . By the fifth condition .
Now fix and let . Since we have . If , then
so . By the fifth condition , and since was arbitrary the identity holds throughout.
Theorem 5.25 (Laws of addition).
For all , we have and .
Discussion.
Both are inductions on the variable sitting in the right-hand position of a sum, where the definition applies. For associativity, fix and and take the statement ; its base case reduces both sides by , and its step rewrites the left as , applies the hypothesis, and uses the successor clause twice to arrive at . For commutativity, fix and take ; the base case is , which needs the first identity of the preceding proposition, and the step turns into , applies the hypothesis, and then uses the second identity to reach . Neither induction would close without that proposition, since both steps have to move a successor across to the left of a sum.
Proof.
Fix and let . Both and equal , so . If , then
so , and by the fifth condition.
Next fix and let . The preceding proposition gives , so . If , then
using that proposition again at the last step, so . By the fifth condition , and since was arbitrary the identity holds throughout.
Definition 5.26 (Positive elements).
An element of a Peano system is positive if .
Proposition 5.27 (Positivity is absorbing).
If is positive and , then is positive.
Discussion.
We induct on , since the defining clauses of addition speak about the right-hand variable. The base case is , which is positive by hypothesis. For the step, the successor clause turns into , and the fourth condition says no successor is , so the conclusion needs nothing from the inductive hypothesis at all.
Proof.
Let . Since and is positive, . If , then , which is not by the fourth condition, so . By the fifth condition .
Corollary 5.28 (A sum is zero only when both parts are).
If satisfy , then and .
Proof.
Suppose . Then is positive, so is positive by the proposition, contradicting . Hence , and by commutativity the same argument gives .
Define multiplication in a Peano system by the clauses and . Show that these clauses do define a map from to .
Using the previous problem, prove that for all :
- ;
- ;
- ;
- ;
- .
Proposition 5.29 (Positive elements are closed under addition and multiplication).
Let and be positive elements of a Peano system, with multiplication as in the two problems above. Then and are positive.
Discussion.
The sum is Proposition 5.27 read at a positive , which asked no more of than that it be an element at all. The product needs one further move. Being positive, is not , so the theorem on predecessors writes it as for a unique , and the second clause of the multiplication problem turns into . That is a sum whose left part we know nothing about and whose right part is positive, which is exactly the situation Proposition 5.27 handles, once commutativity puts the positive part in front. No induction is needed: the predecessor supplies the single step the definition wants.
Proof.
That is positive is Proposition 5.27 , since is positive.
For the product, , so the theorem on predecessors gives for some . Then by the second clause of the multiplication problem, and by commutativity of addition. Since is positive, Proposition 5.27 makes positive, so is positive.
Write for the positive elements of a Peano system, and recall . Show that every with is for some . Why does the argument need , and not merely ?
Let . Use the recursion theorem, with a starting element and a map of your choosing, to produce a unique map satisfying
written for . Prove directly from the clauses that , and, writing , compute , and from the definitions alone.
Let satisfy . Prove that for every . No commutativity is needed.
Let .
- Prove that if , then .
- Deduce that implies .
- Show that if with positive, then .
Prove that for all , and that the map sending to is the unique one with , and for all .
Sums
Induction has so far done the necessary work of establishing properties of the natural numbers. Before going further, it is worth seeing the recursion theorem carry a load it cannot quite manage as it stands.
Imagine defining the running totals , the sum of everything up to . Once is found, the next total should be : the old total is kept and the next term added. That update needs both the previous value and the index, whereas the recursion theorem applies a fixed map to the previous value alone and never sees where it is. The gap is easily closed by carrying the index along.
Proposition 5.30 (Parametrised recursion).
Let be a Peano system, let be a set with an element , and let . Then there is exactly one map with
Discussion.
The recursion theorem hands the next value a single argument, the previous value, while wants two. So we make the previous value carry its own index: apply the theorem on rather than on , starting at and stepping by . That gives a map , and an induction shows its first coordinate at is always itself, so the second coordinate is the we want. Uniqueness goes the same way in reverse: any rival can be paired with its index to give a rival , which solves the same recursion problem on and is therefore by the uniqueness already proved.
Proof.
Apply the recursion theorem with target set , initial element , and the map sending to . It gives a unique with and whenever .
Let be the set of for which for some . Since we have ; and if with , the displayed equation gives , so . By the fifth condition .
For each write . Then , and the defining equation for reads .
If is another map with these two properties, let . Then and , so solves the same recursion problem as ; the uniqueness clause of the recursion theorem gives , and comparing second coordinates gives .
Before using sums we should say what the dots are doing. In
they leave the middle terms to the pattern made visible by the terms around them. This is a convention for readers, not a definition: determines nothing without further context. What follows replaces the convention by a recursion, so that the expression means something whether or not the pattern is visible.
Proposition 5.31 (The summation symbol).
Let be a Peano system with addition, and let be a map, written for . Then there is exactly one map with
We write for , so that the two clauses read
Discussion.
The update needs the index as well as the running total, since it is the index that says which term comes next, so this is parametrised recursion rather than the plain kind. We take , initial element , and , which is a map from to because addition is. The two clauses of the proposition are then exactly the two the previous result delivers, and its uniqueness clause gives ours.
Proof.
Apply parametrised recursion with , initial element , and given by . It supplies exactly one map with and , which are the two clauses asserted.
The limits carry no order with them: nothing here says that runs through the elements between and , only that the recursion starts at and steps by . Once an order is available the notation will mean what it looks like it means.
The index is bound by the symbol and may be renamed at will, so that
while may not be renamed, since the value depends on it. The value is the empty sum, worth keeping both because it starts the recursion and because it spares us a separate case whenever a sum is allowed to run out of terms. Notice too that the clauses fix one reading of , the one that brackets from the left; that any other bracketing gives the same element is a consequence of the laws of addition, and we leave it to a problem.
Show that there is exactly one map with and for every , where multiplication is as defined in the problems above, and write for . Which clause takes the place of the empty sum, and why is that the right choice?
Argue from the defining clauses alone.
- Let for every . Prove that and for every .
- Let for every , so that the sum is the running total of everything up to . Prove that
Prove that
stating carefully what the second sum on the right means as a recursion in its own right. Where do the laws of addition enter?
Let and be Peano systems, each carrying the addition of Definition 5.23 and the multiplication of Problem 5.9 , and let be the bijection of Theorem 5.22 . Prove that and for all .
Let be a Peano system with multiplication.
- Produce a map with and for every .
- Show that there is no with for every , and deduce that Theorem 5.21 taken with cannot produce .
Let be a non-empty set and let . Taking for the set of all maps from to itself, use Theorem 5.21 to produce the iterates of , characterised by and for every .
- Suppose for some . Determine and , with proof.
- Suppose instead that . Determine , with proof.
- Find a map with , , and .
- Decide whether there is a map with , and .
Let be maps, written for and for , and let . Prove that for every :
- ;
- ;
- if for every , then .
Let denote the statement .
- Prove that if holds for some , then holds.
- Criticise the statement: “by induction it follows that holds for every ”.
- Determine which , if any, satisfy .
Work in a Peano system with addition, multiplication and the powers of Problem 5.12 .
- Prove that for every .
- Deduce that .
The Fibonacci numbers are , each after the second being the sum of the two before it.
- Produce exactly one map with and for every , writing for .
- Prove that for every exactly one of
holds, and that which of the two holds changes at every step.
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.
The numerals, read back as the sets they were built from.
The set is:
The number of elements of the set is:
Of the two statements and :
Inductive sets.
The set of natural numbers proper is:
And is:
Let be any inductive set. Then is:
Each line below alters in one place. Say which of the five conditions the result fails.
The successor is replaced by .
The carrier is cut down to , keeping , with distinguished in place of .
The successor is left alone except at , where .
Starting elements. Work in an arbitrary Peano system .
The elements that are not successors are:
Induction without order gives every non-empty an element with . For that element is:
And for :
What the recursion theorem produces. Take throughout, with the addition and multiplication of the chapter.
With and , the map is:
With and , it is:
Relabelling. Let and be Peano systems.
Let satisfy and . Then is:
Drop the condition at . The number of maps with is then:
And the number of those that are bijections is:
Arithmetic in a Peano system.
The product is:
Suppose with positive. Then:
Sums.
The result that defines is:
With , the element is:
In the expression :
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 pairs, products, maps, and the sets the pairing axiom lists. This one adds a Peano system to compute in.
The successor
A listed set is typed as it is written, {x} and {x, y}, and its membership criterion is the one the axiom gives: y ∈ {x} is y = x, in the way that x ∈ A ∩ B was a conjunction on an earlier sheet. So the successor needs no notation of its own; it is x ∪ {x}.
Example.
The membership and the equation are one statement, so nothing has to be done to pass between them.
Example.
A union is a disjunction, and its right half is an equation that holds of itself.
The first half of Proposition 5.10 .
The fourth Peano condition for .
Two inductive sets, and their intersection.
Transitivity passes to the successor, which is the step of the induction that makes every element of transitive.
The second half of Proposition 5.10 : a set between and its successor which reaches outside is the successor.
And the third Peano condition, which transitivity was proved for.
A Peano system
ℕ is now read as the carrier , with 0 its distinguished element and succ its successor. Nothing about the sets and survives the change: what a proof may use is the five conditions and nothing else. Two of them have names, Nat.succ_inj for the third and Nat.succ_ne_zero for the fourth. The fifth is a tactic.
induction
induction n with k ih is the fifth condition applied to the set of at which the goal holds. It leaves two goals: the goal at 0, and the goal at succ k with ih recording it at k. Prove them under focus dots, as with any pair of goals.
Addition and multiplication arrive as their defining clauses, Nat.add_zero and Nat.add_succ, Nat.mul_zero and Nat.mul_succ. A clause may be cited bare: rw [Nat.add_succ] finds the first ?m + succ ?n in the goal and reads the two off it, and rw [Nat.add_succ m n] names them.
Example.
Two clauses, in the order the sum is peeled: the successor first, then the zero underneath it. rw closes what is left when both sides come out the same.
Example.
The first half of Proposition 5.24 . It is listed below as Nat.zero_add, along with the rest of what the lecture proved, so the exercises may lean on it.
One is not zero.
A successor may be moved from one side of a sum to the other.
Addition cancels.
Nothing but zero can be added without moving.
A map commuting with the successor is a translation. No commutativity is needed.
Multiplication from the left, at zero.
And one is an identity on the right.
Multiplication from the left, at a successor. The two clauses only ever act on the right, so this is where the work is.
Multiplication distributes over addition.
And it commutes, once both sides can be peeled.
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 |
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 |