Square root of a real number #
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 OrderIso
, so for NNReal
numbers we get continuity as well as
theorems like NNReal.sqrt x ≤ y ↔ x ≤ y * y
for free.
Then we define Real.sqrt x
to be NNReal.sqrt (Real.toNNReal x)
.
Tags #
square root
Square root of a nonnegative real number.
Equations
Instances For
Alias of NNReal.sqrt_le_sqrt
.
Alias of NNReal.sqrt_lt_sqrt
.
Alias of NNReal.sqrt_le_iff_le_sq
.
Alias of NNReal.le_sqrt_iff_sq_le
.
Alias of NNReal.sqrt_eq_iff_eq_sq
.
NNReal.sqrt
as a MonoidWithZeroHom
.
Equations
- NNReal.sqrtHom = { toFun := ⇑NNReal.sqrt, map_zero' := NNReal.sqrt_zero, map_one' := NNReal.sqrt_one, map_mul' := NNReal.sqrt_mul }
Instances For
Alias of the reverse direction of NNReal.sqrt_pos
.
The square root of a real number. This returns 0 for negative inputs.
This has notation √x
. Note that √x⁻¹
is parsed as √(x⁻¹)
.
Equations
- Real.«term√_» = Lean.ParserDescr.node `Real.«term√_» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "√") (Lean.ParserDescr.cat `term 1024))
Instances For
Note: if you want to conclude x ≤ √y
, then use Real.le_sqrt_of_sq_le
.
If you have x > 0
, consider using Real.le_sqrt'
Alias of the reverse direction of Real.sqrt_pos
.
Extension for the positivity
tactic: a square root of a strictly positive nonnegative real is
positive.
Instances For
Extension for the positivity
tactic: a square root is nonnegative, and is strictly positive if
its input is.
Instances For
The natural square root is at most the real square root
Cauchy-Schwarz inequality for finsets using square roots in ℝ≥0
.
Cauchy-Schwarz inequality for finsets using square roots in ℝ≥0
.