Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Try doing some basic maths questions in the Lean Theorem Prover. Functions, real numbers, equivalence relations and groups. Click on README.md and then on "Open in CoCalc with one click".
License: APACHE
Maths in Lean : p-adic numbers
The construction of ℝ
using Cauchy sequences of rationals can be generalized to any absolute value on ℚ
. For any prime p, the completion of ℚ
with repsect to the p-adic norm creates a field ℚ_p
and a ring ℤ_p
.
padic_norm.lean
defines the p-adic valuationℤ → ℕ
, extends it toℚ
, and definespadic_norm {p} : prime p → ℚ → ℚ
. Note that this does not lead to a useful instance ofhas_norm
sincep
cannot be inferred from the input, and it is not a norm for compositep
.padic_norm
is shown to be a non-archimedean absolute value.Fix
p
and[prime p]
.padic_rationals.lean
definesℚ_[p]
as the Cauchy completion ofℚ
wrtpadic_norm p
using the same mechanisms asdata/real/basic.lean
. It is immediately a field. The norm lifts topadic_norm_e : ℚ_[p] → ℚ
, which is cast toℝ
and gives us anormed_field
instance.ℚ_[p]
is shown to be Cauchy complete.padic_integers.lean
definesℤ_[p]
as the subtype{x : ℚ_[p] \\ ∥x∥ ≤ 1}
. It instantiateslocal_ring
andnormed_ring
and is Cauchy complete.hensel.lean
proves Hensel's lemma overℤ_[p]
, described by Gouvêa (1997) as the "most important algebraic property of the p-adic numbers." ForF : polynomial ℤ_[p]
anda : ℤ_[p]
with∥F.eval a∥ < ∥F.derivative.eval a∥^2
, then there exists a uniquez
such thatF.eval z = 0 ∧ ∥z - a∥ < ∥F.derivative.eval a∥
; furthermore,∥F.derivative.eval z∥ = ∥F.derivative.eval a∥
. The proof is an adaptation of a writeup by Keith Conrad and uses Newton's method to construct a sequence inℤ_[p]
converging to the unique solution.