Exact Lean source
Nonadditivity.QuadraticNet
Download original .lean · View on GitHub · Jump to source
Direct imports
Nonadditivity.ObservableDimensionMathlib.LinearAlgebra.Complex.FiniteDimensionaldependencyMathlib.Analysis.InnerProductSpace.Rayleighdependency
Imported by project modules
2 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
8 project constants, including generated, internal and private declarations.
8 declarations
Nonadditivity.QuadraticNet.exists_complex_input_netNonadditivity.QuadraticNet.exists_netNonadditivity.QuadraticNet.exists_observable_netNonadditivity.QuadraticNet.exists_observable_net._proof_1_1internal/detail/privateNonadditivity.QuadraticNet.matrix_norm_le_of_unitSphereNetNonadditivity.QuadraticNet.norm_le_of_unitSphereNetNonadditivity.QuadraticNet.norm_le_of_unit_quadraticNonadditivity.QuadraticNet.quadratic_difference
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Nonadditivity.ObservableDimension7import Mathlib.LinearAlgebra.Complex.FiniteDimensional8import Mathlib.Analysis.InnerProductSpace.Rayleigh910/-! Quadratic tests on a finite sphere net control the norm of an actual symmetric operator. -/11noncomputable section12set_option backward.isDefEq.respectTransparency false13set_option linter.unusedSectionVars false14namespace Nonadditivity.QuadraticNet15open scoped InnerProductSpace16variable {F : Type*} [NormedAddCommGroup F] [InnerProductSpace ℝ F]1718/-- Quadratic forms have a dimension-independent Lipschitz bound on the unit sphere. -/19theorem quadratic_difference (T : F →L[ℝ] F) (x y : F) :20|⟪T x,x⟫_ℝ-⟪T y,y⟫_ℝ| ≤ ‖T‖*‖x-y‖*(‖x‖+‖y‖) := by21have heq : ⟪T x,x⟫_ℝ-⟪T y,y⟫_ℝ = ⟪T (x-y),x⟫_ℝ+⟪T y,x-y⟫_ℝ := by22simp only [map_sub,inner_sub_left,inner_sub_right]23ring24rw [heq]25calc26|⟪T (x-y),x⟫_ℝ+⟪T y,x-y⟫_ℝ| ≤ |⟪T (x-y),x⟫_ℝ|+|⟪T y,x-y⟫_ℝ| := abs_add_le _ _27_ ≤ (‖T‖*‖x-y‖)*‖x‖+(‖T‖*‖y‖)*‖x-y‖ := by28apply add_le_add29· exact (abs_real_inner_le_norm _ _).trans30(mul_le_mul_of_nonneg_right (T.le_opNorm _) (norm_nonneg _))31· exact (abs_real_inner_le_norm _ _).trans32(mul_le_mul_of_nonneg_right (T.le_opNorm _) (norm_nonneg _))33_ = _ := by ring3435theorem norm_le_of_unit_quadratic (T : F →L[ℝ] F) (hT : T.IsSymmetric)36{C : ℝ} (hC : 0≤C) (hquad : ∀x:F, ‖x‖=1 → |⟪T x,x⟫_ℝ|≤C) : ‖T‖≤C := by37rw [T.norm_eq_iSup_rayleighQuotient hT]38apply ciSup_le39intro x40by_cases hx:x=041· simpa [hx] using hC42· have hxnorm : ‖x‖≠0 := norm_ne_zero_iff.mpr hx43have hu : ‖‖x‖⁻¹ • x‖=1 := by simp [norm_smul,hxnorm]44have h := hquad (‖x‖⁻¹ • x) hu45have hr := T.rayleigh_smul x (inv_ne_zero hxnorm)46rw [←hr]47simpa only [ContinuousLinearMap.rayleighQuotient,ContinuousLinearMap.reApplyInnerSelf_apply,48RCLike.re_to_real,hu,one_pow,div_one] using h4950/-- The actual quadratic net loss is `1/(1-2δ)`. -/51theorem norm_le_of_unitSphereNet (T : F →L[ℝ] F) (hT : T.IsSymmetric)52{tests : Finset F} {δ C : ℝ} (hδ : 0≤δ) (hδhalf : δ<1/2) (hC : 0≤C)53(hunit : ∀y∈tests, ‖y‖=1) (hnet : UnitSphereNet tests δ)54(htests : ∀y∈tests, |⟪T y,y⟫_ℝ|≤C) : ‖T‖≤C/(1-2*δ) := by55have hbound : ‖T‖≤C+2*δ*‖T‖ := by56apply norm_le_of_unit_quadratic T hT (by positivity)57intro x hx58obtain ⟨y,hy,hxy⟩ := hnet x hx59have hdist : ‖x-y‖≤δ := by simpa only [dist_eq_norm] using hxy60have hd := quadratic_difference T x y61rw [hx,hunit y hy] at hd62have hq : |⟪T x,x⟫_ℝ|≤|⟪T x,x⟫_ℝ-⟪T y,y⟫_ℝ|+|⟪T y,y⟫_ℝ| :=63calc64|⟪T x,x⟫_ℝ| = |(⟪T x,x⟫_ℝ-⟪T y,y⟫_ℝ)+⟪T y,y⟫_ℝ| := by congr 1; ring65_ ≤ _ := abs_add_le _ _66have hm := mul_le_mul_of_nonneg_left hdist (norm_nonneg T)67linarith [htests y hy]68exact (le_div_iff₀ (by linarith)).mpr (by nlinarith)6970/-- Actual finite sphere nets, with the proved volume cardinality estimate. -/71theorem exists_net {δ : ℝ} (hδ : 0<δ) (hδtwo : δ<2) [FiniteDimensional ℝ F] :72∃tests : Finset F, (∀x∈tests,‖x‖=1) ∧ UnitSphereNet tests δ ∧73(tests.card:ℝ) ≤ (1+2/δ)^Module.finrank ℝ F := by74classical75obtain ⟨tests,_,hunit,_,_,hnet,hcard⟩ :=76QuantitativeNet.exists_symmetric_unitSphereNet_containing (∅:Finset F) hδ hδtwo77(by simp) (by simp) (by simp)78exact ⟨tests,hunit,hnet,hcard⟩7980/-- A quarter-net of the complex input sphere has at most `9^(2D)` tests. -/81theorem exists_complex_input_net (D : Type*) [Fintype D] :82∃tests : Finset (EuclideanSpace ℂ D), (∀x∈tests,‖x‖=1) ∧83UnitSphereNet tests (1/4) ∧ tests.card ≤ 9^(2*Fintype.card D) := by84have hdim : Module.finrank ℝ (EuclideanSpace ℂ D) = 2*Fintype.card D := by85rw [←Module.finrank_mul_finrank ℝ ℂ (EuclideanSpace ℂ D)]86simp87obtain ⟨tests,hunit,hnet,hcard⟩ := exists_net (F := EuclideanSpace ℂ D)88(show (0:ℝ)<1/4 by norm_num) (by norm_num)89refine ⟨tests,hunit,hnet,?_⟩90rw [hdim] at hcard91norm_num at hcard92exact_mod_cast hcard9394/-- A half-net of traceless Hermitian HS-unit observables has at most `5^(K²)` tests. -/95theorem exists_observable_net (B : Type*) [Fintype B] [DecidableEq B] [Nonempty B] :96∃tests : Finset (FiniteRealization.ObservableSpace B), (∀x∈tests,‖x‖=1) ∧97UnitSphereNet tests (1/2) ∧ tests.card ≤ 5^(Fintype.card B)^2 := by98obtain ⟨tests,hunit,hnet,hcard⟩ := exists_net (F := FiniteRealization.ObservableSpace B)99(show (0:ℝ)<1/2 by norm_num) (by norm_num)100refine ⟨tests,hunit,hnet,?_⟩101rw [ObservableDimension.observableSpace_finrank] at hcard102norm_num at hcard103have hsmall : tests.card ≤ 5^(Fintype.card B^2-1) := by exact_mod_cast hcard104exact hsmall.trans (Nat.pow_le_pow_right (by omega) (Nat.sub_le _ _))105106open scoped Matrix.Norms.L2Operator107108/-- Complex Hermitian matrix version, with the Euclidean operator norm and literal quadratic form. -/109theorem matrix_norm_le_of_unitSphereNet {D : Type*} [Fintype D] [DecidableEq D]110(A : Matrix D D ℂ) (hA : A.IsHermitian)111{tests : Finset (EuclideanSpace ℂ D)} {δ C : ℝ}112(hδ : 0≤δ) (hδhalf : δ<1/2) (hC : 0≤C)113(hunit : ∀x∈tests,‖x‖=1) (hnet : UnitSphereNet tests δ)114(htests : ∀x∈tests, |(⟪(Matrix.toEuclideanCLM (n := D) (𝕜 := ℂ)) A x,x⟫_ℂ).re|≤C) :115‖A‖≤C/(1-2*δ) := by116letI : InnerProductSpace ℝ (EuclideanSpace ℂ D) := InnerProductSpace.rclikeToReal ℂ _117let T := ((Matrix.toEuclideanCLM (n := D) (𝕜 := ℂ)) A).restrictScalars ℝ118have hT : T.IsSymmetric := (Matrix.isHermitian_iff_isSymmetric.mp hA).restrictScalars119have h := norm_le_of_unitSphereNet T hT hδ hδhalf hC hunit hnet (by120intro x hx121simpa only [T,ContinuousLinearMap.coe_restrictScalars,real_inner_eq_re_inner]122using htests x hx)123exact h124125end Nonadditivity.QuadraticNet