Skip to content

Commit

Permalink
- Re-work of the printing for divisors and cycles by taking off the c…
Browse files Browse the repository at this point in the history
…harts details and the expansion of the ideal sheaves

- New printing for `EllipticSurface`
- Fix a typo
- Put coordinates and homogeneous coordinates in brackets for affine/projective spaces compact printing
- Put more comments on the function `is_prime(D::WeilDivisor)`
- Change the doctests accordingly
  • Loading branch information
StevellM committed Jul 20, 2023
1 parent 57de73e commit b92ad7d
Show file tree
Hide file tree
Showing 29 changed files with 181 additions and 194 deletions.
46 changes: 11 additions & 35 deletions experimental/Schemes/AlgebraicCycles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ julia> R = ZZ;
julia> algebraic_cycle(Ycov, R)
Zero algebraic cycle
on scheme over QQ covered with 3 patches
1: [(y//x), (z//x)] spec of quotient of multivariate polynomial ring
2: [(x//y), (z//y)] spec of quotient of multivariate polynomial ring
3: [(x//z), (y//z)] spec of quotient of multivariate polynomial ring
with coefficients in integer Ring
```
"""
Expand Down Expand Up @@ -230,17 +227,11 @@ julia> II = IdealSheaf(Y, I);
julia> R = ZZ;
julia> algebraic_cycle(II, R)
Irreducible algebraic cycle
Effective algebraic cycle
on scheme over QQ covered with 3 patches
1: [(y//x), (z//x)] spec of multivariate polynomial ring
2: [(x//y), (z//y)] spec of multivariate polynomial ring
3: [(x//z), (y//z)] spec of multivariate polynomial ring
with coefficients in integer Ring
given as the formal sum of
1*sheaf of ideals with restrictions
1: ideal(-(y//x)^2*(z//x) + 1)
2: ideal((x//y)^3 - (z//y))
3: ideal((x//z)^3 - (y//z)^2)
1 * sheaf of ideals
```
"""
Expand Down Expand Up @@ -277,17 +268,11 @@ julia> II = IdealSheaf(Y, I);
julia> R = ZZ;
julia> algebraic_cycle(II, R)
Irreducible algebraic cycle
Effective algebraic cycle
on scheme over QQ covered with 3 patches
1: [(y//x), (z//x)] spec of multivariate polynomial ring
2: [(x//y), (z//y)] spec of multivariate polynomial ring
3: [(x//z), (y//z)] spec of multivariate polynomial ring
with coefficients in integer Ring
given as the formal sum of
1*sheaf of ideals with restrictions
1: ideal(-(y//x)^2*(z//x) + 1)
2: ideal((x//y)^3 - (z//y))
3: ideal((x//z)^3 - (y//z)^2)
1 * sheaf of ideals
```
"""
algebraic_cycle(I::IdealSheaf) = AlgebraicCycle(I)
Expand Down Expand Up @@ -317,30 +302,24 @@ function Base.show(io::IO, ::MIME"text/plain", D::AlgebraicCycle, cov::Covering
io = pretty(io)
X = scheme(D)
eff = all(i >= 0 for i in collect(values(D.coefficients)))
if length(components(D)) == 1
prim = D[components(D)[1]] == 1
else
prim = false
end
if length(components(D)) == 0
print(io, "Zero algebraic cycle")
else
if eff
if prim
print(io, "Irreducible algebraic cycle")
else
print(io, "Effective algebraic cycle")
end
print(io, "Effective algebraic cycle")
else
print(io, "Algebraic cycle")
end
if has_name(D)
print(io, " ", get_attribute(D, :name))
end
if has_attribute(D, :dim)
print(io, " of dimension $(dim(D))")
end
end
println(io)
print(io, Indent(), "on ", Lowercase())
Oscar._show_semi_compact(io, X, cov)
show(io, X, cov)
println(io, Dedent())
print(io, "with coefficients in ", Lowercase(), coefficient_ring(D))
if length(components(D)) != 0
Expand All @@ -353,13 +332,10 @@ function Base.show(io::IO, ::MIME"text/plain", D::AlgebraicCycle, cov::Covering
println(io)
I = components(D)[i]
kI = length(co_str[i])
print(io, " "^(k-kI)*"$(D[I])*")
print(io, " "^(k-kI)*"$(D[I]) * ")
print(io, Indent(), Lowercase())
Oscar._show_semi_compact(io, I, cov)
show(io, I, false)
print(io, Dedent())
if i != length(components(D))
println(io, "--------------------------------------------------------------------------------")
end
end
end
print(io, Dedent())
Expand Down
49 changes: 30 additions & 19 deletions experimental/Schemes/CartierDivisor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,9 @@ defined by
julia> cartier_divisor(E)
Cartier divisor
on scheme over QQ covered with 3 patches
1: [(y//x), (z//x)] spec of multivariate polynomial ring
2: [(x//y), (z//y)] spec of multivariate polynomial ring
3: [(x//z), (y//z)] spec of multivariate polynomial ring
with coefficients in integer Ring
defined by the formal sum of
1*sheaf of ideals with restrictions
1: ideal(-(y//x)^2*(z//x) + 1)
2: ideal((x//y)^3 - (z//y))
3: ideal((x//z)^3 - (y//z)^2)
1 * sheaf of ideals
```
"""
cartier_divisor(E::EffectiveCartierDivisor) = CartierDivisor(E)
Expand Down Expand Up @@ -405,6 +399,8 @@ function Base.show(io::IO, C::EffectiveCartierDivisor)
io = pretty(io)
if get(io, :supercompact, false)
print(io, "Cartier divisor")
elseif has_attribute(C, :name)
print(io, get_attribute(C, :name))
else
print(io, "Effective cartier divisor on ", Lowercase())
show(io, scheme(C))
Expand All @@ -418,7 +414,11 @@ function Base.show(io::IO, ::MIME"text/plain", C::EffectiveCartierDivisor, cov::
I = ideal_sheaf(C)
X = scheme(C)

println(io, "Effective cartier divisor")
print(io, "Effective cartier divisor")
if has_attribute(C, :name)
print(io, " ", get_attribute(C, :name))
end
println(io)
print(io, Indent(), "on ", Lowercase())
Oscar._show_semi_compact(io, scheme(C), cov)
println(io, Dedent())
Expand All @@ -439,7 +439,11 @@ end
function _show_semi_compact(io::IO, C::EffectiveCartierDivisor, cov::Covering = get_attribute(scheme(C), :simplified_covering, default_covering(scheme(C))), n::String = "")
io = pretty(io)
X = scheme(C)
println(io, "Effective cartier divisor defined by")
print(io, "Effective cartier divisor")
if has_attribute(C, :name)
print(io, " ", get_attribute(C, :name))
end
println(io, " defined by")
print(io, Indent(), Lowercase())
Oscar._show_semi_compact(io, ideal_sheaf(C), cov, n)
print(io, Dedent())
Expand All @@ -449,6 +453,8 @@ function Base.show(io::IO, C::CartierDivisor)
io = pretty(io)
if get(io, :supercompact, false)
print(io, "Cartier divisor")
elseif has_attribute(C, :name)
print(io, get_attribute(C, :name))
else
print(io, "Cartier divisor on ", Lowercase())
show(io, scheme(C))
Expand All @@ -467,12 +473,16 @@ function Base.show(io::IO, ::MIME"text/plain", C::CartierDivisor, cov::Covering
if length(cc) == 0
print(io, "Zero cartier divisor ")
print(io, Indent(), "on ", Lowercase())
Oscar._show_semi_compact(io, scheme(C), cov)
show(io, scheme(C), cov)
print(io, Dedent())
else
println(io, "Cartier divisor")
print(io, "Cartier divisor")
if has_attribute(C, :name)
print(io, " ", get_attribute(C, :name))
end
println(io)
print(io, Indent(), "on ", Lowercase())
Oscar._show_semi_compact(io, scheme(C), cov)
show(io, scheme(C), cov)
println(io)
println(io, Dedent(), "with coefficients in ", Lowercase(), coefficient_ring(C))
print(io, "defined by the formal sum of")
Expand All @@ -482,12 +492,9 @@ function Base.show(io::IO, ::MIME"text/plain", C::CartierDivisor, cov::Covering
for i in 1:length(components(C))
I = cc[i]
kI = length(co_str[i])
print(io, " "^(k-kI)*"$(C[I])*")
print(io, " "^(k-kI)*"$(C[I]) * ")
print(io, Lowercase())
Oscar._show_semi_compact(io, ideal_sheaf(I), cov)
if i != length(components(C))
println(io, "--------------------------------------------------------------------------------")
end
show(io, ideal_sheaf(I), false)
end
print(io, Dedent())
end
Expand All @@ -508,14 +515,18 @@ function _show_semi_compact(io::IO, C::CartierDivisor, cov::Covering = get_attri
if length(cc) == 0
print(io, "Zero cartier divisor")
else
println(io, "Cartier divisor defined by the formal sum of")
print(io, "Cartier divisor")
if has_attribute(C, :name)
print(io, " ", get_attribute(C, :name))
end
println(io, " defined by the formal sum of")
print(io, Indent())
co_str = String["$(C[I])" for I in cc]
k = max(length.(co_str)...)
for i in 1:length(components(C))
I = cc[i]
kI = length(co_str[i])
print(io, " "^(k-kI)*"$(C[I])*")
print(io, " "^(k-kI)*"$(C[I]) * ")
print(io, Lowercase())
Oscar._show_semi_compact(io, ideal_sheaf(I), cov, n)
if i != length(components(C))
Expand Down
12 changes: 9 additions & 3 deletions experimental/Schemes/CoherentSheaves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ function Base.show(io::IO, ::MIME"text/plain", M::AbsCoherentSheaf)
X = scheme(M)
cov = default_covering(X)
D = M.ID
println(io, "Coherent sheaf of modules")
print(io, "Coherent sheaf of modules")
if has_attribute(M, :name)
print(io, " ", get_attribute(M, :name))
end
println(io)
print(io, Indent(), "on ", Lowercase())
Oscar._show_semi_compact(io, X, cov)
if length(cov) > 0
Expand All @@ -68,6 +72,8 @@ function Base.show(io::IO, M::AbsCoherentSheaf)
io = pretty(io)
if get(io, :supercompact, false)
print(io, "Presheaf")
elseif has_attribute(M, :name)
print(io, get_attribute(M, :name))
else
if is_unicode_allowed()
print(io, "Coherent sheaf of $(sheaf_of_rings(M))-modules on ", Lowercase(), scheme(M))
Expand Down Expand Up @@ -706,7 +712,7 @@ For a `ProjectiveScheme` ``ℙ`` return the ``d``-th twisting sheaf
julia> P = projective_space(QQ,3)
Projective space of dimension 3
over rational field
with homogeneous coordinates s0, s1, s2, s3
with homogeneous coordinates [s0, s1, s2, s3]
julia> twisting_sheaf(P, 4)
Coherent sheaf of modules
Expand Down Expand Up @@ -767,7 +773,7 @@ For a `ProjectiveScheme` ``ℙ`` return the sheaf ``𝒪(-1)`` as a `CoherentShe
julia> P = projective_space(QQ,3)
Projective space of dimension 3
over rational field
with homogeneous coordinates s0, s1, s2, s3
with homogeneous coordinates [s0, s1, s2, s3]
julia> tautological_bundle(P)
Coherent sheaf of modules
Expand Down
13 changes: 8 additions & 5 deletions experimental/Schemes/IdealSheaves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ julia> I = ideal([x^3-y^2*z]);
julia> Y = projective_scheme(P)
Projective space of dimension 2
over rational field
with homogeneous coordinates x, y, z
with homogeneous coordinates [x, y, z]
julia> IdealSheaf(Y, I)
Sheaf of ideals
Expand Down Expand Up @@ -1008,7 +1008,7 @@ end
###########################################################################

# If we know things about the ideal sheaf, we print them
function Base.show(io::IO, I::IdealSheaf)
function Base.show(io::IO, I::IdealSheaf, show_scheme::Bool = true)
io = pretty(io)
X = scheme(I)
if has_attribute(I, :dim) && has_attribute(X, :dim)
Expand All @@ -1017,8 +1017,9 @@ function Base.show(io::IO, I::IdealSheaf)
z = false
end
prim = get_attribute(I, :is_prime, false)

if get(io, :supercompact, false)
if has_attribute(I, :name)
print(io, get_attribute(I, :name))
elseif get(io, :supercompact, false)
print(io, "Presheaf")
else
if get_attribute(I, :is_one, false)
Expand All @@ -1030,7 +1031,9 @@ function Base.show(io::IO, I::IdealSheaf)
else
print(io, "Sheaf of ideals")
end
print(io," on ", Lowercase(), X)
if show_scheme
print(io," on ", Lowercase(), X)
end
end
end

Expand Down
Loading

0 comments on commit b92ad7d

Please sign in to comment.