From ddf1e30cc9f1be8a308c6db9c5a2674ae95823ea Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Thu, 14 Nov 2024 21:50:13 +0100 Subject: [PATCH 1/4] fix: don't use polynomial rings over zero rings --- src/Misc/nmod_poly.jl | 3 +++ src/NumFieldOrd/NfOrd/Ideal/Ideal.jl | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Misc/nmod_poly.jl b/src/Misc/nmod_poly.jl index 510d979da6..5e3d9ad6e2 100644 --- a/src/Misc/nmod_poly.jl +++ b/src/Misc/nmod_poly.jl @@ -199,6 +199,9 @@ function resultant_ideal_pp(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: R s = gcd(lift(res), pn) if !isone(s) new_pn = divexact(pn, s) + if is_one(new_pn) + return zero(R) + end R1 = residue_ring(ZZ, S(new_pn), cached = false)[1] R1t = polynomial_ring(R1, "y", cached = false)[1] f2 = R1t(T[R1(lift(coeff(f, i))) for i = 0:degree(f)]) diff --git a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl index 2399da4d0d..f71b4adcb7 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl @@ -1053,6 +1053,9 @@ function _minmod_easy(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) end function _minmod_easy_pp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) + if isone(a) + return one(a) + end Zk = parent(b) k = number_field(Zk) if fits(Int, a) From 15be127071ceb6a462fbf65105f91482cf9eb351 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Thu, 14 Nov 2024 23:01:25 +0100 Subject: [PATCH 2/4] more --- src/FunField/HessQR.jl | 2 ++ src/NumField/NfAbs/Elem.jl | 2 ++ src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl | 1 + 3 files changed, 5 insertions(+) diff --git a/src/FunField/HessQR.jl b/src/FunField/HessQR.jl index b5a0d86eca..b5d7d6e3ba 100644 --- a/src/FunField/HessQR.jl +++ b/src/FunField/HessQR.jl @@ -111,6 +111,8 @@ function expressify(a::HessQRElem; context = nothing) expressify(a.g, context = context))) end +Hecke.characteristic(::HessQR) = 0 + function Hecke.integral_split(a::Generic.RationalFunctionFieldElem{QQFieldElem}, S::HessQR) if iszero(a) return zero(S), one(S) diff --git a/src/NumField/NfAbs/Elem.jl b/src/NumField/NfAbs/Elem.jl index 89ff2c5fc2..8fa2d76df0 100644 --- a/src/NumField/NfAbs/Elem.jl +++ b/src/NumField/NfAbs/Elem.jl @@ -157,6 +157,8 @@ end #In this version, n is supposed to be a prime power function is_norm_divisible_pp(a::AbsSimpleNumFieldElem, n::ZZRingElem) + Main.a = a + Main.n = n K = parent(a) if !is_coprime(denominator(K.pol), n) na = norm(a) diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl index 222cfefdd6..bc73eafcd0 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl @@ -741,6 +741,7 @@ function _decomposition(O::AbsNumFieldOrder, I::AbsNumFieldOrderIdeal, Ip::AbsNu Ba = basis(P, copy = false) for i in 1:degree(O) if !is_norm_divisible_pp((v*Ba[i] + u).elem_in_nf, modulo) + @assert !is_zero(mod(ZZ(norm((v*Ba[i] + u).elem_in_nf)), modulo)) u = v*Ba[i] + u break end From 3a411985747599c753f897ed2f24c495e0110620 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Fri, 15 Nov 2024 19:51:47 +0100 Subject: [PATCH 3/4] more --- src/NumField/NfAbs/Elem.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/NumField/NfAbs/Elem.jl b/src/NumField/NfAbs/Elem.jl index 8fa2d76df0..89ff2c5fc2 100644 --- a/src/NumField/NfAbs/Elem.jl +++ b/src/NumField/NfAbs/Elem.jl @@ -157,8 +157,6 @@ end #In this version, n is supposed to be a prime power function is_norm_divisible_pp(a::AbsSimpleNumFieldElem, n::ZZRingElem) - Main.a = a - Main.n = n K = parent(a) if !is_coprime(denominator(K.pol), n) na = norm(a) From 4eb68b8614d038d5aea73d6b3d8bef9b59d40356 Mon Sep 17 00:00:00 2001 From: Tommy Hofmann Date: Fri, 15 Nov 2024 21:28:42 +0100 Subject: [PATCH 4/4] more --- src/NumFieldOrd/NfOrd/Ideal/Ideal.jl | 4 +++- src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl index f71b4adcb7..66cf12b241 100644 --- a/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl +++ b/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl @@ -1033,6 +1033,9 @@ function _minmod(a::ZZRingElem, b::AbsNumFieldOrderElem) end function _minmod_easy(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) + if is_one(a) + return a + end Zk = parent(b) k = number_field(Zk) if fits(Int, a) @@ -1150,7 +1153,6 @@ end function _minmod_comp(a::ZZRingElem, b::AbsSimpleNumFieldOrderElem) - Zk = parent(b) k = number_field(Zk) acom, auncom = ppio(a, index(Zk)) diff --git a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl index bc73eafcd0..222cfefdd6 100644 --- a/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl +++ b/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl @@ -741,7 +741,6 @@ function _decomposition(O::AbsNumFieldOrder, I::AbsNumFieldOrderIdeal, Ip::AbsNu Ba = basis(P, copy = false) for i in 1:degree(O) if !is_norm_divisible_pp((v*Ba[i] + u).elem_in_nf, modulo) - @assert !is_zero(mod(ZZ(norm((v*Ba[i] + u).elem_in_nf)), modulo)) u = v*Ba[i] + u break end