On Tue, Nov 8, 2011 at 1:15 PM, Serge D. Mechveliani wrote:
> People,
>
> I have the following notes and questions on Axiom and on the book
> "Axiom. The 30 year Horizon",
> which I have downloaded together with the FriCAS-1.1.4 source.
>
> Margines  On the pages No  105, 144, 1006  there are several lines
> --------  that exheed the right margine.
>

The Axiom book source is from the original Axiom project. I haven't
seen any serious attempt to maintain it separately in the FriCAS
project, although I am sure either project would be glad to receive
patches which correct problems.

> The three languages
> -------------------
> The book mentiones the languages  Spad (=?= Scratchpad ), Axiom, Aldor.
> What is the difference? Which one in described in the book?

Scratchpad is the original name for Axiom. Axiom is the computer
algebra *system* including both an interpret and a compiler as well as
a library (written in the compiled language). SPAD is the name of the
compiler and compiled language in Axiom.  Aldor was originally
developed to be a replacement for SPAD, i.e. a 2nd generation version
of SPAD. The name refers to both the compiler and the language.  At
the time Axiom development at IBM was sold to NAG, Aldor had only been
incorporated into Axiom at a somewhat superficial level. Unlike SPAD,
Aldor was designed to operate as a standalone compiler as well as
being a compiler for the Axiom library.  Aldor was not included in the
open source release of Axiom.  Currently only the FriCAS project (a
fork of the original open source Axiom project) supports the use of
Aldor as a library compiler.

Only SPAD is described in the Axiom book but there may well be some
references to Aldor as an alternative library compiler.

> Which one is implemented in  FriCAS-1.1.4 ?
>

SPAD is the library compiler for FriCAS-1.1.4.  FriCAS also optionally
includes the so called "Aldor interface" which allows library code
written in the Aldor language to interoperate with code written in
SPAD.

> Spad \ ML = ?  Spad \ Haskell = ?
> ---------------------------------
> What principal language constructs Spad (Axiom, Aldor) has that cannot
> be replaced with the ML language constructs
> (classes, structures, functors ...).
> I am experienced in Haskell and know very few of ML, so the question is
> mainly on Spad vs Haskell
> (and apart from Haskell's "laziness" and functionality).
>

This is a large question with no simple answer.  In general there are
usually no constructs in one general purpose language which cannot in
some way or other be replaced with constructs in another. You need to
ask this question in a more specific way.

> Language or Library?
> --------------------
> In about 1992, I looked into the book on Axiom, spent a couple of days
> and was puzzled, could not understand what is the very programming
> language. I thought
> "Is this a domain-specific language for mathematics?

The SPAD language could be called such a domain-specific language.

> Do they think that to program trains one needs a language with the
> constructs of Train, Rails and Station, and to program mathematics the
> language needs the constructs of Matrix and PolynomialDomain and such?
> "

No, I don't think so.

> Then I looked into ML and Haskell: classes, instances, etc.
> Then, I wrote a certain small algebraic library (a prototype of DoCon)
> in Haskell.
> Another reasons for doing this was that
> 1) Axiom was commercial and not open-source,
> 2) Haskell is  functional, "lazy", elegant, popular, open source,
>   and reliably implemented and supported.
>
> I think that generally, a set of the language constructs must be possibly
> small and universal (not specialized to mathematics), and all the rest
> must be of the Library and be written in this very language.
> For example, take a small universal language, say, ML or Haskell, --
> popular and reliably implemented and supported --
> and write in it a library for mathematics.

That was (more or less) the intention of the design of SPAD and
especially in it's re-design as the Aldor language.

> Why does one need to introduce for this a new language (known to almost
> nobody), does not this lead to a concept confusion, to an user confusion?
>

This argument has also been advanced as a justification of the use of
Python in Sage.  But in general I think mathematicians are not adverse
to developing new languages for specific purposes. Some might even
claim that it is essential for progress in mathematics ...  SPAD
was/is such an attempt in the domain of mathematics in computer
algebra.

> And in DoCon, it was (is) clear where is the language (Haskell) and
> where is the library (DoCon itself).
>

I am surprised you did not also find this true in Axiom.

> Then, in about 1996, I again looked into the Axiom book. And suspected
> that many items in it, which I thought as of the language, are, probably,
> of the Library (hopefully written in Axiom).
> In the book, the language features are mixed with the library features,
> so that it is difficult to understand what construct is of the library
> and what is of the Spad (Axiom) language.
>

That is true.  SPAD was never formally specified. It was always (and
still is to some extent) a work in progress.  One the other hand there
was an attempt to formally specify Aldor.  If you haven't done so
already you should check the aldor.org web site.

> In many places it is written in this book  "Axiom",
> "Axiom has this and this" -- without making it clear:
> the Axiom language or the Axiom library?
> Really, this ambiguity is great.
>

