Square root of a real number #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
In this file we define
nnreal.sqrt
to be the square root of a nonnegative real number.real.sqrt
to 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 = (nnreal.pow_order_iso 2 nnreal.sqrt._proof_1).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 = star_ordered_ring.of_nonneg_iff' real.star_ordered_ring._proof_1 real.star_ordered_ring._proof_2