Natural Numbers

\(\mathbb{N}\)

2020 James B. Wilson

Colorado State University

 

Natural numbers count from 0

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)\]

\(\mathbb{N}\) as an algebra, I.

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}\).

  • \(\langle \mathbb{N},\texttt{++}\rangle\) is a [1]-algebra.
  • \(\langle \mathbb{N},\texttt{++},0\rangle\) is a [1,0]-algebra.

This is counting (or "tally") algebra.

\(\mathbb{N}\) as an algebra, II.

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.

  • \(\langle \mathbb{N},+,0\rangle\) is a [2,0]-algebra.

\(\mathbb{N}\) as an algebra, II.

\[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\)

\(\mathbb{N}\) as an algebra, II.

\[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\)

 

\(\mathbb{N}\) as an algebra, II.

\[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\)

 

Laws of \(\mathbb{N}\)

\(m+n=n+m\)

\(\mathbb{N}\) as an algebra, II.

\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]

Proposition.\(m+n=n+m\).

Proof. 

  • Start with \(m=0\).
    • Start with \(n=0\).
    • \(0+0=0=0+0\).
    • Next use \(n=S(k)\)
    • \(0+n=0+S(k)=S(0+k)=S(k+0)=S(k)=n\), by induction that \(0+k=k+0\).

\(\mathbb{N}\) as an algebra, II.

\[m+n = \left\{\begin{array}{cc} m & n=0\\ S(m+k) & n=S(k)\end{array}\right.\]

Proposition.\(m+n=n+m\).

Proof. 

  • Next with \(m=S(j)\).
    • Start with \(n=0\).
    • \(m+0=m\), \(0+m=m\), apply reflexive and transitive law of \(=_{\mathbb{N}}\).
    • Next use \(n=S(k)\)
    • \(m+n=m+S(k)=S(m+k)=S(S(j)+k)=?\)
    • \(n+m=S(n+j)=S(S(k)+j)=?\)

\(\mathbb{N}\) as an algebra, II.

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}\]

Laws of \(\mathbb{N}\)

\(\ell+(m+n)=(\ell+n)+m\)

HOMEWORK!

(sorry...everyone has to done one once in their life!)

This is cheating.

We never finished defining \(\mathbb{N}\) how can we begin using it?

\[\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}\]

Induction:

\[\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}\]

\(\mathbb{N}\) elimination:

Natural numbers \(\mathbb{N}\)

\[\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}\]

Incomplete History

  • Peano: first to recognize \(\mathbb{N}\) as an algebra generated by nullary 0 and unary successor \(S\), a bit less formal than today but appropriate for the logic of his day.
  • Russell-Whitehead: made \(\mathbb{N}\) with types inside their Principia,
  • Zermelo's modeled the same in his Set Theory
  • Martin-Lof: gave \(\mathbb{N}\) in dependent type theory using his identity types for equality.

References

[H] Halmos, Naive Set Theory, Van Nostrand, 1960

[ML] Martin-Lof, Intuitionistic Type Theory, Padua Lectures, 1980.

 

Natural Numbers

By James Wilson

Natural Numbers

  • 428