Ralf Hemmecke wrote:
> 
> > Opinions?
> 
> I don't really think these forgetful functors are needed. Do you have 
> some concrete use cases?
> 
> Why do I believe they are unnecessary?
> If ever one wants to compute with a monoid then one would write a package
> 
> Pkg(M: Monoid): with ... === add ...
> 
> Inside "add" one can only rely on monoid operations. But calling 
> Pkg(Integer) works fine and basically automatically forgets about the 
> ring properties.

Main point is not new code, but re-using the old one.  For example,
to get non-canceling fractions simply make sure that argument to
Fraction do not have GcdDomain.  I hit that issue several times.
Admitedly, one may wish to add extra functionality to such domain,
for example coercions to/from base domain (actually if we were
to include them, having coercions seem to be better than what
I wrote above).


For new code you may wish to avoid inheriting unwanted operations.

Currently we have several domains defined like:

Dom1 : Cat1 == Dom2 add ...

while definition like:

Dom1 : Cat1 == AsCat2(Dom2) add ...

would be safer.

> And unless SPAD semantics is different from Aldor semantics there was an 
> issue at the Aldor Workshop 2007 where I constructed legal Aldor code 
> that inhabits a domain of non-negative numbers with a -1 (see attachment).
> 
> Looking at http://axiom-wiki.newsynthesis.org/SandBoxAldorSemantics 
> seems to show that your definition
> 
>    AsRing(R : Ring) : Ring == R
> 
> doesn't actually do what it should. I'm pretty sure that falls into the
> 
>    B: CatA == Dom;
> 
> class and leads to somewhat surprising (not necessarily wrong) results 
> for "AsRing(Fraction Integer) has Field".

No, as you see below it works OK.  Maybe you compared this to:

Dom1 == Dom2

but the two definitions are quite different: first specifies
category and the result is _exactly_ of the specified category.
The second one first computes type (= category) of Dom2 and
then uses it as category of Dom1.

> Interestingly, SPAD is really different from Aldor in this case.
> 
> ---rhxBEGIN asring.as
> #include "algebra"
> #include "aldorio"
> 
> AsRing1(R: Ring): Ring == R;
> AsRing2(R: Ring): Ring == R add;
> 
> stdout << "1: " << (AsRing1(Fraction Integer) has Field) << newline;
> stdout << "2: " << (AsRing2(Fraction Integer) has Field) << newline;
> ---rhxEND
> 
> This program returns:
> 
> 1: T
> 2: F
> 
> while
> 
> ---rhxBEGIN asring.spad
> )abbrev domain ASRING AsRing
> AsRing(R : Ring) : Ring == R
> ---rhxEND
> 
> (1) -> AsRing(Fraction Integer) has Field
> 
>     (1)  false
> 
> Anyway, I think, unless you give a convincing use case, adding forgetful 
> functors is unnecessary.
> 

-- 
                              Waldek Hebisch
[email protected] 

-- 
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