|
From: Dmitry A. Kazakov on 2 Sep 2005 09:11 On Fri, 02 Sep 2005 12:43:24 +0200, Georg Bauhaus wrote: > Dmitry A. Kazakov wrote: > >>>>The problem with the current (Ada 83) design is that it tries to abstract >>>>away trivial mathematical facts: >>> >>>As does a computer :-) >> >> It does what you tell it. Computers do not have free will! (:-)) > > So why do you want to tell it about non-computer mathematics? Huh, there is only mathematics and non-mathematics! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: Dmitry A. Kazakov on 2 Sep 2005 09:20 On Fri, 02 Sep 2005 12:42:06 +0200, Georg Bauhaus wrote: > Dmitry A. Kazakov wrote: >> On 01 Sep 2005 12:04:17 -0400, Robert A Duff wrote: > >>>Heh? You want this: >>> >>> procedure Put(S: String) is >>> begin >>> for I in S'First..S'Last loop -- equivalent to S'Range >>> Put_Char(S(I)); >>> >>>to crash when S = ""? >> >> Yes. > > What is your approach to subranges then? > > function h(s: String) return Unsigned_32 is > prefix: String renames > s(s'first .. s'first + Integer'min(3, s'length - 1)); > result: Unsigned_32 := 0; > begin > for k in prefix'range loop > result := result or Shift_Left(Character'pos(prefix(k)), > (k - prefix'first) * 8); > end loop; > return result; > end h; > > (If you could assume for the moment that there is no > Unchecked_Conversion and not a different/better algorithm etc.) I don't see any problem, so far. Subrange of an empty range is empty. As for the checksum of an empty string it is to be extra defined. You cannot in general case reverse any possible sequence S1, S2, S3, ... to deduce S0. IF the sequence is a series bound by some operation *: SN = x1 * x2 * ...* xN AND * is a group operation THEN you can take the unit element of the group for S0. So if * is "+" then S0 could be 0. If * is "or" then S0 could be "false" etc. Now, take something else: let * be max, what would be the maximum of an empty array? Real'First? What would be then with the array invariant Max >= Min? What if Float is a subtype of a type which has lesser values than Real'First? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: Georg Bauhaus on 2 Sep 2005 10:14 Dmitry A. Kazakov wrote: > On Fri, 02 Sep 2005 12:42:06 +0200, Georg Bauhaus wrote: > > >>Dmitry A. Kazakov wrote: >> >>>On 01 Sep 2005 12:04:17 -0400, Robert A Duff wrote: >> >>>>Heh? You want this: >>>> >>>> procedure Put(S: String) is >>>> begin >>>> for I in S'First..S'Last loop -- equivalent to S'Range >>>> Put_Char(S(I)); >>>> >>>>to crash when S = ""? >>> >>> >>>Yes. >> >>What is your approach to subranges then? >> >> function h(s: String) return Unsigned_32 is >> prefix: String renames >> s(s'first .. s'first + Integer'min(3, s'length - 1)); >> result: Unsigned_32 := 0; >> begin >> for k in prefix'range loop >> result := result or Shift_Left(Character'pos(prefix(k)), >> (k - prefix'first) * 8); >> end loop; >> return result; >> end h; >> >>(If you could assume for the moment that there is no >>Unchecked_Conversion and not a different/better algorithm etc.) > > > I don't see any problem, so far. Subrange of an empty range is empty. But earlier you said that s'first .. ... should crash when s = "". > As > for the checksum of an empty string it is to be extra defined. > > You cannot in general case reverse any possible sequence S1, S2, S3, ... to > deduce S0. This requirement being generated by arbitrarily applying the mathematical habit of starting things, deducing thing, extending things to become some general case (not well defined for real computers), etc. Basic mathematical facts are basic relative to some starting point from which you perform mathematical reasoning. > IF the sequence is a series bound by some operation *: > SN = x1 * x2 * ...* xN > > AND * is a group operation > > THEN you can take the unit element of the group for S0. And what does mathematical group theory offer when the computer executes fine without it? Why don't you start your basic mathematical theory from things that work, and explain them first? If a sphere of negative radius opens many interesting insights into unforeseen extensions of geometry, will this have an influence on a pot maker's occupation? I'm not asking these questions because I believe that mathematics is the wrong science for approaching real computers. It's not. However, every once in a while I'm having to defend that running computers and performing mathematics are two sets of operations. They have a fair amount of overlap. But they are not the same set. Yet many mathematicians seem to view computer programming as if it were nothing but a way of transforming their mathematical knowledge into programs, largely ignoring a few issues: 1 - computers perform I/O, in time - no complete simple theory here, right? 2 - computers operate non-deterministically ("malfunction") ("Malfunctions are the technicians' job. I'm writing mathematically correct programs for flawless computers") 3 - computers are finite. 4 - computers cannot operate on no (0) bits. Why don't they apply their mathematical capacity to problems that are probably less fun and more dirty but more crucial? That it, at least consider adapting mathematics to the world instead of adapting the world to mathematics. > Now, take something else: let * be max, what would be the maximum of an > empty array? A problem of math-think. Like this .... talking to son: "See this little wood over there? I have counted the trees, there are 139." .... a little later: "Remember I told you about this wood having 139 trees, 14 years ago? Now there are only 23 left." .... talking to granddaughter visiting: "See this little wood over there?" -- "No." -- "It has 0 trees". -- "Ha, ha." If there is nothing about which to say anything, then mathematicians decide to say something about it: truth. Useful, but in a material setting, you have to consider whether it makes sense. Using your Max example, I could ask those mathematicians about the maximum of a subset of the natural numbers (possibly empty!). I'd venture a guess that the answer will likely be, "It depends.". For example, you have given "extra defined". ;-)
From: Georg Bauhaus on 2 Sep 2005 10:23 Dmitry A. Kazakov wrote: > On Fri, 02 Sep 2005 12:43:24 +0200, Georg Bauhaus wrote: > > >>Dmitry A. Kazakov wrote: >> >> >>>>>The problem with the current (Ada 83) design is that it tries to abstract >>>>>away trivial mathematical facts: >>>> >>>>As does a computer :-) >>> >>>It does what you tell it. Computers do not have free will! (:-)) >> >>So why do you want to tell it about non-computer mathematics? > > > Huh, there is only mathematics and non-mathematics! Not at all. Mathematics is not even a well defined term in a formal sense of the word "definition". (Notice the recursion :-) Thus computer-mathematics (as in theory of real, operating hardware) if used in a PL context has to start from some description of the real computer to be used with a PL program. Real computers executing (non-empty) programs translated from Ada text cannot but transorm a finite number (> 0) of finite (non-empty) sets of discrete "fantasies" of electro-magnetic values, somehow coping with the effects of one or more "times". That excludes infinity and no-bits from real-computer mathematics, for a start. Likewise, forget about non-discrete numbers.
From: Björn Persson on 2 Sep 2005 13:21
Dmitry A. Kazakov wrote: > On Thu, 01 Sep 2005 17:36:26 +0200, Georg Bauhaus wrote: >>Dmitry A. Kazakov wrote: >>>The problem with the current (Ada 83) design is that it tries to abstract >>>away trivial mathematical facts: >> >>As does a computer :-) > > It does what you tell it. Computers do not have free will! (:-)) You mean the Ada 83 design does have a free will? :-ý -- Bjýrn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu |