On Wed, May 01, 2024 at 08:22:41AM +0200, Ralf Hemmecke wrote:
> > Thanks for the testcase.  There was missing transformation, before main
> > compile in effect your program was transformed into a wrong form
> > (not handled by the rest of compiler).  The following worked:
> > 
> > if C has OrderedRing and C has Field then -- OK
> 
> > Early transformation was supposed to transform your Join into 'and'
> > above.  However, the 'and' was supposed to be transformed in turn
> > into:
> 
> > if C has OrderedRing then if C has Field then -- OK
> 
> > and this transformation happended when 'and' was explicit in the source,
> > but did not happen with generated 'and'.  Fixed now
> Than you for the fix. Will recompile soon.
> 
> Just an addon question. Are you saying that
> 
>   if C has Join(A, B)
> 
> and
> 
>   if C has A and C has B
> 
> always end up internally as
> 
>   if C has A then if C has B then ...
> 
> ? Sounds reasonable, but just for curiousity.

Yes.  'if' needs special handling, after ' if C has A then ...'
Spad compiler "knows" that C satisfies more conditions than
implied by original declaration.  Transformations above simplify
handling of 'if'.

> The problem actually occured, because I was looking for "OrderedField",
> could not find it and so replaced it with a Join(OrderedRing, Field).
> 
> It's not totally important, but perhaps it would also make sense to
> introduce "OrderedField" even though that would be a rather trivial addon.

Note that _using_ OrderedField would have nontrivial cost.  Namely,
Spad rules say that something has category "by assertion" and _only_
by assertion.  So domain which satisfies 'Join(OrderedRing, Field)'
would not satisfy 'OrderedField'.  To put this differently, from
point of view of Spad compiler after definition like

OrderedField() : Category == Joint(OrderedIntegralDomain, Field)

'OrderedField' potentially says more than the Join.  In fact,
'OrderedRing' not only says that there is order on the ring,
but also asserts that multiplication is compatible with order
(definition in algebra also adds operations, but even without
extra operations 'OrderedRing' means more than Join).

So to make 'OrderedField' useful we would have to annotate algebra
with several declarations like

   if C has OrderedRing and C has Field then OrderedField

BTW: For domain we can write things like

SortedExponentVector == U32Vector

which basically says that 'SortedExponentVector' is an alias for
'U32Vector'.  BUT ATM this is not supported for categories.
You can write:

OrderedField ==> Joint(OrderedIntegralDomain, Field)

but this is local to a file.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZjI2hH4Y_dFJkpgD%40fricas.org.

Reply via email to