Skip to content

Commit

Permalink
experimentally: allow small hight lifts (#1506)
Browse files Browse the repository at this point in the history
* allow small hight lifts

Co-authored-by: Tommy Hofmann <[email protected]>
Co-authored-by: Simon Brandhorst <[email protected]>
  • Loading branch information
3 people authored May 20, 2024
1 parent 81046a2 commit 5e6c8c2
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 7 deletions.
56 changes: 49 additions & 7 deletions src/LocalField/Completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,40 @@ function image(f::CompletionMap, a::AbsSimpleNumFieldElem)
return z
end

function preimage(f::CompletionMap{LocalField{QadicFieldElem, EisensteinLocalField}, LocalFieldElem{QadicFieldElem, EisensteinLocalField}}, a::LocalFieldElem{QadicFieldElem, EisensteinLocalField})
function _small_lift(f::Map, a::AbsSimpleNumFieldElem, integral::Bool)
if !isdefined(f, :lift_data) || f.lift_data[1] != f.precision
l = lll(basis_matrix(f.P^f.precision))
f.lift_data = (f.precision, l, solve_init(map_entries(QQ, l)))
end
n = degree(domain(f))
zk = order(f.P)
@assert denominator(a, zk) == 1
cc = matrix(ZZ, 1, n, coordinates(zk(a)))
l = f.lift_data[2]
if integral
s = solve(f.lift_data[3], QQ.(cc))
r = round.(ZZRingElem, s)
cc -= r*l
return domain(f)(order(f.P)(cc))
end
m = [ identity_matrix(ZZ, 1) cc; zero_matrix(ZZ, n, 1) l ]
lll!(m)
return domain(f)(order(f.P)(view(m, 1:1, 2:n+1))//m[1,1])
end

function preimage(f::CompletionMap{LocalField{QadicFieldElem, EisensteinLocalField}, LocalFieldElem{QadicFieldElem, EisensteinLocalField}}, a::LocalFieldElem{QadicFieldElem, EisensteinLocalField}; small_lift::Bool = false, integral::Bool = false)
#Eisenstein/ qadic
Kp = codomain(f)
@assert Kp === parent(a)
Qq = base_field(Kp)
Qpx = parent(defining_polynomial(Qq))
coeffs = Vector{AbsSimpleNumFieldElem}()
#careful: we're working in a limited precision world and the lift
#can be waaaay to large
if !iszero(a) && abs(valuation(a)) > 100
if iszero(a)
return zero(domain(f))
end
if abs(valuation(a)) > 100
global last_a = a
error("elem too large")
end
Expand All @@ -40,21 +65,38 @@ function preimage(f::CompletionMap{LocalField{QadicFieldElem, EisensteinLocalFie
K = domain(f)
Kx = polynomial_ring(K, "x")[1]
r = Kx(coeffs)
return evaluate(r, f.inv_img[2])
s = evaluate(r, f.inv_img[2])
if small_lift
return _small_lift(f, s, integral)
else
return s
end
end

function preimage(f::CompletionMap{LocalField{PadicFieldElem, EisensteinLocalField}, LocalFieldElem{PadicFieldElem, EisensteinLocalField}}, a::LocalFieldElem{PadicFieldElem, EisensteinLocalField})
function preimage(f::CompletionMap{LocalField{PadicFieldElem, EisensteinLocalField}, LocalFieldElem{PadicFieldElem, EisensteinLocalField}}, a::LocalFieldElem{PadicFieldElem, EisensteinLocalField}; small_lift::Bool = false, integral::Bool = false)
#Eisenstein/ padic
@assert codomain(f) === parent(a)
return evaluate(map_coefficients(x -> lift(ZZ, x), a.data, cached = false), f.inv_img[2])
s = evaluate(map_coefficients(x -> lift(ZZ, x), a.data, cached = false), f.inv_img[2])
if small_lift
return _small_lift(f, s, integral)
else
return s
end
end

function preimage(f::CompletionMap{QadicField, QadicFieldElem}, a::QadicFieldElem)
function preimage(f::CompletionMap{QadicField, QadicFieldElem}, a::QadicFieldElem; small_lift::Bool = false, integral::Bool = false)
#qadic only
Kp = codomain(f)
@assert Kp == parent(a)
Qpx = parent(defining_polynomial(Kp))
as_pol = Qpx(a)
as_fmpq_poly = map_coefficients(x -> lift(ZZ, x), as_pol, cached = false)
return evaluate(as_fmpq_poly, f.inv_img[1])
r = evaluate(as_fmpq_poly, f.inv_img[1])
if small_lift
return _small_lift(f, r, integral)
else
return r
end
end

function prime(f::CompletionMap)
Expand Down
1 change: 1 addition & 0 deletions src/LocalField/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mutable struct CompletionMap{S, T} <: Map{AbsSimpleNumField, S, HeckeMap, Comple
prim_img::T
inv_img::Tuple{AbsSimpleNumFieldElem, AbsSimpleNumFieldElem}
precision::Int
lift_data::Tuple{Int, ZZMatrix, AbstractAlgebra.Solve.SolveCtx{QQFieldElem, QQMatrix, QQMatrix, QQMatrix}}

function CompletionMap(K::AbsSimpleNumField, L::LocalField{QadicFieldElem, EisensteinLocalField},
img::LocalFieldElem{QadicFieldElem, EisensteinLocalField},
Expand Down
27 changes: 27 additions & 0 deletions test/LocalField/Completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,27 @@
@test valuation(KtoC(K(uniformizer(P)))) == 1//6
end

@testset "small height lifts" begin
k, a = wildanger_field(3, 13)
c, mc = Hecke.unramified_completion(k, prime_ideals_over(maximal_order(k), 17)[1])
@test a == preimage(mc, mc(a); small_lift = true, integral = true)
@test a^3//5-2 == preimage(mc, mc(a^3//5-2); small_lift = true)

Qx, x = QQ["x"];
f = x^9 - 828*x^7 - 4371*x^6 + 226071*x^5 + 2371023*x^4 - 14243253*x^3 - 318645900*x^2 - 1637156439*x - 2754662093;

K, a = number_field(f, "a");
OK = maximal_order(K);
p = 3;
P = prime_ideals_over(OK, p)[1];
C, mC = completion(K, P, 100);
b = 5001310657//440423231859045*a^8 - 332069942701//3963809086731405*a^7 - 34477045500619//3963809086731405*a^6 + 22827170414018//1321269695577135*a^5 + 1893757018539416//792761817346281*a^4 + 29698097663762398//3963809086731405*a^3 - 57718358174700707//264253939115427*a^2 - 1362121503883347224//792761817346281*a - 13294109890580232283//3963809086731405;

bb = mC(b)

@test b == preimage(mC, mC(b); small_lift=true)
end

@testset "Issue 1075" begin
Qx, x = QQ["x"];
f = x^9 - 828*x^7 - 4371*x^6 + 226071*x^5 + 2371023*x^4 - 14243253*x^3 - 318645900*x^2 - 1637156439*x - 2754662093;
Expand All @@ -28,6 +49,8 @@ end
b = 5001310657//440423231859045*a^8 - 332069942701//3963809086731405*a^7 - 34477045500619//3963809086731405*a^6 + 22827170414018//1321269695577135*a^5 + 1893757018539416//792761817346281*a^4 + 29698097663762398//3963809086731405*a^3 - 57718358174700707//264253939115427*a^2 - 1362121503883347224//792761817346281*a - 13294109890580232283//3963809086731405;

bb = mC(b)


@test !iszero(bb)
@test valuation(bb) == 0
@test precision(bb) >= 8
Expand All @@ -37,6 +60,10 @@ end
@test !iszero(bb)
@test valuation(bb) == 0
@test precision(bb) >= 20

setprecision!(mC, 100) #does not seem to work
@test_broken b == preimage(mC, mC(b); small_lift=true)
@test_broken setprecision!(mC, 20)
end

@testset "Issue 1509" begin
Expand Down

0 comments on commit 5e6c8c2

Please sign in to comment.