# Explanation of EWD831

Here is the original EWD831.

Here is the argument’s outline in simple form. If you do not read the original text, nothing below will be graspable.

Choices we have:

a. \(2 ≤ i < 13\)

b. \(1 < i ≤ 12\)

c. \(2 ≤ i ≤ 12\)

d. \(1 < i < 13\)

EWD starts with two points, which might help us decide which one to use:

- The difference of bounds in \(a\) and \(b\) gives the length of the sequence.
- In \(a\) and \(b\), for two adjacent subsequences, upper bound of one is lower bound of the other.

These are nice properties, but we are still not clear what to use.

He then gives two more arguments:

Let’s assume natural numbers start at 0. Then,

- Exclusion of lower bound forces us to write \(-1 < i\) or \(-1 < i\) (only lower bounds written) for sequences that start at the smallest natural number.
- Inclusion of the upper bound would force us to write \(i ≤ -1\) (only upper bounds written) as upper bound for empty sequences.

The argument is, having to write -1, which is not a natural number, is ugly. And this narrows our choice down to a single option:

a. \(2 ≤ i < 13\)

Now let’s talk about subscripts, which are relevant to array definitions, if you care.

We assume that convention of \(a\) is the one we are adhering to.

If we start subscripts at 1, we will end up writing \(1 ≤ i < N+1\). But if we start at 0, we can write \(0 ≤ i < N\) which is cleaner.

And therefore, the numbering should start at 0.

# For programmers

For empty sets, the lower bound will have to be -1 if we use the convention of exclusive lower bounds i.e. \(-1 < i < 0\).

Issues with negative indices:

- We will need arithmetic for negative integers.
- Indices will consume more memory because of signed integers.
- The effort is only for the edge case of empty sets.

As we can see, it is not only mathematically ugly, but programmatically ugly too.

And therefore, the numbering should start at 0.