-
Notifications
You must be signed in to change notification settings - Fork 126
/
Constructors.jl
101 lines (82 loc) · 2.61 KB
/
Constructors.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
########################################################################
# Constructors for Covering #
########################################################################
### The default constructor
# Returns a scheme in which every affine patch is only
# glued to itself via the identity.
@doc raw"""
Covering(patches::Vector{<:AbsSpec})
Return a `Covering` with pairwise disjoint affine charts ``Uᵢ`` given by
the entries of `patches`. This `Covering` will have no glueings except
those glueings along the identity of every affine chart to itself.
# Examples
```jldoctest
julia> P1, (x,y) = QQ["x", "y"];
julia> P2, (u,v) = QQ["u", "v"];
julia> U1 = Spec(P1);
julia> U2 = Spec(P2);
julia> C = Covering([U1, U2]) # A Covering with two disjoint affine charts
Covering
described by patches
1: spec of multivariate polynomial ring
2: spec of multivariate polynomial ring
in the coordinate(s)
1: [x, y]
2: [u, v]
```
"""
function Covering(patches::Vector{<:AbsSpec})
g = IdDict{Tuple{AbsSpec, AbsSpec}, AbsGlueing}()
for X in patches
U = PrincipalOpenSubset(X)
f = identity_map(U)
g[X,X] = SimpleGlueing(X, X, f, f, check=false)
end
return Covering(patches, g, check=false)
end
### Turns an affine scheme into a trivial covering
Covering(X::AbsSpec) = Covering([X])
### The empty covering of the empty scheme over kk
empty_covering(kk::Ring) = Covering(kk)
@doc raw"""
disjoint_union(C1::Covering, C2::Covering)
Return the `Covering` corresponding to the disjoint union of `C1` and `C2`.
The charts and glueings of the disjoint union are given by the disjoint union of the charts and glueings of the covers `C1` and `C2`.
# Examples
```jldoctest
julia> P1, (x,y) = QQ["x", "y"];
julia> P2, (u,v) = QQ["u", "v"];
julia> U1 = Spec(P1);
julia> U2 = Spec(P2);
julia> C1 = Covering(U1) # Set up the trivial covering with only one patch
Covering
described by patches
1: spec of multivariate polynomial ring
in the coordinate(s)
1: [x, y]
julia> C2 = Covering(U2)
Covering
described by patches
1: spec of multivariate polynomial ring
in the coordinate(s)
1: [u, v]
julia> C = disjoint_union(C1, C2)
Covering
described by patches
1: spec of multivariate polynomial ring
2: spec of multivariate polynomial ring
in the coordinate(s)
1: [x, y]
2: [u, v]
```
"""
function disjoint_union(C1::Covering, C2::Covering)
C = Covering(vcat(patches(C1), patches(C2)))
for (X, Y) in keys(glueings(C1))
add_glueing!(C, C1[X, Y])
end
for (X, Y) in keys(glueings(C2))
add_glueing!(C, C2[X, Y])
end
return C
end