Bad example demonstrates failure in complexity

❝How I failed to "fix" a simple example illustrating simplicity.❞

I decided to demonstrate the three components of simplicity, that I was writing about in posts The definition of simplicity, with an example in mathematics. It is supposed to be as trivial as possible, so as not to distract from the concept “simplicity” in itself. There was some mathematical ambiguity – which really is not relevant for illustrating the idea – but it kept bothering me.

The simple example

In posts The definition of simplicity and Refining ‘simplicity’, I go into we can break down the concept of simplicity in three components, concerns if you will: specialized, unoptimized, reduced. To demonstrate by example, I needed to use a small mathemathical expression. I started out with .

In order to demonstrate optimization in the domain of the binary system, I would show 2 << 1, that is value 2 bit-shifted by 1 bit meaning that it gets multiplied by 2. So far, so good.

Ambiguity

The chosen expression has an ambiguity though.

2² = 2 * 2 = 2 + 2

Which is only an issue for the value 2 and is not really relevant for demonstrating optimization. If you choose a different value, say 3, as in , this does not hold, i.e. 3² = 3 * 3 != 3 + 3. Of course, the programmer in me is like .. “you could introduce a variable”. So, instead of , we have .

My brain while in a hurry to continue with other parts of the post:

Of course this is still considered trivial … right? So now it’s just x << 1 for squaring. Okay, so let’s go on with writing the rest of the text that actually explains the subject.

But of course it is not x << 1, because that equals 2x. And, because of the very same ambiguity that I knew was there and tried to fix, I make the mistake of not fixing all related expressions. And while I kept working with in the back of my mind, x² = x * x != x << 1 = 2 * x = x + x. Instead, this example requires calculating the logarithm, because x² = x << (log₂ x), at least for values of x that are powers of two. “How many bit-shifts – multiplications by 2 – do you need?” Which makes the example far less obvious. So not a good fit.

The irony in the mistake

Now, the actual mistake is in recognizing that the ambiguity in is insignificant. It does not matter. The point is not to prove the binary number system, or two’s complement representation, or bit-wise operators, or being able to generalize or introduce variability.

The point is that you can express a solution differently by changing – typically lowering – the level of abstraction with its corresponding restrictions and bounds, by generalizing, and adding or removing parts. That is what is relevant.

The worst thing (arguably) is not even the mistake in a trivial mathematical expressions. The real mistake – real irony – is that, in a post that tries to explain and define the very subject simplicity in concrete, workable terms, I have (inadvertently) added complexity while trying to demonstrate a single component: unoptimized. So, the opposite of simplicity, … of keeping it simple.

I deviated from simplicity while explaining simplicity, and that complexity invalidated the explanation.


This post is part of the Defining simplicity series.
Other posts in this series: