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

Intersection theory: correct bug, add more examples #4269

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion experimental/IntersectionTheory/docs/src/AbstractBundles.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ euler_characteristic(F::AbstractBundle)
hilbert_polynomial(F::AbstractBundle)
```


## Operations on Abstract Bundles

```@docs
Expand All @@ -88,3 +87,9 @@ exterior_power(F::AbstractBundle, k::Int)
```@docs
symmetric_power(F::AbstractBundle, k::Int)
```

## Tests on Abstract Bundles

```@docs
==(F::AbstractBundle, G::AbstractBundle)
```
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ product(X::AbstractVariety, Y::AbstractVariety)
## Integrate Chow Ring Elements

```@julia
integral(x::MPolyDecRingElem)
integral(x::Union{MPolyDecRingElem, MPolyQuoRingElem})
```

Given an element `x` of the Chow ring of an abstract variety `X`, say, return the integral of `x`.
Expand Down
113 changes: 109 additions & 4 deletions experimental/IntersectionTheory/src/Main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,28 @@
abstract_bundle(X::AbstractVariety, ch::MPolyDecRingOrQuoElem) = AbstractBundle(X, ch)
abstract_bundle(X::AbstractVariety, r::RingElement, c::MPolyDecRingOrQuoElem) = AbstractBundle(X, r, c)

#######################################################
@doc raw"""
==(F::AbstractBundle, G::AbstractBundle)

Return `true` if `F` is equal to `G`, and `false` otherwise.

# Examples
```jldoctest
julia> P2 = abstract_projective_space(2)
AbstractVariety of dim 2

julia> 3*OO(P2, 1) - OO(P2) == tangent_bundle(P2) # Euler sequence
true

```
"""
==(F::AbstractBundle, G::AbstractBundle) = chern_character(F) == chern_character(G)
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved

function Base.hash(F::AbstractBundle, h::UInt)
return hash(chern_character(F), h)

Check warning on line 72 in experimental/IntersectionTheory/src/Main.jl

View check run for this annotation

Codecov / codecov/patch

experimental/IntersectionTheory/src/Main.jl#L71-L72

Added lines #L71 - L72 were not covered by tests
end

@doc raw"""
chern_character(F::AbstractBundle)

Expand Down Expand Up @@ -196,13 +216,62 @@
segre_class(F::AbstractBundle, k::Int)

Return the `k`-th Segre class of `F`.

# Examples
```jldoctest
julia> G = abstract_grassmannian(3,5)
AbstractVariety of dim 6

julia> Q = tautological_bundles(G)[2]
AbstractBundle of rank 2 on AbstractVariety of dim 6

julia> segre_class(Q,0)
1

julia> segre_class(Q,1)
c[1]

julia> segre_class(Q,2)
c[2]

julia> segre_class(Q,3)
c[3]

```
"""
segre_class(F::AbstractBundle, k::Int) = total_segre_class(F)[k]

@doc raw"""
todd_class(F::AbstractBundle)

Return the Todd class of `F`.

# Examples
```jldoctest
julia> P = abstract_projective_space(4, symbol = "H"); # Hartshorne, p. 433

julia> F = exterior_power(cotangent_bundle(P), 3)*OO(P,3);

julia> G = OO(P, 1)+4*OO(P);

julia> Z = degeneracy_locus(F, G, 3) # rational surface in P4
AbstractVariety of dim 2

julia> TZ = tangent_bundle(Z);

julia> K = canonical_class(Z)
z - H

julia> chern_class(TZ, 1) == -K
true

julia> tc = todd_class(TZ)
-1//2*z + 1//8*H^2 + 1//2*H + 1

julia> tc == 1-1//2*K+1//12*(K^2+chern_class(TZ, 2))
true

```
"""
todd_class(F::AbstractBundle) = _todd_class(chern_character(F))

Expand Down Expand Up @@ -231,6 +300,36 @@

Return the holomorphic Euler characteristic $\chi(F)$ and the Euler pairing
$\chi(F,G)$, respectively.

# Examples
```jldoctest
julia> P = abstract_projective_space(4, symbol = "H"); # Hartshorne, p. 433

julia> F = exterior_power(cotangent_bundle(P), 3)*OO(P,3);

julia> G = OO(P, 1)+4*OO(P);

julia> Z = degeneracy_locus(F, G, 3) # rational surface in P4
AbstractVariety of dim 2

julia> TZ = tangent_bundle(Z);

julia> tc = todd_class(TZ)
-1//2*z + 1//8*H^2 + 1//2*H + 1

julia> K = canonical_class(Z)
z - H

julia> H = hyperplane_class(Z)
H

julia> ec = euler_characteristic(OO(Z, H))
4

julia> ec == integral(1//2*H*(H-K)+1//12*(K^2+chern_class(TZ, 2)))
true

```
"""
Oscar.euler_characteristic(F::AbstractBundle) = integral(chern_character(F) * todd_class(F.parent)) # Hirzebruch-Riemann-Roch
euler_pairing(F::AbstractBundle, G::AbstractBundle) = begin
Expand Down Expand Up @@ -757,7 +856,7 @@

@doc raw"""
line_bundle(X::AbstractVariety, n::RingElement)
line_bundle(X::AbstractVariety, D::MPolyDecRingElem)
line_bundle(X::AbstractVariety, D::Union{MPolyDecRingElem, MPolyQuoRingElem})

Return the line bundle $\mathcal O_X(n)$ on `X` if `X` has been given a
hyperplane class, or a line bundle $\mathcal O_X(D)$ with first Chern class $D$.
Expand All @@ -771,13 +870,19 @@
julia> tautological_bundles(P2)[1] == OO(P2, -1)
true

julia> h = gens(P2)[1]
h

julia> OO(P2, h) == OO(P2, 1)
true

```
"""
line_bundle(X::AbstractVariety, n::RingElement) = AbstractBundle(X, 1, 1+n*X.O1)
line_bundle(X::AbstractVariety, D::MPolyDecRingElem) = AbstractBundle(X, 1, 1+D[1])
line_bundle(X::AbstractVariety, D::Union{MPolyDecRingElem, MPolyQuoRingElem}) = AbstractBundle(X, 1, 1+D[1])

(OO)(X::AbstractVariety, n::RingElement) = line_bundle(X, n)
OO(X::AbstractVariety, D::MPolyDecRingElem) = line_bundle(X, D)
OO(X::AbstractVariety, D::Union{MPolyDecRingElem, MPolyQuoRingElem}) = line_bundle(X, D)

@doc raw"""
degree(X::AbstractVariety)
Expand Down Expand Up @@ -1451,7 +1556,7 @@
betti_numbers(X::AbstractVariety) = length.(basis(X))

@doc raw"""
integral(x::MPolyDecRingElem)
integral(x:::Union{MPolyDecRingElem, MPolyQuoRingElem})

Given an element `x` of the Chow ring of an abstract variety `X`, say, return the integral of `x`.

Expand Down
Loading