Ralf Hemmecke wrote:
> 
> Hi Waldek,
> 
> My new machinery did not consider situations of the form
> 
>     if % has Ring then
>        minPoly: K -> SparseUnivariatePolynomial %
>          ++ minPoly(k) returns p such that \spad{p(k) = 0}.
> 
> This is actual code from the code of ExpressionSpace.
> 
> https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/fspace.spad.pamphlet#L165
> 
> Although this might be a syntactically correct statement and it probably 
> also works, since "% has Ring" is evaluated at runtime, it still looks a 
> bit wierd to me.
> 
> Why? Because it needs something like
> 
> D: Join(ExpressionSpace, Ring)
> 
> in order for D to provide "minPoly".
> 
> So an "external" category triggers whether "minPoly" is exported or not.
> 
> But, OK, that's the way it is.

The only thing which raises questions is why Ring is enough
(it is clear that Field is sufficient).  Otherwise I do not
consider this weird: we simply write conditions that are needed
to implement given function.  In this place it immaterial
when '% has Ring'.

> 
> Only one question, where can I find the code that deals with this case?
 
I am affraid there is no simple answer: all exports carry conditions.
Handling of conditions is spread out into several places: JoinInner
(and functions it calls) is responsible for merging export lists.
'knownInfo' decides if conditions is true in given context (and
context changes dynamically during compilation).  Modemap selection
checks (using 'knownInfo') if conditions are satisfied and if
not it skips given modemap.

> Will it also just doe something like
> 
>    if % has T then
>        foo: X -> Dom(% pretend S)
> 
> where S is the category from the argument of Dom, i.e. Dom was defined as:
> 
>    Dome(D: S): with ...
> 
> ?
> 
> There is no checking of Join(categoryOf(%), T) actually refines S (so it 
> is somewhat unsafe, but at least it should work.

I think it is safe in the sense that to actually use conditional
export you need to create appropriate domains.  My impression
is that checks done at creation time prevents using incorrect
constructs.  However, even if this impression is correct it
would be better to reject wrong constructs early, rather
than compiling wrong code which can not be correctly called.

> Ralf
> 
> PS: The documentation for "minPoly is questionable.
> 1) Always returning the zero polynomial would perfectly match the 
> specification.
> 2) Nothing says that the returned polynomial has minimal degree.
> 3) Nothing says that a *non-zero* polynomial exists (and in general 
> domains it certainly doesn't).

AFAICS for transcendental kernels 'minPoly' returns linear
polynomial.  But returning 0 probably would be good enough.
Anyway, I am not sure if I want to comit to always
returning nonzero result.

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