## Abolishing zeros

I've just finished a short one-page paper with the title 'Accounting: counting with balanced Debits and Credits'. The paper aims to eradicate the notion of zero and thus division by zero. There is some humour to be found in the paper but I'm serious about the ideas. Here is the abstract:

Division by zero is undefined, so we have decided to eradicate zeros completely. We do this by introducing a new kind of Integer, called an Account, which is an ordered pair of two Naturals - Debit and Credit.
Naturally, we also introduce a new kind of Rational, called the Super-Rational, which is an ordered pair of two Accounts - Numerator and Denominator.

Note: I've been posting a lot of stuff here lately so it may appear like a one-man show. If you think I'm out of line please say so.

## Comment viewing options

### Hm

I'm not sure what the goal (or point) of this document is, and how you evaluate whether it accomplished it or not.

To me it looks like a standard popular science presentation of a rigorous construction of various classes of mathematical numbers, where you intentionally left zero out of the discussion (which seems rather artificial). Is it relevant to LtU?

### Total computing

I want to program with 'arithmetical' operations that are total (at the expense of the distributive laws).

### Zero fun

You claim you have extended these new-fangled rationals with multiplicative inverses. What does that mean? Using the more familiar notation of - for subtraction (rather than \), your definitions give:

(1-1)/(1-1)' = (1-1)/(1-1)

(Where x' is the multiplicative inverse of x, as in the document). But,

(1-1)/(1-1) ** (1-1)/(1-1) = (2-2)/(2-2)

which is 0/0 rather than 1. So is it really a multiplicative inverse?

BTW: You should clarify that you are apparently using Naturals as starting with 1. Most non-number theorists start them at 0, I believe.

If there's an issue here, I think it's quality, not quantity.

### Good point

I thought I made it clear that Naturals start at 1 but apparently not - thanks for pointing that out.
Also, I'm not defining a traditional multiplicative inverse, so may be I should rename it to 'tumble' or something.
Suggestions for other names are welcome.

### Doesn't seem to solve your problem.

Multiplication by a balanced Account still destroys information:

1\1 ** 2\1  ==  ((1*2)+(1*1))\((1*1)(1*2))  ==  3\3  ==  1\1

You show us that

1\1/2\1  ==  2\1/1\1

and conclude that multiplicative inverse is 'defined'. But I can do the same with normal arithmetic:

(0/1)^-1  ==  1/0

See? Defined. But it doesn't mean anything. You're basically saying that one undefined value is equal to another. A vacuous truth.

Oh, and your definition of Account multiplication is missing a parenthesis.

### Undefined?

But everything is defined. There isn't any single vacuous truth in the paper.
You say that information can still be destroyed and that's true, if you replace numbers with equivalent numbers (you use == as the equivalent operation).
Thanks for noticing the missing parenthesis: I wanted to write the expressions in postfix format but decided that was too much!

### Well, let me put it like this:

What can you 'do' with your algebra that I can't do with classical arithmetic? Perhaps there's something there, but your paper should be much more clear in that regard.

I've learned to bluntly state the obvious in my papers. Your readers will appreciate it.

### Stating the obvious

You are right - I didn't bluntly state the obvious. The big bonus of my algebra is that any operation can be 'rolled back' by applying the inverse of that operation (if you don't apply dubious simplifications). Of course, if you don't simplify Super-Rationals they become very large very quickly.
Is that a problem? Not if you implement Naturals with a confluently persistent data structure. On top of those, you can represent exponentially big numbers in linear space.

### The big bonus of my algebra

The big bonus of my algebra is that any operation can be 'rolled back' by applying the inverse of that operation

Can you please show that calculation? Do an example that involves multiplying by a representative of zero and then its multiplicative inverse.

### Rolling back

Let me roll back my previous statement :)

With 'rolling back' I don't mean that a number ends up in the same equivalence class after applying an operation on it and then its inverse. That would be nonsense in the case of multiplying representatives of zeros. I mean that every operation preserves information. For example:
 x+1\1/2/1 *** 1\1/2\1 (the equivalent of x/1 * 0/1) 
would give (after dubious simplification):
 x\x/2\1 (the equivalent of 0/1) 
