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

Disjoint gluings #3861

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion experimental/Schemes/src/LazyGluing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,3 @@ end
# Method for compatibility with internal methods of the gluings

Gluing(g::LazyGluing) = Gluing(underlying_gluing(g))

Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
return X, injections
end

disjoint_union(X::AbsCoveredScheme, Y::AbsCoveredScheme) = disjoint_union([X,Y])

Check warning on line 151 in src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Constructors.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Constructors.jl#L151

Added line #L151 was not covered by tests

### Conversion of an affine scheme into a covered scheme
CoveredScheme(X::AbsAffineScheme) = CoveredScheme(Covering(X))

Expand Down
16 changes: 16 additions & 0 deletions src/AlgebraicGeometry/Schemes/Covering/Objects/Constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ function disjoint_union(C1::Covering, C2::Covering)
for (X, Y) in keys(gluings(C2))
add_gluing!(C, C2[X, Y])
end
for X in patches(C1)
for Y in patches(C2)
add_gluing!(C, disjoint_gluing(X, Y))
end
end
return C
end

# legacy for the test
function _disjoint_union_raw(C1::Covering, C2::Covering)
C = Covering(vcat(patches(C1), patches(C2)))
for (X, Y) in keys(gluings(C1))
add_gluing!(C, C1[X, Y])
end
for (X, Y) in keys(gluings(C2))
add_gluing!(C, C2[X, Y])
end
return C
end
8 changes: 6 additions & 2 deletions src/AlgebraicGeometry/Schemes/Covering/Objects/Methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ function update_gluing_graph(C::Covering; all_dense::Bool=false)
add_edge!(gg, C[X], C[Y])
add_edge!(gg, C[Y], C[X])
else
(U, V) = gluing_domains(C[X,Y])
G = C[X,Y]
has_is_disjoint_gluing(G) && is_disjoint_gluing(G) && continue
(U, V) = gluing_domains(G)
is_dense(U) && add_edge!(gg, C[X], C[Y])
is_dense(V) && add_edge!(gg, C[Y], C[X])
end
Expand All @@ -81,11 +83,13 @@ function pruned_gluing_graph(C::Covering)
m = length(v)
gt = Graph{Undirected}(m)
for (X, Y) in keys(gluings(C))
G = C[X,Y]
has_is_disjoint_gluing(G) && is_disjoint_gluing(G) && continue
i = findfirst(==(C[X]),v)
!isnothing(i) || continue
j = findfirst(==(C[Y]),v)
!isnothing(j) || continue
(U, V) = gluing_domains(C[X,Y])
(U, V) = gluing_domains(G)
is_dense(U) && add_edge!(gt, i, j)
is_dense(V) && add_edge!(gt, j, i)
end
Expand Down
12 changes: 12 additions & 0 deletions src/AlgebraicGeometry/Schemes/Gluing/Attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
return Ginv
end


########################################################################
# Getters for Gluing #
########################################################################
Expand All @@ -76,4 +77,15 @@
return Ginv
end

########################################################################
# Further methods #
########################################################################

@attr function is_disjoint_gluing(G::AbsGluing)
U = gluing_domains(G)[1]
return is_empty(U)

Check warning on line 86 in src/AlgebraicGeometry/Schemes/Gluing/Attributes.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgebraicGeometry/Schemes/Gluing/Attributes.jl#L84-L86

Added lines #L84 - L86 were not covered by tests
end

function has_is_disjoint_gluing(G::AbsGluing)
return has_attribute(G, :is_disjoint_gluing)
end
15 changes: 15 additions & 0 deletions src/AlgebraicGeometry/Schemes/Gluing/Constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ function Gluing(
return SimpleGluing(X, Y, f, g, check=check)
end

########################################################################
# Disjoint gluing #
########################################################################

function disjoint_gluing(X::AbsAffineScheme, Y::AbsAffineScheme)
U = EmptyPrincipalOpenSubset(X)
V = EmptyPrincipalOpenSubset(Y)
f = morphism(U,V, [zero(OO(U)) for i in 1:ngens(OO(V))])
g = morphism(V,U, [zero(OO(V)) for i in 1:ngens(OO(U))])
S = SimpleGluing(X,Y,f,g)
set_attribute!(S, :is_disjoint_gluing=>true)
return S
end


########################################################################
# Restrictions of Gluings to closed subschemes #
########################################################################
Expand Down
1 change: 0 additions & 1 deletion src/AlgebraicGeometry/Schemes/Gluing/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,3 @@ Concrete instance of an `AbsGluing` for gluings of affine schemes
}(X, Y, U, V, f, g)
end
end

Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@

