Skip to content

Commit

Permalink
Add a few more ZZIdl methods (#1409)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Feb 20, 2024
1 parent c336a38 commit 57ed2c2
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AlgAss/AbsAlgAss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ end
@doc raw"""
radical(A::AbstractAssociativeAlgebra) -> AbsAlgAssIdl
Returns the Jacobson-Radical of $A$.
Returns the Jacobson radical of $A$.
"""
function radical(A::AbstractAssociativeAlgebra{T}) where { T } #<: Union{ fpFieldElem, EuclideanRingResidueFieldElem{ZZRingElem}, fqPolyRepFieldElem, FqPolyRepFieldElem, QQFieldElem, AbsSimpleNumFieldElem } }
return ideal_from_gens(A, _radical(A), :twosided)
Expand Down
15 changes: 14 additions & 1 deletion src/NumField/QQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ end

*(x::ZZIdl, y::ZZIdl) = ZZIdl(x.gen * y.gen)

intersect(x::ZZIdl, y::ZZIdl) = ZZIdl(lcm(x.gen, y.gen))
function intersect(x::ZZIdl, y::ZZIdl...)
g = gen(x)
for I in y
g = lcm(g, gen(I))
end
return ZZIdl(g)
end

lcm(x::ZZIdl, y::ZZIdl) = intersect(x, y)

Expand All @@ -152,6 +158,13 @@ isone(I::ZZIdl) = isone(I.gen)
iszero(I::ZZIdl) = iszero(gen(I))
is_maximal(I::ZZIdl) = is_prime(gen(I))
is_prime(I::ZZIdl) = is_zero(I) || is_maximal(I)
is_primary(I::ZZIdl) = is_zero(I) || is_prime_power_with_data(gen(I))[1]

is_subset(I::ZZIdl, J::ZZIdl) = is_divisible_by(gen(J), gen(I))

radical(I::ZZIdl) = iszero(I) ? I : ideal(ZZ, radical(gen(I)))
primary_decomposition(I::ZZIdl) = iszero(I) ? [ (I,I) ] :
[ (ideal(ZZ, p^k), ideal(ZZ, p)) for (p,k) in factor(gen(I)) ]

maximal_order(::QQField) = ZZ

Expand Down
35 changes: 35 additions & 0 deletions test/NumField/QQ.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
function check_primary_decomposition(J::Any)
@testset "Testing primary decomposition for $J" begin
d = primary_decomposition(J)
@test all(is_primary(Q) for (Q,P) in d)
@test all(is_prime(P) for (Q,P) in d)
@test all(is_subset(P,Q) for (Q,P) in d)
if isempty(d)
@test isone(J)
@test J == radical(J)
else
@test intersect([Q for (Q,P) in d]...) == J
@test prod([P for (Q,P) in d]) == radical(J)
end
end
end

@testset "NumField/QQ" begin
@test Hecke.ideal_type(ZZ) == Hecke.ZZIdl
@test Hecke.ideal_type(Hecke.ZZRing) == Hecke.ZZIdl
Expand All @@ -19,6 +35,8 @@
@test !is_one(I)
@test is_maximal(I)
@test is_prime(I)
@test is_primary(I)
check_primary_decomposition(I)

J = 4*ZZ

Expand All @@ -31,18 +49,35 @@
@test !is_one(J)
@test !is_maximal(J)
@test !is_prime(J)
@test is_primary(J)
check_primary_decomposition(J)

J = 0*ZZ
@test is_zero(J)
@test !is_one(J)
@test !is_maximal(J)
@test is_prime(J)
@test is_primary(J)
check_primary_decomposition(J)

J = 1*ZZ
@test !is_zero(J)
@test is_one(J)
@test !is_maximal(J)
@test !is_prime(J)
@test !is_primary(J)
check_primary_decomposition(J)

J = 36*ZZ
@test !is_zero(J)
@test !is_one(J)
@test !is_maximal(J)
@test !is_prime(J)
@test !is_primary(J)
@test radical(J) == 6*ZZ
check_primary_decomposition(J)

check_primary_decomposition((2*3*5)^2*ZZ)

I = QQ(1, 2)*ZZ
@test I == ZZ * QQ(1, 2)
Expand Down

0 comments on commit 57ed2c2

Please sign in to comment.