Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the new printing guidelines for more compact printing #2166

Open
6 tasks
simonbrandhorst opened this issue Mar 30, 2023 · 1 comment
Open
6 tasks
Labels
enhancement New feature or request

Comments

@simonbrandhorst
Copy link
Collaborator

simonbrandhorst commented Mar 30, 2023

#2148 adds the new printing guidelines to our developer documentation.
They need to be implemented for our existing Types.
The first ones to do this seem to be the following:

  • basic rings such as QQ, ZZ, GF
  • polynomial rings
  • number fields
  • homomorphisms of rings
  • groups
  • group homomorphisms

Once these are implemented we can go for the more complicated constructs such as modules, group rings, (toric) varieties etc.

TODOs

Implement some some fallback functions

show_details(x) = show(stdout, "text/plain", x)

show_one_line(x) = show(stdout, x)

show_supercompact(x) = show(IOContext(stdout, :supercompact => true), x)

and also provide some macros

@show_details x
@show_one_line x
@show_super_compact x
  • Helper for with 1 generator and not with 1 generators
  • make indentation work by using stuff from https://github.com/KristofferC/IOIndents.jl
    the nested call will then be print(indented(io), R.substruct)
  • Max wants to add a few more examples so we can discuss them:
    • detailed group homomorphisms given by generator-images, including the mappings (f1 -> (1,2)(3,4,5))
    • permutations
    • matrices (in detailed view they could print their ring?)
    • matrices-as-group-elements (should be distinguishable from plain matrices? at least in detailed mode)
  • Max: Right now all output starts with an uppercase letter. Drawback: this makes it harder to compose outputs.
    Perhaps we need an option to control that? Or we write a helper function
    which changes the case of the first letter of a string --
    but then we need to first print into strings, instead of directly printing to the output io,
    which means overhead and has other concerns
@simonbrandhorst simonbrandhorst added the enhancement New feature or request label Mar 30, 2023
@simonbrandhorst
Copy link
Collaborator Author

simonbrandhorst commented Mar 30, 2023

Examples for the new 2+1 print modes in Oscar

These examples are intended as guidelines for implementing the new show
functions.

Examples

For each example we fix a single parent and display its three print modes
consecutively each in its own block
:details
:oneline
:supercompact

Coefficient rings

Integer ring
Integer ring
ZZ

Rational field
Rational field
QQ

Prime field
Finite field of characteristic 2
Finite field of characteristic 2
GF(2)
Finite field
Finite field of degree 7 over GF(29)
Finite field of degree 7 over GF(29)
GF(29^7)
Integer mod rings
Integers modulo 125
Integers modulo 125
ZZ/(125)  # ?

Numberfields

A simple number field

Number field
with defining polynomial x^10 - 3x^9 + 7x^8 - 11x^7 + 13x^6 - 12x^5 + 9x^4 - 5x^3 + 3x^2 - 2x + 1
  over QQ
Number field of degree 10 over QQ
Number field
Fancy number field
Number field
with defining polynomial x^10 - 3x^9 + 7x^8 - 11x^7 + 13x^6 - 12x^5 + 9x^4 - 5x^3 + 3x^2 - 2x + 1
  over
  Number field
  with defining polynomial 9x^4 - 5x^3 + 3x^2 - 3x + 1
    over
    Number field
    with defining polynomial x^2+1
    over
      QQ
Number field of degree 10 over Number field
Number field

Groups

Permutation group
Permutation group of degree 7
Permutation group of degree 7
Permutation group
Polycyclic group
Polycyclic group of infinite order
Polycyclic group of infinite order
Polycyclic group
General linear group over finite field
General linear group of degree 24
  over Finite field of degree 7 over GF(29)
General linear group of degree 24 over GF(29^7)
General linear group
General linear group over number field
General linear group of degree 24
  over Number field of degree 2 over Number field

(note the oneline but not supercompact representation of the number field)

General linear group of degree 24 over Number field
General linear group

Matrix group over QQ

Marix group of degree 24 over Rational field
Matrix group of degree 24 over QQ
Matrix group

Rings

Common polynomial rings

Multivariate polynomial ring in x, y, z over QQ
Multivariate polynomial ring in 30 variables x1, x2, x3, ... , x30 over QQ
Multivariate polynomial ring in 30 variables over QQ
Multivariate polynomial ring
Examples for Polynomial rings
julia> P,x = polynomial_ring(QQ,[:x,:y,:z])
(Multivariate polynomial ring in 3 variables, QQMPolyRingElem[x, y, z])

