Skip to content
1 change: 0 additions & 1 deletion experimental/IntersectionTheory/src/IntersectionTheory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using ..Oscar
import Base: +, -, *, ^, ==, div, zero, one, parent
import ..Oscar: AffAlgHom, Ring, MPolyDecRingElem, symmetric_power, exterior_power, pullback, canonical_bundle, graph, euler_characteristic, pullback
import ..Oscar: basis, betti_numbers, chow_ring, codomain, degree, det, dim, domain, dual, gens, hilbert_polynomial, hom, integral, rank, signature, partitions, blow_up
import ..Oscar.AbstractAlgebra.Generic: FunctionalMap
import ..Oscar: pullback, pushforward, base, OO, product, compose, identity_map, map
import ..Oscar: trivial_line_bundle
import ..Oscar: intersection_matrix
Expand Down
66 changes: 33 additions & 33 deletions experimental/IntersectionTheory/src/Main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ end
map(X::AbstractVariety, Y::AbstractVariety, fˣ::Vector, fₓ = nothing; inclusion::Bool = false, symbol::String = "x")

Return an abstract variety map `X` $\rightarrow$ `Y` by specifying the pullbacks of
the generators of the Chow ring of `Y`.
the generators of the Chow ring of `Y`.

!!! note
The corresponding pushforward will be automatically computed in certain cases.
Expand Down Expand Up @@ -588,7 +588,7 @@ pushforward(f::AbstractVarietyMap, F::AbstractBundle) = AbstractBundle(f.codomai
Return the identity map on `X`.
"""
function identity_map(X::AbstractVariety)
AbstractVarietyMap(X, X, gens(X.ring), map_from_func(identity, X.ring, X.ring))
AbstractVarietyMap(X, X, gens(X.ring), MapFromFunc(X.ring, X.ring, identity))
end

@doc raw"""
Expand All @@ -602,7 +602,7 @@ function compose(f::AbstractVarietyMap, g::AbstractVarietyMap)
Z = g.codomain
gofₓ = nothing
if isdefined(f, :pushforward) && isdefined(g, :pushforward)
gofₓ = map_from_func(g.pushforward ∘ f.pushforward, X.ring, Z.ring)
gofₓ = MapFromFunc(X.ring, Z.ring, g.pushforward ∘ f.pushforward)
end
gof = AbstractVarietyMap(X, Z, g.pullback * f.pullback, gofₓ)
return gof
Expand Down Expand Up @@ -1051,7 +1051,7 @@ If `X` has been given a tangent bundle, return the dual bundle.
julia> P2 = abstract_projective_space(2)
AbstractVariety of dim 2

julia> cotangent_bundle(P2) == dual(tangent_bundle(P2))
julia> cotangent_bundle(P2) == dual(tangent_bundle(P2))
true

```
Expand All @@ -1071,7 +1071,7 @@ AbstractVariety of dim 2
julia> canonical_class(P2) == chern_class(cotangent_bundle(P2), 1)
true

julia> canonical_class(P2)
julia> canonical_class(P2)
-3*h

```
Expand Down Expand Up @@ -1348,7 +1348,7 @@ end

Return the product $X\times Y$. Alternatively, use `*`.

!!! note
!!! note
If both `X` and `Y` have been given a polarization, $X\times Y$ will be endowed with the polarization corresponding to the Segre embedding.

```jldoctest
Expand Down Expand Up @@ -1473,7 +1473,7 @@ end
+(F::AbstractBundle, G::AbstractBundle)
-(F::AbstractBundle, G::AbstractBundle)
*(F::AbstractBundle, G::AbstractBundle)

Return `-F`, the sum `F` $+ \dots +$ `F` of `n` copies of `F`, `F` $+$ `G`, `F` $-$ `G`, and the tensor product of `F` and `G`, respectively.

# Examples
Expand Down Expand Up @@ -1554,7 +1554,7 @@ end
@doc raw"""
symmetric_power(F::AbstractBundle, k::Int)
symmetric_power(F::AbstractBundle, k::RingElement)

Return the `k`-th symmetric power of `F`. Here, `k` can contain parameters.
"""
function symmetric_power(F::AbstractBundle, k::Int)
Expand Down Expand Up @@ -1665,7 +1665,7 @@ basis(X::AbstractVariety, k::Int) = basis(X)[k+1]
@doc raw"""
betti_numbers(X::AbstractVariety)

Return the Betti numbers of the Chow ring of `X`.
Return the Betti numbers of the Chow ring of `X`.

!!! note
The Betti number of `X` in a given degree is the number of elements of `basis(X)` in that degree.
Expand Down Expand Up @@ -1787,7 +1787,7 @@ end
intersection_matrix(X::AbstractVariety)

If `b = vcat(basis(X)...)`, return `matrix([integral(bi*bj) for bi in b, bj in b])`.

intersection_matrix(a::Vector, b::Vector)

Return `matrix([integral(ai*bj) for ai in a, bj in b])`.
Expand Down Expand Up @@ -2119,7 +2119,7 @@ function zero_locus_section(F::AbstractBundle; class::Bool=false)
Z.O1 = Z(X.O1.f)
end
iₓ = x -> x.f * cZ
iₓ = map_from_func(iₓ, Z.ring, X.ring)
iₓ = MapFromFunc(Z.ring, X.ring, iₓ)
@assert R isa MPolyQuoRing
i = AbstractVarietyMap(Z, X, Z.(gens(base_ring(R))), iₓ)
i.T = pullback(i, -F)
Expand Down Expand Up @@ -2424,9 +2424,9 @@ function projective_bundle(F::AbstractBundle; symbol::String = "z")
X, r = F.parent, F.rank
!(r isa Int) && error("expect rank to be an integer")
R = X.ring

# construct the ring

w = vcat([1], gradings(R))
R1, (z,), imgs_in_R1 = graded_polynomial_ring(X.base, [symbol], symbols(R); weights = w)
if R isa MPolyQuoRing
Expand All @@ -2436,7 +2436,7 @@ function projective_bundle(F::AbstractBundle; symbol::String = "z")
end
pback = hom(PR, R1, imgs_in_R1)
pfwd = hom(R1, R, pushfirst!(gens(R), R()))

# construct the relations

rels = [sum(pback(chern_class(F, i).f) * z^(r-i) for i in 0:r)]
Expand All @@ -2445,19 +2445,19 @@ function projective_bundle(F::AbstractBundle; symbol::String = "z")
end
APF = quo(R1, ideal(rels))[1]
z = APF(z)

# construct the abstract variety

PF = AbstractVariety(X.dim+r-1, APF)
pₓ = x -> X(pfwd(div(simplify(x).f, simplify(PF(z^(r-1))).f)))
pₓ = map_from_func(pₓ, PF.ring, X.ring)
pₓ = MapFromFunc(PF.ring, X.ring, pₓ)
p = AbstractVarietyMap(PF, X, PF.(imgs_in_R1), pₓ)
if isdefined(X, :point)
PF.point = p.pullback(X.point) * z^(r-1)
end
p.O1 = PF(z)
PF.O1 = PF(z)
S = AbstractBundle(PF, 1, 1-z)
S = AbstractBundle(PF, 1, 1-z)
Q = pullback(p, F) - S
p.T = dual(S)*Q
if isdefined(X, :T)
Expand Down Expand Up @@ -2506,7 +2506,7 @@ end
@doc raw"""
abstract_grassmannian(k::Int, n::Int; base::Ring = QQ, symbol::String = "c")

Return the abstract Grassmannian $\mathrm{G}(k, n)$ of `k`-dimensional subspaces of an
Return the abstract Grassmannian $\mathrm{G}(k, n)$ of `k`-dimensional subspaces of an
`n`-dimensional vector space.

!!! note
Expand Down Expand Up @@ -2544,7 +2544,7 @@ true
```
"""
function abstract_grassmannian(k::Int, n::Int; base::Ring = QQ, symbol::String = "c")
@assert k < n
@assert k < n
d = k*(n-k)
R, c = graded_polynomial_ring(base, symbol => 1:k; weights = 1:k)
inv_c = sum((-sum(c))^i for i in 1:n) # this is c(Q) since c(S)⋅c(Q) = 1
Expand All @@ -2570,8 +2570,8 @@ end
abstract_flag_variety(dims::Int...; base::Ring = QQ, symbol::String = "c")
abstract_flag_variety(dims::Vector{Int}; base::Ring = QQ, symbol::String = "c")

Given integers, say, $d_1, \dots, d_{k}, n$ with $0 < d_1 < \dots < d_{k} < n$ or a vector of such integers,
return the abstract flag variety $\mathrm{F}(d_1, \dots, d_{k}; n)$ of nested sequences of subspaces of
Given integers, say, $d_1, \dots, d_{k}, n$ with $0 < d_1 < \dots < d_{k} < n$ or a vector of such integers,
return the abstract flag variety $\mathrm{F}(d_1, \dots, d_{k}; n)$ of nested sequences of subspaces of
dimensions $d_1, \dots, d_{k}$ of an $n$-dimensional vector space.

!!! note
Expand Down Expand Up @@ -2646,8 +2646,8 @@ end
flag_bundle(F::AbstractBundle, dims::Int...; symbol::String = "c")
flag_bundle(F::AbstractBundle, dims::Vector{Int}; symbol::String = "c")

Given integers, say, $d_1, \dots, d_{k}, n$ with $0 < d_1 < \dots < d_{k} < n$ or a vector of such integers,
and given an abstract bundle $F$ of rank $n$, return the abstract flag bundle of nested sequences
Given integers, say, $d_1, \dots, d_{k}, n$ with $0 < d_1 < \dots < d_{k} < n$ or a vector of such integers,
and given an abstract bundle $F$ of rank $n$, return the abstract flag bundle of nested sequences
of subspaces of dimensions $d_1, \dots, d_{k}$ in the fibers of $F$.

!!! note
Expand Down Expand Up @@ -2697,19 +2697,19 @@ end
function flag_bundle(F::AbstractBundle, dims::Vector{Int}; symbol::String = "c")
X, n = F.parent, F.rank
!(n isa Int) && error("expect rank to be an integer")

# compute the ranks of successive subqotients and the relative dimension

if dims[end] < n # the last dim can be omitted
dims = vcat(dims, [n])
end
l = length(dims)
ranks = pushfirst!([dims[i+1]-dims[i] for i in 1:l-1], dims[1])
@assert all(>(0), ranks) && dims[end] <= n
d = sum(ranks[i] * sum(dims[end]-dims[i]) for i in 1:l-1)

# construct the ring

R = X.ring
if R isa MPolyQuoRing
PR = base_ring(R)
Expand All @@ -2722,9 +2722,9 @@ function flag_bundle(F::AbstractBundle, dims::Vector{Int}; symbol::String = "c")
R1, gens_for_rels_R1, imgs_in_R1 = graded_polynomial_ring(X.base, syms, symbols(PR); weights = w)
pback = hom(PR, R1, imgs_in_R1)
pfwd = hom(R1, R, vcat(repeat([R()], n), gens(R)))

# compute the relations

c = [1+sum(gens_for_rels_R1[dims[i]+1:dims[i+1]]) for i in 1:l-1]
pushfirst!(c, 1+sum(gens_for_rels_R1[1:dims[1]]))
Rx, x = R1[:x]
Expand All @@ -2740,16 +2740,16 @@ function flag_bundle(F::AbstractBundle, dims::Vector{Int}; symbol::String = "c")
c = AFl.(c)

# construct the abstract_variety
Fl = AbstractVariety(X.dim + d, AFl)

Fl = AbstractVariety(X.dim + d, AFl)
Fl.bundles = [AbstractBundle(Fl, r, ci) for (r,ci) in zip(ranks, c)]
section = prod(top_chern_class(E)^sum(dims[i]) for (i, E) in enumerate(Fl.bundles[2:end]))
if isdefined(X, :point)
Fl.point = pback(X.point.f) * section
end
pˣ = Fl.(imgs_in_R1)
pₓ = x -> (@warn("possibly wrong ans"); X(pfwd(div(simplify(x).f, simplify(section).f))))
pₓ = map_from_func(pₓ, Fl.ring, X.ring)
pₓ = MapFromFunc(Fl.ring, X.ring, pₓ)
p = AbstractVarietyMap(Fl, X, pˣ, pₓ)
p.O1 = simplify(sum((i-1)*chern_class(Fl.bundles[i], 1) for i in 1:l))
Fl.O1 = p.O1
Expand Down
7 changes: 3 additions & 4 deletions experimental/IntersectionTheory/src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ mutable struct AbstractVarietyMap{V1 <: AbstractVarietyT, V2 <: AbstractVarietyT
codomain::V2
dim::Int
pullback::AffAlgHom
pushforward::FunctionalMap
pushforward::MapFromFunc
O1::MPolyDecRingOrQuoElem
T::AbstractBundle{V1}
function AbstractVarietyMap(X::V1, Y::V2, fˣ::AffAlgHom, fₓ=nothing) where {V1 <: AbstractVarietyT, V2 <: AbstractVarietyT}
if !(fₓ isa FunctionalMap) && isdefined(X, :point) && isdefined(Y, :point)
if !(fₓ isa MapFromFunc) && isdefined(X, :point) && isdefined(Y, :point)
# pushforward can be deduced from pullback in the following cases
# - explicitly specified (f is relatively algebraic)
# - X is a point
Expand All @@ -141,7 +141,7 @@ mutable struct AbstractVarietyMap{V1 <: AbstractVarietyT, V2 <: AbstractVarietyT
end;
sum(integral(xi*fˣ(yi))*di for (i, xi) in zip(dim(Y):-1:0, x[dim(X)-dim(Y):dim(X)])
if xi !=0 for (yi, di) in zip(basis(Y, i), dual_basis(Y, i))))
fₓ = map_from_func(fₓ, X.ring, Y.ring)
fₓ = MapFromFunc(X.ring, Y.ring, fₓ)
end
f = new{V1, V2}(X, Y, X.dim-Y.dim, fˣ)
try
Expand Down Expand Up @@ -179,4 +179,3 @@ end
return X
end
end

18 changes: 9 additions & 9 deletions experimental/IntersectionTheory/src/blowup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

# we construct E as the projective bundle PN of N, see [E-H, p 472]

E = projective_bundle(N)
E = projective_bundle(N)
AE, RE = E.ring, base_ring(E.ring)
g = E.struct_map
ζ = g.O1 # the first Chern class of O_E(1)
Expand All @@ -124,7 +124,7 @@
degs = [degree(Int, Z(gs[i])) + 1 for i in 1:ngs]
degsRX = [Int(degree(g)[1]) for g in gens(RX)]
RBl, ev, xv = graded_polynomial_ring(X.base, syms, symbols(RX); weights = vcat(degs, degsRX))

RXtoRBl = hom(RX, RBl, xv) # fˣ on polynomial ring level
jₓgˣ = x -> sum(ev .* RXtoRBl.(sect(x.f))) # AZ --> RBl

Expand Down Expand Up @@ -163,7 +163,7 @@
rhs = sum([jₓgˣ(Z(gs[j]) * cN[k]) * (-ev[end])^(rN-k) for k in 1:rN])
push!(Rels, lhs - rhs)
end

Rels = minimal_generating_set(ideal(RBl, Rels)) ### TODO: make this an option?
ABl, _ = quo(RBl, Rels)
Bl = abstract_variety(X.dim, ABl)
Expand All @@ -175,15 +175,15 @@
RBltoRX = hom(RBl, RX, vcat(repeat([RX()], ngs), gens(RX)))
fₓ = x -> (xf = simplify(x).f;
X(RBltoRX(xf));)
fₓ = map_from_func(fₓ, ABl, AX)
fₓ = MapFromFunc(ABl, AX, fₓ)
f = AbstractVarietyMap(Bl, X, Bl.(xv), fₓ)
Bl.struct_map = f
if isdefined(X, :point) Bl.point = f.pullback(X.point) end

# pullback of j

jˣ = vcat([-ζ * g.pullback(Z(xi)) for xi in gs], [g.pullback(i.pullback(f)) for f in gens(AX)])

# pushforward of j: write as a polynomial in ζ, and compute term by term

REtoRZ = hom(RE, RZ, pushfirst!(gens(RZ), RZ()))
Expand All @@ -195,7 +195,7 @@
xf -= q * ζ.f^k
end;
Bl(ans))
jₓ = map_from_func(jₓ, AE, AX)
jₓ = MapFromFunc(AE, ABl, jₓ)
j = AbstractVarietyMap(E, Bl, jˣ, jₓ)

# the normal bundle of E in Bl is O(-1)
Expand Down Expand Up @@ -339,15 +339,15 @@
X⁺ = abstract_variety(X.dim, AX⁺)

set_attribute!(X⁺, :description => "$X")
fₓ = map_from_func(x -> error("not defined"), X⁺.ring, X.ring) # TODO check this
fₓ = MapFromFunc(X⁺.ring, X.ring, x -> error("not defined")) # TODO check this

Check warning on line 342 in experimental/IntersectionTheory/src/blowup.jl

View check run for this annotation

Codecov / codecov/patch

experimental/IntersectionTheory/src/blowup.jl#L342

Added line #L342 was not covered by tests
f = AbstractVarietyMap(X⁺, X, X⁺.(xv), fₓ)
X⁺.struct_map = f
X⁺.T = pullback(f, X.T)
f.T = AbstractBundle(X⁺, X⁺(0)) # there is no relative tangent bundle
X⁺.point = f.pullback(X.point)
if isdefined(X, :O1) X⁺.O1 = f.pullback(X.O1) end
jˣ = vcat(Z.(gs) .* c, [i.pullback(f) for f in gens(AX)])
j_ = map_from_func(x -> X⁺(jₓ(x)), Z.ring, X⁺.ring)
j_ = MapFromFunc(Z.ring, X⁺.ring, x -> X⁺(jₓ(x)))

Check warning on line 350 in experimental/IntersectionTheory/src/blowup.jl

View check run for this annotation

Codecov / codecov/patch

experimental/IntersectionTheory/src/blowup.jl#L350

Added line #L350 was not covered by tests
j = AbstractVarietyMap(Z, X⁺, jˣ, j_)
return j
end
Loading
Loading