[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Axiom-developer] non extending category

From: Bill Page
Subject: RE: [Axiom-developer] non extending category
Date: Sun, 12 Feb 2006 14:31:40 -0500

On February 11, 2006 7:25 PM Ralf Hemmecke wrote:
> > How can I set an Aldor compiler switch when compiling Aldor code
> > in Axiom?
> )set compiler args "-O -Fasy -Fao -Flsp -laxiom 
> -Mno-AXL_W_WillObsolete 
> -DAxiom -Y $AXIOM/algebra -mno-mactext"
> (all on one line, of course)

Ok, great. I will try this.

> >> With the original (why are you removing the empty
> >> lines???)
> > I am not removing any lines.
> Sorry, Bill. I didn't want to offend. I didn't press the EDIT 
> button and just cut'n'pasted from the green area. So that's my
> fault. Please, forgive me.

No problem! Just so long as we are clear. :)

> > I guess you are running Aldor stand alone?
> Right. I did not see a reason to start Axiom just to check 
> whether the Aldor compile step works.

I suppose that it is good to try it separately just to check
the Aldor compile but of course this code is designed to run
from within Axiom.

>  > How then do you integrate the compiler output with Axiom?
> That was not my main concern. I just tried to compile the code.
> But for including the results with Axiom... I think Martin Rubey
> knows and it should be written on the AxiomWiki -- maybe
> AldorForAxiom or so.

Yes, that is it exactly. That has also been implemented on the
LatexWiki/MathAction extension that runs Axiom Wiki so this is
possible from within a web page.

> >> I haven't found a definition for the "SubDomain" constructor
> >> that appears in src/algebra/integer.spad. :-(
> > Like SubsetCategory, SubDomain is apparently a compiler primative.
> Hmm, that cannot be true.

??? But this is true. src/algebra/integer.spad is written in SPAD.
Did you check the references in the interp/compiler.boot code that
I sent you?

> If I compile just with the Aldor compiler, then the SPAD compiler
> is not involved.

But src/algebra/integer.spad is involved indirectly through
the Axiom library interface, I think.

> So if the Aldor compiler does not complain, it must find
> "SubDomain" in I am pretty sure that the Aldor
> compiler does NOT know of "SubDomain" by itself.

Perhaps it is true that stand alone Aldor does implement
something like SubDomain in the algebra. Aldor, in a sense,
is a more "primitive" compiler than SPAD, i.e. with fewer
things built-in and more of "SPAD" actually coded in Aldor.
Actually this makes Aldor more powerful and flexible than
SPAD. But in Axiom itself, the SPAD compile seems to
implement some of these things as primitives.

> > In the case of both SubsetCategory and SubDomain, the usage
> > is very restricted in the Algebra library - they appear almost
> > to be invented for this one purpose alone.
> Yes, and that might be a reason why you will not find 
> "SubDomain" in the and that is
> distributed with Aldor.

I am not sure I follow you but maybe you mean the same thing
as I said above - that SubDomain is needed to compile
src/algebra/integer.spad and with Axiom, Aldor must interface
with this routine?

> woodpecker:~/scratch/FRAC>aldor -gloop
> %1 >> #include "algebra"
>                                             Comp: 1760 msec, 
> Interp: 10 msec
> %2 >> SubDomain
>        ^
> [L2 C1] #1 (Error) No meaning for identifier `SubDomain'.
> > But I presume that this sort of design has more or less carried over
> > to Aldor, no? How does one define a sub-domain in Aldor?
> There is neither something like PI nor NNI in the Aldor 
> libraries. And till now I did not have any need for them.

Hmmm.... that's interesting.

> But I think you could simply say
> NonNegativeInteger: SomeCategoryForNNI == add {
>    Rep == Integer;
>    ...
>    -- implement the signatures from SomeCategoryForNNI
>    ...
> }
> In integer.spad it says
> NonNegativeInteger: ...
>    == SubDomain(Integer, #1 >= 0) add ...
> So, if I remember correctly, "#1 >=0" is an old way of declaring an 
> anonymous function (without giving the types!!!)
> (x: Integer): Boolean +-> x >=0

No. The expression '#1 >= 0' is a boolean expression which is
saying something like "you can coerce an Integer to an NNI
provided that the integer value is greater than or equal to

> But what does SubDomain return?

SubDomain is an expression that defines a new domain.

> And a much more interesting question: how does this work?

For that you must consult the undocumented interp/compiler.boot
source code. :(

> If I see Integer, than that is a blackbox for me. I only
> know the interface, ie, its type or its category.
> Now what should SubDomain do? It takes, for example, the 
> implementation of a function *: (%, %) -> % from Integer
> and returns another implementation that checks whether the
> input arguments are non-negative and the result is non-negative.

No. I think it simply lifts all operations from Integer to NNI.

> If that were not a compiler primitive, I had no idea how that
> should work on a library level. I think, I would be unable to
> write the constructor "SubDomain" in a proper .as file. I 
> cannot even guess what its input/output types would be.
> I don't like "SubDomain".

I agree that this concept does not seem to be clearly explained
anywhere. There is a little more about this concept in the glossary
of the Axiom book. I would love to see some of the original Axiom
design documentation/papers/notes about this. 

> Oh, something interesting... After the definition of NNI in 
> integer.spad it reads
>    {\bf NNI} depends on itself.
> That is not at all obvious for my eyes. If Integer would be 
> implemented without referring to NNI (and that can be done),
> then NNI could be implemented on top of Integer. So why is there
> a need for a cycle here?

I also do not understand this comment in the code.

Bill Page.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]