Download data/lean/OAI/Probability/ParisiFinite/Field.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 28.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/ParisiFinite/Field.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/ParisiFinite/Field.lean
-
curl -L -o Field.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/ParisiFinite/Field.lean
28.6 kB
| import Mathlib | |
| import OAI.Probability.ParisiFinite.Sine | |
| namespace OAI | |
| /-! Field. -/ | |
| noncomputable section | |
| open scoped BigOperators ComplexConjugate InnerProductSpace Topology ComplexOrder | |
| open Filter | |
| open scoped BigOperators | |
| open scoped Matrix Matrix.Norms.L2Operator ComplexConjugate | |
| open scoped InnerProductSpace ComplexConjugate | |
| open Filter Topology | |
| open Filter Set Topology | |
| open scoped InnerProductSpace ComplexConjugate Topology | |
| open scoped InnerProductSpace | |
| open scoped BigOperators Topology InnerProductSpace | |
| open scoped BigOperators InnerProductSpace | |
| namespace ClassicalGaussian | |
| open MeasureTheory ProbabilityTheory | |
| open scoped RealInnerProductSpace | |
| variable (E : Type*) [NormedAddCommGroup E] [InnerProductSpace β E] | |
| [FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E] | |
| def field (d : E) (g : E) : β := βͺd,gβ« | |
| theorem memLp_field (d : E) : MemLp (field E d) 2 (stdGaussian E) := by | |
| exact (innerSL β d).comp_memLp' IsGaussian.memLp_two_id | |
| def vector (d : E) : Lp β 2 (stdGaussian E) := (memLp_field E d).toLp (field E d) | |
| theorem vector_ae (d : E) : (vector E d : E β β)=α΅[stdGaussian E] field E d := | |
| (memLp_field E d).coeFn_toLp | |
| theorem field_covariance (d e : E) : | |
| (β«g, field E d g*field E e g βstdGaussian E)=βͺd,eβ« := by | |
| have h := covarianceBilin_apply (ΞΌ := stdGaussian E) IsGaussian.memLp_two_id d e | |
| rw [covarianceBilin_stdGaussian] at h | |
| simpa only [field,id_eq,integral_id_stdGaussian,sub_zero,innerSL_apply_apply β] using h.symm | |
| theorem inner_vector (d e : E) : βͺvector E d,vector E eβ«=βͺd,eβ« := by | |
| rw [L2.inner_def,βfield_covariance E d e] | |
| apply integral_congr_ae | |
| filter_upwards [vector_ae E d,vector_ae E e] with g hd he | |
| rw [hd,he] | |
| simp only [RCLike.inner_apply',starRingEnd_apply,star_trivial] | |
| def linearMap : E ββ[β] Lp β 2 (stdGaussian E) where | |
| toFun := vector E | |
| map_add' d e := by | |
| apply Lp.ext | |
| filter_upwards [vector_ae E (d+e),vector_ae E d,vector_ae E e, | |
| Lp.coeFn_add (vector E d) (vector E e)] with g h1 h2 h3 h4 | |
| rw [h1,h4] | |
| simp only [Pi.add_apply] | |
| rw [h2,h3] | |
| exact inner_add_left d e g | |
| map_smul' c d := by | |
| apply Lp.ext | |
| filter_upwards [vector_ae E (c β’ d),vector_ae E d, | |
| Lp.coeFn_smul c (vector E d)] with g h1 h2 h3 | |
| simp only [RingHom.id_apply] | |
| rw [h1,h3] | |
| simp only [Pi.smul_apply,smul_eq_mul] | |
| rw [h2] | |
| exact real_inner_smul_left d g c | |
| def aggregate : E ββα΅’[β] Lp β 2 (stdGaussian E) := | |
| LinearMap.isometryOfInner (linearMap E) (inner_vector E) | |
| @[simp] theorem aggregate_apply (d : E) : aggregate E d=vector E d := rfl | |
| @[simp] theorem norm_aggregate_sub (d e : E) : | |
| βaggregate E d-aggregate E eβ=βd-eβ := by | |
| rw [βmap_sub,(aggregate E).norm_map] | |
| theorem aggregate_centered (d : E) : (β«g, aggregate E d g βstdGaussian E)=0 := by | |
| change (β«g, vector E d g βstdGaussian E)=0 | |
| rw [integral_congr_ae (vector_ae E d)] | |
| exact integral_strongDual_stdGaussian (innerSL β d) | |
| theorem reflection : MeasurePreserving (fun g : E => -g) (stdGaussian E) (stdGaussian E) := by | |
| refine β¨measurable_neg,?_β© | |
| exact stdGaussian_map (LinearIsometryEquiv.neg β : E ββα΅’[β] E) | |
| theorem aggregate_odd (d : E) : | |
| βα΅ g βstdGaussian E, aggregate E d (-g)= -aggregate E d g := by | |
| have ha := (reflection E).quasiMeasurePreserving.ae (vector_ae E d) | |
| filter_upwards [vector_ae E d,ha] with g h1 h2 | |
| change vector E d (-g)= -vector E d g | |
| rw [h1,h2] | |
| exact inner_neg_right d g | |
| theorem field_law (d : E) : | |
| (stdGaussian E).map (field E d)=gaussianReal 0 (βdββ^2) := by | |
| change (stdGaussian E).map (innerSL β d)=_ | |
| rw [IsGaussian.map_eq_gaussianReal,integral_strongDual_stdGaussian, | |
| variance_dual_stdGaussian] | |
| congr 1 | |
| simp only [innerSL_apply_norm] | |
| apply NNReal.coe_injective | |
| simp only [Real.coe_toNNReal' , NNReal.coe_pow,coe_nnnorm,sup_eq_left.mpr (sq_nonneg βdβ)] | |
| end ClassicalGaussian | |
| namespace ClassicalGaussian | |
| open MeasureTheory ProbabilityTheory | |
| open scoped RealInnerProductSpace | |
| variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace β V] | |
| variable {ΞΊ : Type*} [Fintype ΞΊ] (cols : ΞΊ β V) | |
| abbrev ColumnSpan := Submodule.span β (Set.range cols) | |
| instance span_finiteDimensional : FiniteDimensional β (ColumnSpan cols) := | |
| FiniteDimensional.span_of_finite β (Set.finite_range cols) | |
| instance span_measurableSpace : MeasurableSpace (ColumnSpan cols) := borel (ColumnSpan cols) | |
| instance span_borelSpace : BorelSpace (ColumnSpan cols) := β¨rflβ© | |
| def column (k : ΞΊ) : ColumnSpan cols := β¨cols k, Submodule.subset_span (Set.mem_range_self k)β© | |
| omit [Fintype ΞΊ] in | |
| @[simp] theorem inner_column (j k : ΞΊ) : βͺcolumn cols j,column cols kβ«=βͺcols j,cols kβ« := rfl | |
| omit [Fintype ΞΊ] in | |
| @[simp] theorem norm_column_sub (j k : ΞΊ) : βcolumn cols j-column cols kβ=βcols j-cols kβ := rfl | |
| def jointColumn (k : ΞΊ) : Lp β 2 (stdGaussian (ColumnSpan cols)) := | |
| aggregate (ColumnSpan cols) (column cols k) | |
| theorem jointColumn_covariance (j k : ΞΊ) : | |
| (β«g, jointColumn cols j g*jointColumn cols k g βstdGaussian (ColumnSpan cols))= | |
| βͺcols j,cols kβ« := by | |
| rw [βinner_column cols j k,βfield_covariance (ColumnSpan cols) (column cols j) (column cols k)] | |
| apply integral_congr_ae | |
| filter_upwards [vector_ae (ColumnSpan cols) (column cols j), | |
| vector_ae (ColumnSpan cols) (column cols k)] with g h1 h2 | |
| change vector (ColumnSpan cols) (column cols j) g * | |
| vector (ColumnSpan cols) (column cols k) g = _ | |
| rw [h1,h2] | |
| theorem jointColumn_centered (k : ΞΊ) : | |
| (β«g, jointColumn cols k g βstdGaussian (ColumnSpan cols))=0 := | |
| aggregate_centered (ColumnSpan cols) (column cols k) | |
| theorem jointColumn_norm_sub (j k : ΞΊ) : | |
| βjointColumn cols j-jointColumn cols kβ=βcols j-cols kβ := | |
| norm_aggregate_sub (ColumnSpan cols) (column cols j) (column cols k) | |
| theorem jointColumn_odd (k : ΞΊ) : | |
| βα΅ g βstdGaussian (ColumnSpan cols), jointColumn cols k (-g)= -jointColumn cols k g := | |
| aggregate_odd (ColumnSpan cols) (column cols k) | |
| end ClassicalGaussian | |
| namespace ClassicalGaussian | |
| open MeasureTheory ProbabilityTheory | |
| open scoped RealInnerProductSpace | |
| variable {E F : Type*} | |
| [NormedAddCommGroup E] [InnerProductSpace β E] [FiniteDimensional β E] | |
| [MeasurableSpace E] [BorelSpace E] | |
| [NormedAddCommGroup F] [InnerProductSpace β F] [FiniteDimensional β F] | |
| [MeasurableSpace F] [BorelSpace F] | |
| theorem projection_gaussian (i : E ββα΅’[β] F) : | |
| (stdGaussian F).map (ContinuousLinearMap.adjoint i.toContinuousLinearMap)=stdGaussian E := by | |
| apply Measure.ext_of_charFun | |
| funext t | |
| rw [charFun_apply,integral_map (by fun_prop) (by fun_prop)] | |
| simp only [ContinuousLinearMap.adjoint_inner_left] | |
| change charFun (stdGaussian F) (i t)=charFun (stdGaussian E) t | |
| simp only [charFun_stdGaussian,i.norm_map] | |
| theorem projection_preserving (i : E ββα΅’[β] F) : | |
| MeasurePreserving (ContinuousLinearMap.adjoint i.toContinuousLinearMap) | |
| (stdGaussian F) (stdGaussian E) := | |
| β¨by fun_prop,projection_gaussian iβ© | |
| theorem aggregate_pullback (i : E ββα΅’[β] F) (d : E) : | |
| Lp.compMeasurePreserving (ContinuousLinearMap.adjoint i.toContinuousLinearMap) | |
| (projection_preserving i) (aggregate E d)=aggregate F (i d) := by | |
| apply Lp.ext | |
| have h1 := (projection_preserving i).quasiMeasurePreserving.ae (vector_ae E d) | |
| filter_upwards [Lp.coeFn_compMeasurePreserving (aggregate E d) (projection_preserving i), | |
| h1,vector_ae F (i d)] with g h2 h3 h4 | |
| change _=vector F (i d) g | |
| rw [h2,h4] | |
| change vector E d (ContinuousLinearMap.adjoint i.toContinuousLinearMap g)=_ | |
| rw [h3] | |
| exact ContinuousLinearMap.adjoint_inner_right i.toContinuousLinearMap d g | |
| end ClassicalGaussian | |
| namespace ClassicalGaussian | |
| open MeasureTheory ProbabilityTheory TrigLp | |
| open scoped Topology | |
| variable (E : Type*) [NormedAddCommGroup E] [InnerProductSpace β E] | |
| [FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E] | |
| variable {ΞΊ : Type*} [Fintype ΞΊ] | |
| theorem exists_robust_gaussian_operation (cols : ΞΊ β E) (Ο : (ΞΊ β β) β β) | |
| (hΟ : MemLp Ο 2 (inputLaw (stdGaussian E) (fun k => aggregate E (cols k)))) | |
| (ho : βx, Ο (-x)= -Ο x) {Ξ΅ : β} (hΞ΅ : 0<Ξ΅) : | |
| βs : Finset (ΞΊ β β), βb : (ΞΊ β β) β β, βΞ΄ : β, 0<Ξ΄ β§ | |
| βd : ΞΊ β E, (βk, βd k-cols kβ<Ξ΄) β | |
| βpolynomial (stdGaussian E) s b (fun k => aggregate E (d k))- | |
| (hΟ.comp_measurePreserving (inputMap_preserving (stdGaussian E) | |
| (fun k => aggregate E (cols k)))).toLp | |
| (Ο β inputMap (stdGaussian E) (fun k => aggregate E (cols k)))β<Ξ΅ := by | |
| obtain β¨s,b,Ξ΄,hΞ΄,hdβ© := exists_robust_odd_operation (stdGaussian E) (fun g => -g) | |
| (reflection E) (fun k => aggregate E (cols k)) (fun k => aggregate_odd E (cols k)) | |
| Ο hΟ ho hΞ΅ | |
| refine β¨s,b,Ξ΄,hΞ΄,?_β© | |
| intro d hd' | |
| apply hd | |
| intro k | |
| simpa only [norm_aggregate_sub] using hd' k | |
| theorem exists_robust_gaussian_angle (cols : ΞΊ β E) (Ο : (ΞΊ β β) β β) | |
| (hΟ : MemLp Ο 2 (inputLaw (stdGaussian E) (fun k => aggregate E (cols k)))) | |
| (ho : βx, Ο (-x)= -Ο x) (hb : βx, |Ο x|β€1) {Ξ΅ : β} (hΞ΅ : 0<Ξ΅) : | |
| βs : Finset (ΞΊ β β), βb : (ΞΊ β β) β β, βΞ΄ : β, 0<Ξ΄ β§ | |
| βd : ΞΊ β E, (βk, βd k-cols kβ<Ξ΄) β | |
| βreadout (stdGaussian E) s b (fun k => aggregate E (d k))- | |
| (hΟ.comp_measurePreserving (inputMap_preserving (stdGaussian E) | |
| (fun k => aggregate E (cols k)))).toLp | |
| (Ο β inputMap (stdGaussian E) (fun k => aggregate E (cols k)))β<Ξ΅ := by | |
| obtain β¨s,b,Ξ΄,hΞ΄,hdβ© := exists_robust_odd_readout (stdGaussian E) (fun g => -g) | |
| (reflection E) (fun k => aggregate E (cols k)) (fun k => aggregate_odd E (cols k)) | |
| Ο hΟ ho hb hΞ΅ | |
| refine β¨s,b,Ξ΄,hΞ΄,?_β© | |
| intro d hd' | |
| apply hd | |
| intro k | |
| simpa only [norm_aggregate_sub] using hd' k | |
| end ClassicalGaussian | |
| namespace ClassicalGaussian | |
| open MeasureTheory ProbabilityTheory | |
| open scoped RealInnerProductSpace | |
| variable (E : Type*) [NormedAddCommGroup E] [InnerProductSpace β E] | |
| [FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E] | |
| theorem covariance_field (d e : E) : | |
| cov[field E d,field E e;stdGaussian E]=βͺd,eβ« := by | |
| rw [covariance_eq_sub (memLp_field E d) (memLp_field E e)] | |
| have hd : (β«g,field E d g βstdGaussian E)=0 := | |
| integral_strongDual_stdGaussian (innerSL β d) | |
| have he : (β«g,field E e g βstdGaussian E)=0 := | |
| integral_strongDual_stdGaussian (innerSL β e) | |
| rw [hd,he,mul_zero,sub_zero] | |
| exact field_covariance E d e | |
| theorem joint_gaussian {ΞΊ : Type*} [Fintype ΞΊ] (cols : ΞΊ β E) : | |
| HasGaussianLaw (fun g k => field E (cols k) g) (stdGaussian E) := by | |
| exact HasGaussianLaw.map_of_measurable | |
| (ContinuousLinearMap.pi (fun k => innerSL β (cols k))) | |
| IsGaussian.hasGaussianLaw_id (by fun_prop) | |
| theorem fields_independent {ΞΊ : Type*} [Fintype ΞΊ] (cols : ΞΊ β E) | |
| (h : βj k, jβ k β βͺcols j,cols kβ«=0) : | |
| iIndepFun (fun k => field E (cols k)) (stdGaussian E) := by | |
| apply (joint_gaussian E cols).iIndepFun_of_covariance_eq_zero | |
| intro j k hjk | |
| rw [covariance_field] | |
| exact h j k hjk | |
| theorem orthogonal_families_independent {ΞΊ ΞΉ : Type*} [Fintype ΞΊ] [Fintype ΞΉ] | |
| (d : ΞΊ β E) (e : ΞΉ β E) (h : βj k, βͺd j,e kβ«=0) : | |
| IndepFun (fun g j => field E (d j) g) (fun g k => field E (e k) g) | |
| (stdGaussian E) := by | |
| have hg : HasGaussianLaw (fun g => ((fun j => field E (d j) g), | |
| (fun k => field E (e k) g))) (stdGaussian E) := by | |
| exact HasGaussianLaw.map_of_measurable | |
| ((ContinuousLinearMap.pi (fun j => innerSL β (d j))).prod | |
| (ContinuousLinearMap.pi (fun k => innerSL β (e k)))) | |
| IsGaussian.hasGaussianLaw_id (by fun_prop) | |
| apply hg.indepFun_of_covariance_eval | |
| intro j k | |
| rw [covariance_field] | |
| exact h j k | |
| end ClassicalGaussian | |
| namespace TrigLp | |
| open MeasureTheory | |
| variable {Ξ© Ξ©' : Type*} [MeasurableSpace Ξ©] [MeasurableSpace Ξ©'] | |
| variable (ΞΌ : Measure Ξ©) (Ξ½ : Measure Ξ©') (X : Ξ© β Ξ©') | |
| variable (hX : MeasurePreserving X ΞΌ Ξ½) | |
| variable {ΞΊ : Type*} [Fintype ΞΊ] | |
| omit [Fintype ΞΊ] in | |
| theorem sine_pullback (f : Lp β 2 Ξ½) : | |
| Lp.compMeasurePreservingβ β X hX (sine Ξ½ f)= | |
| sine ΞΌ (Lp.compMeasurePreservingβ β X hX f) := by | |
| apply Lp.ext | |
| have hf := hX.quasiMeasurePreserving.ae (sine_ae Ξ½ f) | |
| filter_upwards [Lp.coeFn_compMeasurePreserving (sine Ξ½ f) hX,hf, | |
| sine_ae ΞΌ (Lp.compMeasurePreservingβ β X hX f), | |
| Lp.coeFn_compMeasurePreserving f hX] with Ο h1 h2 h3 h4 | |
| change Lp.compMeasurePreserving X hX (sine Ξ½ f) Ο=_ | |
| rw [h1,Function.comp_apply,h2,h3] | |
| congr 1 | |
| change f (X Ο)=Lp.compMeasurePreserving X hX f Ο | |
| exact h4.symm | |
| theorem polynomial_pullback (s : Finset (ΞΊ β β)) (b : (ΞΊ β β) β β) | |
| (cols : ΞΊ β Lp β 2 Ξ½) : | |
| Lp.compMeasurePreservingβ β X hX (polynomial Ξ½ s b cols)= | |
| polynomial ΞΌ s b (fun k => Lp.compMeasurePreservingβ β X hX (cols k)) := by | |
| simp only [polynomial,map_sum,map_smul,sine_pullback,linear] | |
| theorem readout_pullback (s : Finset (ΞΊ β β)) (b : (ΞΊ β β) β β) | |
| (cols : ΞΊ β Lp β 2 Ξ½) : | |
| Lp.compMeasurePreservingβ β X hX (readout Ξ½ s b cols)= | |
| readout ΞΌ s b (fun k => Lp.compMeasurePreservingβ β X hX (cols k)) := by | |
| simp only [readout,sine_pullback,map_smul,polynomial_pullback] | |
| def coefficientBound (s : Finset (ΞΊ β β)) (b : (ΞΊ β β) β β) : β := | |
| βaβs, |b a| * (βk, |a k|) | |
| theorem coefficientBound_nonneg (s : Finset (ΞΊ β β)) (b : (ΞΊ β β) β β) : | |
| 0β€coefficientBound s b := by | |
| exact Finset.sum_nonneg (fun a ha => mul_nonneg (abs_nonneg _) (Finset.sum_nonneg fun _ _ => abs_nonneg _)) | |
| theorem polynomial_norm_sub_uniform (s : Finset (ΞΊ β β)) (b : (ΞΊ β β) β β) | |
| (f g : ΞΊ β Lp β 2 ΞΌ) {Ξ΄ : β} (h : βk, βf k-g kββ€Ξ΄) : | |
| βpolynomial ΞΌ s b f-polynomial ΞΌ s b gββ€coefficientBound s b*Ξ΄ := by | |
| calc | |
| _ β€ βaβs, |b a| *(βk, |a k| *βf k-g kβ) := polynomial_norm_sub_le ΞΌ s b f g | |
| _ β€ βaβs, |b a| *(βk, |a k| *Ξ΄) := by | |
| apply Finset.sum_le_sum | |
| intro a ha | |
| apply mul_le_mul_of_nonneg_left _ (abs_nonneg _) | |
| exact Finset.sum_le_sum (fun k hk => mul_le_mul_of_nonneg_left (h k) (abs_nonneg _)) | |
| _ = coefficientBound s b*Ξ΄ := by | |
| simp only [coefficientBound,Finset.sum_mul,Finset.mul_sum,mul_assoc] | |
| end TrigLp | |
| namespace ClassicalGaussian | |
| open MeasureTheory ProbabilityTheory TrigLp | |
| universe u v | |
| variable (E : Type u) [NormedAddCommGroup E] [InnerProductSpace β E] | |
| [FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E] | |
| variable {ΞΊ : Type*} [Fintype ΞΊ] | |
| def localValue (cols : ΞΊ β E) (Ο : (ΞΊ β β) β β) | |
| (hΟ : MemLp Ο 2 (inputLaw (stdGaussian E) (fun k => aggregate E (cols k)))) : | |
| Lp β 2 (stdGaussian E) := | |
| (hΟ.comp_measurePreserving (inputMap_preserving (stdGaussian E) | |
| (fun k => aggregate E (cols k)))).toLp | |
| (Ο β inputMap (stdGaussian E) (fun k => aggregate E (cols k))) | |
| theorem exists_ambient_robust_operation (cols : ΞΊ β E) (Ο : (ΞΊ β β) β β) | |
| (hΟ : MemLp Ο 2 (inputLaw (stdGaussian E) (fun k => aggregate E (cols k)))) | |
| (ho : βx, Ο (-x)= -Ο x) {Ξ΅ : β} (hΞ΅ : 0<Ξ΅) : | |
| βs : Finset (ΞΊ β β), βb : (ΞΊ β β) β β, βΞ΄ : β, 0<Ξ΄ β§ | |
| β (F : Type v) [NormedAddCommGroup F] [InnerProductSpace β F] | |
| [FiniteDimensional β F] [MeasurableSpace F] [BorelSpace F] | |
| (i : E ββα΅’[β] F) (d : ΞΊ β F), (βk, βd k-i (cols k)β<Ξ΄) β | |
| βpolynomial (stdGaussian F) s b (fun k => aggregate F (d k))- | |
| Lp.compMeasurePreservingβ β (ContinuousLinearMap.adjoint i.toContinuousLinearMap) | |
| (projection_preserving i) (localValue E cols Ο hΟ)β<Ξ΅ := by | |
| obtain β¨s,b,Ξ΄β,hΞ΄β,haβ© := exists_robust_gaussian_operation E cols Ο hΟ ho (half_pos hΞ΅) | |
| have hb := ha cols (fun k => by simpa only [sub_self,norm_zero] using hΞ΄β) | |
| change βpolynomial (stdGaussian E) s b (fun k => aggregate E (cols k))- | |
| localValue E cols Ο hΟβ<Ξ΅/2 at hb | |
| let K := coefficientBound s b | |
| have hK : 0β€K := coefficientBound_nonneg s b | |
| have hp : 0<2*(K+1) := by positivity | |
| let Ξ΄ := Ξ΅/(2*(K+1)) | |
| have hΞ΄ : 0<Ξ΄ := div_pos hΞ΅ hp | |
| have heq : Ξ΄*(2*(K+1))=Ξ΅ := div_mul_cancelβ Ξ΅ (ne_of_gt hp) | |
| have hKΞ΄ : K*Ξ΄<Ξ΅/2 := by nlinarith | |
| refine β¨s,b,Ξ΄,hΞ΄,?_β© | |
| intro F inst1 inst2 inst3 inst4 inst5 i d hd | |
| let P : Lp β 2 (stdGaussian E) ββ[β] Lp β 2 (stdGaussian F) := Lp.compMeasurePreservingβ β | |
| (ContinuousLinearMap.adjoint i.toContinuousLinearMap) (projection_preserving i) | |
| have hid : polynomial (stdGaussian F) s b (fun k => aggregate F (i (cols k)))= | |
| P (polynomial (stdGaussian E) s b (fun k => aggregate E (cols k))) := by | |
| rw [polynomial_pullback] | |
| congr 1 | |
| funext k | |
| exact (aggregate_pullback i (cols k)).symm | |
| have herr : βpolynomial (stdGaussian F) s b (fun k => aggregate F (i (cols k)))- | |
| P (localValue E cols Ο hΟ)β<Ξ΅/2 := by | |
| rw [hid,βmap_sub] | |
| change βLp.compMeasurePreserving (ContinuousLinearMap.adjoint i.toContinuousLinearMap) | |
| (projection_preserving i) | |
| (polynomial (stdGaussian E) s b (fun k => aggregate E (cols k))-localValue E cols Ο hΟ)β<Ξ΅/2 | |
| rwa [Lp.norm_compMeasurePreserving] | |
| have hpert : βpolynomial (stdGaussian F) s b (fun k => aggregate F (d k))- | |
| polynomial (stdGaussian F) s b (fun k => aggregate F (i (cols k)))β<Ξ΅/2 := by | |
| apply lt_of_le_of_lt (polynomial_norm_sub_uniform (stdGaussian F) s b _ _ ?_) hKΞ΄ | |
| intro k | |
| rw [norm_aggregate_sub] | |
| exact (hd k).le | |
| calc | |
| _ β€ βpolynomial (stdGaussian F) s b (fun k => aggregate F (d k))- | |
| polynomial (stdGaussian F) s b (fun k => aggregate F (i (cols k)))β+ | |
| βpolynomial (stdGaussian F) s b (fun k => aggregate F (i (cols k)))- | |
| P (localValue E cols Ο hΟ)β := norm_sub_le_norm_sub_add_norm_sub _ _ _ | |
| _ < Ξ΅/2+Ξ΅/2 := add_lt_add hpert herr | |
| _ = Ξ΅ := add_halves Ξ΅ | |
| end ClassicalGaussian | |
| namespace ClassicalGaussian | |
| open MeasureTheory ProbabilityTheory TrigLp | |
| universe u v | |
| variable (E : Type u) [NormedAddCommGroup E] [InnerProductSpace β E] | |
| [FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E] | |
| variable {ΞΊ : Type*} [Fintype ΞΊ] | |
| theorem exists_ambient_robust_angle (cols : ΞΊ β E) (Ο : (ΞΊ β β) β β) | |
| (hΟ : MemLp Ο 2 (inputLaw (stdGaussian E) (fun k => aggregate E (cols k)))) | |
| (ho : βx, Ο (-x)= -Ο x) (hbound : βx, |Ο x|β€1) {Ξ΅ : β} (hΞ΅ : 0<Ξ΅) : | |
| βs : Finset (ΞΊ β β), βb : (ΞΊ β β) β β, βΞ΄ : β, 0<Ξ΄ β§ | |
| β (F : Type v) [NormedAddCommGroup F] [InnerProductSpace β F] | |
| [FiniteDimensional β F] [MeasurableSpace F] [BorelSpace F] | |
| (i : E ββα΅’[β] F) (d : ΞΊ β F), (βk, βd k-i (cols k)β<Ξ΄) β | |
| βreadout (stdGaussian F) s b (fun k => aggregate F (d k))- | |
| Lp.compMeasurePreservingβ β (ContinuousLinearMap.adjoint i.toContinuousLinearMap) | |
| (projection_preserving i) (localValue E cols Ο hΟ)β<Ξ΅ := by | |
| obtain β¨s,b,Ξ΄β,hΞ΄β,haβ© := exists_robust_gaussian_angle E cols Ο hΟ ho hbound (half_pos hΞ΅) | |
| have hb := ha cols (fun k => by simpa only [sub_self,norm_zero] using hΞ΄β) | |
| change βreadout (stdGaussian E) s b (fun k => aggregate E (cols k))- | |
| localValue E cols Ο hΟβ<Ξ΅/2 at hb | |
| let K := coefficientBound s b | |
| have hK : 0β€K := coefficientBound_nonneg s b | |
| have hp : 0<4*(K+1) := by positivity | |
| let Ξ΄ := Ξ΅/(4*(K+1)) | |
| have hΞ΄ : 0<Ξ΄ := div_pos hΞ΅ hp | |
| have heq : Ξ΄*(4*(K+1))=Ξ΅ := div_mul_cancelβ Ξ΅ (ne_of_gt hp) | |
| have hKΞ΄ : 2*(K*Ξ΄)<Ξ΅/2 := by nlinarith | |
| refine β¨s,b,Ξ΄,hΞ΄,?_β© | |
| intro F inst1 inst2 inst3 inst4 inst5 i d hd | |
| let P : Lp β 2 (stdGaussian E) ββ[β] Lp β 2 (stdGaussian F) := Lp.compMeasurePreservingβ β | |
| (ContinuousLinearMap.adjoint i.toContinuousLinearMap) (projection_preserving i) | |
| have hid : readout (stdGaussian F) s b (fun k => aggregate F (i (cols k)))= | |
| P (readout (stdGaussian E) s b (fun k => aggregate E (cols k))) := by | |
| rw [readout_pullback] | |
| congr 1 | |
| funext k | |
| exact (aggregate_pullback i (cols k)).symm | |
| have herr : βreadout (stdGaussian F) s b (fun k => aggregate F (i (cols k)))- | |
| P (localValue E cols Ο hΟ)β<Ξ΅/2 := by | |
| rw [hid,βmap_sub] | |
| change βLp.compMeasurePreserving (ContinuousLinearMap.adjoint i.toContinuousLinearMap) | |
| (projection_preserving i) | |
| (readout (stdGaussian E) s b (fun k => aggregate E (cols k))-localValue E cols Ο hΟ)β<Ξ΅/2 | |
| rwa [Lp.norm_compMeasurePreserving] | |
| have hpert : βreadout (stdGaussian F) s b (fun k => aggregate F (d k))- | |
| readout (stdGaussian F) s b (fun k => aggregate F (i (cols k)))β<Ξ΅/2 := by | |
| apply lt_of_le_of_lt (readout_norm_sub_le (stdGaussian F) s b _ _) | |
| apply lt_of_le_of_lt (mul_le_mul_of_nonneg_left | |
| (polynomial_norm_sub_uniform (stdGaussian F) s b _ _ ?_) (by norm_num : (0:β)β€2)) hKΞ΄ | |
| intro k | |
| rw [norm_aggregate_sub] | |
| exact (hd k).le | |
| calc | |
| _ β€ βreadout (stdGaussian F) s b (fun k => aggregate F (d k))- | |
| readout (stdGaussian F) s b (fun k => aggregate F (i (cols k)))β+ | |
| βreadout (stdGaussian F) s b (fun k => aggregate F (i (cols k)))- | |
| P (localValue E cols Ο hΟ)β := norm_sub_le_norm_sub_add_norm_sub _ _ _ | |
| _ < Ξ΅/2+Ξ΅/2 := add_lt_add hpert herr | |
| _ = Ξ΅ := add_halves Ξ΅ | |
| end ClassicalGaussian | |
| namespace FiniteOccupations | |
| open scoped InnerProductSpace BigOperators | |
| variable {A B : Type*} [Fintype A] [Fintype B] [DecidableEq B] | |
| variable (f : A β B) | |
| def weight (b : B) : β := (Real.sqrt (Fintype.card {a : A // f a=b} : β) : β)β»ΒΉ | |
| omit [Fintype B] in | |
| theorem card_pos (hf : Function.Surjective f) (b : B) : 0<Fintype.card {a : A // f a=b} := by | |
| obtain β¨a,haβ© := hf b | |
| exact Fintype.card_pos_iff.mpr β¨β¨a,haβ©β© | |
| omit [Fintype B] in | |
| @[simp] theorem star_weight (b : B) : starRingEnd β (weight f b)=weight f b := by | |
| simp [weight] | |
| omit [Fintype B] in | |
| theorem card_mul_weight_sq (hf : Function.Surjective f) (b : B) : | |
| (Fintype.card {a : A // f a=b} : β)*(weight f b)^2=1 := by | |
| have hsq : (Real.sqrt (Fintype.card {a : A // f a=b} : β) : β)^2= | |
| (Fintype.card {a : A // f a=b} : β) := by | |
| exact_mod_cast Real.sq_sqrt (Nat.cast_nonneg (Fintype.card {a : A // f a=b})) | |
| rw [weight,inv_pow,hsq] | |
| exact mul_inv_cancelβ (Nat.cast_ne_zero.mpr (Nat.ne_of_gt (card_pos f hf b))) | |
| omit [Fintype B] in | |
| theorem weight_ne_zero (hf : Function.Surjective f) (b : B) : weight f bβ 0 := by | |
| intro h | |
| simpa [h] using card_mul_weight_sq f hf b | |
| def liftLinear : EuclideanSpace β B ββ[β] EuclideanSpace β A where | |
| toFun u := WithLp.toLp 2 (fun a => weight f (f a)*u (f a)) | |
| map_add' u v := by ext a; simp [mul_add] | |
| map_smul' c u := by ext a; simp [mul_left_comm] | |
| omit [Fintype B] in | |
| @[simp] theorem liftLinear_apply (u : EuclideanSpace β B) (a : A) : | |
| liftLinear f u a=weight f (f a)*u (f a) := rfl | |
| theorem inner_lift (hf : Function.Surjective f) (u v : EuclideanSpace β B) : | |
| βͺliftLinear f u,liftLinear f vβ«_β=βͺu,vβ«_β := by | |
| classical | |
| simp only [PiLp.inner_apply,RCLike.inner_apply,liftLinear_apply,map_mul,star_weight] | |
| rw [βFintype.sum_fiberwise f] | |
| apply Finset.sum_congr rfl | |
| intro b hb | |
| have he (a : {a : A // f a=b}) : | |
| weight f (f a)*v (f a)*(weight f (f a)*starRingEnd β (u (f a)))= | |
| (weight f b)^2*(v b*starRingEnd β (u b)) := by rw [a.property]; ring | |
| simp_rw [he] | |
| simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] | |
| rw [βmul_assoc,card_mul_weight_sq f hf,one_mul] | |
| def lift (hf : Function.Surjective f) : EuclideanSpace β B ββα΅’[β] EuclideanSpace β A := | |
| LinearMap.isometryOfInner (liftLinear f) (inner_lift f hf) | |
| @[simp] theorem lift_apply (hf : Function.Surjective f) (u : EuclideanSpace β B) (a : A) : | |
| lift f hf u a=weight f (f a)*u (f a) := rfl | |
| theorem mem_range_iff (hf : Function.Surjective f) (u : EuclideanSpace β A) : | |
| uβSet.range (lift f hf) β βa a', f a=f a' β u a=u a' := by | |
| constructor | |
| Β· rintro β¨v,rflβ© a a' h | |
| simp only [lift_apply,h] | |
| Β· intro h | |
| let rep : B β A := fun b => (hf b).choose | |
| have hr (b : B) : f (rep b)=b := (hf b).choose_spec | |
| refine β¨WithLp.toLp 2 (fun b => u (rep b)/weight f b),?_β© | |
| ext a | |
| change weight f (f a)*(u (rep (f a))/weight f (f a))=u a | |
| rw [mul_div_cancelβ _ (weight_ne_zero f hf _)] | |
| exact h _ _ (hr (f a)) | |
| end FiniteOccupations | |
| namespace FiniteTensorOccupations | |
| open scoped InnerProductSpace | |
| variable {I Ξ± : Type*} [Fintype I] [Fintype Ξ±] [DecidableEq Ξ±] | |
| local instance : DecidableEq I := Classical.decEq _ | |
| def counts (w : I β Ξ±) (a : Ξ±) : β := Fintype.card {i : I // w i=a} | |
| omit [Fintype Ξ±] in | |
| theorem counts_eq_iff (w z : I β Ξ±) : | |
| counts w=counts z β βΟ : I β I, βi, z (Ο i)=w i := by | |
| classical | |
| constructor | |
| Β· intro h | |
| let e (a : Ξ±) : {i : I // w i=a} β {i : I // z i=a} := | |
| Fintype.equivOfCardEq (congrFun h a) | |
| exact β¨Equiv.ofFiberEquiv e,Equiv.ofFiberEquiv_map eβ© | |
| Β· rintro β¨Ο,hΟβ© | |
| funext a | |
| apply Fintype.card_congr | |
| exact { | |
| toFun := fun i => β¨Ο i,by rw [hΟ,i.property]β© | |
| invFun := fun j => β¨Ο.symm j,by rw [βhΟ,Ο.apply_symm_apply,j.property]β© | |
| left_inv := by intro i; ext; simp | |
| right_inv := by intro j; ext; simp } | |
| def occupancySetoid : Setoid (I β Ξ±) where | |
| r w z := counts w=counts z | |
| iseqv := β¨fun _ => rfl,fun h => h.symm,fun h h' => h.trans h'β© | |
| abbrev Occupation (I Ξ± : Type*) [Fintype I] [DecidableEq Ξ±] := | |
| Quotient (occupancySetoid (I := I) (Ξ± := Ξ±)) | |
| instance : Fintype (Occupation I Ξ±) := Fintype.ofFinite _ | |
| noncomputable instance : DecidableEq (Occupation I Ξ±) := Classical.decEq _ | |
| def register (w : I β Ξ±) : Occupation I Ξ± := Quotient.mk _ w | |
| omit [Fintype Ξ±] in | |
| @[simp] theorem register_eq_iff (w z : I β Ξ±) : | |
| register w=register z β counts w=counts z := Quotient.eq | |
| omit [Fintype Ξ±] in | |
| theorem register_surjective : Function.Surjective (register (I := I) (Ξ± := Ξ±)) := by | |
| intro q | |
| exact Quotient.inductionOn q (fun w => β¨w,rflβ©) | |
| def embedding : EuclideanSpace β (Occupation I Ξ±) ββα΅’[β] EuclideanSpace β (I β Ξ±) := | |
| FiniteOccupations.lift register register_surjective | |
| theorem mem_range_iff_symmetric (u : EuclideanSpace β (I β Ξ±)) : | |
| uβSet.range (embedding (I := I) (Ξ± := Ξ±)) β | |
| βw : I β Ξ±, βΟ : I β I, u (w β Ο)=u w := by | |
| rw [embedding,FiniteOccupations.mem_range_iff] | |
| constructor | |
| Β· intro h w Ο | |
| apply h | |
| apply (register_eq_iff _ _).mpr | |
| exact (counts_eq_iff _ _).mpr β¨Ο,fun _ => rflβ© | |
| Β· intro h w z hwz | |
| obtain β¨Ο,hΟβ© := (counts_eq_iff w z).mp ((register_eq_iff _ _).mp hwz) | |
| have he : z β Ο=w := funext hΟ | |
| simpa only [he] using h z Ο | |
| def symmetricSector : Submodule β (EuclideanSpace β (I β Ξ±)) where | |
| carrier := {u | βw : I β Ξ±, βΟ : I β I, u (w β Ο)=u w} | |
| zero_mem' := by intro w Ο; rfl | |
| add_mem' := by intro u v hu hv w Ο; simp [hu w Ο,hv w Ο] | |
| smul_mem' := by intro c u hu w Ο; simp [hu w Ο] | |
| def symmetricEmbedding : | |
| EuclideanSpace β (Occupation I Ξ±) ββα΅’[β] symmetricSector (I := I) (Ξ± := Ξ±) where | |
| toLinearMap := (embedding (I := I) (Ξ± := Ξ±)).toLinearMap.codRestrict symmetricSector | |
| (fun u => (mem_range_iff_symmetric _).mp β¨u,rflβ©) | |
| norm_map' u := (embedding (I := I) (Ξ± := Ξ±)).norm_map u | |
| theorem symmetricEmbedding_surjective : | |
| Function.Surjective (symmetricEmbedding (I := I) (Ξ± := Ξ±)) := by | |
| intro y | |
| obtain β¨u,huβ© := (mem_range_iff_symmetric (y : EuclideanSpace β (I β Ξ±))).mpr y.property | |
| refine β¨u,?_β© | |
| apply Subtype.ext | |
| exact hu | |
| def occupationMap : symmetricSector (I := I) (Ξ± := Ξ±) ββα΅’[β] | |
| EuclideanSpace β (Occupation I Ξ±) := | |
| (LinearIsometryEquiv.ofSurjective symmetricEmbedding symmetricEmbedding_surjective).symm | |
| @[simp] theorem occupationMap_symm_apply (u : EuclideanSpace β (Occupation I Ξ±)) | |
| (w : I β Ξ±) : | |
| (occupationMap.symm u : EuclideanSpace β (I β Ξ±)) w = | |
| FiniteOccupations.weight register (register w)*u (register w) := rfl | |
| end FiniteTensorOccupations | |
| end | |
| end OAI | |