Skip to content

HenselLift ​

The bb-adic root of a polynomial that reduces to seed mod bb, by Newton's iteration — Hensel's lemma made to run. AdicSqrt is the special case f=x2−af = x^2 − a.

HenselLift(f, seed, b, prec?)needs f(seed)≡0f(seed) ≡ 0 and f′(seed)f'(seed) a unit mod bb; ff in one free variable
AdicSqrt(x, prec?)a square root in Zp\mathbb{Z}_p, prime pp; declines when there is none
Typed signatures
TypePackageApplies
(any, integer, integer, integer?) -> valuenumeralsalways

Domain: Numeral systems

Details
  • Each Newton step doubles the number of correct digits, so 20 digits take five steps
  • The result is capped at prec (default 20): a root found this way is known modulo bprecb^{prec} and nothing more, which is where capped values come from
  • A root with f′(seed)≡0f'(seed) ≡ 0 is not simple and does not lift this way — x3−xx^3 − x from 1 in Z2\mathbb{Z}_2 declines
  • Composite bb works when f′(seed)f'(seed) is coprime to bb, and that is how the non-rational elements of Z10\mathbb{Z}_{10} appear: x2−xx^2 − x from 5 lifts to the idempotent …890625…890625
  • Square roots: an odd prime needs xx to be a quadratic residue mod pp; p=2p = 2 needs x≡1(mod8)x ≡ 1 \pmod 8 and starts the iteration one level up, since f′(a)=2af'(a) = 2a is not a unit

Examples

Basic #

2\sqrt{2} in Z7\mathbb{Z}_7, from 32≡2(mod7)3^2 ≡ 2 \pmod 7

live ↗
InHenselLift(x2−2,3,7,6)\mathrm{HenselLift}(x^2-2, 3, 7, 6)OutAdicNumeral(7,38 181,6)\mathrm{AdicNumeral}(7, 38\,181, 6)

and squaring it gives 2 back, to the same precision

live ↗
InAdicSqrt(AdicNumeral(7,2),6)2\mathrm{AdicSqrt}(\mathrm{AdicNumeral}(7, 2), 6)^2OutAdicNumeral(7,2,6)\mathrm{AdicNumeral}(7, 2, 6)
Applications #

a 10-adic idempotent: e2=ee^2 = e, and e≠0,1e ≠ 0, 1

live ↗
InAdicExpansion(HenselLift(x2−x,5,10,8))\mathrm{AdicExpansion}(\mathrm{HenselLift}(x^2-x, 5, 10, 8))Out…12890625 + O(10^8)\text{…12890625 + O(10\textasciicircum{}8)}
Possible issues #

3 is not a square mod 7, so it has no 7-adic square root

live ↗
InAdicSqrt(AdicNumeral(7,3))\mathrm{AdicSqrt}(\mathrm{AdicNumeral}(7, 3))OutAdicSqrt(AdicNumeral(7,3))\mathrm{AdicSqrt}(\mathrm{AdicNumeral}(7, 3))

Declines at a non-simple root: f′(1)=2f'(1)=2 is not a unit mod 2, so Newton's step can't lift

live ↗
InHenselLift(x3−x,1,2,6)\mathrm{HenselLift}(x^3-x, 1, 2, 6)OutHenselLift(x3−x,1,2,6)\mathrm{HenselLift}(x^3-x, 1, 2, 6)
Neat examples #
1 / 2

The two roots of x2=xx^2=x lifted in Z10\mathbf{Z}_{10} are orthogonal idempotents: their product is 0

live ↗
InHenselLift(x2−x,5,10,8)HenselLift(x2−x,6,10,8)\mathrm{HenselLift}(x^2-x, 5, 10, 8)\mathrm{HenselLift}(x^2-x, 6, 10, 8)OutAdicNumeral(10,0,8)\mathrm{AdicNumeral}(10, 0, 8)
About
Examples7

See also: AdicNumeral, AdicExpansion