Download data/lean/OAI/Probability/LatticeSurface/Coercivity/GridTraceKernel.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.96 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/LatticeSurface/Coercivity/GridTraceKernel.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/LatticeSurface/Coercivity/GridTraceKernel.lean
-
curl -L -o GridTraceKernel.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/LatticeSurface/Coercivity/GridTraceKernel.lean
5.96 kB
| import Mathlib | |
| import OAI.Probability.LatticeSurface.Coercivity.GridTrace | |
| import OAI.Probability.LatticeSurface.Coercivity.GridTraceGeometry | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace GridTrace.NatGrid | |
| def distβ (x y : Vertex) : β := |(x.1:β)-y.1|+|(x.2:β)-y.2| | |
| def ball (N : β) (x : Vertex) (r : β) : Finset Vertex := | |
| (square N).filter (fun y => distβ x y β€ r) | |
| def localKernel (N : β) (Ξ½ : Vertex β β) (s : β) (e : Edge) : β := | |
| (4/(s:β)) * β x β square N, | |
| if e β edges (lo x (2*s-1)) (hi N x (2*s-1)) then Ξ½ x else 0 | |
| lemma local_mem_dist {N r : β} {x : Vertex} {e : Edge} | |
| (he : e β edges (lo x r) (hi N x r)) : distβ (anchor e) x β€ 2*r := by | |
| have h := mem_box_iff.mp (anchor_mem_rect he) | |
| have h1 : |((anchor e).1:β)-x.1| β€ r := by | |
| rw [abs_le] | |
| constructor <;> linarith [show ((anchor e).1:β) β€ x.1+r by exact_mod_cast h.2.2.1, | |
| show (x.1:β) β€ (anchor e).1+r by exact_mod_cast h.2.2.2.1] | |
| have h2 : |((anchor e).2:β)-x.2| β€ r := by | |
| rw [abs_le] | |
| constructor <;> linarith [show ((anchor e).2:β) β€ x.2+r by exact_mod_cast h.2.2.2.2.1, | |
| show (x.2:β) β€ (anchor e).2+r by exact_mod_cast h.2.2.2.2.2] | |
| exact (add_le_add h1 h2).trans_eq (by ring) | |
| lemma square_dist {N : β} {x y : Vertex} (hx : x β square N) (hy : y β square N) : | |
| distβ x y β€ 2*N := by | |
| have hx := square_mem.mp hx | |
| have hy := square_mem.mp hy | |
| have h1 : |(x.1:β)-y.1| β€ N := by | |
| rw [abs_le] | |
| have hx : (x.1:β) β€ N := by exact_mod_cast hx.1 | |
| have hy : (y.1:β) β€ N := by exact_mod_cast hy.1 | |
| constructor <;> linarith [Nat.cast_nonneg (Ξ± := β) x.1,Nat.cast_nonneg (Ξ± := β) y.1] | |
| have h2 : |(x.2:β)-y.2| β€ N := by | |
| rw [abs_le] | |
| have hx : (x.2:β) β€ N := by exact_mod_cast hx.2 | |
| have hy : (y.2:β) β€ N := by exact_mod_cast hy.2 | |
| constructor <;> linarith [Nat.cast_nonneg (Ξ± := β) x.2,Nat.cast_nonneg (Ξ± := β) y.2] | |
| exact (add_le_add h1 h2).trans_eq (by ring) | |
| lemma localKernel_nonneg {N s : β} {Ξ½ : Vertex β β} | |
| (hΞ½ : β x β square N, 0 β€ Ξ½ x) (e : Edge) : 0 β€ localKernel N Ξ½ s e := by | |
| apply mul_nonneg (by positivity) | |
| exact Finset.sum_nonneg (fun x hx => by split_ifs <;> simp [hΞ½ x hx]) | |
| lemma localKernel_sup {N s : β} (hN : 1 β€ N) (hs : 1 β€ s) {Ξ½ : Vertex β β} {Ξ± C : β} | |
| (hΞ± : 0 β€ Ξ±) (hC : 0 β€ C) (hΞ½ : β x β square N, 0 β€ Ξ½ x) | |
| (hspread : β x β square N, β r : β, 0 β€ r β r β€ 2*(N:β) β | |
| (β y β ball N x r, Ξ½ y) β€ C*((r+1)/(N:β))^Ξ±) | |
| {e : Edge} (he : e β edges (0,0) (N,N)) : | |
| localKernel N Ξ½ s e β€ (4/(s:β))*C*((5*s)/(N:β))^Ξ± := by | |
| have hanc : anchor e β square N := anchor_mem_rect he | |
| have hnp : (0:β) < N := by exact_mod_cast hN | |
| have hn : (0:β) β€ N := hnp.le | |
| have hs1 : (1:β) β€ s := by exact_mod_cast hs | |
| let R : β := min (4*s) (2*N) | |
| have hr : 0 β€ R := le_min (by positivity) (by positivity) | |
| have hrN : R β€ 2*N := min_le_right _ _ | |
| have hsum : (β x β square N, if e β edges (lo x (2*s-1)) (hi N x (2*s-1)) then Ξ½ x else 0) β€ | |
| β x β ball N (anchor e) R, Ξ½ x := by | |
| rw [ball,Finset.sum_filter] | |
| apply Finset.sum_le_sum | |
| intro x hx | |
| by_cases hm : e β edges (lo x (2*s-1)) (hi N x (2*s-1)) | |
| Β· have hd := local_mem_dist hm | |
| have dd : (2*(2*s-1):β) β€ 4*s := by omega | |
| have hd4 : distβ (anchor e) x β€ 4*s := hd.trans (by exact_mod_cast dd) | |
| have hdR : distβ (anchor e) x β€ R := le_min hd4 (square_dist hanc hx) | |
| simp [hm,hdR] | |
| Β· simp only [ite_eq_right hm] | |
| split_ifs <;> simp [hΞ½ x hx] | |
| calc | |
| _ β€ (4/(s:β))*(β x β ball N (anchor e) R, Ξ½ x) := mul_le_mul_of_nonneg_left hsum (by positivity) | |
| _ β€ (4/(s:β))*(C*((R+1)/(N:β))^Ξ±) := | |
| mul_le_mul_of_nonneg_left (hspread (anchor e) hanc R hr hrN) (by positivity) | |
| _ β€ (4/(s:β))*C*((5*s)/(N:β))^Ξ± := by | |
| rw [mul_assoc] | |
| apply mul_le_mul_of_nonneg_left _ (by positivity) | |
| apply mul_le_mul_of_nonneg_left _ hC | |
| apply Real.rpow_le_rpow (by positivity) _ hΞ± | |
| exact div_le_div_of_nonneg_right (by have := min_le_left (4*(s:β)) (2*N);dsimp [R];linarith) hn | |
| lemma localKernel_sum {N s : β} (hs : 1 β€ s) {Ξ½ : Vertex β β} {C : β} | |
| (hΞ½ : β x β square N, 0 β€ Ξ½ x) (hmass : (β x β square N, Ξ½ x) β€ C) : | |
| (β e β edges (0,0) (N,N), localKernel N Ξ½ s e) β€ 128*C*s := by | |
| have hsp : (0:β) < s := by exact_mod_cast hs | |
| have hcards (x : Vertex) : ((edges (lo x (2*s-1)) (hi N x (2*s-1))).card:β) β€ 32*(s:β)^2 := by | |
| have h := edges_card_bound N x (2*s-1) | |
| have ha : 2*(2*s-1)+1 β€ 4*s := by omega | |
| have hb : 2*(2*(2*s-1)+1)^2 β€ 32*s^2 := by nlinarith [Nat.pow_le_pow_left ha 2] | |
| exact_mod_cast h.trans hb | |
| have hid (x : Vertex) : (β e β edges (0,0) (N,N), | |
| if e β edges (lo x (2*s-1)) (hi N x (2*s-1)) then Ξ½ x else 0) = | |
| (edges (lo x (2*s-1)) (hi N x (2*s-1))).card*Ξ½ x := by | |
| rw [β Finset.sum_filter] | |
| have hf : (edges (0,0) (N,N)).filter | |
| (fun e => e β edges (lo x (2*s-1)) (hi N x (2*s-1))) = | |
| edges (lo x (2*s-1)) (hi N x (2*s-1)) := by | |
| ext e | |
| simp only [Finset.mem_filter] | |
| exact β¨fun h => h.2,fun h => β¨box_edges_subset N x _ h,hβ©β© | |
| rw [hf,Finset.sum_const,nsmul_eq_mul] | |
| simp only [localKernel,β Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| simp_rw [hid] | |
| calc | |
| _ β€ (4/(s:β))*β x β square N, (32*(s:β)^2)*Ξ½ x := | |
| mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun x hx => mul_le_mul_of_nonneg_right (hcards x) (hΞ½ x hx))) (by positivity) | |
| _ = (4/(s:β))*(32*(s:β)^2)*(β x β square N, Ξ½ x) := by | |
| rw [β Finset.mul_sum, β mul_assoc] | |
| _ β€ (4/(s:β))*(32*(s:β)^2)*C := mul_le_mul_of_nonneg_left hmass (by positivity) | |
| _ = _ := by field_simp;ring | |
| end GridTrace.NatGrid | |
| end | |
| end OAI | |