module public import Aesop.BuiltinRules public import Mathlib.Analysis.CStarAlgebra.Module.Constructions public import Mathlib.Order.CompletePartialOrder import Mathlib.Algebra.Order.Star.Int import Mathlib.Algebra.Order.Star.Real import Mathlib.Analysis.InnerProductSpace.Trace import Mathlib.RingTheory.Coalgebra.CoassocSimps public import TauCeti.LinearAlgebra.Spreading import TauCeti.Analysis.InnerProductSpace.NearIsometry.SecondMoment public import Lib.Speed /-! # Few translates fill Let a finite group act unitarily on `T`, let `pr₀` be the projection onto a stable subspace `T₀`, and let `B : S → T` be linear. Suppose that `pr₀ B` is almost an isometry from below in mean square and that the second moment of the operators `B* s B` is nearly as small as Cauchy–Schwarz allows. Then a few translates `s pr₀ B` span almost all of `T₀`. In this file `‖A‖`, written of a linear map `A`, is its Hilbert–Schmidt norm. * `New.hilbertSchmidtNorm`, `New.IsNearIsometry`: the Hilbert–Schmidt norm, and the first hypothesis. * `New.isSpread_of_second_moment`: for any subspace `W` of `T₀`, the preimage of `W` under some translate `s pr₀ B` is small, in terms of the share of `W` in `T₀` (`TauCeti.IsSpread`). * `TauCeti.IsSpread.exists_card_mul_finrank_le_and_le_finrank_biSup_range`: a logarithm times `dim T₀ / dim S` translates span almost all of `T₀`. ## Relation to the literature Rank bounds from second moments: Welch 1974. Greedy covering with a logarithmic loss: Wolsey, Greedy algorithm for the submodular set covering problem, 1982. -/ @[expose] public section open Module LinearMap Finset open scoped InnerProductSpace namespace New section HilbertSchmidt open Complex variable {S T T' : Type} [NormedAddCommGroup S] [InnerProductSpace ℂ S] [FiniteDimensional ℂ S] [NormedAddCommGroup T] [InnerProductSpace ℂ T] [FiniteDimensional ℂ T] [NormedAddCommGroup T'] [InnerProductSpace ℂ T'] [FiniteDimensional ℂ T'] /-- The values of a linear map on an orthonormal basis of the source, as one vector of a Hilbert space. Its inner product is the Hilbert–Schmidt inner product of maps. -/ noncomputable def hilbertSchmidtVector : (S →ₗ[ℂ] T) →ₗ[ℂ] PiLp 2 fun _ : Fin (finrank ℂ S) ↦ T where toFun A := WithLp.toLp 2 fun i ↦ A (stdOrthonormalBasis ℂ S i) map_add' _ _ := rfl map_smul' _ _ := rfl /-- The Hilbert–Schmidt norm of a linear map. -/ noncomputable def hilbertSchmidtNorm (A : S →ₗ[ℂ] T) : ℝ := ‖hilbertSchmidtVector A‖ omit [FiniteDimensional ℂ T] in /-- The Hilbert–Schmidt norm is nonnegative. -/ lemma hilbertSchmidtNorm_nonneg (A : S →ₗ[ℂ] T) : 0 ≤ hilbertSchmidtNorm A := norm_nonneg _ /-- The inner product of `hilbertSchmidtVector A` and `hilbertSchmidtVector B`, the vectors of the values of `A` and `B` on an orthonormal basis, is the trace of `A* B`: the Hilbert–Schmidt inner product. -/ lemma inner_hilbertSchmidtVector (A B : S →ₗ[ℂ] T) : ⟪hilbertSchmidtVector A, hilbertSchmidtVector B⟫_ℂ = trace ℂ S (A.adjoint ∘ₗ B) := by rw [trace_eq_sum_inner _ (stdOrthonormalBasis ℂ S), PiLp.inner_apply] exact sum_congr rfl fun i _ ↦ (adjoint_inner_right A _ _).symm /-- The square of the Hilbert–Schmidt norm of `A`, as a complex number, is the trace of `A* A`. -/ lemma hilbertSchmidtNorm_sq_eq_trace (A : S →ₗ[ℂ] T) : ((hilbertSchmidtNorm A ^ 2 : ℝ) : ℂ) = trace ℂ S (A.adjoint ∘ₗ A) := by simp [← inner_hilbertSchmidtVector, hilbertSchmidtNorm, inner_self_eq_norm_sq_to_K] /-- The squared Hilbert–Schmidt norm of `A` is the sum of `‖A (b i)‖ ^ 2` over the vectors `b i` of any orthonormal basis `b` of `S`. -/ lemma hilbertSchmidtNorm_sq_eq_sum {ι : Type} [Fintype ι] (b : OrthonormalBasis ι ℂ S) (A : S →ₗ[ℂ] T) : hilbertSchmidtNorm A ^ 2 = ∑ i : ι, ‖A (b i)‖ ^ 2 := by apply ofReal_injective rw [hilbertSchmidtNorm_sq_eq_trace, trace_eq_sum_inner _ b, ofReal_sum] simp [inner_self_eq_norm_sq_to_K, adjoint_inner_right] open TauCeti.UnitarilyInvariantSeminorm /-- `hilbertSchmidtNorm` has the same square as Tau Ceti's Frobenius seminorm. -/ private lemma hilbertSchmidtNorm_sq_eq_sq_frobenius (A : S →ₗ[ℂ] T) : hilbertSchmidtNorm A ^ 2 = TauCeti.UnitarilyInvariantSeminorm.frobenius ℂ S T A ^ 2 := (hilbertSchmidtNorm_sq_eq_sum (stdOrthonormalBasis ℂ S) A).trans (sq_frobenius_apply (stdOrthonormalBasis ℂ S) A).symm /-- The squared Hilbert–Schmidt norm is the sum of the squared moduli of the matrix entries. -/ lemma hilbertSchmidtNorm_sq_eq_sum_entries {ι κ : Type} [Fintype ι] [Fintype κ] (b : OrthonormalBasis ι ℂ S) (c : OrthonormalBasis κ ℂ T) (A : S →ₗ[ℂ] T) : hilbertSchmidtNorm A ^ 2 = ∑ j : κ, ∑ i : ι, ‖⟪A (b i), c j⟫_ℂ‖ ^ 2 := by rw [hilbertSchmidtNorm_sq_eq_sum b, sum_comm] exact sum_congr rfl fun i _ ↦ (c.sum_sq_norm_inner_left _).symm /-- A linear map and its adjoint have the same Hilbert–Schmidt norm. -/ lemma hilbertSchmidtNorm_adjoint (A : S →ₗ[ℂ] T) : hilbertSchmidtNorm A.adjoint = hilbertSchmidtNorm A := by rw [← sq_eq_sq₀ (hilbertSchmidtNorm_nonneg _) (hilbertSchmidtNorm_nonneg _), ← ofReal_inj, hilbertSchmidtNorm_sq_eq_trace, hilbertSchmidtNorm_sq_eq_trace, adjoint_adjoint, trace_comp_comm'] /-- If `‖A x‖ ≤ ‖B x‖` for all `x`, then the Hilbert–Schmidt norm of `A` is at most that of `B`. -/ lemma hilbertSchmidtNorm_le_of_norm_le {A : S →ₗ[ℂ] T} {B : S →ₗ[ℂ] T'} (h_le : ∀ x : S, ‖A x‖ ≤ ‖B x‖) : hilbertSchmidtNorm A ≤ hilbertSchmidtNorm B := by rw [← sq_le_sq₀ (hilbertSchmidtNorm_nonneg _) (hilbertSchmidtNorm_nonneg _), hilbertSchmidtNorm_sq_eq_sum (stdOrthonormalBasis ℂ S), hilbertSchmidtNorm_sq_eq_sum (stdOrthonormalBasis ℂ S)] exact sum_le_sum fun i _ ↦ pow_le_pow_left₀ (norm_nonneg _) (h_le _) 2 /-- The orthogonal projection onto a subspace, as the linear map under `starProjection`. -/ noncomputable def orthoProj (U : Submodule ℂ S) : S →ₗ[ℂ] S := U.starProjection /-- `A` is almost an isometry from below in mean square, with the error `ε`: on every subspace `U` its squared Hilbert–Schmidt norm `‖A pr_U‖²` is at least `dim U - ε dim S`. -/ def IsNearIsometry (A : S →ₗ[ℂ] T) (ε : ℝ) : Prop := ∀ U : Submodule ℂ S, finrank ℂ U - ε * finrank ℂ S ≤ hilbertSchmidtNorm (A ∘ₗ orthoProj U) ^ 2 /-- The near-isometry bound expressed with Tau Ceti's Frobenius seminorm. -/ private lemma isNearIsometry_iff_frobenius (A : S →ₗ[ℂ] T) (ε : ℝ) : IsNearIsometry A ε ↔ A.IsNearIsometry ε := by simp only [IsNearIsometry, LinearMap.isNearIsometry_iff, hilbertSchmidtNorm_sq_eq_sq_frobenius, orthoProj] /-- If the squared Hilbert–Schmidt norm of `A* A - 1` is at most `ε² dim S`, then `IsNearIsometry A ε`: on every subspace `U` the squared Hilbert–Schmidt norm of `A` is at least `dim U - ε dim S`. -/ lemma isNearIsometry_of_hilbertSchmidtNorm_le {A : S →ₗ[ℂ] T} {ε : ℝ} (hε : 0 ≤ ε) (h_defect : hilbertSchmidtNorm (A.adjoint ∘ₗ A - 1) ^ 2 ≤ ε ^ 2 * finrank ℂ S) : IsNearIsometry A ε := by apply (isNearIsometry_iff_frobenius A ε).2 exact LinearMap.isNearIsometry_of_sq_frobenius_le hε (by simpa only [hilbertSchmidtNorm_sq_eq_sq_frobenius] using h_defect) omit [FiniteDimensional ℂ T] in /-- A near isometry with the error `ε` is one with any larger error. -/ lemma IsNearIsometry.mono {A : S →ₗ[ℂ] T} {ε ε' : ℝ} (hA : IsNearIsometry A ε) (h_le : ε ≤ ε') : IsNearIsometry A ε' := fun U ↦ le_trans (by gcongr) (hA U) /-- Let `pr₀` be any endomorphism. If `pr₀ B` is almost an isometry from below in mean square, with an error `ε` below `1`, and the source `S` is not zero, then the range of `pr₀` is not zero. -/ lemma IsNearIsometry.finrank_range_pos [Nontrivial S] {pr₀ : T →ₗ[ℂ] T} {B : S →ₗ[ℂ] T} {ε : ℝ} (h_isom : IsNearIsometry (pr₀ ∘ₗ B) ε) (hε : ε < 1) : 0 < finrank ℂ (range pr₀) := by -- Otherwise `pr₀ = 0`, so the composite vanishes, contradicting near-isometry for `ε < 1`. have h_ne := ((isNearIsometry_iff_frobenius _ _).1 h_isom).ne_zero hε refine Nat.pos_of_ne_zero fun h_zero ↦ ?_ obtain rfl : pr₀ = 0 := range_eq_bot.1 (Submodule.finrank_eq_zero.1 h_zero) exact h_ne (by simp) /-- For an orthogonal projection `p` and any `q`: in squared Hilbert–Schmidt norm, the part `(1 - p q) A` that `p q` misses is at most the sum of the parts that `p` and `q` miss. -/ lemma hilbertSchmidtNorm_one_sub_mul_comp_sq_le {p : T →ₗ[ℂ] T} (hp : p.IsSymmetricProjection) (q : T →ₗ[ℂ] T) (A : S →ₗ[ℂ] T) : hilbertSchmidtNorm ((1 - p * q) ∘ₗ A) ^ 2 ≤ hilbertSchmidtNorm ((1 - p) ∘ₗ A) ^ 2 + hilbertSchmidtNorm ((1 - q) ∘ₗ A) ^ 2 := by simpa only [hilbertSchmidtNorm_sq_eq_sq_frobenius] using sq_frobenius_one_sub_mul_comp_le hp q A /-- Let `IsNearIsometry A ε`: `dim U - ε dim S ≤ ‖A pr_U‖²` in Hilbert–Schmidt norm for all subspaces `U`. If an orthogonal projection `pr` misses at most `δ dim S` of the squared norm of `A`, then `IsNearIsometry (pr A) (ε + δ)`. -/ lemma IsNearIsometry.proj_comp {A : S →ₗ[ℂ] T} {ε δ : ℝ} (hA : IsNearIsometry A ε) {pr : T →ₗ[ℂ] T} (hpr : pr.IsSymmetricProjection) (h_rest : hilbertSchmidtNorm ((1 - pr) ∘ₗ A) ^ 2 ≤ δ * finrank ℂ S) : IsNearIsometry (pr ∘ₗ A) (ε + δ) := by apply (isNearIsometry_iff_frobenius _ _).2 exact ((isNearIsometry_iff_frobenius A ε).1 hA).comp_of_isSymmetricProjection hpr (by simpa only [hilbertSchmidtNorm_sq_eq_sq_frobenius] using h_rest) variable {Γ : Type} [Group Γ] {ρ : Representation ℂ Γ T} /-- If `ρ` preserves the inner product on `T`, the adjoint of `ρ s` is `ρ s⁻¹`. -/ lemma adjoint_rep_of_unitary (hρ : ∀ (s : Γ) (x y : T), ⟪ρ s x, ρ s y⟫_ℂ = ⟪x, y⟫_ℂ) (s : Γ) : (ρ s).adjoint = ρ s⁻¹ := by refine ((eq_adjoint_iff _ _).2 fun x y ↦ ?_).symm rw [← hρ s, ρ.self_inv_apply] omit [FiniteDimensional ℂ T] in /-- A representation that preserves inner products preserves norms. -/ private lemma norm_rep_of_unitary (hρ : ∀ (s : Γ) (x y : T), ⟪ρ s x, ρ s y⟫_ℂ = ⟪x, y⟫_ℂ) (s : Γ) (x : T) : ‖ρ s x‖ = ‖x‖ := by simp only [norm_eq_sqrt_re_inner (𝕜 := ℂ), hρ] /-- Let `ρ` be a unitary representation of `Γ` on `T`. The vector `hilbertSchmidtVector X` lists the values of a map `X` on an orthonormal basis, so `⟪hilbertSchmidtVector X, hilbertSchmidtVector Y⟫` is the Hilbert–Schmidt inner product `tr (X* Y)`. This product of `s B B* s⁻¹` and `t B B* t⁻¹` is the squared Hilbert–Schmidt norm of `B* s⁻¹ t B`. So `s ↦ ‖B* s B‖²` has positive type in this norm. -/ lemma inner_hilbertSchmidtVector_translate (hρ : ∀ (s : Γ) (x y : T), ⟪ρ s x, ρ s y⟫_ℂ = ⟪x, y⟫_ℂ) (B : S →ₗ[ℂ] T) (s t : Γ) : ⟪hilbertSchmidtVector ((ρ s ∘ₗ B) ∘ₗ (ρ s ∘ₗ B).adjoint), hilbertSchmidtVector ((ρ t ∘ₗ B) ∘ₗ (ρ t ∘ₗ B).adjoint)⟫_ℂ = (hilbertSchmidtNorm (B.adjoint ∘ₗ ρ (s⁻¹ * t) ∘ₗ B) ^ 2 : ℝ) := by rw [inner_hilbertSchmidtVector, hilbertSchmidtNorm_sq_eq_sq_frobenius] exact TauCeti.trace_adjoint_comp_eq_sq_frobenius_adjoint_comp_comp (norm_rep_of_unitary hρ) B s t /-- **One translate.** Let a finite group `Γ` act unitarily on `T` by `ρ`, and let `pr₀` be the orthogonal projection onto a stable subspace `T₀`, so that `pr₀ s = s pr₀`. Suppose that `pr₀ B` is almost an isometry in mean square with the error `ε`, and that `dim T₀` times the mean of `‖B* s B‖²` is at most `(1 + ε) (dim S)²`. Then the maps `pr₀ s B` spread (`TauCeti.IsSpread`): for every subspace `W` of `T₀`, of dimension `α dim T₀`, the preimage of `W` under some `pr₀ s B` has dimension at most `(1 + α + 3 ε) / 2 · dim S`. -/ theorem isSpread_of_second_moment [Fintype Γ] (hρ : ∀ (s : Γ) (x y : T), ⟪ρ s x, ρ s y⟫_ℂ = ⟪x, y⟫_ℂ) {pr₀ : T →ₗ[ℂ] T} (hpr₀ : pr₀.IsSymmetricProjection) (h_comm : ∀ s : Γ, Commute pr₀ (ρ s)) {B : S →ₗ[ℂ] T} {ε : ℝ} (hε : 0 ≤ ε) (h_isom : IsNearIsometry (pr₀ ∘ₗ B) ε) (h_moment : finrank ℂ (range pr₀) * ∑ s : Γ, hilbertSchmidtNorm (B.adjoint ∘ₗ ρ s ∘ₗ B) ^ 2 ≤ Fintype.card Γ * ((1 + ε) * finrank ℂ S ^ 2)) : TauCeti.IsSpread (fun s : Γ ↦ pr₀.rangeRestrict ∘ₗ ρ s ∘ₗ B) (3 / 2 * ε) := by -- Identify `pr₀` with the orthogonal projection onto `T₀ = range pr₀` so that `pr₀.rangeRestrict` -- agrees with `T₀.orthogonalProjectionOnto`. let T₀ : Submodule ℂ T := range pr₀ obtain ⟨_, h_proj⟩ := pr₀.isSymmetricProjection_iff_eq_coe_starProjection_range.mp hpr₀ have h_apply (x : T) : pr₀ x = T₀.starProjection x := DFunLike.congr_fun h_proj x have h_onto : pr₀.rangeRestrict = (T₀.orthogonalProjectionOnto : T →ₗ[ℂ] T₀) := by ext x simp [h_apply] have h_comm' (s : Γ) (x : T) : T₀.starProjection (ρ s x) = ρ s (T₀.starProjection x) := by simpa only [mul_apply_eq_comp, comp_apply, h_apply] using DFunLike.congr_fun (h_comm s).eq x -- Transport the near-isometry and second-moment bounds to `T₀.orthogonalProjectionOnto` and -- Tau Ceti's Frobenius seminorm, then apply `TauCeti.isSpread_of_sum_sq_frobenius_le`. have h_isom' : ((T₀.orthogonalProjectionOnto : T →ₗ[ℂ] T₀) ∘ₗ B).IsNearIsometry ε := by rw [← h_onto] refine LinearMap.isNearIsometry_iff.2 fun U ↦ ?_ rw [← LinearMap.frobenius_linearIsometry_comp T₀.subtypeₗᵢ] exact LinearMap.isNearIsometry_iff.1 ((isNearIsometry_iff_frobenius _ _).1 h_isom) U have h_moment' : finrank ℂ T₀ * ∑ s : Γ, TauCeti.UnitarilyInvariantSeminorm.frobenius ℂ S S (B.adjoint ∘ₗ ρ s ∘ₗ B) ^ 2 ≤ Fintype.card Γ * ((1 + ε) * finrank ℂ S ^ 2) := by simpa only [hilbertSchmidtNorm_sq_eq_sq_frobenius] using h_moment have h_spread := TauCeti.isSpread_of_sum_sq_frobenius_le (norm_rep_of_unitary hρ) h_comm' hε h_isom' h_moment' rw [← h_onto] at h_spread exact h_spread end HilbertSchmidt end New