then we multiply x\x/2\1 with the inverse 2\1/1\1 (or 1/0) resulting in:
 x\x/1\1 (the equivalent of 0/0) 
Note that all operations on x\x/1\1 afterwards will always give you the equivalent of (0/0). There is no escape. But that's ok because we still can get hold of x.
Surrationals follow the Wheel algebra except that Wheels only have one infinity while Surrationals have many 'infinities', thus a bigger equivalence class of infinities. The same applies for bottom(0/0).

* edit - small typo

### To escape or not to escape

Note that all operations on x\x/1\1 afterwards will always give you the equivalent of (0/0). There is no escape. But that's ok because we still can get hold of x.

How can we get hold of x if no operation will give it to us?

More importantly, what's the motivation behind any of this? If we think of the operation as division (or multiplicative inverse or whatever you want to call it), why shouldn't we just model it as a partial function as usual?

I say this as someone who spent most of middle school and high school using 0/0 and 1/0 in my own calculations just because I wanted division to be total. :) I changed my mind when I realized additive inverse was no longer reliable (1/0 - 1/0 = 0/0), not to mention the fact that multiplicative inverse was never really fixed ((1/0) / (1/0) = 0/0). It's good to know wheels might provide a formal basis for what I was doing, but I don't have a reason to go back yet.

### Sur-Quaternions

We can continue to define Sur-complexes, which are ordered pairs of Sur-rationals, and Sur-quaternions, which are ordered pairs of of Sur-complexes.
Why do this? Again, because all operations on Sur-quaternions are total, but now everything stays in the same equivalence class.
Of course, something has to give: multiplication of quaternions is not commutative..

### Wrong why

Why do this? Again, because all operations on Sur-quaternions are total[...]

That wasn't my question. Why not model division as a partial function? Why must that operation be total? (Let alone whatever other operations you're considering now...)

### Total functional programming

Good question.

Because I'm trying to design a programming language that has no runtime exceptions.
To model all operations to be total and finite (no unbounded recursion) is one way to achieve such goal. Of course, I also want my language to have numbers, so I need division to be total.
Another design goal of my language is that everything should be immutable (and preferably uniquely representable).

(I guess all this puts me firmly in the ultrafinitists camp :) )

The nice thing is that - because of these extreme constraints I've set myself - I'm forced to look at alternative computational models. It has been an interesting ride so far.

I value total functional programming and some degree of ultrafinitism too. However, in my own programming, I'd probably model division as a total function of type Rational -> Rational -> Maybe Rational. Is there a shortcoming to this approach?

### maybe not

I would argue that the only shortcoming of Maybe is that the None value doesn't carry the information of the what and why it had become None (remember that I don't want to destroy information if I can help it).
So for me, a fruitful approach would be to extend Maybe with the following.
 data Maybe a = Nothing a | Some a 
We also need the following extension:
 Maybe Rational -> Maybe Rational -> Maybe Rational 
But somehow such Nothing does look "awfully" close to a division by zero :).

edit: s/zero/division by zero/

### Don't give up on Nothing

If you aren't willing to give up some information, then even that type is insufficient, right? Potentially, a number needs to be represented in a way that fully determines the web of operations that led up to it, and maybe even more, depending on how far we want the reflection to go. As long as we're representing that whole web and ignoring most of it most of the time, I'm comfortable if the one part we pay attention to is sometimes simple and atomic like Nothing, 0, or True`.

### LOL

"Don't give up on Nothing, If you aren't willing to give up Some information"

Man, that's the best reply I got so far!

### Some pun that was

Oops, the "some" pun was not intended. :)

### Seriously nothing

I understand that my goals may appear too extreme.
Of course, there are other ways to keep a (immediately accessible) history of the all the operations that lead up to a value (even Nothing). I'm also pursuing that venue.

### If I was forced to make a

If I was forced to make a choice between eliminating zeroes and eliminating division, I would eliminate division.

### There is no division

There is no division in my algebra, only the multiplicative inverse (tumble?). All other operations are implemented on top of addition and multiplication. Another interpretation of division is that it is similar to simplifying a Rational (replacing numbers with their most simple equivalence versions).
So if we don't simplify we never do division and we never get zeros.

