So I am learning about the successor function $S(n)$ where we have $S(n) = n+1$ basically. So $S(0) = 1, S(1) = 2, S(2) = 3, S(3) = 4$, etc.
But are we explicitly mapping $0$ through $9$ "by hand" and then using some other rule for base 10? Are we explicitly defining $S(9) = 10$ or is there some other rule we use for defining how natural numbers are represented in a given base system?
Also does the successor function imply knowledge of subtraction? For instance if I wanted to define addition for something like $2+3$ I'd use the rule $a + 0 = a$ and $a + S(b) = S(a + b)$. So for instance:
$2 + 0 = 2$
$2 + 1 = 2 + S(0) = S(2 + 0) = S(2) = 3$
$2 + 2 = 2 + S(1) = S(2 + 1) = S(3) = 4$
$2 + 3 = 2 + S(2) = S(2 + 2) = S(4) = 5$
When evaluating something like $2 + 3$ I had to know that $3$ was the same as $S(2)$ which requires subtraction by one. Or is this seen as more of a substitution and mapping? As in, "in our set of relationships, $3$ is equivalent to $S(2)$"?
Are these expressions really being treated like a nested function of sorts? In other words it seems like something like this is actually going on (Python code), i.e. there's some other function or mapping taking place, not just the successor function:
def S(n):
return n + 1
successors = {}
for i in range(0, 100): #ideally we have this to infinity
successors[S(i)] = i
def add(a, b):
if b == 0:
return a
else:
return S(add(a, successors[b])) # note the use of add() inside S() here
print(add(2, 3))
I think you are confused about two different things. (I sympathise, I shared the confusion for many years!)
Firstly, addition of natural numbers is not defined by the algorithm we use to calculate $(a+b)$ in base 10, or any other base. We can add two numbers, irrespective of how they are represented.
But more importantly, we build up the arithmetic of natural numbers slowly. Stage one is the definition of successor, your $S$ function.
Then we define some notation:
$$ 1:=S(0); 2:=S(1); 3:=S(2); \dots ; 10:=S(9); \dots $$ and so on. This is just a convenience, we can just as well work with $SSS(0)$ and so on.
Only once that is done can we define addition: it is not sitting there already. As you say, we define it as $$\begin{array}{3} a &+ 0 &:=a\\ a & +S(b) &:=S(a+b). \end{array} $$ Note that this isn't just an algorithm for calculating $+$, it is the definition of what $+$ is.