Download data/lean/OAI/Geometry/BallPacking/Models/EqualNormalModelConvergence.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 25.4 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/BallPacking/Models/EqualNormalModelConvergence.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/BallPacking/Models/EqualNormalModelConvergence.lean
-
curl -L -o EqualNormalModelConvergence.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/BallPacking/Models/EqualNormalModelConvergence.lean
25.4 kB
| import Mathlib | |
| import OAI.Geometry.BallPacking.Moser.AnnularFinalPacking | |
| namespace OAI | |
| noncomputable section | |
| namespace PackingSufficiencySupport.Hamiltonian | |
| open scoped ContDiff Manifold Topology BigOperators | |
| open Set Function Manifold MeasureTheory Filter | |
| theorem equalNormalCoefficient_pos {m : β} {b d : β} (hb : 0β€b) (hbd : b*d<1) | |
| {p : Fin m β β} (hp : (β j,p j)β€d) : 0<equalNormalCoefficient m b p := by | |
| unfold equalNormalCoefficient | |
| have hle := mul_le_mul_of_nonneg_left hp hb | |
| linarith | |
| theorem equalNormalCoefficient_le_one {m : β} {b : β} (hb : 0β€b) | |
| {p : Fin m β β} (hp : β j,0β€p j) : equalNormalCoefficient m b pβ€1 := by | |
| unfold equalNormalCoefficient | |
| exact sub_le_self _ (mul_nonneg hb (Finset.sum_nonneg (fun j _ => hp j))) | |
| theorem equalNormalCoefficient_uniform_limit {m : β} {b d a : β} | |
| (hb : 0β€b) (hbd : b*d<1) {P : Set (Fin m β β)} | |
| (hP : β pβP,(β j,0β€p j) β§ (β j,p j)β€d) | |
| {mass : β β β} (hmass : Tendsto mass atTop (π a)) : | |
| TendstoUniformlyOn (fun β p => equalNormalCoefficient m b p * mass β) | |
| (fun p => a * equalNormalCoefficient m b p) atTop P := by | |
| rw [Metric.tendstoUniformlyOn_iff] | |
| intro Ξ΅ hΞ΅ | |
| have hm : βαΆ β in atTop,dist (mass β) a<Ξ΅ := | |
| hmass.eventually (Metric.ball_mem_nhds a hΞ΅) | |
| filter_upwards [hm] with β hβ p hp | |
| have hc0 := equalNormalCoefficient_pos hb hbd (hP p hp).2 | |
| have hc1 := equalNormalCoefficient_le_one hb (hP p hp).1 | |
| rw [Real.dist_eq,show a*equalNormalCoefficient m b p- | |
| equalNormalCoefficient m b p*mass β = equalNormalCoefficient m b p*(a-mass β) by ring, | |
| abs_mul,abs_of_pos hc0] | |
| calc | |
| equalNormalCoefficient m b p * |a-mass β| β€ |a-mass β| := | |
| mul_le_of_le_one_left (abs_nonneg _) hc1 | |
| _ < Ξ΅ := by simpa only [Real.dist_eq,abs_sub_comm] using hβ | |
| variable {M : Type*} [TopologicalSpace M] [ChartedSpace Plane M] | |
| [IsManifold π(β,Plane) β M] [T2Space M] [PreconnectedSpace M] | |
| [NormalSpace M] [SigmaCompactSpace M] | |
| theorem exists_equalNormalPrimitive_sequence {m : β} | |
| (D : β β Set M) (hD : β β,IsCompact (D β)) | |
| (hproper : β β,(D β)αΆ.Nonempty) (hor : PositivePlaneTransitions M) | |
| {Ο : ManifoldTwoForm Plane M} (hΟ : SmoothTwoForm Ο) | |
| (hskew : β x u v,Ο x u v= -Ο x v u) | |
| (b : β) (A : β β Fin m β ManifoldOneForm Plane M) | |
| (hA : β β j,SmoothOneFormFamily (fun _ : β => A β j)) | |
| (hdA : β β,βαΆ x in πΛ’ (D β),β j,manifoldExteriorOneForm (A β j) x=(-b) β’ Ο x) : | |
| β Ξ³ : β β ManifoldOneForm Plane M, | |
| (β β,SmoothOneFormFamily (fun _ : β => Ξ³ β)) β§ | |
| (β β,β L : Set M,IsCompact L β§ β x,xβL β Ξ³ β x=0) β§ | |
| (β β,SmoothOneFormFamily (equalNormalPrimitive (Ξ³ β) (A β))) β§ | |
| β β,βαΆ x in πΛ’ (D β),β p, | |
| manifoldExteriorOneForm (equalNormalPrimitive (Ξ³ β) (A β) p) x = | |
| equalNormalCoefficient m b p β’ Ο x := by | |
| classical | |
| have hex β := exists_base_primitive_near_compact (hD β) (hproper β) hor hΟ hskew | |
| choose Ξ³ L hL hΞ³ hΞ³z hdΞ³ using hex | |
| refine β¨Ξ³,hΞ³,fun β => β¨L β,hL β,hΞ³z ββ©, | |
| fun β => equalNormalPrimitive_smooth (hΞ³ β) (hA β),?_β© | |
| intro β | |
| filter_upwards [hdΞ³ β,hdA β] with x hxΞ³ hxA | |
| exact equalNormalPrimitive_exterior (hΞ³ β) (hA β) b Ο hxΞ³ hxA | |
| variable [MeasurableSpace M] [BorelSpace M] | |
| omit [PreconnectedSpace M] [NormalSpace M] in | |
| theorem equalNormalPrimitive_mass {m : β} {D : Set M} (hD : IsCompact D) | |
| (Ξ : (Fin m β β) β ManifoldOneForm Plane M) | |
| (Ο : ManifoldTwoForm Plane M) (b : β) | |
| (hd : β xβD,β p,manifoldExteriorOneForm (Ξ p) x=equalNormalCoefficient m b p β’ Ο x) | |
| (p : Fin m β β) : | |
| compactSurfaceFormIntegral hD (manifoldExteriorOneForm (Ξ p)) = | |
| equalNormalCoefficient m b p * compactSurfaceFormIntegral hD Ο := by | |
| rw [compactSurfaceFormIntegral_congr hD (fun x hx => hd x hx p)] | |
| exact compactSurfaceFormIntegral_smul hD _ Ο | |
| omit [PreconnectedSpace M] [NormalSpace M] in | |
| theorem equalNormalPrimitive_area_limit {m : β} | |
| (D : β β Set M) (hD : β β,IsCompact (D β)) | |
| (Ξ : β β (Fin m β β) β ManifoldOneForm Plane M) | |
| (Ο : ManifoldTwoForm Plane M) {b d a : β} (hb : 0β€b) (hbd : b*d<1) | |
| {P : Set (Fin m β β)} (hP : β pβP,(β j,0β€p j) β§ (β j,p j)β€d) | |
| (hd : β β,β xβD β,β p, | |
| manifoldExteriorOneForm (Ξ β p) x=equalNormalCoefficient m b p β’ Ο x) | |
| (hmass : Tendsto (fun β => compactSurfaceFormIntegral (hD β) Ο) atTop (π a)) : | |
| TendstoUniformlyOn (fun β p => compactSurfaceFormIntegral (hD β) | |
| (manifoldExteriorOneForm (Ξ β p))) | |
| (fun p => a * equalNormalCoefficient m b p) atTop P := by | |
| have he β p := equalNormalPrimitive_mass (hD β) (Ξ β) Ο b (hd β) p | |
| simp_rw [he] | |
| exact equalNormalCoefficient_uniform_limit hb hbd hP hmass | |
| end PackingSufficiencySupport.Hamiltonian | |
| namespace PackingSufficiencySupport.DiagonalQuadrics | |
| open scoped ContDiff Manifold Topology BigOperators | |
| open Set Function Filter Manifold MeasureTheory | |
| open Hamiltonian | |
| variable {m q : β} (a : Fin m β β) [Fact (Injective a)] [Fact (β j,a jβ 0)] | |
| local instance : SigmaCompactSpace (locus a) := curveSigmaCompact a | |
| def normalHorizontalPrimitive (b : β) (p : Fin q β β) : ManifoldOneForm Plane (locus a) := | |
| equalNormalCoefficient q b p β’ curveFSPrimitive a (1/Real.pi) | |
| theorem normalHorizontalPrimitive_smooth (b : β) : | |
| SmoothOneFormFamily (normalHorizontalPrimitive (q := q) a b) := | |
| ((curveFSPrimitive_smooth a (1/Real.pi)).comp | |
| (f := fun _ : Fin q β β => (0:β)) contDiff_const).smul (equalNormalCoefficient_smooth q b) | |
| theorem normalHorizontalPrimitive_exterior (b : β) (p : Fin q β β) (x : locus a) : | |
| manifoldExteriorOneForm (normalHorizontalPrimitive a b p) x= | |
| equalNormalCoefficient q b p β’ curveFSForm a (1/Real.pi) x := by | |
| have hx := (extChartAt π(β,Plane) x).map_source (mem_extChartAt_source x) | |
| rw [normalHorizontalPrimitive,manifoldExteriorOneForm_smul_at _ | |
| ((curveFSPrimitive_smooth a (1/Real.pi)).spatial_smooth 0 x hx),curveFSPrimitive_exterior] | |
| theorem normalHorizontalPrimitive_area_limit {b d : β} (hb : 0β€b) (hbd : b*d<1) | |
| {P : Set (Fin q β β)} (hP : β pβP,(β j,0β€p j) β§ (β j,p j)β€d) : | |
| TendstoUniformlyOn (fun β p => compactSurfaceFormIntegral | |
| (projectionDomain_compact a (exhaustionRadius a β)) | |
| (fun x => equalNormalCoefficient q b p β’ curveFSForm a (1/Real.pi) x)) | |
| (fun p => (2:β)^m*equalNormalCoefficient q b p) atTop P := by | |
| have he p : (fun x => equalNormalCoefficient q b p β’ curveFSForm a (1/Real.pi) x)= | |
| equalNormalCoefficient q b p β’ curveFSForm a (1/Real.pi) := rfl | |
| simp_rw [he,compactSurfaceFormIntegral_smul] | |
| exact equalNormalCoefficient_uniform_limit hb hbd hP (tendsto_normalized_exhaustion_area a) | |
| end PackingSufficiencySupport.DiagonalQuadrics | |
| namespace PackingSufficiencySupport.DiagonalQuadrics.Explicit | |
| open scoped ContDiff Manifold Topology | |
| open Set Function Filter Manifold | |
| open Hamiltonian | |
| variable (m : β) | |
| theorem transverse_transition_differentiable (c : Surface m) {z : β} | |
| (hz : zβtransverseAnnulusDomain m) : | |
| DifferentiableAt β (((normalChartAt (parameters m) c).sliceChart c) β | |
| (transverseAnnulusChart m).symm) z := by | |
| let n := normalChartAt (parameters m) c | |
| have hs := (curveCoordinate n.coordinate).contDiff.contDiffAt.comp z | |
| (transverseAnnulusPoint_contDiffAt m hz) | |
| apply (hs.differentiableAt (by simp)).congr_of_eventuallyEq | |
| filter_upwards [(transverseAnnulusDomain_isOpen m).mem_nhds hz] with t ht | |
| change curveCoordinate n.coordinate ((transverseAnnulusInverse m t).val)=_ | |
| rw [transverseAnnulusInverse_val m ht.1] | |
| rfl | |
| theorem transverse_transition_inverse_differentiable (c : Surface m) {z : β} | |
| (hz : zβ((normalChartAt (parameters m) c).sliceChart c).target) : | |
| DifferentiableAt β ((transverseAnnulusChart m) β | |
| ((normalChartAt (parameters m) c).sliceChart c).symm) z := by | |
| have hs := ((normalChartAt (parameters m) c).sliceChart_inverse_smooth c).contDiffAt | |
| (((normalChartAt (parameters m) c).sliceChart c).open_target.mem_nhds hz) | |
| exact ((transverseCoordinate m).contDiff.contDiffAt.comp z hs).differentiableAt (by simp) | |
| theorem transverseDiffeomorph_positive : PositivePartialChart (transverseDiffeomorph m) := by | |
| intro c y hy hc | |
| let n := normalChartAt (parameters m) c | |
| let e := (transverseAnnulusChart m).symm.trans (n.sliceChart c) | |
| have hchart : chartAt Plane c=realChart (parameters m) c := rfl | |
| have hc' : transverseDiffeomorph m yβ(n.sliceChart c).source := by | |
| simpa only [mfld_simps,hchart,realChart_source] using hc | |
| have hy' : Complex.equivRealProdCLM.symm yβtransverseAnnulusDomain m := by | |
| simpa only [transverseDiffeomorph_source,mem_preimage] using hy | |
| have hye : Complex.equivRealProdCLM.symm yβe.source := β¨hy',hc'β© | |
| have h := holomorphic_partialHomeomorph_orientation e hye | |
| (transverse_transition_differentiable m c hy') | |
| (transverse_transition_inverse_differentiable m c (n.sliceChart c |>.map_source hc')) | |
| simpa only [e,mfld_simps,hchart,realChart,realTransverseChart, | |
| transverseDiffeomorph,Function.comp_def,OpenPartialHomeomorph.trans_apply, | |
| ContinuousLinearEquiv.coe_toHomeomorph] using h | |
| end PackingSufficiencySupport.DiagonalQuadrics.Explicit | |
| namespace PackingSufficiencySupport.Hamiltonian | |
| open scoped ContDiff Manifold Topology | |
| open Set Function Manifold | |
| def rectanglePolar (y : Plane) : Plane := | |
| Complex.equivRealProdCLM (cylinderComplexMap (cylinderCover y)) | |
| theorem rectanglePolar_smooth : ContDiff β β rectanglePolar := by | |
| apply contMDiff_iff_contDiff.mp | |
| exact Complex.equivRealProdCLM.contDiff.contMDiff.comp | |
| (cylinderComplexMap_smooth.comp cylinderCover_smooth) | |
| theorem rectanglePolar_det (y : Plane) : | |
| (fderiv β rectanglePolar y).det=2*Real.pi*(Real.exp y.1)^2 := by | |
| let u : β := circleTurn y.2 | |
| have h1 := (Complex.ofRealCLM.hasFDerivAt.comp y.1 (Real.hasDerivAt_exp y.1).hasFDerivAt).comp y | |
| (hasFDerivAt_fst : HasFDerivAt (@Prod.fst β β) (ContinuousLinearMap.fst β β β) y) | |
| have h2 := (circleTurn_deriv y.2).hasFDerivAt.comp y | |
| (hasFDerivAt_snd : HasFDerivAt (@Prod.snd β β) (ContinuousLinearMap.snd β β β) y) | |
| have hh := Complex.equivRealProdCLM.hasFDerivAt.comp y (h1.mul h2) | |
| change HasFDerivAt rectanglePolar _ y at hh | |
| rw [hh.fderiv,planar_det,planarArea_apply] | |
| have hu : u.re^2+u.im^2=1 := by | |
| have h := Complex.sq_norm (u) | |
| rw [show βuβ=1 from Circle.norm_coe _,one_pow] at h | |
| simpa only [Complex.normSq_apply,pow_two] using h.symm | |
| simp [Function.comp_def,Complex.mul_re,Complex.mul_im,Complex.exp_ofReal_re] | |
| calc | |
| _=2*Real.pi*(Real.exp y.1)^2*(u.re^2+u.im^2) := by ring | |
| _=_ := by rw [hu,mul_one] | |
| theorem rectanglePolar_det_pos (y : Plane) : 0<(fderiv β rectanglePolar y).det := by | |
| rw [rectanglePolar_det] | |
| exact mul_pos (mul_pos (by norm_num) Real.pi_pos) (sq_pos_of_pos (Real.exp_pos _)) | |
| end PackingSufficiencySupport.Hamiltonian | |
| namespace PackingSufficiencySupport.DiagonalQuadrics.Explicit | |
| open scoped ContDiff Manifold Topology | |
| open Set Function Manifold | |
| open Hamiltonian | |
| variable (m : β) | |
| theorem fixed_handle_densityChart_positive (H : AnnularHandleData Plane (Surface m)) | |
| (hH : H.chart=restrictedTransverseCylinder m (transverseCylinderWidth m/2)) : | |
| PositivePartialChart H.densityChart := by | |
| have heq : (H.densityChart : Plane β Surface m)=transverseDiffeomorph m β rectanglePolar := by | |
| funext y | |
| rw [AnnularHandleData.densityChart_apply,hH] | |
| rfl | |
| intro c y hy hc | |
| have hys : cylinderCover yβH.chart.source := hy.2 | |
| rw [hH] at hys | |
| have hyc : cylinderCover yβ(transverseCylinder m).source := hys.1 | |
| rw [transverseCylinder_source] at hyc | |
| have hyd : rectanglePolar yβ(transverseDiffeomorph m).source := by | |
| rw [transverseDiffeomorph_source] | |
| change Complex.equivRealProdCLM.symm (Complex.equivRealProdCLM | |
| (cylinderComplexMap (cylinderCover y)))βtransverseAnnulusDomain m | |
| simpa only [ContinuousLinearEquiv.symm_apply_apply,mem_preimage] using hyc | |
| have hc' : transverseDiffeomorph m (rectanglePolar y)β(extChartAt π(β,Plane) c).source := by | |
| simpa only [heq,Function.comp_apply] using hc | |
| have hpos := transverseDiffeomorph_positive m c (rectanglePolar y) hyd hc' | |
| have hf : DifferentiableAt β (extChartAt π(β,Plane) c β transverseDiffeomorph m) (rectanglePolar y) := by | |
| have hi := (transverseDiffeomorph m).contMDiffOn.contMDiffAt | |
| ((transverseDiffeomorph m).open_source.mem_nhds hyd) | |
| have ho := contMDiffAt_extChartAt' (I := π(β,Plane)) (n := β) (x := c) | |
| (by simpa only [extChartAt_source] using hc') | |
| exact (ho.comp _ hi).contDiffAt.differentiableAt (by simp) | |
| rw [heq,β Function.comp_assoc,fderiv_comp y hf (rectanglePolar_smooth.differentiable (by simp) y)] | |
| change 0<LinearMap.det ((fderiv β (extChartAt π(β,Plane) c β transverseDiffeomorph m) | |
| (rectanglePolar y)).toLinearMap.comp (fderiv β rectanglePolar y).toLinearMap) | |
| rw [LinearMap.det_comp] | |
| exact mul_pos hpos (rectanglePolar_det_pos y) | |
| theorem exists_positive_fixed_annularHandleData : | |
| β H : AnnularHandleData Plane (Surface m), | |
| H.width=transverseCylinderWidth m/2 β§ | |
| H.clock=positiveCircleClock (1/4) β§ PositivePartialChart H.densityChart := by | |
| obtain β¨H,hw,hH,hfβ© := exists_fixed_annularHandleData m | |
| exact β¨H,hw,hf,fixed_handle_densityChart_positive m H hHβ© | |
| theorem exists_positive_annularHandleData : | |
| β H : AnnularHandleData Plane (Surface m),PositivePartialChart H.densityChart := by | |
| obtain β¨H,_,hH,_β© := exists_fixed_annularHandleData m | |
| exact β¨H,fixed_handle_densityChart_positive m H hHβ© | |
| end PackingSufficiencySupport.DiagonalQuadrics.Explicit | |
| namespace PackingSufficiencySupport | |
| open scoped BigOperators | |
| open Set MeasureTheory | |
| def momentSimplex (m : β) (h : β) : Set (Fin m β β) := | |
| {p | (β i, 0 β€ p i) β§ β i, p i β€ h} | |
| theorem momentSimplex_isClosed (m : β) (h : β) : IsClosed (momentSimplex m h) := by | |
| have hβ : IsClosed {p : Fin m β β | β i, 0 β€ p i} := by | |
| simp only [ofPred_forall] | |
| exact isClosed_iInter fun i => isClosed_le continuous_const (continuous_apply i) | |
| exact hβ.inter (isClosed_le (continuous_finsetSum _ fun i _ => continuous_apply i) continuous_const) | |
| theorem momentSimplex_isCompact (m : β) (h : β) : IsCompact (momentSimplex m h) := by | |
| refine (isCompact_Icc (a := (fun _ : Fin m => (0:β))) (b := fun _ => h)).of_isClosed_subset (momentSimplex_isClosed m h) ?_ | |
| intro p hp | |
| refine β¨hp.1,fun i => ?_β© | |
| exact (Finset.single_le_sum (fun j _ => hp.1 j) (Finset.mem_univ i)).trans hp.2 | |
| theorem momentSimplex_cons {m : β} (h t : β) (p : Fin m β β) : | |
| Fin.cons t p β momentSimplex (m+1) h β 0 β€ t β§ p β momentSimplex m (h-t) := by | |
| simp only [momentSimplex,mem_ofPred_eq,Fin.forall_fin_succ,Fin.cons_zero, | |
| Fin.cons_succ,Fin.sum_univ_succ] | |
| constructor | |
| Β· rintro β¨β¨ht,hpβ©,hsβ© | |
| exact β¨ht,hp,by linarithβ© | |
| Β· rintro β¨ht,hp,hsβ© | |
| exact β¨β¨ht,hpβ©,by linarithβ© | |
| theorem integrable_simplex_power (m k : β) (h : β) : | |
| Integrable ((momentSimplex m h).indicator (fun p => (h-β i,p i)^k)) := by | |
| apply (integrable_indicator_iff (momentSimplex_isClosed m h).measurableSet).2 | |
| exact (((continuous_const.sub (continuous_finsetSum _ fun i _ => continuous_apply i)).pow k).continuousOn).integrableOn_compact (momentSimplex_isCompact m h) | |
| theorem simplex_power_cons {m k : β} (h t : β) (p : Fin m β β) : | |
| (momentSimplex (m+1) h).indicator (fun q => (h-β i,q i)^k) (Fin.cons t p) = | |
| (Icc 0 h).indicator (fun s => (momentSimplex m (h-s)).indicator | |
| (fun q => (h-s-β i,q i)^k) p) t := by | |
| by_cases ht : t β Icc 0 h | |
| Β· rw [indicator_of_mem ht] | |
| by_cases hp : p β momentSimplex m (h-t) | |
| Β· rw [indicator_of_mem hp,indicator_of_mem ((momentSimplex_cons h t p).2 β¨ht.1,hpβ©)] | |
| congr 1 | |
| simp only [Fin.sum_univ_succ,Fin.cons_zero,Fin.cons_succ] | |
| ring | |
| Β· rw [indicator_of_notMem hp,indicator_of_notMem (by | |
| intro hh; exact hp ((momentSimplex_cons h t p).1 hh).2)] | |
| Β· rw [indicator_of_notMem ht,indicator_of_notMem (by | |
| intro hh | |
| obtain β¨ht0,hpβ© := (momentSimplex_cons h t p).1 hh | |
| have hs : 0 β€ β i,p i := Finset.sum_nonneg fun i _ => hp.1 i | |
| exact ht β¨ht0,by linarith [hp.2]β©)] | |
| theorem integral_simplex_power_step (m k : β) (h : β) : | |
| (β« p in momentSimplex (m+1) h, (h-β i,p i)^k) = | |
| β« t in Icc 0 h, β« p in momentSimplex m (h-t), (h-t-β i,p i)^k := by | |
| let e := (MeasurableEquiv.piFinSuccAbove (fun _ : Fin (m+1) => β) 0).symm | |
| have he := (volume_preserving_piFinSuccAbove (fun _ : Fin (m+1) => β) 0).symm | |
| let f := (momentSimplex (m+1) h).indicator (fun p => (h-β i,p i)^k) | |
| have hi : Integrable (f β e) := (he.integrable_comp_emb e.measurableEmbedding).2 | |
| (integrable_simplex_power (m+1) k h) | |
| rw [βintegral_indicator (momentSimplex_isClosed (m+1) h).measurableSet] | |
| change (β« p, f p) = _ | |
| rw [βhe.integral_comp e.measurableEmbedding] | |
| change (β« x, (f β e) x β(volume.prod volume)) = _ | |
| rw [integral_prod _ hi] | |
| have hes (x : β Γ (Fin m β β)) : e x = Fin.cons x.1 x.2 := by | |
| ext i | |
| refine Fin.cases ?_ (fun j => ?_) i <;> | |
| simp [e,MeasurableEquiv.piFinSuccAbove_symm_apply,Fin.insertNthEquiv] | |
| simp only [Function.comp_apply,hes,f,simplex_power_cons] | |
| rw [βintegral_indicator measurableSet_Icc] | |
| congr 1 | |
| funext t | |
| by_cases ht : t β Icc 0 h | |
| Β· simp only [indicator_of_mem ht] | |
| exact integral_indicator (momentSimplex_isClosed m (h-t)).measurableSet | |
| Β· simp [ht] | |
| theorem integral_simplex_power (m k : β) {h : β} (hh : 0 β€ h) : | |
| (β« p in momentSimplex m h, (h-β i,p i)^k) = | |
| (k.factorial : β) / ((m+k).factorial : β) * h^(m+k) := by | |
| induction m generalizing h with | |
| | zero => | |
| have hv : (volume : Measure (Fin 0 β β)) univ = 1 := Measure.pi_empty_univ _ | |
| have hfac : (k.factorial : β) β 0 := by positivity | |
| simp [momentSimplex,hh,hv,measureReal_def,hfac] | |
| | succ m ih => | |
| rw [integral_simplex_power_step] | |
| have hc : (β« t in Icc 0 h, β« p in momentSimplex m (h-t), (h-t-β i,p i)^k) = | |
| β« t in Icc 0 h, (k.factorial : β) / ((m+k).factorial : β) * (h-t)^(m+k) := by | |
| apply setIntegral_congr_fun measurableSet_Icc | |
| intro t ht | |
| exact ih (by linarith [ht.2]) | |
| rw [hc,integral_const_mul,integral_Icc_eq_integral_Ioc, | |
| βintervalIntegral.integral_of_le hh, | |
| intervalIntegral.integral_comp_sub_left (fun t : β => t^(m+k)) h] | |
| rw [sub_self,sub_zero,integral_pow] | |
| simp only [zero_pow (Nat.succ_ne_zero _),sub_zero] | |
| rw [show m+1+k=m+k+1 by omega,Nat.factorial_succ,Nat.cast_mul] | |
| simp only [Nat.cast_add,Nat.cast_one,div_eq_mul_inv,mul_inv_rev] | |
| ring | |
| theorem volumeReal_momentSimplex (m : β) {h : β} (hh : 0 β€ h) : | |
| volume.real (momentSimplex m h) = h^m / (m.factorial : β) := by | |
| simpa [div_eq_mul_inv,mul_comm] using integral_simplex_power m 0 hh | |
| theorem integral_simplex_tent (m : β) {h : β} (hh : 0 β€ h) : | |
| (β« p in momentSimplex m h, (h-β i,p i)) = h^(m+1) / ((m+1).factorial : β) := by | |
| simpa [div_eq_mul_inv,mul_comm] using integral_simplex_power m 1 hh | |
| theorem tent_indicator_eq {m : β} {r : β} {D : Set (Fin m β β)} | |
| (hD : β p β D, β i, 0 β€ p i) (hcap : momentSimplex m r β D) : | |
| D.indicator (fun p => max (r-β i,p i) 0) = | |
| (momentSimplex m r).indicator (fun p => r-β i,p i) := by | |
| funext p | |
| by_cases hp : p β momentSimplex m r | |
| Β· rw [indicator_of_mem hp,indicator_of_mem (hcap hp),max_eq_left (sub_nonneg.mpr hp.2)] | |
| Β· rw [indicator_of_notMem hp] | |
| by_cases hd : p β D | |
| Β· rw [indicator_of_mem hd,max_eq_right] | |
| exact le_of_lt (sub_neg.mpr (lt_of_not_ge (fun hs => hp β¨hD p hd,hsβ©))) | |
| Β· exact indicator_of_notMem hd _ | |
| theorem integrableOn_tent {m : β} {r : β} {D : Set (Fin m β β)} | |
| (hDmeas : MeasurableSet D) (hD : β p β D, β i, 0 β€ p i) | |
| (hcap : momentSimplex m r β D) : | |
| IntegrableOn (fun p => max (r-β i,p i) 0) D := by | |
| rw [βintegrable_indicator_iff hDmeas,tent_indicator_eq hD hcap] | |
| simpa using integrable_simplex_power m 1 r | |
| theorem integral_tent {m : β} {r : β} (hr : 0 β€ r) {D : Set (Fin m β β)} | |
| (hDmeas : MeasurableSet D) (hD : β p β D, β i, 0 β€ p i) | |
| (hcap : momentSimplex m r β D) : | |
| (β« p in D, max (r-β i,p i) 0) = r^(m+1) / ((m+1).factorial : β) := by | |
| rw [βintegral_indicator hDmeas,tent_indicator_eq hD hcap, | |
| integral_indicator (momentSimplex_isClosed m r).measurableSet] | |
| exact integral_simplex_tent m hr | |
| theorem integral_sum_tents {m : β} {ΞΉ : Type*} [Fintype ΞΉ] (r : ΞΉ β β) | |
| (hr : β i, 0 β€ r i) {D : Set (Fin m β β)} | |
| (hDmeas : MeasurableSet D) (hD : β p β D, β j, 0 β€ p j) | |
| (hcap : β i, momentSimplex m (r i) β D) : | |
| (β« p in D, β i, max (r i-β j,p j) 0) = | |
| (β i,r i^(m+1)) / ((m+1).factorial : β) := by | |
| rw [integral_finsetSum _ (fun i _ => integrableOn_tent hDmeas hD (hcap i))] | |
| simp_rw [integral_tent (hr _) hDmeas hD (hcap _)] | |
| exact (Finset.sum_div _ _ _).symm | |
| def smallModelMean (m : β) (h : β) : β := | |
| (2:β)^m*h^m/(m.factorial : β)*(1-2*m*h/(m+1)) | |
| theorem integral_small_model (m : β) {h : β} (hh : 0 β€ h) : | |
| (β« p in momentSimplex m h, (2:β)^m*(1-2*β i,p i)) = smallModelMean m h := by | |
| have ht : IntegrableOn (fun p : Fin m β β => h-β i,p i) (momentSimplex m h) := by | |
| exact ((continuous_const.sub (continuous_finsetSum _ fun i _ => continuous_apply i)).continuousOn).integrableOn_compact (momentSimplex_isCompact m h) | |
| have hc : IntegrableOn (fun _ : Fin m β β => 1-2*h) (momentSimplex m h) := | |
| continuousOn_const.integrableOn_compact (momentSimplex_isCompact m h) | |
| have heq (p : Fin m β β) : 1-2*β i,p i = (1-2*h)+2*(h-β i,p i) := by ring | |
| simp_rw [heq] | |
| rw [integral_const_mul,integral_add hc (ht.const_mul 2),integral_const_mul, | |
| setIntegral_const,integral_simplex_tent m hh] | |
| simp only [smul_eq_mul,volumeReal_momentSimplex m hh] | |
| dsimp [smallModelMean] | |
| rw [Nat.factorial_succ,Nat.cast_mul] | |
| simp only [Nat.cast_add,Nat.cast_one,pow_succ] | |
| have hf : (m.factorial : β) β 0 := by positivity | |
| have hm : (m:β)+1 β 0 := by positivity | |
| field_simp | |
| ring | |
| theorem continuous_smallModelMean (m : β) : Continuous (smallModelMean m) := by | |
| unfold smallModelMean | |
| fun_prop | |
| theorem smallModelMean_half (m : β) : smallModelMean m (1/2) = | |
| 1 / ((m+1).factorial : β) := by | |
| have hp : (2:β)^m*(1/2)^m=1 := by rw [βmul_pow]; norm_num | |
| dsimp [smallModelMean] | |
| rw [hp,Nat.factorial_succ,Nat.cast_mul] | |
| simp only [Nat.cast_add,Nat.cast_one] | |
| have hf : (m.factorial : β) β 0 := by positivity | |
| have hm : (m:β)+1 β 0 := by positivity | |
| field_simp | |
| ring | |
| def cappedAffine {m : β} {ΞΉ : Type*} [Fintype ΞΉ] | |
| (A : β) (B : Fin m β β) (r w : ΞΉ β β) (p : Fin m β β) : β := | |
| A-(β j, B j*p j)-β i,w i*max (r i-β j,p j) 0 | |
| theorem continuous_cappedAffine {m : β} {ΞΉ : Type*} [Fintype ΞΉ] | |
| (A : β) (B : Fin m β β) (r w : ΞΉ β β) : Continuous (cappedAffine A B r w) := by | |
| unfold cappedAffine | |
| fun_prop | |
| theorem concaveOn_cappedAffine {m : β} {ΞΉ : Type*} [Fintype ΞΉ] | |
| (A : β) (B : Fin m β β) (r w : ΞΉ β β) (hw : β i,0 β€ w i) | |
| {D : Set (Fin m β β)} (hD : Convex β D) : ConcaveOn β D (cappedAffine A B r w) := by | |
| refine β¨hD,?_β© | |
| intro x hx y hy a b ha hb hab | |
| have hsum : (β j,(a β’ x+b β’ y) j)=a*(β j,x j)+b*(β j,y j) := by | |
| simp only [Pi.add_apply,Pi.smul_apply,smul_eq_mul,Finset.sum_add_distrib,Finset.mul_sum] | |
| have hB : (β j,B j*(a β’ x+b β’ y) j)=a*(β j,B j*x j)+b*(β j,B j*y j) := by | |
| simp only [Pi.add_apply,Pi.smul_apply,smul_eq_mul,mul_add,Finset.sum_add_distrib,Finset.mul_sum] | |
| congr 1 <;> apply Finset.sum_congr rfl <;> intros <;> ring | |
| have hcap (i : ΞΉ) : max (r i-β j,(a β’ x+b β’ y) j) 0 β€ | |
| a*max (r i-β j,x j) 0+b*max (r i-β j,y j) 0 := by | |
| apply max_le | |
| Β· rw [hsum] | |
| have hx := mul_le_mul_of_nonneg_left (le_max_left (r i-β j,x j) 0) ha | |
| have hy := mul_le_mul_of_nonneg_left (le_max_left (r i-β j,y j) 0) hb | |
| have he := congrArg (fun t : β => t*r i) hab | |
| nlinarith only [hx,hy,he] | |
| Β· exact add_nonneg (mul_nonneg ha (le_max_right _ _)) (mul_nonneg hb (le_max_right _ _)) | |
| have hc := Finset.sum_le_sum (s := Finset.univ) (fun i _ => | |
| mul_le_mul_of_nonneg_left (hcap i) (hw i)) | |
| have he : (β i,w i*(a*max (r i-β j,x j) 0+b*max (r i-β j,y j) 0)) = | |
| a*(β i,w i*max (r i-β j,x j) 0)+b*(β i,w i*max (r i-β j,y j) 0) := by | |
| simp only [mul_add,Finset.sum_add_distrib,Finset.mul_sum] | |
| congr 1 <;> apply Finset.sum_congr rfl <;> intros <;> ring | |
| rw [he] at hc | |
| have hA : a*A+b*A=A := by rw [βadd_mul,hab,one_mul] | |
| dsimp [cappedAffine] | |
| simp only [Pi.add_apply,Pi.smul_apply,smul_eq_mul] at hB hc | |
| rw [hB] | |
| nlinarith only [hA,hc] | |
| end PackingSufficiencySupport | |
| end | |
| end OAI | |