2020 James B. Wilson
Colorado State University
Summarized compactly in what is called "Backus-Naur Form (BNF) Grammar":
\[\mathbb{N} = 0 \mid S(n)\]
(Elimination etc. will come later.)
\[\vdash \mathbb{N}:type\quad (F_{\mathbb{N}})\]
\[\vdash 0:\mathbb{N}\quad(I_{\mathbb{N}}0)\qquad \frac{n:\mathbb{N}}{S(n):\mathbb{N}}(I_{\mathbb{N}}S)\]
Evidently \(n\mapsto S(n)\) can be typed as \(\mathbb{N}\to \mathbb{N}\) by intro rule \((I_{\mathbb{N}}S)\).
\[\frac{n:\mathbb{N}}{S(n):\mathbb{N}}(I_{\mathbb{N}}S)\]
Name that function \(\texttt{++}\), i.e. \(\texttt{++}n:=S(n)\) of type \(\mathbb{N}\to \mathbb{N}\).
This is counting (or "tally") algebra.
We also know we can make new operators from old ones.
E.g.
\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]
So \((m,n)\mapsto m+n\) can be typed as \(\mathbb{N}^2\to \mathbb{N}\), i.e. it is a binary operator.
\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]
By convention we short-hand symbols, e.g. \(1:=S(0)\), \(2:=S(1)\), etc.
Proposition. \(m+0=m\)
\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]
Proposition.\(m+1=S(m)\)
Proof. Recall \(1:=S(0)\) so
\(m+1=m+S(0)=S(m+0)=S(m)\). \(\Box\)
\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]
Proposition.\(m+1=S(m)\)
Proof. Recall \(1:=S(0)\) so
\(m+1=m+S(0)=S(m+0)=S(m)\). \(\Box\)
\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]
Proposition.\(m+n=n+m\).
Proof.
\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]
Proposition.\(m+n=n+m\).
Proof.
Proposition.\(m+n=n+m\)
Proof. Cases \(m=S(j)\), \(n=S(k)\)
\[\begin{aligned} m+n & =S(j)+S(k) \\ & = S(S(j)+k) \\ & =S(k+S(j)) \\ & = S(S(k+j)) \\ & = S(S(j+k)) \\ & = S(j+S(k)) \\ & = S(S(k)+j) \\ & = S(k)+S(j)\\ & = n+m\end{aligned}\]
(sorry...everyone has to done one once in their life!)
\[\begin{array}{l} n\in \mathbb{N}\\ P(0)\\ k\in \mathbb{N}\vdash P(k)\Rightarrow P(k+1)\\ \hline P(n)\end{array}\]
\[\begin{array}{rl} n&:\mathbb{N}\\ \epsilon &:P(0)\\ ind-hypo&:\prod_{k:\mathbb{N}}P(k)\to P(k+1)\\ \hline ind(\epsilon,f)&:P(n)\end{array}\]
\[\vdash \mathbb{N}:type\quad (F_{\mathbb{N}})\]
\[\vdash 0:\mathbb{N}\quad(I_{\mathbb{N}}0)\qquad \frac{n:\mathbb{N}}{S(n):\mathbb{N}}(I_{\mathbb{N}}S)\]
\[\begin{array}{rl} n & :\mathbb{N}\\ T & :\mathbb{N}\to type\\ base &:T_0\\ ind &:\prod_{k:\mathbb{N}}(T_k\to T_{S(k)})\\ \hline pf(n) & :T_n \end{array}\]
\((E_{\mathbb{N}})\)
\[\begin{array}{rl} T & :\mathbb{N}\to type\\ base &:T_0\\ ind &:\prod_{k:\mathbb{N}}(T_k\to T_{S(k)})\\ \hline refl & :pf(0)=_{T_0} base \end{array}\]
\[\begin{array}{rl} n & :\mathbb{N}\\ T & :\mathbb{N}\to type\\ base &:T_0\\ ind &:\prod_{k:\mathbb{N}}(T_k\to T_{S(k)})\\ \hline refl & : ind_n(pf(n))=_{T_{S(n)} }pf(S(n))\end{array}\]
[H] Halmos, Naive Set Theory, Van Nostrand, 1960
[ML] Martin-Lof, Intuitionistic Type Theory, Padua Lectures, 1980.