Skip to content

Commit

Permalink
JA homogenizer (#3344)
Browse files Browse the repository at this point in the history
* Revised interface for homogenization (old UI still there)

* Removed excess semicolon in doctest

* First revision after feedback via Slack

* Restored correct operation (was temporarily disabled for testing)

* Fixed ambiguity to do with positive grading

* New Homogenizer/Dehomogenizer UI; removed old homogenization code

* Added default values of kwargs to the doc

* Updated doc for new homogenization UI

* Fixed docstring for dehomogenizer

* Workaround for limitation in Documenter

* Improved example by printing an ideal

* Updated defn of degree(ideal) to use new homogenization UI
  • Loading branch information
JohnAAbbott authored Feb 15, 2024
1 parent 449a824 commit 6d3e523
Show file tree
Hide file tree
Showing 7 changed files with 263 additions and 998 deletions.
26 changes: 20 additions & 6 deletions docs/src/CommutativeAlgebra/ideals.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,31 @@ equidimensional_hull_radical(I::MPolyIdeal)
Referring to [KR05](@cite) for definitions and technical details, we discuss homogenization and dehomogenization in the context of $\mathbb Z^m$-gradings.

```@docs
homogenization(f::MPolyRingElem, W::Union{ZZMatrix, Matrix{<:IntegerUnion}}, var::VarName; pos::Union{Int,Nothing}=nothing)
homogenizer(P::MPolyRing{T}, h::VarName; pos::Int=1+ngens(P)) where T
homogenizer(P::MPolyRing{T}, W::Union{ZZMatrix, Matrix{<:IntegerUnion}}, h::VarName; pos::Int) where T
dehomogenizer(H::Homogenizer)
```

```@docs
homogenization(f::MPolyRingElem, var::VarName; pos::Union{Int,Nothing}=nothing)
```
```jldoctest
julia> P, (x, y) = polynomial_ring(QQ, ["x", "y"]);
```@docs
dehomogenization(F::MPolyDecRingElem, pos::Int)
julia> I = ideal([x^2+y, x*y+y^2]);
julia> H = homogenizer(P, "h");
julia> Ih = H(I) # homogenization of ideal I
Ideal generated by
x*y + y^2
x^2 + y*h
y^3 + y^2*h
julia> DH = dehomogenizer(H);
julia> DH(Ih) == I # dehomogenization of Ih
true
```


## Ideals as Modules

```@docs
Expand Down
8 changes: 3 additions & 5 deletions src/AlgebraicGeometry/Curves/AffinePlaneCurve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,9 @@ end
Return the projective closure of `C`.
"""
function projective_closure(C::AffinePlaneCurve)
F = defining_equation(C)
K = base_ring(C)
T, (x, y, z) = graded_polynomial_ring(K, ["x", "y", "z"])
G = homogenization(F, T; pos=3)
D = plane_curve(G)
F = defining_equation(C)
H = homogenizer(parent(F), "z")
return plane_curve(H(F))
end

geometric_genus(C::AffinePlaneCurve) = geometric_genus(projective_closure(C))
Expand Down
12 changes: 8 additions & 4 deletions src/Rings/groebner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,16 @@ function standard_basis(I::MPolyIdeal; ordering::MonomialOrdering = default_orde
K = iszero(characteristic(R)) && !haskey(I.gb, degrevlex(R)) ? _mod_rand_prime(I) : I
S = base_ring(K)
gb = groebner_assure(K, degrevlex(S))
K_hom = homogenization(K, "w")
gb_hom = IdealGens((p -> homogenization(p, base_ring(K_hom))).(gens(gb)))
# 2024-02-09 Next lines "blindly" updated to use new homogenization UI
H = homogenizer(S, "w")
K_hom = H(K)
gb_hom = IdealGens(H.(gens(gb)))
gb_hom.isGB = true
K_hom.gb[degrevlex(S)] = gb_hom
singular_assure(K_hom.gb[degrevlex(S)])
hn = hilbert_series(quo(base_ring(K_hom), K_hom)[1])[1]
J = homogenization(I, "w")
H2 = homogenizer(R, "w")
J = H2(I)
weights = ones(Int, ngens(base_ring(J)))
target_ordering = _extend_mon_order(ordering, base_ring(J))
end
Expand All @@ -191,7 +194,8 @@ function standard_basis(I::MPolyIdeal; ordering::MonomialOrdering = default_orde
if base_ring(I) == base_ring(J)
I.gb[ordering] = GB
else
GB_dehom_gens = [dehomogenization(p, base_ring(I), 1) for p in gens(GB)]
DH2 = dehomogenizer(H2)
GB_dehom_gens = DH2.(gens(GB))
I.gb[ordering] = IdealGens(GB_dehom_gens, ordering, isGB = true)
end
elseif algorithm == :f4
Expand Down
Loading

0 comments on commit 6d3e523

Please sign in to comment.