Square root of a real number #
In this file we define
nnreal.sqrtto be the square root of a nonnegative real number.real.sqrtto be the square root of a real number, defined to be zero on negative numbers.
Then we prove some basic properties of these functions.
Implementation notes #
We define nnreal.sqrt as the noncomputable inverse to the function x ↦ x * x. We use general
theory of inverses of strictly monotone functions to prove that nnreal.sqrt x exists. As a side
effect, nnreal.sqrt is a bundled order_iso, so for nnreal numbers we get continuity as well as
theorems like sqrt x ≤ y ↔ x ≤ y * y for free.
Then we define real.sqrt x to be nnreal.sqrt (real.to_nnreal x). We also define a Cauchy
sequence real.sqrt_aux (f : cau_seq ℚ abs) which converges to sqrt (mk f) but do not prove (yet)
that this sequence actually converges to sqrt (mk f).
Tags #
square root
Square root of a nonnegative real number.
Equations
- nnreal.sqrt = (strict_mono.order_iso_of_surjective (λ (x : nnreal), x * x) nnreal.sqrt._proof_1 nnreal.sqrt._proof_2).symm
 
nnreal.sqrt as a monoid_with_zero_hom.
Equations
An auxiliary sequence of rational numbers that converges to real.sqrt (mk f).
Currently this sequence is not used in mathlib.
Equations
- real.sqrt_aux f (n + 1) = let s : ℚ := real.sqrt_aux f n in linear_order.max 0 ((s + ⇑f (n + 1) / s) / 2)
 - real.sqrt_aux f 0 = rat.mk_nat ↑(nat.sqrt (⇑f 0).num.to_nat) (nat.sqrt (⇑f 0).denom)
 
Alias of the reverse direction of real.sqrt_pos.
Equations
- real.star_ordered_ring = {to_star_ring := real.star_ring, add_le_add_left := _, nonneg_iff := real.star_ordered_ring._proof_1}