0

Background

I have been learning to write simple proofs in Lean/Mathlib, and recently learn to write simple induction proofs. This different perspective clarified a gap in my understanding.

Question

There is a connection between simple induction proofs and the recursive definition of natural numbers.

  • The base case corresponds to the definition of zero.
  • The inductive step (implication) corresponds to the recursive definition of a successor of a natural number as another natural number.

I am vaguely / intuitively content with this, but I don't think I understand why precisely enough to be able to write it down or explain it to someone else.

I'd welcome an explanation of this connection.

Please note that I am not advanced in mathematics - I didn't study it at university and am self-teaching, so explanations will ideally avoid higher-level terminology.

Thoughts

My own attempts to solve this lead me to think:

  • Proving a proposition $P(n)$ holds for $n=0$, the base case, doesn't have anything to do with recursive definitions. There's nothing special here.

  • Proving $P(n) \implies P(n+1)$ means we've shown the property holds for $P(n+1)$ if holds for $P(n)$ - but we haven't proven that $n+1$ exists - that requires the recursive definition of natural numbers.

So, in my unclear thinking, $P(0) \land P(n)\implies P(n+1)$ is insufficient, we need to also explain why $n+1$ exists for every $n$.

Am I on the right path?


The other question on this site isn't the same, and the replies don't answer this specific question.

Penelope
  • 3,635
  • 1
    $n+1$ is already defined, for example by $n \cup {n}$ (von Neumann definition), as can be found in many duplicates (e.g. https://math.stackexchange.com/questions/3101863/ and https://math.stackexchange.com/questions/85672/ and https://math.stackexchange.com/questions/2975907/). Please explain why they presumably do not answer your question. – Martin Brandenburg Dec 30 '24 at 23:24
  • I can't explain what I don't understand. – Penelope Jan 01 '25 at 00:06
  • 1
    I don't understand why this question is downvoted. It seems reasonably clear and the OP seems to have done some effort. – Jean Abou Samra Jan 01 '25 at 14:25
  • 1
    @MartinBrandenburg Type theory does not use the von Neumann definition of $\mathbb{N}$. – Jean Abou Samra Jan 01 '25 at 14:25
  • Yes, I didn't know this is about type theory. – Martin Brandenburg Jan 01 '25 at 15:15
  • @JeanAbouSamra thanks for querying the down vote. Many people now see stackexchange as quite hostile and unhelpful because of this kind of behaviour. I now use a different site which has been extremely helpful and friendly. I hesitated about asking this question here but I did to compare answers and see if a different perspective might provide useful insights. – Penelope Jan 02 '25 at 16:27

2 Answers2

2

[Since you mention Lean I'll assume type-theoretic foundations.]

This connection holds for all inductive types and type families, not just the natural numbers. In general, if we consider an inductive type $T$ (with no parameters and no indices for simplicity) specified by some list of constructors $\vec{c}$ (for the natural numbers those are $0 : \mathbb{N}$ and $s : \mathbb{N} \to \mathbb{N}$; for the booleans those are $\mathrm{true} : \mathrm{Bool}$ and $\mathrm{false} : \mathrm{Bool}$), then its elimination/induction principle can be derived mechanically as follows (informally): for every type family $P : T \to \mathrm{Type}$ (sometimes known as a motive in this context), in order to construct a dependent function $(t : T) \to P(t)$ (also known as a section of $P$; or, interpreting propositions as types, a proof of $\forall t. P(t)$), it suffices to handle each constructor of $T$: in other words, (dependent) functions out of inductive types can be defined by cases/"pattern matching".

In the case of natural numbers, it suffices to handle the case where $t = 0$ (i.e. provide an element of $P(0)$, the "base case") and the case where $t = s(n)$, in which case, since $n$ is smaller than $t$, we may assume that we have already figured out how to produce $P(n)$ (this is the whole idea behind induction after all), so we have to give a function $P(n) \to P(s(n))$ (the "inductive step").

These "case handlers" are often called methods, and you can perhaps see that their types can be derived by a simple syntactic translation on the types of the constructors of $T$.

\begin{align*} &0 : \mathbb{N} && P(0) \\ &s : \mathbb{N} \to \mathbb{N} && (n : \mathbb{N}) \to P(n) \to P(s(n)) \end{align*}

All told, the induction principle for $\mathbb{N}$ has the following type:

$$(P : \mathbb{N} \to \mathrm{Type}) \to P(0) \to ((n : \mathbb{N}) \to P(n) \to P(s(n))) \to (n : \mathbb{N}) \to P(n)$$

Note that the terminology "base case" and "inductive step" is closely related to the natural numbers (and set theorists don't like to perform induction on things that aren't natural numbers so this is all you hear about), but in general a type may have many "base cases" (corresponding to non-recursive constructors like $0$) or none at all, and many "inductive steps" (corresponding to recursive constructors like $s$) or none at all. As further examples, we can look at the sum type $A + B$ with the following constructors and methods:

\begin{align*} &l : A \to A + B && (a : A) \to P(l(a)) \\ &r : B \to A + B && (b : B) \to P(r(b)) \end{align*}

Or the type of binary trees with nodes of type $A$, $T(A)$:

\begin{align*} &\epsilon : T(A) && P(\epsilon) \\ &n : T(A) \to A \to T(A) \to T(A) && (l : T(A)) \to P(l) \to (a : A) \to (r : T(A)) \to P(r) \to P(n(l, a, r)) \end{align*}

1

Yes, there is a clear connection: if you have a recursive definition of a set of objects, then you can use that definition to prove that all elements of that set have some property. This is called structural induction. Please note that the definition does need to include some clause that the recursion covers all elements of the set, i.e. that there are no elements in the set in addition to those that are obtained by the recursive process.

Weak mathematical induction is structural induction following the recursive definition of natural numbers:

  1. $0$ is a natural number

  2. If $n$ is a natural number, then $n+1$ is a natural number.

  3. Nothing else (other than what can be obtained through 1 and 2) is a natural number

Note how the inclusion of 3 is crucial for weak mathematical induction to work, for if you show $P(0)$ and $P(n) \to P(n+1)$, then all you have shown is that those objects that you can generate through $1$ and $2$ have property $n$, but that does not mean that all natural numbers have property $n$ until you specify that there are no other natural numbers.

Let’s do some hypothetical example: Suppose the class of all oinks is defined as follows:

  1. Smirk and Glob are oinks.
  2. If some object $x$ is an oink, then $f(x)$ and $g(x)$ are oinks too.
  3. If $x$ and $y$ are oinks, then $h(x,y)$ is an oink too
  4. There are no other oinks

Ok, so how can we translate this definition into a structural induction proof that all oinks have property $P$? Easy. You show that:

  1. Smirk and Glob have property $P$
  2. If $x$ has property $P$ then $f(x)$ and $g(x)$ have property $P$ as well
  3. If $x$ and $y$ have property $P$, then $h(x,y)$ has property $P$ as well

This shows that all oinks that can be recursively generated through 1,2, and 3 all have property $P$, and since there are no other oinks, that means that all oinks have property $P$

Bram28
  • 103,721