Agreed.

> The chapter
>  1. An Overwiew of Axiom
> has the subsection  1.3. The Axiom language.
> Then, there follows
>  1.4 Numbers,
> and there are given the examples of the number expressions, as
> x : IntegerMod 6 := 5   and  rootOf(...).
>
> I guess now that  IntegerMod  is a domain constructor of the  Library,
> it is not a language construct for forming a number expression (is it?).

Libary code.

> Similarly, I guess that  rootOf  is a  library function (implemented in
> Spad), and is not a language operation (like +, * ...) for forming an
> arithmetical expression (is it?).

Library function.

> Further:
>  1.8 Polynomials
>
> A naive reader sees here  "Polynomial ...  UP(x, INT)  ..."
> and thinks "Oh, this is a special mathematical language to express
> polynomials and their domains, and such objects".
>

I have never read it this way.

> I suggest to insert in many appropriate places in this books the phrases
> like
>  "the Axiom library has the domain constructor  Polynomial,  which ...",
>  "the Axiom language has the constructs of  Category, Domain,
>   type declaration ...".
> And to put this explicit in each place where there might be such and
> ambiguity. In this case the book would be much easier to understand.
>

It would be great if you could supply patches with your suggested changes.

> Page 105.  `Table' (and its related operations) is, probably, not of the
>           Language but a constructor from the Library.
> For example, the Glasgow Haskell system has the corresponding constructor
> Map  in the Library.
> Then, it follows `Record' in the book. And it is, probably, a construct of
> the Language (in Haskelll records are in the language).
> But Record is explained near Table, so a language feature is mixed with
> library features (?)
>

True.

> Then, after this "Overview of Axiom", it follows
>                                         2. Using Types and Modes
> And I guess that the subject has again, changed: this chapter is not on
> the library, but on the programming language (Spad?, Axiom? Aldor?).
> Is this so?
> And so on.

I agree with you.

> Then, there goes "Advanced Problem Solving", like  Groebner basis,
> polynomial factorization, and such.
> Yes! this time I know that this is not of the language.
>
> Then:   Chapter 12. Categories.
>
> Probably, this is of the language!
>

Definitely.  I think you are learning to read the Axiom book!

>
> Comparison to some Haskell features
> -----------------------------------
> a) Union  of types is good.
> b) `case x <type>' is good.
> c) Using Subdomain, `pretend'  looks good.
> d) Rules  are good,
>   because                rule  sin(2*x) == 2*sin(x)*cos(x)
>   cannot be written as   sin(2*x) = 2*sin(x)*cos(x)    in Haskell.
>   The Haskell programs often compute by pattern matching, but not of
>   the LHS part of such kind.
>
> e) Clarity of the code.
>   For example, consider the lexicographic list comparison:
>
>  lexListComp :: Ord a => [a] -> [a] -> ComparisonValue
>  lexListComp xs ys = case (xs, ys)
>                      of
>                      ([],     []    ) -> EQ
>                      ([],     _     ) -> LT
>                      (_,      []    ) -> GT
>                      (x: xs', y: ys') -> case compare x y
>                                          of
>                                          EQ -> lexListComp xs' ys'
>                                          v  -> v
>
> (no `val', no `defun', few parentheses,
>  the long word `lexListComp' is not repeated).
>

I do not know how to quantify statements like "good".

> What is the nicest code for this in Spad ?
> Another question is about nested local values introduced by let-in and
> "where". For example,
>             f x = let (p: (y, z): _) = g x x
>                       h ys =  let h' = (\ x -> [x]) in  ...
>                   in
>                   h [p, y, z]
>

SPAD differs greatly here.

> Dependent types
> ---------------
> Also there exists a particular question of dependent types and
> dependent instances (domains). In Haskell they are not possible.
> Due to this, DoCon has a more complicated architecture than it might have.
> And I do not know whether they really work in Aldor or in the current Spad.
>

Yes in general they really do work in Aldor and SPAD but there are
limitations.  Do you have specific examples?

> History
> -------
> The DoCon library started in about 1995. In 2000 I got tired and stopped it.
> Very few items were improved since 2000.
> Noone uses it except myself (about 2 weeks in an year).
> I think, the main reason for this is that the set of the implemented
> methods is 50-100 times smaller that in Axiom of 2000.
> In about 2003 I read about that Axiom has become open source, also read
> about Aldor, which was not open source. And I had an impression that the
> Aldor implementation was not workable in 2003.
>
> Now, someone wrote to me unexpectedly about DoCon and Axiom.
> So, I have now installed FriCAS and looked in the book once more, and
> decided to write these questions and notes.
>

I have read about DoCon with some interest especially in connection
with category theory but I did not have sufficient time to learn how
to install and use even simple examples.  Are you planning to revive
this project?

Regards,
Bill Page.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to