math / data /lean /OAI /Probability /LatticeSurface /Coercivity /GridTraceKernel.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
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