I cannot understand how double/nested induction works. I am supposed to prove that the addition operation is both commutative (x + y = y + x) and associative (x+(y+z)) = ((x+y)+z) from the following definitions of the naturals and addition (no other axiom is given).
Naturals: Base: $0 \in \mathbb{N}$ and Ind. $n \in \mathbb{N} \implies sn \in \mathbb{N}$.
Addition: Base: $0 + n = n$ and Ind. $s(m)+n = s(m+n)$.
I do understand that I am supposed to divide the proof into a base case and an inductive case, but I am very unsure about the way to proceed since there's $m$ and $n$ to care about:
Proof statement: $\forall m,n \in \mathbb{N}: n+m = m+n$.
Base case:
Assume $n=0$. This gives us $0 + m = m + 0$. By the definition of addition, this means $0 + m = m$.
But now I am stumped, obviously I should do some sort of induction on $m$, but otherwise I am stumped, since there is nothing I can say about $0 + m$ (as it is not on the definition of +. Any ideas on how to structure the proof for both the commutative and associative properties? I have seen a few explanations online, but they sometimes use other lemmas or are otherwise so quick and straightforward that I feel like I miss something. Thank you.
Step 1: To prove $m+0=m$ you have to start with a base case:
$$0+0=0$$
To show that $1+0=1$ you have
$$1+0=S(0)+0=S(0+0)=S(0)=1$$
Likewise, for $2$ you have
$$2+0=S(1)+0=S(1+0)=S(1)=2$$
In general, assume you have proved $k+0=k$, then you only need to show that $S(k)+0=S(k)$. But this is simple as
$$S(k)+0=S(k+0)=S(k)$$
as desired.
Step 2: Great, we've now shown that $m+0=m=0+m$ for all $m$. To show the same for $+n$ we will start with the example $n=1$.
$$1+m=S(0)+m=S(0+m)=S(m)$$
We then also need to show that $m+1=S(m)$. AGAIN this takes an induction proof! Base case
$$0+1=1=S(0)$$
Assume that $k+1=S(k)$. Then
$$S(k)+1=S(k+1)=S(S(k))$$
as desired. For general (and specific) $n$, assume that we have shown that
$$m+n=n+m$$
for all $m$. We have to show that
$$m+S(n)=S(n)+m$$
We will do this by proving the following equalities true
$$m+S(n)=S(m+n)=S(n+m)=S(n)+m$$
Some of these equal signs are easy to see
$$S(n)+m=S(n+m)\text{ by definition}$$
$$S(m+n)=S(n+m)\text{ by inductive assumption}$$
The difficult thing to prove is that $m+S(n)=S(m+n)$. AGAIN, we will use induction! Base case:
$$0+S(n)=S(n)+0=S(n+0)=S(0+n)$$
Assume $k+S(n)=S(k+n)$. Then
$$S(k)+S(n)=S(k+S(n))=S(S(k+n))$$
as desired.