Exact Lean source
Nonadditivity.Linearization
Download original .lean · View on GitHub · Jump to source
Direct imports
Mathlib.Data.Real.BasicdependencyMathlib.Data.Real.SqrtdependencyMathlib.Algebra.Order.BigOperators.Ring.FinsetdependencyMathlib.Analysis.Normed.Operator.BasicdependencyMathlib.Data.Finset.ProddependencyMathlib.Data.Fintype.SigmadependencyMathlib.Data.Fin.RevdependencyMathlib.Data.Matrix.BlockdependencyMathlib.Data.Matrix.ColumnRowPartitioneddependencyMathlib.Analysis.Matrix.OrderdependencyMathlib.Analysis.CStarAlgebra.MatrixdependencyMathlib.LinearAlgebra.Matrix.HermitiandependencyMathlib.Tactic.LinarithdependencyMathlib.Tactic.PositivitydependencyMathlib.Tactic.RingdependencyMathlib.Tactic.NormNumdependencyLean.Elab.Tactic.Omegadependency
Imported by project modules
4 direct reverse imports
Relationships above come from literal import commands. The declarations below link to types and references extracted from Lean’s environment. Source text is complete and unchanged.
Declarations in this module
61 project constants, including generated, internal and private declarations.
61 declarations
Nonadditivity.Linearization.FollowingLetterNonadditivity.Linearization.LetterNonadditivity.Linearization.ReducedTailNonadditivity.Linearization.ReducedTail._sunfoldinternal/detail/privateNonadditivity.Linearization.ReducedTail._unsafe_recinternal/detail/privateNonadditivity.Linearization.ReducedTail.eq_1internal/detail/privateNonadditivity.Linearization.ReducedTail.eq_2internal/detail/privateNonadditivity.Linearization.ReducedTail.eq_defNonadditivity.Linearization.ReducedTail.match_1internal/detail/privateNonadditivity.Linearization.ReducedWordNonadditivity.Linearization.backward_error_chainNonadditivity.Linearization.backward_error_chain._proof_1_1internal/detail/privateNonadditivity.Linearization.backward_error_chain._proof_1_2internal/detail/privateNonadditivity.Linearization.backward_error_chain._proof_1_3internal/detail/privateNonadditivity.Linearization.backward_error_transferNonadditivity.Linearization.card_differenceSupport_leNonadditivity.Linearization.card_followingLetterNonadditivity.Linearization.card_reducedTailNonadditivity.Linearization.card_reducedWordNonadditivity.Linearization.coefficient_energy_le_of_gram_normNonadditivity.Linearization.column_gram_entryNonadditivity.Linearization.differenceSupportNonadditivity.Linearization.differenceSupport.eq_1internal/detail/privateNonadditivity.Linearization.gram_factorizationNonadditivity.Linearization.gram_factorization_of_sqrtNonadditivity.Linearization.hermitianDilationNonadditivity.Linearization.hermitianDilation_isHermitianNonadditivity.Linearization.hermitianDilation_sqNonadditivity.Linearization.initial_backward_errorNonadditivity.Linearization.inv_mem_differenceSupportNonadditivity.Linearization.inverseLetterNonadditivity.Linearization.inverseLetter.eq_1internal/detail/privateNonadditivity.Linearization.inverseLetter_inverseNonadditivity.Linearization.inverseLetter_neNonadditivity.Linearization.mem_differenceSupportNonadditivity.Linearization.mem_differenceSupport._simp_1internal/detail/privateNonadditivity.Linearization.mem_differenceSupport._simp_1_2internal/detail/privateNonadditivity.Linearization.mem_differenceSupport._simp_1_3internal/detail/privateNonadditivity.Linearization.norm_sum_sq_le_card_sum_sqNonadditivity.Linearization.one_le_cardNonadditivity.Linearization.operator_sum_norm_le_differenceSupportNonadditivity.Linearization.operator_sum_norm_le_of_gram_normNonadditivity.Linearization.operator_sum_norm_le_sqrt_cardNonadditivity.Linearization.operator_sum_norm_le_support_sizeNonadditivity.Linearization.polar_block_posSemidefNonadditivity.Linearization.polar_block_posSemidef_of_identitiesNonadditivity.Linearization.positive_gram_factorizationNonadditivity.Linearization.positive_sqrt_gramNonadditivity.Linearization.reducedTailFintypeNonadditivity.Linearization.reduced_word_geometric_sumNonadditivity.Linearization.reduced_word_geometric_sum._proof_1_1internal/detail/privateNonadditivity.Linearization.relativeNormErrorNonadditivity.Linearization.relativeNormError_le_iffNonadditivity.Linearization.relativeNormError_nonnegNonadditivity.Linearization.relativeNormError_nonneg._simp_1internal/detail/privateNonadditivity.Linearization.relative_backward_error_transferNonadditivity.Linearization.short_word_count_boundNonadditivity.Linearization.split_mem_differenceSupport_private.Nonadditivity.Linearization.0.Nonadditivity.Linearization.ReducedTail.match_1.eq_1internal/detail/private_private.Nonadditivity.Linearization.0.Nonadditivity.Linearization.ReducedTail.match_1.eq_2internal/detail/private_private.Nonadditivity.Linearization.0.Nonadditivity.Linearization.ReducedTail.match_1.splitterinternal/detail/private
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Mathlib.Data.Real.Basic7import Mathlib.Data.Real.Sqrt8import Mathlib.Algebra.Order.BigOperators.Ring.Finset9import Mathlib.Analysis.Normed.Operator.Basic10import Mathlib.Data.Finset.Prod11import Mathlib.Data.Fintype.Sigma12import Mathlib.Data.Fin.Rev13import Mathlib.Data.Matrix.Block14import Mathlib.Data.Matrix.ColumnRowPartitioned15import Mathlib.Analysis.Matrix.Order16import Mathlib.Analysis.CStarAlgebra.Matrix17import Mathlib.LinearAlgebra.Matrix.Hermitian18import Mathlib.Tactic.Linarith19import Mathlib.Tactic.Positivity20import Mathlib.Tactic.Ring21import Mathlib.Tactic.NormNum22import Lean.Elab.Tactic.Omega2324/-!25# Algebraic and numerical steps in polynomial linearization2627This file proves the finite support bound, Gram factorization identities,28Hermitian dilation identities, the scalar backward-error calculation, and the29geometric word-count calculation used in Sections 3 and Appendix A of30`nonadditivity.tex`.3132The analytic existence of the positive block matrix with the stated operator33norm bound is not assumed globally or declared as an axiom here. The Gram34identities below apply to any supplied square-root factor; the error theorem35states its norm-identity hypotheses explicitly.36-/3738set_option backward.isDefEq.respectTransparency false3940namespace Nonadditivity.Linearization4142open scoped BigOperators4344section Support4546variable {G : Type*} [Group G] [DecidableEq G]4748/-- The finite set `S⁻¹ S`, represented without a pointwise-set convention. -/49def differenceSupport (S : Finset G) : Finset G :=50(S ×ˢ S).image (fun gh => gh.1⁻¹ * gh.2)5152@[simp] theorem mem_differenceSupport {S : Finset G} {w : G} :53w ∈ differenceSupport S ↔ ∃ g ∈ S, ∃ h ∈ S, g⁻¹ * h = w := by54simp only [differenceSupport, Finset.mem_image, Finset.mem_product]55constructor56· rintro ⟨⟨g,h⟩, ⟨hg,hh⟩, hw⟩57exact ⟨g,hg,h,hh,hw⟩58· rintro ⟨g,hg,h,hh,hw⟩59exact ⟨(g,h), ⟨hg,hh⟩, hw⟩6061/-- There are at most `B²` differences in a set of `B` elements. -/62theorem card_differenceSupport_le (S : Finset G) :63(differenceSupport S).card ≤ S.card ^ 2 := by64calc65(differenceSupport S).card ≤ (S ×ˢ S).card := Finset.card_image_le66_ = S.card ^ 2 := by simp [pow_two]6768/-- The adjoint support is covered by the same finite set. -/69theorem inv_mem_differenceSupport {S : Finset G} {w : G}70(hw : w ∈ differenceSupport S) : w⁻¹ ∈ differenceSupport S := by71obtain ⟨g,hg,h,hh,rfl⟩ := mem_differenceSupport.mp hw72apply mem_differenceSupport.mpr73exact ⟨h,hh,g,hg, by simp⟩7475omit [DecidableEq G] in76/-- Including the identity makes the support size at least one. -/77theorem one_le_card {S : Finset G} (hS : (1 : G) ∈ S) : 1 ≤ S.card :=78Finset.one_le_card.mpr ⟨1,hS⟩7980/-- A split word `a * b` factors as `(a⁻¹)⁻¹ * b`. -/81theorem split_mem_differenceSupport {S : Finset G} {a b : G}82(ha : a⁻¹ ∈ S) (hb : b ∈ S) : a * b ∈ differenceSupport S :=83mem_differenceSupport.mpr ⟨a⁻¹, ha, b, hb, by simp⟩8485end Support8687section Gram8889variable {ι κ ν : Type*} [Fintype ι] [Fintype κ] [Fintype ν]90variable {A : Type*} [NonUnitalSemiring A] [StarRing A]9192omit [Fintype ν] in93/-- Exact Gram identity for the evaluated square-root construction. -/94theorem gram_factorization (R : Matrix ι κ A) (V : Matrix κ ν A) :95(R * V).conjTranspose * (R * V) =96V.conjTranspose * (R.conjTranspose * R) * V := by97rw [Matrix.conjTranspose_mul]98simp only [Matrix.mul_assoc]99100omit [Fintype ν] in101/-- A square-root factor may be supplied as ordinary data. -/102theorem gram_factorization_of_sqrt (R : Matrix ι κ A) (G : Matrix κ κ A)103(V : Matrix κ ν A) (hR : R.conjTranspose * R = G) :104(R * V).conjTranspose * (R * V) = V.conjTranspose * G * V := by105rw [gram_factorization, hR]106107/-- The finite block evaluation in the manuscript, with noncommuting entries. -/108theorem column_gram_entry (G : Matrix κ κ A) (v : κ → A) :109let V : Matrix κ Unit A := fun g _ => v g110(V.conjTranspose * G * V) () () =111∑ g, ∑ h, star (v g) * G g h * v h := by112dsimp113simp only [Matrix.mul_apply, Matrix.conjTranspose_apply]114rw [Finset.sum_comm]115apply Finset.sum_congr rfl116intro g _117rw [Finset.sum_mul]118119end Gram120121section PositiveMatrices122123open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator124125variable {ι ν : Type*} [Fintype ι] [DecidableEq ι] [Fintype ν]126127/-- Finite-dimensional positivity provides the Gram square root. -/128theorem positive_sqrt_gram (G : Matrix ι ι ℂ) (hG : G.PosSemidef) :129(CFC.sqrt G).conjTranspose * CFC.sqrt G = G := by130rw [← Matrix.star_eq_conjTranspose,131(IsSelfAdjoint.of_nonneg (CFC.sqrt_nonneg G)).star_eq]132exact CFC.sqrt_mul_sqrt_self G hG.nonneg133134omit [Fintype ν] in135/-- Construct the evaluated factor using the positive matrix's actual square root. -/136theorem positive_gram_factorization (G : Matrix ι ι ℂ) (hG : G.PosSemidef)137(V : Matrix ι ν ℂ) :138∃ Q : Matrix ι ν ℂ, Q.conjTranspose * Q = V.conjTranspose * G * V := by139exact ⟨CFC.sqrt G * V,140gram_factorization_of_sqrt _ G V (positive_sqrt_gram G hG)⟩141142/-- The positive polar block is a compression of `P` by the column `(U*, I)`. -/143theorem polar_block_posSemidef (P U : Matrix ι ι ℂ) (hP : P.PosSemidef) :144(Matrix.fromBlocks (U * P * U.conjTranspose) (U * P)145(P * U.conjTranspose) P).PosSemidef := by146have h := hP.conjTranspose_mul_mul_same (Matrix.fromCols U.conjTranspose (1 : Matrix ι ι ℂ))147simpa [Matrix.conjTranspose_fromCols_eq_fromRows_conjTranspose,148Matrix.fromRows_mul_fromCols, Matrix.mul_assoc] using h149150/-- The appendix polar positivity step with the exact polar identities explicit. -/151theorem polar_block_posSemidef_of_identities (c p d u : Matrix ι ι ℂ)152(hp : p.PosSemidef) (hc : c = u * p) (hd : d = u * p * u.conjTranspose) :153(Matrix.fromBlocks d c c.conjTranspose p).PosSemidef := by154rw [hc, hd, Matrix.conjTranspose_mul, hp.1]155exact polar_block_posSemidef p u hp156157end PositiveMatrices158159section Dilation160161variable {ι : Type*} [Fintype ι]162variable {A : Type*} [NonUnitalSemiring A] [StarRing A]163164/-- The standard Hermitian dilation, at the matrix-algebra level. -/165def hermitianDilation (P : Matrix ι ι A) : Matrix (Sum ι ι) (Sum ι ι) A :=166Matrix.fromBlocks 0 P P.conjTranspose 0167168omit [Fintype ι] in169theorem hermitianDilation_isHermitian (P : Matrix ι ι A) :170(hermitianDilation P).IsHermitian := by171unfold hermitianDilation Matrix.IsHermitian172simp [Matrix.fromBlocks_conjTranspose]173174theorem hermitianDilation_sq (P : Matrix ι ι A) :175hermitianDilation P * hermitianDilation P =176Matrix.fromBlocks (P * P.conjTranspose) 0 0 (P.conjTranspose * P) := by177unfold hermitianDilation178simp [Matrix.fromBlocks_multiply]179180end Dilation181182section ErrorTransfer183184/-- The scalar calculation behind `e_old ≤ 6 B e_new`.185186`rN, rR` are the original two operator norms; `qN, qR` are the187factorized operator norms. All analytic input appears in `hN`, `hR`,188and `hTheta`, rather than as hidden axioms.189-/190theorem backward_error_transfer191(rN rR qN qR theta B e : ℝ)192(hqN : 0 ≤ qN) (_hqR : 0 ≤ qR) (hrR : 0 ≤ rR)193(hTheta0 : 0 ≤ theta) (hB : 1 ≤ B)194(he0 : 0 ≤ e) (he1 : e ≤ 1)195(hN : qN ^ 2 = rN + theta) (hR : qR ^ 2 = rR + theta)196(hTheta : theta ≤ B * rR)197(hQ : qN ≤ (1 + e) * qR) :198rN ≤ (1 + 6 * B * e) * rR := by199have hsq : qN ^ 2 ≤ ((1 + e) * qR) ^ 2 := by200exact pow_le_pow_left₀ hqN hQ 2201have heSq : e ^ 2 ≤ e := by nlinarith202have hError : ((1 + e) ^ 2 - 1) ≤ 3 * e := by nlinarith203have hSum : 0 ≤ rR + theta := add_nonneg hrR hTheta0204have hGrowth := mul_le_mul_of_nonneg_right hError hSum205have hPre : rN ≤ rR + 3 * e * (rR + theta) := by206nlinarith [hsq, hGrowth]207have hScale : 0 ≤ 3 * e := by positivity208have hBound := mul_le_mul_of_nonneg_left hTheta hScale209have hBScale : 3 * (1 + B) ≤ 6 * B := by linarith210have hBound' := mul_le_mul_of_nonneg_right hBScale (mul_nonneg he0 hrR)211nlinarith [hPre, hBound, hBound']212213/-- Initial Gram reduction has additive constant one. -/214theorem initial_backward_error215(rN rR qN qR e : ℝ)216(hqN : 0 ≤ qN) (hrR : 0 ≤ rR)217(he0 : 0 ≤ e) (he1 : e ≤ 1)218(hN : qN ^ 2 = rN + 1) (hR : qR ^ 2 = rR + 1)219(hQ : qN ≤ (1 + e) * qR) :220rN - rR ≤ 3 * e * (1 + rR) := by221have hsq := pow_le_pow_left₀ hqN hQ 2222have heSq : e ^ 2 ≤ e := by nlinarith223have hError : (1 + e) ^ 2 - 1 ≤ 3 * e := by nlinarith224have hGrowth := mul_le_mul_of_nonneg_right hError (show 0 ≤ 1 + rR by linarith)225nlinarith [hsq, hGrowth]226227/-- Nonnegative relative excess used for every intermediate polynomial. -/228noncomputable def relativeNormError (a b : ℝ) : ℝ := max 0 (a / b - 1)229230@[simp] theorem relativeNormError_nonneg (a b : ℝ) : 0 ≤ relativeNormError a b :=231le_max_left _ _232233/-- Convert between a relative-error number and a multiplicative norm bound. -/234theorem relativeNormError_le_iff (a b e : ℝ) (hb : 0 < b) (he : 0 ≤ e) :235relativeNormError a b ≤ e ↔ a ≤ (1 + e) * b := by236unfold relativeNormError237rw [max_le_iff]238constructor239· intro h240have hdiv : a / b ≤ 1 + e := by linarith [h.2]241have hmul := (div_le_iff₀ hb).mp hdiv242nlinarith243· intro h244refine ⟨he, ?_⟩245have hdiv : a / b ≤ 1 + e := (div_le_iff₀ hb).mpr (by nlinarith)246linarith247248/-- The backward-error statement in exactly the `max(0, ratio - 1)` convention. -/249theorem relative_backward_error_transfer250(rN rR qN qR theta B : ℝ)251(hqN : 0 ≤ qN) (hqR : 0 ≤ qR) (hrR : 0 < rR)252(hTheta0 : 0 ≤ theta) (hB : 1 ≤ B)253(hN : qN ^ 2 = rN + theta) (hR : qR ^ 2 = rR + theta)254(hTheta : theta ≤ B * rR)255(hError : relativeNormError qN qR ≤ 1) :256relativeNormError rN rR ≤ 6 * B * relativeNormError qN qR := by257have hqRpos : 0 < qR := by nlinarith258have he0 := relativeNormError_nonneg qN qR259have hQ := (relativeNormError_le_iff qN qR (relativeNormError qN qR) hqRpos he0).mp le_rfl260apply (relativeNormError_le_iff rN rR _ hrR (by positivity)).mpr261exact backward_error_transfer rN rR qN qR theta B _ hqN hqR hrR.le262hTheta0 hB he0 hError hN hR hTheta hQ263264/-- Compose an arbitrary finite sequence of nonnegative backward-error factors. -/265theorem backward_error_chain (n : ℕ) (F e : ℕ → ℝ)266(hF : ∀ i < n, 0 ≤ F i) (hStep : ∀ i < n, e i ≤ F i * e (i + 1)) :267e 0 ≤ (∏ i ∈ Finset.range n, F i) * e n := by268induction n with269| zero => simp270| succ n ih =>271have hPrefix : e 0 ≤ (∏ i ∈ Finset.range n, F i) * e n :=272ih (fun i hi => hF i (by omega)) (fun i hi => hStep i (by omega))273have hProd : 0 ≤ ∏ i ∈ Finset.range n, F i :=274Finset.prod_nonneg (fun i hi => hF i (by have := Finset.mem_range.mp hi; omega))275calc276e 0 ≤ (∏ i ∈ Finset.range n, F i) * e n := hPrefix277_ ≤ (∏ i ∈ Finset.range n, F i) * (F n * e (n + 1)) :=278mul_le_mul_of_nonneg_left (hStep n (by omega)) hProd279_ = (∏ i ∈ Finset.range (n + 1), F i) * e (n + 1) := by280rw [Finset.prod_range_succ]281ring282283end ErrorTransfer284285section OperatorCauchySchwarz286287variable {ι : Type*} {E F 𝕜 : Type*}288variable [NontriviallyNormedField 𝕜] [SeminormedAddCommGroup E] [SeminormedAddCommGroup F]289variable [NormedSpace 𝕜 E] [NormedSpace 𝕜 F]290291/-- The vector Cauchy–Schwarz step used to control the additive constant. -/292theorem norm_sum_sq_le_card_sum_sq (s : Finset ι) (v : ι → F) :293‖∑ i ∈ s, v i‖ ^ 2 ≤ (s.card : ℝ) * ∑ i ∈ s, ‖v i‖ ^ 2 := by294calc295‖∑ i ∈ s, v i‖ ^ 2 ≤ (∑ i ∈ s, ‖v i‖) ^ 2 :=296pow_le_pow_left₀ (norm_nonneg _) (norm_sum_le s v) 2297_ ≤ (∑ i ∈ s, ‖v i‖ ^ 2) * (∑ _i ∈ s, (1 : ℝ) ^ 2) := by298simpa using Finset.sum_mul_sq_le_sq_mul_sq s (fun i => ‖v i‖) (fun _ => (1 : ℝ))299_ = (s.card : ℝ) * ∑ i ∈ s, ‖v i‖ ^ 2 := by simp [mul_comm]300301/-- A quadratic energy bound controls the sum's operator norm by `√|S| ρ`. -/302theorem operator_sum_norm_le_sqrt_card (s : Finset ι) (T : ι → E →L[𝕜] F)303(rho : ℝ) (hrho : 0 ≤ rho)304(hEnergy : ∀ x : E, ∑ i ∈ s, ‖T i x‖ ^ 2 ≤ rho ^ 2 * ‖x‖ ^ 2) :305‖∑ i ∈ s, T i‖ ≤ Real.sqrt (s.card : ℝ) * rho := by306apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg (Real.sqrt_nonneg _) hrho)307intro x308have h1 := norm_sum_sq_le_card_sum_sq s (fun i => T i x)309have h2 := mul_le_mul_of_nonneg_left (hEnergy x) (show 0 ≤ (s.card : ℝ) by positivity)310have h3 : (Real.sqrt (s.card : ℝ) * rho * ‖x‖) ^ 2 =311(s.card : ℝ) * rho ^ 2 * ‖x‖ ^ 2 := by312rw [mul_pow, mul_pow, Real.sq_sqrt (by positivity)]313have hTarget : 0 ≤ Real.sqrt (s.card : ℝ) * rho * ‖x‖ := by positivity314simp only [ContinuousLinearMap.sum_apply]315nlinarith [norm_nonneg (∑ i ∈ s, T i x)]316317/-- The manuscript's `θ ≤ Bρ` follows once the coefficient energy bound318and `|W| ≤ B²` have been supplied. -/319theorem operator_sum_norm_le_support_size (s : Finset ι) (T : ι → E →L[𝕜] F)320(rho B : ℝ) (hrho : 0 ≤ rho) (hB : 0 ≤ B)321(hCard : (s.card : ℝ) ≤ B ^ 2)322(hEnergy : ∀ x : E, ∑ i ∈ s, ‖T i x‖ ^ 2 ≤ rho ^ 2 * ‖x‖ ^ 2) :323‖∑ i ∈ s, T i‖ ≤ B * rho := by324calc325‖∑ i ∈ s, T i‖ ≤ Real.sqrt (s.card : ℝ) * rho :=326operator_sum_norm_le_sqrt_card s T rho hrho hEnergy327_ ≤ B * rho := mul_le_mul_of_nonneg_right (Real.sqrt_le_iff.mpr ⟨hB,hCard⟩) hrho328329/-- Specialize the coefficient-energy estimate to the actual difference support;330the cardinal bound needed here is proved from `S`, rather than supplied. -/331theorem operator_sum_norm_le_differenceSupport332{G : Type*} [Group G] [DecidableEq G]333(S : Finset G) (T : G → E →L[𝕜] F) (rho : ℝ) (hrho : 0 ≤ rho)334(hEnergy : ∀ x : E, ∑ w ∈ differenceSupport S, ‖T w x‖ ^ 2 ≤ rho ^ 2 * ‖x‖ ^ 2) :335‖∑ w ∈ differenceSupport S, T w‖ ≤ (S.card : ℝ) * rho := by336apply operator_sum_norm_le_support_size _ T rho (S.card : ℝ) hrho (by positivity) ?_ hEnergy337exact_mod_cast card_differenceSupport_le S338339end OperatorCauchySchwarz340341section HilbertCoefficientEnergy342343variable {ι E F 𝕜 : Type*} [RCLike 𝕜]344variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [CompleteSpace E]345variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F] [CompleteSpace F]346347/-- A bound on the coefficient Gram operator gives the precise quadratic energy348estimate used in the appendix's operator Cauchy–Schwarz argument. -/349theorem coefficient_energy_le_of_gram_norm350(s : Finset ι) (T : ι → E →L[𝕜] F) (rho : ℝ)351(hGram : ‖∑ i ∈ s, ContinuousLinearMap.adjoint (T i) ∘L T i‖ ≤ rho ^ 2)352(x : E) :353∑ i ∈ s, ‖T i x‖ ^ 2 ≤ rho ^ 2 * ‖x‖ ^ 2 := by354let G : E →L[𝕜] E := ∑ i ∈ s, ContinuousLinearMap.adjoint (T i) ∘L T i355have hNorm : ‖G‖ ≤ rho ^ 2 := hGram356calc357(∑ i ∈ s, ‖T i x‖ ^ 2) = RCLike.re (inner 𝕜 (G x) x) := by358simp only [G, ContinuousLinearMap.sum_apply, sum_inner, map_sum]359apply Finset.sum_congr rfl360intro i _361exact ContinuousLinearMap.apply_norm_sq_eq_inner_adjoint_left (T i) x362_ ≤ ‖G x‖ * ‖x‖ := re_inner_le_norm _ _363_ ≤ (‖G‖ * ‖x‖) * ‖x‖ :=364mul_le_mul_of_nonneg_right (G.le_opNorm x) (norm_nonneg _)365_ ≤ rho ^ 2 * ‖x‖ ^ 2 := by366have h := mul_le_mul_of_nonneg_right hNorm (sq_nonneg ‖x‖)367nlinarith368369/-- Operator Cauchy–Schwarz, with a Gram-operator hypothesis rather than a370pointwise energy hypothesis. -/371theorem operator_sum_norm_le_of_gram_norm372(s : Finset ι) (T : ι → E →L[𝕜] F) (rho : ℝ) (hrho : 0 ≤ rho)373(hGram : ‖∑ i ∈ s, ContinuousLinearMap.adjoint (T i) ∘L T i‖ ≤ rho ^ 2) :374‖∑ i ∈ s, T i‖ ≤ Real.sqrt (s.card : ℝ) * rho :=375operator_sum_norm_le_sqrt_card s T rho hrho376(coefficient_energy_le_of_gram_norm s T rho hGram)377378end HilbertCoefficientEnergy379380section Counts381382/-- The four oriented letters of a free group on two generators. -/383abbrev Letter := Fin 4384385/-- `0 ↔ 3` and `1 ↔ 2` form the two inverse pairs. -/386def inverseLetter (a : Letter) : Letter := a.rev387388@[simp] theorem inverseLetter_inverse (a : Letter) :389inverseLetter (inverseLetter a) = a := by simp [inverseLetter]390391theorem inverseLetter_ne (a : Letter) : inverseLetter a ≠ a := by392have h : ∀ b : Letter, inverseLetter b ≠ b := by decide393exact h a394395/-- Legal letters following `a`: all letters except its inverse. -/396abbrev FollowingLetter (a : Letter) := {b : Letter // b ≠ inverseLetter a}397398@[simp] theorem card_followingLetter (a : Letter) :399Fintype.card (FollowingLetter a) = 3 := by400simp [FollowingLetter, Fintype.card_subtype_compl]401402/-- A genuine reduced tail; each next letter excludes the previous inverse. -/403def ReducedTail (a : Letter) : ℕ → Type404| 0 => Unit405| n + 1 => Σ b : FollowingLetter a, ReducedTail b.val n406407noncomputable instance reducedTailFintype (a : Letter) (n : ℕ) :408Fintype (ReducedTail a n) := by409induction n generalizing a with410| zero => exact inferInstanceAs (Fintype Unit)411| succ n ih =>412change Fintype (Σ b : FollowingLetter a, ReducedTail b.val n)413letI : ∀ b : FollowingLetter a, Fintype (ReducedTail b.val n) := fun b => ih b.val414infer_instance415416/-- Exactly three choices are available for each subsequent letter. -/417@[simp] theorem card_reducedTail (a : Letter) (n : ℕ) :418Fintype.card (ReducedTail a n) = 3 ^ n := by419induction n generalizing a with420| zero => simp [ReducedTail]421| succ n ih =>422change Fintype.card (Σ b : FollowingLetter a, ReducedTail b.val n) = _423rw [Fintype.card_sigma]424simp [ih, pow_succ, mul_comm]425426/-- A nonempty reduced word of length `t+1` is its first letter and reduced tail. -/427abbrev ReducedWord (t : ℕ) := Σ a : Letter, ReducedTail a t428429/-- Exact count of reduced words of length `t+1`. -/430theorem card_reducedWord (t : ℕ) : Fintype.card (ReducedWord t) = 4 * 3 ^ t := by431simp [ReducedWord, Fintype.card_sigma, mul_comm]432433434/-- Four choices for the first letter and three for each succeeding letter. -/435theorem reduced_word_geometric_sum (r : ℕ) :436(∑ t ∈ Finset.range r, 4 * 3 ^ t) + 2 = 2 * 3 ^ r := by437induction r with438| zero => simp439| succ r ih =>440rw [Finset.sum_range_succ, pow_succ]441omega442443/-- The numerical bound `1 + n ∑ 4·3ᵗ ≤ 2 n 3ʳ`, for `n ≥ 1`. -/444theorem short_word_count_bound (n r : ℕ) (hn : 1 ≤ n) :4451 + n * (∑ t ∈ Finset.range r, 4 * 3 ^ t) ≤ 2 * n * 3 ^ r := by446have h := reduced_word_geometric_sum r447have heq : n * ((∑ t ∈ Finset.range r, 4 * 3 ^ t) + 2) =448n * (2 * 3 ^ r) := congrArg (n * ·) h449nlinarith450451end Counts452453end Nonadditivity.Linearization