diff --git a/experimental/GModule/GaloisCohomology.jl b/experimental/GModule/GaloisCohomology.jl index 295e6402cc06..555f44199a19 100644 --- a/experimental/GModule/GaloisCohomology.jl +++ b/experimental/GModule/GaloisCohomology.jl @@ -1081,15 +1081,15 @@ function Oscar.completion(I::IdelParent, P::NfAbsOrdIdl) mUp = I.L[p] mGp = I.D[p] - inj = Hecke.canonical_injection(I.M, p+1) #units are first - pro = Hecke.canonical_projection(I.M, p+1) + inj = canonical_injection(I.M, p+1) #units are first + pro = canonical_projection(I.M, p+1) @assert domain(inj) == codomain(pro) J = components(I.M)[p+1] if mKp.P == P #easy case - return Kp, mKp, mGp, mUp, pro * Hecke.canonical_projection(J, 1) , Hecke.canonical_injection(J, 1)*inj + return Kp, mKp, mGp, mUp, pro * canonical_projection(J, 1), canonical_injection(J, 1)*inj end prm = get_attribute(J, :induce)[2] @@ -1100,7 +1100,7 @@ function Oscar.completion(I::IdelParent, P::NfAbsOrdIdl) nKp = MapFromFunc(I.k, Kp, x->mKp(mG(pr)(x)), y->mG(inv(pr))(preimage(mKp, y))) - return Kp, nKp, mGp, mUp, pro * Hecke.canonical_projection(J, z[1]), Hecke.canonical_injection(J, z[1])*inj + return Kp, nKp, mGp, mUp, pro * canonical_projection(J, z[1]), canonical_injection(J, z[1])*inj end function Oscar.map_entries(mp::Union{Map, Function}, C::GrpCoh.CoChain{N, G, M}; parent::GModule) where {N, G, M} @@ -1726,11 +1726,11 @@ end function serre(A::IdelParent, P::Union{Integer, ZZRingElem}) C = A.data[1] t = findfirst(isequal(ZZ(P)), [minimum(x) for x = A.S]) - Inj = Hecke.canonical_injection(A.M, t+1) - Pro = Hecke.canonical_projection(A.M, t+1) + Inj = canonical_injection(A.M, t+1) + Pro = canonical_projection(A.M, t+1) - inj = Hecke.canonical_injection(domain(Inj), 1) - pro = Hecke.canonical_projection(domain(Inj), 1) + inj = canonical_injection(domain(Inj), 1) + pro = canonical_projection(domain(Inj), 1) Kp, mKp, mGp, mUp, _, _ = completion(A, A.S[t]) @assert domain(inj) == domain(mUp) diff --git a/src/Modules/FreeModules-graded.jl b/src/Modules/FreeModules-graded.jl index af637f836c4a..864b8ce6ddf4 100644 --- a/src/Modules/FreeModules-graded.jl +++ b/src/Modules/FreeModules-graded.jl @@ -1214,25 +1214,32 @@ function direct_product(G::ModuleFP_dec...; task::Symbol = :none) end ⊕(M::ModuleFP_dec...) = direct_product(M..., task = :none) +function canonical_injections(G::ModuleFP_dec) + H = get_attribute(G, :direct_product) + @req H !== nothing "module not a direct product" + return [canonical_injection(G, i) for i in 1:length(H)] +end -function Hecke.canonical_injection(G::ModuleFP_dec, i::Int) +function canonical_injection(G::ModuleFP_dec, i::Int) H = get_attribute(G, :direct_product) - if H === nothing - error("module not a direct product") - end - 0 domain(A[ij[1],ij[2]]) === tM[ij[1]] && codomain(A[ij[1],ij[2]]) === tN[ij[2]], Base.Iterators.ProductIterator((1:size(A, 1), 1:size(A, 2)))) #need the canonical maps..., maybe store them as well? - return hom(M,N,Vector{elem_type(N)}([sum([Hecke.canonical_injection(N,j)(sum([A[i,j](Hecke.canonical_projection(M,i)(g)) for i=1:length(tM)])) for j=1:length(tN)]) for g in gens(M)])) + return hom(M,N,Vector{elem_type(N)}([sum([canonical_injection(N,j)(sum([A[i,j](canonical_projection(M,i)(g)) for i=1:length(tM)])) for j=1:length(tN)]) for g in gens(M)])) end # hom(prod -> X), hom(x -> prod) # if too much time: improve the hom(A, B) in case of A and/or B are products - or maybe not... @@ -7299,45 +7299,64 @@ end ⊕(M::ModuleFP...) = direct_sum(M..., task = :none) +@doc raw""" + canonical_injections(G::ModuleFP) + +Return the canonical injections from all components into $G$ +where $G = G_1 \oplus \cdot \oplus G_n$. +""" +function canonical_injections(G::ModuleFP) + H = get_attribute(G, :direct_product) + @req H !== nothing "module not a direct product" + return [canonical_injection(G, i) for i in 1:length(H)] +end @doc raw""" - Hecke.canonical_injection(G::ModuleFP, i::Int) + canonical_injection(G::ModuleFP, i::Int) Return the canonical injection $G_i \to G$ where $G = G_1 \oplus \cdot \oplus G_n$. """ -function Hecke.canonical_injection(G::ModuleFP, i::Int) +function canonical_injection(G::ModuleFP, i::Int) H = get_attribute(G, :direct_product) - if H === nothing - error("module not a direct product") - end + @req H !== nothing "module not a direct product" injection_dictionary = get_attribute(G, :injection_morphisms) if haskey(injection_dictionary, i) return injection_dictionary[i] end - 0