On Fri, Feb 09, 2024 at 12:42:39PM +0800, Qian Yun wrote:
> When I was improving "simplifyExp", I met this problem:
> 
> (a^b)^n can get simplified into a^(b*n), when n is Integer.
> 
> but in package TRMANIP(R,F), where F has FunctionSpace R,
> but F does not have RetractableTo Integer.
> 
> So for (a^b)^f, there's no way to tell if (simplifyExp f) is
> Integer or not.
> 
> But in FunctionSpace, there is
> 
> isMult : % -> Union(Record(coef:Z, var:K),"failed")
> 
> I think this function can be used to effectively test if
> a value can be retracted to Integer.
> 
> So, my question is, should FunctionSpace export RetractableTo
> Integer under some circumstances?

That is a subtle question.  First, what RetractableTo really
mean?  IMO RetractableTo should be asserted when there we
have effective test for membership in a subset.  OTOH
things like isMult and isTimes work at level of representation.

In principle representaion of FunctionSpace can be highly
noncanonical and isMult may fail even if expression really
is equal to an integer.

So, IMO 'isMult' can not be used to implement general retraction
to integers.

You ask about "some circumstances".  Currently FunctionSpace(R)
where R is a Ring has RetractableTo(Polynomial(R)).  Polynomial(R)
has FullyRetractableTo(R).  Arguably this RetractableTo could
be replaced by FullyRetractableTo, so assuming that R
has RetractableTo(Integer) then also FunctionSpace(R) would
have RetractableTo(Integer).  OTOH in TranscendentalManipulations
R is only GcdDomain, so no warrantly that we can retract it
to ingegers.

Concerning 'isMult', export in FunctionSpace is a lie, it
is defined only in two cases:

a) when R is a Ring which has RetractableTo(Integer) (so really
   the case above)

b) when the domain is Expression(R) and R is an AbelianMonoid
   which is _not_ a Ring

Moreover, when R is a Ring 'isMult' seem to ignore denominator.

There are also different considerations: some changes that would
be desirable from logical/mathematical point of view lead to
problematic function selection.  In other words interpreter
selects different functions than desired by average user.
As an example let me mention 'inverse' for matrices. 'inverse'
makes sense over rings and in particular we can compute it
over integers.  But we export it only for fields, because
users usualy want inverse over rationals instead of not
so interesting statement that invers over integers does not
exist.

I do not think that is is a problem for retraction to integers, but
just mention the issue for completeness.

-- 
                              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/ZcXBiLHWqdySoRgd%40fricas.org.

Reply via email to