Skip to content

Commit

Permalink
Extend is_invertible_with_inverse to rings of type `MPolyQuoRing{<:…
Browse files Browse the repository at this point in the history
…MPolyDecRingElem}` (oscar-system#4226)

* Extend `is_invertible_with_inverse` to rings of type `MPolyQuoRing{<:MPolyDecRingElem}`

* correction

* Adressing remark by @joschmitt

* correction

* add extended function to docu

* correction
  • Loading branch information
wdecker authored and HechtiDerLachs committed Oct 30, 2024
1 parent 3440748 commit af7cc4c
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/src/CommutativeAlgebra/affine_algebras.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ simplify(f::MPolyQuoRingElem)
==(f::MPolyQuoRingElem{T}, g::MPolyQuoRingElem{T}) where T
```

```@docs
is_invertible_with_inverse(f::MPolyQuoRingElem)
```

In the graded case, we additionally have:

```@docs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ top_chern_class(F::AbstractBundle)
```

```@docs
segre_class(F::AbstractBundle)
total_segre_class(F::AbstractBundle)
```

```@docs
Expand Down
2 changes: 2 additions & 0 deletions experimental/IntersectionTheory/src/IntersectionTheory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export pushforward
export schubert_class
export schubert_classes
export schur_functor
export total_segre_class
export segre_class
export structure_map
export tangent_bundle
Expand Down Expand Up @@ -134,6 +135,7 @@ export pushforward
export schubert_class
export schubert_classes
export schur_functor
export total_segre_class
export segre_class
export structure_map
export tangent_bundle
Expand Down
33 changes: 29 additions & 4 deletions experimental/IntersectionTheory/src/Main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ AbstractBundle of rank 2 on AbstractVariety of dim 6
julia> total_chern_class(Q)
c[1]^2 - c[1] - c[2] + 1
julia> chern_class(Q, 1)
-c[1]
julia> chern_class(Q, 2)
c[1]^2 - c[2]
```
"""
total_chern_class(F::AbstractBundle) = (
Expand Down Expand Up @@ -161,18 +167,37 @@ julia> top_chern_class(F)
top_chern_class(F::AbstractBundle) = chern_class(F, F.rank)

@doc raw"""
segre_class(F::AbstractBundle)
total_segre_class(F::AbstractBundle)
Return the total Segre class of `F`.
# Examples
```jldoctest
julia> G = abstract_grassmannian(3,5)
AbstractVariety of dim 6
julia> Q = tautological_bundles(G)[2]
AbstractBundle of rank 2 on AbstractVariety of dim 6
julia> C = total_chern_class(Q)
c[1]^2 - c[1] - c[2] + 1
julia> S = total_segre_class(Q)
c[1] + c[2] + c[3] + 1
julia> C*S
1
```
"""
segre_class(F::AbstractBundle) = inv(total_chern_class(F))
total_segre_class(F::AbstractBundle) = inv(total_chern_class(F))

@doc raw"""
segre_class(F::AbstractBundle, k::Int)
Retuen the `k`-th Segre class of `F`.
Return the `k`-th Segre class of `F`.
"""
segre_class(F::AbstractBundle, k::Int) = segre_class(F)[k]
segre_class(F::AbstractBundle, k::Int) = total_segre_class(F)[k]

@doc raw"""
todd_class(F::AbstractBundle)
Expand Down
54 changes: 54 additions & 0 deletions src/Rings/MPolyQuo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,33 @@ end

one(Q::MPolyQuoRing) = Q(1)

@doc raw"""
is_invertible_with_inverse(f::MPolyQuoRingElem)
If `f` is invertible with inverse `g`, say, return `(true, g)`. Otherwise, return `(false, f)`.
# Examples
```jldoctest
julia> R, c = polynomial_ring(QQ, :c => (1:3));
julia> R, c = grade(R, [1, 2, 3]);
julia> I = ideal(R, [ -c[1]^3 + 2*c[1]*c[2] - c[3], c[1]^4 - 3*c[1]^2*c[2] + 2*c[1]*c[3] + c[2]^2,-c[1]^5 + 4*c[1]^3*c[2] - 3*c[1]^2*c[3] - 3*c[1]*c[2]^2 + 2*c[2]*c[3]]);
julia> A, _ = quo(R, I);
julia> f = A(c[1]^2 - c[1] - c[2] + 1)
c[1]^2 - c[1] - c[2] + 1
julia> tt, g = is_invertible_with_inverse(f)
(true, c[1] + c[2] + c[3] + 1)
julia> f*g
1
```
"""
function is_invertible_with_inverse(a::MPolyQuoRingElem)
# TODO:
# Eventually, the code below should be replaced
Expand All @@ -1111,6 +1138,11 @@ function is_invertible_with_inverse(a::MPolyQuoRingElem)
Q = parent(a)
J = oscar_groebner_basis(Q)
J = vcat(J, [a.f])

if Q isa MPolyQuoRing{<:MPolyDecRingElem}
J = [x.f for x in J]
end

j, T = standard_basis_with_transformation_matrix(ideal(J))
if is_constant(j[1]) && is_unit(first(coefficients(j[1])))
@assert ncols(T) == 1
Expand All @@ -1121,6 +1153,28 @@ end

is_unit(a::MPolyQuoRingElem) = is_invertible_with_inverse(a)[1]

@doc raw"""
inv(f::MPolyQuoRingElem)
If `f` is invertible, return its inverse. Otherwise, throw an error.
# Examples
```jldoctest
julia> R, c = polynomial_ring(QQ, :c => (1:3));
julia> I = ideal(R, [ -c[1]^3 + 2*c[1]*c[2] - c[3], c[1]^4 - 3*c[1]^2*c[2] + 2*c[1]*c[3] + c[2]^2,-c[1]^5 + 4*c[1]^3*c[2] - 3*c[1]^2*c[3] - 3*c[1]*c[2]^2 + 2*c[2]*c[3]]);
julia> A, _ = quo(R, I);
julia> f = A(c[1]^2 - c[1] - c[2] + 1)
c[1]^2 - c[1] - c[2] + 1
julia> inv(f)
c[1] + c[2] + c[3] + 1
```
"""
function inv(a::MPolyQuoRingElem)
fl, b = is_invertible_with_inverse(a)
fl || error("Element not invertible")
Expand Down

0 comments on commit af7cc4c

Please sign in to comment.