Opened 2 years ago

# Allow for p-adic n-th roots of 0

Reported by: Owned by: alexjbest major sage-8.5 padics padicBordeaux roed, caruso N/A

### Description

In the recent tickets for p-adics sqrts were changed a lot #23344 and n-th roots were added #12567, after these changes (and probably before also) p-adic sqrts of `0 + O(p^n)` are disallowed.

Mathematically speaking there are two ways to interpret a p-adic zero to some precision `O(p^n)`, as the ball of radius `1/p^n` around exact 0, or as an unknown element somewhere in the ball. `sqrt(O(p^n))` is therefore ill defined with the second interpretation as the element may not have a square root. However with the first interpretation its okay to take the sqrt we simply halve the precision the ball is known to, the same holds for n-th roots I guess.

This ticket proposes to add a flag `secure` to p-adic n-th root (and sqrt) which defaults to True but allows the user to select the insecure behaviour alluded to above. The name is for consistency with several similar options added in the Tate algebras ticket #26195.

I am happy to write the code, but would like to hear from the p-adic gurus first, to make sure that they don't disagree with adding this in principle, or can think of a better way to accomplish what I want.

For a specific example where this comes up, when working with hyperelliptic curves `y^2 = f(x)` we often deal with p-adic weierstrass points where the `x` coordinate is defined to be a root of `f(x)`, some parts of the code (in coleman integration) try to sqrt `f(x0)` for some `x0` which fails if `x0` is constructed as an approximation to a p-adic root.

### comment:1 Changed 2 years ago by caruso

I agree for adding the keyword `secure`. And even for letting `secure=False` be the default since it is in general elsewhere.

Note that `x = O(p^n)` is not the sole example for which `sqrt(x)` is ambiguous. For example `sqrt(1 + O(2^2))` is also and we can cook up more exotic examples over ramified extensions of `Q2`. Of course, similar phenomena occur for when extracting `p^n`-th root over extensions of `Qp`.