Skip to content

Commit

Permalink
feat: add notation for Real.sqrt (#12056)
Browse files Browse the repository at this point in the history
This adds the notation `√r` for `Real.sqrt r`. The precedence is such that `√x⁻¹` is parsed as `√(x⁻¹)`; not because this is particularly desirable, but because it's the default and the choice doesn't really matter.

This is extracted from #7907, which adds a more general nth root typeclass.
The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot.
This PR also won't rot as quickly, as it does not forbid writing `x.sqrt` as that PR does.

While perhaps claiming `√` for `Real.sqrt` is greedy; it:
* Is far more common thatn `NNReal.sqrt` and `Nat.sqrt`
* Is far more interesting to mathlib than `sqrt` on `Float`
* Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types.
* Will be replaced by a more general typeclass in a future PR.

[Zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60Sqrt.60.20notation.20typeclass/near/400086502)



Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
  • Loading branch information
2 people authored and uniwuni committed Apr 19, 2024
1 parent df7414a commit 972df12
Show file tree
Hide file tree
Showing 51 changed files with 359 additions and 367 deletions.
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Order/CompleteField.lean
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ theorem ringHom_monotone (hR : ∀ r : R, 0 ≤ r → ∃ s : R, s ^ 2 = r) (f :
instance Real.RingHom.unique : Unique (ℝ →+* ℝ) where
default := RingHom.id ℝ
uniq f := congr_arg OrderRingHom.toRingHom (@Subsingleton.elim (ℝ →+*o ℝ) _
⟨f, ringHom_monotone (fun r hr => ⟨Real.sqrt r, sq_sqrt hr⟩) f⟩ default)
⟨f, ringHom_monotone (fun r hr => ⟨r, sq_sqrt hr⟩) f⟩ default)
#align real.ring_hom.unique Real.RingHom.unique

end Real
14 changes: 6 additions & 8 deletions Mathlib/Algebra/Star/CHSH.lean
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ which we hide in a namespace as they are unlikely to be useful elsewhere.
-/


local notation "√2" => (Real.sqrt 2 : ℝ)

namespace TsirelsonInequality

/-!
Expand All @@ -157,14 +155,14 @@ we prepare some easy lemmas about √2.

-- This calculation, which we need for Tsirelson's bound,
-- defeated me. Thanks for the rescue from Shing Tak Lam!
theorem tsirelson_inequality_aux : √2 * √2 ^ 3 = √2 * (2 * 2⁻¹ + 4 * (2⁻¹ * 2⁻¹)) := by
theorem tsirelson_inequality_aux : √2 * √2 ^ 3 = √2 * (2 * (√2)⁻¹ + 4 * ((√2)⁻¹ * 2⁻¹)) := by
ring_nf
rw [mul_inv_cancel (ne_of_gt (Real.sqrt_pos.2 (show (2 : ℝ) > 0 by norm_num)))]
convert congr_arg (· ^ 2) (@Real.sq_sqrt 2 (by norm_num)) using 1 <;>
(try simp only [← pow_mul]) <;> norm_num
#align tsirelson_inequality.tsirelson_inequality_aux TsirelsonInequality.tsirelson_inequality_aux

theorem sqrt_two_inv_mul_self : 2⁻¹ * 2⁻¹ = (2⁻¹ : ℝ) := by
theorem sqrt_two_inv_mul_self : (√2)⁻¹ * (√2)⁻¹ = (2⁻¹ : ℝ) := by
rw [← mul_inv]
norm_num
#align tsirelson_inequality.sqrt_two_inv_mul_self TsirelsonInequality.sqrt_two_inv_mul_self
Expand All @@ -188,9 +186,9 @@ theorem tsirelson_inequality [OrderedRing R] [StarRing R] [StarOrderedRing R] [A
-- abel will create `ℤ` multiplication. We will `simp` them away to `ℝ` multiplication.
have M : ∀ (m : ℤ) (a : ℝ) (x : R), m • a • x = ((m : ℝ) * a) • x := fun m a x => by
rw [zsmul_eq_smul_cast ℝ, ← mul_smul]
let P := 2⁻¹ • (A₁ + A₀) - B₀
let Q := 2⁻¹ • (A₁ - A₀) + B₁
have w : √2 ^ 3 • (1 : R) - A₀ * B₀ - A₀ * B₁ - A₁ * B₀ + A₁ * B₁ = 2⁻¹ • (P ^ 2 + Q ^ 2) := by
let P := (√2)⁻¹ • (A₁ + A₀) - B₀
let Q := (√2)⁻¹ • (A₁ - A₀) + B₁
have w : √2 ^ 3 • (1 : R) - A₀ * B₀ - A₀ * B₁ - A₁ * B₀ + A₁ * B₁ = (√2)⁻¹ • (P ^ 2 + Q ^ 2) := by
dsimp [P, Q]
-- distribute out all the powers and products appearing on the RHS
simp only [sq, sub_mul, mul_sub, add_mul, mul_add, smul_add, smul_sub]
Expand All @@ -210,7 +208,7 @@ theorem tsirelson_inequality [OrderedRing R] [StarRing R] [StarOrderedRing R] [A
-- just look at the coefficients now:
congr
exact mul_left_cancel₀ (by norm_num) tsirelson_inequality_aux
have pos : 02⁻¹ • (P ^ 2 + Q ^ 2) := by
have pos : 0(√2)⁻¹ • (P ^ 2 + Q ^ 2) := by
have P_sa : star P = P := by
simp only [P, star_smul, star_add, star_sub, star_id_of_comm, T.A₀_sa, T.A₁_sa, T.B₀_sa,
T.B₁_sa]
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/Analysis/Complex/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ theorem dist_eq (z w : ℂ) : dist z w = abs (z - w) :=
rfl
#align complex.dist_eq Complex.dist_eq

theorem dist_eq_re_im (z w : ℂ) : dist z w = Real.sqrt ((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by
theorem dist_eq_re_im (z w : ℂ) : dist z w = ((z.re - w.re) ^ 2 + (z.im - w.im) ^ 2) := by
rw [sq, sq]
rfl
#align complex.dist_eq_re_im Complex.dist_eq_re_im

@[simp]
theorem dist_mk (x₁ y₁ x₂ y₂ : ℝ) :
dist (mk x₁ y₁) (mk x₂ y₂) = Real.sqrt ((x₁ - x₂) ^ 2 + (y₁ - y₂) ^ 2) :=
dist (mk x₁ y₁) (mk x₂ y₂) = ((x₁ - x₂) ^ 2 + (y₁ - y₂) ^ 2) :=
dist_eq_re_im _ _
#align complex.dist_mk Complex.dist_mk

Expand Down Expand Up @@ -243,7 +243,7 @@ instance instT2Space : T2Space ℂ := TopologicalSpace.t2Space_of_metrizableSpac
/-- The natural `ContinuousLinearEquiv` from `ℂ` to `ℝ × ℝ`. -/
@[simps! (config := { simpRhs := true }) apply symm_apply_re symm_apply_im]
def equivRealProdCLM : ℂ ≃L[ℝ] ℝ × ℝ :=
equivRealProdLm.toContinuousLinearEquivOfBounds 1 (Real.sqrt 2) equivRealProd_apply_le' fun p =>
equivRealProdLm.toContinuousLinearEquivOfBounds 1 (2) equivRealProd_apply_le' fun p =>
abs_le_sqrt_two_mul_max (equivRealProd.symm p)
#align complex.equiv_real_prod_clm Complex.equivRealProdCLM

Expand Down
31 changes: 15 additions & 16 deletions Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Mathlib.Geometry.Euclidean.Inversion.Basic
In this file we define a `MetricSpace` structure on the `UpperHalfPlane`. We use hyperbolic
(Poincaré) distance given by
`dist z w = 2 * arsinh (dist (z : ℂ) w / (2 * Real.sqrt (z.im * w.im)))` instead of the induced
`dist z w = 2 * arsinh (dist (z : ℂ) w / (2 * (z.im * w.im)))` instead of the induced
Euclidean distance because the hyperbolic distance is invariant under holomorphic automorphisms of
the upper half-plane. However, we ensure that the projection to `TopologicalSpace` is
definitionally equal to the induced topological space structure.
Expand All @@ -36,19 +36,19 @@ variable {z w : ℍ} {r R : ℝ}
namespace UpperHalfPlane

instance : Dist ℍ :=
fun z w => 2 * arsinh (dist (z : ℂ) w / (2 * sqrt (z.im * w.im)))⟩
fun z w => 2 * arsinh (dist (z : ℂ) w / (2 * (z.im * w.im)))⟩

theorem dist_eq (z w : ℍ) : dist z w = 2 * arsinh (dist (z : ℂ) w / (2 * sqrt (z.im * w.im))) :=
theorem dist_eq (z w : ℍ) : dist z w = 2 * arsinh (dist (z : ℂ) w / (2 * (z.im * w.im))) :=
rfl
#align upper_half_plane.dist_eq UpperHalfPlane.dist_eq

theorem sinh_half_dist (z w : ℍ) :
sinh (dist z w / 2) = dist (z : ℂ) w / (2 * sqrt (z.im * w.im)) := by
sinh (dist z w / 2) = dist (z : ℂ) w / (2 * (z.im * w.im)) := by
rw [dist_eq, mul_div_cancel_left₀ (arsinh _) two_ne_zero, sinh_arsinh]
#align upper_half_plane.sinh_half_dist UpperHalfPlane.sinh_half_dist

theorem cosh_half_dist (z w : ℍ) :
cosh (dist z w / 2) = dist (z : ℂ) (conj (w : ℂ)) / (2 * sqrt (z.im * w.im)) := by
cosh (dist z w / 2) = dist (z : ℂ) (conj (w : ℂ)) / (2 * (z.im * w.im)) := by
rw [← sq_eq_sq, cosh_sq', sinh_half_dist, div_pow, div_pow, one_add_div, mul_pow, sq_sqrt]
· congr 1
simp only [Complex.dist_eq, Complex.sq_abs, Complex.normSq_sub, Complex.normSq_conj,
Expand All @@ -64,7 +64,7 @@ theorem tanh_half_dist (z w : ℍ) :
#align upper_half_plane.tanh_half_dist UpperHalfPlane.tanh_half_dist

theorem exp_half_dist (z w : ℍ) :
exp (dist z w / 2) = (dist (z : ℂ) w + dist (z : ℂ) (conj ↑w)) / (2 * sqrt (z.im * w.im)) := by
exp (dist z w / 2) = (dist (z : ℂ) w + dist (z : ℂ) (conj ↑w)) / (2 * (z.im * w.im)) := by
rw [← sinh_add_cosh, sinh_half_dist, cosh_half_dist, add_div]
#align upper_half_plane.exp_half_dist UpperHalfPlane.exp_half_dist

Expand All @@ -75,12 +75,12 @@ theorem cosh_dist (z w : ℍ) : cosh (dist z w) = 1 + dist (z : ℂ) w ^ 2 / (2

theorem sinh_half_dist_add_dist (a b c : ℍ) : sinh ((dist a b + dist b c) / 2) =
(dist (a : ℂ) b * dist (c : ℂ) (conj ↑b) + dist (b : ℂ) c * dist (a : ℂ) (conj ↑b)) /
(2 * sqrt (a.im * c.im) * dist (b : ℂ) (conj ↑b)) := by
(2 * (a.im * c.im) * dist (b : ℂ) (conj ↑b)) := by
simp only [add_div _ _ (2 : ℝ), sinh_add, sinh_half_dist, cosh_half_dist, div_mul_div_comm]
rw [← add_div, Complex.dist_self_conj, coe_im, abs_of_pos b.im_pos, mul_comm (dist (b : ℂ) _),
dist_comm (b : ℂ), Complex.dist_conj_comm, mul_mul_mul_comm, mul_mul_mul_comm _ _ _ b.im]
congr 2
rw [sqrt_mul, sqrt_mul, sqrt_mul, mul_comm (sqrt a.im), mul_mul_mul_comm, mul_self_sqrt,
rw [sqrt_mul, sqrt_mul, sqrt_mul, mul_comm (a.im), mul_mul_mul_comm, mul_self_sqrt,
mul_comm] <;> exact (im_pos _).le
#align upper_half_plane.sinh_half_dist_add_dist UpperHalfPlane.sinh_half_dist_add_dist

Expand All @@ -89,12 +89,12 @@ protected theorem dist_comm (z w : ℍ) : dist z w = dist w z := by
#align upper_half_plane.dist_comm UpperHalfPlane.dist_comm

theorem dist_le_iff_le_sinh :
dist z w ≤ r ↔ dist (z : ℂ) w / (2 * sqrt (z.im * w.im)) ≤ sinh (r / 2) := by
dist z w ≤ r ↔ dist (z : ℂ) w / (2 * (z.im * w.im)) ≤ sinh (r / 2) := by
rw [← div_le_div_right (zero_lt_two' ℝ), ← sinh_le_sinh, sinh_half_dist]
#align upper_half_plane.dist_le_iff_le_sinh UpperHalfPlane.dist_le_iff_le_sinh

theorem dist_eq_iff_eq_sinh :
dist z w = r ↔ dist (z : ℂ) w / (2 * sqrt (z.im * w.im)) = sinh (r / 2) := by
dist z w = r ↔ dist (z : ℂ) w / (2 * (z.im * w.im)) = sinh (r / 2) := by
rw [← div_left_inj' (two_ne_zero' ℝ), ← sinh_inj, sinh_half_dist]
#align upper_half_plane.dist_eq_iff_eq_sinh UpperHalfPlane.dist_eq_iff_eq_sinh

Expand All @@ -114,7 +114,7 @@ protected theorem dist_triangle (a b c : ℍ) : dist a c ≤ dist a b + dist b c
exact b.im_ne_zero
#align upper_half_plane.dist_triangle UpperHalfPlane.dist_triangle

theorem dist_le_dist_coe_div_sqrt (z w : ℍ) : dist z w ≤ dist (z : ℂ) w / sqrt (z.im * w.im) := by
theorem dist_le_dist_coe_div_sqrt (z w : ℍ) : dist z w ≤ dist (z : ℂ) w / (z.im * w.im) := by
rw [dist_le_iff_le_sinh, ← div_mul_eq_div_div_swap, self_le_sinh_iff]
positivity
#align upper_half_plane.dist_le_dist_coe_div_sqrt UpperHalfPlane.dist_le_dist_coe_div_sqrt
Expand Down Expand Up @@ -169,7 +169,7 @@ theorem dist_coe_center_sq (z w : ℍ) (r : ℝ) : dist (z : ℂ) (w.center r) ^
#align upper_half_plane.dist_coe_center_sq UpperHalfPlane.dist_coe_center_sq

theorem dist_coe_center (z w : ℍ) (r : ℝ) : dist (z : ℂ) (w.center r) =
sqrt (2 * z.im * w.im * (Real.cosh (dist z w) - Real.cosh r) + (w.im * Real.sinh r) ^ 2) := by
(2 * z.im * w.im * (Real.cosh (dist z w) - Real.cosh r) + (w.im * Real.sinh r) ^ 2) := by
rw [← sqrt_sq dist_nonneg, dist_coe_center_sq]
#align upper_half_plane.dist_coe_center UpperHalfPlane.dist_coe_center

Expand Down Expand Up @@ -238,7 +238,6 @@ nonrec theorem dist_of_re_eq (h : z.re = w.re) : dist z w = dist (log z.im) (log
field_simp
ring
#align upper_half_plane.dist_of_re_eq UpperHalfPlane.dist_of_re_eq

/-- Hyperbolic distance between two points is greater than or equal to the distance between the
logarithms of their imaginary parts. -/
theorem dist_log_im_le (z w : ℍ) : dist (log z.im) (log w.im) ≤ dist z w :=
Expand All @@ -247,9 +246,9 @@ theorem dist_log_im_le (z w : ℍ) : dist (log z.im) (log w.im) ≤ dist z w :=
Eq.symm <| dist_of_re_eq rfl
_ ≤ dist z w := by
simp_rw [dist_eq]
dsimp only [coe_mk, mk_im]
gcongr
· simpa [sqrt_sq_eq_abs] using Complex.abs_im_le_abs (z - w)
· simp
simpa [sqrt_sq_eq_abs] using Complex.abs_im_le_abs (z - w)
#align upper_half_plane.dist_log_im_le UpperHalfPlane.dist_log_im_le

theorem im_le_im_mul_exp_dist (z w : ℍ) : z.im ≤ w.im * Real.exp (dist z w) := by
Expand Down Expand Up @@ -287,7 +286,7 @@ instance : MetricSpace ℍ :=
metricSpaceAux.replaceTopology <| by
refine' le_antisymm (continuous_id_iff_le.1 _) _
· refine' (@continuous_iff_continuous_dist ℍ ℍ metricSpaceAux.toPseudoMetricSpace _ _).2 _
have : ∀ x : ℍ × ℍ, 2 * Real.sqrt (x.1.im * x.2.im) ≠ 0 := fun x => by positivity
have : ∀ x : ℍ × ℍ, 2 * (x.1.im * x.2.im) ≠ 0 := fun x => by positivity
-- `continuity` fails to apply `Continuous.div`
apply_rules [Continuous.div, Continuous.mul, continuous_const, Continuous.arsinh,
Continuous.dist, continuous_coe.comp, continuous_fst, continuous_snd,
Expand Down
14 changes: 7 additions & 7 deletions Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
section SqrtMulLog

theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
HasDerivAt (fun x => sqrt x * log x) ((2 + log x) / (2 * sqrt x)) x := by
HasDerivAt (fun x => x * log x) ((2 + log x) / (2 * x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
one_div, one_div, ← div_eq_inv_mul]
#align has_deriv_at_sqrt_mul_log hasDerivAt_sqrt_mul_log

theorem deriv_sqrt_mul_log (x : ℝ) :
deriv (fun x => sqrt x * log x) x = (2 + log x) / (2 * sqrt x) := by
deriv (fun x => x * log x) x = (2 + log x) / (2 * x) := by
cases' lt_or_le 0 x with hx hx
· exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
· rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
Expand All @@ -130,29 +130,29 @@ theorem deriv_sqrt_mul_log (x : ℝ) :
#align deriv_sqrt_mul_log deriv_sqrt_mul_log

theorem deriv_sqrt_mul_log' :
(deriv fun x => sqrt x * log x) = fun x => (2 + log x) / (2 * sqrt x) :=
(deriv fun x => x * log x) = fun x => (2 + log x) / (2 * x) :=
funext deriv_sqrt_mul_log
#align deriv_sqrt_mul_log' deriv_sqrt_mul_log'

theorem deriv2_sqrt_mul_log (x : ℝ) :
deriv^[2] (fun x => sqrt x * log x) x = -log x / (4 * sqrt x ^ 3) := by
deriv^[2] (fun x => x * log x) x = -log x / (4 * x ^ 3) := by
simp only [Nat.iterate, deriv_sqrt_mul_log']
rcases le_or_lt x 0 with hx | hx
· rw [sqrt_eq_zero_of_nonpos hx, zero_pow three_ne_zero, mul_zero, div_zero]
refine' HasDerivWithinAt.deriv_eq_zero _ (uniqueDiffOn_Iic 0 x hx)
refine' (hasDerivWithinAt_const _ _ 0).congr_of_mem (fun x hx => _) hx
rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
· have h₀ : sqrt x ≠ 0 := sqrt_ne_zero'.2 hx
· have h₀ : x ≠ 0 := sqrt_ne_zero'.2 hx
convert (((hasDerivAt_log hx.ne').const_add 2).div ((hasDerivAt_sqrt hx.ne').const_mul 2) <|
mul_ne_zero two_ne_zero h₀).deriv using 1
nth_rw 3 [← mul_self_sqrt hx.le]
generalize sqrt x = sqx at h₀ -- else field_simp rewrites sqrt x * sqrt x back to x
generalize x = sqx at h₀ -- else field_simp rewrites sqrt x * sqrt x back to x
field_simp
ring
#align deriv2_sqrt_mul_log deriv2_sqrt_mul_log

theorem strictConcaveOn_sqrt_mul_log_Ioi :
StrictConcaveOn ℝ (Set.Ioi 1) fun x => sqrt x * log x := by
StrictConcaveOn ℝ (Set.Ioi 1) fun x => x * log x := by
apply strictConcaveOn_of_deriv2_neg' (convex_Ioi 1) _ fun x hx => ?_
· exact continuous_sqrt.continuousOn.mul
(continuousOn_log.mono fun x hx => ne_of_gt (zero_lt_one.trans hx))
Expand Down
6 changes: 2 additions & 4 deletions Mathlib/Analysis/Convex/SpecificFunctions/Pow.lean
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ lemma concaveOn_rpow {p : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) :
· simpa only [rpow_one] using concaveOn_id (convex_Ici _)
exact (strictConcaveOn_rpow hp₀ hp₁).concaveOn

lemma strictConcaveOn_sqrt : StrictConcaveOn ℝ (Set.Ici 0) Real.sqrt := by
have : Real.sqrt = fun x : ℝ ↦ x ^ (1 / (2 : ℝ)) := by
ext x; exact Real.sqrt_eq_rpow x
rw [this]
lemma strictConcaveOn_sqrt : StrictConcaveOn ℝ (Set.Ici 0) (√· : ℝ → ℝ) := by
rw [funext Real.sqrt_eq_rpow]
exact strictConcaveOn_rpow (by positivity) (by linarith)

end Real
10 changes: 5 additions & 5 deletions Mathlib/Analysis/InnerProductSpace/Adjoint.lean
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ theorem apply_norm_sq_eq_inner_adjoint_left (A : E →L[𝕜] F) (x : E) :
#align continuous_linear_map.apply_norm_sq_eq_inner_adjoint_left ContinuousLinearMap.apply_norm_sq_eq_inner_adjoint_left

theorem apply_norm_eq_sqrt_inner_adjoint_left (A : E →L[𝕜] F) (x : E) :
‖A x‖ = Real.sqrt (re ⟪(A† ∘L A) x, x⟫) := by
‖A x‖ = (re ⟪(A† ∘L A) x, x⟫) := by
rw [← apply_norm_sq_eq_inner_adjoint_left, Real.sqrt_sq (norm_nonneg _)]
#align continuous_linear_map.apply_norm_eq_sqrt_inner_adjoint_left ContinuousLinearMap.apply_norm_eq_sqrt_inner_adjoint_left

Expand All @@ -159,7 +159,7 @@ theorem apply_norm_sq_eq_inner_adjoint_right (A : E →L[𝕜] F) (x : E) :
#align continuous_linear_map.apply_norm_sq_eq_inner_adjoint_right ContinuousLinearMap.apply_norm_sq_eq_inner_adjoint_right

theorem apply_norm_eq_sqrt_inner_adjoint_right (A : E →L[𝕜] F) (x : E) :
‖A x‖ = Real.sqrt (re ⟪x, (A† ∘L A) x⟫) := by
‖A x‖ = (re ⟪x, (A† ∘L A) x⟫) := by
rw [← apply_norm_sq_eq_inner_adjoint_right, Real.sqrt_sq (norm_nonneg _)]
#align continuous_linear_map.apply_norm_eq_sqrt_inner_adjoint_right ContinuousLinearMap.apply_norm_eq_sqrt_inner_adjoint_right

Expand Down Expand Up @@ -233,9 +233,9 @@ theorem norm_adjoint_comp_self (A : E →L[𝕜] F) :
re ⟪(A† ∘L A) x, x⟫ ≤ ‖(A† ∘L A) x‖ * ‖x‖ := re_inner_le_norm _ _
_ ≤ ‖A† ∘L A‖ * ‖x‖ * ‖x‖ := mul_le_mul_of_nonneg_right (le_opNorm _ _) (norm_nonneg _)
calc
‖A x‖ = Real.sqrt (re ⟪(A† ∘L A) x, x⟫) := by rw [apply_norm_eq_sqrt_inner_adjoint_left]
_ ≤ Real.sqrt (‖A† ∘L A‖ * ‖x‖ * ‖x‖) := (Real.sqrt_le_sqrt this)
_ = Real.sqrt ‖A† ∘L A‖ * ‖x‖ := by
‖A x‖ = (re ⟪(A† ∘L A) x, x⟫) := by rw [apply_norm_eq_sqrt_inner_adjoint_left]
_ ≤ (‖A† ∘L A‖ * ‖x‖ * ‖x‖) := (Real.sqrt_le_sqrt this)
_ = ‖A† ∘L A‖ * ‖x‖ := by
simp_rw [mul_assoc, Real.sqrt_mul (norm_nonneg _) (‖x‖ * ‖x‖),
Real.sqrt_mul_self (norm_nonneg x)]

Expand Down
Loading

0 comments on commit 972df12

Please sign in to comment.