Skip to content

Commit

Permalink
Merge pull request #586 from tthsqe12/better_quotient_rings
Browse files Browse the repository at this point in the history
add quotient_ideal
  • Loading branch information
tthsqe12 committed Jul 15, 2022
2 parents 138eeb1 + a7c11fd commit 9c286d3
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ makedocs(
"polynomial.md",
"noncommutative.md",
"ideal.md",
"qring.md",
"Modules" => [
"module.md",
"vector.md"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/ideal.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ iszero(::sideal)
```

```@docs
is_zerodim(::sideal)
is_zerodim(I::sideal)
```

```@docs
Expand Down
4 changes: 0 additions & 4 deletions docs/src/polynomial.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,6 @@ has_local_ordering(R::PolyRing)
degree_bound(R::PolyRing)
```

```@docs
leading_exponent_vector(p::spoly)
```

```@docs
total_degree(p::spoly)
```
Expand Down
39 changes: 39 additions & 0 deletions docs/src/qring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
```@meta
CurrentModule = Singular
```

# Quotient Rings

Quotient rings $Q = R/I$ in Singular.jl are constructed with the constructor
`QuotientRing(R, I)`. The input ideal $I$ to the constructor must be a Groebner
basis. The $R$-ideal $I$ may be recovered as `quotient_ideal(Q)`.

```@docs
is_quotient_ring(R::PolyRingUnion)
quotient_ideal(Q::PolyRing{T}) where T <: Nemo.RingElem
```

**Examples**

```julia
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"]);

julia> is_quotient_ring(R)
false

julia> Q1, (x, y) = QuotientRing(R, Ideal(R, x^2+y^2));

julia> is_quotient_ring(Q1)
true

julia> quotient_ideal(Q1)
Singular ideal over Singular Polynomial Ring (QQ),(x,y),(dp(2),C) with generators (x^2 + y^2)

julia> Q2, (x, y) = QuotientRing(Q1, std(Ideal(Q1, x*y)));

julia> quotient_ideal(Q2)
Singular ideal over Singular Polynomial Ring (QQ),(x,y),(dp(2),C) with generators (x*y, y^3, x^2 + y^2)

julia> base_ring(quotient_ideal(Q1)) == base_ring(quotient_ideal(Q2))
true
```
1 change: 0 additions & 1 deletion src/ideal/ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ end
Return `true` if the given ideal is zero dimensional, i.e. the Krull dimension of
$R/I$ is zero, where $R$ is the polynomial ring over which $I$ is an ideal..
"""

function is_zerodim(I::sideal)
I.isGB || error("Not a Groebner basis")
R = base_ring(I)
Expand Down
18 changes: 16 additions & 2 deletions src/ideal/quotient.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export is_quotient_ring, QuotientRing
export is_quotient_ring, QuotientRing, quotient_ideal

@doc Markdown.doc"""
is_quotient_ring(R::PolyRing)
is_quotient_ring(R::PolyRingUnion)
Return `true` if the given ring is the quotient of a polynomial ring with
a non - zero ideal.
Expand All @@ -10,6 +10,20 @@ function is_quotient_ring(R::PolyRingUnion)
GC.@preserve R return Bool(Singular.libSingular.rIsQuotientRing(R.ptr))
end

@doc Markdown.doc"""
quotient_ideal(Q::PolyRing{T}) where T <: Nemo.RingElem
Return `I` for a given quotient ring `Q = R/I`.
"""
function quotient_ideal(Q::PolyRing{T}) where T <: Nemo.RingElem
is_quotient_ring(Q) || ArgumentError("input ring is not a quotient ring")
R = PolyRing{T}(base_ring(Q), symbols(Q), ordering(Q), true, degree_bound(Q))
GC.@preserve Q begin
iptr = libSingular.r_get_qideal(Q.ptr)
return sideal{spoly{T}}(R, libSingular.id_Copy(iptr, R.ptr), true)
end
end

###############################################################################
#
# Quotient ring construction
Expand Down
1 change: 1 addition & 0 deletions test/ideal/quotient-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Q, (x, y, z) = @inferred QuotientRing(R, Ideal(R, x^2 - y*z))

@test is_quotient_ring(Q)
@test isequal(quotient_ideal(Q), Ideal(R, x^2 - y*z))

I = Ideal(Q, x)
@test !I.isGB
Expand Down

0 comments on commit 9c286d3

Please sign in to comment.