Skip to content

Commit

Permalink
Test algebraic independence (#2804)
Browse files Browse the repository at this point in the history
* Test algebraic Independence
  • Loading branch information
wdecker authored Sep 15, 2023
1 parent 6ed4e08 commit d0e775e
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/src/CommutativeAlgebra/affine_algebras.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ true
inverse(F::AffAlgHom)
```

## Algebraic Independence

```@docs
are_algebraically_independent(V::Vector{T}) where T <: Union{MPolyRingElem, MPolyQuoRingElem}
```

## Subalgebras

### Subalgebra Membership
Expand Down
44 changes: 44 additions & 0 deletions src/Rings/mpoly-affine-algebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,50 @@ function _subalgebra_membership_homogeneous(f::PolyRingElemT, v::Vector{PolyRing
end
end

################################################################################
#
# Algebraic Independence
#
################################################################################

@doc raw"""
are_algebraically_independent(V::Vector{T}) where T <: Union{MPolyRingElem, MPolyQuoRingElem}
Given a vector `V` of elements of a multivariate polynomial ring over a field `K`, say, or of a quotient of such a ring,
return `(true, ideal(0))` if the elements of `V` are algebraically independent over `K`. Return, `false`
together with the ideal of `K`-algebra relations, otherwise.
# Examples
```jldoctest
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> V = [x, y, x^2+y^3]
3-element Vector{QQMPolyRingElem}:
x
y
x^2 + y^3
julia> are_algebraically_independent(V)
(false, ideal(t1^2 + t2^3 - t3))
julia> A, p = quo(R, [x*y]);
julia> are_algebraically_independent([p(x), p(y)])
(false, ideal(t1*t2))
```
"""
function are_algebraically_independent(V::Vector{T}) where T <: Union{MPolyRingElem, MPolyQuoRingElem}
@req !isempty(V) "Input vector must not be empty"
R = parent(V[1])
@req coefficient_ring(R) isa Field "The coefficient ring must be a field"
@req all(x -> parent(x) === R, V) "The elements must have the same parent"
S, _ = polynomial_ring(coefficient_ring(R), length(V), "t"; cached = false)
phi = hom(S, R, V)
I = kernel(phi)
return iszero(I), I
end

################################################################################
#
# Minimalizing a set of subalgebra generators in graded case
Expand Down
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export anticanonical_divisor
export anticanonical_divisor_class
export approximate_class_fusion
export archimedean_solid
export are_algebraically_independent
export as_dictionary
export as_gset
export as_perm_group
Expand Down
8 changes: 8 additions & 0 deletions test/Rings/mpoly_affine_algebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,11 @@ end
@test V[i] == rels[i](V2...)
end
end

@testset "are_algebraically_independent" begin
R, (x, y) = polynomial_ring(QQ, ["x", "y"])
V = [x, y]
fl, I = are_algebraically_independent(V)
@test fl
@test is_zero(I)
end

0 comments on commit d0e775e

Please sign in to comment.