Buckets:
| import Mathlib | |
| import OAI.Geometry.BallPacking.Moments.RadialSlopes | |
| namespace OAI | |
| noncomputable section | |
| namespace PackingSufficiencySupport.FiniteMoment.Radial | |
| section | |
| open scoped BigOperators Topology ContDiff | |
| open Set Filter Function | |
| variable {ι : Type*} [Fintype ι] | |
| theorem polynomial_swap (k : ι → ℕ × ℕ) (a : ι → ℝ) (r : Plane) : | |
| polynomial (fun i => (k i).swap) a r.swap=polynomial k a r := by | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| simp only [monomial,Prod.fst_swap,Prod.snd_swap] | |
| ring | |
| theorem numerator_swap (k : ι → ℕ × ℕ) (a : ι → ℝ) (r : Plane) : | |
| numerator (fun i => (k i).swap) a r.swap=(numerator k a r).swap := by | |
| apply Prod.ext <;> apply Finset.sum_congr rfl <;> intro i _ | |
| all_goals simp only [monomial,Prod.fst_swap,Prod.snd_swap]; ring | |
| theorem moment_swap (k : ι → ℕ × ℕ) (a : ι → ℝ) (r : Plane) : | |
| moment (fun i => (k i).swap) a r.swap=(moment k a r).swap := by | |
| unfold moment | |
| rw [polynomial_swap,numerator_swap] | |
| rfl | |
| theorem centered_swap (k : ι → ℕ × ℕ) (a : ι → ℝ) (p r : Plane) : | |
| centered (fun i => (k i).swap) a p.swap r.swap=(centered k a p r).swap := by | |
| apply Prod.ext <;> apply Finset.sum_congr rfl <;> intro i _ | |
| all_goals simp only [monomial,Prod.fst_swap,Prod.snd_swap]; ring | |
| theorem exists_smooth_other_axis_radial_solution {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (hzero : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {t : ℝ} (ht : 0≤t) : | |
| ∃ f : ((ι → ℝ) × Plane) → Plane, | |
| f (a,moment k a (t,0))=(t,0) ∧ | |
| ContDiffAt ℝ ∞ f (a,moment k a (t,0)) ∧ | |
| ∀ᶠ q in 𝓝 (a,moment k a (t,0)),centered k q.1 q.2 (f q)=0 := by | |
| have hzero' : ∃ i,(k i).swap=(0,0) := by | |
| obtain ⟨i,hi⟩ := hzero | |
| exact ⟨i,by simp [hi]⟩ | |
| have he0' : ∃ i,(k i).swap=(1,0) := by | |
| obtain ⟨i,hi⟩ := he1 | |
| exact ⟨i,by simp [hi]⟩ | |
| have he1' : ∃ i,(k i).swap=(0,1) := by | |
| obtain ⟨i,hi⟩ := he0 | |
| exact ⟨i,by simp [hi]⟩ | |
| obtain ⟨f,hf,hfs,hfe⟩ := exists_smooth_axis_radial_solution ha hzero' he0' he1' ht | |
| have hm : moment (fun i => (k i).swap) a (0,t)=(moment k a (t,0)).swap := | |
| moment_swap k a (t,0) | |
| rw [hm] at hf hfs hfe | |
| let F : (ι → ℝ) × Plane → Plane := fun q => (f (q.1,q.2.swap)).swap | |
| have hswap : ContDiff ℝ ∞ (fun q : (ι → ℝ) × Plane => (q.1,q.2.swap)) := by | |
| change ContDiff ℝ ∞ (fun q : (ι → ℝ) × Plane => (q.1,(q.2.2,q.2.1))) | |
| fun_prop | |
| refine ⟨F,?_,?_,?_⟩ | |
| · dsimp [F] | |
| rw [hf] | |
| rfl | |
| · have hc : ContDiffAt ℝ ∞ (fun q : (ι → ℝ) × Plane => f (q.1,q.2.swap)) | |
| (a,moment k a (t,0)) := hfs.comp (a,moment k a (t,0)) hswap.contDiffAt | |
| exact hc.snd.prodMk hc.fst | |
| · have htend : Tendsto (fun q : (ι → ℝ) × Plane => (q.1,q.2.swap)) | |
| (𝓝 (a,moment k a (t,0))) (𝓝 (a,(moment k a (t,0)).swap)) := | |
| hswap.continuous.continuousAt | |
| have he := htend.eventually hfe | |
| filter_upwards [he] with q hq | |
| have h := congrArg Prod.swap hq | |
| have hr : centered k q.1 q.2 (F q)= | |
| (centered (fun i => (k i).swap) q.1 q.2.swap (f (q.1,q.2.swap))).swap := by | |
| have hh := centered_swap k q.1 q.2 (F q) | |
| simp only [F,Prod.swap_swap] at hh | |
| exact (congrArg Prod.swap hh).symm | |
| rw [hr,h] | |
| rfl | |
| theorem basis_weights_separate {k : ι → ℕ × ℕ} (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) (p : MomentPlane) | |
| {v : MomentPlane} (hv : v≠0) : ∃ i,inner ℝ (weight k i-p) v≠0 := by | |
| classical | |
| by_contra hn | |
| push Not at hn | |
| obtain ⟨i0,hi0⟩ := h0 | |
| obtain ⟨i1,hi1⟩ := he0 | |
| obtain ⟨i2,hi2⟩ := he1 | |
| have hp : inner ℝ p v=0 := by | |
| have h := hn i0 | |
| have hw : weight k i0=0 := by ext j; fin_cases j <;> simp [weight,hi0,planeVector] | |
| simpa only [hw,zero_sub,inner_neg_left,neg_eq_zero] using h | |
| have hv0 : v 0=0 := by | |
| have h := hn i1 | |
| simpa [inner_sub_left,hp,weight,hi1,planeVector,PiLp.inner_apply,Fin.sum_univ_succ] using h | |
| have hv1 : v 1=0 := by | |
| have h := hn i2 | |
| simpa [inner_sub_left,hp,weight,hi2,planeVector,PiLp.inner_apply,Fin.sum_univ_succ] using h | |
| apply hv | |
| ext j | |
| fin_cases j <;> assumption | |
| theorem positive_radial_unique_basis {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) | |
| {r s : Plane} (hr : 0<r.1 ∧ 0<r.2) (hs : 0<s.1 ∧ 0<s.2) | |
| (he : moment k a r=moment k a s) : r=s := by | |
| let : Nonempty ι := ⟨h0.choose⟩ | |
| let p := planeVector (moment k a r).1 (moment k a r).2 | |
| have hre : FiniteMoment.moment (weight k) a (logRadius r)=p := by | |
| rw [← moment_expRadius,expRadius_logRadius hr] | |
| have hse : FiniteMoment.moment (weight k) a (logRadius s)=p := by | |
| rw [← moment_expRadius,expRadius_logRadius hs,← he] | |
| have hh := moment_unique_of_separates ha (fun v hv => basis_weights_separate h0 he0 he1 p hv) hre hse | |
| have h := congrArg expRadius hh | |
| simpa only [expRadius_logRadius hr,expRadius_logRadius hs] using h | |
| theorem moment_zero_coordinates {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) : | |
| ((moment k a r).1=0 ↔ r.1=0) ∧ ((moment k a r).2=0 ↔ r.2=0) := by | |
| have hs := slope_pos ha h0 he0 he1 hr | |
| rw [moment_eq_radius_slope] | |
| exact ⟨mul_eq_zero_iff_right hs.1.ne',mul_eq_zero_iff_right hs.2.ne'⟩ | |
| theorem moment_injective_quadrant {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) : | |
| InjOn (moment k a) {r : Plane | 0≤r.1 ∧ 0≤r.2} := by | |
| intro r hr s hs he | |
| have hzr := moment_zero_coordinates ha h0 he0 he1 hr | |
| have hzs := moment_zero_coordinates ha h0 he0 he1 hs | |
| have hz0 : r.1=0 ↔ s.1=0 := hzr.1.symm.trans ((congrArg Prod.fst he) ▸ hzs.1) | |
| have hz1 : r.2=0 ↔ s.2=0 := hzr.2.symm.trans ((congrArg Prod.snd he) ▸ hzs.2) | |
| by_cases hr0 : r.1=0 | |
| · have hs0 := hz0.mp hr0 | |
| by_cases hr1 : r.2=0 | |
| · exact Prod.ext (hr0.trans hs0.symm) (hr1.trans (hz1.mp hr1).symm) | |
| · have hrp : 0<r.2 := lt_of_le_of_ne hr.2 (Ne.symm hr1) | |
| have hsp : 0<s.2 := lt_of_le_of_ne hs.2 (Ne.symm (fun h => hr1 (hz1.mpr h))) | |
| have hrr : r=(0,r.2) := Prod.ext hr0 rfl | |
| have hss : s=(0,s.2) := Prod.ext hs0 rfl | |
| have hp : moment k a (0,r.2)=(0,(moment k a (0,r.2)).2) := | |
| Prod.ext (moment_axis_fst k a _) rfl | |
| have hps : moment k a (0,s.2)=(0,(moment k a (0,r.2)).2) := by | |
| rw [← hss,← he,hrr] | |
| exact hp | |
| exact Prod.ext (hr0.trans hs0.symm) (positive_axis_unique ha h0 he1 hrp hsp hp hps) | |
| · have hs0 : s.1≠0 := fun h => hr0 (hz0.mpr h) | |
| have hrp : 0<r.1 := lt_of_le_of_ne hr.1 (Ne.symm hr0) | |
| have hsp : 0<s.1 := lt_of_le_of_ne hs.1 (Ne.symm hs0) | |
| by_cases hr1 : r.2=0 | |
| · have hs1 := hz1.mp hr1 | |
| have h0' : ∃ i,(k i).swap=(0,0) := by obtain ⟨i,hi⟩ := h0; exact ⟨i,by simp [hi]⟩ | |
| have h1' : ∃ i,(k i).swap=(0,1) := by obtain ⟨i,hi⟩ := he0; exact ⟨i,by simp [hi]⟩ | |
| have hrr : r.swap=(0,r.1) := Prod.ext hr1 rfl | |
| have hss : s.swap=(0,s.1) := Prod.ext hs1 rfl | |
| have hes : moment (fun i => (k i).swap) a r.swap=moment (fun i => (k i).swap) a s.swap := by | |
| rw [moment_swap,moment_swap,he] | |
| rw [hrr,hss] at hes | |
| have hp : moment (fun i => (k i).swap) a (0,r.1)= | |
| (0,(moment (fun i => (k i).swap) a (0,r.1)).2) := | |
| Prod.ext (moment_axis_fst _ a _) rfl | |
| exact Prod.ext (positive_axis_unique ha h0' h1' hrp hsp hp (hes.symm.trans hp)) | |
| (hr1.trans hs1.symm) | |
| · exact positive_radial_unique_basis ha h0 he0 he1 | |
| ⟨hrp,lt_of_le_of_ne hr.2 (Ne.symm hr1)⟩ | |
| ⟨hsp,lt_of_le_of_ne hs.2 (Ne.symm (fun h => hr1 (hz1.mpr h)))⟩ he | |
| theorem exists_smooth_boundary_radial_solution {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (hzero : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) (hb : r.1=0 ∨ r.2=0) : | |
| ∃ f : ((ι → ℝ) × Plane) → Plane, | |
| f (a,moment k a r)=r ∧ ContDiffAt ℝ ∞ f (a,moment k a r) ∧ | |
| ∀ᶠ q in 𝓝 (a,moment k a r),centered k q.1 q.2 (f q)=0 := by | |
| rcases r with ⟨s,t⟩ | |
| rcases hb with hs|ht | |
| · change s=0 at hs | |
| subst s | |
| exact exists_smooth_axis_radial_solution ha hzero he0 he1 hr.2 | |
| · change t=0 at ht | |
| subst t | |
| exact exists_smooth_other_axis_radial_solution ha hzero he0 he1 hr.1 | |
| theorem exists_smooth_boundary_moment_inverse {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (hzero : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) (hb : r.1=0 ∨ r.2=0) : | |
| ∃ f : ((ι → ℝ) × Plane) → Plane, | |
| f (a,moment k a r)=r ∧ ContDiffAt ℝ ∞ f (a,moment k a r) ∧ | |
| ∀ᶠ q in 𝓝 (a,moment k a r), | |
| moment k q.1 (f q)=q.2 ∧ | |
| (0≤(f q).1 ↔ 0≤q.2.1) ∧ (0≤(f q).2 ↔ 0≤q.2.2) ∧ | |
| (0<(f q).1 ↔ 0<q.2.1) ∧ (0<(f q).2 ↔ 0<q.2.2) := by | |
| obtain ⟨f,hf,hfs,hfe⟩ := exists_smooth_boundary_radial_solution ha hzero he0 he1 hr hb | |
| let q0 := (a,moment k a r) | |
| have hc : ContDiffAt ℝ ∞ (fun q : (ι → ℝ) × Plane => (q.1,f q)) q0 := | |
| contDiffAt_fst.prodMk hfs | |
| have hP := polynomial_pos ha hzero hr | |
| have hPc : ContinuousAt (fun q : (ι → ℝ) × Plane => polynomial k q.1 (f q)) q0 := | |
| (polynomial_contDiff k).continuous.continuousAt.comp hc.continuousAt | |
| have hPe : ∀ᶠ q in 𝓝 q0,0<polynomial k q.1 (f q) := by | |
| apply hPc.tendsto.eventually | |
| exact eventually_gt_nhds (by simpa only [q0,hf] using hP) | |
| have hsc : ContDiffAt ℝ ∞ (fun q : (ι → ℝ) × Plane => slope k q.1 (f q)) q0 := by | |
| have hs := slope_contDiffAt hP.ne' | |
| have hh : (a,r)=(q0.1,f q0) := by simp [q0,hf] | |
| rw [hh] at hs | |
| exact hs.comp q0 hc | |
| have hs := slope_pos ha hzero he0 he1 hr | |
| have hse0 : ∀ᶠ q in 𝓝 q0,0<(slope k q.1 (f q)).1 := by | |
| apply hsc.continuousAt.fst.tendsto.eventually | |
| exact eventually_gt_nhds (by simpa only [q0,hf] using hs.1) | |
| have hse1 : ∀ᶠ q in 𝓝 q0,0<(slope k q.1 (f q)).2 := by | |
| apply hsc.continuousAt.snd.tendsto.eventually | |
| exact eventually_gt_nhds (by simpa only [q0,hf] using hs.2) | |
| refine ⟨f,hf,hfs,?_⟩ | |
| filter_upwards [hfe,hPe,hse0,hse1] with q hq hPq hs0 hs1 | |
| have hm := moment_eq_of_centered hPq.ne' hq | |
| refine ⟨hm,?_,?_,?_,?_⟩ | |
| all_goals | |
| have he := moment_eq_radius_slope k q.1 (f q) | |
| rw [hm] at he | |
| · rw [show q.2.1=(f q).1*(slope k q.1 (f q)).1 from congrArg Prod.fst he] | |
| exact (mul_nonneg_iff_of_pos_right hs0).symm | |
| · rw [show q.2.2=(f q).2*(slope k q.1 (f q)).2 from congrArg Prod.snd he] | |
| exact (mul_nonneg_iff_of_pos_right hs1).symm | |
| · rw [show q.2.1=(f q).1*(slope k q.1 (f q)).1 from congrArg Prod.fst he] | |
| exact (mul_pos_iff_of_pos_right hs0).symm | |
| · rw [show q.2.2=(f q).2*(slope k q.1 (f q)).2 from congrArg Prod.snd he] | |
| exact (mul_pos_iff_of_pos_right hs1).symm | |
| abbrev Quadrant := {r : Plane // 0≤r.1 ∧ 0≤r.2} | |
| instance : Inhabited Quadrant := ⟨⟨(0,0),le_rfl,le_rfl⟩⟩ | |
| def nonnegativeInverse (k : ι → ℕ × ℕ) (a : ι → ℝ) (p : Plane) : Plane := | |
| (invFun (fun r : Quadrant => moment k a r.val) p).val | |
| theorem nonnegativeInverse_nonneg (k : ι → ℕ × ℕ) (a : ι → ℝ) (p : Plane) : | |
| 0≤(nonnegativeInverse k a p).1 ∧ 0≤(nonnegativeInverse k a p).2 := | |
| (invFun (fun r : Quadrant => moment k a r.val) p).property | |
| theorem nonnegativeInverse_spec {k : ι → ℕ × ℕ} {a : ι → ℝ} {p : Plane} | |
| (hp : ∃ r : Plane,(0≤r.1 ∧ 0≤r.2) ∧ moment k a r=p) : | |
| moment k a (nonnegativeInverse k a p)=p := by | |
| change (fun r : Quadrant => moment k a r.val) | |
| (invFun (fun r : Quadrant => moment k a r.val) p)=p | |
| exact invFun_eq (f := fun r : Quadrant => moment k a r.val) | |
| (by obtain ⟨r,hr,he⟩ := hp; exact ⟨⟨r,hr⟩,he⟩) | |
| theorem nonnegativeInverse_of_moment {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) : nonnegativeInverse k a (moment k a r)=r := by | |
| apply moment_injective_quadrant ha h0 he0 he1 (nonnegativeInverse_nonneg _ _ _) hr | |
| exact nonnegativeInverse_spec ⟨r,hr,rfl⟩ | |
| theorem nonnegativeInverse_eq_of_moment {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r p : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) (he : moment k a r=p) : nonnegativeInverse k a p=r := by | |
| rw [← he] | |
| exact nonnegativeInverse_of_moment ha h0 he0 he1 hr | |
| theorem boundary_inverse_smooth_extension {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) (hb : r.1=0 ∨ r.2=0) : | |
| ∃ f : ((ι → ℝ) × Plane) → Plane, | |
| f (a,moment k a r)=nonnegativeInverse k a (moment k a r) ∧ | |
| ContDiffAt ℝ ∞ f (a,moment k a r) ∧ | |
| ∀ᶠ q in 𝓝 (a,moment k a r), | |
| (∀ i,0<q.1 i) → 0≤q.2.1 → 0≤q.2.2 → nonnegativeInverse k q.1 q.2=f q := by | |
| obtain ⟨f,hf,hfs,hfe⟩ := exists_smooth_boundary_moment_inverse ha h0 he0 he1 hr hb | |
| refine ⟨f,hf.trans (nonnegativeInverse_of_moment ha h0 he0 he1 hr).symm,hfs,?_⟩ | |
| filter_upwards [hfe] with q hq hqa hq0 hq1 | |
| exact nonnegativeInverse_eq_of_moment hqa h0 he0 he1 | |
| ⟨hq.2.1.mpr hq0,hq.2.2.1.mpr hq1⟩ hq.1 | |
| theorem boundary_inverse_contDiffWithinAt {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) (hb : r.1=0 ∨ r.2=0) : | |
| ContDiffWithinAt ℝ ∞ (fun q : (ι → ℝ) × Plane => nonnegativeInverse k q.1 q.2) | |
| {q | (∀ i,0<q.1 i) ∧ 0≤q.2.1 ∧ 0≤q.2.2} (a,moment k a r) := by | |
| obtain ⟨f,hf,hfs,hfe⟩ := boundary_inverse_smooth_extension ha h0 he0 he1 hr hb | |
| apply hfs.contDiffWithinAt.congr_of_eventuallyEq _ hf.symm | |
| filter_upwards [hfe.filter_mono nhdsWithin_le_nhds,self_mem_nhdsWithin] with q hq hqS | |
| exact hq hqS.1 hqS.2.1 hqS.2.2 | |
| theorem boundary_inverse_coeff_contDiffAt {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {r : Plane} | |
| (hr : 0≤r.1 ∧ 0≤r.2) (hb : r.1=0 ∨ r.2=0) : | |
| ContDiffAt ℝ ∞ (fun b : ι → ℝ => nonnegativeInverse k b (moment k a r)) a := by | |
| obtain ⟨f,hf,hfs,hfe⟩ := boundary_inverse_smooth_extension ha h0 he0 he1 hr hb | |
| have hmap : ContDiff ℝ ∞ (fun b : ι → ℝ => (b,moment k a r)) := by fun_prop | |
| have hfc : ContDiffAt ℝ ∞ (fun b : ι → ℝ => f (b,moment k a r)) a := | |
| hfs.comp a hmap.contDiffAt | |
| apply hfc.congr_of_eventuallyEq | |
| have hmapt : Tendsto (fun b : ι → ℝ => (b,moment k a r)) (𝓝 a) (𝓝 (a,moment k a r)) := | |
| hmap.continuous.continuousAt | |
| have hape : ∀ᶠ b in 𝓝 a,∀ i,0<b i := positiveCoefficients_isOpen.mem_nhds ha | |
| filter_upwards [hmapt.eventually hfe,hape] with b hb hba | |
| have hsm := slope_pos ha h0 he0 he1 hr | |
| have hmr : 0≤(moment k a r).1 ∧ 0≤(moment k a r).2 := by | |
| rw [moment_eq_radius_slope] | |
| exact ⟨mul_nonneg hr.1 hsm.1.le,mul_nonneg hr.2 hsm.2.le⟩ | |
| exact hb hba hmr.1 hmr.2 | |
| end | |
| section | |
| open scoped BigOperators Topology ContDiff | |
| open Set Filter Function | |
| def latticeIndex {A B : ℕ} (i : TrapezoidWeight A B) : ℕ × ℕ := | |
| (i.val.1.val,i.val.2.val) | |
| def lowerTrapezoid (A B : ℝ) : Set Plane := | |
| {p | 0≤p.1 ∧ p.1<A ∧ 0≤p.2 ∧ p.1+p.2<B} | |
| theorem lattice_zero (A B : ℕ) : ∃ i : TrapezoidWeight A B,latticeIndex i=(0,0) := | |
| ⟨⟨(⟨0,by omega⟩,⟨0,by omega⟩),by simp⟩,rfl⟩ | |
| theorem lattice_unit_fst {A B : ℕ} (hA : 0<A) (hAB : A≤B) : | |
| ∃ i : TrapezoidWeight A B,latticeIndex i=(1,0) := | |
| ⟨⟨(⟨1,by omega⟩,⟨0,by omega⟩),by simp; omega⟩,rfl⟩ | |
| theorem lattice_unit_snd {A B : ℕ} (hA : 0<A) (hAB : A≤B) : | |
| ∃ i : TrapezoidWeight A B,latticeIndex i=(0,1) := | |
| ⟨⟨(⟨0,by omega⟩,⟨1,by omega⟩),by simp; omega⟩,rfl⟩ | |
| theorem lattice_end_fst {A B : ℕ} (hAB : A≤B) : | |
| ∃ i : TrapezoidWeight A B,latticeIndex i=(A,0) := | |
| ⟨⟨(⟨A,by omega⟩,⟨0,by omega⟩),by simp [hAB]⟩,rfl⟩ | |
| theorem lattice_end_snd (A B : ℕ) : | |
| ∃ i : TrapezoidWeight A B,latticeIndex i=(0,B) := | |
| ⟨⟨(⟨0,by omega⟩,⟨B,by omega⟩),by simp⟩,rfl⟩ | |
| theorem trapezoid_radial_surjective {A B : ℕ} (hAB : A≤B) | |
| {a : TrapezoidWeight A B → ℝ} (ha : ∀ i,0<a i) {p : Plane} | |
| (hp : p∈lowerTrapezoid A B) : | |
| ∃ r : Plane,(0≤r.1 ∧ 0≤r.2) ∧ moment latticeIndex a r=p := by | |
| by_cases hp0 : p.1=0 | |
| · by_cases hp1 : p.2=0 | |
| · refine ⟨(0,0),⟨le_rfl,le_rfl⟩,?_⟩ | |
| rw [moment_origin] | |
| exact Prod.ext hp0.symm hp1.symm | |
| · obtain ⟨t,ht,he⟩ := exists_axis_solution ha (lattice_zero A B) (lattice_end_snd A B) | |
| (p:=p.2) ⟨lt_of_le_of_ne hp.2.2.1 (Ne.symm hp1),by simpa [hp0] using hp.2.2.2⟩ | |
| exact ⟨(0,t),⟨le_rfl,ht.le⟩,he.trans (Prod.ext hp0.symm rfl)⟩ | |
| · have hp0p : 0<p.1 := lt_of_le_of_ne hp.1 (Ne.symm hp0) | |
| by_cases hp1 : p.2=0 | |
| · have hzero : ∃ i : TrapezoidWeight A B,(latticeIndex i).swap=(0,0) := by | |
| obtain ⟨i,hi⟩ := lattice_zero A B | |
| exact ⟨i,by simp [hi]⟩ | |
| have hend : ∃ i : TrapezoidWeight A B,(latticeIndex i).swap=(0,A) := by | |
| obtain ⟨i,hi⟩ := lattice_end_fst hAB | |
| exact ⟨i,by simp [hi]⟩ | |
| obtain ⟨t,ht,he⟩ := exists_axis_solution ha hzero hend ⟨hp0p,hp.2.1⟩ | |
| refine ⟨(t,0),⟨ht.le,le_rfl⟩,?_⟩ | |
| have hh := moment_swap latticeIndex a (t,0) | |
| change moment (fun i => (latticeIndex i).swap) a (0,t)= | |
| (moment latticeIndex a (t,0)).swap at hh | |
| rw [he] at hh | |
| have hx := congrArg Prod.swap hh | |
| exact (show moment latticeIndex a (t,0)=(p.1,0) by simpa using hx.symm).trans | |
| (Prod.ext rfl hp1.symm) | |
| · obtain ⟨r,hr,he⟩ := exists_positive_radial_solution ha | |
| (show Surrounds (weight (latticeIndex (A:=A) (B:=B))) (planeVector p.1 p.2) from | |
| trapezoidWeight_surrounds hAB ⟨hp0p,hp.2.1,lt_of_le_of_ne hp.2.2.1 (Ne.symm hp1),hp.2.2.2⟩) | |
| exact ⟨r,⟨hr.1.le,hr.2.le⟩,he⟩ | |
| theorem trapezoid_inverse_spec {A B : ℕ} (hAB : A≤B) | |
| {a : TrapezoidWeight A B → ℝ} (ha : ∀ i,0<a i) {p : Plane} | |
| (hp : p∈lowerTrapezoid A B) : moment latticeIndex a (nonnegativeInverse latticeIndex a p)=p := | |
| nonnegativeInverse_spec (trapezoid_radial_surjective hAB ha hp) | |
| end | |
| section | |
| open scoped BigOperators Topology ContDiff | |
| open Set Filter Function | |
| variable {ι : Type*} [Fintype ι] | |
| theorem planeVector_contDiff : ContDiff ℝ ∞ (fun r : Plane => planeVector r.1 r.2) := by | |
| apply (contDiff_piLp 2).mpr | |
| intro j | |
| fin_cases j | |
| · exact contDiff_fst | |
| · exact contDiff_snd | |
| theorem expRadius_contDiff : ContDiff ℝ ∞ expRadius := by | |
| apply ContDiff.prodMk <;> apply ContDiff.exp <;> fun_prop | |
| theorem nonnegativeInverse_exp [Nonempty ι] {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {p : Plane} | |
| (hp : Surrounds (weight k) (planeVector p.1 p.2)) : | |
| nonnegativeInverse k a p=expRadius (inverse (weight k) a (planeVector p.1 p.2)) := by | |
| apply nonnegativeInverse_eq_of_moment ha h0 he0 he1 | |
| ⟨(Real.exp_pos _).le,(Real.exp_pos _).le⟩ | |
| have he := moment_expRadius k a (inverse (weight k) a (planeVector p.1 p.2)) | |
| rw [inverse_spec ha hp] at he | |
| exact Prod.ext (congrArg (fun z : MomentPlane => z 0) he) | |
| (congrArg (fun z : MomentPlane => z 1) he) | |
| theorem nonnegativeInverse_interior_contDiffAt [Nonempty ι] {k : ι → ℕ × ℕ} {a : ι → ℝ} | |
| (ha : ∀ i,0<a i) (h0 : ∃ i,k i=(0,0)) | |
| (he0 : ∃ i,k i=(1,0)) (he1 : ∃ i,k i=(0,1)) {p : Plane} | |
| (hp : Surrounds (weight k) (planeVector p.1 p.2)) : | |
| ContDiffAt ℝ ∞ (fun q : (ι → ℝ) × Plane => nonnegativeInverse k q.1 q.2) (a,p) := by | |
| have hmap : ContDiff ℝ ∞ (fun q : (ι → ℝ) × Plane => (q.1,planeVector q.2.1 q.2.2)) := | |
| contDiff_fst.prodMk (planeVector_contDiff.comp contDiff_snd) | |
| have hs := expRadius_contDiff.contDiffAt.comp (a,p) | |
| ((inverse_contDiffAt ha hp).comp (a,p) hmap.contDiffAt) | |
| apply hs.congr_of_eventuallyEq | |
| have hae : ∀ᶠ q : (ι → ℝ) × Plane in 𝓝 (a,p),∀ i,0<q.1 i := | |
| (positiveCoefficients_isOpen.preimage continuous_fst).mem_nhds ha | |
| have hpe : ∀ᶠ q : (ι → ℝ) × Plane in 𝓝 (a,p),Surrounds (weight k) (planeVector q.2.1 q.2.2) := | |
| ((surrounds_isOpen (weight k)).preimage (planeVector_contDiff.continuous.comp continuous_snd)).mem_nhds hp | |
| filter_upwards [hae,hpe] with q hqa hqp | |
| exact nonnegativeInverse_exp hqa h0 he0 he1 hqp | |
| end | |
| open scoped BigOperators Topology ContDiff | |
| open Set Filter Function | |
| theorem trapezoid_inverse_contDiffWithinAt {A B : ℕ} (hA : 0<A) (hAB : A≤B) | |
| {a : TrapezoidWeight A B → ℝ} (ha : ∀ i,0<a i) {p : Plane} | |
| (hp : p∈lowerTrapezoid A B) : | |
| ContDiffWithinAt ℝ ∞ | |
| (fun q : (TrapezoidWeight A B → ℝ) × Plane => nonnegativeInverse latticeIndex q.1 q.2) | |
| {q | (∀ i,0<q.1 i) ∧ q.2∈lowerTrapezoid A B} (a,p) := by | |
| by_cases hb : p.1=0 ∨ p.2=0 | |
| · let r := nonnegativeInverse (latticeIndex (A:=A) (B:=B)) a p | |
| have hr := nonnegativeInverse_nonneg (latticeIndex (A:=A) (B:=B)) a p | |
| have he : moment latticeIndex a r=p := trapezoid_inverse_spec hAB ha hp | |
| have hz := moment_zero_coordinates ha (lattice_zero A B) (lattice_unit_fst hA hAB) | |
| (lattice_unit_snd hA hAB) hr | |
| have hbr : r.1=0 ∨ r.2=0 := by | |
| rw [he] at hz | |
| exact hb.elim (fun h => Or.inl (hz.1.mp h)) (fun h => Or.inr (hz.2.mp h)) | |
| have hs := boundary_inverse_contDiffWithinAt ha (lattice_zero A B) | |
| (lattice_unit_fst hA hAB) (lattice_unit_snd hA hAB) hr hbr | |
| rw [he] at hs | |
| exact hs.mono (fun _ hq => ⟨hq.1,hq.2.1,hq.2.2.2.1⟩) | |
| · have hp0 : 0<p.1 := lt_of_le_of_ne hp.1 (Ne.symm (fun h => hb (Or.inl h))) | |
| have hp1 : 0<p.2 := lt_of_le_of_ne hp.2.2.1 (Ne.symm (fun h => hb (Or.inr h))) | |
| exact (nonnegativeInverse_interior_contDiffAt ha (lattice_zero A B) | |
| (lattice_unit_fst hA hAB) (lattice_unit_snd hA hAB) | |
| (trapezoidWeight_surrounds hAB ⟨hp0,hp.2.1,hp1,hp.2.2.2⟩)).contDiffWithinAt | |
| theorem trapezoid_inverse_coeff_contDiffAt {A B : ℕ} (hA : 0<A) (hAB : A≤B) | |
| {a : TrapezoidWeight A B → ℝ} (ha : ∀ i,0<a i) {p : Plane} | |
| (hp : p∈lowerTrapezoid A B) : | |
| ContDiffAt ℝ ∞ (fun b : TrapezoidWeight A B → ℝ => nonnegativeInverse latticeIndex b p) a := by | |
| by_cases hb : p.1=0 ∨ p.2=0 | |
| · let r := nonnegativeInverse (latticeIndex (A:=A) (B:=B)) a p | |
| have hr := nonnegativeInverse_nonneg (latticeIndex (A:=A) (B:=B)) a p | |
| have he : moment latticeIndex a r=p := trapezoid_inverse_spec hAB ha hp | |
| have hz := moment_zero_coordinates ha (lattice_zero A B) (lattice_unit_fst hA hAB) | |
| (lattice_unit_snd hA hAB) hr | |
| have hbr : r.1=0 ∨ r.2=0 := by | |
| rw [he] at hz | |
| exact hb.elim (fun h => Or.inl (hz.1.mp h)) (fun h => Or.inr (hz.2.mp h)) | |
| have hs := boundary_inverse_coeff_contDiffAt ha (lattice_zero A B) | |
| (lattice_unit_fst hA hAB) (lattice_unit_snd hA hAB) hr hbr | |
| rwa [he] at hs | |
| · have hp0 : 0<p.1 := lt_of_le_of_ne hp.1 (Ne.symm (fun h => hb (Or.inl h))) | |
| have hp1 : 0<p.2 := lt_of_le_of_ne hp.2.2.1 (Ne.symm (fun h => hb (Or.inr h))) | |
| have hs : ContDiffAt ℝ ∞ | |
| (fun q : (TrapezoidWeight A B → ℝ) × Plane => nonnegativeInverse latticeIndex q.1 q.2) (a,p) := | |
| nonnegativeInverse_interior_contDiffAt ha (lattice_zero A B) | |
| (lattice_unit_fst hA hAB) (lattice_unit_snd hA hAB) | |
| (trapezoidWeight_surrounds hAB ⟨hp0,hp.2.1,hp1,hp.2.2.2⟩) | |
| have hmap : ContDiffAt ℝ ∞ (fun b : TrapezoidWeight A B → ℝ => (b,p)) a := | |
| contDiffAt_id.prodMk contDiffAt_const | |
| have hc := hs.comp a hmap | |
| exact hc | |
| end PackingSufficiencySupport.FiniteMoment.Radial | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 24.4 kB
- Xet hash:
- 2285c41ad23b6be95b43ba3e6b417eab2b98928545e279145be847672e829286
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.