From fd5321e7e01d772aff4fd5b70c63fc4a9adbb3b7 Mon Sep 17 00:00:00 2001 From: Rafael Mohr Date: Fri, 4 Oct 2024 14:14:55 +0200 Subject: [PATCH] adds test for decomposition --- src/siggb/affine_cells.jl | 20 ++++++++------------ test/algorithms/decomposition.jl | 19 +++++++++++++++++++ test/runtests.jl | 1 + 3 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 test/algorithms/decomposition.jl diff --git a/src/siggb/affine_cells.jl b/src/siggb/affine_cells.jl index ec08791..e6b8fa8 100644 --- a/src/siggb/affine_cells.jl +++ b/src/siggb/affine_cells.jl @@ -288,17 +288,13 @@ function variety_string_rep(F::Vector{<:MPolyRingElem}; return string_rep end -# for debugging -function check_decomp(F::Vector{P}, Xs::Vector{<:LocClosedSet}) where {P <: MPolyRingElem} - println("checking decomp") - gb_ch = F - for X in Xs - for gb in X.gbs - g = random_lin_comb(gb) - gb_ch = saturate(gb_ch, g) - end +# check if idls provides ideal-theoretic decomposition of radical of I +function _check_decomp(I::IDL, idls::Vector{IDL}) where {IDL <: Ideal} + gb_ch = I.gens + for idl in idls + g = random_lin_comb(idl.gens) + gb_ch = saturate(gb_ch, g) end - R = parent(first(F)) - gb_ch = saturate(gb_ch, last(gens(R))) - return one(parent(first(F))) in gb_ch + R = parent(I) + return one(R) in gb_ch end diff --git a/test/algorithms/decomposition.jl b/test/algorithms/decomposition.jl new file mode 100644 index 0000000..e8b7981 --- /dev/null +++ b/test/algorithms/decomposition.jl @@ -0,0 +1,19 @@ +@testset "Algorithms -> Equidimensional Decomposition" begin + P, (x, y, z) = polynomial_ring(GF(2020853), ["x", "y", "z"], internal_ordering = :degrevlex) + F = [73960*x^3+46428*x^2*y-320426*x^2*z-88867*x*y^2-163934*x*y*z-184389*x*z^2-62940*y^3+356381*y^2*z+32282*y*z^2-27183*z^3-210018*x^2+721747*x*y+416981*x*z+146898*y^2+118097*y*z+116973*z^2-111106*x-377082*y-153504*z+56580, + 3038*x^2*y-3686*x^2*z+2288*x*y^2-16544*x*y*z-3344*x*z^2+315*y^3+4111*y^2*z+157*y*z^2-663*z^3-27166*x*y+4168*x*z-2769*y^2+13942*y*z+1527*z^2+25806*y-690*z, + 650*x^2*y+3350*x^2*z+195*x*y^2-8450*x*y*z+845*x*z^2-260*y^3-3410*y^2*z-390*y*z^2+13390*x*y-1630*x*z-276*y^2+8372*y*z-15088*y, + -225*x^2*y+1685*x^2*z-705*x*y^2-450*x*y*z+345*x*z^2-420*y^3+1325*y^2*z+645*y*z^2+8056*x*y-705*x*z+918*y^2+1527*y*z-5658*y] + I = Ideal(F) + dec = equidimensional_decomposition(I) + @test AlgebraicSolving._check_decomp(I, dec) + + P, (x1, x2, x3, x4) = polynomial_ring(GF(1059823), ["x1", "x2", "x3", "x4"], internal_ordering = :degrevlex); + F = [2297232*x1^4+10816588*x1^3*x2-19696652*x1^3*x3+12014836*x1^3*x4+19038581*x1^2*x2^2+25140479*x1^2*x2*x3-124056256*x1^2*x2*x4-19352961*x1^2*x3^2+30086207*x1^2*x3*x4-15861565*x1^2*x4^2-64545276*x1*x2^3-3395230*x1*x2^2*x3+125153935*x1*x2^2*x4-10319588*x1*x2*x3^2+5839912*x1*x2*x3*x4+112915639*x1*x2*x4^2+12114032*x1*x3^3+32314614*x1*x3^2*x4-5646418*x1*x3*x4^2-3823868*x1*x4^3+40572828*x2^4-42051502*x2^3*x3-17361686*x2^3*x4+66618627*x2^2*x3^2-61020343*x2^2*x3*x4-66491064*x2^2*x4^2+16298428*x2*x3^3+46623254*x2*x3^2*x4-26720875*x2*x3*x4^2-16047619*x2*x4^3+15073900*x3^4+9644976*x3^3*x4-9790086*x3^2*x4^2-9372130*x3*x4^3+4661500*x4^4-39813328*x1^3-9400295*x1^2*x2-1289811*x1^2*x3+64756487*x1^2*x4-41226416*x1*x2^2+22255617*x1*x2*x3+115474646*x1*x2*x4+54583668*x1*x3^2+150465505*x1*x3*x4-19224417*x1*x4^2+52554279*x2^3-1318549*x2^2*x3-91874169*x2^2*x4+119183502*x2*x3^2-131012023*x2*x3*x4-88321124*x2*x4^2+41605616*x3^3+58052114*x3^2*x4-70772721*x3*x4^2+3123219*x4^3+99968607*x1^2-17533608*x1*x2+133696391*x1*x3-71771275*x1*x4+20484256*x2^2+10206682*x2*x3-58141098*x2*x4+72704712*x3^2-111938286*x3*x4-5946966*x4^2-46338000*x1+12230767*x2-23665371*x3+7665457*x4+9313394, + 10816588*x1^3+38077162*x1^2*x2+25140479*x1^2*x3-124056256*x1^2*x4-193635828*x1*x2^2-6790460*x1*x2*x3+250307870*x1*x2*x4-10319588*x1*x3^2+5839912*x1*x3*x4+112915639*x1*x4^2+162291312*x2^3-126154506*x2^2*x3-52085058*x2^2*x4+133237254*x2*x3^2-122040686*x2*x3*x4-132982128*x2*x4^2+16298428*x3^3+46623254*x3^2*x4-26720875*x3*x4^2-16047619*x4^3-9400295*x1^2-82452832*x1*x2+22255617*x1*x3+115474646*x1*x4+157662837*x2^2-2637098*x2*x3-183748338*x2*x4+119183502*x3^2-131012023*x3*x4-88321124*x4^2-17533608*x1+40968512*x2+10206682*x3-58141098*x4+12230767, + -19696652*x1^3+25140479*x1^2*x2-38705922*x1^2*x3+30086207*x1^2*x4-3395230*x1*x2^2-20639176*x1*x2*x3+5839912*x1*x2*x4+36342096*x1*x3^2+64629228*x1*x3*x4-5646418*x1*x4^2-42051502*x2^3+133237254*x2^2*x3-61020343*x2^2*x4+48895284*x2*x3^2+93246508*x2*x3*x4-26720875*x2*x4^2+60295600*x3^3+28934928*x3^2*x4-19580172*x3*x4^2-9372130*x4^3-1289811*x1^2+22255617*x1*x2+109167336*x1*x3+150465505*x1*x4-1318549*x2^2+238367004*x2*x3-131012023*x2*x4+124816848*x3^2+116104228*x3*x4-70772721*x4^2+133696391*x1+10206682*x2+145409424*x3-111938286*x4-23665371, + 12014836*x1^3-124056256*x1^2*x2+30086207*x1^2*x3-31723130*x1^2*x4+125153935*x1*x2^2+5839912*x1*x2*x3+225831278*x1*x2*x4+32314614*x1*x3^2-11292836*x1*x3*x4-11471604*x1*x4^2-17361686*x2^3-61020343*x2^2*x3-132982128*x2^2*x4+46623254*x2*x3^2-53441750*x2*x3*x4-48142857*x2*x4^2+9644976*x3^3-19580172*x3^2*x4-28116390*x3*x4^2+18646000*x4^3+64756487*x1^2+115474646*x1*x2+150465505*x1*x3-38448834*x1*x4-91874169*x2^2-131012023*x2*x3-176642248*x2*x4+58052114*x3^2-141545442*x3*x4+9369657*x4^2-71771275*x1-58141098*x2-111938286*x3-11893932*x4+7665457]; + I = Ideal(F) + dec = equidimensional_decomposition(I) + @test AlgebraicSolving._check_decomp(I, dec) +end diff --git a/test/runtests.jl b/test/runtests.jl index 184f88f..8da5e27 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,5 +7,6 @@ include("algorithms/groebner-bases.jl") include("algorithms/normal-forms.jl") include("algorithms/solvers.jl") include("algorithms/dimension.jl") +include("algorithms/decomposition.jl") include("examples/katsura.jl") end