cfahlgren1/math / lean /OAI /Geometry /BallPacking /Models /CubicPhysicalLocality.lean
cfahlgren1's picture
download
raw
29.2 kB
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.