comp.lang.ada
 help / color / mirror / Atom feed
* Consider her way -- Re: Dimensionality Checking
@ 2001-12-11 19:10 Alexandre E. Kopilovitch
  2001-12-11 22:45 ` Mark Lundquist
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexandre E. Kopilovitch @ 2001-12-11 19:10 UTC (permalink / raw)
  To: comp.lang.ada

Recent discussion about the dimensions/unit analysis seems to me... well, not
directed by the spirit of the Ada language. As far as I understand, all
participants of the discussion presume that if the dimensional/unit analysis
should be done for an Ada program then it must be performed entirely with the
facilities of Ada language itself. I think that that assumption is plain wrong.

  Let us consider what the dimensional/unit analysis is, in general terms.
For every dimension/unit U we have the mapping Deg_U, which assigns the
rational numbers to the subtypes (that is, the domain of the Deg_U is the set
of all subtypes in our Ada program, and the range of the Deg_U is the set of
rational numbers). We extend this mapping to the variables and user-defined
functions, using the subtype of a variable and the subtype that a function
returns. The mapping Deg_U is "logarithmic", that is, for any variables (or 
user-defined functions) X, Y, Z:
  Z is compatible with X * Y implies Deg_U(Z) = Deg_U(X) + Deg_U(Y), and
  Z is compatible with X / Y implies Deg_U(Z) = Deg_U(X) - Deg_U(Y),
Then we require for all assignments (including an argument passing), additions
and subtractions in our program, that the values of the mapping Deg_U for the
right operand (side) must be equal to the corresponding value for the left
operand. This requirement permits us to define Deg_U over the rational
expressions. Taking into account that the "logarithmic" rule effectively
determines the values of the mapping for the square root, we conclude that 
the mapping Deg_U is defined over the algebraic expressions. The final step
is to assign zero value to all standard (predefined) transcendent functions
(such as Sin etc.). So, the mapping Deg_U is defined for all expressions,
and the condition to be verified is already formulated: for each assignment,
addition and subtraction the value of the mapping Deg_U on the right operand
must be equal to the corresponding value on the left operand.
  This is a definition of the basic "linear" dimensional analysis. One may
construct other, more sophisticated forms of the dimensional analysis for the
specific purposes.

  Now let's recall the fact that the Ada is not a problem-oriented language,
but rather a "superassembler". It intentionally and carefully avoids all
paradigms that aren't closely related to the real computer architectures or
to the general software engineering, even if those paradigms are heavily used
in some significant application area. (Note that I'm speaking here about the
paradigms; the data representation issues are another matter, that is a natural
job for an assembler.)
  Obviously, the dimensionality paradigm is one of the kind that Ada avoids:
it belongs neither to a computer architecture nor to the general software
engineering, but to the particular application area, no matter how significant
it is in the real world. Therefore Ada most probably will not take any move
to support it directly.

  The proper way to do the dimensional/unit analysis for the Ada programs is
to use the ASIS and some suitable language processor, I guess that the SML
might be the best for this purpose (because it is well-suited for the
manipulations with the algebraic type systems). So the configuration of the
whole tool chain may look like that:

       dimension/unit values for the subtypes
                       |
                       |
                      \|/
                       |
  |------|         |---------|	      |-------------|
  | ASIS | ------> | SML     | ------ | SML         |
  | tool |         | program |        | interpreter |
  |------|         |---------|        |-------------|
     |                 |
    /|\                |
     |                \|/
     |                 |
  |----------|    diagnostic output
  | Ada      |      
  | compiler |
  |----------|
     |
    /|\
     |
     |
 program to be verified
   

  Finally, I'll try to explain why the subtypes, and not the types, are the
natural carriers for the dimensionality info. Briefly, with the physical
magnitudes, all the dimensionalities are imaginary, and only the repetition
count within some underlying measurement process is real. That count is obviously
dimensionless. In fact, a dimension of physical magnitude is the abstraction
for the class of the instruments with which we can measure the magnitude.
  If you do not like such vague metaphysical arguments then consider the
following question: if X and X*X belong to the different types, how will you
treat (interpret) the usual approximations by the Taylor series?
  And as for the units, I hope everyone will agree that there is no fundamental
difference (in physics) between miles and kilometers.


Alexander Kopilovitch                      aek@vib.usr.pu.ru
Saint-Petersburg
Russia




^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Superassemblers: was Dimensionality Checking
@ 2001-12-18 20:19 Alexandre E. Kopilovitch
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandre E. Kopilovitch @ 2001-12-18 20:19 UTC (permalink / raw)
  To: comp.lang.ada

Richard Riehle <richard@adaworks.com> wrote:

>"Alexandre E. Kopilovitch" wrote:
>
>>   Now let's recall the fact that the Ada is not a problem-oriented language,
>> but rather a "superassembler". It intentionally and carefully avoids all
>> paradigms that aren't closely related to the real computer architectures or
>> to the general software engineering, even if those paradigms are heavily used
>> in some significant application area.
>
>How do you characterize problem-oriented from superassembler?
I don't think that there exists a characterization, which is good enough for
general audience, and at the same time short. Tell me the background and the
experience of the questioner, and I'll be able to give an answer.
  I hope that the following definition is sufficient for you: a language is
problem-oriented if it supports _directly_ the views and the methods which are
customary for the targeted problem area.

>Do  superassemblers include Java, C++, C#, COBOL, Fortran, and PL/I, and
>Eiffel?
In this list only C++ falls in that category.
  Java, as a language, does not deserve any comments. It is enough to point out,
that this rather modern language has no construct for enumeration. I'd say that
Java should be better called NetBasic.
  C# is too immature... but it surely is (and will be, as far as I understand)
platform-dependent. Its objects presume a quite strong (dynamic) support from
the underlying software platform. Therefore it can't be an assembler at all.
Perhaps I should be slightly more formal to avoid naive counter-arguments:
the characteristic features of the C# may be used effectively only with strong
dynamic support provided by the underlying software platform.
  Cobol and Fortran, those titans of the past, are quite different in respect
to the issue. Cobol was strongly problem-oriented language, but Fortran was
much closer to the (portable) assembler in the past. In fact, a mixture of the
Fortran and assembler code was the best cocktail for many things (in the past,
of course).
  PL/I is (was) certainly a problem-oriented language, although it tried to
embrace several broad apllication areas. I know well enough that the PL/I story
is quite controversial, but here I simply express my personal opinion.
  As for Eiffel, I do not know this language (I'm still in doubt, which book
about Eiffel is more suitable for me - I'm interested in that language, but
not in the associated methodology teachings). But all that I read/heard about
it suggests that Eiffel's author recognizes the general software engineering
as a separate problem in its own right, and focused his efforts on that problem.
Therefore I think that the Eiffel language probably is problem-oriented, although
the problem targeted does not belong to a particular application area.

>  Can we say that those that are not superassemblers inlcude Haskell,
>Lisp, APL,  Prolog, and OCAML?
I do not know Haskell and OCAML (although I hope to take a look at Haskell
eventually, mostly because the author of the good compression program bzip2
likes it very much and recommends it persuasively).
  As for the other languages in this list - Lisp, APL and Prolog, I think that
the proper answer should be cautious: they all have a chance to become a part
of some future superassembler, but certainly each of them isn't (and cannot
evolve into) a whole thing. This is especially true for the List and Prolog,
while APL is slightly more shifted towards the problem-orientation.

> And which ones are truly problem-oriented?
Cobol, Fortran, PL/I, APL, Prolog, Pascal, SmallTalk, Snobol...


Alexander Kopilovitch                      aek@vib.usr.pu.ru
Saint-Petersburg
Russia




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-12-18 20:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-11 19:10 Consider her way -- Re: Dimensionality Checking Alexandre E. Kopilovitch
2001-12-11 22:45 ` Mark Lundquist
2001-12-13 21:08 ` Nick Roberts
2001-12-17 18:06 ` Superassemblers: was " Richard Riehle
  -- strict thread matches above, loose matches on Subject: below --
2001-12-18 20:19 Alexandre E. Kopilovitch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox