Download data/lean/OAI/Combinatorics/HalvingLines/Partition.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 25.5 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/HalvingLines/Partition.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/HalvingLines/Partition.lean
-
curl -L -o Partition.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/HalvingLines/Partition.lean
25.5 kB
| import OAI.Combinatorics.HalvingLines.AtomicBounds | |
| namespace OAI | |
| open Filter Topology | |
| namespace PlanarHalving.Limits | |
| open MeasureTheory Set Filter | |
| open scoped Topology | |
| variable {X ΞΉ : Type*} [MeasurableSpace X] | |
| lemma probability_overlap_bound (ΞΌ : FiniteMeasure X) (S : Finset ΞΉ) (p : ΞΉ β X β β) | |
| (hp : β i β S, Measurable (p i)) (hp0 : β i β S, β z, 0 β€ p i z) | |
| (hsum : β z, β i β S, p i z β€ 1) {Ξ² : β} (hΞ² : 0 < Ξ²) : | |
| β i β S, (ΞΌ {z | Ξ² < p i z} : β) β€ (ΞΌ.mass : β)/Ξ² := by | |
| classical | |
| let A : ΞΉ β Set X := fun i => {z | Ξ² < p i z} | |
| have hm i (hi : i β S) : MeasurableSet (A i) := measurableSet_lt measurable_const (hp i hi) | |
| have hInt i (hi : i β S) : Integrable ((A i).indicator (fun _ : X => (1 : β))) (ΞΌ : Measure X) := | |
| (integrable_const 1).indicator (hm i hi) | |
| have he i (hi : i β S) : β« z, (A i).indicator (fun _ : X => (1 : β)) z β(ΞΌ : Measure X) = | |
| (ΞΌ (A i) : β) := by | |
| rw [integral_indicator_const 1 (hm i hi)] | |
| simp | |
| have hbound (z : X) : (β i β S, (A i).indicator (fun _ : X => (1 : β)) z) β€ 1/Ξ² := by | |
| have hh : Ξ²*(β i β S, (A i).indicator (fun _ : X => (1 : β)) z) β€ 1 := by | |
| calc | |
| _ = β i β S, Ξ²*(A i).indicator (fun _ : X => (1 : β)) z := Finset.mul_sum .. | |
| _ β€ β i β S, p i z := by | |
| apply Finset.sum_le_sum | |
| intro i hi | |
| by_cases hz : z β A i | |
| Β· simpa only [Set.indicator_of_mem hz,mul_one] using (show Ξ² < p i z from hz).le | |
| Β· simpa only [Set.indicator_of_notMem hz,mul_zero] using hp0 i hi z | |
| _ β€ 1 := hsum z | |
| exact (le_div_iffβ hΞ²).mpr (by simpa only [mul_comm] using hh) | |
| have hh := integral_mono (integrable_finsetSum S hInt) (integrable_const (1/Ξ²)) hbound | |
| rw [integral_finsetSum S hInt] at hh | |
| rw [Finset.sum_congr rfl he] at hh | |
| simpa [integral_const,div_eq_mul_inv,FiniteMeasure.mass] using hh | |
| lemma finite_bad_cover_mass (ΞΌ : FiniteMeasure X) (S : Finset ΞΉ) (p : ΞΉ β X β β) | |
| (hp : β i β S, Measurable (p i)) (hp0 : β i β S, β z, 0 β€ p i z) | |
| (hp1 : β i β S, β z, p i z β€ 1) {Ξ² : β} | |
| {B : Set X} (hB : MeasurableSet B) | |
| (hcover : β z β B, β i β S, Ξ² < p i z) : | |
| Ξ²*(ΞΌ B : β) β€ β i β S, β« z in {z | Ξ² < p i z}, p i z β(ΞΌ : Measure X) := by | |
| classical | |
| let A : ΞΉ β Set X := fun i => {z | Ξ² < p i z} | |
| have hm i (hi : i β S) : MeasurableSet (A i) := measurableSet_lt measurable_const (hp i hi) | |
| have hInt i (hi : i β S) : Integrable (p i) (ΞΌ : Measure X) := | |
| (integrable_const (1 : β)).mono' (hp i hi).aestronglyMeasurable | |
| (Filter.Eventually.of_forall (fun z => by simpa only [Real.norm_eq_abs,abs_of_nonneg (hp0 i hi z)] using hp1 i hi z)) | |
| have hInd i (hi : i β S) := (hInt i hi).indicator (hm i hi) | |
| have hpoint (z : X) : B.indicator (fun _ : X => Ξ²) z β€ β i β S, (A i).indicator (p i) z := by | |
| have hnn i (hi : i β S) : 0 β€ (A i).indicator (p i) z := by | |
| exact Set.indicator_nonneg (fun x _ => hp0 i hi x) z | |
| by_cases hz : z β B | |
| Β· obtain β¨i,hi,hipβ© := hcover z hz | |
| rw [Set.indicator_of_mem hz] | |
| calc | |
| Ξ² β€ (A i).indicator (p i) z := by rw [Set.indicator_of_mem (show z β A i from hip)]; exact hip.le | |
| _ β€ β i β S, (A i).indicator (p i) z := Finset.single_le_sum hnn hi | |
| Β· rw [Set.indicator_of_notMem hz] | |
| exact Finset.sum_nonneg hnn | |
| have hh := integral_mono ((integrable_const Ξ²).indicator hB) (integrable_finsetSum S hInd) hpoint | |
| rw [integral_indicator_const Ξ² hB,integral_finsetSum S hInd] at hh | |
| rw [Finset.sum_congr rfl (fun i hi => integral_indicator (hm i hi))] at hh | |
| simpa [mul_comm] using hh | |
| end PlanarHalving.Limits | |
| namespace PlanarHalving.Limits | |
| open MeasureTheory Set Filter | |
| open scoped Topology | |
| theorem ae_exists_partition_small {X ΞΉ : Type*} [MeasurableSpace X] | |
| (lam ΞΌ : FiniteMeasure X) (S : β β Finset ΞΉ) (p : β β ΞΉ β X β β) | |
| (mu nu : β β ΞΉ β FiniteMeasure X) (s : β β ΞΉ β β) (q : β β β) | |
| {A H : β} (hA : 0 β€ A) | |
| (hq : β n, 0 < q n) (hqtop : Tendsto q atTop atTop) | |
| (hcard : β n, ((S n).card : β) β€ q n) | |
| (hp : β n i, i β S n β Measurable (p n i)) | |
| (hp0 : β n i, i β S n β β z, 0 β€ p n i z) | |
| (hp1 : β n i, i β S n β β z, p n i z β€ 1) | |
| (hsum : β n z, β i β S n, p n i z β€ 1) | |
| (hs0 : β n i, i β S n β 0 β€ s n i) | |
| (hmu : β n i, i β S n β β B, mu n i B β€ ΞΌ B) | |
| (hnu : β n i, i β S n β β B, MeasurableSet B β | |
| (nu n i B : β) = β« z in B, p n i z β(lam : Measure X)) | |
| (hnuMass : β n i, i β S n β ((nu n i).mass : β) β€ (q n)β»ΒΉ) | |
| (hmass : β n i, i β S n β β B, MeasurableSet B β | |
| (nu n i B : β)^3 β€ A*(s n i)^3*(mu n i B : β)) | |
| (htail : β n u, 0 < u β ((S n |>.filter fun i => u < s n i).card : β) β€ | |
| H*u^(-(4:β)/3)) {Ξ² : β} (hΞ² : 0 < Ξ²) : | |
| βα΅ z β(lam : Measure X), β n, β i β S n, p n i z β€ Ξ² := by | |
| classical | |
| let B : Set X := β n, β i β S n, {z | Ξ² < p n i z} | |
| have hm n i (hi : i β S n) : MeasurableSet {z | Ξ² < p n i z} := | |
| measurableSet_lt measurable_const (hp n i hi) | |
| have hB : MeasurableSet B := by | |
| apply MeasurableSet.iInter | |
| intro n | |
| exact (S n).finite_toSet.measurableSet_biUnion (fun i hi => hm n i hi) | |
| have hcover n z (hz : z β B) : β i β S n, Ξ² < p n i z := by | |
| have hz' := mem_iInter.mp hz n | |
| simpa only [mem_iUnion,mem_ofPred_eq,exists_prop] using hz' | |
| have hz := persistent_mass_zero S | |
| (fun n i => (nu n i {z | Ξ² < p n i z} : β)) | |
| (fun n i => (mu n i {z | Ξ² < p n i z} : β)) s q | |
| (L := Ξ²*(lam B : β)) (A := A) (H := H) (U := (ΞΌ.mass : β)/Ξ²) | |
| (mul_nonneg hΞ².le (NNReal.coe_nonneg _)) hA hq hqtop hcard | |
| (fun _ _ _ => NNReal.coe_nonneg _) ?_ | |
| (fun _ _ _ => NNReal.coe_nonneg _) hs0 ?_ ?_ htail ?_ | |
| Β· have hzero : (lam B : β) = 0 := (mul_eq_zero.mp hz).resolve_left hΞ².ne' | |
| have hzero' : (lam : Measure X) B = 0 := by | |
| apply (measureReal_eq_zero_iff (measure_ne_top _ _)).mp | |
| simpa using hzero | |
| rw [ae_iff] | |
| have he : {z | Β¬ β n, β i β S n, p n i z β€ Ξ²} = B := by | |
| ext z | |
| simp only [mem_ofPred_eq,not_exists,not_forall,not_le,B,mem_iInter,mem_iUnion, | |
| exists_prop] | |
| rw [he] | |
| exact hzero' | |
| Β· intro n i hi | |
| exact (show (nu n i {z | Ξ² < p n i z} : β) β€ ((nu n i).mass : β) from | |
| NNReal.coe_le_coe.mpr ((nu n i).apply_le_mass _)).trans (hnuMass n i hi) | |
| Β· intro n i hi | |
| exact hmass n i hi _ (hm n i hi) | |
| Β· intro n | |
| exact (Finset.sum_le_sum (fun i hi => NNReal.coe_le_coe.mpr (hmu n i hi _))).trans | |
| (probability_overlap_bound ΞΌ (S n) (p n) (hp n) (hp0 n) (hsum n) hΞ²) | |
| Β· intro n | |
| have hc := finite_bad_cover_mass lam (S n) (p n) (hp n) (hp0 n) (hp1 n) hB (hcover n) | |
| simpa only [Finset.sum_congr rfl (fun i hi => hnu n i hi _ (hm n i hi))] using hc | |
| end PlanarHalving.Limits | |
| namespace PlanarHalving.Limits | |
| open MeasureTheory Set Filter ProbabilityTheory | |
| lemma kernel_nullSingleton_of_cells {X T ΞΉ : Type*} [MeasurableSpace X] | |
| [MeasurableSpace T] (lam : Measure X) (h : Kernel X T) [IsMarkovKernel h] | |
| (S : β β Finset ΞΉ) (cell : β β ΞΉ β Set T) | |
| (hcover : β n t, β i β S n, t β cell n i) | |
| (hsmall : β m : β, βα΅ z βlam, β n, β i β S n, | |
| (h z).real (cell n i) β€ 1/((m : β)+1)) : | |
| βα΅ z βlam, NullSingletonClass (h z) := by | |
| have hh := (ae_all_iff.mpr hsmall) | |
| filter_upwards [hh] with z hz | |
| constructor | |
| intro t | |
| apply (measureReal_eq_zero_iff (measure_ne_top _ _)).mp | |
| by_contra hpos | |
| have htpos : 0 < (h z).real {t} := lt_of_le_of_ne (measureReal_nonneg) (Ne.symm hpos) | |
| obtain β¨m, hmβ© := exists_nat_one_div_lt htpos | |
| obtain β¨n, hnβ© := hz m | |
| obtain β¨i, hi, hitβ© := hcover n t | |
| have hh : (h z).real {t} β€ (h z).real (cell n i) := | |
| measureReal_mono (singleton_subset_iff.mpr hit) | |
| linarith [hn i hi] | |
| end PlanarHalving.Limits | |
| namespace PlanarHalving.UniformPartition | |
| open MeasureTheory Set | |
| open scoped unitInterval | |
| noncomputable def boundary (m : β) [NeZero m] (i : Fin (m+1)) : I := | |
| β¨(i : β)/(m : β), by | |
| have hm : (0 : β) < m := Nat.cast_pos.mpr (NeZero.pos m) | |
| constructor | |
| Β· positivity | |
| Β· apply (div_le_one hm).mpr | |
| exact_mod_cast (Nat.le_of_lt_succ i.isLt)β© | |
| noncomputable def cell (m : β) [NeZero m] (i : Fin m) : Set I := | |
| if i.val+1=m then Icc (boundary m i.castSucc) (boundary m i.succ) | |
| else Ico (boundary m i.castSucc) (boundary m i.succ) | |
| lemma cell_measurable (m : β) [NeZero m] (i : Fin m) : MeasurableSet (cell m i) := by | |
| unfold cell | |
| split_ifs <;> measurability | |
| lemma cell_lower (m : β) [NeZero m] (i : Fin m) {t : I} (ht : t β cell m i) : | |
| (i : β)/(m : β) β€ (t : β) := by | |
| unfold cell at ht | |
| split_ifs at ht <;> exact ht.1 | |
| lemma cell_upper (m : β) [NeZero m] (i : Fin m) {t : I} (ht : t β cell m i) : | |
| (t : β) β€ ((i : β)+1)/(m : β) := by | |
| unfold cell at ht | |
| split_ifs at ht | |
| Β· simpa [boundary] using (show (t : β) β€ (boundary m i.succ : β) from ht.2) | |
| Β· simpa [boundary] using (show (t : β) β€ (boundary m i.succ : β) from ht.2.le) | |
| lemma cell_upper_lt (m : β) [NeZero m] (i : Fin m) (hi : i.val+1β m) | |
| {t : I} (ht : t β cell m i) : (t : β) < ((i : β)+1)/(m : β) := by | |
| rw [cell,ite_eq_right hi] at ht | |
| simpa [boundary] using (show (t : β) < (boundary m i.succ : β) from ht.2) | |
| lemma cells_disjoint (m : β) [NeZero m] : Pairwise (fun i j : Fin m => Disjoint (cell m i) (cell m j)) := by | |
| have hh (i j : Fin m) (hlt : i.val < j.val) : Disjoint (cell m i) (cell m j) := by | |
| apply Set.disjoint_left.mpr | |
| intro t hti htj | |
| have hm : (0 : β) < m := Nat.cast_pos.mpr (NeZero.pos m) | |
| have hu := cell_upper_lt m i (by omega) hti | |
| have hl := cell_lower m j htj | |
| have hij' : (i : β)+1 β€ (j : β) := by exact_mod_cast hlt | |
| have hc := div_le_div_of_nonneg_right hij' hm.le | |
| linarith | |
| intro i j hij | |
| have hne : i.val β j.val := fun h => hij (Fin.ext h) | |
| rcases lt_or_gt_of_ne hne with h | h | |
| Β· exact hh i j h | |
| Β· exact (hh j i h).symm | |
| lemma mem_some_cell (m : β) [NeZero m] (t : I) : β i : Fin m, t β cell m i := by | |
| have hm : 0 < m := NeZero.pos m | |
| have hm' : (0 : β) < m := Nat.cast_pos.mpr hm | |
| by_cases ht : (t : β)=1 | |
| Β· let i : Fin m := β¨m-1, by omegaβ© | |
| refine β¨i, ?_β© | |
| have hi : i.val+1=m := by dsimp [i]; omega | |
| rw [cell,ite_eq_left hi] | |
| constructor | |
| Β· change (i : β)/(m : β) β€ (t : β) | |
| rw [ht] | |
| apply (div_le_one hm').mpr | |
| exact_mod_cast i.isLt.le | |
| Β· change (t : β) β€ ((i.val+1 : β) : β)/(m : β) | |
| rw [Nat.cast_add,Nat.cast_one,ht] | |
| have he : (i : β)+1=(m : β) := by exact_mod_cast hi | |
| rw [he,div_self hm'.ne'] | |
| Β· have ht' : (t : β)<1 := lt_of_le_of_ne t.property.2 ht | |
| have hx : 0 β€ (m : β)*(t : β) := mul_nonneg hm'.le t.property.1 | |
| have hi : β(m : β)*(t : β)ββ < m := by | |
| apply (Nat.floor_lt hx).mpr | |
| nlinarith | |
| let i : Fin m := β¨β(m : β)*(t : β)ββ, hiβ© | |
| have hlo : (i : β)/(m : β) β€ (t : β) := by | |
| apply (div_le_iffβ hm').mpr | |
| simpa [i,mul_comm] using Nat.floor_le hx | |
| have hup : (t : β) < ((i : β)+1)/(m : β) := by | |
| apply (lt_div_iffβ hm').mpr | |
| simpa [i,mul_comm] using Nat.lt_floor_add_one ((m : β)*(t : β)) | |
| refine β¨i, ?_β© | |
| unfold cell | |
| split_ifs | |
| Β· refine β¨hlo, ?_β© | |
| change (t : β) β€ ((i.val+1 : β) : β)/(m : β) | |
| simpa only [Nat.cast_add,Nat.cast_one] using hup.le | |
| Β· refine β¨hlo, ?_β© | |
| change (t : β) < ((i.val+1 : β) : β)/(m : β) | |
| simpa only [Nat.cast_add,Nat.cast_one] using hup | |
| lemma cells_cover (m : β) [NeZero m] : (β i : Fin m, cell m i) = univ := by | |
| ext t | |
| simp only [mem_iUnion,mem_univ,iff_true] | |
| exact mem_some_cell m t | |
| lemma cell_volume (m : β) [NeZero m] (i : Fin m) : | |
| volume (cell m i) = ENNReal.ofReal (1/(m : β)) := by | |
| have he : ((boundary m i.succ : I) : β) - ((boundary m i.castSucc : I) : β) = | |
| 1/(m : β) := by simp [boundary]; ring | |
| unfold cell | |
| split_ifs | |
| Β· rw [unitInterval.volume_Icc,he] | |
| Β· rw [unitInterval.volume_Ico,he] | |
| lemma cell_diameter_bound (m : β) [NeZero m] (i : Fin m) {s t : I} | |
| (hs : s β cell m i) (ht : t β cell m i) : dist s t β€ 1/(m : β) := by | |
| rw [Subtype.dist_eq,Real.dist_eq] | |
| apply abs_le.mpr | |
| have hs0 := cell_lower m i hs | |
| have hs1 := cell_upper m i hs | |
| have ht0 := cell_lower m i ht | |
| have ht1 := cell_upper m i ht | |
| have he : ((i : β)+1)/(m : β) = (i : β)/(m : β)+1/(m : β) := by ring | |
| rw [he] at hs1 ht1 | |
| constructor <;> linarith | |
| end PlanarHalving.UniformPartition | |
| namespace PlanarHalving.UniformPartition | |
| open MeasureTheory Set Filter | |
| open scoped unitInterval Topology | |
| noncomputable def index (m : β) [NeZero m] (t : I) : Fin m := | |
| (mem_some_cell m t).choose | |
| lemma mem_cell_index (m : β) [NeZero m] (t : I) : t β cell m (index m t) := | |
| (mem_some_cell m t).choose_spec | |
| lemma index_eq (m : β) [NeZero m] (t : I) (i : Fin m) : index m t = i β t β cell m i := by | |
| constructor | |
| Β· intro h; rw [β h]; exact mem_cell_index m t | |
| Β· intro ht | |
| by_contra hne | |
| exact Set.disjoint_left.mp (cells_disjoint m hne) (mem_cell_index m t) ht | |
| lemma index_measurable (m : β) [NeZero m] : Measurable (index m) := by | |
| apply measurable_to_countable' | |
| intro i | |
| have he : (index m) β»ΒΉ' {i} = cell m i := by ext t; exact index_eq m t i | |
| rw [he] | |
| exact cell_measurable m i | |
| noncomputable def grid (m : β) [NeZero m] (t : I) : I := boundary m (index m t).castSucc | |
| lemma grid_measurable (m : β) [NeZero m] : Measurable (grid m) := | |
| (measurable_of_finite (fun i : Fin m => boundary m i.castSucc)).comp (index_measurable m) | |
| lemma dist_grid (m : β) [NeZero m] (t : I) : dist (grid m t) t β€ 1/(m : β) := by | |
| have ht := mem_cell_index m t | |
| have hl := cell_lower m (index m t) ht | |
| have hu := cell_upper m (index m t) ht | |
| rw [Subtype.dist_eq,Real.dist_eq,abs_sub_comm] | |
| change |(t : β)-(index m t : β)/(m : β)| β€ _ | |
| rw [abs_of_nonneg (sub_nonneg.mpr hl)] | |
| change (t : β)-(index m t : β)/(m : β) β€ 1/(m : β) | |
| have he : ((index m t : β)+1)/(m : β) = (index m t : β)/(m : β)+1/(m : β) := by ring | |
| rw [he] at hu | |
| linarith | |
| lemma grid_tendsto (t : I) : Tendsto (fun n : β => grid (n+1) t) atTop (π t) := by | |
| apply tendsto_iff_dist_tendsto_zero.mpr | |
| apply squeeze_zero (fun _ => dist_nonneg) (fun n => dist_grid (n+1) t) | |
| simpa only [Nat.cast_add,Nat.cast_one] using tendsto_one_div_add_atTop_nhds_zero_nat | |
| lemma grid_pair_tendsto (t : I Γ I) : | |
| Tendsto (fun n : β => (grid (n+1) t.1,grid (n+1) t.2)) atTop (π t) := | |
| (grid_tendsto t.1).prodMk_nhds (grid_tendsto t.2) | |
| lemma integral_partition {X ΞΉ : Type*} [MeasurableSpace X] [Fintype ΞΉ] | |
| (ΞΌ : Measure X) [IsFiniteMeasure ΞΌ] (C : ΞΉ β Set X) | |
| (hC : β i, MeasurableSet (C i)) | |
| (idx : X β ΞΉ) (hi : β x i, idx x = i β x β C i) (v : ΞΉ β β) : | |
| β« x, v (idx x) βΞΌ = β i, ΞΌ.real (C i)*v i := by | |
| classical | |
| have he : (fun x => v (idx x)) = fun x => β i, (C i).indicator (fun _ => v i) x := by | |
| funext x | |
| symm | |
| rw [Finset.sum_eq_single (idx x)] | |
| Β· exact Set.indicator_of_mem ((hi x (idx x)).mp rfl) _ | |
| Β· intro j _ hj | |
| rw [Set.indicator_of_notMem] | |
| intro hx | |
| exact hj ((hi x j).mpr hx).symm | |
| Β· simp | |
| rw [he,integral_finsetSum] | |
| Β· apply Finset.sum_congr rfl | |
| intro i _ | |
| rw [integral_indicator_const _ (hC i)] | |
| simp only [smul_eq_mul] | |
| Β· intro i _ | |
| exact (integrable_const (v i)).indicator (hC i) | |
| lemma integral_grid (m : β) [NeZero m] (f : I β β) : | |
| β« t, f (grid m t) = (β i : Fin m, f (boundary m i.castSucc))/(m : β) := by | |
| rw [show (fun t => f (grid m t)) = fun t => | |
| (fun i : Fin m => f (boundary m i.castSucc)) (index m t) from rfl] | |
| rw [integral_partition volume (cell m) (cell_measurable m) | |
| (index m) (index_eq m) (fun i : Fin m => f (boundary m i.castSucc))] | |
| simp only [measureReal_def,cell_volume,ENNReal.toReal_ofReal (by positivity : 0 β€ 1/(m : β))] | |
| rw [β Finset.mul_sum] | |
| ring | |
| lemma integral_grid_pair (m : β) [NeZero m] (f : I Γ I β β) : | |
| β« t : I Γ I, f (grid m t.1,grid m t.2) = | |
| (β i : Fin m Γ Fin m, f (boundary m i.1.castSucc,boundary m i.2.castSucc))/(m : β)^2 := by | |
| let C : Fin m Γ Fin m β Set (I Γ I) := fun i => cell m i.1 ΓΛ’ cell m i.2 | |
| have hC i : MeasurableSet (C i) := (cell_measurable m i.1).prod (cell_measurable m i.2) | |
| let idx : I Γ I β Fin m Γ Fin m := fun t => (index m t.1,index m t.2) | |
| have hi t i : idx t = i β t β C i := by | |
| rcases i with β¨i,jβ© | |
| simp only [idx,C,Prod.mk.injEq,index_eq,mem_prod] | |
| change β« t, (fun i : Fin m Γ Fin m => f (boundary m i.1.castSucc,boundary m i.2.castSucc)) (idx t) = _ | |
| rw [integral_partition volume C hC idx hi (fun i => f (boundary m i.1.castSucc,boundary m i.2.castSucc))] | |
| have hv i : volume.real (C i) = 1/(m : β)^2 := by | |
| rw [measureReal_def] | |
| change ((volume.prod volume) (cell m i.1 ΓΛ’ cell m i.2)).toReal = _ | |
| rw [Measure.prod_prod,cell_volume,cell_volume,ENNReal.toReal_mul, | |
| ENNReal.toReal_ofReal (by positivity : 0 β€ 1/(m : β))] | |
| ring | |
| simp_rw [hv] | |
| rw [β Finset.mul_sum] | |
| ring | |
| end PlanarHalving.UniformPartition | |
| namespace PlanarHalving.UniformPartition | |
| open MeasureTheory Set Filter BoundedContinuousFunction | |
| open scoped unitInterval Topology | |
| lemma grid_tendsto_seq (m : β β β) [β n, NeZero (m n)] (hm : Tendsto m atTop atTop) (t : I) : | |
| Tendsto (fun n => grid (m n) t) atTop (π t) := by | |
| apply tendsto_iff_dist_tendsto_zero.mpr | |
| apply squeeze_zero (fun _ => dist_nonneg) (fun n => dist_grid (m n) t) | |
| have hnat : Tendsto (fun n => (m n : β)) atTop atTop := tendsto_natCast_atTop_atTop.comp hm | |
| simpa only [one_div, Function.comp_def] using tendsto_inv_atTop_zero.comp hnat | |
| lemma riemann_tendsto (m : β β β) [β n, NeZero (m n)] (hm : Tendsto m atTop atTop) | |
| (f : BoundedContinuousFunction (I Γ I) β) : | |
| Tendsto (fun n => (β i : Fin (m n) Γ Fin (m n), | |
| f (boundary (m n) i.1.castSucc,boundary (m n) i.2.castSucc))/(m n : β)^2) | |
| atTop (π (β« t : I Γ I, f t)) := by | |
| simp_rw [β integral_grid_pair] | |
| apply tendsto_integral_of_dominated_convergence (fun _ : I Γ I => βfβ) | |
| Β· intro n | |
| exact (f.continuous.measurable.comp | |
| (((grid_measurable (m n)).comp measurable_fst).prodMk | |
| ((grid_measurable (m n)).comp measurable_snd))).aestronglyMeasurable | |
| Β· exact integrable_const _ | |
| Β· intro n | |
| exact Filter.Eventually.of_forall (fun _ => f.norm_coe_le_norm _) | |
| Β· exact Filter.Eventually.of_forall (fun t => (f.continuous.tendsto t).comp | |
| ((grid_tendsto_seq m hm t.1).prodMk_nhds (grid_tendsto_seq m hm t.2))) | |
| end PlanarHalving.UniformPartition | |
| namespace PlanarHalving.Limits | |
| open MeasureTheory Set Filter BoundedContinuousFunction | |
| open scoped Topology | |
| lemma measure_le_of_test {X : Type*} [MetricSpace X] [CompactSpace X] | |
| [MeasurableSpace X] [BorelSpace X] (ΞΌ Ξ½ : FiniteMeasure X) | |
| (h : β f : BoundedContinuousFunction X β, (β x, 0 β€ f x) β β« x, f x β(ΞΌ : Measure X) β€ β« x, f x β(Ξ½ : Measure X)) : | |
| (ΞΌ : Measure X) β€ (Ξ½ : Measure X) := by | |
| have hn (f : BoundedContinuousFunction X NNReal) : β«β» x, f x β(ΞΌ : Measure X) β€ β«β» x, f x β(Ξ½ : Measure X) := by | |
| let g : BoundedContinuousFunction X β := β¨β¨fun x => (f x : β), continuous_subtype_val.comp f.continuousβ©,f.map_bounded'β© | |
| apply (ENNReal.toReal_le_toReal (f.lintegral_lt_top_of_nnreal _).ne | |
| (f.lintegral_lt_top_of_nnreal _).ne).mp | |
| rw [toReal_lintegral_coe_eq_integral f ΞΌ,toReal_lintegral_coe_eq_integral f Ξ½] | |
| exact h g (fun x => NNReal.coe_nonneg _) | |
| have hclosed (F : Set X) (hF : IsClosed F) : (ΞΌ : Measure X) F β€ (Ξ½ : Measure X) F := by | |
| exact le_of_tendsto_of_tendsto (HasOuterApproxClosed.tendsto_lintegral_apprSeq hF (ΞΌ : Measure X)) | |
| (HasOuterApproxClosed.tendsto_lintegral_apprSeq hF (Ξ½ : Measure X)) (Filter.Eventually.of_forall (fun n => hn (hF.apprSeq n))) | |
| apply Measure.le_iff.mpr | |
| intro F hF | |
| rw [hF.measure_eq_iSup_isCompact (ΞΌ : Measure X)] | |
| exact iSup_le (fun K => iSup_le (fun hKF => iSup_le (fun hK => | |
| (hclosed K hK.isClosed).trans (measure_mono hKF)))) | |
| end PlanarHalving.Limits | |
| namespace PlanarHalving.Limits | |
| open MeasureTheory Set Filter | |
| open scoped Topology unitInterval NNReal ENNReal | |
| noncomputable def weightedAtoms {X : Type*} [MeasurableSpace X] {Ξ± : Type*} [Fintype Ξ±] | |
| (w : ββ₯0) (x : Ξ± β X) : FiniteMeasure X := | |
| β¨w β’ (β i, Measure.dirac (x i) : Measure X), inferInstanceβ© | |
| lemma integral_weightedAtoms {X : Type*} [MeasurableSpace X] [MeasurableSingletonClass X] | |
| {Ξ± : Type*} [Fintype Ξ±] (w : ββ₯0) (x : Ξ± β X) (f : X β β) : | |
| β« t, f t β(weightedAtoms w x : Measure X) = (w : β) * β i, f (x i) := by | |
| classical | |
| change β« t, f t β((w : ββ₯0β) β’ β i, Measure.dirac (x i)) = _ | |
| rw [integral_smul_measure,integral_finsetSum_measure] | |
| Β· simp only [integral_dirac,ENNReal.coe_toReal,smul_eq_mul] | |
| Β· intro i _ | |
| exact integrable_dirac (by simp) | |
| lemma mass_weightedAtoms {X : Type*} [MeasurableSpace X] {Ξ± : Type*} [Fintype Ξ±] | |
| (w : ββ₯0) (x : Ξ± β X) : | |
| (weightedAtoms w x).mass = w * Fintype.card Ξ± := by | |
| classical | |
| simp [weightedAtoms,FiniteMeasure.mass,FiniteMeasure.mk_apply,Measure.smul_apply, | |
| Measure.finsetSum_apply] | |
| end PlanarHalving.Limits | |
| namespace PlanarHalving.UniformPartition | |
| open MeasureTheory Set Filter PlanarHalving.Limits | |
| open scoped Topology unitInterval NNReal ENNReal | |
| noncomputable def gridPoint (m : β) [NeZero m] (i : Fin m Γ Fin m) : I Γ I := | |
| (boundary m i.1.castSucc,boundary m i.2.castSucc) | |
| lemma grid_sum_le {m c : β} [NeZero m] (slots : Fin c β Fin m Γ Fin m) | |
| (hs : Function.Injective slots) (f : I Γ I β β) (hf : β t, 0 β€ f t) : | |
| (β i, f (gridPoint m (slots i))) β€ β j, f (gridPoint m j) := by | |
| classical | |
| rw [β Finset.sum_image (f := fun j => f (gridPoint m j)) hs.injOn] | |
| exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) (fun i _ _ => hf _) | |
| lemma normalized_perturbed_sum_le {m c : β} [NeZero m] | |
| (slots : Fin c β Fin m Γ Fin m) (hs : Function.Injective slots) | |
| (x : Fin c β I Γ I) (f : I Γ I β β) (hf : β t, 0 β€ f t) | |
| {Ξ΅ : β} (hΞ΅ : 0 β€ Ξ΅) (hclose : β i, f (x i) β€ f (gridPoint m (slots i)) + Ξ΅) : | |
| (β i, f (x i))/(m : β)^2 β€ | |
| (β j : Fin m Γ Fin m, f (gridPoint m j))/(m : β)^2 + Ξ΅ := by | |
| have hm : 0 < (m : β) := by exact_mod_cast NeZero.pos m | |
| have hc : (c : β) β€ (m : β)^2 := by | |
| have h := Fintype.card_le_of_injective slots hs | |
| simp only [Fintype.card_fin,Fintype.card_prod] at h | |
| simpa only [pow_two] using (show (c : β) β€ (m : β)*(m : β) by exact_mod_cast h) | |
| have hsum : (β i, f (x i)) β€ (β j : Fin m Γ Fin m, f (gridPoint m j)) + (c : β)*Ξ΅ := by | |
| calc | |
| _ β€ β i, (f (gridPoint m (slots i)) + Ξ΅) := Finset.sum_le_sum (fun i _ => hclose i) | |
| _ = (β i, f (gridPoint m (slots i))) + (c : β)*Ξ΅ := by simp [Finset.sum_add_distrib] | |
| _ β€ _ := add_le_add (grid_sum_le slots hs f hf) le_rfl | |
| have hΞ΅c : (c : β)*Ξ΅ β€ (m : β)^2*Ξ΅ := mul_le_mul_of_nonneg_right hc hΞ΅ | |
| apply (div_le_iffβ (sq_pos_of_pos hm)).mpr | |
| nlinarith [div_mul_cancelβ (β j : Fin m Γ Fin m, f (gridPoint m j)) (ne_of_gt (sq_pos_of_pos hm))] | |
| lemma perturbed_grid_limit_le_volume (m c : β β β) [β n, NeZero (m n)] | |
| (hm : Tendsto m atTop atTop) (x : β n, Fin (c n) β I Γ I) | |
| (slots : β n, Fin (c n) β Fin (m n) Γ Fin (m n)) | |
| (hs : β n, Function.Injective (slots n)) | |
| (d : β β β) (hd : Tendsto d atTop (π 0)) | |
| (hclose : β n i, dist (x n i) (gridPoint (m n) (slots n i)) β€ d n) | |
| (ΞΌ : FiniteMeasure (I Γ I)) | |
| (hΞΌ : Tendsto (fun n => weightedAtoms ((m n : ββ₯0)^2)β»ΒΉ (x n)) atTop (π ΞΌ)) : | |
| (ΞΌ : Measure (I Γ I)) β€ volume := by | |
| let Ξ½ : FiniteMeasure (I Γ I) := β¨volume,inferInstanceβ© | |
| apply measure_le_of_test ΞΌ Ξ½ | |
| intro f hf | |
| apply le_of_forall_pos_le_add | |
| intro Ξ΅ hΞ΅ | |
| obtain β¨Ξ΄,hΞ΄,hfΞ΄β© := Metric.uniformContinuous_iff.mp | |
| (CompactSpace.uniformContinuous_of_continuous f.continuous) Ξ΅ hΞ΅ | |
| have hdΞ΄ : βαΆ n in atTop, d n < Ξ΄ := (tendsto_order.mp hd).2 Ξ΄ hΞ΄ | |
| have hineq : βαΆ n in atTop, | |
| β« t, f t β(weightedAtoms ((m n : ββ₯0)^2)β»ΒΉ (x n) : Measure (I Γ I)) β€ | |
| (β j : Fin (m n) Γ Fin (m n), f (gridPoint (m n) j))/(m n : β)^2 + Ξ΅ := by | |
| filter_upwards [hdΞ΄] with n hn | |
| rw [integral_weightedAtoms] | |
| simp only [NNReal.coe_inv,NNReal.coe_pow,NNReal.coe_natCast] | |
| rw [β div_eq_inv_mul] | |
| apply normalized_perturbed_sum_le (slots n) (hs n) (x n) f hf hΞ΅.le | |
| intro i | |
| have h := hfΞ΄ ((hclose n i).trans_lt hn) | |
| rw [Real.dist_eq,abs_lt] at h | |
| linarith [h.2] | |
| have hlim := (FiniteMeasure.tendsto_iff_forall_integral_tendsto.mp hΞΌ) f | |
| have hgrid := (riemann_tendsto m hm f).add_const Ξ΅ | |
| apply le_of_tendsto_of_tendsto hlim hgrid | |
| filter_upwards [hineq] with n hn | |
| exact hn | |
| end PlanarHalving.UniformPartition | |
| end OAI | |