The areas / V15. Real analysis in one variable
Mathlib.Analysis.Real.Sqrt
115 declarations. Mathlib docs · Source
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 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
theorem MonoidWithZeroHom.mk.congr_simp E1 #
∀ {α : Type u_7} {β : Type u_8} [inst : MulZeroOneClass α] [inst_1 : MulZeroOneClass β]
(toZeroHom toZeroHom_1 : ZeroHom α β) (e_toZeroHom : toZeroHom = toZeroHom_1) (map_one' : toZeroHom.toFun 1 = 1)
(map_mul' : ∀ (x y : α), toZeroHom.toFun (x * y) = toZeroHom.toFun x * toZeroHom.toFun y),
{ toZeroHom := toZeroHom, map_one' := map_one', map_mul' := map_mul' } =
{ toZeroHom := toZeroHom_1, map_one' := ⋯, map_mul' := ⋯ }
def NNReal.sqrt E1 #
NNReal ≃o NNReal
Square root of a nonnegative real number.
theorem NNReal.sq_sqrt E0 #
∀ (x : NNReal), NNReal.sqrt x ^ 2 = x
theorem NNReal.sqrt_sq E0 #
∀ (x : NNReal), NNReal.sqrt (x ^ 2) = x
theorem NNReal.mul_self_sqrt E0 #
∀ (x : NNReal), NNReal.sqrt x * NNReal.sqrt x = x
theorem NNReal.sqrt_mul_self E0 #
∀ (x : NNReal), NNReal.sqrt (x * x) = x
theorem NNReal.sqrt_le_sqrt E1 #
∀ {x y : NNReal}, NNReal.sqrt x ≤ NNReal.sqrt y ↔ x ≤ y
theorem NNReal.sqrt_lt_sqrt E1 #
∀ {x y : NNReal}, NNReal.sqrt x < NNReal.sqrt y ↔ x < y
theorem NNReal.sqrt_eq_iff_eq_sq E1 #
∀ {x y : NNReal}, NNReal.sqrt x = y ↔ x = y ^ 2
theorem NNReal.sqrt_le_iff_le_sq E1 #
∀ {x y : NNReal}, NNReal.sqrt x ≤ y ↔ x ≤ y ^ 2
theorem NNReal.le_sqrt_iff_sq_le E1 #
∀ {x y : NNReal}, x ≤ NNReal.sqrt y ↔ x ^ 2 ≤ y
theorem NNReal.sqrt_eq_zero E0 #
∀ {x : NNReal}, NNReal.sqrt x = 0 ↔ x = 0
theorem NNReal.sqrt_eq_one E0 #
∀ {x : NNReal}, NNReal.sqrt x = 1 ↔ x = 1
theorem NNReal.sqrt_zero E0 #
NNReal.sqrt 0 = 0
theorem NNReal.sqrt_one E0 #
NNReal.sqrt 1 = 1
theorem NNReal.sqrt_le_one E0 #
∀ {x : NNReal}, NNReal.sqrt x ≤ 1 ↔ x ≤ 1
theorem NNReal.one_le_sqrt E0 #
∀ {x : NNReal}, 1 ≤ NNReal.sqrt x ↔ 1 ≤ x
theorem NNReal.sqrt_mul_le_max E1 #
∀ {x y : NNReal}, NNReal.sqrt (x * y) ≤ max x y
theorem NNReal.sqrt_mul E1 #
∀ (x y : NNReal), NNReal.sqrt (x * y) = NNReal.sqrt x * NNReal.sqrt y
def NNReal.sqrtHom E1 #
NNReal →*₀ NNReal
NNReal.sqrt as a MonoidWithZeroHom.
theorem NNReal.sqrt_inv E1 #
∀ (x : NNReal), NNReal.sqrt x⁻¹ = (NNReal.sqrt x)⁻¹
theorem NNReal.sqrt_div E1 #
∀ (x y : NNReal), NNReal.sqrt (x / y) = NNReal.sqrt x / NNReal.sqrt y
theorem NNReal.continuous_sqrt E1 #
Continuous ⇑NNReal.sqrt
theorem NNReal.sqrt_pos E0 #
∀ {x : NNReal}, 0 < NNReal.sqrt x ↔ 0 < x
theorem NNReal.sqrt_pos_of_pos E1 #
∀ {x : NNReal}, 0 < x → 0 < NNReal.sqrt x
Alias of the reverse direction of NNReal.sqrt_pos.
theorem NNReal.isSquare E0 #
∀ (x : NNReal), IsSquare x
def Real.sqrt E1 #
ℝ → ℝ
The square root of a real number. This returns 0 for negative inputs.
This has notation √x. Note that √x⁻¹ is parsed as √(x⁻¹).
def Real.«term√_» E1 #
Lean.ParserDescr
The square root of a real number. This returns 0 for negative inputs.
This has notation √x. Note that √x⁻¹ is parsed as √(x⁻¹).
theorem Real.coe_sqrt E0 #
∀ {x : NNReal}, ↑(NNReal.sqrt x) = √↑x
theorem Real.continuous_sqrt E1 #
Continuous fun x ↦ √x
theorem Real.map_sqrt_atTop E0 #
Filter.map (fun x ↦ √x) Filter.atTop = Filter.atTop
theorem Real.comap_sqrt_atTop E0 #
Filter.comap (fun x ↦ √x) Filter.atTop = Filter.atTop
theorem Real.tendsto_sqrt_atTop E1 #
Filter.Tendsto (fun x ↦ √x) Filter.atTop Filter.atTop
theorem Real.sqrt_eq_zero_of_nonpos E1 #
∀ {x : ℝ}, x ≤ 0 → √x = 0
theorem Real.sqrt_nonneg E0 #
∀ (x : ℝ), 0 ≤ √x
theorem Real.mul_self_sqrt E0 #
∀ {x : ℝ}, 0 ≤ x → √x * √x = x
theorem Real.sqrt_mul_self E0 #
∀ {x : ℝ}, 0 ≤ x → √(x * x) = x
theorem Real.sqrt_eq_cases E1 #
∀ {x y : ℝ}, √x = y ↔ y * y = x ∧ 0 ≤ y ∨ x < 0 ∧ y = 0
theorem Real.sqrt_eq_iff_mul_self_eq E0 #
∀ {x y : ℝ}, 0 ≤ x → 0 ≤ y → (√x = y ↔ x = y * y)
theorem Real.sqrt_eq_iff_mul_self_eq_of_pos E1 #
∀ {x y : ℝ}, 0 < y → (√x = y ↔ y * y = x)
theorem Real.sqrt_eq_one E0 #
∀ {x : ℝ}, √x = 1 ↔ x = 1
theorem Real.sq_sqrt E0 #
∀ {x : ℝ}, 0 ≤ x → √x ^ 2 = x
theorem Real.sqrt_sq E0 #
∀ {x : ℝ}, 0 ≤ x → √(x ^ 2) = x
theorem Real.sqrt_eq_iff_eq_sq E1 #
∀ {x y : ℝ}, 0 ≤ x → 0 ≤ y → (√x = y ↔ x = y ^ 2)
theorem Real.sqrt_mul_self_eq_abs E1 #
∀ (x : ℝ), √(x * x) = |x|
theorem Real.sqrt_sq_eq_abs E1 #
∀ (x : ℝ), √(x ^ 2) = |x|
theorem Real.sqrt_zero E0 #
√0 = 0
theorem Real.sqrt_one E0 #
√1 = 1
theorem Real.sqrt_le_sqrt_iff E0 #
∀ {x y : ℝ}, 0 ≤ y → (√x ≤ √y ↔ x ≤ y)
theorem Real.sqrt_lt_sqrt_iff E0 #
∀ {x y : ℝ}, 0 ≤ x → (√x < √y ↔ x < y)
theorem Real.sqrt_lt_sqrt_iff_of_pos E1 #
∀ {x y : ℝ}, 0 < y → (√x < √y ↔ x < y)
theorem Real.sqrt_le_sqrt E1 #
∀ {x y : ℝ}, x ≤ y → √x ≤ √y
theorem Real.sqrt_monotone E1 #
Monotone Real.sqrt
theorem Real.strictMonoOn_sqrt E1 #
StrictMonoOn Real.sqrt (Set.Ici 0)
theorem Real.sqrt_lt_sqrt E1 #
∀ {x y : ℝ}, 0 ≤ x → x < y → √x < √y
theorem Real.sqrt_le_left E1 #
∀ {x y : ℝ}, 0 ≤ y → (√x ≤ y ↔ x ≤ y ^ 2)
theorem Real.sqrt_le_iff E0 #
∀ {x y : ℝ}, √x ≤ y ↔ 0 ≤ y ∧ x ≤ y ^ 2
theorem Real.sqrt_lt E1 #
∀ {x y : ℝ}, 0 ≤ x → 0 ≤ y → (√x < y ↔ x < y ^ 2)
theorem Real.sqrt_lt' E1 #
∀ {x y : ℝ}, 0 < y → (√x < y ↔ x < y ^ 2)
theorem Real.le_sqrt E1 #
∀ {x y : ℝ}, 0 ≤ x → 0 ≤ y → (x ≤ √y ↔ x ^ 2 ≤ y)
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'
theorem Real.le_sqrt' E1 #
∀ {x y : ℝ}, 0 < x → (x ≤ √y ↔ x ^ 2 ≤ y)
theorem Real.abs_le_sqrt E1 #
∀ {x y : ℝ}, x ^ 2 ≤ y → |x| ≤ √y
theorem Real.sq_le E1 #
∀ {x y : ℝ}, 0 ≤ y → (x ^ 2 ≤ y ↔ -√y ≤ x ∧ x ≤ √y)
theorem Real.neg_sqrt_le_of_sq_le E1 #
∀ {x y : ℝ}, x ^ 2 ≤ y → -√y ≤ x
theorem Real.le_sqrt_of_sq_le E1 #
∀ {x y : ℝ}, x ^ 2 ≤ y → x ≤ √y
theorem Real.sqrt_inj E0 #
∀ {x y : ℝ}, 0 ≤ x → 0 ≤ y → (√x = √y ↔ x = y)
theorem Real.sqrt_eq_zero E0 #
∀ {x : ℝ}, 0 ≤ x → (√x = 0 ↔ x = 0)
theorem Real.sqrt_eq_zero' E1 #
∀ {x : ℝ}, √x = 0 ↔ x ≤ 0
theorem Real.sqrt_ne_zero E1 #
∀ {x : ℝ}, 0 ≤ x → (√x ≠ 0 ↔ x ≠ 0)
theorem Real.sqrt_ne_zero' E1 #
∀ {x : ℝ}, √x ≠ 0 ↔ 0 < x
theorem Real.sq_sqrt' E1 #
∀ {x : ℝ}, √x ^ 2 = max x 0
Variant of sq_sqrt without a non-negativity assumption on x.
theorem Real.sqrt_pos E0 #
∀ {x : ℝ}, 0 < √x ↔ 0 < x
theorem Real.sqrt_pos_of_pos E1 #
∀ {x : ℝ}, 0 < x → 0 < √x
Alias of the reverse direction of Real.sqrt_pos.
theorem Real.sqrt_le_sqrt_iff' E1 #
∀ {x y : ℝ}, 0 < x → (√x ≤ √y ↔ x ≤ y)
theorem Real.one_le_sqrt E0 #
∀ {x : ℝ}, 1 ≤ √x ↔ 1 ≤ x
theorem Real.sqrt_le_one E0 #
∀ {x : ℝ}, √x ≤ 1 ↔ x ≤ 1
theorem Real.isSquare_iff E0 #
∀ {x : ℝ}, IsSquare x ↔ 0 ≤ x
theorem Real.sqrt_le_self_iff E0 #
∀ {x : ℝ}, √x ≤ x ↔ x = 0 ∨ 1 ≤ x
theorem Real.le_sqrt_self_iff E0 #
∀ {x : ℝ}, x ≤ √x ↔ x ≤ 1
theorem Real.sqrt_lt_self_iff E0 #
∀ {x : ℝ}, √x < x ↔ 1 < x
theorem Real.lt_sqrt_self_iff E0 #
∀ {x : ℝ}, x < √x ↔ x ≠ 0 ∧ x < 1
def Mathlib.Meta.Positivity.evalNNRealSqrt E1 #
Mathlib.Meta.Positivity.PositivityExt
Extension for the positivity tactic: a square root of a strictly positive nonnegative real is
positive.
def Mathlib.Meta.Positivity.evalSqrt E1 #
Mathlib.Meta.Positivity.PositivityExt
Extension for the positivity tactic: a square root is nonnegative, and is strictly positive if
its input is.
theorem Real.one_lt_sqrt_two E1 #
1 < √2
theorem Real.sqrt_two_lt_three_halves E1 #
√2 < 3 / 2
theorem Real.inv_sqrt_two_sub_one E1 #
(√2 - 1)⁻¹ = √2 + 1
theorem Real.sqrt_mul E0 #
∀ {x : ℝ}, 0 ≤ x → ∀ (y : ℝ), √(x * y) = √x * √y
theorem Real.sqrt_mul' E0 #
∀ (x : ℝ) {y : ℝ}, 0 ≤ y → √(x * y) = √x * √y
theorem Real.sqrt_inv E0 #
∀ (x : ℝ), √x⁻¹ = (√x)⁻¹
theorem Real.sqrt_div E0 #
∀ {x : ℝ}, 0 ≤ x → ∀ (y : ℝ), √(x / y) = √x / √y
theorem Real.sqrt_div' E0 #
∀ (x : ℝ) {y : ℝ}, 0 ≤ y → √(x / y) = √x / √y
theorem Real.div_sqrt E0 #
∀ {x : ℝ}, x / √x = √x
theorem Real.sqrt_div_self' E1 #
∀ {x : ℝ}, √x / x = 1 / √x
theorem Real.sqrt_div_self E1 #
∀ {x : ℝ}, √x / x = (√x)⁻¹
theorem Real.lt_sqrt E1 #
∀ {x y : ℝ}, 0 ≤ x → (x < √y ↔ x ^ 2 < y)
theorem Real.sq_lt E1 #
∀ {x y : ℝ}, x ^ 2 < y ↔ -√y < x ∧ x < √y
theorem Real.neg_sqrt_lt_of_sq_lt E1 #
∀ {x y : ℝ}, x ^ 2 < y → -√y < x
theorem Real.lt_sqrt_of_sq_lt E1 #
∀ {x y : ℝ}, x ^ 2 < y → x < √y
theorem Real.lt_sq_of_sqrt_lt E1 #
∀ {x y : ℝ}, √x < y → x < y ^ 2
theorem Real.nat_sqrt_le_real_sqrt E1 #
∀ {a : ℕ}, ↑a.sqrt ≤ √↑a
The natural square root is at most the real square root
theorem Real.real_sqrt_lt_nat_sqrt_succ E1 #
∀ {a : ℕ}, √↑a < ↑a.sqrt + 1
The real square root is less than the natural square root plus one
theorem Real.real_sqrt_le_nat_sqrt_succ E1 #
∀ {a : ℕ}, √↑a ≤ ↑a.sqrt + 1
The real square root is at most the natural square root plus one
theorem Real.floor_real_sqrt_eq_nat_sqrt E0 #
∀ {a : ℕ}, ⌊√↑a⌋ = ↑a.sqrt
The floor of the real square root is the same as the natural square root.
theorem Real.nat_floor_real_sqrt_eq_nat_sqrt E0 #
∀ {a : ℕ}, ⌊√↑a⌋₊ = a.sqrt
The natural floor of the real square root is the same as the natural square root.
theorem Real.sqrt_one_add_le E2 #
∀ {x : ℝ}, -1 ≤ x → √(1 + x) ≤ 1 + x / 2
Bernoulli's inequality for exponent 1 / 2, stated using sqrt.
theorem Real.sqrt_prod E1 #
∀ {ι : Type u_1} (s : Finset ι) {x : ι → ℝ}, (∀ i ∈ s, 0 ≤ x i) → √(∏ i ∈ s, x i) = ∏ i ∈ s, √(x i)
theorem Filter.Tendsto.sqrt E1 #
∀ {α : Type u_1} {f : α → ℝ} {l : Filter α} {x : ℝ},
Filter.Tendsto f l (nhds x) → Filter.Tendsto (fun x ↦ √(f x)) l (nhds √x)
theorem ContinuousWithinAt.sqrt E1 #
∀ {α : Type u_1} [inst : TopologicalSpace α] {f : α → ℝ} {s : Set α} {x : α},
ContinuousWithinAt f s x → ContinuousWithinAt (fun x ↦ √(f x)) s x
theorem ContinuousAt.sqrt E1 #
∀ {α : Type u_1} [inst : TopologicalSpace α] {f : α → ℝ} {x : α}, ContinuousAt f x → ContinuousAt (fun x ↦ √(f x)) x
theorem ContinuousOn.sqrt E1 #
∀ {α : Type u_1} [inst : TopologicalSpace α] {f : α → ℝ} {s : Set α}, ContinuousOn f s → ContinuousOn (fun x ↦ √(f x)) s
theorem Continuous.sqrt E1 #
∀ {α : Type u_1} [inst : TopologicalSpace α] {f : α → ℝ}, Continuous f → Continuous fun x ↦ √(f x)
theorem NNReal.sum_mul_le_sqrt_mul_sqrt E2 #
∀ {ι : Type u_2} (s : Finset ι) (f g : ι → NNReal),
∑ i ∈ s, f i * g i ≤ NNReal.sqrt (∑ i ∈ s, f i ^ 2) * NNReal.sqrt (∑ i ∈ s, g i ^ 2)
Cauchy-Schwarz inequality for finsets using square roots in ℝ≥0.
theorem NNReal.sum_sqrt_mul_sqrt_le E2 #
∀ {ι : Type u_2} (s : Finset ι) (f g : ι → NNReal),
∑ i ∈ s, NNReal.sqrt (f i) * NNReal.sqrt (g i) ≤ NNReal.sqrt (∑ i ∈ s, f i) * NNReal.sqrt (∑ i ∈ s, g i)
Cauchy-Schwarz inequality for finsets using square roots in ℝ≥0.
theorem Real.sum_mul_le_sqrt_mul_sqrt E2 #
∀ {ι : Type u_2} (s : Finset ι) (f g : ι → ℝ), ∑ i ∈ s, f i * g i ≤ √(∑ i ∈ s, f i ^ 2) * √(∑ i ∈ s, g i ^ 2)
Cauchy-Schwarz inequality for finsets using square roots in ℝ.
theorem Real.sum_sqrt_mul_sqrt_le E2 #
∀ {ι : Type u_2} {f g : ι → ℝ} (s : Finset ι),
(∀ (i : ι), 0 ≤ f i) → (∀ (i : ι), 0 ≤ g i) → ∑ i ∈ s, √(f i) * √(g i) ≤ √(∑ i ∈ s, f i) * √(∑ i ∈ s, g i)
Cauchy-Schwarz inequality for finsets using square roots in ℝ.