I had some issues understanding how addition is defined recursively in Von Neumann construction of Natural Numbers.
As a computer scientist student who is approaching the topic of Set-Theory, it helps me to formulate my problems and ideas with some small portions of code, I hope this can be forgiven.
Addition Recursive Definition
int add(int x, int y) { |Von Neumann Constuction:
if(y==0) | 0=∅
return x; | 1={∅}
else | 2={∅,{∅}}
return(1+add(x,y-1)); | :
} | :
where x, y, 0 and 1 are sets as in Von Neumann construction
My struggle with this definition is that I can't stop considering the $y-1$ term problematic, since what I think we usually define is the successor term $y+1$ as $( y+1=y\cup \{y \})$. Defining the "antecedent" seems more painful to me, the reasons are surely linked to my ignorance on the topic and I feel I wouldn't even be able to express them properly so I guess I will keep studying and then come back.
Meanwhile I came up with an "alternative" deifnition of addition that feels less painful for my untrained mind and I wanted to share it with you to get some feedback.
Can this be considered a valid alternative?
Addition Alternative Definition
Set add (set x, set y) {
set h=∅
set z=∅
while (x!=z)
z= z U {z};
while (y!=h) {
z= z U {z};
h= h U {h};
}
return z;
}
where x, y, h, and z are sets as in Von Neumann construction
I wrote this code with set operations to strip any abstraction away, hoping it would make my ideas easier to be understood. If this is not the case, please share any suggestion.
The alternative definition looks fine. It might be better though to remove the first "while" loop, and just initialize z to x. That better expresses the requirement $x + 0 = x$.
Yes, the "y - 1" term is problematic. If you're still defining addition, you haven't got subtraction.
On the other hand, the "antecedent" notion is not so bad. Since the successor function is one-to-one, it has a well defined inverse, the predecessor function, and the domain of the predecessor function is the range of the successor function, the set of all non-zero natural numbers. There's even an easy way to calculate it; the predecessor of the natural number $x$ is just the union of the collection $x$ of sets of natural numbers.