2

I am interested in knowing what a set theoretic definition of the standard addition algorithm for the natural numbers would be. Second, how do we know the standard algorithm gives the correct sum? Is there a gold standard for addition that we could compare it to?

It seems if you have two disjoint sets and you want to add the elements of one set to the other, you would just add one element to the receiving set and subtract one from the giving set and repeat this until the giving set is empty. Then you would just count the number of elements in the receiving set and that would be the sum. To me this would be the gold standard, but I’m not sure.

If you forget everything you know about addition and try to create a faster method of adding than the procedure above, the standard algorithm doesn’t seem very obvious to me.

Lastly, are there any writings about this topic that someone could direct me to? This is so basic and uninteresting to most people that I couldn’t find much on the topic.

I have seen one answer on here that defines the algorithm and proves it, but it was so hard to follow and I don’t think it was compared to any gold standard to make sure we get the correct answer.

I really need it dumbed down for me. It’s been awhile since I have been in school. Thank you.

  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 23 '22 at 21:39
  • 1
    I'm guessing that by "the standard addition algorithm for the natural numbers," you mean the algorithm for adding decimal numbers that's usually taught in primary school, right? This is a pretty interesting question, although I'm not sure if it would be possible to write a thorough answer given the limited space that we have here. I'm sure that somebody has written all this up in a book somewhere, but I don't know how to go about searching for such a book. – Sophie Swett Sep 23 '22 at 22:14
  • In Coq, the standard library has a formalization of a binary encoding of a positive number, and a recursively defined addition function (involving an implicit carry bit through a simultaneously defined add-with-carry function). Then, there's a deifnition of a natural number from that (either 0 or a positive number), and addition on that. There's also a definition of natural numbers essentially by unary representation, and a recursive definition of addition there corresponding to the Peano arithmetic axiom/definition of addition; and formalization of an isomorphism... – Daniel Schepler Sep 23 '22 at 22:21
  • between the two versions of natural numbers, respecting addition. – Daniel Schepler Sep 23 '22 at 22:21
  • @TannerSwett yes that is it. The method where you line up the numbers in a column according to their place value and then add one column at a time and carry a 1 if needed to the next column. – user1035015 Sep 23 '22 at 22:22
  • By the way, I happened to find this, which looks like it may answer part of your question. https://math.stackexchange.com/questions/321939/proof-of-the-standard-algorithm-for-addition – Sophie Swett Sep 23 '22 at 22:23
  • @TannerSwett yes this is what I mentioned above that I do not understand. The writer mentions true addition but doesn’t define it. I was hoping to find something easier to read and understand. Thanks though. – user1035015 Sep 23 '22 at 22:29
  • @user1035015 I have tried to give an answer in normal-language terms, with a pointer to where the justifications are required. It depends where you want to start, a little bit. – preferred_anon Sep 24 '22 at 09:10
  • "This is so basic and uninteresting to most people that I couldn’t find much on the topic." - Right! The addition as we learnt it as kids need not be formalized. I have nothing against formalizations , but everything can be exaggerated. – Peter Sep 24 '22 at 09:17

2 Answers2

1

If you accept the addition of 1-digit numbers, then you can prove how to add any-digit numbers using the "long addition" algorithm from school. The proof comes from a couple of basic facts.

The first is a definition of place-value numbering. What do I mean when I write the number $1234$? Well, in school I was taught that this means "1 thousand plus 2 hundreds plus 3 tens plus 4 ones". In a formula, that is

$$1234 = 1\times 1000 + 2 \times 100 + 3 \times 10 + 4 \times 1$$

Suppose I want to add this to the number $4321$. In full,

$$4321 = 4\times 1000 + 3 \times 100 + 2 \times 10 + 1 \times 1$$

How many thousands do I have? Well, $1+4=5$. How many hundreds? Also $5$. And $5$ tens and $5$ ones. So the answer is $5555$.

