Buckets:
| import Mathlib | |
| import OAI.Geometry.BallPacking.Models.RationalSlack | |
| namespace OAI | |
| noncomputable section | |
| namespace PackingSufficiencySupport.Hamiltonian | |
| open scoped ContDiff Manifold Topology BigOperators | |
| open Set Function Filter Manifold | |
| variable {E V : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| [NormedAddCommGroup V] [NormedSpace β V] | |
| {M : Type*} [TopologicalSpace M] [ChartedSpace E M] [IsManifold π(β,E) β M] | |
| theorem globalHorizontalCoupling_congr_germs (Ξ© : V βL[β] V βL[β] β) | |
| {Ξ Ξ' : V β ManifoldOneForm E M} {K : Set (M Γ V)} | |
| (h : β zβK,βαΆ q in π z,Ξ q.2 q.1=Ξ' q.2 q.1) : | |
| globalHorizontalCoupling Ξ© Ξ=αΆ [πΛ’ K] globalHorizontalCoupling Ξ© Ξ' := by | |
| apply mem_nhdsSet_iff_forall.mpr | |
| intro z hz | |
| filter_upwards [(h z hz).eventually_nhds] with q hq | |
| exact globalHorizontalCoupling_congr_joint Ξ© hq | |
| end PackingSufficiencySupport.Hamiltonian | |
| namespace PackingSufficiencySupport.CubicModel | |
| open scoped ContDiff Manifold Topology BigOperators | |
| open Set Function Filter Manifold | |
| open DiagonalQuadrics DiagonalQuadrics.Explicit Hamiltonian FiniteMoment MomentPolytope | |
| theorem physicalParameter_fiber_lower_near {A B : β} {L : β} (hL : 0β€L) | |
| {z : BaseCurve Γ PlanePhase (Fin 2)} | |
| (hz : physicalParameter L (planeMoments z.2)βRadial.lowerTrapezoid A B) : | |
| βαΆ q in π z,physicalParameter L (planeMoments q.2)βRadial.lowerTrapezoid A B := by | |
| have hc : Continuous (fun q : BaseCurve Γ PlanePhase (Fin 2) => physicalParameter L (planeMoments q.2)) := | |
| (physicalParameter_smooth L).continuous.comp (planeMoments_smooth.continuous.comp continuous_snd) | |
| have h0 := (hc.fst.continuousAt.eventually_lt continuousAt_const hz.2.1) | |
| have h1 := ((hc.fst.add hc.snd).continuousAt.eventually_lt continuousAt_const hz.2.2.2) | |
| filter_upwards [h0,h1] with q hq0 hq1 | |
| exact β¨mul_nonneg hL (planeMoments_nonneg _ 0),hq0, | |
| mul_nonneg hL (planeMoments_nonneg _ 1),hq1β© | |
| theorem physicalPrimitive_representative_fiber_germ {A B D S q : β} {c L : β} (hL : 0β€L) | |
| {bF : Fin q β Moments 2} {cF : Fin q β β} | |
| (hPS : MapsTo (physicalParameter L) (region bF cF) (Radial.lowerTrapezoid A B)) | |
| {β : β} {Ξ : Moments 2 β ManifoldOneForm RealModel BaseCurve} | |
| (he : βαΆ q in πΛ’ (region bF cF ΓΛ’ cubicExhaustion β), | |
| physicalParameter L q.1βRadial.lowerTrapezoid A B β | |
| Ξ q.1 q.2=physicalPrimitive (A := A) (B := B) D S c L q.1 q.2) : | |
| β zβcubicExhaustion β ΓΛ’ planeRegion bF cF,βαΆ q in π z, | |
| Ξ (planeMoments q.2) q.1=physicalPrimitive (A := A) (B := B) D S c L (planeMoments q.2) q.1 := by | |
| intro z hz | |
| have hn := mem_nhdsSet_iff_forall.mp he (planeMoments z.2,z.1) β¨hz.2,hz.1β© | |
| have hc : Continuous (fun q : BaseCurve Γ PlanePhase (Fin 2) => (planeMoments q.2,q.1)) := | |
| (planeMoments_smooth.continuous.comp continuous_snd).prodMk continuous_fst | |
| have hi := physicalParameter_fiber_lower_near (A := A) (B := B) (z := z) hL (hPS hz.2) | |
| filter_upwards [hc.continuousAt.eventually hn,hi] with q hq hqp | |
| exact hq hqp | |
| attribute [local irreducible] physicalPrimitive | |
| theorem physicalCoupling_representative_near {A B D S q : β} {c L : β} (hL : 0β€L) | |
| {bF : Fin q β Moments 2} {cF : Fin q β β} | |
| (hPS : MapsTo (physicalParameter L) (region bF cF) (Radial.lowerTrapezoid A B)) | |
| {β : β} {Ξ : Moments 2 β ManifoldOneForm RealModel BaseCurve} | |
| (he : βαΆ q in πΛ’ (region bF cF ΓΛ’ cubicExhaustion β), | |
| physicalParameter L q.1βRadial.lowerTrapezoid A B β | |
| Ξ q.1 q.2=physicalPrimitive (A := A) (B := B) D S c L q.1 q.2) : | |
| globalHorizontalCoupling (E := RealModel) (M := BaseCurve) (V := PlanePhase (Fin 2)) phaseArea (Ξ β planeMoments)=αΆ [πΛ’ (cubicExhaustion β ΓΛ’ planeRegion bF cF)] | |
| globalHorizontalCoupling (E := RealModel) (M := BaseCurve) (V := PlanePhase (Fin 2)) phaseArea (physicalPrimitive (A := A) (B := B) D S c L β planeMoments) := by | |
| have hg : β zβcubicExhaustion β ΓΛ’ planeRegion bF cF,βαΆ q in π z, | |
| Ξ (planeMoments q.2) q.1=physicalPrimitive (A := A) (B := B) D S c L (planeMoments q.2) q.1 := | |
| physicalPrimitive_representative_fiber_germ hL hPS he | |
| exact globalHorizontalCoupling_congr_germs (E := RealModel) (M := BaseCurve) (V := PlanePhase (Fin 2)) phaseArea (Ξ := Ξ β planeMoments) | |
| (Ξ' := physicalPrimitive (A := A) (B := B) D S c L β planeMoments) hg | |
| end PackingSufficiencySupport.CubicModel | |
| namespace PackingSufficiencySupport | |
| open scoped BigOperators | |
| open MeasureTheory Set | |
| open scoped Pointwise | |
| open MomentPolytope | |
| theorem exists_positive_common_denominator {ΞΉ : Type*} [Fintype ΞΉ] | |
| (q : ΞΉ β β) (hq : β i,0β€q i) : | |
| β L : β,0<L β§ β k : ΞΉ β β,β i,(k i:β)=(L:β)*(q i:β) := by | |
| classical | |
| let L := β i,(q i).den | |
| have hL : 0<L := Finset.prod_pos (fun i _ => (q i).den_pos) | |
| have hd i : (q i).denβ£L := Finset.dvd_prod_of_mem _ (Finset.mem_univ i) | |
| have hn i : 0β€(q i).num := Rat.num_nonneg.mpr (hq i) | |
| let k := fun i => (q i).num.toNat*(L/(q i).den) | |
| refine β¨L,hL,k,fun i => ?_β© | |
| have hc : ((q i).num.toNat:β)=((q i).num:β) := by | |
| exact_mod_cast Int.toNat_of_nonneg (hn i) | |
| have hmul : ((L/(q i).den:β):β)*((q i).den:β)=(L:β) := by | |
| exact_mod_cast Nat.div_mul_cancel (hd i) | |
| have hd0 : ((q i).den:β)β 0 := by exact_mod_cast (q i).den_ne_zero | |
| dsimp only [k] | |
| rw [Nat.cast_mul,hc,Rat.cast_def] | |
| field_simp | |
| nlinarith [hmul] | |
| def truncatedSimplex (q : β) (h b : β) : Set (β Γ (Fin q β β)) := | |
| {x | x.1 β Icc 0 h β§ x.2 β momentSimplex q (b-x.1)} | |
| theorem truncatedSimplex_isClosed (q : β) (h b : β) : | |
| IsClosed (truncatedSimplex q h b) := by | |
| have hn : IsClosed {x : β Γ (Fin q β β) | β i,0β€x.2 i} := by | |
| simp only [ofPred_forall] | |
| exact isClosed_iInter fun i => isClosed_le continuous_const ((continuous_apply i).comp continuous_snd) | |
| exact (isClosed_Icc.preimage continuous_fst).inter (hn.inter | |
| (isClosed_le (continuous_finsetSum _ fun i _ => (continuous_apply i).comp continuous_snd) | |
| (continuous_const.sub continuous_fst))) | |
| theorem truncatedSimplex_isCompact (q : β) (h b : β) : | |
| IsCompact (truncatedSimplex q h b) := by | |
| refine (isCompact_Icc (a := (0,fun _ : Fin q => (0:β))) | |
| (b := (h,fun _ => b))).of_isClosed_subset (truncatedSimplex_isClosed q h b) ?_ | |
| intro x hx | |
| refine β¨β¨hx.1.1,hx.2.1β©,hx.1.2,fun i => ?_β© | |
| have hi := (Finset.single_le_sum (fun j _ => hx.2.1 j) (Finset.mem_univ i)).trans hx.2.2 | |
| linarith [hx.1.1] | |
| theorem truncatedSimplex_fubini (q : β) (h b : β) | |
| (f : βΓ(Fin q β β) β β) (hf : ContinuousOn f (truncatedSimplex q h b)) : | |
| (β« x in truncatedSimplex q h b, f x) = | |
| β« u in Icc 0 h, β« p in momentSimplex q (b-u), f (u,p) := by | |
| let D := truncatedSimplex q h b | |
| have hD := (truncatedSimplex_isClosed q h b).measurableSet | |
| have hi : Integrable (D.indicator f) := (integrable_indicator_iff hD).2 | |
| (hf.integrableOn_compact (truncatedSimplex_isCompact q h b)) | |
| rw [βintegral_indicator hD] | |
| change (β« x, D.indicator f x β(volume.prod volume)) = _ | |
| rw [integral_prod _ hi,βintegral_indicator measurableSet_Icc] | |
| congr 1 | |
| funext u | |
| by_cases hu : uβIcc 0 h | |
| Β· rw [indicator_of_mem hu,βintegral_indicator (momentSimplex_isClosed q (b-u)).measurableSet] | |
| congr 1 | |
| funext p | |
| by_cases hp : pβmomentSimplex q (b-u) | |
| Β· rw [indicator_of_mem (show (u,p)βD from β¨hu,hpβ©),indicator_of_mem hp] | |
| Β· rw [indicator_of_notMem (show (u,p)βD from fun hx => hp hx.2),indicator_of_notMem hp] | |
| Β· rw [indicator_of_notMem hu] | |
| have hz (p : Fin q β β) : D.indicator f (u,p)=0 := | |
| indicator_of_notMem (show (u,p)βD from fun hx => hu hx.1) f | |
| simp_rw [hz] | |
| exact integral_zero _ _ | |
| theorem integral_truncated_simplex_power (q k : β) {h b : β} (hh : 0β€h) (hhb : hβ€b) : | |
| (β« x in truncatedSimplex q h b, (b-x.1-β i,x.2 i)^k) = | |
| (k.factorial : β)/((q+k+1).factorial : β)* | |
| (b^(q+k+1)-(b-h)^(q+k+1)) := by | |
| rw [truncatedSimplex_fubini q h b _ (by fun_prop)] | |
| have heq : (β« u in Icc 0 h, β« p in momentSimplex q (b-u), (b-u-β i,p i)^k) = | |
| β« u in Icc 0 h, (k.factorial : β)/((q+k).factorial : β)*(b-u)^(q+k) := by | |
| apply setIntegral_congr_fun measurableSet_Icc | |
| intro u hu | |
| exact integral_simplex_power q k (by linarith [hu.2]) | |
| rw [heq,integral_const_mul,integral_Icc_eq_integral_Ioc, | |
| βintervalIntegral.integral_of_le hh, | |
| intervalIntegral.integral_comp_sub_left (fun u : β => u^(q+k)) b, | |
| sub_zero,integral_pow] | |
| rw [Nat.factorial_succ (q+k),Nat.cast_mul] | |
| simp only [Nat.cast_add,Nat.cast_one,div_eq_mul_inv,mul_inv_rev] | |
| ring | |
| theorem volumeReal_truncatedSimplex (q : β) {h b : β} (hh : 0β€h) (hhb : hβ€b) : | |
| volume.real (truncatedSimplex q h b) = | |
| (b^(q+1)-(b-h)^(q+1))/((q+1).factorial : β) := by | |
| simpa [div_eq_mul_inv,mul_comm] using integral_truncated_simplex_power q 0 hh hhb | |
| theorem integral_truncated_tent (q : β) {h b : β} (hh : 0β€h) (hhb : hβ€b) : | |
| (β« x in truncatedSimplex q h b, b-x.1-β i,x.2 i) = | |
| (b^(q+2)-(b-h)^(q+2))/((q+2).factorial : β) := by | |
| simpa [div_eq_mul_inv,mul_comm] using integral_truncated_simplex_power q 1 hh hhb | |
| theorem integral_truncated_cap (q : β) {h s b : β} | |
| (hh : 0 β€ h) (hhs : h β€ s) (hsb : s β€ b) : | |
| (β« x in truncatedSimplex q h b, max (s-x.1-β i,x.2 i) 0) = | |
| (s^(q+2)-(s-h)^(q+2))/((q+2).factorial : β) := by | |
| rw [βintegral_truncated_tent q hh hhs, | |
| βintegral_indicator (truncatedSimplex_isClosed q h b).measurableSet, | |
| βintegral_indicator (truncatedSimplex_isClosed q h s).measurableSet] | |
| congr 1 | |
| funext x | |
| by_cases hb : xβtruncatedSimplex q h b | |
| Β· rw [indicator_of_mem hb] | |
| by_cases hs : xβtruncatedSimplex q h s | |
| Β· rw [indicator_of_mem hs,max_eq_left] | |
| linarith [hs.2.2] | |
| Β· rw [indicator_of_notMem hs,max_eq_right] | |
| have hn : Β¬ (β i,x.2 i) β€ s-x.1 := fun he => hs β¨hb.1,hb.2.1,heβ© | |
| linarith [not_le.1 hn] | |
| Β· rw [indicator_of_notMem hb,indicator_of_notMem] | |
| intro hs | |
| apply hb | |
| exact β¨hs.1,hs.2.1,hs.2.2.trans (by linarith)β© | |
| theorem integral_truncated_affine {h b d : β} (hh : 0 β€ h) (hhd : h β€ d) : | |
| (β« x in truncatedSimplex 1 h d, b-x.1-β i,x.2 i) = | |
| (b-d)*(d^2-(d-h)^2)/2+(d^3-(d-h)^3)/6 := by | |
| have ht : IntegrableOn (fun x : βΓ(Fin 1ββ) => d-x.1-β i,x.2 i) | |
| (truncatedSimplex 1 h d) := by | |
| apply ContinuousOn.integrableOn_compact (truncatedSimplex_isCompact 1 h d) | |
| fun_prop | |
| have hc : IntegrableOn (fun _ : βΓ(Fin 1ββ) => b-d) (truncatedSimplex 1 h d) := | |
| continuousOn_const.integrableOn_compact (truncatedSimplex_isCompact 1 h d) | |
| have heq (x : βΓ(Fin 1ββ)) : b-x.1-β i,x.2 i = (b-d)+(d-x.1-β i,x.2 i) := by ring | |
| simp_rw [heq] | |
| rw [integral_add hc ht,setIntegral_const,integral_truncated_tent 1 hh hhd] | |
| simp only [smul_eq_mul,volumeReal_truncatedSimplex 1 hh hhd] | |
| norm_num | |
| ring | |
| def sixModelMean (s b hβ hβ : β) : β := | |
| (3/2)*(b^3-(b-hβ)^3) -(9/2)*hβ*(b-hβ)^2 -(1/3)*(s^3-(s-hβ)^3) | |
| theorem integral_six_model {s b hβ hβ : β} | |
| (hhβ : 0 β€ hβ) (hhs : hβ β€ s) (hsh : s β€ hβ) : | |
| (β« x in truncatedSimplex 1 hβ hβ, | |
| 9*(b-x.1-β i,x.2 i)-2*max (s-x.1-β i,x.2 i) 0) = | |
| sixModelMean s b hβ hβ := by | |
| have hi (f : βΓ(Fin 1ββ) β β) (hf : Continuous f) : | |
| IntegrableOn f (truncatedSimplex 1 hβ hβ) := | |
| hf.continuousOn.integrableOn_compact (truncatedSimplex_isCompact 1 hβ hβ) | |
| rw [integral_sub (hi _ (by fun_prop)) (hi _ (by fun_prop)), | |
| integral_const_mul,integral_const_mul, | |
| integral_truncated_affine hhβ (hhs.trans hsh), | |
| integral_truncated_cap 1 hhβ hhs hsh] | |
| norm_num [sixModelMean] | |
| ring | |
| theorem continuous_sixModelMean (s b : β) : | |
| Continuous (fun h : βΓβ => sixModelMean s b h.1 h.2) := by | |
| unfold sixModelMean | |
| fun_prop | |
| theorem sixModelMean_limit_value (a : β) : | |
| sixModelMean (1-a) ((2-a)/3) (1-a) ((2-a)/3) = (1-a^3)/6 := by | |
| unfold sixModelMean | |
| ring | |
| def momentHeadTail (q : β) : (Fin (q+1) β β) βα΅ (βΓ(Fin q β β)) := | |
| MeasurableEquiv.piFinSuccAbove (fun _ : Fin (q+1) => β) 0 | |
| @[simp] theorem momentHeadTail_apply (q : β) (p : Fin (q+1) β β) : | |
| momentHeadTail q p=(p 0,fun i => p i.succ) := by | |
| rfl | |
| @[simp] theorem momentHeadTail_symm_apply (q : β) (x : βΓ(Fin q β β)) : | |
| (momentHeadTail q).symm x=Fin.cons x.1 x.2 := by | |
| ext i | |
| refine Fin.cases ?_ (fun j => ?_) i <;> | |
| simp [momentHeadTail,MeasurableEquiv.piFinSuccAbove_symm_apply,Fin.insertNthEquiv] | |
| theorem continuous_momentHeadTail (q : β) : Continuous (momentHeadTail q) := by | |
| change Continuous (fun p : Fin (q+1) β β => (p 0,fun i : Fin q => p i.succ)) | |
| fun_prop | |
| theorem continuous_momentHeadTail_symm (q : β) : Continuous (momentHeadTail q).symm := by | |
| change Continuous (fun x : βΓ(Fin q β β) => (momentHeadTail q).symm x) | |
| simp_rw [momentHeadTail_symm_apply] | |
| apply continuous_pi | |
| intro i | |
| refine Fin.cases ?_ (fun j => ?_) i <;> simp only [Fin.cons_zero,Fin.cons_succ] <;> fun_prop | |
| theorem isCompact_preimage_momentHeadTail (q : β) {D : Set (βΓ(Fin q β β))} | |
| (hD : IsCompact D) : IsCompact ((momentHeadTail q) β»ΒΉ' D) := by | |
| have he : (momentHeadTail q) β»ΒΉ' D = (momentHeadTail q).symm '' D := by | |
| ext p | |
| constructor | |
| Β· intro hp | |
| exact β¨momentHeadTail q p,hp,(momentHeadTail q).symm_apply_apply pβ© | |
| Β· rintro β¨x,hx,rflβ© | |
| simpa using hx | |
| rw [he] | |
| exact hD.image (continuous_momentHeadTail_symm q) | |
| theorem integral_momentHeadTail (q : β) {D : Set (βΓ(Fin q β β))} | |
| (hD : MeasurableSet D) (f : βΓ(Fin q β β) β β) : | |
| (β« p in (momentHeadTail q) β»ΒΉ' D, f (momentHeadTail q p)) = β« x in D,f x := by | |
| let e := momentHeadTail q | |
| have he : MeasurePreserving e := volume_preserving_piFinSuccAbove (fun _ : Fin (q+1) => β) 0 | |
| rw [βintegral_indicator (hD.preimage e.measurable),βintegral_indicator hD] | |
| have hf : (e β»ΒΉ' D).indicator (fun p => f (e p)) = (D.indicator f) β e := by | |
| funext p | |
| by_cases hp : e pβD <;> simp [hp] | |
| rw [hf] | |
| exact he.integral_comp e.measurableEmbedding _ | |
| def sixModelBounds : Fin 2 β Moments 2 := ![![1,0],![1,1]] | |
| theorem sixModelBounds_nonneg : β Ξ½ j,0 β€ sixModelBounds Ξ½ j := by | |
| intro Ξ½ j | |
| fin_cases Ξ½ <;> fin_cases j <;> norm_num [sixModelBounds] | |
| theorem sixModelBounds_le_one : β Ξ½ j,sixModelBounds Ξ½ j β€ 1 := by | |
| intro Ξ½ j | |
| fin_cases Ξ½ <;> fin_cases j <;> norm_num [sixModelBounds] | |
| theorem sixModelRegion_eq (hβ hβ : β) : | |
| region sixModelBounds ![hβ,hβ] = (momentHeadTail 1) β»ΒΉ' truncatedSimplex 1 hβ hβ := by | |
| ext p | |
| change ((β j,0β€p j) β§ β Ξ½,β j,sixModelBounds Ξ½ j*p j β€ ![hβ,hβ] Ξ½) β | |
| (p 0βIcc 0 hβ β§ (fun j : Fin 1 => p j.succ)βmomentSimplex 1 (hβ-p 0)) | |
| simp only [Fin.forall_fin_two,Fin.sum_univ_two,Fin.sum_univ_one, | |
| sixModelBounds,Matrix.cons_val_zero,Matrix.cons_val_one,momentSimplex, | |
| mem_ofPred_eq,Fin.forall_fin_one,mem_Icc,one_mul,zero_mul,add_zero] | |
| norm_num only [Fin.succ_zero_eq_one] | |
| constructor | |
| Β· rintro β¨β¨h0,h1β©,hhβ,hhββ© | |
| exact β¨β¨h0,hhββ©,h1,by linarithβ© | |
| Β· rintro β¨β¨h0,hhββ©,h1,hhββ© | |
| exact β¨β¨h0,h1β©,hhβ,by linarithβ© | |
| theorem sixModelRegion_isCompact (hβ hβ : β) : | |
| IsCompact (region sixModelBounds ![hβ,hβ]) := by | |
| rw [sixModelRegion_eq] | |
| exact isCompact_preimage_momentHeadTail 1 (truncatedSimplex_isCompact 1 hβ hβ) | |
| theorem sixModelRegion_contains_cap {r hβ hβ : β} (hrβ : r β€ hβ) (hrβ : r β€ hβ) : | |
| momentSimplex 2 r β region sixModelBounds ![hβ,hβ] := by | |
| intro p hp | |
| refine β¨hp.1,fun Ξ½ => ?_β© | |
| fin_cases Ξ½ | |
| Β· change (β j,(![1,0] : Fin 2ββ) j*p j) β€ hβ | |
| simp only [Fin.sum_univ_two,Matrix.cons_val_zero,Matrix.cons_val_one,one_mul,zero_mul,add_zero] | |
| have hs : p 0+p 1 β€ r := by simpa only [Fin.sum_univ_two] using hp.2 | |
| linarith [hp.1 1] | |
| Β· change (β j,(![1,1] : Fin 2ββ) j*p j) β€ hβ | |
| simpa only [Fin.sum_univ_two,Matrix.cons_val_zero,Matrix.cons_val_one,one_mul] using hp.2.trans hrβ | |
| def sixModelDensity (s b : β) (p : Moments 2) : β := | |
| 9*(b-β j,p j)-2*max (s-β j,p j) 0 | |
| def sixModelGap {ΞΉ : Type*} [Fintype ΞΉ] (s b : β) (r : ΞΉ β β) (p : Moments 2) : β := | |
| sixModelDensity s b p-β i,max (r i-β j,p j) 0 | |
| theorem continuous_sixModelGap {ΞΉ : Type*} [Fintype ΞΉ] (s b : β) (r : ΞΉ β β) : | |
| Continuous (sixModelGap s b r) := by | |
| unfold sixModelGap sixModelDensity | |
| fun_prop | |
| theorem sixModelGap_eq_cappedAffine {ΞΉ : Type*} [Fintype ΞΉ] (s b : β) (r : ΞΉ β β) : | |
| sixModelGap s b r = cappedAffine (9*b) (fun _ => 9) | |
| (Sum.elim (fun _ : Unit => s) r) (Sum.elim (fun _ : Unit => 2) (fun _ => 1)) := by | |
| funext p | |
| simp only [sixModelGap,sixModelDensity,cappedAffine,Fintype.sum_sum_type, | |
| Sum.elim_inl,Sum.elim_inr,Fintype.sum_unique,one_mul,βFinset.mul_sum] | |
| ring | |
| theorem integral_sixModelDensity {s b hβ hβ : β} | |
| (hhβ : 0 β€ hβ) (hhs : hβ β€ s) (hsh : s β€ hβ) : | |
| (β« p in region sixModelBounds ![hβ,hβ],sixModelDensity s b p) = sixModelMean s b hβ hβ := by | |
| rw [sixModelRegion_eq] | |
| have he : sixModelDensity s b = (fun x : βΓ(Fin 1ββ) => | |
| 9*(b-x.1-β j,x.2 j)-2*max (s-x.1-β j,x.2 j) 0) β momentHeadTail 1 := by | |
| funext p | |
| simp only [sixModelDensity,Fin.sum_univ_succ,Function.comp_apply,momentHeadTail_apply] | |
| congr 2 <;> ring_nf | |
| rw [he] | |
| simp only [Function.comp_apply] | |
| rw [integral_momentHeadTail 1 (truncatedSimplex_isClosed 1 hβ hβ).measurableSet | |
| (fun x : βΓ(Fin 1ββ) => 9*(b-x.1-β j,x.2 j)-2*max (s-x.1-β j,x.2 j) 0)] | |
| exact integral_six_model hhβ hhs hsh | |
| theorem integral_sixModelGap {ΞΉ : Type*} [Fintype ΞΉ] (r : ΞΉ β β) (hr : β i,0 β€ r i) | |
| {s b hβ hβ : β} (hhβ : 0 β€ hβ) (hhs : hβ β€ s) (hsh : s β€ hβ) | |
| (hrβ : β i,r i β€ hβ) (hrβ : β i,r i β€ hβ) : | |
| (β« p in region sixModelBounds ![hβ,hβ],sixModelGap s b r p) = | |
| sixModelMean s b hβ hβ-(β i,r i^3)/6 := by | |
| have hC := sixModelRegion_isCompact hβ hβ | |
| have hcap (i : ΞΉ) := sixModelRegion_contains_cap (hrβ i) (hrβ i) | |
| unfold sixModelGap | |
| rw [integral_sub] | |
| Β· rw [integral_sixModelDensity hhβ hhs hsh, | |
| integral_sum_tents r hr hC.measurableSet (fun _ hp => hp.1) hcap] | |
| norm_num | |
| Β· apply ContinuousOn.integrableOn_compact hC | |
| unfold sixModelDensity | |
| fun_prop | |
| Β· apply ContinuousOn.integrableOn_compact hC | |
| fun_prop | |
| theorem sixModelDensity_lower {s b hβ hβ : β} (hsh : s β€ hβ) | |
| {p : Moments 2} (hp : p β region sixModelBounds ![hβ,hβ]) : | |
| 9*(b-hβ) β€ sixModelDensity s b p := by | |
| have hs : (β j,p j) β€ hβ := by | |
| have ht := hp.2 1 | |
| simpa [sixModelBounds,Fin.sum_univ_two] using ht | |
| have hm : max (s-β j,p j) 0 β€ hβ-β j,p j := max_le (by linarith) (by linarith) | |
| unfold sixModelDensity | |
| linarith | |
| end PackingSufficiencySupport | |
| namespace PackingSufficiencySupport.CubicModel | |
| open scoped BigOperators | |
| open Set Function | |
| open MomentPolytope FiniteMoment | |
| theorem physicalArea_eq_sixModelDensity {L D S : β} (hL : 0<L) {a : β} | |
| (hD : (D:β)=(L:β)*(2-a)) (hS : (S:β)=(L:β)*(1-a)) : | |
| physicalArea D S (1/((L:β)*Real.pi)) L=sixModelDensity (1-a) ((2-a)/3) := by | |
| have hLr : 0<(L:β) := Nat.cast_pos.mpr hL | |
| funext p | |
| unfold physicalArea sixModelDensity | |
| rw [hD,hS,Fin.sum_univ_two] | |
| have he : (L:β)*(1-a)-((L:β)*p 0+(L:β)*p 1)=(L:β)*((1-a)-(p 0+p 1)) := by ring | |
| rw [he] | |
| have hm : max ((L:β)*((1-a)-(p 0+p 1))) 0 = (L:β)*max ((1-a)-(p 0+p 1)) 0 := by | |
| simpa only [mul_zero] using (mul_max_of_nonneg ((1-a)-(p 0+p 1)) 0 hLr.le).symm | |
| rw [hm] | |
| field_simp [hLr.ne',Real.pi_ne_zero] | |
| ring | |
| theorem exists_six_cubic_weights {a dβ dβ : β} (ha : (1:β)/2<a) (ha1 : a<1) | |
| (hdβ : 1-a<dβ) (hdd : dβ<dβ) (hdβ : dβ<(2-a)/3) : | |
| β L A B D S : β,0<L β§ 0<A β§ 0<S β§ Aβ€B β§ Sβ€B β§ 3*B<D β§ 3*S<D β§ | |
| (A:β)=(L:β)*(dβ:β) β§ (B:β)=(L:β)*(dβ:β) β§ | |
| (D:β)=(L:β)*(2-(a:β)) β§ (S:β)=(L:β)*(1-(a:β)) := by | |
| let q : Fin 4 β β := ![1-a,2-a,dβ,dβ] | |
| have hq : β i,0β€q i := by | |
| intro i | |
| fin_cases i <;> dsimp [q] <;> linarith | |
| obtain β¨L,hL,k,hkβ© := exists_positive_common_denominator q hq | |
| have hS : (k 0:β)=(L:β)*(1-(a:β)) := by simpa [q] using hk 0 | |
| have hD : (k 1:β)=(L:β)*(2-(a:β)) := by simpa [q] using hk 1 | |
| have hA : (k 2:β)=(L:β)*(dβ:β) := by simpa [q] using hk 2 | |
| have hB : (k 3:β)=(L:β)*(dβ:β) := by simpa [q] using hk 3 | |
| have hLr : 0<(L:β) := Nat.cast_pos.mpr hL | |
| have ha' : (1:β)/2<(a:β) := by | |
| have hh : (((1:β)/2:β):β)<(a:β) := Rat.cast_lt.mpr ha | |
| norm_num at hh β’ | |
| exact hh | |
| have ha1' : (a:β)<1 := by exact_mod_cast ha1 | |
| have hdβ' : 1-(a:β)<dβ := by exact_mod_cast hdβ | |
| have hdd' : (dβ:β)<dβ := by exact_mod_cast hdd | |
| have hdβ' : (dβ:β)<(2-(a:β))/3 := by exact_mod_cast hdβ | |
| refine β¨L,k 2,k 3,k 1,k 0,hL,?_,?_,?_,?_,?_,?_,hA,hB,hD,hSβ© | |
| Β· apply (Nat.cast_pos (Ξ± := β)).mp | |
| rw [hA] | |
| exact mul_pos hLr (by linarith) | |
| Β· apply (Nat.cast_pos (Ξ± := β)).mp | |
| rw [hS] | |
| exact mul_pos hLr (by linarith) | |
| Β· apply (Nat.cast_le (Ξ± := β)).mp | |
| rw [hA,hB] | |
| exact mul_le_mul_of_nonneg_left hdd'.le hLr.le | |
| Β· apply (Nat.cast_le (Ξ± := β)).mp | |
| rw [hS,hB] | |
| exact mul_le_mul_of_nonneg_left (by linarith) hLr.le | |
| Β· have hm := mul_lt_mul_of_pos_left (show 3*(dβ:β)<2-(a:β) by linarith) hLr | |
| have hp : 3*(k 3:β)<(k 1:β) := by rw [hB,hD]; nlinarith | |
| exact_mod_cast hp | |
| Β· have hm := mul_lt_mul_of_pos_left (show 3*(1-(a:β))<2-(a:β) by linarith) hLr | |
| have hp : 3*(k 0:β)<(k 1:β) := by rw [hS,hD]; nlinarith | |
| exact_mod_cast hp | |
| theorem physicalParameter_maps_six_region {L A B : β} (hL : 0<L) | |
| {hβ hβ dβ dβ : β} (hhdβ : hβ<dβ) (hhdβ : hβ<dβ) | |
| (hA : (A:β)=(L:β)*dβ) (hB : (B:β)=(L:β)*dβ) : | |
| MapsTo (physicalParameter L) (region sixModelBounds ![hβ,hβ]) (Radial.lowerTrapezoid A B) := by | |
| intro p hp | |
| have hn := hp.1 | |
| have hp0 : p 0β€hβ := by | |
| simpa [sixModelBounds,Fin.sum_univ_two] using hp.2 0 | |
| have hpt : p 0+p 1β€hβ := by | |
| simpa [sixModelBounds,Fin.sum_univ_two] using hp.2 1 | |
| have hLr : 0<(L:β) := Nat.cast_pos.mpr hL | |
| refine β¨mul_nonneg hLr.le (hn 0),?_,mul_nonneg hLr.le (hn 1),?_β© | |
| Β· change (L:β)*p 0<(A:β) | |
| rw [hA] | |
| exact mul_lt_mul_of_pos_left (hp0.trans_lt hhdβ) hLr | |
| Β· change (L:β)*p 0+(L:β)*p 1<(B:β) | |
| rw [hB,β mul_add] | |
| exact mul_lt_mul_of_pos_left (hpt.trans_lt hhdβ) hLr | |
| theorem exists_six_cubic_inner_weights {a dβ dβ : β} (ha : (1:β)/2<a) (ha1 : a<1) | |
| (hdβ0 : 0<dβ) (hdβ : dβ<1-a) (hdβs : 1-a<dβ) (hdβ : dβ<(2-a)/3) : | |
| β L A B D S : β,0<L β§ 0<A β§ 0<S β§ A<S β§ Aβ€B β§ Sβ€B β§ 3*B<D β§ 3*S<D β§ | |
| (A:β)=(L:β)*(dβ:β) β§ (B:β)=(L:β)*(dβ:β) β§ | |
| (D:β)=(L:β)*(2-(a:β)) β§ (S:β)=(L:β)*(1-(a:β)) := by | |
| let q : Fin 4 β β := ![1-a,2-a,dβ,dβ] | |
| have hq : β i,0β€q i := by | |
| intro i | |
| fin_cases i <;> dsimp [q] <;> linarith | |
| obtain β¨L,hL,k,hkβ© := exists_positive_common_denominator q hq | |
| have hS : (k 0:β)=(L:β)*(1-(a:β)) := by simpa [q] using hk 0 | |
| have hD : (k 1:β)=(L:β)*(2-(a:β)) := by simpa [q] using hk 1 | |
| have hA : (k 2:β)=(L:β)*(dβ:β) := by simpa [q] using hk 2 | |
| have hB : (k 3:β)=(L:β)*(dβ:β) := by simpa [q] using hk 3 | |
| have hLr : 0<(L:β) := Nat.cast_pos.mpr hL | |
| have ha' : (1:β)/2<(a:β) := by | |
| have hh : (((1:β)/2:β):β)<(a:β) := Rat.cast_lt.mpr ha | |
| norm_num at hh β’ | |
| exact hh | |
| have ha1' : (a:β)<1 := by exact_mod_cast ha1 | |
| have hdβ0' : 0<(dβ:β) := by exact_mod_cast hdβ0 | |
| have hdβ' : (dβ:β)<1-(a:β) := by exact_mod_cast hdβ | |
| have hdβs' : 1-(a:β)<dβ := by exact_mod_cast hdβs | |
| have hdd' : (dβ:β)<dβ := hdβ'.trans hdβs' | |
| have hdβ' : (dβ:β)<(2-(a:β))/3 := by exact_mod_cast hdβ | |
| refine β¨L,k 2,k 3,k 1,k 0,hL,?_,?_,?_,?_,?_,?_,?_,hA,hB,hD,hSβ© | |
| Β· apply (Nat.cast_pos (Ξ± := β)).mp | |
| rw [hA] | |
| exact mul_pos hLr (by linarith) | |
| Β· apply (Nat.cast_pos (Ξ± := β)).mp | |
| rw [hS] | |
| exact mul_pos hLr (by linarith) | |
| Β· apply (Nat.cast_lt (Ξ± := β)).mp | |
| rw [hA,hS] | |
| exact mul_lt_mul_of_pos_left hdβ' hLr | |
| Β· apply (Nat.cast_le (Ξ± := β)).mp | |
| rw [hA,hB] | |
| exact mul_le_mul_of_nonneg_left hdd'.le hLr.le | |
| Β· apply (Nat.cast_le (Ξ± := β)).mp | |
| rw [hS,hB] | |
| exact mul_le_mul_of_nonneg_left (by linarith) hLr.le | |
| Β· have hm := mul_lt_mul_of_pos_left (show 3*(dβ:β)<2-(a:β) by linarith) hLr | |
| have hp : 3*(k 3:β)<(k 1:β) := by rw [hB,hD]; nlinarith | |
| exact_mod_cast hp | |
| Β· have hm := mul_lt_mul_of_pos_left (show 3*(1-(a:β))<2-(a:β) by linarith) hLr | |
| have hp : 3*(k 0:β)<(k 1:β) := by rw [hS,hD]; nlinarith | |
| exact_mod_cast hp | |
| theorem exists_six_cubic_inner_weights_large (Q : β) {a dβ dβ : β} | |
| (ha : (1:β)/2<a) (ha1 : a<1) | |
| (hdβ0 : 0<dβ) (hdβ : dβ<1-a) (hdβs : 1-a<dβ) (hdβ : dβ<(2-a)/3) : | |
| β L A B D S : β,Q<L β§ 0<L β§ 0<A β§ 0<S β§ A<S β§ Aβ€B β§ Sβ€B β§ 3*B<D β§ 3*S<D β§ | |
| (A:β)=(L:β)*(dβ:β) β§ (B:β)=(L:β)*(dβ:β) β§ | |
| (D:β)=(L:β)*(2-(a:β)) β§ (S:β)=(L:β)*(1-(a:β)) := by | |
| obtain β¨L,A,B,D,S,hL,hA,hS,hAS,hAB,hSB,hBD,hSD,heA,heB,heD,heSβ© := | |
| exists_six_cubic_inner_weights ha ha1 hdβ0 hdβ hdβs hdβ | |
| let M := Q+1 | |
| have hM : 0<M := by dsimp [M]; omega | |
| refine β¨M*L,M*A,M*B,M*D,M*S,?_,Nat.mul_pos hM hL,Nat.mul_pos hM hA, | |
| Nat.mul_pos hM hS,Nat.mul_lt_mul_of_pos_left hAS hM, | |
| Nat.mul_le_mul_left M hAB,Nat.mul_le_mul_left M hSB,?_,?_,?_,?_,?_,?_β© | |
| Β· have hh := Nat.mul_le_mul_left M (show 1β€L by omega) | |
| dsimp [M] at hh β’ | |
| nlinarith | |
| Β· nlinarith [Nat.mul_lt_mul_of_pos_left hBD hM] | |
| Β· nlinarith [Nat.mul_lt_mul_of_pos_left hSD hM] | |
| Β· push_cast | |
| rw [heA] | |
| ring | |
| Β· push_cast | |
| rw [heB] | |
| ring | |
| Β· push_cast | |
| rw [heD] | |
| ring | |
| Β· push_cast | |
| rw [heS] | |
| ring | |
| end PackingSufficiencySupport.CubicModel | |
| namespace PackingSufficiencySupport | |
| open Set | |
| open scoped BigOperators Pointwise | |
| open MomentPolytope | |
| theorem rational_truncation_pair (F : βΓβ β β) (hF : Continuous F) | |
| {sβ sβ lβ lβ c : β} (hlβ : lβ<sβ) (hlβ : lβ<sβ) (hc : c<F (sβ,sβ)) : | |
| β hβ hβ dβ dβ : β, | |
| lβ<hβ β§ hβ<dβ β§ (dβ:β)<sβ β§ | |
| lβ<hβ β§ hβ<dβ β§ (dβ:β)<sβ β§ c<F (hβ,hβ) := by | |
| let U : Set (Fin 2 β β) := {p | lβ<p 0 β§ lβ<p 1 β§ c<F (p 0,p 1)} | |
| have hU : IsOpen U := (isOpen_lt continuous_const (continuous_apply 0)).inter | |
| ((isOpen_lt continuous_const (continuous_apply 1)).inter | |
| (isOpen_lt continuous_const (hF.comp ((continuous_apply 0).prodMk (continuous_apply 1))))) | |
| let r : Fin 2 β β := ![sβ,sβ] | |
| have hr : rβU := β¨hlβ,hlβ,hcβ© | |
| obtain β¨h,hh,hUβ© := exists_rational_below_in_open hU hr | |
| obtain β¨dβ,hdβ,hdβsβ© := exists_rat_btwn (hh 0) | |
| obtain β¨dβ,hdβ,hdβsβ© := exists_rat_btwn (hh 1) | |
| exact β¨h 0,h 1,dβ,dβ,hU.1,by exact_mod_cast hdβ,hdβs, | |
| hU.2.1,by exact_mod_cast hdβ,hdβs,hU.2.2β© | |
| theorem cap_into_scaled_region {m N : β} (b : Fin N β Moments m) (c : Fin N β β) | |
| (hb : β Ξ½ j,b Ξ½ j β€ 1) {Ο r : β} (hΟ : 0 < Ο) | |
| (hr : β Ξ½,r β€ Ο*c Ξ½) : momentSimplex m r β Ο β’ region b c := by | |
| intro p hp | |
| let q := Οβ»ΒΉ β’ p | |
| have hq (j : Fin m) : 0 β€ q j := mul_nonneg (inv_nonneg.2 hΟ.le) (hp.1 j) | |
| have hsum : (β j,q j) β€ Οβ»ΒΉ*r := by | |
| simpa only [q,Pi.smul_apply,smul_eq_mul,βFinset.mul_sum] using | |
| mul_le_mul_of_nonneg_left hp.2 (inv_nonneg.2 hΟ.le) | |
| refine β¨q,β¨hq,fun Ξ½ => ?_β©,?_β© | |
| Β· have hweighted : (β j,b Ξ½ j*q j) β€ β j,q j := by | |
| apply Finset.sum_le_sum | |
| intro j _ | |
| simpa only [one_mul] using mul_le_mul_of_nonneg_right (hb Ξ½ j) (hq j) | |
| have hc : Οβ»ΒΉ*r β€ c Ξ½ := by | |
| have ht := mul_le_mul_of_nonneg_left (hr Ξ½) (inv_nonneg.2 hΟ.le) | |
| simpa only [βmul_assoc,inv_mul_cancelβ hΟ.ne',one_mul] using ht | |
| exact hweighted.trans (hsum.trans hc) | |
| Β· simp [q,smul_smul,hΟ.ne'] | |
| theorem sum_caps_zero_outside {m : β} {ΞΉ : Type*} [Fintype ΞΉ] | |
| (r : ΞΉ β β) {D A : Set (Fin m β β)} | |
| (hD : β p β D,β j,0 β€ p j) (hcap : β i,momentSimplex m (r i) β A) | |
| {p : Fin m β β} (hp : p β D) (hout : p β A) : | |
| (β i,max (r i-β j,p j) 0)=0 := by | |
| apply Finset.sum_eq_zero | |
| intro i _ | |
| apply max_eq_right | |
| have hn : Β¬ (β j,p j) β€ r i := fun he => hout (hcap i β¨hD p hp,heβ©) | |
| linarith [not_le.1 hn] | |
| end PackingSufficiencySupport | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 29.2 kB
- Xet hash:
- 7cb385624b2a7540e94eeb1bfe659628e9db38b1648304556ca4a4c68f831c01
Β·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.