diff --git a/Project.toml b/Project.toml index e65f9aec36c1..745b6a756afa 100644 --- a/Project.toml +++ b/Project.toml @@ -25,22 +25,22 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" cohomCalg_jll = "5558cf25-a90e-53b0-b813-cadaa3ae7ade" [compat] -AbstractAlgebra = "0.40.8" +AbstractAlgebra = "0.41.3" AlgebraicSolving = "0.4.11" Distributed = "1.6" DocStringExtensions = "0.8, 0.9" GAP = "0.10.2" -Hecke = "0.30.11" +Hecke = "0.31.3" JSON = "^0.20, ^0.21" JSON3 = "1.13.2" LazyArtifacts = "1.6" -Nemo = "0.43.3" +Nemo = "0.44.0" Pkg = "1.6" Polymake = "0.11.14" Random = "1.6" RandomExtensions = "0.4.3" Serialization = "1.6" -Singular = "0.22.4" +Singular = "0.23.0" TOPCOM_jll = "0.17.8" UUIDs = "1.6" cohomCalg_jll = "0.32.0" diff --git a/docs/src/CommutativeAlgebra/rings.md b/docs/src/CommutativeAlgebra/rings.md index aa09ec1d811b..d9ea584c43b9 100644 --- a/docs/src/CommutativeAlgebra/rings.md +++ b/docs/src/CommutativeAlgebra/rings.md @@ -405,7 +405,7 @@ julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) julia> B = MPolyBuildCtx(R) -Builder for an element of Multivariate polynomial ring in 2 variables over QQ +Builder for an element of multivariate polynomial ring julia> for i = 1:5 push_term!(B, QQ(i), [i, i-1]) end diff --git a/docs/src/NumberTheory/galois.md b/docs/src/NumberTheory/galois.md index 9294ab41c1b8..0d878cbbd3f8 100644 --- a/docs/src/NumberTheory/galois.md +++ b/docs/src/NumberTheory/galois.md @@ -96,10 +96,10 @@ julia> F, a = function_field(x^6 + 108*t^2 + 108*t + 27); julia> subfields(F) 4-element Vector{Any}: - (Function Field over Rational field with defining polynomial a^3 + 54*t + 27, (1//12*_a^4 + (3//2*t + 3//4)*_a)//(t + 1//2)) - (Function Field over Rational field with defining polynomial a^2 + 108*t^2 + 108*t + 27, _a^3) - (Function Field over Rational field with defining polynomial a^3 - 108*t^2 - 108*t - 27, -_a^2) - (Function Field over Rational field with defining polynomial a^3 - 54*t - 27, (-1//12*_a^4 + (3//2*t + 3//4)*_a)//(t + 1//2)) + (Function Field over QQ with defining polynomial a^3 + 54*t + 27, (1//12*_a^4 + (3//2*t + 3//4)*_a)//(t + 1//2)) + (Function Field over QQ with defining polynomial a^2 + 108*t^2 + 108*t + 27, _a^3) + (Function Field over QQ with defining polynomial a^3 - 108*t^2 - 108*t - 27, -_a^2) + (Function Field over QQ with defining polynomial a^3 - 54*t - 27, (-1//12*_a^4 + (3//2*t + 3//4)*_a)//(t + 1//2)) julia> galois_group(F) (Permutation group of degree 6 and order 6, Galois context for s^6 + 108*t^2 + 540*t + 675) diff --git a/experimental/GModule/Cohomology.jl b/experimental/GModule/Cohomology.jl index 2448b469e5a1..77e5bf91e9a3 100644 --- a/experimental/GModule/Cohomology.jl +++ b/experimental/GModule/Cohomology.jl @@ -380,8 +380,8 @@ function Oscar.direct_product(C::GModule...; task::Symbol = :none) @assert all(x->x.G == G, C) mM, pro, inj = direct_product([x.M for x = C]..., task = :both) - mC = gmodule(G, [direct_sum(mM, mM, [action(C[i], g) for i=1:length(C)]) for g = gens(G)]) - mC.iac = [direct_sum(mM, mM, [action(C[i], inv(g)) for i=1:length(C)]) for g = gens(G)] + mC = gmodule(G, [hom_direct_sum(mM, mM, [action(C[i], g) for i=1:length(C)]) for g = gens(G)]) + mC.iac = [hom_direct_sum(mM, mM, [action(C[i], inv(g)) for i=1:length(C)]) for g = gens(G)] if task == :none return mC @@ -403,7 +403,7 @@ function Oscar.tensor_product(C::GModule{<:Any, FinGenAbGroup}...; task::Symbol @assert all(x->x.G == C[1].G, C) T, mT = Oscar.tensor_product([x.M for x = C]...; task = :map) - TT = gmodule(T, C[1].G, [hom(T, T, [action(C[i], g) for i=1:length(C)]) for g = gens(C[1].G)]) + TT = gmodule(T, C[1].G, [hom_tensor(T, T, [action(C[i], g) for i=1:length(C)]) for g = gens(C[1].G)]) if task == :map return TT, mT else @@ -492,6 +492,7 @@ _rank(M) = rank(M) Oscar.dim(C::GModule) = _rank(C.M) Oscar.base_ring(C::GModule) = base_ring(C.M) +Oscar.base_ring_type(::Type{GModule{gT, mT}}) where {gT, mT} = base_ring_type(mT) Oscar.group(C::GModule) = C.G ########################################################### diff --git a/experimental/GModule/GModule.jl b/experimental/GModule/GModule.jl index 01b5c6d4cb4f..34450024d1ff 100644 --- a/experimental/GModule/GModule.jl +++ b/experimental/GModule/GModule.jl @@ -40,10 +40,10 @@ julia> C = gmodule(CyclotomicField, C); julia> h = subfields(base_ring(C), degree = 2)[1][2]; julia> restriction_of_scalars(C, h) -G-module for G acting on vector space of dimension 4 over number field of degree 2 over QQ +G-module for G acting on vector space of dimension 4 over number field julia> restriction_of_scalars(C, QQ) -G-module for G acting on vector space of dimension 8 over rational field +G-module for G acting on vector space of dimension 8 over QQ ``` """ diff --git a/experimental/GModule/Misc.jl b/experimental/GModule/Misc.jl index 54e16c35118f..9bc37f9b1bb3 100644 --- a/experimental/GModule/Misc.jl +++ b/experimental/GModule/Misc.jl @@ -2,7 +2,6 @@ module Misc using Oscar import Base: ==, parent -export coimage export relative_field Hecke.minpoly(a::QQBarFieldElem) = minpoly(Hecke.Globals.Qx, a) @@ -194,11 +193,6 @@ end ## functions that will eventually get defined in Hecke.jl, ## and then should get removed here -function Hecke.roots(a::FinFieldElem, i::Int) - kx, x = polynomial_ring(parent(a), cached = false) - return roots(x^i-a) -end - function Oscar.dual(h::Map{FinGenAbGroup, FinGenAbGroup}) A = domain(h) B = codomain(h) @@ -253,27 +247,6 @@ Hecke.extend(::Hecke.QQEmb, mp::MapFromFunc{QQField, AbsSimpleNumField}) = compl Hecke.restrict(::Hecke.NumFieldEmb, ::Map{QQField, AbsSimpleNumField}) = complex_embeddings(QQ)[1] -""" - direct_sum(G::FinGenAbGroup, H::FinGenAbGroup, V::Vector{<:Map{FinGenAbGroup, FinGenAbGroup}}) - -For groups `G = prod G_i` and `H = prod H_i` as well as maps `V_i: G_i -> H_i`, -build the induced map from `G -> H`. -""" -function Oscar.direct_sum(G::FinGenAbGroup, H::FinGenAbGroup, V::Vector{<:Map{FinGenAbGroup, FinGenAbGroup}}) - dG = get_attribute(G, :direct_product) - dH = get_attribute(H, :direct_product) - - if dG === nothing || dH === nothing - error("both groups need to be direct products") - end - @assert length(V) == length(dG) == length(dH) - - @assert all(i -> domain(V[i]) == dG[i] && codomain(V[i]) == dH[i], 1:length(V)) - h = hom(G, H, cat([matrix(V[i]) for i=1:length(V)]..., dims=(1,2)), check = !true) - return h - -end - #XXX: have a type for an implicit field - in Hecke? # add all(?) the other functions to it function relative_field(m::Map{<:AbstractAlgebra.Field, <:AbstractAlgebra.Field}) @@ -387,133 +360,17 @@ function Hecke.induce_rational_reconstruction(a::ZZMatrix, pg::ZZRingElem; Error end -############################################################################# -## -## functions that will eventually get defined in Nemo.jl, -## and then should get removed here - -function (k::Nemo.fpField)(a::Vector) - @assert length(a) == 1 - return k(a[1]) -end - -function (k::fqPolyRepField)(a::Vector) - return k(polynomial(Native.GF(Int(characteristic(k))), a)) -end - - ############################################################################# ## ## functions that will eventually get defined in AbstractAlgebra.jl, ## and then should get removed here -Base.pairs(M::MatElem) = Base.pairs(IndexCartesian(), M) -Base.pairs(::IndexCartesian, M::MatElem) = Base.Iterators.Pairs(M, CartesianIndices(axes(M))) - -Oscar.matrix(phi::Generic.IdentityMap{<:AbstractAlgebra.FPModule}) = identity_matrix(base_ring(domain(phi)), dim(domain(phi))) - -Oscar.gen(M::AbstractAlgebra.FPModule, i::Int) = M[i] - -Oscar.is_free(M::Generic.FreeModule) = true Oscar.is_free(M::Generic.DirectSumModule) = all(is_free, M.m) -function Base.iterate(M::AbstractAlgebra.FPModule{T}) where T <: FinFieldElem - k = base_ring(M) - if dim(M) == 0 - return zero(M), iterate([1]) - end - p = Base.Iterators.ProductIterator(Tuple([k for i=1:dim(M)])) - f = iterate(p) - return M(elem_type(k)[f[1][i] for i=1:dim(M)]), (f[2], p) -end - -function Base.iterate(::AbstractAlgebra.FPModule{<:FinFieldElem}, ::Tuple{Int64, Int64}) - return nothing -end - -Oscar.issubset(M::AbstractAlgebra.FPModule{T}, N::AbstractAlgebra.FPModule{T}) where T<:RingElement = is_submodule(M, N) - -function is_sub_with_data(M::AbstractAlgebra.FPModule{T}, N::AbstractAlgebra.FPModule{T}) where T<:RingElement - fl = is_submodule(N, M) - if fl - return fl, hom(M, N, elem_type(N)[N(m) for m = gens(M)]) - else - return fl, hom(M, N, elem_type(N)[zero(N) for m = gens(M)]) - end -end - -function Oscar.hom(V::AbstractAlgebra.Module, W::AbstractAlgebra.Module, v::Vector{<:ModuleElem}; check::Bool = true) - if ngens(V) == 0 - return Generic.ModuleHomomorphism(V, W, zero_matrix(base_ring(V), ngens(V), ngens(W))) - end - return Generic.ModuleHomomorphism(V, W, reduce(vcat, [x.v for x = v])) -end -function Oscar.hom(V::AbstractAlgebra.Module, W::AbstractAlgebra.Module, v::MatElem; check::Bool = true) - return Generic.ModuleHomomorphism(V, W, v) -end -function Oscar.inv(M::Generic.ModuleHomomorphism) - return hom(codomain(M), domain(M), inv(matrix(M))) -end - -Oscar.is_finite(M::AbstractAlgebra.FPModule{<:FinFieldElem}) = true - -function Oscar.order(F::AbstractAlgebra.FPModule{<:FinFieldElem}) - return order(base_ring(F))^dim(F) -end - -function Base.iterate(M::AbstractAlgebra.FPModule{T}, st::Tuple{<:Tuple, <:Base.Iterators.ProductIterator}) where T <: FinFieldElem - n = iterate(st[2], st[1]) - if n === nothing - return n - end - return M(elem_type(base_ring(M))[n[1][i] for i=1:dim(M)]), (n[2], st[2]) -end - -function Base.length(M::AbstractAlgebra.FPModule{T}) where T <: FinFieldElem - return Int(order(M)) -end - -function Base.eltype(M::AbstractAlgebra.FPModule{T}) where T <: FinFieldElem - return elem_type(M) -end - -function Oscar.dim(M::AbstractAlgebra.Generic.DirectSumModule{<:FieldElem}) - return sum(dim(x) for x = M.m) -end - -Base.:*(a::T, b::Generic.ModuleHomomorphism{T}) where {T} = hom(domain(b), codomain(b), a * matrix(b)) -Base.:*(a::T, b::Generic.ModuleIsomorphism{T}) where {T} = hom(domain(b), codomain(b), a * matrix(b)) -Base.:+(a::Generic.ModuleHomomorphism, b::Generic.ModuleHomomorphism) = hom(domain(a), codomain(a), matrix(a) + matrix(b)) -Base.:-(a::Generic.ModuleHomomorphism, b::Generic.ModuleHomomorphism) = hom(domain(a), codomain(a), matrix(a) - matrix(b)) -Base.:-(a::Generic.ModuleHomomorphism) = hom(domain(a), codomain(a), -matrix(a)) - -function Base.:(==)(a::Union{Generic.ModuleHomomorphism, Generic.ModuleIsomorphism}, b::Union{Generic.ModuleHomomorphism, Generic.ModuleIsomorphism}) - domain(a) === domain(b) || return false - codomain(a) === codomain(b) || return false - return matrix(a) == matrix(b) -end - -function Base.hash(a::Union{Generic.ModuleHomomorphism, Generic.ModuleIsomorphism}, h::UInt) - h = hash(domain(a), h) - h = hash(codomain(a), h) - h = hash(matrix(a), h) - return h -end - function Oscar.pseudo_inv(h::Generic.ModuleHomomorphism) return MapFromFunc(codomain(h), domain(h), x->preimage(h, x)) end -function Oscar.direct_sum(M::AbstractAlgebra.Generic.DirectSumModule{T}, N::AbstractAlgebra.Generic.DirectSumModule{T}, mp::Vector{AbstractAlgebra.Generic.ModuleHomomorphism{T}}) where T - @assert length(M.m) == length(mp) == length(N.m) - return hom(M, N, cat(map(matrix, mp)..., dims = (1,2))) -end - -function coimage(h::Map) - return quo(domain(h), kernel(h)[1]) -end - end # module using .Misc -export coimage export relative_field diff --git a/experimental/LieAlgebras/src/LieAlgebras.jl b/experimental/LieAlgebras/src/LieAlgebras.jl index 649dce18f6b4..db8d0b8b4b55 100644 --- a/experimental/LieAlgebras/src/LieAlgebras.jl +++ b/experimental/LieAlgebras/src/LieAlgebras.jl @@ -45,8 +45,9 @@ import ..Oscar: gen, gens, height, - hom_tensor, hom, + hom_direct_sum, + hom_tensor, ideal, identity_map, image, @@ -131,7 +132,6 @@ export exterior_power export fundamental_weight export fundamental_weights export general_linear_lie_algebra -export hom_direct_sum export induced_map_on_symmetric_power export induced_map_on_tensor_power export is_cartan_matrix @@ -260,7 +260,6 @@ export exterior_power export fundamental_weight export fundamental_weights export general_linear_lie_algebra -export hom_direct_sum export induced_map_on_symmetric_power export induced_map_on_tensor_power export is_cartan_matrix diff --git a/experimental/LinearQuotients/src/cox_rings.jl b/experimental/LinearQuotients/src/cox_rings.jl index 7648d81cc871..d98c0bd66fd8 100644 --- a/experimental/LinearQuotients/src/cox_rings.jl +++ b/experimental/LinearQuotients/src/cox_rings.jl @@ -6,6 +6,10 @@ base_ring(HBB::HomBasisBuilder) = HBB.R +base_ring_type( + ::Type{HomBasisBuilder{RingType,RingElemType}} +) where {RingType,RingElemType} = RingType + power_product_cache(HBB::HomBasisBuilder) = HBB.C group(HBB::HomBasisBuilder) = HBB.G diff --git a/experimental/LinearQuotients/src/linear_quotients.jl b/experimental/LinearQuotients/src/linear_quotients.jl index b1b6b88772f6..7b706c3cec1f 100644 --- a/experimental/LinearQuotients/src/linear_quotients.jl +++ b/experimental/LinearQuotients/src/linear_quotients.jl @@ -22,6 +22,7 @@ end group(L::LinearQuotient) = L.group base_ring(L::LinearQuotient) = base_ring(group(L)) +base_ring_type(::Type{LinearQuotient{S,T}}) where {S,T} = base_ring_type(MatrixGroup{S,T}) function fixed_root_of_unity(L::LinearQuotient) if isdefined(L, :root_of_unity) diff --git a/experimental/ModStd/src/ModStdQt.jl b/experimental/ModStd/src/ModStdQt.jl index b4268bc519bd..20f36b48a9e1 100644 --- a/experimental/ModStd/src/ModStdQt.jl +++ b/experimental/ModStd/src/ModStdQt.jl @@ -591,7 +591,7 @@ julia> f = factor_absolute((X[1]^2+a[1]*X[2]^2)*(X[1]+2*X[2]+3*a[1]+4*a[2])) julia> parent(f[3][1]) Multivariate polynomial ring in 2 variables X[1], X[2] - over fraction field of multivariate polynomial ring + over fraction field of Qa julia> parent(f[2][1]) Multivariate polynomial ring in 2 variables X[1], X[2] diff --git a/experimental/Schemes/CoveredProjectiveSchemes.jl b/experimental/Schemes/CoveredProjectiveSchemes.jl index 4a17ec3edcf3..6b56b606d78d 100644 --- a/experimental/Schemes/CoveredProjectiveSchemes.jl +++ b/experimental/Schemes/CoveredProjectiveSchemes.jl @@ -311,7 +311,7 @@ julia> R, (x,y,z) = QQ["x", "y", "z"]; julia> Oscar.empty_covered_projective_scheme(R) Relative projective scheme - over empty covered scheme over multivariate polynomial ring + over empty covered scheme over R covered with 0 projective patches ``` """ diff --git a/experimental/Schemes/duValSing.jl b/experimental/Schemes/duValSing.jl index a359008e96ee..38e742e8ed5a 100644 --- a/experimental/Schemes/duValSing.jl +++ b/experimental/Schemes/duValSing.jl @@ -14,7 +14,7 @@ Ideal generated by x^2 + y^3 + z^4 julia> Rq, _ = quo(R,I) -(Quotient of multivariate polynomial ring by ideal (w, x^2 + y^3 + z^4), Map: multivariate polynomial ring -> Rq) +(Quotient of multivariate polynomial ring by ideal (w, x^2 + y^3 + z^4), Map: R -> Rq) julia> X = spec(Rq) Spectrum @@ -78,7 +78,7 @@ Ideal generated by x^2 + y^3 + z^4 julia> Rq, _ = quo(R,I) -(Quotient of multivariate polynomial ring by ideal (w, x^2 + y^3 + z^4), Map: multivariate polynomial ring -> Rq) +(Quotient of multivariate polynomial ring by ideal (w, x^2 + y^3 + z^4), Map: R -> Rq) julia> J = ideal(R,[x,y,z,w]) Ideal generated by @@ -158,7 +158,7 @@ Ideal generated by x^2 + y^3 + z^4 julia> Rq, _ = quo(R,I) -(Quotient of multivariate polynomial ring by ideal (w, x^2 + y^3 + z^4), Map: multivariate polynomial ring -> Rq) +(Quotient of multivariate polynomial ring by ideal (w, x^2 + y^3 + z^4), Map: R -> Rq) julia> J = ideal(R,[x,y,z,w]) Ideal generated by diff --git a/src/Combinatorics/SimplicialComplexes.jl b/src/Combinatorics/SimplicialComplexes.jl index 1edd796bcb98..e00d6a293045 100644 --- a/src/Combinatorics/SimplicialComplexes.jl +++ b/src/Combinatorics/SimplicialComplexes.jl @@ -370,7 +370,7 @@ Return the Stanley-Reisner ring of the abstract simplicial complex `K`, as a quo julia> R, _ = ZZ["a","b","c","d","e","f"]; julia> stanley_reisner_ring(R, real_projective_plane()) -(Quotient of multivariate polynomial ring by ideal (a*b*c, a*b*d, a*e*f, b*e*f, a*c*f, a*d*e, c*d*e, c*d*f, b*c*e, b*d*f), Map: multivariate polynomial ring -> quotient of multivariate polynomial ring) +(Quotient of multivariate polynomial ring by ideal (a*b*c, a*b*d, a*e*f, b*e*f, a*c*f, a*d*e, c*d*e, c*d*f, b*c*e, b*d*f), Map: R -> quotient of multivariate polynomial ring) ``` """ stanley_reisner_ring(R::MPolyRing, K::SimplicialComplex) = quo(R, stanley_reisner_ideal(R, K)) diff --git a/src/Groups/matrices/MatGrp.jl b/src/Groups/matrices/MatGrp.jl index ce833179a1b1..439147c289a6 100644 --- a/src/Groups/matrices/MatGrp.jl +++ b/src/Groups/matrices/MatGrp.jl @@ -450,6 +450,8 @@ Return the base ring of the underlying matrix of `x`. """ base_ring(x::MatrixGroupElem) = x.parent.ring +base_ring_type(::Type{<:MatrixGroupElem{RE}}) where {RE} = parent_type(RE) + parent(x::MatrixGroupElem) = x.parent """ @@ -512,6 +514,8 @@ Return the base ring of the matrix group `G`. """ base_ring(G::MatrixGroup{RE}) where RE <: RingElem = G.ring::parent_type(RE) +base_ring_type(::Type{<:MatrixGroup{RE}}) where {RE} = parent_type(RE) + """ degree(G::MatrixGroup) diff --git a/src/Modules/ModuleTypes.jl b/src/Modules/ModuleTypes.jl index a2416d45c949..b771dfac76a2 100644 --- a/src/Modules/ModuleTypes.jl +++ b/src/Modules/ModuleTypes.jl @@ -116,7 +116,7 @@ julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) julia> F = free_module(R, 3) -Free module of rank 3 over Multivariate polynomial ring in 2 variables over QQ +Free module of rank 3 over R julia> f = F(sparse_row(R, [(1,x),(3,y)])) x*e[1] + y*e[3] diff --git a/src/Modules/ModulesGraded.jl b/src/Modules/ModulesGraded.jl index 01257946083d..ad82e60c8d40 100644 --- a/src/Modules/ModulesGraded.jl +++ b/src/Modules/ModulesGraded.jl @@ -2153,6 +2153,8 @@ Return the underlying ring of `F`. """ base_ring(F::FreeMod_dec) = forget_decoration(F).R +base_ring_type(::Type{FreeMod_dec{T}}) where {T} = base_ring_type(FreeMod{T}) + @doc raw""" rank(F::FreeMod_dec) diff --git a/src/Modules/UngradedModules/FreeMod.jl b/src/Modules/UngradedModules/FreeMod.jl index 86c3a881f3f5..e040f69abb42 100644 --- a/src/Modules/UngradedModules/FreeMod.jl +++ b/src/Modules/UngradedModules/FreeMod.jl @@ -37,7 +37,7 @@ The string `name` specifies how the basis vectors are printed. julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]); julia> FR = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> x*FR[1] x*e[1] @@ -49,7 +49,7 @@ julia> U = complement_of_prime_ideal(P); julia> RL, _ = localization(R, U); julia> FRL = free_module(RL, 2, "f") -Free module of rank 2 over Localization of multivariate polynomial ring in 3 variables over QQ at complement of prime ideal (x, y, z) +Free module of rank 2 over Localization of R at complement of prime ideal (x, y, z) julia> RL(x)*FRL[1] x*f[1] diff --git a/src/Modules/UngradedModules/FreeModElem.jl b/src/Modules/UngradedModules/FreeModElem.jl index ea29e58f9ba1..70e67c8d331c 100644 --- a/src/Modules/UngradedModules/FreeModElem.jl +++ b/src/Modules/UngradedModules/FreeModElem.jl @@ -84,7 +84,7 @@ julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) julia> F = FreeMod(R,3) -Free module of rank 3 over Multivariate polynomial ring in 2 variables over QQ +Free module of rank 3 over R julia> f = x*gen(F,1)+y*gen(F,3) x*e[1] + y*e[3] diff --git a/src/Modules/UngradedModules/FreeModuleHom.jl b/src/Modules/UngradedModules/FreeModuleHom.jl index 7053cb615649..569df691993a 100644 --- a/src/Modules/UngradedModules/FreeModuleHom.jl +++ b/src/Modules/UngradedModules/FreeModuleHom.jl @@ -42,10 +42,10 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 3) -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R julia> G = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> V = [y*G[1], x*G[1]+y*G[2], z*G[2]]; @@ -101,10 +101,10 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 3) -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R julia> G = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> V = [y*G[1], x*G[1]+y*G[2], z*G[2]] 3-element Vector{FreeModElem{QQMPolyRingElem}}: @@ -116,10 +116,10 @@ julia> a = hom(F, G, V) Map with following data Domain: ======= -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R Codomain: ========= -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> a(F[2]) x*e[1] + y*e[2] @@ -133,10 +133,10 @@ julia> b = hom(F, G, B) Map with following data Domain: ======= -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R Codomain: ========= -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> a == b true @@ -325,10 +325,10 @@ that converts elements from $S$ into morphisms $F \to G$. julia> R, _ = polynomial_ring(QQ, ["x", "y", "z"]); julia> F1 = free_module(R, 3) -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R julia> F2 = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> V, f = hom(F1, F2) (hom of (F1, F2), Map: V -> set of all homomorphisms from F1 to F2) @@ -337,10 +337,10 @@ julia> f(V[1]) Map with following data Domain: ======= -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R Codomain: ========= -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R ``` @@ -414,10 +414,10 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 3) -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R julia> G = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> V = [y*G[1], x*G[1]+y*G[2], z*G[2]]; @@ -434,7 +434,7 @@ Submodule with 1 generator represented as subquotient with no relations. Codomain: ========= -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ) +Free module of rank 3 over R) ``` ```jldoctest @@ -546,10 +546,10 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 3) -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R julia> G = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> V = [y*G[1], x*G[1]+y*G[2], z*G[2]]; @@ -570,7 +570,7 @@ Submodule with 3 generators represented as subquotient with no relations. Codomain: ========= -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ) +Free module of rank 2 over R) ``` ```jldoctest diff --git a/src/Modules/UngradedModules/FreeResolutions.jl b/src/Modules/UngradedModules/FreeResolutions.jl index de1e53c24f87..672d8c4696e4 100644 --- a/src/Modules/UngradedModules/FreeResolutions.jl +++ b/src/Modules/UngradedModules/FreeResolutions.jl @@ -284,7 +284,7 @@ julia> is_complete(fr) false julia> fr[4] -Free module of rank 0 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 0 over R julia> fr Free resolution of M diff --git a/src/Modules/UngradedModules/ModuleGens.jl b/src/Modules/UngradedModules/ModuleGens.jl index 02521bb98f10..f08661768b94 100644 --- a/src/Modules/UngradedModules/ModuleGens.jl +++ b/src/Modules/UngradedModules/ModuleGens.jl @@ -88,6 +88,8 @@ function base_ring(M::ModuleGens) return base_ring(M.F) end +base_ring_type(::Type{ModuleGens{T}}) where {T} = base_ring_type(FreeMod{T}) + @doc raw""" singular_generators(M::ModuleGens) diff --git a/src/Modules/UngradedModules/Presentation.jl b/src/Modules/UngradedModules/Presentation.jl index c30a9d92f9f1..9bf8031f91c1 100644 --- a/src/Modules/UngradedModules/Presentation.jl +++ b/src/Modules/UngradedModules/Presentation.jl @@ -432,7 +432,7 @@ If `task = :only_morphism`, return only an isomorphism. julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]); julia> F = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> present_as_cokernel(F) Submodule with 2 generators @@ -444,7 +444,7 @@ julia> present_as_cokernel(F, :only_morphism) Map with following data Domain: ======= -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R Codomain: ========= Submodule with 2 generators diff --git a/src/Modules/UngradedModules/SubModuleOfFreeModule.jl b/src/Modules/UngradedModules/SubModuleOfFreeModule.jl index 8a4e603433cb..ca8ae8494564 100644 --- a/src/Modules/UngradedModules/SubModuleOfFreeModule.jl +++ b/src/Modules/UngradedModules/SubModuleOfFreeModule.jl @@ -125,6 +125,9 @@ function base_ring(M::SubModuleOfFreeModule) return base_ring(M.F) end +base_ring_type(::Type{SubModuleOfFreeModule{T}}) where {T} = base_ring_type(FreeMod{T}) + + @doc raw""" ambient_free_module(M::SubModuleOfFreeModule) diff --git a/src/Modules/UngradedModules/SubQuoHom.jl b/src/Modules/UngradedModules/SubQuoHom.jl index 54b833e5e4a3..bfa2221091c9 100644 --- a/src/Modules/UngradedModules/SubQuoHom.jl +++ b/src/Modules/UngradedModules/SubQuoHom.jl @@ -121,7 +121,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> A = R[x; y] [x] @@ -187,7 +187,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> A = R[x; y]; @@ -383,7 +383,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> A = R[x; y] [x] @@ -602,7 +602,7 @@ Submodule with 3 generators represented as subquotient with no relations. Codomain: ========= -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R ``` ```jldoctest @@ -780,7 +780,7 @@ Submodule with 1 generator represented as subquotient with no relations. Codomain: ========= -Free module of rank 3 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 3 over R ``` ```jldoctest diff --git a/src/Modules/UngradedModules/SubquoModule.jl b/src/Modules/UngradedModules/SubquoModule.jl index 83821631c1d2..8c66a77c44a6 100644 --- a/src/Modules/UngradedModules/SubquoModule.jl +++ b/src/Modules/UngradedModules/SubquoModule.jl @@ -42,7 +42,7 @@ julia> R, (x,y) = polynomial_ring(QQ, ["x", "y"]) (Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y]) julia> F = FreeMod(R,2) -Free module of rank 2 over Multivariate polynomial ring in 2 variables over QQ +Free module of rank 2 over R julia> O = [x*F[1]+F[2],y*F[2]] 2-element Vector{FreeModElem{QQMPolyRingElem}}: @@ -187,7 +187,7 @@ free module homomorphisms with codomain `F` represented by `A` and `B`. julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]); julia> FR = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> AR = R[x; y] [x] @@ -214,7 +214,7 @@ julia> U = complement_of_prime_ideal(P); julia> RL, _ = localization(R, U); julia> FRL = free_module(RL, 1) -Free module of rank 1 over Localization of multivariate polynomial ring in 3 variables over QQ at complement of prime ideal (x, y, z) +Free module of rank 1 over Localization of R at complement of prime ideal (x, y, z) julia> ARL = RL[x; y] [x] @@ -571,7 +571,7 @@ Return the cokernel of `A` as an object of type `SubquoModule` with ambient free julia> R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"]); julia> F = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> A = R[x y; 2*x^2 3*y^2] [ x y] @@ -658,7 +658,7 @@ Return the image of `A` as an object of type `SubquoModule` with ambient free mo julia> R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"]); julia> F = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> A = R[x y; 2*x^2 3*y^2] [ x y] @@ -838,7 +838,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> AM = R[x;] [x] @@ -966,7 +966,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> AM = R[x;] [x] @@ -1165,7 +1165,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> AM = R[x;] [x] @@ -1347,7 +1347,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> AM = R[x;] [x] @@ -1450,7 +1450,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> AM = R[x;] [x] diff --git a/src/Modules/UngradedModules/SubquoModuleElem.jl b/src/Modules/UngradedModules/SubquoModuleElem.jl index b59fdf355817..5e25c8d06ab1 100644 --- a/src/Modules/UngradedModules/SubquoModuleElem.jl +++ b/src/Modules/UngradedModules/SubquoModuleElem.jl @@ -624,7 +624,7 @@ Submodule with 3 generators represented as subquotient with no relations. Codomain: ========= -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R ``` """ function sub(M::ModuleFP{T}, V::Vector{<:ModuleFPElem{T}}; cache_morphism::Bool=false) where T @@ -822,7 +822,7 @@ julia> proj Map with following data Domain: ======= -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R Codomain: ========= Subquotient of Submodule with 1 generator @@ -962,7 +962,9 @@ number_of_generators(M::SubquoModule) = number_of_generators(M.sub) Given an `R`-module `M`, return `R`. """ -base_ring(M::SubquoModule) = base_ring(M.F)::base_ring_type(M.F) +base_ring(M::SubquoModule) = base_ring(M.F)::base_ring_type(M) + +base_ring_type(::Type{SubquoModule{T}}) where {T} = base_ring_type(FreeMod{T}) @doc raw""" zero(M::SubquoModule) @@ -982,7 +984,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> A = R[x^2+y^2;] [x^2 + y^2] @@ -1038,7 +1040,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> F = free_module(R, 1) -Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 1 over R julia> A = R[x; y] [x] diff --git a/src/PolyhedralGeometry/helpers.jl b/src/PolyhedralGeometry/helpers.jl index 1733a098ce42..1a223840d881 100644 --- a/src/PolyhedralGeometry/helpers.jl +++ b/src/PolyhedralGeometry/helpers.jl @@ -216,6 +216,10 @@ end (F::Field)(x::Polymake.Rational) = F(QQ(x)) (F::Field)(x::Polymake.OscarNumber) = F(Polymake.unwrap(x)) +# Disambiguation +(F::QQBarField)(x::Polymake.Rational) = F(QQ(x)) +(F::QQBarField)(x::Polymake.OscarNumber) = F(Polymake.unwrap(x)) + Polymake.convert_to_pm_type(::Type{typeof(min)}) = Polymake.Min Polymake.convert_to_pm_type(::Type{typeof(max)}) = Polymake.Max diff --git a/src/Rings/AbelianClosure.jl b/src/Rings/AbelianClosure.jl index ee92f85bb71b..63317534d07f 100644 --- a/src/Rings/AbelianClosure.jl +++ b/src/Rings/AbelianClosure.jl @@ -34,7 +34,7 @@ import Base: +, *, -, //, ==, zero, one, ^, div, isone, iszero, #import ..Oscar.AbstractAlgebra: promote_rule -import ..Oscar: AbstractAlgebra, addeq!, characteristic, elem_type, divexact, gen, +import ..Oscar: AbstractAlgebra, addeq!, base_ring, base_ring_type, characteristic, elem_type, divexact, gen, has_preimage_with_preimage, is_root_of_unity, is_unit, mul!, parent, parent_type, promote_rule, root, root_of_unity, roots @@ -151,6 +151,9 @@ elem_type(::Type{QQAbField{AbsNonSimpleNumField}}) = QQAbElem{AbsNonSimpleNumFie parent_type(::Type{QQAbElem{AbsNonSimpleNumFieldElem}}) = QQAbField{AbsNonSimpleNumField} parent(::QQAbElem{AbsNonSimpleNumFieldElem}) = _QQAb_sparse +base_ring(::QQAbField) = Union{} +base_ring_type(::Type{<:QQAbField}) = typeof(Union{}) + ################################################################################ # # Field access diff --git a/src/Rings/AlgClosureFp.jl b/src/Rings/AlgClosureFp.jl index 38bf0aaaeeeb..32c57802f697 100644 --- a/src/Rings/AlgClosureFp.jl +++ b/src/Rings/AlgClosureFp.jl @@ -16,7 +16,7 @@ import Base: +, -, *, //, ==, deepcopy_internal, hash, isone, iszero, one, import ..Oscar.AbstractAlgebra: pretty, Lowercase -import ..Oscar: algebraic_closure, base_field, base_ring, characteristic, data, degree, divexact, +import ..Oscar: algebraic_closure, base_field, base_ring, base_ring_type, characteristic, data, degree, divexact, elem_type, embedding, has_preimage_with_preimage, IntegerUnion, is_unit, map_entries, minpoly, parent_type, promote_rule, roots @@ -36,6 +36,7 @@ end base_field(A::AlgClosure) = A.k base_ring(A::AlgClosure) = A.k +base_ring_type(::Type{AlgClosure{T}}) where {T} = T characteristic(k::AlgClosure) = characteristic(base_field(k)) struct AlgClosureElem{T} <: FieldElem diff --git a/src/Rings/FractionalIdeal.jl b/src/Rings/FractionalIdeal.jl index 7a948bd0fdf9..4b9fa5242067 100644 --- a/src/Rings/FractionalIdeal.jl +++ b/src/Rings/FractionalIdeal.jl @@ -30,6 +30,8 @@ function base_ring(a::FractionalIdeal) return base_ring(numerator(a)) end +base_ring_type(::Type{FractionalIdeal{S, T}}) where {S, T} = base_ring_type(S) + function iszero(a::FractionalIdeal) return iszero(numerator(a)) end diff --git a/src/Rings/FreeAssAlgIdeal.jl b/src/Rings/FreeAssAlgIdeal.jl index 8c636beb7ec4..ce21d0ff3505 100644 --- a/src/Rings/FreeAssAlgIdeal.jl +++ b/src/Rings/FreeAssAlgIdeal.jl @@ -51,6 +51,10 @@ function base_ring(I::FreeAssAlgIdeal{T}) where T return I.gens.Ox::parent_type(T) end +function base_ring_type(::Type{<:FreeAssAlgIdeal{T}}) where T + return parent_type(T) +end + function number_of_generators(a::FreeAssAlgIdeal) return length(a.gens) end diff --git a/src/Rings/Laurent.jl b/src/Rings/Laurent.jl index 993ffefc1a0c..86051757d6f3 100644 --- a/src/Rings/Laurent.jl +++ b/src/Rings/Laurent.jl @@ -208,6 +208,8 @@ end base_ring(I::LaurentMPolyIdeal{T}) where {T} = I.R::parent_type(T) +base_ring_type(::Type{LaurentMPolyIdeal{T}}) where {T} = parent_type(T) + gens(I::LaurentMPolyIdeal) = I.gens @enable_all_show_via_expressify LaurentMPolyIdeal diff --git a/src/Rings/MPolyMap/MPolyRing.jl b/src/Rings/MPolyMap/MPolyRing.jl index e8135a7f8c73..fd9ac903c1d6 100644 --- a/src/Rings/MPolyMap/MPolyRing.jl +++ b/src/Rings/MPolyMap/MPolyRing.jl @@ -53,8 +53,8 @@ julia> R, (x, y) = polynomial_ring(K, ["x", "y"]); julia> F = hom(R, R, z -> z^2, [y, x]) Ring homomorphism - from multivariate polynomial ring in 2 variables over GF(2, 2) - to multivariate polynomial ring in 2 variables over GF(2, 2) + from multivariate polynomial ring in 2 variables over K + to multivariate polynomial ring in 2 variables over K defined by x -> y y -> x diff --git a/src/Rings/MPolyQuo.jl b/src/Rings/MPolyQuo.jl index 2bc4ef53bb49..24ad06baf7ca 100644 --- a/src/Rings/MPolyQuo.jl +++ b/src/Rings/MPolyQuo.jl @@ -65,6 +65,7 @@ gens(Q::MPolyQuoRing) = [Q(x) for x = gens(base_ring(Q))] number_of_generators(Q::MPolyQuoRing) = number_of_generators(base_ring(Q)) gen(Q::MPolyQuoRing, i::Int) = Q(gen(base_ring(Q), i)) base_ring(Q::MPolyQuoRing) = base_ring(Q.I) +base_ring_type(::Type{MPolyQuoRing{S}}) where {S} = base_ring_type(S) coefficient_ring(Q::MPolyQuoRing) = coefficient_ring(base_ring(Q)) modulus(Q::MPolyQuoRing) = Q.I oscar_groebner_basis(Q::MPolyQuoRing) = _groebner_basis(Q) && return Q.I.gb[Q.ordering].O @@ -331,7 +332,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3])) -(Quotient of multivariate polynomial ring by ideal (-x^2 + y, -x^3 + z), Map: multivariate polynomial ring -> A) +(Quotient of multivariate polynomial ring by ideal (-x^2 + y, -x^3 + z), Map: R -> A) julia> a = ideal(A, [x-y]) Ideal generated by @@ -360,7 +361,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]) (Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z]) julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3])) -(Quotient of multivariate polynomial ring by ideal (-x^2 + y, -x^3 + z), Map: multivariate polynomial ring -> A) +(Quotient of multivariate polynomial ring by ideal (-x^2 + y, -x^3 + z), Map: R -> A) julia> a = ideal(A, [x-y]) Ideal generated by @@ -1594,8 +1595,7 @@ julia> HC = gens(L[1]); julia> EMB = L[2] Map defined by a julia-function with inverse - from quotient space over: - Rational field with 7 generators and no relations + from quotient space over QQ with 7 generators and no relations to quotient of multivariate polynomial ring by ideal (-x*z + y^2, -w*z + x*y, -w*y + x^2) julia> for i in 1:length(HC) println(EMB(HC[i])) end @@ -1646,8 +1646,7 @@ julia> HC = gens(L[1]); julia> EMB = L[2] Map defined by a julia-function with inverse - from quotient space over: - Rational field with 7 generators and no relations + from quotient space over QQ with 7 generators and no relations to quotient of multivariate polynomial ring by ideal (x[1]*y[1] - x[2]*y[2]) julia> for i in 1:length(HC) println(EMB(HC[i])) end diff --git a/src/Rings/PBWAlgebra.jl b/src/Rings/PBWAlgebra.jl index d7f9d7afd4a4..756737efcab4 100644 --- a/src/Rings/PBWAlgebra.jl +++ b/src/Rings/PBWAlgebra.jl @@ -599,6 +599,8 @@ function base_ring(a::PBWAlgIdeal) return a.basering end +base_ring_type(::Type{PBWAlgIdeal{D, T, S}}) where {D, T, S} = PBWAlgRing{T, S} + function number_of_generators(a::PBWAlgIdeal) return number_of_generators(a.sdata) end diff --git a/src/Rings/PBWAlgebraQuo.jl b/src/Rings/PBWAlgebraQuo.jl index 60dcdf9288e6..72204fdcffcc 100644 --- a/src/Rings/PBWAlgebraQuo.jl +++ b/src/Rings/PBWAlgebraQuo.jl @@ -77,7 +77,9 @@ coefficient_ring(a::PBWAlgQuoElem) = coefficient_ring(parent(a)) modulus(Q::PBWAlgQuo) = Q.I -base_ring(Q::PBWAlgQuo) = Q.I.basering +base_ring(Q::PBWAlgQuo) = base_ring(Q.I) + +base_ring_type(::Type{PBWAlgQuo{T, S}}) where {T, S} = base_ring_type(PBWAlgIdeal{0, T, S}) base_ring(a::PBWAlgQuoElem) = base_ring(parent(a)) diff --git a/src/Rings/lazypolys.jl b/src/Rings/lazypolys.jl index ec13921ffdb4..1914d9a1bf3d 100644 --- a/src/Rings/lazypolys.jl +++ b/src/Rings/lazypolys.jl @@ -11,6 +11,7 @@ end base_ring(F::LazyPolyRing) = F.base_ring +base_ring_type(::Type{LazyPolyRing{T, R}}) where {T,R} = R ## LazyPoly diff --git a/src/Rings/mpoly-graded.jl b/src/Rings/mpoly-graded.jl index cf70e5d3ee56..42e0267e23f7 100644 --- a/src/Rings/mpoly-graded.jl +++ b/src/Rings/mpoly-graded.jl @@ -1169,6 +1169,7 @@ function homogeneous_component(a::MPolyDecRingElem, g::Vector{<:IntegerUnion}) end base_ring(W::MPolyDecRing) = base_ring(forget_decoration(W)) +base_ring_type(::Type{MPolyDecRing{T, S}}) where {T, S} = base_ring_type(S) number_of_generators(W::MPolyDecRing) = number_of_generators(forget_decoration(W)) gens(W::MPolyDecRing) = map(W, gens(forget_decoration(W))) gen(W::MPolyDecRing, i::Int) = W(gen(forget_decoration(W), i)) diff --git a/src/Rings/mpoly-ideals.jl b/src/Rings/mpoly-ideals.jl index 2974e47520ae..3d07571daa76 100644 --- a/src/Rings/mpoly-ideals.jl +++ b/src/Rings/mpoly-ideals.jl @@ -1651,6 +1651,8 @@ function base_ring(I::MPolyIdeal{S}) where {S} return I.gens.Ox::parent_type(S) end +base_ring_type(::Type{MPolyIdeal{S}}) where {S} = parent_type(S) + ####################################################### @doc raw""" coefficient_ring(I::MPolyIdeal) diff --git a/src/Rings/mpoly-local.jl b/src/Rings/mpoly-local.jl index d6127e138252..83acdcbf6328 100644 --- a/src/Rings/mpoly-local.jl +++ b/src/Rings/mpoly-local.jl @@ -96,6 +96,7 @@ function Base.show(io::IO, w::MPolyRingElemLoc) end base_ring(R::MPolyRingLoc) = R.base_ring +base_ring_type(::Type{MPolyRingLoc{T}}) where {T} = MPolyRing{T} symbols(R::MPolyRingLoc) = symbols(base_ring(R)) number_of_variables(R::MPolyRingLoc) = number_of_variables(base_ring(R)) parent(f::MPolyRingElemLoc) = f.parent diff --git a/src/Rings/mpoly-localizations.jl b/src/Rings/mpoly-localizations.jl index d5107af41c27..c64ce0297e66 100644 --- a/src/Rings/mpoly-localizations.jl +++ b/src/Rings/mpoly-localizations.jl @@ -900,6 +900,7 @@ end ### required getter functions base_ring(W::MPolyLocRing) = W.R +base_ring_type(::Type{MPolyLocRing{BRT, BRET, RT, RET, MST}}) where {BRT, BRET, RT, RET, MST} = BRT inverted_set(W::MPolyLocRing) = W.S ### additional getter functions @@ -1308,6 +1309,7 @@ end gens(I::MPolyLocalizedIdeal) = copy(I.gens) gen(I::MPolyLocalizedIdeal, i::Int) = I.gens[i] base_ring(I::MPolyLocalizedIdeal) = I.W +base_ring_type(::Type{MPolyLocalizedIdeal{LRT, LRET}}) where {LRT, LRET} = LRT ### type getters ideal_type(::Type{MPolyLocalizedRingType}) where {MPolyLocalizedRingType<:MPolyLocRing} = MPolyLocalizedIdeal{MPolyLocalizedRingType, elem_type(MPolyLocalizedRingType)} @@ -1821,7 +1823,7 @@ Complement in multivariate polynomial ring in 2 variables over QQ julia> L, _ = localization(R, U) -(Localization of multivariate polynomial ring in 2 variables over QQ at complement of prime ideal (x, y^2 + 1), Hom: multivariate polynomial ring -> localized ring) +(Localization of multivariate polynomial ring in 2 variables over QQ at complement of prime ideal (x, y^2 + 1), Hom: R -> localized ring) julia> J = ideal(L,[y*(x^2+(y^2+1)^2)]) Ideal generated by diff --git a/src/Rings/mpolyquo-localizations.jl b/src/Rings/mpolyquo-localizations.jl index 6cdac96bb474..3a1318d3336e 100644 --- a/src/Rings/mpolyquo-localizations.jl +++ b/src/Rings/mpolyquo-localizations.jl @@ -122,7 +122,6 @@ coefficient_ring_elem_type(::Type{MPolyQuoLocRing{BRT, BRET, RT, RET, MST}}) whe coefficient_ring_elem_type(L::MPolyQuoLocRing{BRT, BRET, RT, RET, MST}) where {BRT, BRET, RT, RET, MST} = coefficient_ring_elem_type(typeof(L)) base_ring_type(::Type{MPolyQuoLocRing{BRT, BRET, RT, RET, MST}}) where {BRT, BRET, RT, RET, MST} = RT -base_ring_type(L::MPolyQuoLocRing{BRT, BRET, RT, RET, MST}) where {BRT, BRET, RT, RET, MST} = base_ring_type(typeof(L)) base_ring_elem_type(::Type{MPolyQuoLocRing{BRT, BRET, RT, RET, MST}}) where {BRT, BRET, RT, RET, MST} = RET base_ring_elem_type(L::MPolyQuoLocRing{BRT, BRET, RT, RET, MST}) where {BRT, BRET, RT, RET, MST} = base_ring_elem_type(typeof(L)) @@ -1711,6 +1710,7 @@ end gens(I::MPolyQuoLocalizedIdeal) = copy(I.gens) gen(I::MPolyQuoLocalizedIdeal, i::Int) = I.gens[i] base_ring(I::MPolyQuoLocalizedIdeal) = I.W +base_ring_type(::Type{MPolyQuoLocalizedIdeal{LRT, LET, MPT}}) where {LRT, LET, MPT} = LRT ### additional getter functions map_from_base_ring(I::MPolyQuoLocalizedIdeal) = I.map_from_base_ring diff --git a/src/Rings/orderings.jl b/src/Rings/orderings.jl index 1eaba27347d9..746b67b60569 100644 --- a/src/Rings/orderings.jl +++ b/src/Rings/orderings.jl @@ -188,6 +188,8 @@ end base_ring(a::MonomialOrdering) = a.R +base_ring_type(::Type{MonomialOrdering{S}}) where {S} = S + @doc raw""" support(o::MonomialOrdering) @@ -1569,7 +1571,7 @@ julia> cmp(lex([x,y,z]), z, one(R)) 1 julia> F = free_module(R, 2) -Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ +Free module of rank 2 over R julia> cmp(lex(R)*invlex(F), F[1], F[2]) -1 @@ -1770,6 +1772,8 @@ end base_ring(a::ModuleOrdering) = a.M +base_ring_type(::Type{ModuleOrdering{S}}) where {S} = S + mutable struct ModProdOrdering <: AbsModOrdering a::AbsOrdering b::AbsOrdering @@ -1927,7 +1931,7 @@ Return the ring ordering induced by `ord`. julia> R, (w, x, y, z) = polynomial_ring(QQ, ["w", "x", "y", "z"]); julia> F = free_module(R, 3) -Free module of rank 3 over Multivariate polynomial ring in 4 variables over QQ +Free module of rank 3 over R julia> o = invlex(gens(F))*degrevlex(R) invlex([gen(1), gen(2), gen(3)])*degrevlex([w, x, y, z]) diff --git a/src/Rings/slpolys.jl b/src/Rings/slpolys.jl index 4e890181790e..e5163dcb44ce 100644 --- a/src/Rings/slpolys.jl +++ b/src/Rings/slpolys.jl @@ -22,6 +22,8 @@ SLPolyRing(r::Ring, v::Pair{<:VarName, base_ring(S::SLPolyRing) = S.base_ring +base_ring_type(::Type{SLPolyRing{T,R}}) where {T,R} = R + elem_type(::Type{S}) where {T,S<:SLPolyRing{T}} = SLPoly{T,S} symbols(S::SLPolyRing) = S.S diff --git a/src/aliases.jl b/src/aliases.jl index 28534d5451e7..6df64e519069 100644 --- a/src/aliases.jl +++ b/src/aliases.jl @@ -1,7 +1,3 @@ -# HACK/FIXME: remove these aliases once https://github.com/Nemocas/AbstractAlgebra.jl/pull/1696 is available -@alias characteristic_polynomial charpoly # FIXME -@alias minimal_polynomial minpoly # FIXME - # make some Julia names compatible with our naming conventions @alias is_subset issubset @alias is_valid isvalid diff --git a/test/Rings/integer-localizations.jl b/test/Rings/integer-localizations.jl index 212982071504..bac0559c4b41 100644 --- a/test/Rings/integer-localizations.jl +++ b/test/Rings/integer-localizations.jl @@ -4,7 +4,7 @@ using Oscar -import Oscar: base_ring, inverted_set, ring, localization, parent, numerator, denominator, one, zero, reduce_fraction +import Oscar: base_ring, base_ring_type, inverted_set, ring, localization, parent, numerator, denominator, one, zero, reduce_fraction import Oscar.AbstractAlgebra: elem_type, parent_type export FmpzComplementOfPrimeIdeal, FmpzPowersOfElement, FmpzComplementOfZeroIdeal @@ -139,6 +139,7 @@ end ### required getter functions base_ring(W::FmpzLocalizedRing) = ZZ::ZZRing +base_ring_type(::Type{<:FmpzLocalizedRing}) = ZZRing inverted_set(W::FmpzLocalizedRing{MultSetType}) where {MultSetType} = W.S::MultSetType ### required extensions of the localization function diff --git a/test/Rings/nmod-localizations.jl b/test/Rings/nmod-localizations.jl index f677ec2c8164..1e9ed12c0847 100644 --- a/test/Rings/nmod-localizations.jl +++ b/test/Rings/nmod-localizations.jl @@ -5,7 +5,7 @@ using Oscar import Oscar.Nemo.zzModRing -import Oscar: base_ring, inverted_set, ring, localization, parent, numerator, denominator, one, zero +import Oscar: base_ring, base_ring_type, inverted_set, ring, localization, parent, numerator, denominator, one, zero import Oscar.AbstractAlgebra: elem_type, parent_type export NmodComplementOfPrimeIdeal, NmodLocalizedRing, NmodLocalizedRingElem @@ -71,6 +71,7 @@ end ### required getter functions base_ring(W::NmodLocalizedRing) = W.R::zzModRing +base_ring_type(::Type{<:NmodLocalizedRing}) = zzModRing inverted_set(W::NmodLocalizedRing{MultSetType}) where {MultSetType} = W.S::MultSetType ### required extension of the localization function diff --git a/test/book/cornerstones/groups/explSL25.jlcon b/test/book/cornerstones/groups/explSL25.jlcon index bfe5f0582ff9..ed265be8f3b3 100644 --- a/test/book/cornerstones/groups/explSL25.jlcon +++ b/test/book/cornerstones/groups/explSL25.jlcon @@ -30,7 +30,7 @@ julia> schur_index(T[end]) 2 julia> gmodule_minimal_field(S) -G-module for G acting on vector space of dimension 6 over number field of degree 4 over QQ +G-module for G acting on vector space of dimension 6 over number field julia> B, mB = relative_brauer_group(base_ring(S), character_field(S)); diff --git a/test/book/cornerstones/groups/intro.jlcon b/test/book/cornerstones/groups/intro.jlcon index fb7e8a623aaf..8be4e4a235a1 100644 --- a/test/book/cornerstones/groups/intro.jlcon +++ b/test/book/cornerstones/groups/intro.jlcon @@ -63,7 +63,7 @@ julia> pts = collect(orb) julia> visualize(convex_hull(pts)) julia> R2 = free_module(K, 2) # the "euclidean" plane over K -Vector space of dimension 2 over field of algebraic numbers +Vector space of dimension 2 over QQBar julia> A = R2([0,1]) (Root 0 of x, Root 1.00000 of x - 1) @@ -72,8 +72,8 @@ julia> pts = [A*mat_rot^i for i in 0:4]; julia> sigma_1 = hom(R2, R2, [-R2[1], R2[2]]) Module homomorphism - from vector space of dimension 2 over field of algebraic numbers - to vector space of dimension 2 over field of algebraic numbers + from vector space of dimension 2 over QQBar + to vector space of dimension 2 over QQBar julia> rot = hom(R2, R2, mat_rot); diff --git a/test/book/cornerstones/groups/reps.jlcon b/test/book/cornerstones/groups/reps.jlcon index 792bd17669d9..bf8736660733 100644 --- a/test/book/cornerstones/groups/reps.jlcon +++ b/test/book/cornerstones/groups/reps.jlcon @@ -12,9 +12,9 @@ julia> M = regular_gmodule(GF(7), G); julia> C = composition_factors_with_multiplicity(M) 3-element Vector{Any}: - (G-module for G acting on vector space of dimension 1 over prime field of characteristic 7, 1) - (G-module for G acting on vector space of dimension 1 over prime field of characteristic 7, 1) - (G-module for G acting on vector space of dimension 4 over prime field of characteristic 7, 2) + (G-module for G acting on vector space of dimension 1 over GF(7), 1) + (G-module for G acting on vector space of dimension 1 over GF(7), 1) + (G-module for G acting on vector space of dimension 4 over GF(7), 2) julia> [is_absolutely_irreducible(x[1]) for x in C] 3-element Vector{Bool}: @@ -28,12 +28,12 @@ Morphism of finite fields to finite field of degree 2 and characteristic 7 julia> M = extension_of_scalars(C[3][1], phi) -G-module for G acting on vector space of dimension 4 over finite field of degree 2 and characteristic 7 +G-module for G acting on vector space of dimension 4 over GF(7, 2) julia> composition_factors_with_multiplicity(M) 2-element Vector{Any}: - (G-module for G acting on vector space of dimension 2 over finite field of degree 2 and characteristic 7, 1) - (G-module for G acting on vector space of dimension 2 over finite field of degree 2 and characteristic 7, 1) + (G-module for G acting on vector space of dimension 2 over GF(7, 2), 1) + (G-module for G acting on vector space of dimension 2 over GF(7, 2), 1) julia> G = pc_group(symmetric_group(4)); diff --git a/test/book/specialized/joswig-kastner-lorenz-confirmable-workflows/polynomial-load.jlcon b/test/book/specialized/joswig-kastner-lorenz-confirmable-workflows/polynomial-load.jlcon index cfe2de4da68f..001284a2e2d1 100644 --- a/test/book/specialized/joswig-kastner-lorenz-confirmable-workflows/polynomial-load.jlcon +++ b/test/book/specialized/joswig-kastner-lorenz-confirmable-workflows/polynomial-load.jlcon @@ -2,7 +2,7 @@ julia> F, o = finite_field(7,2) (Finite field of degree 2 and characteristic 7, o) julia> R, (y,z) = F["y","z"] -(Multivariate polynomial ring in 2 variables over GF(7, 2), FqMPolyRingElem[y, z]) +(Multivariate polynomial ring in 2 variables over F, FqMPolyRingElem[y, z]) julia> save("p.mrdi", 2*y^3*z^4 + (o + 3)*z^2 + 5*o*y + 1) diff --git a/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/draw_hypersurface.jlcon b/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/draw_hypersurface.jlcon index 4847f599b04a..2bcf95ed6cc7 100644 --- a/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/draw_hypersurface.jlcon +++ b/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/draw_hypersurface.jlcon @@ -2,7 +2,7 @@ julia> Kt,t = rational_function_field(QQ,"t") (Rational function field over QQ, t) julia> Kxy, (x,y) = Kt["x", "y"] -(Multivariate polynomial ring in 2 variables over rational function field, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.RationalFunctionFieldElem{QQFieldElem, QQPolyRingElem}}[x, y]) +(Multivariate polynomial ring in 2 variables over Kt, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.RationalFunctionFieldElem{QQFieldElem, QQPolyRingElem}}[x, y]) julia> f=-x^3-4*x^2+y^2+(-8*t^4)*x -x^3 - 4*x^2 - 8*t^4*x + y^2 diff --git a/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/eliminate_xz.jlcon b/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/eliminate_xz.jlcon index b5abf8cf3424..ca90d2698873 100644 --- a/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/eliminate_xz.jlcon +++ b/test/book/specialized/markwig-ristau-schleis-faithful-tropicalization/eliminate_xz.jlcon @@ -2,7 +2,7 @@ julia> S,(b2,b34,b4,b56,b6,b7)=polynomial_ring(QQ,["b2", "b34", "b4", "b56", "b6 (Multivariate polynomial ring in 6 variables over QQ, QQMPolyRingElem[b2, b34, b4, b56, b6, b7]) julia> R,(x, y, z)=polynomial_ring(S,["x", "y", "z"]) -(Multivariate polynomial ring in 3 variables over multivariate polynomial ring, AbstractAlgebra.Generic.MPoly{QQMPolyRingElem}[x, y, z]) +(Multivariate polynomial ring in 3 variables over S, AbstractAlgebra.Generic.MPoly{QQMPolyRingElem}[x, y, z]) julia> g = y^2-x*(x-b2^2)*(x-(b34+b4)^2)*(x-(b4)^2)*(x-(b6+b56)^2)*(x-(b6)^2)*(x+(b7)^2);