Download data/lean/OAI/Probability/JammingConcavity/RowRefinementCovariance.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 32.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/JammingConcavity/RowRefinementCovariance.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/JammingConcavity/RowRefinementCovariance.lean
-
curl -L -o RowRefinementCovariance.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/JammingConcavity/RowRefinementCovariance.lean
32.1 kB
| import Mathlib | |
| import OAI.Probability.JammingConcavity.GaussianDerivativeMartingaleRowRefinementCovariance | |
| namespace OAI | |
| /-! Row Refinement Covariance. -/ | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Set | |
| open scoped NNReal ENNReal | |
| open Set Filter | |
| open scoped Topology | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped ENNReal NNReal Topology BigOperators | |
| open MeasureTheory Filter Set | |
| open scoped ENNReal NNReal BigOperators | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped ENNReal NNReal Topology | |
| open scoped NNReal ENNReal Topology | |
| open scoped NNReal Topology | |
| open Set | |
| open Set Filter MeasureTheory | |
| open scoped BigOperators | |
| open scoped Topology NNReal | |
| open scoped Topology BigOperators | |
| open scoped ENNReal NNReal | |
| open MeasureTheory Set | |
| open MeasureTheory ProbabilityTheory | |
| open scoped ENNReal NNReal BigOperators Classical | |
| open Classical | |
| open scoped ENNReal NNReal Topology BigOperators MatrixOrder | |
| open scoped NNReal BigOperators | |
| open MeasureTheory Metric Set | |
| open Metric | |
| open scoped RealInnerProductSpace | |
| open Filter | |
| open Finset Set | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped ENNReal NNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter Metric | |
| open scoped ENNReal NNReal Topology BigOperators BoundedContinuousFunction | |
| open scoped BigOperators Classical | |
| open scoped ENNReal NNReal Topology BigOperators Matrix MatrixOrder | |
| open scoped BigOperators RealInnerProductSpace | |
| open scoped NNReal Topology BigOperators | |
| open scoped NNReal BigOperators RealInnerProductSpace | |
| open scoped ENNReal NNReal BigOperators MatrixOrder | |
| open scoped MatrixOrder | |
| open scoped NNReal | |
| open scoped BigOperators NNReal | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| namespace MicroscopicJamming | |
| def rowMeshRanks (ms ts : List β) : List β := | |
| (ms.toFinset βͺ ts.toFinset).sort (Β· β€ Β·) | |
| def rowMeshWeight (ms : List β) (d : β β ββ₯0) (a : β) : ββ₯0 := | |
| if a β ms then d (ms.idxOf a) else 0 | |
| def rowMeshIncrement (ms ts : List β) (d : β β ββ₯0) (j : β) : ββ₯0 := | |
| rowMeshWeight ms d ((rowMeshRanks ms ts).getD j 0) | |
| def rowMeshTransport (ts ns : List β) (j : β) : β := | |
| ((ns.take j).filter (fun a => a β ts)).length | |
| lemma rowMeshRanks_sorted (ms ts : List β) : | |
| (rowMeshRanks ms ts).Pairwise (Β· < Β·) := (Finset.sortedLT_sort _).pairwise | |
| @[simp] lemma rowMeshRanks_mem (ms ts : List β) (a : β) : | |
| a β rowMeshRanks ms ts β a β ms β¨ a β ts := by | |
| simp [rowMeshRanks] | |
| lemma rowGaussianBlocks_congr (ms : List β) (d e : β β ββ₯0) | |
| (h : β j, j < ms.length β d j = e j) : | |
| rowGaussianBlocks ms d = rowGaussianBlocks ms e := by | |
| induction ms generalizing d e with | |
| | nil => rfl | |
| | cons m ms ih => | |
| simp only [rowGaussianBlocks] | |
| have h0 := h 0 (by simp) | |
| rw [h0] | |
| congr 1 | |
| exact ih _ _ (fun j hj => h (j+1) (by simpa using Nat.succ_lt_succ hj)) | |
| lemma rowGaussianBlocks_getD (ms : List β) (w : β β ββ₯0) : | |
| rowGaussianBlocks ms (fun j => w (ms.getD j 0)) = | |
| ms.map (fun a => (a,(w a:β))) := by | |
| induction ms with | |
| | nil => rfl | |
| | cons m ms ih => | |
| simpa only [rowGaussianBlocks,List.getD_cons_zero,List.getD_cons_succ, | |
| List.map_cons] using congrArg (List.cons (m,(w m:β))) ih | |
| lemma rowGaussianBlocks_meshWeight (ms : List β) (d : β β ββ₯0) | |
| (hm : ms.Nodup) : | |
| rowGaussianBlocks ms d = ms.map (fun a => (a,(rowMeshWeight ms d a:β))) := by | |
| rw [βrowGaussianBlocks_getD] | |
| apply rowGaussianBlocks_congr | |
| intro j hj | |
| rw [List.getD_eq_getElem _ _ hj] | |
| simp only [rowMeshWeight,ite_eq_left (List.getElem_mem hj),hm.idxOf_getElem j hj] | |
| lemma rowMeshBlocks_filter (ms ts : List β) (d : β β ββ₯0) | |
| (hm : ms.Pairwise (Β· < Β·)) : | |
| (rowGaussianBlocks (rowMeshRanks ms ts) (rowMeshIncrement ms ts d)).filter | |
| (fun r => r.2 != 0) = | |
| (rowGaussianBlocks ms d).filter (fun r => r.2 != 0) := by | |
| rw [rowGaussianBlocks_meshWeight ms d hm.nodup] | |
| change (rowGaussianBlocks (rowMeshRanks ms ts) | |
| (fun j => rowMeshWeight ms d ((rowMeshRanks ms ts).getD j 0))).filter _ = _ | |
| rw [rowGaussianBlocks_getD,List.filter_map,List.filter_map] | |
| congr 1 | |
| apply List.Pairwise.eq_of_mem_iff | |
| ((rowMeshRanks_sorted ms ts).filter _) (hm.filter _) | |
| intro a | |
| simp only [List.mem_filter,Function.comp_apply,rowMeshRanks_mem] | |
| constructor | |
| Β· rintro β¨ha,hzβ© | |
| refine β¨?_,hzβ© | |
| by_contra h | |
| simp [rowMeshWeight,h] at hz | |
| Β· rintro β¨ha,hzβ© | |
| exact β¨Or.inl ha,hzβ© | |
| lemma rowGaussianBlocks_sum (ms : List β) (d : β β ββ₯0) : | |
| ((rowGaussianBlocks ms d).map Prod.snd).sum = β j : Fin ms.length, (d j:β) := by | |
| induction ms generalizing d with | |
| | nil => simp [rowGaussianBlocks] | |
| | cons m ms ih => | |
| simp only [rowGaussianBlocks,List.map_cons,List.sum_cons,List.length_cons, | |
| Fin.sum_univ_succ,Fin.val_zero,Fin.val_succ] | |
| rw [ih] | |
| lemma rowBlocks_sum_filter (rs : List (β Γ β)) : | |
| ((rs.filter (fun r => r.2 != 0)).map Prod.snd).sum = (rs.map Prod.snd).sum := by | |
| induction rs with | |
| | nil => rfl | |
| | cons r rs ih => | |
| by_cases h : r.2 = 0 | |
| Β· simp [h,ih] | |
| Β· simp [h,ih] | |
| lemma rowMesh_diagonal (ms ts : List β) (d : β β ββ₯0) (pβ Ξ : ββ₯0) | |
| (hm : ms.Pairwise (Β· < Β·)) : | |
| rowReplicaDiagonal (rowMeshRanks ms ts).length (rowMeshIncrement ms ts d) pβ Ξ = | |
| rowReplicaDiagonal ms.length d pβ Ξ := by | |
| have h := congrArg (fun rs : List (β Γ β) => (rs.map Prod.snd).sum) | |
| (rowMeshBlocks_filter ms ts d hm) | |
| rw [rowBlocks_sum_filter,rowBlocks_sum_filter,rowGaussianBlocks_sum, | |
| rowGaussianBlocks_sum] at h | |
| apply NNReal.coe_injective | |
| simp only [rowReplicaDiagonal,NNReal.coe_add,NNReal.coe_sum] | |
| rw [h] | |
| lemma rowSorted_take_stepLevel (ns : List β) (hn : ns.Pairwise (Β· < Β·)) (s : β) : | |
| ns.take (rpcStepLevel ns s) = ns.filter (fun a => a β€ s) := by | |
| induction ns with | |
| | nil => rfl | |
| | cons a ns ih => | |
| have ht := (List.pairwise_cons.mp hn).2 | |
| by_cases ha : a β€ s | |
| Β· simpa [rpcStepLevel,List.filter_cons,ha] using congrArg (List.cons a) (ih ht) | |
| Β· have he : ns.filter (fun a => a β€ s) = [] := by | |
| apply List.filter_eq_nil_iff.mpr | |
| intro b hb | |
| have hab := (List.pairwise_cons.mp hn).1 b hb | |
| simpa only [decide_eq_true_eq] using not_le.mpr ((lt_of_not_ge ha).trans hab) | |
| simp [rpcStepLevel,ha,he] | |
| lemma rowMesh_transport (ts ns : List β) (ht : ts.Pairwise (Β· < Β·)) | |
| (hn : ns.Pairwise (Β· < Β·)) (hsub : ts β ns) (s : β) : | |
| rpcStepLevel ts s = rowMeshTransport ts ns (rpcStepLevel ns s) := by | |
| rw [rowMeshTransport,rowSorted_take_stepLevel ns hn] | |
| unfold rpcStepLevel | |
| congr 1 | |
| apply List.Pairwise.eq_of_mem_iff (ht.filter _) ((hn.filter _).filter _) | |
| intro a | |
| simp only [List.mem_filter,decide_eq_true_eq] | |
| constructor | |
| Β· rintro β¨ha,hasβ© | |
| exact β¨β¨hsub ha,hasβ©,haβ© | |
| Β· rintro β¨β¨_,hasβ©,haβ© | |
| exact β¨ha,hasβ© | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| namespace MicroscopicJamming | |
| def rowTestExtend (Ο : C(Set.Icc (0:β) 1, β)) (s : β) : β := | |
| Ο β¨min 1 (max 0 s), le_min zero_le_one (le_max_left _ _), min_le_left _ _β© | |
| def rowMeshTest (ms : List β) (Ο : C(Set.Icc (0:β) 1, β)) | |
| (n j : β) : β := | |
| rowTestExtend Ο ((rowMeshTransport (rankMesh n) | |
| (rowMeshRanks ms (rankMesh n)) j : β) / ((n:β)+1)) | |
| def rowFullRankView (u : β β β) (Ο : C(Set.Icc (0:β) 1, β)) (k : β) | |
| (z : RankArray Γ EuclideanSpace β (Fin (2+k))) : β Γ (Fin (2+k) β β) := | |
| (rowTestExtend Ο (z.1 0 1) * | |
| (deriv u (z.2 (Fin.castAdd k (0:Fin 2))) * | |
| deriv u (z.2 (Fin.castAdd k (1:Fin 2)))), fun i => u (z.2 i)) | |
| def RowAllRankTestLawStatement : Prop := | |
| β (u : β β β) (L H : β), ContDiff β 2 u β 0 β€ L β 0 β€ H β | |
| (β x, |deriv u x| β€ L β§ |deriv (deriv u) x| β€ H) β | |
| β ms : List β, ms.Pairwise (Β· < Β·) β (β m β ms, 0 < m β§ m < 1) β | |
| β (d : β β ββ₯0) (pβ Ξ : ββ₯0) (Ο : C(Set.Icc (0:β) 1,β)) (k : β), | |
| β (Ο : β β ProbabilityMeasure (β Γ (Fin (2+k) β β))) | |
| (Οβ : ProbabilityMeasure (β Γ (Fin (2+k) β β))), | |
| (β n, (Ο n : Measure _) = | |
| replicaFieldLaw | |
| (rowReplicaEnvironmentLaw (rowMeshRanks ms (rankMesh n)) | |
| (rowMeshIncrement ms (rankMesh n) d) pβ) | |
| (rowReplicaKernel (rowMeshRanks ms (rankMesh n)) Ξ) | |
| (rowFullPotential (rowMeshRanks ms (rankMesh n)) u) | |
| (rowFullPair (rowMeshRanks ms (rankMesh n)) u (rowMeshTest ms Ο n)) k) β§ | |
| (Οβ : Measure _) = | |
| (gaussianAdjunctionMeasure (2+k) | |
| (rowFullRankCovariance (2+k) (rowReplicaDiagonal ms.length d pβ Ξ) | |
| (rowCascadeProfile ms d pβ)) realizedRankLaw).map (rowFullRankView u Ο k) β§ | |
| Tendsto Ο atTop (π Οβ) | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology ENNReal NNReal | |
| namespace MicroscopicJamming | |
| lemma probabilityMap_tendsto_of_ae {A B : Type*} [MeasurableSpace A] | |
| [TopologicalSpace B] [MeasurableSpace B] [BorelSpace B] [OpensMeasurableSpace B] | |
| (ΞΌ : Measure A) [IsProbabilityMeasure ΞΌ] | |
| (f : β β A β B) (g : A β B) | |
| (hf : β n, AEMeasurable (f n) ΞΌ) (hg : AEMeasurable g ΞΌ) | |
| (hlim : βα΅ a βΞΌ, Tendsto (fun n => f n a) atTop (π (g a))) : | |
| Tendsto (fun n => (β¨ΞΌ.map (f n), inferInstanceβ© : ProbabilityMeasure B)) | |
| atTop (@nhds (ProbabilityMeasure B) inferInstance (β¨ΞΌ.map g, inferInstanceβ© : ProbabilityMeasure B)) := by | |
| apply ProbabilityMeasure.tendsto_iff_forall_integral_tendsto.mpr | |
| intro F | |
| change Tendsto (fun n => β« b, F b βΞΌ.map (f n)) atTop (π (β« b, F b βΞΌ.map g)) | |
| simp_rw [integral_map (hf _) F.continuous.aestronglyMeasurable, | |
| integral_map hg F.continuous.aestronglyMeasurable] | |
| apply tendsto_integral_of_dominated_convergence (fun _ => βFβ) | |
| Β· intro n | |
| exact (F.continuous.measurable.comp_aemeasurable (hf n)).aestronglyMeasurable | |
| Β· exact integrable_const _ | |
| Β· intro n | |
| exact Filter.Eventually.of_forall (fun a => F.norm_coe_le_norm (f n a)) | |
| Β· filter_upwards [hlim] with a ha | |
| exact F.continuous.continuousAt.tendsto.comp ha | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| namespace MicroscopicJamming | |
| lemma rowTestExtend_continuous (Ο : C(Set.Icc (0:β) 1, β)) : | |
| Continuous (rowTestExtend Ο) := by | |
| apply Ο.continuous.comp | |
| apply Continuous.subtype_mk | |
| fun_prop | |
| lemma rowTestExtend_eq (Ο : C(Set.Icc (0:β) 1, β)) (s : Set.Icc (0:β) 1) : | |
| rowTestExtend Ο s = Ο s := by | |
| simp only [rowTestExtend, max_eq_right s.property.1, min_eq_right s.property.2] | |
| lemma rowMesh_valid (ms ts : List β) | |
| (hm : β m β ms, 0 < m β§ m < 1) (ht : β t β ts, 0 < t β§ t < 1) : | |
| β a β rowMeshRanks ms ts, 0 < a β§ a < 1 := by | |
| intro a ha | |
| exact ((rowMeshRanks_mem ms ts a).mp ha).elim (hm a) (ht a) | |
| lemma rowMeshTest_transport (ms : List β) (Ο : C(Set.Icc (0:β) 1, β)) | |
| (n : β) (s : β) : | |
| rowMeshTest ms Ο n (rpcStepLevel (rowMeshRanks ms (rankMesh n)) s) = | |
| rowTestExtend Ο (rankMeshValue n s) := by | |
| unfold rowMeshTest rankMeshValue | |
| rw [βrowMesh_transport (rankMesh n) (rowMeshRanks ms (rankMesh n)) | |
| (rankMesh_increasing n) (rowMeshRanks_sorted _ _) | |
| (fun _ ha => (rowMeshRanks_mem _ _ _).mpr (Or.inr ha)) s] | |
| lemma measurable_gaussianAdjunction_countable {A B : Type*} | |
| [MeasurableSpace A] [MeasurableSpace B] [Countable B] [MeasurableSingletonClass B] | |
| (r : β) (C : B β Matrix (Fin r) (Fin r) β) (g : A β B) (hg : Measurable g) : | |
| Measurable (gaussianAdjunctionMap r (C β g)) := by | |
| have hC : Measurable (gaussianAdjunctionMap r C) := by | |
| apply measurable_from_prod_countable_right | |
| intro x | |
| exact measurable_const.prodMk | |
| (Matrix.toEuclideanCLM (π := β) (CFC.sqrt (C x))).continuous.measurable | |
| exact measurable_fst.prodMk ((hC.comp (hg.prodMap measurable_id)).snd) | |
| lemma rowGaussianAdjunction_aemeasurable (ms : List β) (r : β) | |
| (d : β β ββ₯0) (pβ Ξ : ββ₯0) : | |
| AEMeasurable (gaussianAdjunctionMap r | |
| (rowFullRankCovariance r (rowReplicaDiagonal ms.length d pβ Ξ) | |
| (rowCascadeProfile ms d pβ))) | |
| (realizedRankLaw.prod (stdGaussian (EuclideanSpace β (Fin r)))) := by | |
| apply (measurable_gaussianAdjunction_countable r (rowSignatureCovariance ms.length r d pβ Ξ) | |
| (rankGenealogySignature ms r) (measurable_rankGenealogySignature ms r)).aemeasurable.congr | |
| filter_upwards [Measure.quasiMeasurePreserving_fst.ae (rowCascadeCovariance_ae (r := r) ms d pβ Ξ)] with z hz | |
| simp only [gaussianAdjunctionMap,hz] | |
| lemma rowGaussianAdjunction_probability (ms : List β) (r : β) | |
| (d : β β ββ₯0) (pβ Ξ : ββ₯0) : | |
| IsProbabilityMeasure (gaussianAdjunctionMeasure r | |
| (rowFullRankCovariance r (rowReplicaDiagonal ms.length d pβ Ξ) | |
| (rowCascadeProfile ms d pβ)) realizedRankLaw) := by | |
| unfold gaussianAdjunctionMeasure | |
| infer_instance | |
| lemma rowGaussianAdjunction_rank_mem (ms : List β) (r : β) | |
| (d : β β ββ₯0) (pβ Ξ : ββ₯0) : | |
| βα΅ z βgaussianAdjunctionMeasure r | |
| (rowFullRankCovariance r (rowReplicaDiagonal ms.length d pβ Ξ) | |
| (rowCascadeProfile ms d pβ)) realizedRankLaw, | |
| z.1 0 1 β Set.Icc (0:β) 1 := by | |
| apply (ae_map_iff (rowGaussianAdjunction_aemeasurable ms r d pβ Ξ) | |
| (by measurability)).mpr | |
| filter_upwards [Measure.quasiMeasurePreserving_fst.ae realizedRankLaw_constraints] with z hz | |
| exact hz.2.2.1 0 1 | |
| def rowMeshRankView (u : β β β) (Ο : C(Set.Icc (0:β) 1, β)) (k n : β) | |
| (z : RankArray Γ EuclideanSpace β (Fin (2+k))) : β Γ (Fin (2+k) β β) := | |
| (rowTestExtend Ο (rankMeshValue n (z.1 0 1)) * | |
| (deriv u (z.2 (Fin.castAdd k (0:Fin 2))) * | |
| deriv u (z.2 (Fin.castAdd k (1:Fin 2)))), fun i => u (z.2 i)) | |
| lemma measurable_rowFullRankView (u : β β β) (hu : ContDiff β 2 u) | |
| (Ο : C(Set.Icc (0:β) 1, β)) (k : β) : Measurable (rowFullRankView u Ο k) := by | |
| have huM : Measurable u := hu.continuous.measurable | |
| have hdu : Continuous (deriv u) := hu.continuous_deriv (by norm_num) | |
| have hΟ := (rowTestExtend_continuous Ο).measurable | |
| unfold rowFullRankView | |
| fun_prop | |
| lemma measurable_rowMeshRankView (u : β β β) (hu : ContDiff β 2 u) | |
| (Ο : C(Set.Icc (0:β) 1, β)) (k n : β) : Measurable (rowMeshRankView u Ο k n) := by | |
| have huM : Measurable u := hu.continuous.measurable | |
| have hdu : Continuous (deriv u) := hu.continuous_deriv (by norm_num) | |
| have hΟ := (rowTestExtend_continuous Ο).measurable | |
| have hmesh : Measurable (rankMeshValue n) := by | |
| unfold rankMeshValue | |
| exact ((show Measurable (fun a : β => (a:β)) from measurable_of_countable _).comp | |
| (measurable_rpcStepLevel _)).div_const _ | |
| unfold rowMeshRankView | |
| fun_prop | |
| lemma rowMesh_fields_exact (u : β β β) (L H : β) (hu : ContDiff β 2 u) | |
| (hL : 0 β€ L) (hH : 0 β€ H) | |
| (hb : β x, |deriv u x| β€ L β§ |deriv (deriv u) x| β€ H) | |
| (ms : List β) (hms : ms.Pairwise (Β· < Β·)) (hm : β m β ms, 0 < m β§ m < 1) | |
| (d : β β ββ₯0) (pβ Ξ : ββ₯0) (Ο : C(Set.Icc (0:β) 1,β)) (k n : β) : | |
| replicaFieldLaw | |
| (rowReplicaEnvironmentLaw (rowMeshRanks ms (rankMesh n)) | |
| (rowMeshIncrement ms (rankMesh n) d) pβ) | |
| (rowReplicaKernel (rowMeshRanks ms (rankMesh n)) Ξ) | |
| (rowFullPotential (rowMeshRanks ms (rankMesh n)) u) | |
| (rowFullPair (rowMeshRanks ms (rankMesh n)) u (rowMeshTest ms Ο n)) k = | |
| (gaussianAdjunctionMeasure (2+k) | |
| (rowFullRankCovariance (2+k) (rowReplicaDiagonal ms.length d pβ Ξ) | |
| (rowCascadeProfile ms d pβ)) realizedRankLaw).map (rowMeshRankView u Ο k n) := by | |
| rw [rowRetainedRankLaw u L H hu hL hH hb _ (rowMeshRanks_sorted _ _) | |
| (rowMesh_valid _ _ hm (rankMesh_valid n))] | |
| rw [rowMesh_diagonal ms (rankMesh n) d pβ Ξ hms] | |
| rw [(rowRefinementCovariance _ _ (rowMeshRanks_sorted _ _) hms | |
| (rowMesh_valid _ _ hm (rankMesh_valid n)) hm _ d pβ | |
| (rowMeshBlocks_filter ms (rankMesh n) d hms)).2] | |
| congr 1 | |
| funext z | |
| simp only [rowMeshRankView,rowMeshTest_transport] | |
| theorem rowAllRankTestLaw : RowAllRankTestLawStatement := by | |
| intro u L H hu hL hH hb ms hms hm d pβ Ξ Ο k | |
| let ΞΌ := gaussianAdjunctionMeasure (2+k) | |
| (rowFullRankCovariance (2+k) (rowReplicaDiagonal ms.length d pβ Ξ) | |
| (rowCascadeProfile ms d pβ)) realizedRankLaw | |
| have : IsProbabilityMeasure ΞΌ := rowGaussianAdjunction_probability ms (2+k) d pβ Ξ | |
| let Ο : β β ProbabilityMeasure (β Γ (Fin (2+k) β β)) := fun n => | |
| β¨ΞΌ.map (rowMeshRankView u Ο k n), inferInstanceβ© | |
| let Οβ : ProbabilityMeasure (β Γ (Fin (2+k) β β)) := | |
| β¨ΞΌ.map (rowFullRankView u Ο k), inferInstanceβ© | |
| refine β¨Ο,Οβ,?_,rfl,?_β© | |
| Β· intro n | |
| exact (rowMesh_fields_exact u L H hu hL hH hb ms hms hm d pβ Ξ Ο k n).symm | |
| Β· apply probabilityMap_tendsto_of_ae ΞΌ _ _ | |
| (fun n => (measurable_rowMeshRankView u hu Ο k n).aemeasurable) | |
| (measurable_rowFullRankView u hu Ο k).aemeasurable | |
| filter_upwards [rowGaussianAdjunction_rank_mem ms (2+k) d pβ Ξ] with z hz | |
| have hΟ := (rowTestExtend_continuous Ο).continuousAt.tendsto.comp | |
| (rankMeshValue_tendsto hz) | |
| exact (hΟ.mul tendsto_const_nhds).prodMk_nhds tendsto_const_nhds | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped Matrix.Norms.L2Operator MatrixOrder Topology NNReal ENNReal BigOperators | |
| namespace MicroscopicJamming | |
| local instance (r : β) : MeasurableSpace (Matrix (Fin r) (Fin r) β) := borel _ | |
| local instance (r : β) : BorelSpace (Matrix (Fin r) (Fin r) β) := β¨rflβ© | |
| lemma isClosed_matrix_nonneg (r : β) : IsClosed {a : Matrix (Fin r) (Fin r) β | 0 β€ a} := by | |
| simp only [Matrix.nonneg_iff_posSemidef, Matrix.posSemidef_iff_dotProduct_mulVec] | |
| apply IsClosed.inter | |
| Β· change IsClosed {a : Matrix (Fin r) (Fin r) β | a.conjTranspose = a} | |
| apply isClosed_eq <;> fun_prop | |
| Β· change IsClosed {a : Matrix (Fin r) (Fin r) β | β x : Fin r β β, 0 β€ star x β¬α΅₯ a.mulVec x} | |
| have he : {a : Matrix (Fin r) (Fin r) β | β x : Fin r β β, 0 β€ star x β¬α΅₯ a.mulVec x} = | |
| β x : Fin r β β, {a : Matrix (Fin r) (Fin r) β | 0 β€ star x β¬α΅₯ a.mulVec x} := by ext; simp | |
| rw [he] | |
| apply isClosed_iInter | |
| intro x | |
| apply isClosed_le continuous_const | |
| fun_prop | |
| lemma measurable_matrix_sqrt (r : β) : | |
| Measurable (CFC.sqrt : Matrix (Fin r) (Fin r) β β _) := by | |
| classical | |
| have h := (CFC.continuousOn_sqrt (A := Matrix (Fin r) (Fin r) β)).measurable_piecewise | |
| (continuous_const.continuousOn (f := fun _ : Matrix (Fin r) (Fin r) β => (0 : Matrix (Fin r) (Fin r) β))) | |
| ((isClosed_matrix_nonneg r).measurableSet : MeasurableSet {a : Matrix (Fin r) (Fin r) β | 0 β€ a}) | |
| convert h using 1 | |
| funext a | |
| by_cases ha : 0 β€ a | |
| Β· simp only [Set.piecewise,Set.mem_ofPred_eq,ha,ite_true] | |
| Β· simp only [Set.piecewise,Set.mem_ofPred_eq,ha,ite_false,CFC.sqrt_of_not_nonneg ha] | |
| lemma continuous_matrix_clm (r : β) : | |
| Continuous (Matrix.toEuclideanCLM (π := β) (n := Fin r)) := by | |
| exact (Matrix.toEuclideanCLM (π := β) (n := Fin r)).toAlgEquiv.toLinearMap.continuous_of_finiteDimensional | |
| lemma measurable_matrix_gaussian_map {A : Type*} [MeasurableSpace A] | |
| (r : β) (C : A β Matrix (Fin r) (Fin r) β) (hC : Measurable C) : | |
| Measurable (fun z : A Γ EuclideanSpace β (Fin r) => | |
| (z.1, Matrix.toEuclideanCLM (π := β) (CFC.sqrt (C z.1)) z.2)) := by | |
| apply measurable_fst.prodMk | |
| have heval : Continuous (fun z : (EuclideanSpace β (Fin r) βL[β] EuclideanSpace β (Fin r)) Γ | |
| EuclideanSpace β (Fin r) => z.1 z.2) := continuous_fst.clm_apply continuous_snd | |
| exact heval.measurable.comp (((continuous_matrix_clm r).measurable.comp | |
| ((measurable_matrix_sqrt r).comp (hC.comp measurable_fst))).prodMk measurable_snd) | |
| lemma matrix_gaussian_map_tendsto | |
| (r : β) (Cn : β β Matrix (Fin r) (Fin r) β) (C : Matrix (Fin r) (Fin r) β) | |
| (hCn : β n, (Cn n).PosSemidef) (hC : C.PosSemidef) | |
| (hlim : Tendsto Cn atTop (π C)) (x : EuclideanSpace β (Fin r)) : | |
| Tendsto (fun n => Matrix.toEuclideanCLM (π := β) (CFC.sqrt (Cn n)) x) | |
| atTop (π (Matrix.toEuclideanCLM (π := β) (CFC.sqrt C) x)) := by | |
| have hs := CFC.continuousOn_sqrt (A := Matrix (Fin r) (Fin r) β) C hC.nonneg | |
| have hh := hs.tendsto.comp (tendsto_nhdsWithin_iff.mpr | |
| β¨hlim,Eventually.of_forall (fun n => (hCn n).nonneg)β©) | |
| exact ((continuous_matrix_clm r).clm_apply (continuous_const (y := x))).continuousAt.tendsto.comp hh | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped Topology ENNReal NNReal | |
| namespace MicroscopicJamming | |
| local instance (r : β) : MeasurableSpace (Matrix (Fin r) (Fin r) β) := borel _ | |
| local instance (r : β) : BorelSpace (Matrix (Fin r) (Fin r) β) := β¨rflβ© | |
| lemma rowClosedProfile_integrable (p : SphericalProfile) : | |
| Integrable (rowClosedProfile p) (volume.restrict (Set.Icc (0:β) 1)) := by | |
| refine β¨(measurable_rowClosedProfile p).aestronglyMeasurable, HasFiniteIntegral.of_bounded (C := p.val 1) ?_β© | |
| exact Eventually.of_forall fun s => by | |
| rw [Real.norm_eq_abs, abs_of_nonneg (rowClosedProfile_bound p s).1] | |
| exact (rowClosedProfile_bound p s).2 | |
| lemma rowClosedProfile_eLpNorm_eq (p q : SphericalProfile) : | |
| eLpNorm (rowClosedProfile p - rowClosedProfile q) 1 (volume.restrict (Set.Icc (0:β) 1)) = | |
| ENNReal.ofReal (sphericalProfileDistance p.val q.val) := by | |
| rw [eLpNorm_one_eq_lintegral_enorm | |
| ((rowClosedProfile_integrable p).sub (rowClosedProfile_integrable q)).aestronglyMeasurable, | |
| β ofReal_integral_norm_eq_lintegral_enorm | |
| ((rowClosedProfile_integrable p).sub (rowClosedProfile_integrable q))] | |
| congr 1 | |
| rw [sphericalProfileDistance, intervalIntegral.integral_of_le zero_le_one, | |
| βintegral_Icc_eq_integral_Ioc] | |
| apply setIntegral_congr_fun measurableSet_Icc | |
| intro s hs | |
| simp only [Pi.sub_apply,Real.norm_eq_abs,rowClosedProfile_eq p hs,rowClosedProfile_eq q hs] | |
| lemma rowClosedProfile_tendstoInMeasure (pn : β β SphericalProfile) (p : SphericalProfile) | |
| (hp : Tendsto (fun n => sphericalProfileDistance (pn n).val p.val) atTop (π 0)) : | |
| TendstoInMeasure (volume.restrict (Set.Icc (0:β) 1)) | |
| (fun n => rowClosedProfile (pn n)) atTop (rowClosedProfile p) := by | |
| apply tendstoInMeasure_of_tendsto_eLpNorm (p := 1) one_ne_zero | |
| simp_rw [rowClosedProfile_eLpNorm_eq] | |
| simpa only [Function.comp_def, ENNReal.ofReal_zero] using | |
| ((ENNReal.continuous_ofReal.tendsto (0:β)).comp hp) | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped Topology ENNReal NNReal BigOperators MatrixOrder Matrix.Norms.L2Operator | |
| namespace MicroscopicJamming | |
| local instance (r : β) : MeasurableSpace (Matrix (Fin r) (Fin r) β) := borel _ | |
| local instance (r : β) : BorelSpace (Matrix (Fin r) (Fin r) β) := β¨rflβ© | |
| lemma rowRankCovariance_tendsto_ae_of_profile_ae | |
| (Q : β) (pn : β β SphericalProfile) (p : SphericalProfile) (r : β) | |
| (h : βα΅ s βvolume.restrict (Set.Icc (0:β) 1), | |
| Tendsto (fun n => rowClosedProfile (pn n) s) atTop (π (rowClosedProfile p s))) : | |
| βα΅ U βrealizedRankLaw, Tendsto (fun n => rowFullRankCovariance r Q (pn n) U) | |
| atTop (π (rowFullRankCovariance r Q p U)) := by | |
| have hentry (i j : Fin r) : βα΅ U βrealizedRankLaw, | |
| Tendsto (fun n => rowFullRankCovariance r Q (pn n) U i j) | |
| atTop (π (rowFullRankCovariance r Q p U i j)) := by | |
| by_cases hij : i=j | |
| Β· exact Eventually.of_forall (fun U => by simp only [rowFullRankCovariance,hij,ite_true]; exact tendsto_const_nhds) | |
| Β· have h' := h | |
| rw [βrealizedRankLaw_pair_uniform i.val j.val (fun hv => hij (Fin.ext hv))] at h' | |
| have hh := ae_of_ae_map (show Measurable (fun U : RankArray => U i.val j.val) from by fun_prop).aemeasurable h' | |
| simpa only [rowFullRankCovariance,ite_eq_right hij] using hh | |
| filter_upwards [ae_all_iff.mpr (fun i => ae_all_iff.mpr (fun j => hentry i j))] with U hU | |
| exact tendsto_pi_nhds.mpr (fun i => tendsto_pi_nhds.mpr (fun j => hU i j)) | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped Topology NNReal ENNReal BigOperators | |
| namespace MicroscopicJamming | |
| def finiteSpinProfile (ms : List β) (d : β β ββ₯0) (pβ : ββ₯0) (s : β) : β := | |
| (pβ:β)+β j β Finset.range ms.length, if ms[j]! β€ s then (d j:β) else 0 | |
| structure SphericalStepProfile where | |
| ranks : List β | |
| variance : β β ββ₯0 | |
| initial : ββ₯0 | |
| ordered : ranks.Pairwise (Β· < Β·) | |
| ranks_mem : β m β ranks, 0 < m β§ m < 1 | |
| def SphericalStepProfile.val (P : SphericalStepProfile) : β β β := | |
| finiteSpinProfile P.ranks P.variance P.initial | |
| def boundedSphericalProfiles (B : β) : Set SphericalProfile := | |
| {p | β s β Set.Icc 0 1, p.val s β€ B} | |
| lemma finiteSpinProfile_monotone (ms : List β) (d : β β ββ₯0) (pβ : ββ₯0) : | |
| Monotone (finiteSpinProfile ms d pβ) := by | |
| intro s t hst | |
| unfold finiteSpinProfile | |
| apply add_le_add le_rfl | |
| apply Finset.sum_le_sum | |
| intro j hj | |
| split_ifs with hs ht | |
| Β· rfl | |
| Β· exact False.elim (ht (hs.trans hst)) | |
| Β· exact (d j).coe_nonneg | |
| Β· rfl | |
| lemma finiteSpinProfile_nonneg (ms : List β) (d : β β ββ₯0) (pβ : ββ₯0) (s : β) : | |
| 0 β€ finiteSpinProfile ms d pβ s := by | |
| unfold finiteSpinProfile | |
| positivity | |
| def SphericalStepProfile.toProfile (P : SphericalStepProfile) : SphericalProfile where | |
| val := P.val | |
| mono := (finiteSpinProfile_monotone P.ranks P.variance P.initial).monotoneOn _ | |
| nonneg := fun s _ => finiteSpinProfile_nonneg P.ranks P.variance P.initial s | |
| lemma SphericalProfile.integrable (p : SphericalProfile) : | |
| IntervalIntegrable p.val volume 0 1 := by | |
| apply MonotoneOn.intervalIntegrable | |
| simpa using p.mono | |
| lemma SphericalStepProfile.integrable (P : SphericalStepProfile) : | |
| IntervalIntegrable P.val volume 0 1 := P.toProfile.integrable | |
| lemma sphericalProfileDistance_nonneg (p q : SphericalProfile) : | |
| 0 β€ sphericalProfileDistance p.val q.val := by | |
| apply intervalIntegral.integral_nonneg (by norm_num) | |
| intro s hs | |
| exact abs_nonneg _ | |
| lemma sphericalProfileDistance_self (p : SphericalProfile) : | |
| sphericalProfileDistance p.val p.val = 0 := by simp [sphericalProfileDistance] | |
| lemma sphericalProfileDistance_comm (p q : SphericalProfile) : | |
| sphericalProfileDistance p.val q.val = sphericalProfileDistance q.val p.val := by | |
| unfold sphericalProfileDistance | |
| simp_rw [abs_sub_comm] | |
| lemma sphericalProfileDistance_triangle (p q r : SphericalProfile) : | |
| sphericalProfileDistance p.val r.val β€ | |
| sphericalProfileDistance p.val q.val+sphericalProfileDistance q.val r.val := by | |
| unfold sphericalProfileDistance | |
| rw [β intervalIntegral.integral_add (p.integrable.sub q.integrable).abs | |
| (q.integrable.sub r.integrable).abs] | |
| apply intervalIntegral.integral_mono_on (by norm_num) (p.integrable.sub r.integrable).abs | |
| ((p.integrable.sub q.integrable).abs.add (q.integrable.sub r.integrable).abs) | |
| intro s hs | |
| exact abs_sub_le (p.val s) (q.val s) (r.val s) | |
| end MicroscopicJamming | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped ENNReal NNReal Topology BigOperators | |
| namespace MicroscopicJamming | |
| def spinGridPoint (n k : β) : β := (k:β)/((n:β)+1) | |
| def spinGridRanks (n : β) : List β := List.ofFn (fun j : Fin n => spinGridPoint n (j+1)) | |
| lemma spinGridPoint_pos_denom (n : β) : (0:β) < (n:β)+1 := by positivity | |
| lemma spinGridPoint_mono (n : β) : Monotone (spinGridPoint n) := by | |
| intro i j h | |
| exact div_le_div_of_nonneg_right (by exact_mod_cast h) (spinGridPoint_pos_denom n).le | |
| lemma spinGridPoint_mem (n k : β) (hk : k β€ n+1) : spinGridPoint n k β Set.Icc 0 1 := by | |
| constructor | |
| Β· unfold spinGridPoint; positivity | |
| Β· rw [spinGridPoint, div_le_one (spinGridPoint_pos_denom n)] | |
| exact_mod_cast hk | |
| lemma spinGridPoint_zero (n : β) : spinGridPoint n 0 = 0 := by simp [spinGridPoint] | |
| lemma spinGridPoint_last (n : β) : spinGridPoint n (n+1) = 1 := by | |
| simp [spinGridPoint, ne_of_gt (spinGridPoint_pos_denom n)] | |
| lemma spinGridRanks_length (n : β) : (spinGridRanks n).length = n := by simp [spinGridRanks] | |
| lemma spinGridRanks_get (n j : β) (hj : j < n) : (spinGridRanks n)[j]! = spinGridPoint n (j+1) := by | |
| rw [getElem!_pos (spinGridRanks n) j (by simpa [spinGridRanks_length] using hj)] | |
| simp [spinGridRanks] | |
| lemma spinGridRanks_ordered (n : β) : (spinGridRanks n).Pairwise (Β· < Β·) := by | |
| apply List.pairwise_ofFn.mpr | |
| intro i j hij | |
| unfold spinGridPoint | |
| apply (div_lt_div_iff_of_pos_right (spinGridPoint_pos_denom n)).2 | |
| have hh : (i:β) < (j:β) := by exact_mod_cast hij | |
| simpa only [Nat.cast_add,Nat.cast_one,add_comm] using add_lt_add_right hh 1 | |
| lemma spinGridRanks_mem (n : β) : β a β spinGridRanks n, 0 < a β§ a < 1 := by | |
| intro a ha | |
| obtain β¨j,rflβ© := List.mem_ofFn.mp ha | |
| constructor | |
| Β· unfold spinGridPoint; positivity | |
| Β· rw [spinGridPoint,div_lt_one (spinGridPoint_pos_denom n)] | |
| have hh : (j:β) < (n:β) := by exact_mod_cast j.isLt | |
| simpa only [Nat.cast_add,Nat.cast_one,add_comm] using add_lt_add_right hh 1 | |
| def SphericalProfile.gridStep (p : SphericalProfile) (n : β) : SphericalStepProfile where | |
| ranks := spinGridRanks n | |
| variance := fun j => Real.toNNReal (p.val (spinGridPoint n (j+1))-p.val (spinGridPoint n j)) | |
| initial := Real.toNNReal (p.val 0) | |
| ordered := spinGridRanks_ordered n | |
| ranks_mem := spinGridRanks_mem n | |
| lemma gridStep_initial (p : SphericalProfile) (n : β) : | |
| ((p.gridStep n).initial:β) = p.val 0 := Real.coe_toNNReal _ (p.nonneg 0 (by norm_num)) | |
| lemma gridStep_variance (p : SphericalProfile) (n j : β) (hj : j < n) : | |
| ((p.gridStep n).variance j:β) = p.val (spinGridPoint n (j+1))-p.val (spinGridPoint n j) := by | |
| apply Real.coe_toNNReal | |
| exact sub_nonneg.mpr (p.mono (spinGridPoint_mem n j (by omega)) | |
| (spinGridPoint_mem n (j+1) (by omega)) (spinGridPoint_mono n (by omega))) | |
| lemma sum_range_ite_lt_real (f : β β β) (n k : β) (hk : k β€ n) : | |
| (β j β Finset.range n, if j < k then f j else 0) = β j β Finset.range k, f j := by | |
| symm | |
| calc | |
| _ = β j β Finset.range k, if j < k then f j else 0 := by | |
| apply Finset.sum_congr rfl | |
| intro j hj | |
| rw [ite_eq_left (Finset.mem_range.mp hj)] | |
| _ = _ := Finset.sum_subset (Finset.range_mono hk) (by | |
| intro j hj hnot | |
| rw [ite_eq_right (by simpa using hnot)]) | |
| lemma gridStep_val_cell (p : SphericalProfile) (n k : β) (hk : k β€ n) | |
| (s : β) (hs : s β Set.Ioo (spinGridPoint n k) (spinGridPoint n (k+1))) : | |
| (p.gridStep n).val s = p.val (spinGridPoint n k) := by | |
| change ((p.gridStep n).initial:β) + β j β Finset.range (spinGridRanks n).length, | |
| (if (spinGridRanks n)[j]! β€ s then ((p.gridStep n).variance j:β) else 0) = _ | |
| rw [gridStep_initial,spinGridRanks_length] | |
| have he : (β j β Finset.range n, if (spinGridRanks n)[j]! β€ s then | |
| ((p.gridStep n).variance j:β) else 0) = | |
| β j β Finset.range n, if j < k then | |
| p.val (spinGridPoint n (j+1))-p.val (spinGridPoint n j) else 0 := by | |
| apply Finset.sum_congr rfl | |
| intro j hj | |
| have hjn := Finset.mem_range.mp hj | |
| rw [spinGridRanks_get n j hjn,gridStep_variance p n j hjn] | |
| by_cases hjk : j < k | |
| Β· rw [ite_eq_left hjk,ite_eq_left ((spinGridPoint_mono n (by omega)).trans hs.1.le)] | |
| Β· rw [ite_eq_right hjk,ite_eq_right (not_le.mpr (hs.2.trans_le (spinGridPoint_mono n (by omega))))] | |
| rw [he,sum_range_ite_lt_real _ n k hk,Finset.sum_range_sub (fun j => p.val (spinGridPoint n j)) k,spinGridPoint_zero] | |
| ring | |
| end MicroscopicJamming | |
| end | |
| end OAI | |