diff --git a/src/QuadForm/Herm/Lattices.jl b/src/QuadForm/Herm/Lattices.jl index 1d34b1ba52..da7ce1a94c 100644 --- a/src/QuadForm/Herm/Lattices.jl +++ b/src/QuadForm/Herm/Lattices.jl @@ -680,12 +680,13 @@ function _maximal_integral_lattice(L::HermLat, p, minimal = true) end function is_maximal_integral(L::HermLat, p) + @req order(p) == fixed_ring(L) "The ideal does not belong to the fixed ring of the lattice" valuation(norm(L), p) < 0 && return false, L return _maximal_integral_lattice(L, p, true) end function is_maximal_integral(L::HermLat) - !is_integral(norm(L)) && error("The lattice is not integral") + !is_integral(norm(L)) && return false, L S = base_ring(L) f = factor(discriminant(S)) ff = factor(norm(volume(L))) @@ -703,6 +704,8 @@ function is_maximal_integral(L::HermLat) end function is_maximal(L::HermLat, p) + @req order(p) == fixed_ring(L) "The ideal does not belong to the fixed ring of the lattice" + @req valuation(norm(L), p) >= 0 "The norm of the lattice is not locally integral" #iszero(L) && error("The lattice must be non-zero") v = valuation(norm(L), p) x = elem_in_nf(p_uniformizer(p))^(-v) @@ -715,7 +718,7 @@ function is_maximal(L::HermLat, p) end function maximal_integral_lattice(L::HermLat) - !is_integral(norm(L)) && error("The lattice is not integral") + @req is_integral(norm(L)) "The norm of the lattice is not integral" S = base_ring(L) f = factor(discriminant(S)) ff = factor(norm(volume(L))) @@ -730,7 +733,8 @@ function maximal_integral_lattice(L::HermLat) end function maximal_integral_lattice(L::HermLat, p) - valuation(norm(L), p) < 0 && error("Lattice is not locally integral") + @req order(p) == fixed_ring(L) "The ideal does not belong to the fixed ring of the lattice" + @req valuation(norm(L), p) >= 0 "The norm of the lattice is not locally integral" _, L = _maximal_integral_lattice(L, p, false) return L end diff --git a/src/QuadForm/Lattices.jl b/src/QuadForm/Lattices.jl index e8c00bf291..703e86d8ec 100644 --- a/src/QuadForm/Lattices.jl +++ b/src/QuadForm/Lattices.jl @@ -1989,17 +1989,25 @@ end is_maximal_integral(L::AbstractLat, p::NfOrdIdl) -> Bool, AbstractLat Given a lattice `L` and a prime ideal `p` of the fixed ring $\mathcal O_K$ of -`L`, return whether the completion of `L` at `p` is maximal integral. If it is -not the case, the second returned value is a lattice in the ambient space of `L` -whose completion at `p` is a minimal overlattice of $L_p$. +`L`, return whether the completion of `L` at `p` has integral norm and that `L` has no +proper overlattice satisfying this property. + +If the norm of `L` is not integral at `p`, the second output is `L` by default. +Otherwise, either `L` is maximal at `p` and the second output is `L`, or the +second output is a lattice `M` in the ambient space of `L` whose completion +at `p` is a minimal overlattice of $L_p$ with integral norm. """ is_maximal_integral(::AbstractLat, p) @doc raw""" is_maximal_integral(L::AbstractLat) -> Bool, AbstractLat -Given a lattice `L`, return whether `L` is maximal integral. If it is not, -the second returned value is a minimal overlattice of `L` with integral norm. +Given a lattice `L`, return whether `L` has integral norm and has no proper +overlattice satisfying this property. + +If the norm of `L` is not integral, the second output is `L` by default. +Otherwise, either `L` is maximal and the second output is `L`, or the second +output is a minimal overlattice `M` of `L` with integral norm. """ is_maximal_integral(::AbstractLat) @@ -2007,10 +2015,12 @@ is_maximal_integral(::AbstractLat) is_maximal(L::AbstractLat, p::NfOrdIdl) -> Bool, AbstractLat Given a lattice `L` and a prime ideal `p` in the fixed ring $\mathcal O_K$ of -`L`, check whether the norm of $L_p$ is integral and return whether `L` is maximal -at `p`. If it is locally integral but not locally maximal, the second returned value -is a lattice in the same ambient space of `L` whose completion at `p` has integral norm -and is a proper overlattice of $L_p$. +`L` such that the norm of $L_p$ is integral, return whether `L` is maximal +integral at `p`. + +If `L` is locally maximal at `p`, the second output is `L`, otherwise it is +a lattice `M` in the same ambient space of `L` whose completion at `p` has +integral norm and is a proper overlattice of $L_p$. """ is_maximal(::AbstractLat, p) @@ -2018,16 +2028,17 @@ is_maximal(::AbstractLat, p) maximal_integral_lattice(L::AbstractLat, p::NfOrdIdl) -> AbstractLat Given a lattice `L` and a prime ideal `p` of the fixed ring $\mathcal O_K$ of -`L`, return a lattice `M` in the ambient space of `L` which is maximal integral -at `p` and which agrees with `L` locally at all the places different from `p`. +`L` such that the norm of $L_p$ is integral, return a lattice `M` in the +ambient space of `L` which is maximal integral at `p` and which agrees +with `L` locally at all the places different from `p`. """ maximal_integral_lattice(::AbstractLat, p) @doc raw""" maximal_integral_lattice(L::AbstractLat) -> AbstractLat -Given a lattice `L`, return a lattice `M` in the ambient space of `L` which -is maximal integral and which contains `L`. +Given a lattice `L` with integral norm, return a maximal integral overlattice +`M` of `L`. """ maximal_integral_lattice(::AbstractLat) diff --git a/src/QuadForm/Quad/Lattices.jl b/src/QuadForm/Quad/Lattices.jl index 0ef68f1ec2..950a2a42c4 100644 --- a/src/QuadForm/Quad/Lattices.jl +++ b/src/QuadForm/Quad/Lattices.jl @@ -440,7 +440,7 @@ function guess_max_det(L::QuadLat, p) end function is_maximal_integral(L::QuadLat, p) - @req order(p) == base_ring(L) "Rings do not match" + @req order(p) == base_ring(L) "The ideal does not belong to the base ring of the lattice" #if iszero(L) # return true, L #end @@ -532,8 +532,8 @@ function is_maximal_integral(L::QuadLat) end function maximal_integral_lattice(L::QuadLat, p) - @req base_ring(L) == order(p) "Second argument must be an ideal of the base ring of L" - @req valuation(norm(L), p) >= 0 "The normal of the lattice must be locally integral" + @req base_ring(L) == order(p) "The ideal does not belong to the base ring of the lattice" + @req valuation(norm(L), p) >= 0 "The norm of the lattice is not locally integral" ok, LL = is_maximal_integral(L, p) while !ok @@ -544,7 +544,8 @@ function maximal_integral_lattice(L::QuadLat, p) end function is_maximal(L::QuadLat, p) - @req order(p) == base_ring(L) "Asdsads" + @req order(p) == base_ring(L) "The ideal does not belong to the base ring of the lattice" + @req valuation(norm(L), p) >= 0 "The norm of the lattice is not locally integral" #if iszero(L) # return true, L #end @@ -576,7 +577,7 @@ function maximal_integral_lattice(V::QuadSpace) end function maximal_integral_lattice(L::QuadLat) - @req is_integral(norm(L)) "Lattice must be integral" + @req is_integral(norm(L)) "The norm of the lattice is not integral" for p in bad_primes(L; even = true) L = maximal_integral_lattice(L, p) end diff --git a/src/QuadForm/Quad/ZLattices.jl b/src/QuadForm/Quad/ZLattices.jl index 2fb7bbd852..c5126f8556 100644 --- a/src/QuadForm/Quad/ZLattices.jl +++ b/src/QuadForm/Quad/ZLattices.jl @@ -1142,14 +1142,13 @@ function _maximal_integral_lattice(L::ZZLat) end @doc raw""" - maximal_even_lattice(L::ZZLat, p) -> ZZLat + maximal_even_lattice(L::ZZLat, p::IntegerUnion) -> ZZLat -Given an even lattice `L` and a prime number `p` return an overlattice of `M` -which is maximal at `p` and agrees locally with `L` at all other places. - -Recall that $L$ is called even if $\Phi(x,x) \in 2 \mathbb Z$ for all $x in L$. +Given an integer lattice `L` with integral scale and a prime number `p` such that +$L_p$ is even, return an overlattice `M` of `L` which is maximal even at `p` and +which agrees locally with `L` at all other places. """ -function maximal_even_lattice(L::ZZLat, p) +function maximal_even_lattice(L::ZZLat, p::IntegerUnion) while true ok, L = is_maximal_even(L, p) if ok @@ -1161,10 +1160,7 @@ end @doc raw""" maximal_even_lattice(L::ZZLat) -> ZZLat -Return a maximal even overlattice `M` of the even lattice `L`. - -Recall that $L$ is called even if $\Phi(x,x) \in 2 \mathbb Z$ for all $x in L$. -Note that the genus of `M` is uniquely determined by the genus of `L`. +Given an even integer lattice `L`, return a maximal even overlattice `M` of `L`. """ function maximal_even_lattice(L::ZZLat) @req iseven(L) "The lattice must be even" @@ -1175,7 +1171,7 @@ function maximal_even_lattice(L::ZZLat) end function maximal_integral_lattice(L::ZZLat) - @req denominator(norm(L)) == 1 "The quadratic form is not integral" + @req denominator(norm(L)) == 1 "The norm of the lattice is not integral" L2 = rescale(L, 2) LL2 = maximal_even_lattice(L2) return rescale(LL2, QQ(1//2)) @@ -1183,21 +1179,23 @@ end @doc raw""" - is_maximal_even(L::ZZLat, p) -> Bool, ZZLat + is_maximal_even(L::ZZLat, p::IntegerUnion) -> Bool, ZZLat -Return if the (`p`-locally) even lattice `L` is maximal at `p` and an even overlattice `M` -of `L` with $[M:L]=p$ if `L` is not maximal and $1$ else. +Given an integer lattice `L` with integral scale and a prime number `p`, +return whether $L_p$ is even and has no proper overlattice satisfying this +property. -Recall that $L$ is called even if $\Phi(x,x) \in 2 \mathbb{Z}$ for all $x in L$. +If $L_p$ is not even, the second output is `L` by default. Otherwise, either +`L` is maximal at `p` and the second output is `L`, or the second output is +an overlattice `M` of `L` such that $M_p$ is even and $[M:L] = p$. """ - -function is_maximal_even(L::ZZLat, p) +function is_maximal_even(L::ZZLat, p::IntegerUnion) @req denominator(scale(L)) == 1 "The bilinear form is not integral" - @req p != 2 || mod(ZZ(norm(L)),2) == 0 "The bilinear form is not even" + p != 2 || mod(ZZ(norm(L)), 2) == 0 || return false, L # o-maximal lattices are classified # see Kirschmer Lemma 3.5.3 - if valuation(det(L), p)<= 1 + if valuation(det(L), p) <= 1 return true, L end G = change_base_ring(ZZ, gram_matrix(L))