This is the essence of the proof when you don't have to do any carrying. It relies on the following facts, which can be justified from first principles.

  • Every number has a place-value representation.
  • Addition commutes (specifically in the following form): $$(x_1 + x_2 + \ldots + x_n) + (y_1 + y_2 + \ldots y_n) = (x_1+y_1) + (x_2 + y_2) + \ldots (x_n + y_n)$$
  • Addition distributes over multiplication (so that we can say $4 \times 1000 + 1 \times 1000 = (4+1) \times 1000$).

The justification for carrying is essentially the following: $7+9 = 10+6$, so if we are in the $k$ position, we rely on the identity

$$(9+7)\times 10^{k} = (10+6)\times 10^k = 1\times 10^{k+1} + 6 \times 10^k$$ which we call "carrying the 1 to the $k+1$ position". Obviously 9 and 7 in this example can be replaced by any two digits which add to a 2-digit number.

Is this the sort of thing you're looking for? It's possible to give many more details, but it helps to know exactly which parts you want to see in more detail, and what basic justification you would be happy with.

Defining addition

You ask what a "gold standard" definition of addition might be. I interpret your attempted definition in the following way:

Let $m$, $n$ be two natural numbers. Interpret $m$ and $n$ as the cardinality (size) of two disjoint sets of objects, $X$ and $Y$. Remove one object from $Y$ and insert it into $X$. Repeat until $Y$ is empty. Count how many objects are in $X$. This is $m+n$.

That is a perfectly correct definition of $m+n$. Its correctness relies on two properties of natural numbers.

  • $m+n = (m+1) + (n-1)$.
  • The sequence $n, n-1, n-2, \ldots$ terminates with $0$ (or $1$, depending on whether you consider $0$ to be a natural number).

If you accept those properties, then you have an algorithm. If you don't, you have to go deeper.

Commutativity of addition

It is not obvious from the definition that the familiar fact $n+m = m+n$ is true for all natural numbers $m,n$. It is hopefully obvious when $m=0$. To prove it requires an argument by induction (which will be implicit throughout this answer). There is a good explanation on this answer.

Defining place-value notation

Place-value representation is the key to getting a fast algorithm for adding natural numbers. The definition in terms of "counting objects" does not make it obvious how to represent a given natural number. The only representation it suggests is some kind of tally, where the number we call 5 would be "11111" and 9 would be "111111111".

The idea of place-value representation is to represent a given natural number by a finite string of digits, where the position of the digits is significant. The first ten numbers are given the representations $0, 1, 2, 3, 4, 5, 6, 7, 8, 9$. We define the place-value representation of an arbitrary number by induction, as follows.

Take an arbitrary number $n$ which we already know how to write in the place-value system. Say it has $k$ digits, and label the digits $a_k a_{k-1} \ldots a_{1}$ from left to right. I want to explain how to find the place-value representation of $n+1$.

  • If $a_1$ is not $9$, then replace $a_1$ by $a_1+1$ (which is also a digit).
  • If $a_1=9$ but $a_2 \ne 9$, replace $a_1$ by $0$ and $a_2$ by $a_2+1$.
  • If there exists a number $\ell$, less than $k$, $a_1, a_2, \ldots, a_{\ell-1}$ are all $9$, but $a_\ell \ne 9$, then replace all of $a_1, a_2 \ldots a_{\ell - 1}$ by $0$, and replace $a_\ell$ by $a_\ell + 1$.
  • It there is no such $\ell$, then every digit of $n$ is $9$. We say $n+1$ has the representation $10\ldots 000$ (with $k$ zeroes).

It can be proved that the representation is unique.

A different characterisation of place value notation

I want to prove the following theorem (notice the slight change in notation to include $a_0$).

$$a_k a_{k-1} a_{k-2} \ldots a_{0} = \sum_{i=0}^{k} 10^{i} \times a_{i}$$

Obviously even the statement of this theorem requires some notion of multiplication. So let's cover that...

Definition of multiplication

In the same way that $n+m = (n+1) + (m-1)$ gives us a definition of addition, the following gives us a definition of multiplication.

$$n\times m = (n+n) \times (m-1) $$

If you apply this repeatedly $m$ times, then you end up with a natural number which we call $n \times m$.

