People normally introduce natural numbers via enumeration: <#62548#><#12244#>0<#12244#><#62548#>,
<#62549#><#12245#>1<#12245#><#62549#>, <#62550#><#12246#>2<#12246#><#62550#>, <#12247#>etc<#12247#>. The
abbreviation ``etc.'' at the end says that the series continues in this
manner. Mathematicians and mathematics teachers often use dots for the same
purpose. For us, however, neither the ``etc.'' nor the dots are good
enough, if we wish to design functions on natural numbers
systematically. So, the question is what it means to write down ``etc.'',
or put differently, what a complete, self-contained description of the
natural numbers is.
The only way to remove the informal ``etc.'' from the enumeration is to
describe the collection of numbers with a self-referential
description. Here is a first attempt:
0 is a natural number.
If n is a natural number, then one more than n is one, too.
While this description is still not quite rigorous, it is a good starting
point for a Scheme-style data description:
A <#62551#><#12253#>natural number<#12253#><#62551#> (<#62552#><#12254#>N<#12254#><#62552#>) is either
- <#62553#><#12256#>0<#12256#><#62553#> or
- <#62554#><#12257#>(add1<#12257#>\ <#12258#>n)<#12258#><#62554#> if <#62555#><#12259#>n<#12259#><#62555#> is a natural number.
The operation <#62556#><#12262#>add1<#12262#><#62556#> adds <#62557#><#12263#>1<#12263#><#62557#> to a natural
number. Of course, we could use <#62558#><#12264#>(+<#12264#>\ <#12265#>...<#12265#>\ <#12266#>1)<#12266#><#62558#> but <#62559#><#12267#>add1<#12267#><#62559#>
stands out and signals ``natural number,'' as opposed to arbitrary number,
to the reader of a data definition and a function.
Although we are familiar with natural numbers from school, it is
instructive to construct examples from the data definition. Clearly,
<#12272#>0<#12272#>
is the first natural number, so
<#12280#>(add1<#12280#> <#12281#>0)<#12281#>
is the next one. From here, it is easy to see the pattern:
<#12289#>(add1<#12289#> <#12290#>(add1<#12290#> <#12291#>0))<#12291#>
<#12292#>(add1<#12292#> <#12293#>(add1<#12293#> <#12294#>(add1<#12294#> <#12295#>0)))<#12295#>
<#12296#>(add1<#12296#> <#12297#>(add1<#12297#> <#12298#>(add1<#12298#> <#12299#>(add1<#12299#> <#12300#>0))))<#12300#>
The examples should remind us of the lists construction process. We built
lists by starting with <#62560#><#12304#>empty<#12304#><#62560#> and by <#62561#><#12305#>cons<#12305#><#62561#>ing on more
items. Now we build natural natural numbers by starting with <#62562#><#12306#>0<#12306#><#62562#> and
by <#62563#><#12307#>add<#12307#><#62563#>ing on <#62564#><#12308#>1<#12308#><#62564#>. In addition, natural numbers come with
century-old abbreviations. For example, <#62565#><#12309#>(add1<#12309#>\ <#12310#>0)<#12310#><#62565#> is abbreviated as
<#62566#><#12311#>1<#12311#><#62566#>, <#62567#><#12312#>(add1<#12312#>\ <#12313#>(add1<#12313#>\ <#12314#>0))<#12314#><#62567#> as <#62568#><#12315#>2<#12315#><#62568#>, and so on.
A function on natural numbers must extract the number that went into
positive natural number just like a function on lists must extract the list
that went into a <#62569#><#12316#>cons<#12316#><#62569#>tructed list. The operation that performs
this ``extraction'' is called <#62570#><#12317#>sub1<#12317#><#62570#>. It satisfies the law
<#12322#>(sub1<#12322#> <#12323#>(add1<#12323#> <#12324#>n))<#12324#> <#12325#>=<#12325#> <#12326#>n<#12326#>
just as the <#62571#><#12330#>rest<#12330#><#62571#> operation satisfies the law
<#12335#>(rest<#12335#> <#12336#>(cons<#12336#> <#12337#>a-value<#12337#> <#12338#>a-list))<#12338#> <#12339#>=<#12339#> <#12340#>a-list<#12340#>
Of course, <#62572#><#12344#>(-<#12344#>\ <#12345#>n<#12345#>\ <#12346#>1)<#12346#><#62572#> would also work, but <#62573#><#12347#>sub1<#12347#><#62573#> stands out
and signals that the function processes natural numbers.