Oscar.jl icon indicating copy to clipboard operation
Oscar.jl copied to clipboard

Enhance `show` for `IdealGens`

Open lgoettgens opened this issue 7 months ago • 9 comments

Resolves https://github.com/oscar-system/Oscar.jl/issues/3322.

Let's first do some bikeshedding here, and I will only fix the doctests once we are happy with the printing of the example from https://github.com/oscar-system/Oscar.jl/issues/3322. All changes to Gröbner basis will then be applied analogously to the cases of Standard basis and Ideal generating system as well.

current master:

julia> P, (x,y) = polynomial_ring(QQ, ["x", "y"]);

julia> I = ideal([x,y]);

julia> g = groebner_basis(I)
Gröbner basis with elements
1 -> y
2 -> x
with respect to the ordering
degrevlex([x, y])

julia> [g]
1-element Vector{Oscar.IdealGens{QQMPolyRingElem}}:
 Gröbner basis with elements
1 -> y
2 -> x
with respect to the ordering
degrevlex([x, y])

julia> show(Oscar.terse(stdout), g)
Gröbner basis with elements
1 -> y
2 -> x
with respect to the ordering
degrevlex([x, y])

julia> I.gb
Dict{MonomialOrdering, Oscar.IdealGens{QQMPolyRingElem}} with 1 entry:
  degrevlex([x, y]) => Gröbner basis with elements…

Proposal 1:

  • keep current printing as detailed mode, only add some indentation (and some sanity things like protecting Gröbner from decapitalization)
  • oneline mode shows length and the ordering
  • terse mode only prints Gröbner basis
julia> g = groebner_basis(I)
Gröbner basis with elements
  1 -> y
  2 -> x
with respect to the ordering
  degrevlex([x, y])

julia> [g]
1-element Vector{Oscar.IdealGens{QQMPolyRingElem}}:
 Gröbner basis with 2 elements w.r.t. degrevlex([x, y])

julia> show(Oscar.terse(stdout), g)
Gröbner basis

julia> I.gb
Dict{MonomialOrdering, Oscar.IdealGens{QQMPolyRingElem}} with 1 entry:
  degrevlex([x, y]) => Gröbner basis with 2 elements w.r.t. degrevlex([x, y])

Proposal 2:

  • as Proposal 1, but remove the enumeration in detailed mode, as this is different from how we do it for other similar things, like printing the ideal I in detailed mode
julia> g = groebner_basis(I)
Gröbner basis with elements
  y
  x
with respect to the ordering
  degrevlex([x, y])

# other printing as in Proposal 1

Please write what you think in general about this change, and all small details you are (un)happy with, in particular:

  • Proposal 1 vs. 2, i.e. show indices or not?
  • print ordering in oneline mode?

Let me ping @fingolfin @ederc @jankoboehm @RafaelDavidMohr @JohnAAbbott as you might have an opinion on this, and please ping other people I might forgot.

lgoettgens avatar Jun 27 '24 15:06 lgoettgens