-
Notifications
You must be signed in to change notification settings - Fork 113
/
Constructors.jl
201 lines (156 loc) · 6.17 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
########################################################
# (1) Generic constructors
########################################################
@doc raw"""
algebraic_set(X::AffineScheme; is_reduced=false, check=true) -> AffineAlgebraicSet
Convert `X` to an `AffineAlgebraicSet` by considering its reduced structure.
If `is_reduced` is set, assume that `X` is already reduced.
If `is_reduced` and `check` are set,
check that `X` is actually geometrically reduced as claimed.
"""
function algebraic_set(X::AffineScheme; is_reduced::Bool=false, check::Bool=true)
return AffineAlgebraicSet(X, is_reduced=is_reduced, check=check)
end
@doc raw"""
algebraic_set(I::MPolyIdeal; is_radical::Bool=false, check::Bool=true)
Return the affine algebraic set defined ``I``.
If `is_radical` is set, assume that ``I`` is a radical ideal.
```jldoctest
julia> R, (x,y) = GF(2)[:x,:y];
julia> X = algebraic_set(ideal([y^2+y+x^3+1,x]))
Affine algebraic set
in affine 2-space over GF(2) with coordinates [x, y]
defined by ideal (x^3 + y^2 + y + 1, x)
```
"""
function algebraic_set(I::MPolyIdeal{<:MPolyRingElem}; is_radical::Bool=false, check::Bool=true)
X = spec(base_ring(I), I)
return algebraic_set(X, is_reduced=is_radical, check=check)
end
@doc raw"""
algebraic_set(p::MPolyRingElem)
Return the affine algebraic set defined by the multivariate polynomial `p`.
```jldoctest
julia> R, (x,y) = QQ[:x,:y];
julia> X = algebraic_set((y^2+y+x^3+1)*x^2)
Affine algebraic set
in affine 2-space over QQ with coordinates [x, y]
defined by ideal (x^5 + x^2*y^2 + x^2*y + x^2)
julia> R, (x,y) = GF(2)[:x,:y];
julia> X = algebraic_set((y^2+y+x^3+1)*x^2)
Affine algebraic set
in affine 2-space over GF(2) with coordinates [x, y]
defined by ideal (x^5 + x^2*y^2 + x^2*y + x^2)
```
"""
function algebraic_set(p::MPolyRingElem; is_radical::Bool =false, check::Bool=true)
I = ideal(parent(p), p)
return algebraic_set(I, check=check, is_radical=is_radical)
end
########################################################
# (2) Intersections of algebraic sets
########################################################
@doc raw"""
set_theoretic_intersection(X::AbsAffineAlgebraicSet, Y::AbsAffineAlgebraicSet)
Return the set theoretic intersection of `X` and `Y` as an algebraic set.
```jldoctest set_theoretic_intersection
julia> A = affine_space(QQ, [:x,:y])
Affine space of dimension 2
over rational field
with coordinates [x, y]
julia> (x, y) = coordinates(A)
2-element Vector{QQMPolyRingElem}:
x
y
julia> X = algebraic_set(ideal([y - x^2]))
Affine algebraic set
in affine 2-space over QQ with coordinates [x, y]
defined by ideal (-x^2 + y)
julia> Y = algebraic_set(ideal([y]))
Affine algebraic set
in affine 2-space over QQ with coordinates [x, y]
defined by ideal (y)
julia> Zred = set_theoretic_intersection(X, Y)
Affine algebraic set
in affine 2-space over QQ with coordinates [x, y]
defined by ideal (-x^2 + y, y)
```
Note that the set theoretic intersection forgets the intersection multiplicities
which the scheme theoretic intersection remembers. Therefore they are different.
```jldoctest set_theoretic_intersection
julia> Z = intersect(X, Y) # a non reduced scheme
Spectrum
of quotient
of multivariate polynomial ring in 2 variables x, y
over rational field
by ideal (x^2 - y, y)
julia> Zred == Z
false
julia> Zred == reduced_scheme(Z)[1]
true
```
"""
function set_theoretic_intersection(X::AbsAffineAlgebraicSet, Y::AbsAffineAlgebraicSet)
Z = intersect(fat_scheme(X), fat_scheme(Y))
return algebraic_set(Z)
end
function union(X::AbsAffineAlgebraicSet, Y::AbsAffineAlgebraicSet)
Z = union(fat_scheme(X), fat_scheme(Y))
return algebraic_set(Z)
end
########################################################
# (3) Closure of algebraic sets
########################################################
@doc raw"""
closure(X::AbsAffineAlgebraicSet)
Return the closure of ``X`` in its ambient affine space.
"""
function closure(X::AbsAffineAlgebraicSet)
Xcl = closure(fat_scheme(X), ambient_space(X))
return algebraic_set(Xcl, check=false)
end
########################################################
# (4) Irreducible Components
########################################################
@doc raw"""
irreducible_components(X::AbsAffineAlgebraicSet) -> Vector{AffineVariety}
Return the irreducible components of ``X`` defined over the base field of ``X``.
Note that they may be reducible over the algebraic closure.
See also [`geometric_irreducible_components`](@ref).
"""
function irreducible_components(X::AbsAffineAlgebraicSet)
error("not implemented")
end
# special case for affine space
irreducible_components(X::AbsAffineAlgebraicSet{<:Field, MPolyRing}) = [X]
function irreducible_components(X::AbsAffineAlgebraicSet{S,T}) where {S<:Field, T<:MPolyQuoRing}
I = fat_ideal(X)
P = minimal_primes(I)
if length(P)==1 && is_one(P[1]) # catch the empty set for now :-(
return AffineAlgebraicSet{S,T}[]
end
return AffineAlgebraicSet{S,T}[algebraic_set(p, is_radical=true, check=false) for p in P]
end
@doc raw"""
geometric_irreducible_components(X::AbsAffineAlgebraicSet)
Return the geometrically irreducible components of ``X``.
They are the irreducible components ``V_{ij}`` of ``X`` seen over an algebraically
closed field and given as a vector of tuples ``(A_i, V_{ij}, d_{ij})``, say,
where ``A_i`` is an algebraic set which is irreducible over the base field of ``X``
and ``V_{ij}`` represents a corresponding class of galois conjugated geometrically
irreducible components of ``A_i`` defined over a number field of degree
``d_{ij}`` whose generator prints as `_a`.
This is expensive and involves taking field extensions.
"""
function geometric_irreducible_components(X::AbsAffineAlgebraicSet)
error("not implemented")
end
geometric_irreducible_components(X::AbsAffineAlgebraicSet{<:Field, <:MPolyRing}) = [X]
function geometric_irreducible_components(X::AbsAffineAlgebraicSet{QQField, T} where {T<:MPolyQuoRing})
I = vanishing_ideal(X)
if is_one(I) # catch the empty set ... not typestable anyways
return AffineAlgebraicSet{QQField, T}[]
end
Pabs = absolute_primary_decomposition(I)
return [(algebraic_set(p[2], is_radical=true, check=false), variety(p[3], check=false),p[4]) for p in Pabs]
end