Let’s add another function: addition. Defined by:
\(\forall a \in \mathbb{N} (a+0=a)\)
\(\forall a b \in \mathbb{N} (a+s(b)=s(a+b))\)
That is, adding zero to a number doesn’t change it, and \((a+b)+1=a+(b+1)\).
Let’s use this to solve \(1+2\):
\(1+2=1+s(1)\)
\(1+s(1)=s(1+1)\)
\(s(1+1)=s(1+s(0))\)
\(s(1+s(0))=s(s(1+0))\)
\(s(s(1+0))=s(s(1))\)
\(s(s(1))=s(2)\)
\(s(2)=3\)
\(1+2=3\)
All addition can be done iteratively like this.
Addition is commutative:
\(x+y=y+x\)
Addition is associative:
\(x+(y+z)=(x+y)+z\)
Multiplication can be defined by:
\(\forall a \in \mathbb{N} (a.0=0)\)
\(\forall a b \in \mathbb{N} (a.s(b)=a.b+a)\)
Let’s calculate \(2.2\).
\(2.2=2.s(1)\)
\(2.s(1)=2.1+2\)
\(2.1+2=2.s(0)+2\)
\(2.s(0)+2=2.0+2+2\)
\(2.0+2+2=2+2\)
\(2+2=4\)
Multiplication is commutative:
\(xy=yx\)
Multiplication is associative:
\(x(yz)=(xy)z\)
Multiplication is distributive over addition:
\(a(b+c)=ab+ac\)
\((a+b)c=ac+bc\)