> Bill Page wrote:
>> See: 'Built-in' section of:
>>
>> http://axiom-wiki.newsynthesis.org/SandBoxNonZeroInteger
>>
> ...

On Wed, Dec 3, 2008 at 2:44 PM, Ralf Hemmecke wrote:
> You know that I rather like to do without the SubDomain constructor. Why
> do you want to support SubDomain?

I can answer this at several different levels.

At the most basic and abstract level the reason why I want there to be
a concept of "sub-domain" in FriCAS is so that FriCAS can be formally
modeled as a topos. This means that FriCAS must have limits (e.g.
products such as Record), co-limits (co-products such as Union),
exponentiation (Mapping) and a sub-object classifier. Unions and
sub-objects is where (Boolean) logic enters the system. Modern ideas
about the semantics of programming languages implies that any general
purpose (i.e. sufficiently complete) programming languages it is
possible implement these essential algebraic features. Topos theory
(and category theory in general) has been proposed as an appropriate
foundation for all (or at least a very large part) of mathematics. So
since the purpose of SPAD is to facilitate the general expression of
mathematical algorithms, it seems suitable that SPAD should implement
these universal features in the most direct manner possible.

Other people have suggested that it is not necessary for the object
language (e.g. SPAD or Aldor or even Python) to directly support the
mathematical structures one might wish to implement in a target
mathematical library, but I am strongly of the opinion that the tools
one uses determines to a very large degree the character and type of
solutions one is most likely to implement.

Another reason for wanting something like subdomain is because it is
often much easier and more efficient to implement directly in computer
hardware a complex domain of computation such as Integer or even
Float. Then one can define simpler domains such as the
PositiveIntegers, simply as a forgetful subset. Compare this for
example to the problem of defining Integer from more primitive domains
that we discussed at the last Axiom/Aldor Workshop in RISC:

http://axiom-wiki.newsynthesis.org/SandBoxDefineInteger

> That would make for a new keyword in SPAD.

SubDomain is already a keyword in SPAD (or more accurately a built-in
domain constructor like Record, Union and Mapping).

Unfortunately it is not fully and generally implemented. Union also
has some known flaws and I have argued that the notation used for
Record is not as general as it could be (Union should export injective
maps, i.e. injections and Record should export projective maps, i.e
projections). Mapping is also missing some critical exports.

>
> Actually, Stephen Watt said something with respect to SubDomain.
>
> 1) SubDomain(X, p?) should not export anything. It cannot inherit
> any function from X since as with your NonZeroInteger, there is
> actually no relation between the categories of INT and NZINT. The
> latter is not an AbelianMonoid anymore.
>
> 2) The only knowledge that the SubDomain constructor states is
> that X and SubDomain(X, p?) have exactly the same representation.
> So there SubDomain(X, p?) could be made to export
>
>   coerce: % -> X
>   retractIfCan: X -> Union(%, "failed")
>   retract: X -> % -- actually that might throw an exception
>
> with the obvious default implementation.
>

I agree with this. Right now these things are implemented as special
purpose built-in logic in the interpreter. This makes accessing these
features from the FriCAS library rather difficult. It would be much
better and more general to implement these features in the manner
suggested by Stephen.

> So what advantage does the (undocumented) SubDomain constructor
> bring for you?
>

See above. I hope that this discussion and my experiments on the
axiom-wiki will contribute to the available documentation, eventually
leading to a better implementation in FriCAS.

> One can easily do without, as the Aldor libraries show.

I do not agree that the Aldor libraries show that it is "easy" - but
"possible", yes.

> The only thing that SubDomain adds is the "p?" in ist argument
> which is accessible to the compiler.

Since p? is a Boolean function that must interact with 'case' of Union
and programming logic in general I think that it adds a lot!

> But I rather opt for a general mechanism to incorporate a
> specification language into SPAD than to just allow a hack
> for SubDomain.
>

I do not want a "hack for SubDomain". I think the idea of a
specification language for SPAD is an interesting but separate issue.

> Other opinions?
>

I hope so! :-)

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