If I start by constructing the natural numbers formally in a reasonably standard way...
Type: NaturalNumber
Constructors: zero:NaturalNumber;successor(NaturalNumber):NaturalNumber
...rather than axiomatising them, then it is straightforward to derive the first eight Peano axioms as theorems, in the sense that it would be relatively easy to write a verifier to do it. I asked myself then why it isn't possible to derive the ninth axiom, namely the axiom of induction?
My motivation for this is that, if you axiomatise the natural numbers rather than construct them, then as I understand it the axiom of induction is necessary in order to exclude the possibility of non-standard sets of natural numbers. Put simply, it rules out the circle of dominoes and allows only the straight line of dominoes in the following picture:
Wikipedia: Domino effect visualizing exclusion of junk term by induction axiom.jpg
I'm aware of, although can hardly claim to be fully versed in, results such as Dedekind's, namely that with the axiom of induction stated using second order logic the Peano axioms define the natural numbers up to isomorphism. And I'm wondering whether these kinds of meta-logical arguments are needed at least to prove that such a proof as this isn't possible, perhaps?
So, at last, I have what I think is an acceptable answer. I'll write out the vernacular and explain as I go along.
Firstly, the construction of the natural numbers (which would be imported from elsewhere):
Next, some abbreviations and declarations:
Next, the rule itself, which you would need if you wanted to prove things
by Induction. I'll leave off the proof for a moment:The first premise
ρ ⊢ R::P(z)reads 'given a contextρ, the theoremRprovesP(z)'. This is the propositions as types paradigm in action, if you like. The context is the axioms and proven theorems that are referenced by the theorem. Similarly for the second premise. So we are taking as premises for the rule the base case and the induction step. The conclusionτ(n) ⊢ T(n)::P(n)states that for each natural numbern, a theoremT(n)can be constructed that provesP(n), given a contextτ(n).So the job is to define these contexts
τ(n)and to construct the theoremsT(n). I'll give the theorems first:These are worth a few comments. They would not verify standalone, so to speak, because they both rely on contexts that won't be in the main context. The verifier might return something like the following message (recall that this question is about how to implement a verifier as much as anything):
These are generic theorems that are structurally correct but do not hold standalone. It should be clear that the context needed for the first to verify fully is just going to be
ρ. Similarly for the second theorem. The context that it needs is going to beσ,T(k)::P(k). This leads to the recursive definition of the contexts, which is the crucial bit and comes at the top of the proof that follows:After the above definitions the proof of the
Inductionrule itself is broken down into the casesn=zandn=s(k). I'll leave out the derivations which prove the implications for the moment, so as to get across the gist of the proof as a whole:Now I'll write out the derivations themselves. Firstly for the case
n=z:In the derivation we begin by re-stating the first premise and then, since we have defined
τ(z)to beρ, the next line follows. And now note that the next line verifies. It reads 'theoremT(z)is a proof ofP(z)givenτ(z). Well, it verifies! Because givenρwe can proveR, whateverRhappens to be, and since our own generic theoremT(z)relies on nothing butR, the assertionτ(z) ⊢ T(z)::P(z)holds. And sincenis justz, we are done. For the casen=s(k), the reasoning is along similar lines.Update: The complete proof is now here.