### Conversion of an arbitrary AbsAffineScheme
PrincipalOpenSubset(X::AbsAffineScheme) = PrincipalOpenSubset(X, one(OO(X)))

function EmptyPrincipalOpenSubset(X::AbsAffineScheme)
Ue = subscheme(X, OO(X)(1))
U = PrincipalOpenSubset(X, Ue, OO(X)(0))
return U
end

Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@
)
U = spec(R)
@check U == hypersurface_complement(X, f) "scheme is not isomorphic to the anticipated open subset"
return new{base_ring_type(X), ring_type(U), typeof(X)}(X, U, lifted_numerator.(f))
n = lifted_numerator(f)
return new{base_ring_type(X), ring_type(U), typeof(X)}(X, U, [n], n)

Check warning on line 32 in src/AlgebraicGeometry/Schemes/PrincipalOpenSubset/Objects/Types.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgebraicGeometry/Schemes/PrincipalOpenSubset/Objects/Types.jl#L31-L32

Added lines #L31 - L32 were not covered by tests
end

function PrincipalOpenSubset(X::AbsAffineScheme, U::AffineScheme, f::RingElem;
check::Bool=true
)
@check ((iszero(f) && is_empty(U)) || U == hypersurface_complement(X, f)) "scheme is not isomorphic to the anticipated open subset"
n = lifted_numerator(f)
return new{base_ring_type(X), ring_type(U), typeof(X)}(X, U, [n], n)
end

function PrincipalOpenSubset(X::AbsAffineScheme, R::Ring, f::Vector{T};
check::Bool=true
) where {T<:RingElem}
Expand Down
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ export is_cyclic, has_is_cyclic, set_is_cyclic
export is_degenerate
export is_dense
export is_dihedral_group, has_is_dihedral_group, set_is_dihedral_group
export is_disjoint_gluing
export is_du_val_singularity
export is_duplicate_table
export is_effective
Expand Down
2 changes: 1 addition & 1 deletion test/AlgebraicGeometry/Schemes/FunctionFields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ end

# Join the resulting schemes in a disjoint union with two
# components
C = disjoint_union(Cs, Ct)
C = Oscar._disjoint_union_raw(Cs, Ct)

# Manually glue two (dense) patches of the two components
X = Cs[3]
Expand Down
11 changes: 11 additions & 0 deletions test/AlgebraicGeometry/Schemes/Gluing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,14 @@ end
end
end

@testset "disjoint gluings" begin
P2a = projective_space(QQ,2)
P2b = projective_space(QQ,2)
P2ac = covered_scheme(P2a)
P2bc = covered_scheme(P2b)
D,_ = disjoint_union(P2ac,P2bc)
@test is_disjoint_gluing(D[1][1,4])
@test !is_disjoint_gluing(D[1][1,2])
@test 12 == number_of_edges(gluing_graph(D))
end

2 changes: 1 addition & 1 deletion test/AlgebraicGeometry/Schemes/IdealSheaves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# Join the resulting schemes in a disjoint union with two
# components
C = disjoint_union(Cs, Ct)
C = Oscar._disjoint_union_raw(Cs, Ct)

# Manually glue two (dense) patches of the two components
X = Cs[3]
Expand Down
2 changes: 1 addition & 1 deletion test/AlgebraicGeometry/Schemes/WeilDivisor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# Join the resulting schemes in a disjoint union with two
# components
C = disjoint_union(Cs, Ct)
C = Oscar._disjoint_union_raw(Cs, Ct)

# Manually glue two (dense) patches of the two components
X = Cs[3]
Expand Down
Loading