diff --git a/experimental/Schemes/CoveredProjectiveSchemes.jl b/experimental/Schemes/CoveredProjectiveSchemes.jl index c804dc36f868..aecd5354731b 100644 --- a/experimental/Schemes/CoveredProjectiveSchemes.jl +++ b/experimental/Schemes/CoveredProjectiveSchemes.jl @@ -1756,3 +1756,45 @@ end # # +function fiber_product( + i1::CoveredClosedEmbedding, + i2::CoveredClosedEmbedding + ) + X1 = domain(i1) + X2 = domain(i2) + Y = codomain(i1) + Y === codomain(i2) || error("codomains do not coincide") + i1_cov = covering_morphism(i1) + i2_cov = covering_morphism(i2) + codomain(i1_cov) === codomain(i2_cov) || error("case of different coverings in codomain not implemented") + cod_cov = codomain(i1_cov) + #= + cod_ref, ref1, ref2 = common_refinement(codomain(i1_cov), codomain(i2_cov)) + dom_ref1, i1_res = fiber_product(i1, ref1) + dom_ref2, i2_res = fiber_product(i1, ref2) + # etc. etc.... This is roughly the generic code to come. + =# + I1 = image_ideal(i1) + pb_I1 = pullback(i2, I1) + I2 = image_ideal(i2) + pb_I2 = pullback(i1, I2) + + j1 = Oscar.CoveredClosedEmbedding(domain(i2), pb_I1) + Z = domain(j1) + morphism_dict = IdDict{AbsSpec, ClosedEmbedding}() + for U in affine_charts(Z) + V2 = codomain(j1[U]) + W = codomain(i2[V2]) + V1_candidates = maps_with_given_codomain(i1, W) + @assert length(V1_candidates) == 1 "not the correct number of patches found" + V1 = domain(first(V1_candidates)) + x = gens(OO(V1)) + lift_x = [preimage(pullback(i1[V1]), f) for f in x] + pb_x = pullback(i2[V2]).(lift_x) + pb_x = pullback(j1[U]).(pb_x) + morphism_dict[U] = ClosedEmbedding(SpecMor(U, V1, pb_x, check=false), pb_I2(V1), check=false) + end + j2_cov = CoveringMorphism(default_covering(Z), domain(i1_cov), morphism_dict, check=false) + j2 = Oscar.CoveredClosedEmbedding(Z, X1, j2_cov) + return j1, j2 +end diff --git a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl index 20c3ca8307e6..a6bb844d521c 100644 --- a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl @@ -159,49 +159,3 @@ function Base.show(io::IO, ::MIME"text/plain", f::AbsCoveredSchemeMorphism) end end -function fiber_product( - i1::CoveredClosedEmbedding, - i2::CoveredClosedEmbedding - ) - X1 = domain(i1) - X2 = domain(i2) - Y = codomain(i1) - Y === codomain(i2) || error("codomains do not coincide") - i1_cov = covering_morphism(i1) - i2_cov = covering_morphism(i2) - codomain(i1_cov) === codomain(i2_cov) || error("case of different coverings in codomain not implemented") - cod_cov = codomain(i1_cov) - #= - cod_ref, ref1, ref2 = common_refinement(codomain(i1_cov), codomain(i2_cov)) - dom_ref1, i1_res = fiber_product(i1, ref1) - dom_ref2, i2_res = fiber_product(i1, ref2) - # etc. etc.... This is roughly the generic code to come. - =# - I1 = image_ideal(i1) - pb_I1 = pullback(i2, I1) - I2 = image_ideal(i2) - pb_I2 = pullback(i1, I2) - - j1 = Oscar.CoveredClosedEmbedding(domain(i2), pb_I1) - Z = domain(j1) - morphism_dict = IdDict{AbsSpec, ClosedEmbedding}() - for U in affine_charts(Z) - V2 = codomain(j1[U]) - W = codomain(i2[V2]) - V1_candidates = maps_with_given_codomain(i1, W) - @assert length(V1_candidates) == 1 "not the correct number of patches found" - V1 = domain(first(V1_candidates)) - x = gens(OO(V1)) - @show x - lift_x = [preimage(pullback(i1[V1]), f) for f in x] - @show lift_x - pb_x = pullback(i2[V2]).(lift_x) - @show pb_x - pb_x = pullback(j1[U]).(pb_x) - @show pb_x - morphism_dict[U] = ClosedEmbedding(SpecMor(U, V1, pb_x, check=false), pb_I2(V1), check=false) - end - j2_cov = CoveringMorphism(default_covering(Z), domain(i1_cov), morphism_dict, check=false) - j2 = Oscar.CoveredClosedEmbedding(Z, X1, j2_cov) - return j1, j2 -end diff --git a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Constructors.jl b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Constructors.jl index bf55c64354e0..8fbb1d946d02 100644 --- a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Constructors.jl +++ b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Constructors.jl @@ -152,6 +152,7 @@ identity_map(P::AbsProjectiveScheme) = ProjectiveSchemeMor(P, P, function sub(P::AbsProjectiveScheme, I::Ideal) @req base_ring(I) === homogeneous_coordinate_ring(P) "ideal must be defined in the homogeneous coordinate ring of the scheme" inc = ProjectiveClosedEmbedding(P, I) + set_attribute!(domain(inc), :ambient_space, ambient_space(P)) return domain(inc), inc end @@ -179,3 +180,13 @@ function compose(f::ProjectiveClosedEmbedding, g::ProjectiveClosedEmbedding) J = push_If + Ig return ProjectiveClosedEmbedding(compose(underlying_morphism(f), underlying_morphism(g)), J, check=false) end + +function ambient_embedding(X::AbsProjectiveScheme) + IP = ambient_space(X) + S = homogeneous_coordinate_ring(IP) + T = homogeneous_coordinate_ring(X) + I = defining_ideal(X) + pb = hom(S, T, gens(T)) + inc_sub = ProjectiveSchemeMor(X, IP, pb, check=false) + return ProjectiveClosedEmbedding(inc_sub, I, check=false) +end