### But "there is no division in

But "there is no division in my algebra, only the multiplicative inverse" is nothing new, there never is a binary subtraction or division: normal algebraic structures like groups or fields are always defined interms of '+' and '*' being binary operations, and '-' and '^-1' being unary operations for the respective inverses, only that we nearly always take the shortcuts of using a binary '-' as in 'a - b' instead of the formally correct 'a + (-b)', and a binary '/' as in 'a / b' instead of the cumbersome 'a * (b^-1)'.

### Multiplicative Inverse

As algebraic operations go, multiplicative inverse has always struck me as a dubious one. It isn't closed for integral types, and it isn't total for rationals.

If you are working with rationals, you could replace most divisions with multiplication by rationals. That would remain closed and total.

### Division is simplification

Of course I say nothing new about inverses. What I say is that division is simplification. 8/4 is in the same equivalence class as 2/1. Replacing 8/4 by 2/1 is division.

### Division by 0 is possible in "meadows"

From 2007 on Jan Bergstra and others have published a number of papers on "meadows", i.e. zero totalized fields (the inverse of 0 is 0). See:

This is work together with John Tucker (Swansea) on the application of EAS (elementary algebraic specifications) to the theory of fields. We have designed an equational specification ENA (elementary number algebra) which specifies a super class of the class of zero-totalized fields. Models of ENA are called meadows. An equivalent subset of 10 equations has been termed Md in a joint paper with Yoram Hirschfeld (Tel Aviv) and John Tucker simply called Meadows. Every field can be expanded to a meadow but not conversely

The Rational Numbers as an Abstract Data Type

Fields, Meadows and Abstract Data Types

### Commutative property of multiplication

Thanks for the all the links!
I agree that (skew) meadows have very nice properties. However, meadows do drop one property, namely the commutative property of multiplication.
Not surprisingly, quaternions (which are not commutative) are also briefly discussed the 'Skew Meadows' paper.
Now that I'm reading through all the papers, meadows do look more favourable than wheels. I'm curious what will happen if meadows are based on accounts (natural*natural).

### Normal meadows are not skew

Normal meadows are not skew; to quote Bergstra: a meadow is a commutative ring.

The terminology is a bit confusing; if a meadow is commutative, then you would expect that a skew meadow is commutative; however, it is not, so apparently a skew meadow is not a meadow but something related to a meadow.

Bergstra is a specialist in skew algebra's BTW. Thirty years ago he invented with Jan Willem Klop the theory Process Algebra, AKA the Algebra of Communicating Processes. You may regard this as an extension of boolean algebra with atomic actions. An addition denotes choice; a multiplication stands for sequence; this is not commutative when an action is involved, so ACP is skew.

### Algebra of communication processes

Many thanks for the pointer to ACP.

What if all 'actions' in a sequence are purely functional and don't depend on the order of the sequence of actions? Is such sequence not skew?

### Commutative composition...

ACP has a commutative composition for such purposes: parallel merge. This operation is defined in terms of addition and multiplication.

A parallel merge of processes x and y is a kind of shuffle merge (as you do with card decks), except for potential communication. See the Wiki page.

These atomic actions are very atomic; they do not overlap when they happen. That makes them in fact badly applicable for the "real world" actions that you mean. This is simply solved by considering the start points and end points of your actions as ACP atomic actions.

ACP is a very elegant and powerful theory. With ACP you can describe grammars, communication protocols, financial systems, probabilistic systems, and systems with time, space and even relativity.

Bergstra also did Thread Algebra and Program Algebra. Think of the latter as an alternative for Turing Machines. IMO it is a pity and even a shame that relatively few are familiar with this algebraic work by Bergstra and others.

### Stream calculus

I'm reading Bergstra's papers. Great stuff and I agree that it is strange that his work isn't more visible.

BTW. I've just stumped upon another algebra, called stream calculus, which also has nice algebraic properties.

I have also thought about stream algebra but Ralf's stuff is way more advanced - like all his work.

### Bergstra

You might want to contact Jan. I remember him giving a seminar a couple of years back where he wanted to eliminate division by zero as well.