Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes Oscar#3841 #1543

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions src/NumFieldOrd/NfOrd/Ideal/Ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,32 @@
# Equality
#
################################################################################
#to be used in the ideal ===
#in case
# the ideals are known to be prime ideals
# with the same minimum
# in the easy case: nice equation order, nice prime
#Then the ideals are "mapped" in to GF(p)[x]/f and are equal iff they
#agree there, so
# map the 2nd gen (the first is p)
# check if they are coprime in the residue ring
#
#the _test should be able to ensure type-stability and the use of small
#p for speed.
function _test(p::Union{Int, ZZRingElem}, f::AbsSimpleNumFieldElem, g::AbsSimpleNumFieldElem, h::QQPolyRingElem)
#the GF(p) version should be faster, in partcular for small p
#however, there are functions missing, Rx(f) will fail for large p
# R = Native.GF(p, cached = false, check = false)
R = residue_ring(ZZ, p, cached = false)[1]
Rx = polynomial_ring(R, "x", cached = false)[1]
f1 = Rx(f)
f2 = Rx(g)
f = Rx(h)
#the problem was f1 and f2 included a unit mod f, thus the gcd was non-trivial
f1 = gcd(f, f1)
f2 = gcd(f, f2)
return !is_coprime(f1, f2)
end

function ==(x::AbsNumFieldOrderIdeal, y::AbsNumFieldOrderIdeal)
@assert order(x) === order(y)
Expand Down Expand Up @@ -820,11 +846,12 @@
end
OK = order(x)
if contains_equation_order(OK) && !is_index_divisor(OK, px) && has_2_elem(x) && has_2_elem(y)
R = residue_ring(FlintZZ, px, cached = false)[1]
Rx = polynomial_ring(R, "x", cached = false)[1]
f1 = Rx(elem_in_nf(x.gen_two))
f2 = Rx(elem_in_nf(y.gen_two))
return !is_coprime(f1, f2)
f = defining_polynomial(number_field(OK))
if px <= typemax(Int)
return _test(Int(px), elem_in_nf(x.gen_two), elem_in_nf(y.gen_two), f)
else
return _test(px, elem_in_nf(x.gen_two), elem_in_nf(y.gen_two), f)

Check warning on line 853 in src/NumFieldOrd/NfOrd/Ideal/Ideal.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/Ideal/Ideal.jl#L853

Added line #L853 was not covered by tests
end
end
end
if isdefined(x, :basis_matrix) && has_2_elem(y)
Expand Down
15 changes: 15 additions & 0 deletions test/NumFieldOrd/NumFieldOrd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,18 @@ end
@test_throws ErrorException Order(K, [x])
end


@testset "Order - Misc" begin
k, a = cyclotomic_field(11)
zk = maximal_order(k)
lp = prime_ideals_over(zk, 23)
p1 = lp[1]
p2 = lp[2]
p1.gen_two *= zk(a+1)
p2.gen_two *= zk(a+1)

@test p1 != p2
end



Loading