Skip to content

Commit

Permalink
Fix dim for affine schemes (oscar-system#2639)
Browse files Browse the repository at this point in the history
Implemented dimension for localizations along complements of prime
ideals and powers of an element. Not implemented for other
localizations.
  • Loading branch information
paemurru committed Sep 4, 2023
1 parent bfd0792 commit 3ead045
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
33 changes: 28 additions & 5 deletions src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,37 @@ julia> dim(Y) # one dimension comes from ZZ and two from x1 and x2
dim(X::AbsSpec)

@attr function dim(X::AbsSpec{<:Ring, <:MPolyQuoLocRing})
return dim(saturated_ideal(modulus(OO(X))))
error("Not implemented")
end

@attr function dim(X::AbsSpec{<:Ring, <:MPolyQuoLocRing{<:Any,<:Any,<:MPolyRing,<:MPolyRingElem, <:MPolyPowersOfElement}})
println("QuoLoc PowersOfElement")
return dim(closure(X))
end

@attr function dim(X::AbsSpec{<:Ring, <:MPolyQuoLocRing{<:Any,<:Any,<:MPolyRing,<:MPolyRingElem, <:MPolyComplementOfPrimeIdeal}})
println("QuoLoc ComplementOfPrimeIdeal")
# Spec (R / I)_P
R = OO(X)
P = prime_ideal(inverted_set(R))
I = saturated_ideal(modulus(R))
return dim(I) - dim(P)
end

@attr function dim(X::AbsSpec{<:Ring, <:MPolyLocRing})
# the following line is supposed to refer the problem to the
# algebra side of the problem
return dim(ideal(ambient_coordinate_ring(X), [zero(ambient_coordinate_ring(X))]))
error("Not implemented")
end

@attr function dim(X::AbsSpec{<:Ring, <:MPolyLocRing{<:Any,<:Any,<:MPolyRing,<:MPolyRingElem, <:MPolyPowersOfElement}})
println("Loc PowersOfElement")
# zariski open subset of A^n
return dim(closure(X))
end

@attr function dim(X::AbsSpec{<:Ring, <:MPolyLocRing{<:Any,<:Any,<:MPolyRing,<:MPolyRingElem, <:MPolyComplementOfPrimeIdeal}})
println("Loc ComplementOfPrimeIdeal")
P = prime_ideal(inverted_set(OO(X)))
return codim(P)
end

@attr function dim(X::AbsSpec{<:Ring, <:MPolyRing})
Expand All @@ -404,7 +428,6 @@ end
return dim(modulus(OO(X)))
end


@doc raw"""
codim(X::AbsSpec)
Expand Down
6 changes: 3 additions & 3 deletions src/Rings/mpoly-localizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ mutable struct MPolyComplementOfPrimeIdeal{

function MPolyComplementOfPrimeIdeal(
P::MPolyIdeal{RingElemType};
check::Bool=false
check::Bool=true
) where {RingElemType}
R = base_ring(P)
check && (is_prime(P) || error("the ideal $P is not prime"))
Expand Down Expand Up @@ -378,7 +378,7 @@ Complement
in multivariate polynomial ring in 3 variables over QQ
```
"""
complement_of_prime_ideal(P::MPolyIdeal; check::Bool=false) = MPolyComplementOfPrimeIdeal(P; check)
complement_of_prime_ideal(P::MPolyIdeal; check::Bool=true) = MPolyComplementOfPrimeIdeal(P; check)

@doc raw"""
powers_of_element(f::MPolyRingElem)
Expand Down Expand Up @@ -1178,7 +1178,7 @@ function Localization(
end

### additional constructors
MPolyLocRing(R::RingType, P::MPolyIdeal{RingElemType}) where {RingType, RingElemType} = MPolyLocRing(R, MPolyComplementOfPrimeIdeal(P))
MPolyLocRing(R::RingType, P::MPolyIdeal{RingElemType}; check::Bool=true) where {RingType, RingElemType} = MPolyLocRing(R, MPolyComplementOfPrimeIdeal(P); check)

Localization(R::MPolyRing, v::Vector{T}) where {T<:MPolyRingElem} = Localization(MPolyPowersOfElement(R, v))

Expand Down
11 changes: 11 additions & 0 deletions test/AlgebraicGeometry/Schemes/AffineSchemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,22 @@
@test !issubset(A3, X)
@test issubset(A3,A3)
@test issubset(intersect(A3,A3), A3)

# Tests for dimension when localizing with respect to either a prime
# ideal or powers of an element
@test dim(A3) == 3
@test dim(U) == 3
@test dim(X) == 2
@test codim(A3) == 0
@test codim(X) == 1
disjoint_plane_and_line = subscheme(A3, [x*(x - 1), x*y])
line = hypersurface_complement(disjoint_plane_and_line, x)
plane = hypersurface_complement(disjoint_plane_and_line, y)
@test dim(line) == 1
@test dim(plane) == 2
A3_localized_along_line = Spec(Localization(R, complement_of_prime_ideal(ideal(R, [x, y])))[1])
@test dim(A3_localized_along_line) == 2
@test dim(standard_spec(A3_localized_along_line)) == 2
end

@testset "smoothness tests" begin
Expand Down

0 comments on commit 3ead045

Please sign in to comment.