Open YueRen opened 1 month ago
The object x1//2
is an element of the fraction field. That phi
does not accept x1//2
but x1/2
is not a bug. For the same reason a function defined on ZZ accepts 1
but not 1//1
.
Edit: The error could be better though.
I see, so is this a user error and using //
should be discouraged (for people working with polynomials at least)? I must admit that I got used to using //
instead of /
because /
can produce floats which cannot be converted to QQFieldElem
.
As usual the answer is complicated. For all the rings that Oscar introduces, x/y == divexact(x, y)
(aka x * inv(y)
if y
is invertible in the ring). Using //
will always create something in the fraction field. We cannot change what 1/1
does though (as you observed). There was a discussion in https://github.com/oscar-system/Oscar.jl/issues/1618 on the mismatch between 1/1
and ZZ(1)/ZZ(1)
, but we deemed it negligible compared to the advantages.
Got it, I will keep that in mind going forward. Thanks for the clarification!
Let me repurpose this issue as a feature request to some better argument checking in the application of a morphisms.
The feedback of the people coming in touch with Oscar for the first time are quite valuable. Happy to hear suggestions on how to make things easier/clearer with respect to the issues encountered here.
Is it possible to write some generic fall-back code that allows hom to be applied to the fraction field (as long as the denominator is a unit)?
Sorry for the bad title. Found by @yuvraj-singh-math. If
g
is a polynomial,g//1
andg/1
produces two different types. This isn't problematic, as most functions do not distinguish between the resulting types, buthom
does:Code to reproduce the error:
(
QQ
above is not special, the error also occurs over a finite field or a rational function field)Error that is produced: