Download data/lean/OAI/Geometry/PeriodicTiling/DirectionalLimits.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 12 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PeriodicTiling/DirectionalLimits.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Geometry/PeriodicTiling/DirectionalLimits.lean
-
curl -L -o DirectionalLimits.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Geometry/PeriodicTiling/DirectionalLimits.lean
12 kB
| import OAI.Geometry.PeriodicTiling.TileDilation | |
| import OAI.Geometry.PeriodicTiling.PlaneLattices | |
| import Mathlib.Algebra.BigOperators.Field | |
| import Mathlib.Algebra.Ring.Periodic | |
| import Mathlib.Analysis.SpecificLimits.Basic | |
| import Mathlib.Data.Fintype.EquivFin | |
| import Mathlib.Topology.Bases | |
| import Mathlib.Topology.Compactness.Compact | |
| import Mathlib.Topology.Order.Compact | |
| import Mathlib.Topology.Sequences | |
| import Mathlib.Tactic.Abel | |
| import Mathlib.Tactic.FieldSimp | |
| import Mathlib.Tactic.Linarith | |
| import Mathlib.Tactic.Positivity | |
| import Mathlib.Tactic.Ring | |
| namespace OAI | |
| universe uΞΉ | |
| noncomputable section | |
| namespace PeriodicTilingThree | |
| open Set Filter | |
| open scoped BigOperators Topology | |
| def directionalAverage (a : Plane β β) (q : β) (v : Plane) (N : β) (x : Plane) : β := | |
| (β k β Finset.range (N + 1), a (x - (1 + q * (k + 1)) β’ v)) / (N + 1 : β) | |
| theorem directionalAverage_nonneg {a : Plane β β} (ha : β x, 0 β€ a x) | |
| (q : β) (v : Plane) (N : β) (x : Plane) : | |
| 0 β€ directionalAverage a q v N x := by | |
| unfold directionalAverage | |
| exact div_nonneg (Finset.sum_nonneg fun k _ => ha _) (by positivity) | |
| theorem directionalAverage_le_one {a : Plane β β} (ha : β x, a x β€ 1) | |
| (q : β) (v : Plane) (N : β) (x : Plane) : | |
| directionalAverage a q v N x β€ 1 := by | |
| have hN : (0 : β) < (N + 1 : β) := by positivity | |
| apply (div_le_iffβ hN).2 | |
| calc | |
| _ β€ β _k β Finset.range (N + 1), (1 : β) := | |
| Finset.sum_le_sum fun k _ => ha _ | |
| _ = _ := by simp | |
| theorem directionalAverage_translate_sub (a : Plane β β) (q : β) | |
| (v : Plane) (N : β) (x : Plane) : | |
| directionalAverage a q v N (x + q β’ v) - directionalAverage a q v N x = | |
| (a (x - v) - a (x - (1 + q * (N + 1)) β’ v)) / (N + 1 : β) := by | |
| have hshift (k : β) : | |
| x + q β’ v - (1 + q * (k + 1)) β’ v = x - (1 + q * k) β’ v := by | |
| have hk : 1 + q * (k + 1) = (1 + q * k) + q := by ring | |
| rw [hk, add_nsmul] | |
| abel | |
| unfold directionalAverage | |
| simp_rw [hshift] | |
| rw [β sub_div, β Finset.sum_sub_distrib] | |
| congr 1 | |
| simpa only [Nat.mul_zero, Nat.add_zero, one_nsmul] using | |
| Finset.sum_range_sub' (fun k => a (x - (1 + q * k) β’ v)) (N + 1) | |
| theorem directionalAverage_translate_error {a : Plane β β} | |
| (ha0 : β x, 0 β€ a x) (ha1 : β x, a x β€ 1) | |
| (q : β) (v : Plane) (N : β) (x : Plane) : | |
| |directionalAverage a q v N (x + q β’ v) - directionalAverage a q v N x| β€ | |
| 1 / (N + 1 : β) := by | |
| rw [directionalAverage_translate_sub, abs_div, | |
| abs_of_pos (show (0 : β) < (N + 1 : β) by positivity)] | |
| apply div_le_div_of_nonneg_right _ (by positivity) | |
| apply abs_le.mpr | |
| constructor <;> linarith [ha0 (x - v), ha1 (x - v), | |
| ha0 (x - (1 + q * (N + 1)) β’ v), ha1 (x - (1 + q * (N + 1)) β’ v)] | |
| theorem sum_directionalAverage {F : Finset Plane} (h0 : (0 : Plane) β F) | |
| {a : Plane β β} {q : β} | |
| (hD : β (k : β) (x : Plane), β f β F, a (x - (1 + q * k) β’ f) = 1) | |
| (N : β) (x : Plane) : | |
| (β f β F.erase 0, directionalAverage a q f N x) = 1 - a x := by | |
| classical | |
| have hs (k : β) : | |
| (β f β F.erase 0, a (x - (1 + q * (k + 1)) β’ f)) = 1 - a x := by | |
| have he := Finset.sum_erase_add F | |
| (fun f => a (x - (1 + q * (k + 1)) β’ f)) h0 | |
| rw [hD (k + 1) x] at he | |
| simpa only [smul_zero, sub_zero] using (eq_sub_iff_add_eq.mpr he) | |
| unfold directionalAverage | |
| rw [β Finset.sum_div, Finset.sum_comm] | |
| simp_rw [hs] | |
| simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul] | |
| exact mul_div_cancel_leftβ (1 - a x) (by positivity) | |
| theorem exists_common_directional_subsequence {ΞΉ : Type uΞΉ} [Countable ΞΉ] | |
| (u : β β ΞΉ β Plane β β) | |
| (hu0 : β N i x, 0 β€ u N i x) (hu1 : β N i x, u N i x β€ 1) : | |
| β (Ο : ΞΉ β Plane β β) (Ο : β β β), StrictMono Ο β§ | |
| (β i x, 0 β€ Ο i x β§ Ο i x β€ 1) β§ | |
| β i x, Tendsto (fun N => u (Ο N) i x) atTop (π (Ο i x)) := by | |
| let u' : β β ((ΞΉ Γ Plane) β Set.Icc (0 : β) 1) := | |
| fun N ix => β¨u N ix.1 ix.2, hu0 N ix.1 ix.2, hu1 N ix.1 ix.2β© | |
| obtain β¨l, Ο, hΟ, hlβ© := CompactSpace.tendsto_subseq u' | |
| refine β¨fun i x => (l (i, x) : β), Ο, hΟ, ?_, ?_β© | |
| Β· intro i x | |
| exact (l (i, x)).property | |
| Β· intro i x | |
| exact ((continuous_subtype_val.comp (continuous_apply (i, x))).tendsto l).comp hl | |
| theorem exists_ungrouped_directional_limits {F : Finset Plane} (h0 : (0 : Plane) β F) | |
| {a : Plane β β} (ha0 : β x, 0 β€ a x) (ha1 : β x, a x β€ 1) | |
| {q : β} | |
| (hD : β (k : β) (x : Plane), β f β F, a (x - (1 + q * k) β’ f) = 1) : | |
| β Ο : β₯(F.erase 0) β Plane β β, | |
| (β f x, 0 β€ Ο f x β§ Ο f x β€ 1) β§ | |
| (β x, a x + β f, Ο f x = 1) β§ | |
| β f, Function.Periodic (Ο f) (q β’ (f : Plane)) := by | |
| classical | |
| obtain β¨Ο, Ο, hΟ, hΟ, hlimβ© := exists_common_directional_subsequence | |
| (fun N (f : β₯(F.erase 0)) x => directionalAverage a q f N x) | |
| (fun N f x => directionalAverage_nonneg ha0 q f N x) | |
| (fun N f x => directionalAverage_le_one ha1 q f N x) | |
| refine β¨Ο, hΟ, ?_, ?_β© | |
| Β· intro x | |
| have hsum := tendsto_finsetSum Finset.univ (fun (f : β₯(F.erase 0)) _ => hlim f x) | |
| have havg (N : β) : | |
| (β f : β₯(F.erase 0), directionalAverage a q f (Ο N) x) = 1 - a x := by | |
| exact (Finset.sum_coe_sort (F.erase 0) | |
| (fun f : Plane => directionalAverage a q f (Ο N) x)).trans | |
| (sum_directionalAverage h0 hD (Ο N) x) | |
| have heq : (β f, Ο f x) = 1 - a x := | |
| tendsto_nhds_unique hsum (by simpa only [havg] using | |
| (tendsto_const_nhds : Tendsto (fun _ : β => 1 - a x) atTop (π (1 - a x)))) | |
| linarith | |
| Β· intro f x | |
| have herr := (hlim f (x + q β’ (f : Plane))).sub (hlim f x) | |
| have hbound : Tendsto (fun N : β => (1 : β) / (Ο N + 1 : β)) atTop (π 0) := | |
| (tendsto_one_div_atTop_nhds_zero_nat.comp (tendsto_add_atTop_nat 1)).comp | |
| hΟ.tendsto_atTop | |
| have hz := squeeze_zero (fun N => abs_nonneg | |
| (directionalAverage a q f (Ο N) (x + q β’ (f : Plane)) - | |
| directionalAverage a q f (Ο N) x)) | |
| (fun N => directionalAverage_translate_error ha0 ha1 q f (Ο N) x) hbound | |
| have heq : |Ο f (x + q β’ (f : Plane)) - Ο f x| = 0 := | |
| tendsto_nhds_unique herr.abs hz | |
| exact sub_eq_zero.mp (abs_eq_zero.mp heq) | |
| theorem Tiles.exists_ungrouped_directional_limits {F : Finset Plane} {A : Set Plane} | |
| (h : Tiles F A) (h0 : (0 : Plane) β F) : | |
| β Ο : β₯(F.erase 0) β Plane β β, | |
| (β f x, 0 β€ Ο f x β§ Ο f x β€ 1) β§ | |
| (β x, tileIndicator β A x + β f, Ο f x = 1) β§ | |
| β f, Function.Periodic (Ο f) (F.card.factorial β’ (f : Plane)) := by | |
| exact PeriodicTilingThree.exists_ungrouped_directional_limits h0 | |
| (fun x => tileIndicator_nonneg A x) (fun x => tileIndicator_le_one A x) | |
| (fun k x => h.sum_tileIndicator_dilate_factorial k x) | |
| theorem exists_grouped_directional_functions {ΞΉ : Type uΞΉ} [Fintype ΞΉ] | |
| (v : ΞΉ β Plane) (hv : β i, v i β 0) (Ο : ΞΉ β Plane β β) | |
| (hΟ : β i x, 0 β€ Ο i x) (hp : β i, Function.Periodic (Ο i) (v i)) | |
| {a : Plane β β} (ha : β x, 0 β€ a x) | |
| (hsum : β x, a x + β i, Ο i x = 1) : | |
| β (m : β) (w : Fin m β Plane) (Ο : Fin m β Plane β β), | |
| (β j, w j β 0) β§ | |
| (β i j, i β j β planeDet (w i) (w j) β 0) β§ | |
| (β j x, 0 β€ Ο j x β§ Ο j x β€ 1) β§ | |
| (β x, a x + β j, Ο j x = 1) β§ | |
| β j, Function.Periodic (Ο j) (w j) := by | |
| classical | |
| let r : Setoid ΞΉ := | |
| { r := fun i j => planeDet (v i) (v j) = 0 | |
| iseqv := β¨fun i => planeDet_self (v i), | |
| fun {i j} hij => by rw [planeDet_swap, hij, neg_zero], | |
| fun {i j k} hij hjk => planeDet_zero_trans (hv j) hij hjkβ© } | |
| let Q := Quotient r | |
| let : Fintype Q := Fintype.ofFinite Q | |
| let cls : ΞΉ β Q := Quotient.mk r | |
| let fiber (j : Q) : Finset ΞΉ := Finset.univ.filter (fun i => cls i = j) | |
| have mem_fiber (i : ΞΉ) (j : Q) : i β fiber j β cls i = j := by | |
| simp [fiber] | |
| have out_mem (j : Q) : j.out β fiber j := | |
| (mem_fiber _ _).2 (Quotient.out_eq j) | |
| have hex (j : Q) : β w : Plane, w β 0 β§ β i β fiber j, β n : β€, w = n β’ v i := by | |
| have himage : ((fiber j).image v).Nonempty := | |
| β¨v j.out, Finset.mem_image_of_mem v (out_mem j)β© | |
| obtain β¨w, hw, hmβ© := exists_common_collinear_multiple ((fiber j).image v) himage | |
| (by | |
| intro z hz | |
| obtain β¨i, _, rflβ© := Finset.mem_image.mp hz | |
| exact hv i) | |
| (by | |
| intro z hz z' hz' | |
| obtain β¨i, hi, rflβ© := Finset.mem_image.mp hz | |
| obtain β¨i', hi', rflβ© := Finset.mem_image.mp hz' | |
| exact Quotient.exact (((mem_fiber i j).1 hi).trans ((mem_fiber i' j).1 hi').symm)) | |
| exact β¨w, hw, fun i hi => hm (v i) (Finset.mem_image_of_mem v hi)β© | |
| choose w hw hm using hex | |
| let Ο : Q β Plane β β := fun j x => β i β fiber j, Ο i x | |
| have hΟ (j : Q) (x : Plane) : 0 β€ Ο j x := | |
| Finset.sum_nonneg (fun i _ => hΟ i x) | |
| have htotal (x : Plane) : (β j, Ο j x) = β i, Ο i x := by | |
| simp only [Ο, fiber, Finset.sum_filter] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| rw [Finset.sum_eq_single (cls i)] | |
| Β· simp only [ite_true] | |
| Β· intro j _ hji | |
| exact ite_eq_right (Ne.symm hji) | |
| Β· intro hi | |
| exact False.elim (hi (Finset.mem_univ _)) | |
| have hΟone (j : Q) (x : Plane) : Ο j x β€ 1 := by | |
| have hj : Ο j x β€ β j', Ο j' x := | |
| Finset.single_le_sum (fun j' _ => hΟ j' x) (Finset.mem_univ j) | |
| rw [htotal] at hj | |
| linarith [hsum x, ha x] | |
| have hper (j : Q) : Function.Periodic (Ο j) (w j) := by | |
| intro x | |
| apply Finset.sum_congr rfl | |
| intro i hi | |
| obtain β¨n, hnβ© := hm j i hi | |
| rw [hn] | |
| exact (hp i).zsmul n x | |
| have hpair (j k : Q) (hjk : j β k) : planeDet (w j) (w k) β 0 := by | |
| intro hdet | |
| obtain β¨n, hnβ© := hm j j.out (out_mem j) | |
| obtain β¨m, hmkβ© := hm k k.out (out_mem k) | |
| have hn0 : n β 0 := by | |
| intro hn0 | |
| exact hw j (by simpa [hn0] using hn) | |
| have hm0 : m β 0 := by | |
| intro hm0 | |
| exact hw k (by simpa [hm0] using hmk) | |
| rw [hn, hmk, planeDet_zsmul_left, planeDet_zsmul_right] at hdet | |
| have hz : planeDet (v j.out) (v k.out) = 0 := | |
| (mul_eq_zero.mp ((mul_eq_zero.mp hdet).resolve_left hn0)).resolve_left hm0 | |
| apply hjk | |
| calc | |
| j = cls j.out := (Quotient.out_eq j).symm | |
| _ = cls k.out := Quotient.sound hz | |
| _ = k := Quotient.out_eq k | |
| let e : Fin (Fintype.card Q) β Q := (Fintype.equivFin Q).symm | |
| refine β¨Fintype.card Q, fun j => w (e j), fun j => Ο (e j), | |
| fun j => hw (e j), ?_, ?_, ?_, fun j => hper (e j)β© | |
| Β· intro i j hij | |
| exact hpair (e i) (e j) (fun he => hij (e.injective he)) | |
| Β· intro j x | |
| exact β¨hΟ (e j) x, hΟone (e j) xβ© | |
| Β· intro x | |
| rw [e.sum_comp (fun j => Ο j x), htotal] | |
| exact hsum x | |
| theorem Tiles.exists_directional_decomposition {F : Finset Plane} {A : Set Plane} | |
| (h : Tiles F A) (h0 : (0 : Plane) β F) : | |
| β (m : β) (v : Fin m β Plane) (Ο : Fin m β Plane β β), | |
| (β j, v j β 0) β§ | |
| (β i j, i β j β planeDet (v i) (v j) β 0) β§ | |
| (β j x, 0 β€ Ο j x β§ Ο j x β€ 1) β§ | |
| (β x, tileIndicator β A x + β j, Ο j x = 1) β§ | |
| β j, Function.Periodic (Ο j) (v j) := by | |
| classical | |
| obtain β¨Ο, hΟ, hsum, hpβ© := h.exists_ungrouped_directional_limits h0 | |
| apply exists_grouped_directional_functions | |
| (fun f : β₯(F.erase 0) => F.card.factorial β’ (f : Plane)) _ Ο | |
| (fun f x => (hΟ f x).1) hp (fun x => tileIndicator_nonneg A x) hsum | |
| intro f | |
| have hq : (F.card.factorial : β€) β 0 := by | |
| exact_mod_cast Nat.factorial_ne_zero F.card | |
| simpa only [natCast_zsmul] using | |
| zsmul_plane_ne_zero hq (Finset.mem_erase.mp f.property).1 | |
| end PeriodicTilingThree | |
| end | |
| end OAI | |