From 7e4ea783fbc8f6d0153e723174ae43a6f5d6bf6e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 24 Apr 2024 13:55:57 +0200 Subject: [PATCH] Print base rings terse and starting with lowercase --- src/NCPoly.jl | 3 +-- src/generic/DirectSum.jl | 3 ++- src/generic/FreeModule.jl | 6 ++---- src/generic/FunctionField.jl | 2 +- src/generic/InvariantFactorDecomposition.jl | 4 ++-- src/generic/MPoly.jl | 3 +-- src/generic/Misc/Localization.jl | 4 ++-- src/generic/QuotientModule.jl | 4 ++-- src/generic/SparsePoly.jl | 4 ++-- src/generic/Submodule.jl | 4 ++-- src/generic/TotalFraction.jl | 3 ++- 11 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/NCPoly.jl b/src/NCPoly.jl index 7b1371650b..39302ba200 100644 --- a/src/NCPoly.jl +++ b/src/NCPoly.jl @@ -150,9 +150,8 @@ number_of_generators(R::NCPolyRing) = 1 ############################################################################### function show(io::IO, p::NCPolyRing) - io = pretty(io) print(io, "Univariate polynomial ring in ", var(p), " over ") - print(IOContext(io, :compact => true), Lowercase(), base_ring(p)) + print(terse(pretty(io)), Lowercase(), base_ring(p)) end ############################################################################### diff --git a/src/generic/DirectSum.jl b/src/generic/DirectSum.jl index 2e722bbf2e..389cf52496 100644 --- a/src/generic/DirectSum.jl +++ b/src/generic/DirectSum.jl @@ -49,7 +49,8 @@ function show(io::IO, N::DirectSumModule{T}) where T <: RingElement print(io, LowercaseOff(), "DirectSumModule") else io = pretty(io) - print(io, LowercaseOff(), "DirectSumModule over ", Lowercase(), base_ring(N)) + print(io, LowercaseOff(), "DirectSumModule over ") + print(terse(io), Lowercase(), base_ring(N)) end end diff --git a/src/generic/FreeModule.jl b/src/generic/FreeModule.jl index ab20cec12c..71a63cfbf5 100644 --- a/src/generic/FreeModule.jl +++ b/src/generic/FreeModule.jl @@ -74,8 +74,7 @@ function show(io::IO, M::FreeModule{T}) where T <: Union{RingElement, NCRingElem print(io, "Free module of rank ") print(io, rank(M)) print(io, " over ") - io = pretty(io) - print(IOContext(io, :compact => true), Lowercase(), base_ring(M)) + print(terse(pretty(io)), Lowercase(), base_ring(M)) end function show(io::IO, M::FreeModule{T}) where T <: FieldElement @@ -85,8 +84,7 @@ function show(io::IO, M::FreeModule{T}) where T <: FieldElement print(io, "Vector space of dimension ") print(io, dim(M)) print(io, " over ") - io = pretty(io) - print(IOContext(io, :compact => true), Lowercase(), base_ring(M)) + print(terse(pretty(io)), Lowercase(), base_ring(M)) end function show(io::IO, a::FreeModuleElem) diff --git a/src/generic/FunctionField.jl b/src/generic/FunctionField.jl index e79a936040..5d3d97faf5 100644 --- a/src/generic/FunctionField.jl +++ b/src/generic/FunctionField.jl @@ -772,7 +772,7 @@ end @enable_all_show_via_expressify FunctionFieldElem function show(io::IO, R::FunctionField) - print(IOContext(io, :compact => true), "Function Field over ", + print(terse(io), "Function Field over ", base_ring(base_ring(R)), " with defining polynomial ", numerator(R)) end diff --git a/src/generic/InvariantFactorDecomposition.jl b/src/generic/InvariantFactorDecomposition.jl index ab5562e8b7..f06c1b00df 100644 --- a/src/generic/InvariantFactorDecomposition.jl +++ b/src/generic/InvariantFactorDecomposition.jl @@ -57,14 +57,14 @@ end function show(io::IO, N::SNFModule{T}) where T <: RingElement print(io, "Invariant factor decomposed module over ") - print(IOContext(io, :compact => true), base_ring(N)) + print(terse(pretty(io)), Lowercase(), base_ring(N)) print(io, " with invariant factors ") print(IOContext(io, :compact => true), invariant_factors(N)) end function show(io::IO, N::SNFModule{T}) where T <: FieldElement print(io, "Vector space over ") - print(IOContext(io, :compact => true), base_ring(N)) + print(terse(pretty(io)), Lowercase(), base_ring(N)) print(io, " with dimension ") print(io, ngens(N)) end diff --git a/src/generic/MPoly.jl b/src/generic/MPoly.jl index 787b4c08a1..0481121719 100644 --- a/src/generic/MPoly.jl +++ b/src/generic/MPoly.jl @@ -3852,8 +3852,7 @@ function MPolyBuildCtx(R::AbstractAlgebra.NCRing) end function show(io::IO, M::MPolyBuildCtx) - iocomp = IOContext(io, :compact => true) - print(iocomp, "Builder for an element of ", parent(M.poly)) + print(terse(io), "Builder for an element of ", parent(M.poly)) end @doc raw""" diff --git a/src/generic/Misc/Localization.jl b/src/generic/Misc/Localization.jl index 5ba7286a71..597aa4b376 100644 --- a/src/generic/Misc/Localization.jl +++ b/src/generic/Misc/Localization.jl @@ -167,9 +167,9 @@ end function show(io::IO, L::LocalizedEuclideanRing) if L.comp - print(io, "Localization of ", base_ring(L), " at complement of ", prime(L)) + print(io, "Localization of ", Lowercase(), base_ring(L), " at complement of ", prime(L)) else - print(io, "Localization of ", base_ring(L), " at ", prime(L)) + print(io, "Localization of ", Lowercase(), base_ring(L), " at ", prime(L)) end end diff --git a/src/generic/QuotientModule.jl b/src/generic/QuotientModule.jl index bf8838cfbf..a7202ceee5 100644 --- a/src/generic/QuotientModule.jl +++ b/src/generic/QuotientModule.jl @@ -65,13 +65,13 @@ end function show(io::IO, N::QuotientModule{T}) where T <: RingElement print(io, "Quotient module over ") - print(IOContext(io, :compact => true), base_ring(N)) + print(terse(pretty(io)), Lowercase(), base_ring(N)) show_gens_rels(io, N) end function show(io::IO, N::QuotientModule{T}) where T <: FieldElement println(io, "Quotient space over:") - print(IOContext(io, :compact => true), base_ring(N)) + print(terse(pretty(io)), Lowercase(), base_ring(N)) show_gens_rels(io, N) end diff --git a/src/generic/SparsePoly.jl b/src/generic/SparsePoly.jl index 95111ab1a9..0bcbc5493f 100644 --- a/src/generic/SparsePoly.jl +++ b/src/generic/SparsePoly.jl @@ -109,10 +109,10 @@ function Base.show(io::IO, a::SparsePoly) end function show(io::IO, p::SparsePolyRing) - print(io, "Sparse Univariate Polynomial Ring in ") + print(io, "Sparse univariate polynomial ring in ") print(io, string(p.S)) print(io, " over ") - print(IOContext(io, :compact => true), base_ring(p)) + print(terse(pretty(io)), Lowercase(), base_ring(p)) end ############################################################################### diff --git a/src/generic/Submodule.jl b/src/generic/Submodule.jl index 7686f9435a..bae538ca4a 100644 --- a/src/generic/Submodule.jl +++ b/src/generic/Submodule.jl @@ -55,13 +55,13 @@ supermodule(M::Submodule{T}) where T <: RingElement = M.m function show(io::IO, N::Submodule{T}) where T <: RingElement print(io, "Submodule over ") - print(IOContext(io, :compact => true), base_ring(N)) + print(terse(pretty(io)), Lowercase(), base_ring(N)) show_gens_rels(io, N) end function show(io::IO, N::Submodule{T}) where T <: FieldElement print(io, "Subspace over ") - print(IOContext(io, :compact => true), base_ring(N)) + print(terse(pretty(io)), Lowercase(), base_ring(N)) show_gens_rels(io, N) end diff --git a/src/generic/TotalFraction.jl b/src/generic/TotalFraction.jl index 74b47f394a..5a0f50b419 100644 --- a/src/generic/TotalFraction.jl +++ b/src/generic/TotalFraction.jl @@ -137,7 +137,8 @@ end @enable_all_show_via_expressify TotFrac function show(io::IO, a::TotFracRing) - print(IOContext(io, :compact => true), "Total ring of fractions of ", base_ring(a)) + print(io, "Total ring of fractions of ") + print(terse(pretty(io)), Lowercase(), base_ring(a)) end ###############################################################################