Bill Page wrote:
> I would like to partially withdraw my comment above. I recall now
> another aspect of SubsetCategory. As Waldek said:
>
> >> ...
> >> SubsetCategory represents different variant of subtyping -- it
> >> is category of subdomains of given domain, without specifying
> >> exact domain
>
> The implication is that as the *category of subdomains*, this
> construction does something that is currently very inconvenient to do
> otherwise in FriCAS - it gives domains that are declared to satisfy
> this category the same exports as the domain R. So when we write:
>
> Localize(M:Module R,
> R:CommutativeRing,
> S:SubsetCategory(Monoid, R)): Module R with
>
> we mean that the domain S must belong to the same categories as R. I
> expect that computing exactly what these categories are is a large
> part of the 30% of the compile time that Waldek cited.
I do not think SubsetCategory implies that S itself belongs to
some other category. Rather, SubsetCategory means that elements
of S may by coerced to R without executing any code. In other
words given element of S you can use it as an argument to any
function defined for R (and get result in R).
I would rather say that SubsetCategory is a dual of SubDomain.
Namely, assume that you want to allow any SubDomain of R
as an argument to a functor. In pseudo code:
Foo(S: Meet(Category(SubDomain(c_1,R)), Category(SubDomain(c_2,R)),
...)) :...
where you will need a infinite list of possible conditions.
Insted, you can write:
Foo(S: SubsetCategory(R)):...
and than
Foo(SubDomain(c_1,R)), Foo(SubDomain(c_2,R)),...
is legal. Note: I did not test if this works, but I believe
it was the intended use.
The compile time cost comes from checking which signatures
are applicable to arguments: for each argument of a call you
need to check if domain of this argument is a subset of some
other domain. Such checks 99.999% of times say no, but
unfortunatly with naive implementation of symbol table
searches which give the 'no' answer are the most expensive
ones. Let me add that we search such information not only
for function calls but also when generating domanis/categries
or importing domains (in such cases we need to check if some
signature is more general than another one and this again
requires checking if function having argument of type T1 can
be applied to argument of type T2) and when searching for
coercions. I have optimized searches using hash table to
be able to quickly deliver 'no' answer, but while we got
nice speedup searches are still expensive (in particular
positive searches pay extra cost of hash table lookup).
> But as pointed
> out here:
>
> http://axiom-wiki.newsynthesis.org/SandBoxSubsetCategory
>
> For example:
>
> )abbrev category GSUBS GroupSubset
> GroupSubset(R:Type):Category == SubsetCategory(Group,R)
>
<snip>
>
> >> System error:
> Caught fatal error [memory may be damaged]
>
Probably unimplemented case (to say the truth, at first glance
this looks tricky with current complilation scheme).
--
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
-~----------~----~----~----~------~----~------~--~---