Commutativity of multiplication

As with addition, this is a standard exercise in induction. There is another answer on this site with a reasonable explanation.

This means we can interpret $m \times n$ either as "$m$ added to itself $n$ times", or "$n$ added to itself $m$ times".

Multiplication distributes over addition

It is another familiar fact that $a \times (b+c) = a \times b + a \times c$. Again, this is a standard exercise (Note that where they say $S(a)$, we would just say $a+1$. They're the same thing.)

Multiplication by 10 and place value

The theorem I said before is now not that hard to prove. Take your number $n = a_{k} a_{k-1} \ldots a_{1} a_{0}$. Then we have

\begin{align*} n &= a_{0} + a_{1}0 + a_{2}00 + a_{3}000 + \ldots \end{align*}

Now $a_{0} = (1+1+ \ldots +1)$ (where there are $a_{0}$ ones) by definition.

It is hopefully intuitive that $a_{1}0 = (10 + 10 + \ldots + 10)$. You can prove it by checking the cases $a_{1} = 1,2,3, \ldots 9$ separately.

Similarly for $a_{2}00 = a_{2} \times 100$, and so on. This can be made precise by induction. Hence, we have

$$n = a_{0} \times 1 + a_{1} \times 10 + a_{2} \times 100 + \ldots = \sum_{i=0} a_{i} \times 10^{i}$$

  • I think we are going in the right direction! – user1035015 Sep 24 '22 at 11:49
  • @user1035015 I'm glad this fits the question you had in mind. Which parts would you see more detail about? It would be quite easy to write a lot more, but I want to avoid parts you can do yourself. The current answer ends with showing place-value representation exists, but does not show the usual interpretation in terms of powers of ten. Obviously proving that requires a definition of multiplication, and lots of fiddly details. What do you think is missing? – preferred_anon Sep 24 '22 at 12:07
  • @user21750 I’m not sure I follow the definition of place value notation after the third bullet point. Can you provide some examples? Also I was hoping to extend the definition of addition and the algorithm to any base system. It should work with any radix? – user1035015 Sep 24 '22 at 19:26
  • @user1035015 What you say about other bases is true - you can replace 10 by base. About the bullet points: they are the different cases of a number ending in 9s. If there are no 9s in the tail end of the number, it's easy to write $n+1$. If it ends in 9s (but isn't all 9s) then you carry the 1 all the way to the beginning of the 9s (where you can add 1 because it's not a 9) and 9s all become 0. If they're all 9s, then $n+1$ is 100...000. – preferred_anon Sep 24 '22 at 19:39
  • @user21750 So basically you explained what it means to add by one in base 10 and how to represent it digitally? – user1035015 Sep 24 '22 at 22:09
  • @user1035015 Yes - the main point is that this gives you a definition of place value for all natural numbers. It remains to show that $n = a_{k} 10^{k-1} + a_{k-1} 10^{k-2} + \ldots + a_1$. – preferred_anon Sep 24 '22 at 22:16
  • So this place value or positional number notation relies on multiplication. We would need to define multiplication first? And then what it means to multiply a digit 1-9 by 10. It seems like deconstructing basic things we learned in grade open pandoras box! – user1035015 Sep 25 '22 at 01:30
0

Your procedure for "adding" two numbers is a fine algorithm if implemented correctly, however, it does not constitute a true additive function $\omega\times\omega\to\omega$ without making your procedure more precise.

The following theorem is hopefully an easily accessible proof of the existence and uniqueness of the addition function on the natural numbers.

Some Preliminaries:

Definition: $\omega$ is the set of natural numbers, defined to be the smallest inductive set (see the axiom of infinity or any intro to set theory article for more on how to construct $\omega$).

Definition: A relation $f\subseteq X\times Y$ is a function from $X$ to $Y$ provided that $\forall x\in X\exists!y\in Y:(x,y)\in f$. The unique $y$ corresponding to each $x$ is denoted $f(x)$.

Successor Function: There exists a function $s:\omega\to\omega$. Take $s=\{(x,y)\in\omega\times\omega:y = x\cup\{x\}\}$ and show that this is indeed a function with $s(x)=x\cup \{x\}$ (this encapsulates the idea of adding one to $x$).

I assume you have knowledge of the principle of induction and how to follow an inductive proof.

Theorem: There exists a unique function $+:\omega\times\omega\to\omega$ satisfying $$\forall x\in\omega:x+0 = x\tag{i}$$ $$\text{ and }$$ $$\forall x,y\in\omega:x+s(y) = s(x+y)\tag{ii}$$

Proof: Call a subset $A$ of $\omega^3$ additive if $$\forall x\in\omega:(x,0,x)\in A\tag{a}$$ $$\text{and}$$ $$\forall x,y,z\in\omega:(x,y,z)\in A\implies (x,s(y),s(z))\in A\tag{b}$$

Note that this definition is not so restrictive that no subset of $\omega^3$ satifies these conditions, since trivially, $\omega^3$ is additive.

Set $$\mathcal{A}=\{A\in\mathcal{P}(\omega^3):A\text{ is additive }\}$$ and define $+=\bigcap\mathcal{A}$. Our current goal is to show that $+$ is additive (that is, $+$ satisfies (a) and (b)) and that $+$ is a function.

(a) For $x\in\omega$, $(x,0,x)\in A$ for all $A\in\mathcal{A}$ hence $(x,0,x)\in +$.

(b) For $x,y,z\in\omega$, if $(x,y,z)\in +$, then $(x,y,z)\in A$ for all $A\in\mathcal{A}$, hence $(x,s(y),s(z))\in A$ for all $A\in\mathcal{A}$, thus $(x,s(y),s(z))\in+$.

Since $+$ satisfies (a) and (b), then $+$ is additive and is the smallest additive subset of $\omega^3$.

We now show that $+$ is a function via induction. Fix $x\in\omega$ and define $$N_x=\{y\in\omega:\exists!z\in\omega:(x,y,z)\in +\}$$ I leave it to you to show that $0\in N_x$. Now suppose that $y\in N_x$ for some $y\in\omega$. Then there exists a unique $z\in\omega$ such that $(x,y,z)\in+$. As $+$ is additive, then $(x,s(y),s(z))\in+$. If $z'\in\omega$ satisfies $(x,s(y),z')\in +$, then $+\setminus\{(x,s(y),z')\}$ is an additive subset, contradicting minimality of $+$, hence $s(y)\in N_x$. This completes the induction.

It now follows that for all $(x,y)\in\omega\times\omega\exists!z\in\omega:(x,y,z)\in+$, that is, $+$ is a function from $\omega\times\omega$ to $\omega$.

It is clear that $+$ is unique since any other function satisfying (i) and (ii) must be an additive subset of $\omega^3$. You may also check that $+$ indeed satisfies (i) and (ii). $\square$

Properties (i) and (ii) uniquely characterize addition on the natural numbers in the way we are all familiar with, and we have simply constructed a function from the ground up which satisfies the characteristic properties of addition on the natural numbers. This gives you an algorithm to add any two natural numbers based in standard set theory by recursively applying the successor function and the relations $+$ satisfies .

C Squared
  • 3,679
  • I am interested by your first remark "it does not constitute a true additive function $\omega \times \omega \to \omega$ without making your procedure more precise". What do you object to? I interpret the OP's definition as a funny rewording of the standard inductive characterisation $n+m = (n+1) + (m-1)$ (with the zero case being an obvious consequence of the construction). Is it that they don't explicitly state the induction principle? – preferred_anon Sep 25 '22 at 09:05
  • @preferred_anon specifically i’m objecting to the fact that it’s difficult to put into the language of set theory the op’s intended definition for adding two natural numbers. maybe i should make that more clear – C Squared Sep 25 '22 at 15:43
  • @CSquared do you know of any books that do what you wrote or go into it more deeply? I’m a little confused at how the theorem you proved constructs the addition algorithm we are all familiar with. – user1035015 Sep 27 '22 at 14:31