Mailing List Archive: 49091 messages

## [REBOL] Re: Natural numbers

### From: joel:neely:fedex at: 4-Jul-2001 4:51

```
Hi, Alek,

Alekk wrote:
> [...]
> > the series of natural numbers
> >
> > 0 1 2 3 4 5 ....... infinity
> >
> > which is the first number? 0 or 1 ?
> [...]
>
> But there are two shools -
>
> first - as You said
> second - that natural numbers starts from 1...
>

I'm sorry, but this is neither a matter of opinion nor of
popular vote.  The standard model in Mathematics is known
as "Peano's Postulates" or "Peano's Axioms", after Giuseppe
Peano (1858-1932), the brilliant Italian mathematician and
logician.  The full set of axioms states:

-  0 is a natural number.
-  The (unique) successor of any natural number is
a natural number.
-  No two numbers have the same successor.
-  0 is not the successor of any number.
-  If P is a property over the natural numbers
such that
-  P(0) is true, and
-  P(n+1) is true whenever P(n) is true
then P is true for all natural numbers.

The last of these, of course, is the principle of mathematical
induction, which has direct application to programming.

Suppose I have some expressions in the following schema

; point 0
while [loop-cond] [
; point n
loop-action
; point n+1
]
; point z

Now, suppose there is some property (of my computation) that
holds at "point 0", and is preserved by LOOP-ACTION -- i.e.,
if it is true at "point n" then it will still be true at
point n+1
.  Then, by mathematical induction, I can conclude
that at "point z" I will know that the property still holds
true, and that LOOP-COND is false.  The induction, of course,
is over the number of times LOOP-ACTION has been evaluated,
and that count is 0 prior to any evaluations of the loop.

(Corresponding reasoning holds for schemata using other loop
control functions as well.)

Recognizing 0 as the origin of the natural numbers is both
explicit in Peano's Axioms, and too fundamentally useful to
give up.  We learned long ago (from negative experience with
FORTRAN, actually ;-) that requiring a minimum loop count of
one instead of zero is often entirely too awkward.

...feeling too loopy to continue ... ;-)

-jn-

------------------------------------------------------------
Programming languages: compact, powerful, simple ...
Pick any two!
joel'dot'neely'at'fedex'dot'com
```