Open thofma opened 2 years ago
I think that such extended functionality is nice as long as the documented underlying rules are easy to understand.
For example, if image(f, obj)
is defined as image(f, coerce_to(domain(f), obj))
whenever parent(obj) != domain(f)
holds then the situation is clear for both users and developers.
If we want to support image(f, set)
for subsets set
of domain(f)
, as in the example of an ideal in domain(f)
, the rule becomes already more complicated.
And then the natural question arises whether set
may also be something that can be coerced to a subset of domain(f)
.
To all lovers of maps, there are some questions that came up during @ThomasBreuer recent cleanup of the julia <-> GAP conversions. Suppose that
f
is aMap
with proper domain and codomain. I will only talk aboutimage(f, x)
, but the same questions arise forpreimage(f, y)
.Should
image(f, x)
only work forparent(x) === domain(f)
or shouldimage(f, x)
also work where we have "canonical" coercions in place?*More concretely, if I have a map
f : QQ[x] -> QQ[x]
, shouldf(1//2)
orf(QQ(1//2))
also work?Pro:
f : QQ[x] -> QQ[x]
to be automatically applicable also to an idealI
ofQQ[x]
viaf(I)
. It think it would be surprising thatf(I)
would work but notf(1//2)
. Of course this point is moot if we do not intend to also allowf(I)
.Con:
*: By canonical coercions I mean here the coercion that is already taken place for binary operations. For example, one can add an element of
QQ
andQQ[x]
or an element ofZZ
and any other (unitary) ring.CC: @ThomasBreuer @fingolfin @fieker