Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing preimage methods and/or need to extend the map specification #1446

Open
fingolfin opened this issue Sep 19, 2023 · 0 comments
Open

Comments

@fingolfin
Copy link
Member

There are two tests in AA which seem to use preimage:

test/generic/QuotientModule-test.jl:177:         @test h(preimage(h, n)) == n
test/generic/Submodule-test.jl:160:         pre = preimage(f, n)

But in general there don't seem to be preimage methods. I took this examples fromtest/generic/MapWithInverse-test.jl:

julia> u = map_with_section_from_func(x -> x + 1, x -> x - 1, ZZ, ZZ)
Map with section
  from integers
  to integers

julia> u(ZZ(1))
2

But playing with this reveals image and preimage don't exist and in general I found no way to get a preimage other than asking for the preimage map

julia> image(u, ZZ(1))
ERROR: MethodError: no method matching image(::AbstractAlgebra.Generic.MapWithSection{AbstractAlgebra.Integers{BigInt}, AbstractAlgebra.Integers{BigInt}}, ::BigInt)
Stacktrace:
 [1] top-level scope
   @ REPL[34]:1

julia> preimage(u, ZZ(1))
ERROR: MethodError: no method matching preimage(::AbstractAlgebra.Generic.MapWithSection{AbstractAlgebra.Integers{BigInt}, AbstractAlgebra.Integers{BigInt}}, ::BigInt)

Closest candidates are:
  preimage(::AbstractAlgebra.Generic.CompositeMap, ::Any)
   @ AbstractAlgebra ~/Projekte/OSCAR/AbstractAlgebra.jl/src/NemoStuff.jl:564

Stacktrace:
 [1] top-level scope
   @ REPL[35]:1

We only have this:

julia> preimage_map(u)
Map defined by a Julia function
  from integers
  to integers

IMHO preimage should be supported by all maps where it makes sense (whether they have a section or are outright invertible). And personally I'd also like to see image(f,x) work in addition to f(x) but that's secondary.

Originally posted by @fingolfin in #1441 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant