Skip to content

Commit

Permalink
Yet another attempt to revise printing for modules (#4251)
Browse files Browse the repository at this point in the history
* Revise printing of modules

* Adjust test case in test/Modules/ExteriorPowers.jl for new printing

* update jldoctest

* Also adjust printing of ideals

* update doctests

* Also update README.md

* Update code snippet, change to jldoctest

* Update code snippets which are not doctests

* Update booktests
  • Loading branch information
fingolfin authored Oct 29, 2024
1 parent b056c72 commit 84ad208
Show file tree
Hide file tree
Showing 42 changed files with 1,404 additions and 1,547 deletions.
38 changes: 16 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,28 @@ Free module of rank 1 over R
julia> s = sub(F, [f*F[1]])[1]
Submodule with 1 generator
1 -> (x1^2 + x2)*e[1]
represented as subquotient with no relations.
1: (x1^2 + x2)*e[1]
represented as subquotient with no relations
julia> H, mH = hom(s, quo(F, s)[1])
(hom of (s, Subquotient of
1 -> e[1]
by
1 -> (x1^2 + x2)*e[1]), Map: H -> set of all homomorphisms from s to subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
1 -> (x1^2 + x2)*e[1])
(hom of (s, Subquotient of submodule with 1 generator
1: e[1]
by submodule with 1 generator
1: (x1^2 + x2)*e[1]), Map: H -> set of all homomorphisms from s to subquotient of submodule with 1 generator
1: e[1]
by submodule with 1 generator
1: (x1^2 + x2)*e[1])
julia> mH(H[1])
Map with following data
Domain:
=======
Submodule with 1 generator
1 -> (x1^2 + x2)*e[1]
represented as subquotient with no relations.
Codomain:
=========
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
1 -> (x1^2 + x2)*e[1]
Module homomorphism
from s
to subquotient of submodule with 1 generator
1: e[1]
by submodule with 1 generator
1: (x1^2 + x2)*e[1]
```

Of course, the cornerstones are also available directly:
Of course, the cornerstones are also available directly. For example:

```
julia> C = Polymake.polytope.cube(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ Ideal generated by
julia> G = groebner_basis(I, ordering = lex(R))
Gröbner basis with elements
1 -> 28*y^3 - 35*y
2 -> 4*x*y^2 - 5*x
3 -> 15*x^2 + 28*y^2
4 -> 3*x^2*y + 7*y
5 -> x^2*y^2 - 5*x^2 - 7*y^2
1: 28*y^3 - 35*y
2: 4*x*y^2 - 5*x
3: 15*x^2 + 28*y^2
4: 3*x^2*y + 7*y
5: x^2*y^2 - 5*x^2 - 7*y^2
with respect to the ordering
lex([x, y])
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,15 @@ julia> range(C)
5:-1:3
julia> C[5]
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
1 -> x^4*e[1]
Subquotient of submodule with 1 generator
1: e[1]
by submodule with 1 generator
1: x^4*e[1]
julia> delta = map(C, 5)
Map with following data
Domain:
=======
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
1 -> x^4*e[1]
Codomain:
=========
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
1 -> x^3*e[1]
Module homomorphism
from A
to B
julia> matrix(delta)
[x^2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ julia> B = R[x^2; y^3; z^4]
[z^4]
julia> M = SubquoModule(F, A, B)
Subquotient of Submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Subquotient of submodule with 2 generators
1: x*e[1]
2: y*e[1]
by submodule with 3 generators
1: x^2*e[1]
2: y^3*e[1]
3: z^4*e[1]
julia> base_ring(M)
Multivariate polynomial ring in 3 variables x, y, z
Expand Down Expand Up @@ -134,12 +134,12 @@ julia> relations(M)
z^4*e[1]
julia> ambient_module(M)
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Subquotient of submodule with 1 generator
1: e[1]
by submodule with 3 generators
1: x^2*e[1]
2: y^3*e[1]
3: z^4*e[1]
```

In the graded case, we also have:
Expand Down Expand Up @@ -191,13 +191,13 @@ julia> B = R[x^2; y^3; z^4]
[z^4]
julia> M = SubquoModule(F, A, B)
Subquotient of Submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Subquotient of submodule with 2 generators
1: x*e[1]
2: y*e[1]
by submodule with 3 generators
1: x^2*e[1]
2: y^3*e[1]
3: z^4*e[1]
julia> m = M(sparse_row(R, [(1,z),(2,one(R))]))
(x*z + y)*e[1]
Expand Down Expand Up @@ -247,25 +247,25 @@ julia> B = R[x^2; y^3; z^4]
[z^4]
julia> M = SubquoModule(F, A, B)
Subquotient of Submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Subquotient of submodule with 2 generators
1: x*e[1]
2: y*e[1]
by submodule with 3 generators
1: x^2*e[1]
2: y^3*e[1]
3: z^4*e[1]
julia> m = z*M[1] + M[2]
(x*z + y)*e[1]
julia> parent(m)
Subquotient of Submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Subquotient of submodule with 2 generators
1: x*e[1]
2: y*e[1]
by submodule with 3 generators
1: x^2*e[1]
2: y^3*e[1]
3: z^4*e[1]
julia> coordinates(m)
Sparse row with positions [1, 2] and values QQMPolyRingElem[z, 1]
Expand Down
14 changes: 7 additions & 7 deletions experimental/GroebnerWalk/src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,31 @@ julia> I = ideal([y^4+ x^3-x^2+x,x^4]);
julia> groebner_walk(I, lex(R))
Gröbner basis with elements
1 -> x + y^12 - y^8 + y^4
2 -> y^16
1: x + y^12 - y^8 + y^4
2: y^16
with respect to the ordering
lex([x, y])
julia> groebner_walk(I, lex(R); algorithm=:generic)
Gröbner basis with elements
1 -> y^16
2 -> x + y^12 - y^8 + y^4
1: y^16
2: x + y^12 - y^8 + y^4
with respect to the ordering
lex([x, y])
julia> set_verbosity_level(:groebner_walk, 1);
julia> groebner_walk(I, lex(R))
Results for standard_walk
Crossed Cones in:
Crossed Cones in:
ZZRingElem[1, 1]
ZZRingElem[4, 3]
ZZRingElem[4, 1]
ZZRingElem[12, 1]
Cones crossed: 4
Gröbner basis with elements
1 -> x + y^12 - y^8 + y^4
2 -> y^16
1: x + y^12 - y^8 + y^4
2: y^16
with respect to the ordering
lex([x, y])
Expand Down
22 changes: 11 additions & 11 deletions experimental/Schemes/src/Tjurina.jl
Original file line number Diff line number Diff line change
Expand Up @@ -769,17 +769,17 @@ Spectrum
at complement of maximal ideal of point (0, 0, 0)
julia> T = tjurina_module(X)
Subquotient of Submodule with 2 generators
1 -> e[1]
2 -> e[2]
by Submodule with 7 generators
1 -> 2*x*e[1] + y*e[2]
2 -> 2*y*e[1] + x*e[2]
3 -> -2*z*e[1]
4 -> (x^2 + y^2 - z^2)*e[1]
5 -> (x^2 + y^2 - z^2)*e[2]
6 -> x*y*e[1]
7 -> x*y*e[2]
Subquotient of submodule with 2 generators
1: e[1]
2: e[2]
by submodule with 7 generators
1: 2*x*e[1] + y*e[2]
2: 2*y*e[1] + x*e[2]
3: -2*z*e[1]
4: (x^2 + y^2 - z^2)*e[1]
5: (x^2 + y^2 - z^2)*e[2]
6: x*y*e[1]
7: x*y*e[2]
julia> vector_space_basis(T)
5-element Vector{Any}:
Expand Down
16 changes: 8 additions & 8 deletions src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ Coherent sheaf of modules
3: [(s0//s2), (s1//s2), (s3//s2)] affine 3-space
4: [(s0//s3), (s1//s3), (s2//s3)] affine 3-space
with restrictions
1: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
2: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
3: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
4: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
1: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
2: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
3: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
4: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
```
"""
function twisting_sheaf(IP::AbsProjectiveScheme{<:Field}, d::Int)
Expand Down Expand Up @@ -325,10 +325,10 @@ Coherent sheaf of modules
3: [(s0//s2), (s1//s2), (s3//s2)] affine 3-space
4: [(s0//s3), (s1//s3), (s2//s3)] affine 3-space
with restrictions
1: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
2: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
3: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
4: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
1: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
2: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
3: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
4: free module of rank 1 over multivariate polynomial ring in 3 variables over QQ
```
"""
function tautological_bundle(IP::AbsProjectiveScheme{<:Field})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,17 @@ Given a smooth projective variety `X`, return a module whose sheafification is t
# Examples
```
```jldoctest
julia> R, x = graded_polynomial_ring(QQ, :x => (1:6));
julia> I = ideal(R, [x[1]*x[6] - x[2]*x[5] + x[3]*x[4]]);
julia> GRASSMANNIAN = variety(I);
julia> GRASSMANNIAN = variety(I);
julia> Omega = canonical_bundle(GRASSMANNIAN)
Graded subquotient of submodule of R^1 generated by
1 -> e[1]
by submodule of R^1 generated by
1 -> (x[1]*x[6] - x[2]*x[5] + x[3]*x[4])*e[1]
Graded submodule of R^1 with 1 generator
1: e[1]
represented as subquotient with no relations
julia> degrees_of_generators(Omega)
1-element Vector{FinGenAbGroupElem}:
Expand All @@ -167,10 +166,9 @@ julia> I = ideal(R, [y^2*z + x*y*z - x^3 - x*z^2 - z^3]);
julia> ELLCurve = variety(I);
julia> Omega = canonical_bundle(ELLCurve)
Graded subquotient of submodule of R^1 generated by
1 -> e[1]
by submodule of R^1 generated by
1 -> (x^3 - x*y*z + x*z^2 - y^2*z + z^3)*e[1]
Graded submodule of R^1 with 1 generator
1: e[1]
represented as subquotient with no relations
julia> degrees_of_generators(Omega)
1-element Vector{FinGenAbGroupElem}:
Expand Down
16 changes: 8 additions & 8 deletions src/Modules/ModuleTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,14 @@ julia> B = R[x^2; x*y; y^2; z^4]
[z^4]
julia> M = SubquoModule(A, B)
Subquotient of Submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 4 generators
1 -> x^2*e[1]
2 -> x*y*e[1]
3 -> y^2*e[1]
4 -> z^4*e[1]
Subquotient of submodule with 2 generators
1: x*e[1]
2: y*e[1]
by submodule with 4 generators
1: x^2*e[1]
2: x*y*e[1]
3: y^2*e[1]
4: z^4*e[1]
julia> f = SubquoModuleElem(sparse_row(R, [(1,z),(2,one(R))]),M)
(x*z + y)*e[1]
Expand Down
Loading

0 comments on commit 84ad208

Please sign in to comment.