diff --git a/docs/oscar_references.bib b/docs/oscar_references.bib index 47fbde9fe0e0..e7963429c25b 100644 --- a/docs/oscar_references.bib +++ b/docs/oscar_references.bib @@ -2238,6 +2238,19 @@ @Article{Wit88 reportnumber = {IASSNS-HEP-88/7} } +@Article{Wit97, + author = {Witten, Edward}, + title = {{On flux quantization in M theory and the effective action}}, + journal = {J. Geom. Phys.}, + volume = {22}, + pages = {1--13}, + year = {1997}, + doi = {10.1016/S0393-0440(96)00042-3}, + eprint = {hep-th/9609122}, + archiveprefix = {arXiv}, + reportnumber = {IASSNS-HEP-96-96} +} + @Article{Yam18, author = {Yamagishi, Ryo}, title = {On smoothness of minimal models of quotient singularities by finite subgroups of ${\rm SL}_n(\mathbb diff --git a/docs/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses.md b/docs/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses.md index 26a3e87818e5..5c05bbefb755 100644 --- a/docs/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses.md +++ b/docs/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses.md @@ -54,14 +54,14 @@ polynomial(ring::MPolyQuoRing, c::CohomologyClass) ## Methods ```@docs -integrate(c::CohomologyClass) +integrate(c::CohomologyClass; check::Bool = true) ``` ## Special attributes of toric varieties ```@docs -cohomology_ring(v::NormalToricVarietyType) +cohomology_ring(v::NormalToricVarietyType; check::Bool = true) volume_form(v::NormalToricVariety) intersection_form(v::NormalToricVariety) ``` diff --git a/experimental/FTheoryTools/docs/doc.main b/experimental/FTheoryTools/docs/doc.main index a7e330011f80..7f322b33fc73 100644 --- a/experimental/FTheoryTools/docs/doc.main +++ b/experimental/FTheoryTools/docs/doc.main @@ -5,6 +5,7 @@ "weierstrass.md", "tate.md", "hypersurface.md", - "literature.md" + "literature.md", + "g4.md" ], ] diff --git a/experimental/FTheoryTools/docs/src/g4.md b/experimental/FTheoryTools/docs/src/g4.md new file mode 100644 index 000000000000..a6c5c8095da5 --- /dev/null +++ b/experimental/FTheoryTools/docs/src/g4.md @@ -0,0 +1,35 @@ +```@meta +CurrentModule = Oscar +``` + +# G4-Fluxes + +$G_4$-fluxes are at the heart of F-theory model building. + + +## Constructors + +We currently support the following constructor: +```@docs +g4_flux(model::AbstractFTheoryModel, class::CohomologyClass) +``` + + +## Attributes + +We currently support the following attributes: +```@docs +model(gf::G4Flux) +cohomology_class(gf::G4Flux) +``` + + +## Properties + +We currently support the following properties: +```@docs +passes_elementary_quantization_checks(gf::G4Flux) +``` + + +## Methods diff --git a/experimental/FTheoryTools/docs/src/generalities.md b/experimental/FTheoryTools/docs/src/generalities.md index 1c63c013e62c..cb8ebd06d2a2 100644 --- a/experimental/FTheoryTools/docs/src/generalities.md +++ b/experimental/FTheoryTools/docs/src/generalities.md @@ -59,6 +59,8 @@ classes_of_model_sections(m::AbstractFTheoryModel) defining_classes(m::AbstractFTheoryModel) gauge_algebra(m::AbstractFTheoryModel) global_gauge_quotients(m::AbstractFTheoryModel) +chern_class_c1(m::AbstractFTheoryModel; check::Bool = true) +chern_class_c2(m::AbstractFTheoryModel; check::Bool = true) ``` diff --git a/experimental/FTheoryTools/src/AbstractFTheoryModels/attributes.jl b/experimental/FTheoryTools/src/AbstractFTheoryModels/attributes.jl index fbedf3c50c73..71645ef9318f 100644 --- a/experimental/FTheoryTools/src/AbstractFTheoryModels/attributes.jl +++ b/experimental/FTheoryTools/src/AbstractFTheoryModels/attributes.jl @@ -1096,6 +1096,128 @@ function global_gauge_quotients(m::AbstractFTheoryModel) end +@doc raw""" + chern_class_c1(m::AbstractFTheoryModel) + +If the elliptically fibered n-fold $Y_n$ underlying the F-theory model in question is given +as a hypersurface in a toric ambient space, we can compute a cohomology class $h$ on the +toric ambient space $X_\Sigma$, such that its restriction to $Y_n$ is the first Chern class +$c_1$ of the tangent bundle of $Y_n$. If those assumptions are satisfied, this method returns +this very cohomology class $h$, otherwise it raises and error. + +Note that $Y_n$ is a Calabi-Yau variety precisely if $c_1$ is trivial. Thus, the restriction +of $h$ to the hypersurface $Y_n$ must be trivial. Upon closer inspection, in the given toric +setting, this is equivalent to $h$ being trivial. + +The computation of the cohomology ring verifies if the toric variety is simplicial and +complete. The check for it to be complete can be very time consuming. This can be switched +off by setting the optional argument `check` to the value `false`, as in the example below. + +```jldoctest +julia> qsm_model = literature_model(arxiv_id = "1903.00009", model_parameters = Dict("k" => 4)) +Hypersurface model over a concrete base + +julia> h = chern_class_c1(qsm_model; check = false) +Cohomology class on a normal toric variety given by 0 + +julia> is_trivial(h) +true +``` +""" +function chern_class_c1(m::AbstractFTheoryModel; check::Bool = true) + @req (m isa WeierstrassModel || m isa GlobalTateModel || m isa HypersurfaceModel) "First Chern class of F-theory model supported for Weierstrass, global Tate and hypersurface models only" + @req base_space(m) isa NormalToricVariety "First Chern class of F-theory model currently supported only for toric base" + @req ambient_space(m) isa NormalToricVariety "First Chern class of F-theory model currently supported only for toric ambient space" + + # Check if the answer is known + if has_attribute(m, :chern_class_c1) + return get_attribute(m, :chern_class_c1) + end + + # Trigger potential short-cut computation of cohomology ring + cohomology_ring(ambient_space(m); check) + + # Compute the cohomology class corresponding to the hypersurface equation + if m isa WeierstrassModel + cl = toric_divisor_class(ambient_space(m), degree(weierstrass_polynomial(m))) + end + if m isa GlobalTateModel + cl = toric_divisor_class(ambient_space(m), degree(tate_polynomial(m))) + end + if m isa HypersurfaceModel + cl = toric_divisor_class(ambient_space(m), degree(hypersurface_equation(m))) + end + cy = cohomology_class(cl) + + # Compute and set h + c1_t_ambient = cohomology_class(anticanonical_divisor(ambient_space(m))) + set_attribute!(m, :chern_class_c1, c1_t_ambient - cy) + return get_attribute(m, :chern_class_c1) +end + + +@doc raw""" + chern_class_c2(m::AbstractFTheoryModel) + +If the elliptically fibered n-fold $Y_n$ underlying the F-theory model in question is given +as a hypersurface in a toric ambient space, we can compute a cohomology class $h$ on the +toric ambient space $X_\Sigma$, such that its restriction to $Y_n$ is the 2nd Chern class +$c_2$ of the tangent bundle of $Y_n$. If those assumptions are satisfied, this method returns +this very cohomology class $h$, otherwise it raises and error. + +As of right now, this method is computationally quite expensive for involved toric varieties, +such as in the example below. Therefore, think carefully if you truly want to compute this quantity. + +The computation of the cohomology ring verifies if the toric variety is simplicial and +complete. The check for it to be complete can be very time consuming. This can be switched +off by setting the optional argument `check` to the value `false`, as in the example below. + +```jldoctest +julia> qsm_model = literature_model(arxiv_id = "1903.00009", model_parameters = Dict("k" => 4)) +Hypersurface model over a concrete base + +julia> h = chern_class_c2(qsm_model; check = false); + +julia> is_trivial(h) +false +``` +""" +function chern_class_c2(m::AbstractFTheoryModel; check::Bool = true) + @req (m isa WeierstrassModel || m isa GlobalTateModel || m isa HypersurfaceModel) "Second Chern class of F-theory model supported for Weierstrass, global Tate and hypersurface models only" + @req base_space(m) isa NormalToricVariety "Second Chern class of F-theory model currently supported only for toric base" + @req ambient_space(m) isa NormalToricVariety "Second Chern class of F-theory model currently supported only for toric ambient space" + + # Check if the answer is known + if has_attribute(m, :chern_class_c2) + return get_attribute(m, :chern_class_c2) + end + + # Trigger potential short-cut computation of cohomology ring + cohomology_ring(ambient_space(m); check) + + # Compute the cohomology class corresponding to the hypersurface equation + if m isa WeierstrassModel + cl = toric_divisor_class(ambient_space(m), degree(weierstrass_polynomial(m))) + end + if m isa GlobalTateModel + cl = toric_divisor_class(ambient_space(m), degree(tate_polynomial(m))) + end + if m isa HypersurfaceModel + cl = toric_divisor_class(ambient_space(m), degree(hypersurface_equation(m))) + end + cy = cohomology_class(cl) + + # Compute sum of products of cohomolgy classes of torus invariant prime divisors + c_ds = [polynomial(cohomology_class(d)) for d in torusinvariant_prime_divisors(ambient_space(m))] + c2_t_ambient = sum(c_ds[i]*c_ds[j] for i in 1:length(c_ds)-1 for j in i+1:length(c_ds)) + c2_t_ambient = cohomology_class(ambient_space(m), c2_t_ambient) + + # Compute and set h + h = c2_t_ambient - cy * chern_class_c1(m; check = check) + set_attribute!(m, :chern_class_c2, h) + return h +end + ########################################## ### (4) Attributes specially for the QSMs diff --git a/experimental/FTheoryTools/src/FTheoryTools.jl b/experimental/FTheoryTools/src/FTheoryTools.jl index 3774867fb0aa..d8d4cccfa42f 100644 --- a/experimental/FTheoryTools/src/FTheoryTools.jl +++ b/experimental/FTheoryTools/src/FTheoryTools.jl @@ -26,6 +26,10 @@ include("standard_constructions.jl") include("LiteratureModels/constructors.jl") include("LiteratureModels/create_index.jl") +include("G4Fluxes/constructors.jl") +include("G4Fluxes/attributes.jl") +include("G4Fluxes/properties.jl") + include("Serialization/tate_models.jl") include("Serialization/weierstrass_models.jl") include("Serialization/hypersurface_models.jl") diff --git a/experimental/FTheoryTools/src/G4Fluxes/attributes.jl b/experimental/FTheoryTools/src/G4Fluxes/attributes.jl new file mode 100644 index 000000000000..332d9b4a31de --- /dev/null +++ b/experimental/FTheoryTools/src/G4Fluxes/attributes.jl @@ -0,0 +1,48 @@ +##################################################### +# 1 Basic attributes +##################################################### + +@doc raw""" + model(gf::G4Flux) + +Return the F-theory model for which this $G_4$-flux candidate is defined. + +```jldoctest +julia> qsm_model = literature_model(arxiv_id = "1903.00009", model_parameters = Dict("k" => 4)) +Hypersurface model over a concrete base + +julia> cohomology_ring(ambient_space(qsm_model), check = false); + +julia> g4_class = cohomology_class(anticanonical_divisor_class(ambient_space(qsm_model)))^2; + +julia> g4f = g4_flux(qsm_model, g4_class, check = false) +G4-flux candidate lacking elementary quantization checks + +julia> model(g4f) +Hypersurface model over a concrete base +``` +""" +model(gf::G4Flux) = gf.model + + +@doc raw""" + cohomology_class(gf::G4Flux) + +Return the cohomology class which defines the $G_4$-flux candidate. + +```jldoctest +julia> qsm_model = literature_model(arxiv_id = "1903.00009", model_parameters = Dict("k" => 4)) +Hypersurface model over a concrete base + +julia> cohomology_ring(ambient_space(qsm_model), check = false); + +julia> g4_class = cohomology_class(anticanonical_divisor_class(ambient_space(qsm_model)))^2; + +julia> g4f = g4_flux(qsm_model, g4_class, check = false) +G4-flux candidate lacking elementary quantization checks + +julia> cohomology_class(g4f) == g4_class +true +``` +""" +cohomology_class(gf::G4Flux) = gf.class diff --git a/experimental/FTheoryTools/src/G4Fluxes/constructors.jl b/experimental/FTheoryTools/src/G4Fluxes/constructors.jl new file mode 100644 index 000000000000..b09296337e83 --- /dev/null +++ b/experimental/FTheoryTools/src/G4Fluxes/constructors.jl @@ -0,0 +1,120 @@ +################ +# 1: Constructor +################ + +@doc raw""" + g4_flux(model::AbstractFTheoryModel, class::CohomologyClass) + +Construct a G4-flux candidate on an F-theory model. This functionality is +currently limited to +- Weierstrass models, +- global Tate models, +- hypersurface models. +Furthermore, our functionality requires a concrete geometry. That is, +the base space as well as the ambient space must be toric varieties. +In the toric ambient space $X_\Sigma$, the elliptically fibered space $Y$ +that defines the F-theory model, is given by a hypersurface (cut out by +the Weierstrass, Tate or hypersurface polynomial, respectively). + +In this setting, we assume that a $G_4$-flux candidate is represented by a +cohomology class $h$ in $H^{(2,2)} (X_\Sigma)$. The actual $G_4$-flux candidate +is then obtained by restricting $h$ to $Y$. + +It is worth recalling that the $G_4$-flux candidate is subject to the quantization +condition $G_4 + \frac{1}{2} c_2(Y) \in H^{/2,2)}( Y_, \mathbb{Z})$ (see [Wit97](@cite)). +This condition is very hard to verify. However, it is relatively easy to gather +evidence for this condition to be satisfied/show that it is violated. To this end, let +$D_1$, $D_2$ be two toric divisors in $X_\Sigma$, then the topological intersection number +$\left[ h|_Y \right] \cdot \left[ P \right] \cdot \left[ D_1 \right] \cdot \left[ D_2 \right]$ +must be an integer. Even this rather elementary check can be computationally expensive. +Users can therefore decide to skip this check upon construction by setting the parameter +`check` to the value `false`. + +Another bottleneck can be the computation of the cohomology ring, which is necessary to +work with cohomology classes on the toric ambient space, which in turn define the G4-flux, +as explained above. The reason for this is, that by employing the theory explained in +[CLS11](@cite), we can only work out the cohomology ring of simpicial and complete (i.e. compact) +toric varieties. However, checking if a toric variety is complete (i.e. compact) can take +a long time. If the geometry in question is involved and you already know that the variety +is simplicial and complete, then we recommend to trigger the computation of the cohomology +ring with `check = false`. This will avoid this time consuming test. + +An example is in order. + +# Examples +```jldoctest +julia> qsm_model = literature_model(arxiv_id = "1903.00009", model_parameters = Dict("k" => 4)) +Hypersurface model over a concrete base + +julia> cohomology_ring(ambient_space(qsm_model), check = false); + +julia> g4_class = cohomology_class(anticanonical_divisor_class(ambient_space(qsm_model)))^2; + +julia> g4f = g4_flux(qsm_model, g4_class) +G4-flux candidate + +julia> g4f2 = g4_flux(qsm_model, g4_class, check = false) +G4-flux candidate lacking elementary quantization checks +``` +""" +function g4_flux(m::AbstractFTheoryModel, g4_class::CohomologyClass; check::Bool = true) + @req (m isa WeierstrassModel || m isa GlobalTateModel || m isa HypersurfaceModel) "G4-fluxes only supported for Weierstrass, global Tate and hypersurface models" + @req base_space(m) isa NormalToricVariety "G4-flux currently supported only for toric base" + @req ambient_space(m) isa NormalToricVariety "G4-flux currently supported only for toric ambient space" + g4_candidate = G4Flux(m, g4_class) + if check && !passes_elementary_quantization_checks(g4_candidate) + error("Given G4-flux candidate found to violate quantization condition") + end + return g4_candidate +end + + +################################################ +# 2: Equality and hash +################################################ + +function Base.:(==)(gf1::G4Flux, gf2::G4Flux) + # G4-fluxes can only be equal if they are defined for identically the same model + model(gf1) !== model(gf2) && return false + + # Currently, can only decide equality for Weierstrass, global Tate and hypersurface models + if (m isa WeierstrassModel || m isa GlobalTateModel || m isa HypersurfaceModel) == false + error("Can currently only decide equality of G4-fluxes for Weierstrass, global Tate and hypersurface models") + end + + # Compute the cohomology class corresponding to the hypersurface equation + if m isa WeierstrassModel + cl = toric_divisor_class(ambient_space(m), degree(weierstrass_polynomial(m))) + end + if m isa GlobalTateModel + cl = toric_divisor_class(ambient_space(m), degree(tate_polynomial(m))) + end + if m isa HypersurfaceModel + cl = toric_divisor_class(ambient_space(m), degree(hypersurface_equation(m))) + end + cy = cohomology_class(cl) + + # Now can return the result + return cy * cohomology_class(gf1) == cy * cohomology_class(gf2) + +end + +function Base.hash(gf::G4Flux, h::UInt) + b = 0x92bd6ac4f87d834e % UInt + h = hash(model(gf), h) + h = hash(cohomology_class(gf), h) + return xor(h, b) +end + + +################################################ +# 3: Display +################################################ + +function Base.show(io::IO, g4::G4Flux) + properties_string = String["G4-flux candidate"] + if !has_attribute(g4, :passes_elementary_quantization_checks) + push!(properties_string, "lacking elementary quantization checks") + end + join(io, properties_string, " ") +end diff --git a/experimental/FTheoryTools/src/G4Fluxes/properties.jl b/experimental/FTheoryTools/src/G4Fluxes/properties.jl new file mode 100644 index 000000000000..e4c6f9142f46 --- /dev/null +++ b/experimental/FTheoryTools/src/G4Fluxes/properties.jl @@ -0,0 +1,69 @@ +##################################################### +# 1 Basic properties +##################################################### + +@doc raw""" + passes_elementary_quantization_checks(gf::G4Flux) + +G4-fluxes are subject to the quantization condition +[Wit97](@cite) $G_4 + \frac{1}{2} c_2(Y) \in H^{(2,2)}(Y, \mathbb{Z})$. +It is hard to verify that this condition is met. However, +we can execute a number of simple consistency checks, by +verifying that $\int_{Y}{G_4 \wedge [D_1] \wedge [D_2]} \in \mathbb{Z}$ +for any two toric divisors $D_1$, $D_2$. If all of these +simple consistency checks are met, this method will return +`true` and otherwise `false`. + +It is worth mentioning that currently (July 2024), we only +support this check for $G_4$-fluxes defined on Weierstrass, +global Tate and hypersurface models. If this condition is not +met, this method will return an error. + +```jldoctest +julia> qsm_model = literature_model(arxiv_id = "1903.00009", model_parameters = Dict("k" => 4)) +Hypersurface model over a concrete base + +julia> cohomology_ring(ambient_space(qsm_model), check = false); + +julia> g4_class = cohomology_class(anticanonical_divisor_class(ambient_space(qsm_model)))^2; + +julia> g4 = g4_flux(qsm_model, g4_class, check = false) +G4-flux candidate lacking elementary quantization checks + +julia> passes_elementary_quantization_checks(g4) +true +``` +""" +@attr Bool function passes_elementary_quantization_checks(g4::G4Flux) + m = model(g4) + @req (m isa WeierstrassModel || m isa GlobalTateModel || m isa HypersurfaceModel) "Elementary quantization checks for G4-fluxes only supported for Weierstrass, global Tate and hypersurface models" + @req base_space(m) isa NormalToricVariety "Elementary quantization checks for G4-flux currently supported only for toric base" + @req ambient_space(m) isa NormalToricVariety "Elementary quantization checks for G4-flux currently supported only for toric ambient space" + + # Compute the cohomology class corresponding to the hypersurface equation + if m isa WeierstrassModel + cl = toric_divisor_class(ambient_space(m), degree(weierstrass_polynomial(m))) + end + if m isa GlobalTateModel + cl = toric_divisor_class(ambient_space(m), degree(tate_polynomial(m))) + end + if m isa HypersurfaceModel + cl = toric_divisor_class(ambient_space(m), degree(hypersurface_equation(m))) + end + cy = polynomial(cohomology_class(cl)) + + # Now check quantization condition G4 + 1/2 c2 is integral. + c_ds = [polynomial(cohomology_class(d)) for d in torusinvariant_prime_divisors(ambient_space(m))] + + # explicitly switched off an expensive test in the following line + twist_g4 = polynomial(cohomology_class(g4) + 1//2 * chern_class_c2(m; check = false)) + + # now execute elementary checks of the quantization condition + for i in 1:length(c_ds) + for j in i:length(c_ds) + numb = integrate(cohomology_class(ambient_space(m), twist_g4 * cy * c_ds[i] * c_ds[j]); check = false) + !is_integer(numb) && return false + end + end + return true +end diff --git a/experimental/FTheoryTools/src/exports.jl b/experimental/FTheoryTools/src/exports.jl index a277d429f29c..4c2931d4e508 100644 --- a/experimental/FTheoryTools/src/exports.jl +++ b/experimental/FTheoryTools/src/exports.jl @@ -35,6 +35,8 @@ export associated_literature_models export base_space export blow_up export calabi_yau_hypersurface +export chern_class_c1 +export chern_class_c2 export classes_of_model_sections export components_of_dual_graph export components_of_simplified_dual_graph @@ -51,6 +53,7 @@ export estimated_number_of_triangulations export explicit_model_sections export family_of_spaces export fiber_ambient_space +export g4_flux export gauge_algebra export genera_of_ci_curves export genera_of_components_of_dual_graph @@ -121,6 +124,7 @@ export kbar3 export literature_identifier export literature_model export max_lattice_pts_in_facet +export model export model_description export model_index export model_parameters @@ -128,6 +132,7 @@ export paper_authors export paper_buzzwords export paper_description export paper_title +export passes_elementary_quantization_checks export polytope_index export put_over_concrete_base export birational_literature_models diff --git a/experimental/FTheoryTools/src/types.jl b/experimental/FTheoryTools/src/types.jl index 4f696f158928..8b67d0e3585f 100644 --- a/experimental/FTheoryTools/src/types.jl +++ b/experimental/FTheoryTools/src/types.jl @@ -226,3 +226,14 @@ struct QSMModel genus_of_components_of_simplified_dual_graph::Dict{String, Int64} end + + +################################################ +# 4: The julia type for G4-fluxes +################################################ + +@attributes mutable struct G4Flux + model::AbstractFTheoryModel + class::CohomologyClass + G4Flux(model::AbstractFTheoryModel, class::CohomologyClass) = new(model, class) +end diff --git a/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/methods.jl b/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/methods.jl index dfa115c6e579..23eca4350f2f 100644 --- a/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/methods.jl +++ b/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/methods.jl @@ -1,9 +1,14 @@ @doc raw""" - integrate(c::CohomologyClass) + integrate(c::CohomologyClass; check::Bool = true) Integrate the cohomolgy class `c` over the normal toric variety `toric_variety(c)`. +The theory underlying this method requires that the toric variety +in question is simplicial and complete. The check of completeness +may take a long time to complete. If desired, this can be switched +off by setting the optional argument `check` to the value `false`. + # Examples ```jldoctest julia> dP3 = del_pezzo_surface(NormalToricVariety, 3) @@ -88,10 +93,12 @@ julia> integrate(cohomology_class(anticanonical_divisor_class(X))^3) 62 ``` """ -function integrate(c::CohomologyClass) +function integrate(c::CohomologyClass; check::Bool = true) # can only integrate if the variety is simplicial, complete - @req is_simplicial(toric_variety(c)) && is_complete(toric_variety(c)) "Integration only supported over complete and simplicial toric varieties" - + if check + @req is_simplicial(toric_variety(c)) && is_complete(toric_variety(c)) "Integration only supported over complete and simplicial toric varieties" + end + # if the intersection form is known, we can use it if has_attribute(toric_variety(c), :_intersection_form_via_exponents) intersection_dict = _intersection_form_via_exponents(toric_variety(c)) diff --git a/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl b/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl index 0892d9a927a1..7a75886b86e4 100644 --- a/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl +++ b/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl @@ -3,7 +3,7 @@ ######################## @doc raw""" - cohomology_ring(v::NormalToricVarietyType) + cohomology_ring(v::NormalToricVarietyType; check::Bool = true) Return the cohomology ring of the simplicial and complete toric variety `v`. @@ -15,12 +15,18 @@ julia> ngens(cohomology_ring(p2)) 3 ``` """ -@attr MPolyQuoRing function cohomology_ring(v::NormalToricVarietyType) +function cohomology_ring(v::NormalToricVarietyType; check::Bool = true) + if has_attribute(v, :cohomology_ring) + return get_attribute(v, :cohomology_ring) + end + if check @req is_simplicial(v) && is_complete(v) "The cohomology ring is only supported for simplicial and complete toric varieties" - R, _ = graded_polynomial_ring(coefficient_ring(v), coordinate_names(v), cached = false) - linear_relations = ideal_of_linear_relations(R, v) - stanley_reisner = stanley_reisner_ideal(R, v) - return quo(R, linear_relations + stanley_reisner)[1] + end + R, _ = graded_polynomial_ring(coefficient_ring(v), coordinate_names(v), cached = false) + linear_relations = ideal_of_linear_relations(R, v) + stanley_reisner = stanley_reisner_ideal(R, v) + set_attribute!(v, :cohomology_ring, quo(R, linear_relations + stanley_reisner)[1]) + return get_attribute(v, :cohomology_ring) end