Download data/lean/OAI/Probability/SKRatio/Variational/CompactField.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.79 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKRatio/Variational/CompactField.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKRatio/Variational/CompactField.lean
-
curl -L -o CompactField.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKRatio/Variational/CompactField.lean
4.79 kB
| import Mathlib | |
| import OAI.Probability.SKRatio.Calculus.PlusSpin | |
| import OAI.Probability.SKRatio.Variational.ScalarKernel | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open scoped BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter Set Real | |
| namespace SKRatio.Planted | |
| open Scalar Calculus | |
| abbrev FieldWeight := Set.Icc (0:β) 2 | |
| instance : CompactSpace FieldWeight := inferInstanceAs (CompactSpace (Set.Icc (0:β) 2)) | |
| def compactWeight (h : β) : FieldWeight := | |
| β¨w h, (w_pos h).le, by unfold w; linarith [(m_bounds h).1]β© | |
| lemma compactWeight_lipschitz : LipschitzWith 1 compactWeight := by | |
| apply LipschitzWith.of_dist_le_mul | |
| intro h t | |
| change |w h-w t| β€ (1:β)*|h-t| | |
| simpa only [w,m,sub_sub_sub_cancel_left,abs_sub_comm,one_mul] using tanh_lipschitz_abs h t | |
| @[simp] lemma compactWeight_coe (h : β) : (compactWeight h : β) = w h := rfl | |
| def compactV (a : FieldWeight) : β := (a:β)*(2-a) | |
| def compactF (p : FieldWeight Γ FieldWeight) : β := | |
| (p.2:β)^2*(2-p.2)^2/((p.1:β)+p.2) | |
| def compactK (p : FieldWeight Γ FieldWeight) : β := | |
| compactV p.1*compactV p.2/((p.1:β)+p.2) | |
| lemma compactV_nonneg (a : FieldWeight) : 0β€compactV a := | |
| mul_nonneg a.2.1 (sub_nonneg.mpr a.2.2) | |
| lemma compactV_le_one (a : FieldWeight) : compactV aβ€1 := by | |
| dsimp [compactV] | |
| nlinarith [sq_nonneg ((a:β)-1)] | |
| lemma compactV_le (a : FieldWeight) : compactV aβ€2*a := by | |
| dsimp [compactV] | |
| nlinarith [sq_nonneg (a:β)] | |
| lemma compactF_nonneg (p : FieldWeight Γ FieldWeight) : 0β€compactF p := by | |
| unfold compactF | |
| exact div_nonneg (mul_nonneg (sq_nonneg _) (sq_nonneg _)) (add_nonneg p.1.2.1 p.2.2.1) | |
| lemma compactK_nonneg (p : FieldWeight Γ FieldWeight) : 0β€compactK p := by | |
| unfold compactK | |
| exact div_nonneg (mul_nonneg (compactV_nonneg _) (compactV_nonneg _)) (add_nonneg p.1.2.1 p.2.2.1) | |
| lemma compactF_bound (p : FieldWeight Γ FieldWeight) : compactF p β€ 4*(p.2:β) := by | |
| by_cases hz : (p.1:β)+(p.2:β)=0 | |
| Β· simp only [compactF,hz,div_zero] | |
| exact mul_nonneg (by norm_num) p.2.2.1 | |
| have hd : 0<(p.1:β)+(p.2:β) := lt_of_le_of_ne (add_nonneg p.1.2.1 p.2.2.1) (Ne.symm hz) | |
| apply (div_le_iffβ hd).mpr | |
| have hs : (2-(p.2:β))^2β€4 := by nlinarith [p.2.2.1,p.2.2.2] | |
| have hm := mul_le_mul_of_nonneg_left hs (sq_nonneg (p.2:β)) | |
| nlinarith only [hm,mul_nonneg p.1.2.1 p.2.2.1] | |
| lemma compactK_bound (p : FieldWeight Γ FieldWeight) : compactK p β€ 4*(p.2:β) := by | |
| by_cases hz : (p.1:β)+(p.2:β)=0 | |
| Β· simp only [compactK,hz,div_zero] | |
| exact mul_nonneg (by norm_num) p.2.2.1 | |
| have hd : 0<(p.1:β)+(p.2:β) := lt_of_le_of_ne (add_nonneg p.1.2.1 p.2.2.1) (Ne.symm hz) | |
| apply (div_le_iffβ hd).mpr | |
| have hm := mul_le_mul (compactV_le p.1) (compactV_le p.2) | |
| (compactV_nonneg p.2) (mul_nonneg (by norm_num : (0:β)β€2) p.1.2.1) | |
| nlinarith only [hm,sq_nonneg (p.2:β)] | |
| lemma continuous_compactV : Continuous compactV := by unfold compactV; fun_prop | |
| lemma continuous_compact_div {f : FieldWeight Γ FieldWeight β β} | |
| (hnonneg : β p, 0β€f p) (hbound : β p, f pβ€4*(p.2:β)) | |
| (hoff : β p, (p.1:β)+(p.2:β)β 0 β ContinuousAt f p) : Continuous f := by | |
| apply continuous_iff_continuousAt.mpr | |
| intro p | |
| by_cases hz : (p.1:β)+(p.2:β)=0 | |
| Β· have h2 : (p.2:β)=0 := by linarith [p.1.2.1,p.2.2.1] | |
| have hp : f p=0 := le_antisymm (by simpa [h2] using hbound p) (hnonneg p) | |
| rw [ContinuousAt,hp] | |
| apply tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds | |
| (h := fun q : FieldWeight Γ FieldWeight => 4*(q.2:β)) | |
| (by simpa only [ContinuousAt,h2,mul_zero] using | |
| (show Continuous (fun q : FieldWeight Γ FieldWeight => 4*(q.2:β)) by fun_prop).continuousAt (x := p)) | |
| hnonneg hbound | |
| Β· exact hoff p hz | |
| lemma continuous_compactF : Continuous compactF := by | |
| apply continuous_compact_div compactF_nonneg compactF_bound | |
| intro p hp | |
| exact ContinuousAt.div (by fun_prop) (by fun_prop) hp | |
| lemma continuous_compactK : Continuous compactK := by | |
| apply continuous_compact_div compactK_nonneg compactK_bound | |
| intro p hp | |
| exact ContinuousAt.div | |
| ((continuous_compactV.comp continuous_fst).mul (continuous_compactV.comp continuous_snd)).continuousAt | |
| (by fun_prop) hp | |
| lemma compactV_weight (h : β) : compactV (compactWeight h) = v h := by | |
| unfold compactV compactWeight w v | |
| dsimp | |
| ring | |
| lemma compactF_weight (h t : β) : compactF (compactWeight h,compactWeight t) = | |
| v t^2/(w h+w t) := by | |
| unfold compactF | |
| simp only [compactWeight_coe,βmul_pow] | |
| rw [show w t*(2-w t)=v t from compactV_weight t] | |
| lemma compactK_weight (h t : β) : compactK (compactWeight h,compactWeight t) = | |
| kernel h t := by | |
| unfold compactK kernel | |
| rw [compactV_weight,compactV_weight] | |
| rfl | |
| end SKRatio.Planted | |
| end | |
| end | |
| end OAI | |