Generic polynomial rings

Multivariate polynomial ring
  over Fraction field of Univariate polynomial ring over QQ
in 30 variables x1, x2, x3, x4, x5, x6, ..., x30
Multivariate polynomial ring in 30 variables over Univariate function field
Multivariate polynomial ring

Group Rings

Note the :supercompact printing in :oneline printing

Group ring
  of Polycyclic group of infinite order
  over Number field of degree 4
  Group ring of Polycyclic group over Number field
Group ring

Ideals

Polynomial ring
Ideal
  of Multivariate polynomial ring in 30 variables over QQ
generated by
 x1
 x2
 x5^23
   ⋮
 x30 + x2 +  some very big polynomial fitting several pages but which has no line break
Ideal with 126 generators in Multivariate polynomial ring
Ideal

Maximal order of a number field

Ideal
  of Maximal order of Cyclotomic field of order 19
norm: 1123272193876636254792988373
minimum: 1013
two normal wrt: 1013
generated by
 1013
 z_19^9 + 389*z_19^8 + 1011*z_19^7 + 626*z_19^6 + 391*z_19^5 + 386*z_19^4 + 623*z_19^3 + 2*z_19^2 + 388*z_19 + 1012
julia> F,z = cyclotomic_field(19);

julia> OF = maximal_order(F);

julia> support(30*OF)
2-element Vector{NfOrdIdl}
 Ideal in maximal order
 Ideal in maximal order
 Ideal in maximal order
Ideal

Quotient Rings

A common example

Quotient
  of Multivariate polynomial ring in 7 variables over GF(2)
  by Ideal with 126 generators
Quotient of multivariate polynomial ring in 3 variables over GF(2)
Multivariate quotient ring

A fancy example

Quotient
  of Multivariate polynomial ring in 6 variables over Univariate function field
  by Ideal with 126 generators

Quotient of multivariate polynomal ring in 15 variables over Univariate function field
Multivariate quotient ring

Spectra

Spectrum of
  Quotient of Multivariate polynomial ring in 5 variables over GF(2)
  by Ideal with 126 generators
Spectrum of Multivariate quotient ring with 3 relations over GF(2)
Spec of Multivariate quotient ring

Maps

Maps of Rings

Ring homomorphism
  from Multivariate polynomial ring in 30 variables over QQ
  to Quotient of Multivariate polynomial ring in 3 variables over QQ.
defined by
 x1 -> x
 x2 -> y
 x3 -> z
 x4 -> 0
   ⋮
x30 -> 0
Hom: Multivariate polynomial ring -> Multivariate quotient ring
Ring homomorphism

Maps of Groups

Group homomorphism
  from Polycyclic group of size 24 with 3 generators
  to Matrix group of degree 24 with 10 generators over QQ
Hom: Polycyclic group -> Matrix group
Group homomorphism

Maps of rings but not of algebras

Ring homomorphism
  from Multivariate polynomial ring in 2 variables over Quadratic Field
  to  Multivariate polynomial ring in 3 variables over Quadratic field
  with coefficient map Automorphism of quadratic Field
defined by
 x -> x1
 y -> x1*x2
Hom: Multivariate polynomial ring -> Multivariate polynomial ring
Ring homomorphism

Examples of Interactive use

Primary decomposition

julia> p, (x,y,z) = polynomial_ring(GF(2), [:x, :y, :z])
(Multivariate Polynomial Ring in 3 variables over GF(2), fpMPolyRingElem[x, y, z])

julia> I = ideal([x^2 + y^2, z^3 - 1])
Ideal of Multivariate Polynomial Ring in 3 variables over GF(2)
generated by
 x^2 + y^2
 z^3 - 1

julia> PD = primary_decomposition(I)
2-element Vector{Tuple{MPolyIdeal{fpMPolyRingElem}, MPolyIdeal{fpMPolyRingElem}}}:
 (Ideal with 2 generators, Ideal with 2 generators)
 (Ideal with 2 generators, Ideal with 2 generators)

julia> PD[1][1]
Ideal of Multivariate Polynomial Ring in 3 variables over GF(2)
generated by
 z + 1
 x^2 + y^2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant