[comp.lang.ada] Type NATURAL isn't

simpson@spp3.UUCP (Scott Simpson) (06/24/88)

Can anybody explain why the LRM declares NATURAL as
    
    subtype NATURAL is INTEGER range 0..INTEGER'LAST;

Natural numbers start at 1!  Any mathematician would assume it
to be the same declaration as POSITIVE.  A better solution would
be
    subtype WHOLE is INTEGER range 0..INTEGER'LAST;

You might argue that I could make the declarations

    subtype WHOLE is NATURAL;
    subtype NATURAL is STANDARD.NATURAL range 1..INTEGER'LAST;

but then any Ada programmer who reads my code will get thoroughly
confused.  I talked to my boss, Frank Belz, and he said that when Ada
was being developed, a number of people complained that they thought
of natural numbers as starting at zero so they made the language that
way.  This is clearly incorrect.
	Scott Simpson
	TRW Space and Defense Sector
	...{decvax,ihnp4,ucbvax}!trwrb!simpson  (UUCP)
	trwrb!simpson@trwind.trw.com		(Internet)

dd@sei.cmu.edu (Dennis Doubleday) (06/24/88)

In article <8806231808.AA15365@spp3.SPP> simpson@spp3.UUCP (Scott Simpson) writes:
>Can anybody explain why the LRM declares NATURAL as
>    
>    subtype NATURAL is INTEGER range 0..INTEGER'LAST;
>
>Natural numbers start at 1!  Any mathematician would assume it
>to be the same declaration as POSITIVE.

I've never heard this before.  The first two books I took off my
bookshelf both define the set N of natural numbers as
{0,1,2,3...}.  These books are "Computability, Complexity, and
Languages" by Martin D. Davis and Elaine J. Weyuker, and "Discrete
Mathemetical Structures with Applications to Computer Science" by J.P.
Tremblay and R. Manohar.  Is there disagreement over the definition of
the set of natural numbers?



-- 
Dennis Doubleday                       dd@sei.cmu.edu
Software Engineering Institute         (412)268-5873
Carnegie Mellon University
Pittsburgh, PA 15213

daven@lll-crg.llnl.gov (Dave Nelson) (06/25/88)

In article <8806231808.AA15365@spp3.SPP> simpson@spp3.UUCP (Scott Simpson) writes:
>Can anybody explain why the LRM declares NATURAL as
>    
>    subtype NATURAL is INTEGER range 0..INTEGER'LAST;
>
>Natural numbers start at 1!  Any mathematician would assume it
>to be the same declaration as POSITIVE.  A better solution would
>be
>    subtype WHOLE is INTEGER range 0..INTEGER'LAST;
>
>You might argue that I could make the declarations
>
>    subtype WHOLE is NATURAL;
>    subtype NATURAL is STANDARD.NATURAL range 1..INTEGER'LAST;
>
>but then any Ada programmer who reads my code will get thoroughly
>confused.  I talked to my boss, Frank Belz, and he said that when Ada
>was being developed, a number of people complained that they thought
>of natural numbers as starting at zero so they made the language that
>way.  This is clearly incorrect.
>	Scott Simpson
>	TRW Space and Defense Sector
>	...{decvax,ihnp4,ucbvax}!trwrb!simpson  (UUCP)
>	trwrb!simpson@trwind.trw.com		(Internet)
>
One mustn't be so dogmatic about such things!  Speaking for any and all
mathematicians ;-), definitions differ.  For instance, in
van der Waerden's "Algebra", 7th edition, New York: Ungar, 1970, p 3, we see

"We presume that the reader is familiar with the set of natural numbers
(positive integers),

	1, 2, 3, ...,

as well as [the usual stuff about Peano's postulates] ... ."

However, in Lang's "Real Analysis", Reading: Addison-Wesley, 1969, p 4, we see

"We denote by Z+ the set of positive integers (integers > 0), ...
We denote by N the set of natural numbers (integers >= 0)."

Just to show that it's not a battle between the analysts and algebraists,
we see that Halmos, in "Naive Set Theory", New York: Van Nostrand, 1960,
p 44, states:

"A natural number is, by definition, an element of the minimal successor set
omega.  This definition is the rigorous counterpart of the intuitive
description according to which they consist of 0, 1, 2, 3, 'and so on.' "

It doesn't really matter, as long as you define your terms.  And that's just
what the Ada people did.

Dave Nelson

(defrocked mathematician, who has finally found a use for those
old math texts stored in a musty bookcase in his office).

daven (Dave Nelson)
arpa:  daven @ lll-crg.llnl.gov
uucp:  ...{seismo,gymble,mordor,sun,lll-lcc}!lll-crg!daven

smryan@garth.UUCP (Steven Ryan) (06/25/88)

In article <8806231808.AA15365@spp3.SPP> simpson@spp3.UUCP (Scott Simpson) writes:
>Natural numbers start at 1!  Any mathematician would assume it
>to be the same declaration as POSITIVE.

Number theory which deals with the properties of natural numbers starts at
zero. Before appealing to a mathematical definition, be aware some people use
natural to refer to {0,1,2,...} and others use {1,2,3,...} and whole as
{0,1,2,...}. Whatever the authour finds useful.

A word means what I say means, nothing more or less.
                   - H Dumpty

ldw@hpclldw.HP.COM (Larry Woods) (06/27/88)

According to Webster's Seventh New Collegiate Dictionary:

   natural number: the number 1 or any number (as 3, 12, 432)
   obtained by repeatedly adding 1 to this number.

stt@ada-uts (06/29/88)

In most high school mathematics texts, "Natural" starts at 1.
I think once you get into most grad schools, zero has been given
full "natural" status.  "Whole" numbers included all of the
positive and negative integers in at least one text.
And for many friends of 2's complement notation, "positive"
includes zero.

Probably the right names for the STANDARD
integer subtypes would have been:
  "Zero_Dot_Dot_Integer_Tic_Last"
and
  "One_Dot_Dot_Integer_Tic_Last"

Tucker Taft
Intermetrics, Inc.
Cambridge, MA  02138

wpohl@hvrunix.UUCP (Walter E. Pohl) (06/29/88)

	When I was in junior high or something, I was told that the Whole
numbers went from 0 to infinity, and the naturals from 1 to infinity.
	In contemporary math usage, this is WRONG WRONG WRONG.  In all the
math courses I've taken in college, and all the math books I've read (and I
mean college-level or above), the whole numbers are never mentioned, and the
naturals go from 0 to infinity.  Now, I'm sure there are exceptions, but I 
think that this is enough evidence to support the decision of the ADA developersto call this type natural

				Walt
				Wpohl@hvrunix