diff --git a/docs/src/CommutativeAlgebra/affine_algebras.md b/docs/src/CommutativeAlgebra/affine_algebras.md index b47e7d4aab26..bd82251e6376 100644 --- a/docs/src/CommutativeAlgebra/affine_algebras.md +++ b/docs/src/CommutativeAlgebra/affine_algebras.md @@ -357,13 +357,14 @@ julia> C1, (s,t) = graded_polynomial_ring(QQ, ["s", "t"]); julia> V1 = [s^3, s^2*t, s*t^2, t^3]; julia> para = hom(D1, C1, V1) -Map with following data -Domain: -======= -Graded multivariate polynomial ring in 4 variables over QQ -Codomain: -========= -Graded multivariate polynomial ring in 2 variables over QQ +Ring homomorphism + from graded multivariate polynomial ring in 4 variables over QQ + to graded multivariate polynomial ring in 2 variables over QQ +defined by + w -> s^3 + x -> s^2*t + y -> s*t^2 + z -> t^3 julia> twistedCubic = kernel(para) ideal(-x*z + y^2, -w*z + x*y, -w*y + x^2) @@ -375,13 +376,13 @@ julia> D2, (a, b, c) = graded_polynomial_ring(QQ, ["a", "b", "c"]); julia> V2 = [p2(w-y), p2(x), p2(z)]; julia> proj = hom(D2, C2, V2) -Map with following data -Domain: -======= -Graded multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Quotient of multivariate polynomial ring by ideal with 3 generators +Ring homomorphism + from graded multivariate polynomial ring in 3 variables over QQ + to quotient of multivariate polynomial ring by ideal with 3 generators +defined by + a -> w - y + b -> x + c -> z julia> nodalCubic = kernel(proj) ideal(-a^2*c + b^3 - 2*b^2*c + b*c^2) @@ -396,13 +397,13 @@ julia> C3, x = polynomial_ring(QQ, "x" => 1:3); julia> V3 = [x[1]*x[2], x[1]*x[3], x[2]*x[3]]; julia> F3 = hom(D3, C3, V3) -Map with following data -Domain: -======= -Multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Multivariate polynomial ring in 3 variables over QQ +Ring homomorphism + from multivariate polynomial ring in 3 variables over QQ + to multivariate polynomial ring in 3 variables over QQ +defined by + y[1] -> x[1]*x[2] + y[2] -> x[1]*x[3] + y[3] -> x[2]*x[3] julia> sphere = ideal(C3, [x[1]^3 + x[2]^3 + x[3]^3 - 1]) ideal(x[1]^3 + x[2]^3 + x[3]^3 - 1) @@ -434,13 +435,13 @@ julia> C, p = quo(S, ideal(S, [c-b^3])); julia> V = [p(2*a + b^6), p(7*b - a^2), p(c^2)]; julia> F = hom(D, C, V) -Map with following data -Domain: -======= -Multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Quotient of multivariate polynomial ring by ideal with 1 generator +Ring homomorphism + from multivariate polynomial ring in 3 variables over QQ + to quotient of multivariate polynomial ring by ideal with 1 generator +defined by + x -> 2*a + c^2 + y -> -a^2 + 7*b + z -> c^2 julia> is_surjective(F) true @@ -462,13 +463,13 @@ julia> C, (s, t) = polynomial_ring(QQ, ["s", "t"]); julia> V = [s*t, t, s^2]; julia> paraWhitneyUmbrella = hom(R, C, V) -Map with following data -Domain: -======= -Multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Multivariate polynomial ring in 2 variables over QQ +Ring homomorphism + from multivariate polynomial ring in 3 variables over QQ + to multivariate polynomial ring in 2 variables over QQ +defined by + x -> s*t + y -> t + z -> s^2 julia> D, _ = quo(R, kernel(paraWhitneyUmbrella)); @@ -517,22 +518,22 @@ julia> L[1] -5*y + z julia> L[2] -Map with following data -Domain: -======= -Quotient of multivariate polynomial ring by ideal with 2 generators -Codomain: -========= -Quotient of multivariate polynomial ring by ideal with 2 generators +Ring homomorphism + from quotient of multivariate polynomial ring by ideal with 2 generators + to quotient of multivariate polynomial ring by ideal with 2 generators +defined by + x -> x + y -> 2*x + y + z -> 10*x + 5*y + z julia> L[3] -Map with following data -Domain: -======= -Quotient of multivariate polynomial ring by ideal with 2 generators -Codomain: -========= -Quotient of multivariate polynomial ring by ideal with 2 generators +Ring homomorphism + from quotient of multivariate polynomial ring by ideal with 2 generators + to quotient of multivariate polynomial ring by ideal with 2 generators +defined by + x -> x + y -> -2*x + y + z -> -5*y + z ``` ## Normalization diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Attributes.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Attributes.jl index 45cb7c67e588..c8705dc86fde 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Attributes.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Attributes.jl @@ -135,13 +135,13 @@ Spectrum by ideal(x1) julia> pullback(inclusion_morphism(X, Y)) -Map with following data -Domain: -======= -Multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Quotient of multivariate polynomial ring by ideal with 1 generator +Ring homomorphism + from multivariate polynomial ring in 3 variables over QQ + to quotient of multivariate polynomial ring by ideal with 1 generator +defined by + x1 -> 0 + x2 -> x2 + x3 -> x3 ``` """ pullback(f::AbsSpecMor) = pullback(underlying_morphism(f)) diff --git a/src/InvariantTheory/affine_algebra.jl b/src/InvariantTheory/affine_algebra.jl index b8ede1a775fc..415d7b9b43e4 100644 --- a/src/InvariantTheory/affine_algebra.jl +++ b/src/InvariantTheory/affine_algebra.jl @@ -66,13 +66,7 @@ with generators AbstractAlgebra.Generic.MatSpaceElem{nf_elem}[[0 0 1; 1 0 0; 0 1 0], [1 0 0; 0 a 0; 0 0 -a-1]] julia> affine_algebra(IR) -(Quotient of multivariate polynomial ring by ideal with 1 generator, Map with following data -Domain: -======= -Quotient of multivariate polynomial ring by ideal with 1 generator -Codomain: -========= -Graded multivariate polynomial ring in 3 variables over cyclotomic field of order 3) +(Quotient of multivariate polynomial ring by ideal with 1 generator, Hom: quotient of multivariate polynomial ring -> graded multivariate polynomial ring) ``` """ function affine_algebra(IR::InvRing; algo_gens::Symbol = :default, algo_rels::Symbol = :groebner_basis) diff --git a/src/Rings/MPolyMap/AffineAlgebras.jl b/src/Rings/MPolyMap/AffineAlgebras.jl index 2efdc2fc9f3b..0f7e20021796 100644 --- a/src/Rings/MPolyMap/AffineAlgebras.jl +++ b/src/Rings/MPolyMap/AffineAlgebras.jl @@ -155,13 +155,11 @@ julia> is_bijective(F) true julia> G = inverse(F) -Map with following data -Domain: -======= -Multivariate polynomial ring in 1 variable over QQ -Codomain: -========= -D +Ring homomorphism + from multivariate polynomial ring in 1 variable over QQ + to quotient of multivariate polynomial ring by ideal with 2 generators +defined by + t -> x julia> G(t) x diff --git a/src/Rings/MPolyMap/MPolyAnyMap.jl b/src/Rings/MPolyMap/MPolyAnyMap.jl index 0eeef010584c..5654dd66d82f 100644 --- a/src/Rings/MPolyMap/MPolyAnyMap.jl +++ b/src/Rings/MPolyMap/MPolyAnyMap.jl @@ -80,10 +80,39 @@ _images(f::MPolyAnyMap) = f.img_gens # String I/O # ################################################################################ +function Base.show(io::IO, ::MIME"text/plain", f::MPolyAnyMap) + io = pretty(io) + println(io, "Ring homomorphism") # at least one new line is needed + println(io, Indent(), "from ", Lowercase(), domain(f)) + println(io, "to ", Lowercase(), codomain(f)) + println(io, Dedent(), "defined by", Indent()) + R = domain(f) + g = gens(R) + for i in 1:(ngens(R)-1) + println(io, g[i], " -> ", f(g[i])) + end + print(io, g[end], " -> ", f(g[end]), Dedent()) + # the last print statement must not add a new line + phi = coefficient_map(f) + if !(phi isa Nothing) + println(io) + println(io, "with map on coefficients") + print(io, Indent(), phi, Dedent()) + end +end -# There is some default printing for maps. -# We might want to hijack this if we want to indicate whether there is -# a non-trivial coefficient ring map. +function Base.show(io::IO, f::MPolyAnyMap) + io = pretty(io) + if get(io, :supercompact, false) + # no nested printing + print(io, "Ring homomorphism") + else + # nested printing allowed, preferably supercompact + print(io, "Hom: ") + print(IOContext(io, :supercompact => true), Lowercase(), domain(f), " -> ") + print(IOContext(io, :supercompact => true), Lowercase(), codomain(f)) + end +end ################################################################################ # diff --git a/src/Rings/MPolyMap/MPolyQuo.jl b/src/Rings/MPolyMap/MPolyQuo.jl index ca68f59bd288..6e1c86072449 100644 --- a/src/Rings/MPolyMap/MPolyQuo.jl +++ b/src/Rings/MPolyMap/MPolyQuo.jl @@ -66,13 +66,13 @@ julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3])); julia> S, (s, t) = polynomial_ring(QQ, ["s", "t"]); julia> F = hom(A, S, [s, s^2, s^3]) -Map with following data -Domain: -======= -A -Codomain: -========= -Multivariate polynomial ring in 2 variables over QQ +Ring homomorphism + from quotient of multivariate polynomial ring by ideal with 2 generators + to multivariate polynomial ring in 2 variables over QQ +defined by + x -> s + y -> s^2 + z -> s^3 ``` """ function hom(R::MPolyQuoRing, S::NCRing, coeff_map, images::Vector; check::Bool = true) diff --git a/src/Rings/MPolyMap/MPolyRing.jl b/src/Rings/MPolyMap/MPolyRing.jl index 4dc367163c7d..2764f81fe723 100644 --- a/src/Rings/MPolyMap/MPolyRing.jl +++ b/src/Rings/MPolyMap/MPolyRing.jl @@ -52,13 +52,14 @@ julia> K, a = FiniteField(2, 2, "a"); julia> R, (x, y) = polynomial_ring(K, ["x", "y"]); julia> F = hom(R, R, z -> z^2, [y, x]) -Map with following data -Domain: -======= -Multivariate polynomial ring in 2 variables over GF(2^2) -Codomain: -========= -Multivariate polynomial ring in 2 variables over GF(2^2) +Ring homomorphism + from multivariate polynomial ring in 2 variables over GF(2^2) + to multivariate polynomial ring in 2 variables over GF(2^2) +defined by + x -> y + y -> x +with map on coefficients +#1 julia> F(a * y) (a + 1)*x @@ -69,13 +70,20 @@ julia> Qi, i = quadratic_field(-1) julia> S, (x, y) = polynomial_ring(Qi, ["x", "y"]); julia> G = hom(S, S, hom(Qi, Qi, -i), [x^2, y^2]) -Map with following data -Domain: -======= -Multivariate polynomial ring in 2 variables over imaginary quadratic field defined by x^2 + 1 -Codomain: -========= -Multivariate polynomial ring in 2 variables over imaginary quadratic field defined by x^2 + 1 +Ring homomorphism + from multivariate polynomial ring in 2 variables over imaginary quadratic field defined by x^2 + 1 + to multivariate polynomial ring in 2 variables over imaginary quadratic field defined by x^2 + 1 +defined by + x -> x^2 + y -> y^2 +with map on coefficients + Map with following data + Domain: + ======= + Qi + Codomain: + ========= + Qi julia> G(x+i*y) x^2 - sqrt(-1)*y^2 @@ -87,13 +95,12 @@ julia> f = 3*x^2+2*x+1; julia> S, (x, y) = polynomial_ring(GF(2), ["x", "y"]); julia> H = hom(R, S, gens(S)) -Map with following data -Domain: -======= -Multivariate polynomial ring in 2 variables over ZZ -Codomain: -========= -Multivariate polynomial ring in 2 variables over GF(2) +Ring homomorphism + from multivariate polynomial ring in 2 variables over ZZ + to multivariate polynomial ring in 2 variables over GF(2) +defined by + x -> x + y -> y julia> H(f) x^2 + 1 diff --git a/src/Rings/localization_interface.jl b/src/Rings/localization_interface.jl index 64fff1f21052..1969a2543510 100644 --- a/src/Rings/localization_interface.jl +++ b/src/Rings/localization_interface.jl @@ -173,13 +173,13 @@ Localization at complement of prime ideal(x) julia> iota -Map with following data -Domain: -======= -Multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Localization of multivariate polynomial ring in 3 variables over QQ at complement of prime ideal +Ring homomorphism + from multivariate polynomial ring in 3 variables over QQ + to localization of multivariate polynomial ring in 3 variables over QQ at complement of prime ideal +defined by + x -> x + y -> y + z -> z ``` """ function Localization(S::AbsMultSet) diff --git a/src/Rings/mpoly-affine-algebras.jl b/src/Rings/mpoly-affine-algebras.jl index 941f99e9665b..a1dd415629ab 100644 --- a/src/Rings/mpoly-affine-algebras.jl +++ b/src/Rings/mpoly-affine-algebras.jl @@ -1267,13 +1267,12 @@ Quotient by ideal(-T(1)*y + x, -T(1)*x + y^2, T(1)^2 - y, -x^2 + y^3) julia> LL[1][2] -Map with following data -Domain: -======= -A -Codomain: -========= -Quotient of multivariate polynomial ring by ideal with 4 generators +Ring homomorphism + from quotient of multivariate polynomial ring by ideal with 1 generator + to quotient of multivariate polynomial ring by ideal with 4 generators +defined by + x -> x + y -> y julia> LL[1][3] (y, ideal(x, y)) diff --git a/src/Rings/mpoly-localizations.jl b/src/Rings/mpoly-localizations.jl index 5e582bd90acb..64223ab988a0 100644 --- a/src/Rings/mpoly-localizations.jl +++ b/src/Rings/mpoly-localizations.jl @@ -1168,13 +1168,13 @@ Localization at complement of prime ideal(x) julia> iota -Map with following data -Domain: -======= -Multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Localization of multivariate polynomial ring in 3 variables over QQ at complement of prime ideal +Ring homomorphism + from multivariate polynomial ring in 3 variables over QQ + to localization of multivariate polynomial ring in 3 variables over QQ at complement of prime ideal +defined by + x -> x + y -> y + z -> z ``` """ localization(R::MPolyRing, U::AbsMPolyMultSet) @@ -2877,22 +2877,20 @@ julia> PHI = hom(RQL, TL, TL.([t, t^2, t^3])); julia> PSI = hom(TL, RQL, RQL.([x])); julia> phi = restricted_map(PHI) -Map with following data -Domain: -======= -Multivariate polynomial ring in 3 variables over QQ -Codomain: -========= -Localization of multivariate polynomial ring in 1 variable over QQ at complement of maximal ideal +Ring homomorphism + from multivariate polynomial ring in 3 variables over QQ + to localization of multivariate polynomial ring in 1 variable over QQ at complement of maximal ideal +defined by + x -> t + y -> t^2 + z -> t^3 julia> psi = restricted_map(PSI) -Map with following data -Domain: -======= -Multivariate polynomial ring in 1 variable over QQ -Codomain: -========= -Localization of quotient of multivariate polynomial ring at complement of maximal ideal +Ring homomorphism + from multivariate polynomial ring in 1 variable over QQ + to localization of quotient of multivariate polynomial ring at complement of maximal ideal +defined by + t -> x ``` """ restricted_map(PHI::MPolyLocalizedRingHom) = PHI.res