Download data/lean/OAI/Probability/LogConcave/JetEstimates/ProperSplit.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.37 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/LogConcave/JetEstimates/ProperSplit.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/LogConcave/JetEstimates/ProperSplit.lean
-
curl -L -o ProperSplit.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/LogConcave/JetEstimates/ProperSplit.lean
6.37 kB
| import Mathlib | |
| import OAI.Probability.LogConcave.JetEstimates.AllSplitBound | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| namespace LogConcaveSampling.TensorEnergy | |
| open scoped BigOperators Classical Matrix.Norms.L2Operator | |
| variable {I J : Type*} [Fintype I] [Fintype J] | |
| lemma bound_norm (A : Matrix I J β) : Bound A (βAβ^2) := by | |
| intro v | |
| have h := A.l2_opNorm_mulVec (WithLp.toLp 2 v) | |
| have hs := pow_le_pow_leftβ (norm_nonneg _) h 2 | |
| change β(WithLp.toLp 2 (fun i => βj,A i j*v j) : EuclideanSpace β I)β^2 β€ | |
| (βAβ*β(WithLp.toLp 2 v : EuclideanSpace β J)β)^2 at hs | |
| simpa only [mul_pow,EuclideanSpace.real_norm_sq_eq] using hs | |
| lemma Bound.norm_le {A : Matrix I J β} {M : β} (hM : 0β€M) (h : Bound A (M^2)) : | |
| βAββ€M := by | |
| apply ContinuousLinearMap.opNorm_le_bound _ hM | |
| intro v | |
| apply (sq_le_sqβ (norm_nonneg _) (mul_nonneg hM (norm_nonneg v))).mp | |
| change β(WithLp.toLp 2 (fun i => βj,A i j*(WithLp.ofLp v) j) : EuclideanSpace β I)β^2 β€ | |
| (M*βvβ)^2 | |
| simpa only [mul_pow,EuclideanSpace.real_norm_sq_eq] using h (WithLp.ofLp v) | |
| lemma bound_iff_norm_le {A : Matrix I J β} {M : β} (hM : 0β€M) : | |
| Bound A (M^2) β βAββ€M := by | |
| refine β¨Bound.norm_le hM,fun h => ?_β© | |
| intro v | |
| exact (bound_norm A v).trans (mul_le_mul_of_nonneg_right | |
| (pow_le_pow_leftβ (norm_nonneg _) h 2) (energy_nonneg v)) | |
| end LogConcaveSampling.TensorEnergy | |
| end | |
| end | |
| section | |
| noncomputable section | |
| namespace LogConcaveSampling.TensorEnergy | |
| open scoped BigOperators Classical Matrix.Norms.L2Operator | |
| universe u | |
| variable {S : Type u} [Fintype S] {d : β} | |
| def ProperSplit (S : Type u) := | |
| {p : S β Bool // (βs,p s=true) β§ (βs,p s=false)} | |
| instance : Fintype (ProperSplit S) := inferInstanceAs (Fintype {_p : S β Bool // _}) | |
| def InSlots (p : ProperSplit S) := {s : S // p.val s=true} | |
| def OutSlots (p : ProperSplit S) := {s : S // Β¬p.val s=true} | |
| instance (p : ProperSplit S) : Fintype (InSlots p) := inferInstanceAs (Fintype {_s : S // _}) | |
| instance (p : ProperSplit S) : Fintype (OutSlots p) := inferInstanceAs (Fintype {_s : S // _}) | |
| instance (p : ProperSplit S) : Nonempty (InSlots p) := by | |
| obtain β¨s,hsβ© := p.property.1 | |
| exact β¨s,hsβ© | |
| instance (p : ProperSplit S) : Nonempty (OutSlots p) := by | |
| obtain β¨s,hsβ© := p.property.2 | |
| exact β¨s,by simp [hs]β© | |
| def splitEquiv (p : ProperSplit S) : S β InSlots p β OutSlots p := | |
| (Equiv.sumCompl (fun s => p.val s=true)).symm | |
| def splitMatrix (T : (S β Fin d) β β) (p : ProperSplit S) : | |
| Matrix (OutSlots p β Fin d) (InSlots p β Fin d) β := | |
| fun o i => T (fun s => Sum.elim i o (splitEquiv p s)) | |
| def splitEnvelope (T : (S β Fin d) β β) : β := | |
| βp : ProperSplit S, βsplitMatrix T pβ | |
| lemma splitEnvelope_nonneg (T : (S β Fin d) β β) : 0 β€ splitEnvelope T := | |
| Finset.sum_nonneg (fun _ _ => norm_nonneg _) | |
| lemma splitMatrix_norm_le (T : (S β Fin d) β β) (p : ProperSplit S) : | |
| βsplitMatrix T pβ β€ splitEnvelope T := | |
| Finset.single_le_sum (fun _ _ => norm_nonneg _) (Finset.mem_univ p) | |
| section arbitrary | |
| variable {I O : Type u} [Fintype I] [Fintype O] [Nonempty I] [Nonempty O] | |
| def properOfEquiv (e : S β I β O) : ProperSplit S := | |
| β¨fun s => (e s).isLeft, by | |
| constructor | |
| Β· obtain β¨iβ© := βΉNonempty IβΊ | |
| exact β¨e.symm (Sum.inl i),by simpβ© | |
| Β· obtain β¨oβ© := βΉNonempty OβΊ | |
| exact β¨e.symm (Sum.inr o),by simpβ©β© | |
| def leftOfEquiv (e : S β I β O) : I β InSlots (properOfEquiv e) where | |
| toFun i := β¨e.symm (Sum.inl i),by simp [properOfEquiv]β© | |
| invFun s := (e s.val).getLeft s.property | |
| left_inv i := by simp | |
| right_inv s := by | |
| apply Subtype.ext | |
| apply e.injective | |
| simp only [Equiv.apply_symm_apply] | |
| exact Sum.inl_getLeft _ _ | |
| def rightOfEquiv (e : S β I β O) : O β OutSlots (properOfEquiv e) where | |
| toFun o := β¨e.symm (Sum.inr o),by simp [properOfEquiv]β© | |
| invFun s := (e s.val).getRight (by simpa [properOfEquiv] using s.property) | |
| left_inv o := by simp | |
| right_inv s := by | |
| apply Subtype.ext | |
| apply e.injective | |
| simp only [Equiv.apply_symm_apply] | |
| exact Sum.inr_getRight _ _ | |
| omit [Fintype S] [Fintype I] [Fintype O] in | |
| lemma splitEquiv_ofEquiv (e : S β I β O) (s : S) : | |
| splitEquiv (properOfEquiv e) s = | |
| Sum.map (leftOfEquiv e) (rightOfEquiv e) (e s) := by | |
| apply (splitEquiv (properOfEquiv e)).symm.injective | |
| simp only [Equiv.symm_apply_apply] | |
| cases h : e s with | |
| | inl i => | |
| have he : e.symm (Sum.inl i)=s := e.symm_apply_eq.mpr h.symm | |
| change s=e.symm (Sum.inl i) | |
| exact he.symm | |
| | inr o => | |
| have he : e.symm (Sum.inr o)=s := e.symm_apply_eq.mpr h.symm | |
| change s=e.symm (Sum.inr o) | |
| exact he.symm | |
| end arbitrary | |
| lemma allSplitBound_envelope (T : (S β Fin d) β β) : | |
| AllSplitBound T (splitEnvelope T) := by | |
| intro I O _ _ _ _ _ _ e | |
| have h := (bound_norm (splitMatrix T (properOfEquiv e))).mono | |
| (pow_le_pow_leftβ (norm_nonneg _) (splitMatrix_norm_le T (properOfEquiv e)) 2) | |
| have h' := h.reindex (Equiv.arrowCongr (rightOfEquiv e) (Equiv.refl (Fin d))) | |
| (Equiv.arrowCongr (leftOfEquiv e) (Equiv.refl (Fin d))) | |
| convert h' using 1 | |
| ext o i | |
| unfold splitMatrix | |
| congr 1 | |
| funext s | |
| rw [splitEquiv_ofEquiv] | |
| cases e s <;> simp | |
| lemma splitEnvelope_le {T : (S β Fin d) β β} {M : β} | |
| (hM : 0β€M) (h : AllSplitBound T M) : | |
| splitEnvelope T β€ Fintype.card (ProperSplit S)*M := by | |
| calc | |
| _ β€ βp : ProperSplit S,M := Finset.sum_le_sum (fun p _ => | |
| Bound.norm_le hM (h _ _ (splitEquiv p))) | |
| _ = _ := by simp | |
| lemma measurable_splitEnvelope {Ξ© : Type*} [MeasurableSpace Ξ©] | |
| (T : Ξ© β (S β Fin d) β β) (hT : βc,Measurable (fun x => T x c)) : | |
| Measurable (fun x => splitEnvelope (T x)) := by | |
| apply Finset.measurable_sum | |
| intro p _ | |
| let : MeasurableSpace (Matrix (OutSlots p β Fin d) (InSlots p β Fin d) β) := | |
| inferInstanceAs (MeasurableSpace ((OutSlots p β Fin d) β (InSlots p β Fin d) β β)) | |
| have : BorelSpace (Matrix (OutSlots p β Fin d) (InSlots p β Fin d) β) := | |
| inferInstanceAs (BorelSpace ((OutSlots p β Fin d) β (InSlots p β Fin d) β β)) | |
| apply Measurable.norm | |
| exact Measurable.of_eval (fun _ => Measurable.of_eval (fun _ => hT _)) | |
| end LogConcaveSampling.TensorEnergy | |
| end | |
| end | |
| end | |
| end OAI | |