Download lean/OAI/Analysis/FiniteFactor/BoundedMatrixOperator.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 6.27 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Analysis/FiniteFactor/BoundedMatrixOperator.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Analysis/FiniteFactor/BoundedMatrixOperator.lean
-
curl -L -o BoundedMatrixOperator.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Analysis/FiniteFactor/BoundedMatrixOperator.lean
6.27 kB
| import Mathlib.Analysis.InnerProductSpace.l2Space | |
| import Mathlib.Analysis.Normed.Operator.Extend | |
| namespace OAI | |
| namespace FiniteFactor | |
| open Filter | |
| open scoped ENNReal Topology | |
| noncomputable section | |
| abbrev SourceFiberHilbert := lp (fun _ : ℤ => ℂ) 2 | |
| /-- Canonical inclusion of finite coordinate vectors in l2(Z). -/ | |
| def fiberFiniteEmbedding : (ℤ →₀ ℂ) →ₗ[ℂ] SourceFiberHilbert := | |
| Finsupp.linearCombination ℂ (fun n => lp.single 2 n (1 : ℂ)) | |
| theorem fiberFiniteEmbedding_single (n : ℤ) (c : ℂ) : | |
| fiberFiniteEmbedding (Finsupp.single n c) = lp.single 2 n c := by | |
| simp [fiberFiniteEmbedding, ← lp.single_smul] | |
| theorem fiberFiniteEmbedding_sum (a : ℤ →₀ ℂ) : | |
| fiberFiniteEmbedding a = ∑ n ∈ a.support, lp.single 2 n (a n) := by | |
| simp [fiberFiniteEmbedding, Finsupp.linearCombination_apply, Finsupp.sum, ← lp.single_smul] | |
| theorem fiberFiniteEmbedding_norm_sq (a : ℤ →₀ ℂ) : | |
| ‖fiberFiniteEmbedding a‖ ^ 2 = ∑ n ∈ a.support, ‖a n‖ ^ 2 := by | |
| rw [fiberFiniteEmbedding_sum] | |
| simpa using lp.norm_sum_single (p := (2 : ℝ≥0∞)) (by norm_num) a a.support | |
| theorem fiberFiniteEmbedding_dense : DenseRange fiberFiniteEmbedding := by | |
| intro x | |
| apply isClosed_closure.mem_of_tendsto (lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ∞) x) | |
| apply Eventually.of_forall | |
| intro s | |
| apply subset_closure | |
| refine ⟨∑ n ∈ s, Finsupp.single n (x n), ?_⟩ | |
| simp [fiberFiniteEmbedding_single] | |
| /-- The algebraic action of a matrix on finite vectors. -/ | |
| def fiberMatrixLinear (m : ℤ → ℤ → ℂ) : (ℤ →₀ ℂ) →ₗ[ℂ] (ℤ → ℂ) := | |
| Finsupp.linearCombination ℂ (fun n k => m k n) | |
| theorem fiberMatrixLinear_apply (m : ℤ → ℤ → ℂ) (a : ℤ →₀ ℂ) (k : ℤ) : | |
| fiberMatrixLinear m a k = ∑ n ∈ a.support, a n * m k n := by | |
| simp [fiberMatrixLinear, Finsupp.linearCombination_apply, Finsupp.sum, Finset.sum_apply, | |
| Pi.smul_apply, smul_eq_mul] | |
| /-- Every bounded operator is determined by its coordinate matrix. -/ | |
| theorem fiberOperator_ext {A B : SourceFiberHilbert →L[ℂ] SourceFiberHilbert} | |
| (h : ∀ k n : ℤ, (A (lp.single 2 n (1 : ℂ))) k = (B (lp.single 2 n (1 : ℂ))) k) : A = B := by | |
| apply lp.ext_continuousLinearMap (by norm_num : (2 : ℝ≥0∞) ≠ ∞) | |
| intro n | |
| apply ContinuousLinearMap.ext | |
| intro c | |
| apply Subtype.ext | |
| funext k | |
| change (A (lp.single 2 n c)) k = (B (lp.single 2 n c)) k | |
| have he : lp.single 2 n c = c • (lp.single 2 n (1 : ℂ) : SourceFiberHilbert) := by | |
| simp [← lp.single_smul] | |
| rw [he, map_smul, map_smul] | |
| change c * (A (lp.single 2 n 1)) k = c * (B (lp.single 2 n 1)) k | |
| rw [h] | |
| theorem fiberOperator_hasSum (A : SourceFiberHilbert →L[ℂ] SourceFiberHilbert) | |
| (v : SourceFiberHilbert) : | |
| HasSum (fun n : ℤ => v n • A (lp.single 2 n (1 : ℂ))) (A v) := by | |
| convert (lp.hasSum_single (by norm_num : (2 : ℝ≥0∞) ≠ ∞) v).map A A.continuous using 1 | |
| funext n | |
| have he : lp.single 2 n (v n) = v n • (lp.single 2 n (1 : ℂ) : SourceFiberHilbert) := by | |
| simp [← lp.single_smul] | |
| change v n • A (lp.single 2 n (1 : ℂ)) = A (lp.single 2 n (v n)) | |
| rw [he, map_smul] | |
| theorem fiberOperator_action (A : SourceFiberHilbert →L[ℂ] SourceFiberHilbert) | |
| (v : SourceFiberHilbert) (k : ℤ) : | |
| (A v) k = ∑' n : ℤ, (A (lp.single 2 n (1 : ℂ))) k * v n := by | |
| have h := (fiberOperator_hasSum A v).map | |
| (lp.evalCLM ℂ (fun _ : ℤ => ℂ) 2 k) (lp.evalCLM ℂ (fun _ : ℤ => ℂ) 2 k).continuous | |
| have he := h.tsum_eq.symm | |
| change (A v) k = ∑' n : ℤ, v n * (A (lp.single 2 n (1 : ℂ))) k at he | |
| simpa only [mul_comm] using he | |
| variable (m : ℤ → ℤ → ℂ) (C : ℝ) | |
| variable (hb : ∀ (s t : Finset ℤ) (a : ℤ → ℂ), | |
| (∑ k ∈ t, ‖∑ n ∈ s, a n * m k n‖ ^ 2) ≤ C ^ 2 * ∑ n ∈ s, ‖a n‖ ^ 2) | |
| include C hb in | |
| theorem fiberMatrixLinear_mem (a : ℤ →₀ ℂ) : Memℓp (fiberMatrixLinear m a) 2 := by | |
| apply memℓp_gen' (C := C ^ 2 * ∑ n ∈ a.support, ‖a n‖ ^ 2) | |
| intro t | |
| simpa [fiberMatrixLinear_apply] using hb a.support t a | |
| /-- The finite matrix action takes values in actual l2, by the finite-sum bound. -/ | |
| def fiberMatrixFinite : (ℤ →₀ ℂ) →ₗ[ℂ] SourceFiberHilbert where | |
| toFun a := ⟨fiberMatrixLinear m a, fiberMatrixLinear_mem m C hb a⟩ | |
| map_add' a b := by apply Subtype.ext; exact map_add (fiberMatrixLinear m) a b | |
| map_smul' c a := by apply Subtype.ext; exact map_smul (fiberMatrixLinear m) c a | |
| theorem fiberMatrixFinite_norm_le (hC : 0 ≤ C) (a : ℤ →₀ ℂ) : | |
| ‖fiberMatrixFinite m C hb a‖ ≤ C * ‖fiberFiniteEmbedding a‖ := by | |
| have he : ‖fiberMatrixFinite m C hb a‖ ^ 2 = | |
| ∑' k, ‖fiberMatrixLinear m a k‖ ^ 2 := by | |
| simpa [fiberMatrixFinite] using lp.norm_rpow_eq_tsum (p := (2 : ℝ≥0∞)) (by norm_num) | |
| (fiberMatrixFinite m C hb a) | |
| have hsum : (∑' k, ‖fiberMatrixLinear m a k‖ ^ 2) ≤ | |
| C ^ 2 * ∑ n ∈ a.support, ‖a n‖ ^ 2 := by | |
| apply Real.tsum_le_of_sum_le | |
| · intro k; positivity | |
| · intro t; simpa [fiberMatrixLinear_apply] using hb a.support t a | |
| rw [← he, ← fiberFiniteEmbedding_norm_sq] at hsum | |
| have hpos := mul_nonneg hC (norm_nonneg (fiberFiniteEmbedding a)) | |
| nlinarith [norm_nonneg (fiberMatrixFinite m C hb a)] | |
| /-- Extension of the bounded finite matrix action to every l2 vector. -/ | |
| def boundedMatrixOperator : SourceFiberHilbert →L[ℂ] SourceFiberHilbert := | |
| (fiberMatrixFinite m C hb).extendOfNorm fiberFiniteEmbedding | |
| theorem boundedMatrixOperator_norm (hC : 0 ≤ C) : ‖boundedMatrixOperator m C hb‖ ≤ C := | |
| LinearMap.opNorm_extendOfNorm_le fiberFiniteEmbedding_dense hC | |
| (fiberMatrixFinite_norm_le m C hb hC) | |
| theorem boundedMatrixOperator_entry (hC : 0 ≤ C) (k n : ℤ) : | |
| (boundedMatrixOperator m C hb (lp.single 2 n (1 : ℂ))) k = m k n := by | |
| rw [← fiberFiniteEmbedding_single n 1] | |
| change ((fiberMatrixFinite m C hb).extendOfNorm fiberFiniteEmbedding | |
| (fiberFiniteEmbedding (Finsupp.single n 1))) k = _ | |
| rw [LinearMap.extendOfNorm_eq fiberFiniteEmbedding_dense | |
| ⟨C, fiberMatrixFinite_norm_le m C hb hC⟩] | |
| change fiberMatrixLinear m (Finsupp.single n 1) k = _ | |
| simp [fiberMatrixLinear] | |
| end | |
| end FiniteFactor | |
| end OAI | |