cfahlgren1's picture
download
raw
7.47 kB
import Mathlib
import OAI.MeasureTheory.FalconerCompletion.Sphere.SphereMeasure
namespace OAI
/-! Measures and the conditional distance-set completion. -/
section
section
namespace CurrentFalconer
open Set MeasureTheory Metric
def ambientGridCell {d : ℕ} (n : ℕ) (a : Fin d → ℤ) :
Set (EuclideanSpace ℝ (Fin d)) :=
{x | ∀ i, (a i : ℝ) ≤ (2:ℝ)^n*x i ∧ (2:ℝ)^n*x i < (a i : ℝ)+1}
lemma mem_ambientGridCell_iff {d n : ℕ} {a : Fin d → ℤ}
{x : EuclideanSpace ℝ (Fin d)} :
x ∈ ambientGridCell n a ↔ ∀ i, ⌊(2:ℝ)^n*x i⌋ = a i := by
simp only [ambientGridCell,mem_ofPred_eq,Int.floor_eq_iff]
lemma measurableSet_ambientGridCell {d : ℕ} (n : ℕ) (a : Fin d → ℤ) :
MeasurableSet (ambientGridCell n a) := by
have he : ambientGridCell n a = ⋂ i : Fin d,
{x : EuclideanSpace ℝ (Fin d) | (a i : ℝ) ≤ (2:ℝ)^n*x i} ∩
{x : EuclideanSpace ℝ (Fin d) | (2:ℝ)^n*x i < (a i : ℝ)+1} := by
ext x; simp only [ambientGridCell,mem_iInter,mem_inter_iff,mem_ofPred_eq]
rw [he]
apply MeasurableSet.iInter
intro i
exact (isClosed_le continuous_const (continuous_const.mul (EuclideanSpace.proj i).continuous)).measurableSet.inter
((isOpen_lt (continuous_const.mul (EuclideanSpace.proj i).continuous) continuous_const).measurableSet)
lemma ambientGridCell_disjoint {d n : ℕ} {a b : Fin d → ℤ} (hab : a ≠ b) :
Disjoint (ambientGridCell n a) (ambientGridCell n b) := by
apply Set.disjoint_left.mpr
intro x hxa hxb
apply hab
funext i
exact ((mem_ambientGridCell_iff.mp hxa) i).symm.trans ((mem_ambientGridCell_iff.mp hxb) i)
lemma ambientGridCell_dist_le {d n : ℕ} {a : Fin d → ℤ}
{x y : EuclideanSpace ℝ (Fin d)} (hx : x ∈ ambientGridCell n a)
(hy : y ∈ ambientGridCell n a) :
dist y x ≤ (d+1:ℝ)/(2:ℝ)^n := by
have ht : 0 < (2:ℝ)^n := by positivity
have hcoord (i : Fin d) : |y i-x i| ≤ 1/(2:ℝ)^n := by
rw [abs_le]
constructor
· rw [show -(1/(2:ℝ)^n)=(-1)/(2:ℝ)^n by ring]
apply (div_le_iff₀ ht).mpr
have h1 := (hx i).2
have h2 := (hy i).1
nlinarith
· apply (le_div_iff₀ ht).mpr
have h1 := (hy i).2
have h2 := (hx i).1
nlinarith
have hsq : dist y x^2 ≤ (d:ℝ)*(1/(2:ℝ)^n)^2 := by
rw [EuclideanSpace.dist_sq_eq]
calc
_ ≤ ∑ _ : Fin d, (1/(2:ℝ)^n)^2 := by
apply Finset.sum_le_sum
intro i _
simpa only [Real.dist_eq,sq_abs] using
(sq_le_sq₀ (abs_nonneg _) (by positivity : (0:ℝ) ≤ 1/(2:ℝ)^n)).mpr (hcoord i)
_ = _ := by simp
have hh : (d:ℝ)*(1/(2:ℝ)^n)^2 ≤ ((d+1:ℝ)/(2:ℝ)^n)^2 := by
have hd : 0 ≤ (d:ℝ) := by positivity
have hd' : (d:ℝ) ≤ (d+1:ℝ)^2 := by nlinarith
calc
_ ≤ (d+1:ℝ)^2*(1/(2:ℝ)^n)^2 := mul_le_mul_of_nonneg_right hd' (sq_nonneg _)
_ = _ := by ring
exact (sq_le_sq₀ dist_nonneg (by positivity)).mp (hsq.trans hh)
lemma ambientGridCell_subset_ancestor {d m n : ℕ} (hnm : n ≤ m) (a : Fin d → ℤ) :
ambientGridCell m a ⊆ ambientGridCell n (fun i => a i/(2:ℤ)^(m-n)) := by
intro x hx
apply mem_ambientGridCell_iff.mpr
intro i
have hf := Int.floor_div_natCast ((2:ℝ)^m*x i) (2^(m-n))
rw [(mem_ambientGridCell_iff.mp hx) i] at hf
have he : (2:ℝ)^m*x i/(2^(m-n):ℕ) = (2:ℝ)^n*x i := by
have hpow : (2:ℝ)^m=(2:ℝ)^n*(2:ℝ)^(m-n) := by
rw [← pow_add,Nat.add_sub_of_le hnm]
rw [Nat.cast_pow,Nat.cast_ofNat,hpow]
field_simp
rw [he] at hf
simpa only [Nat.cast_pow,Nat.cast_ofNat] using hf
noncomputable def ambientGridCenter {d : ℕ} (n : ℕ) (a : Fin d → ℤ) :
EuclideanSpace ℝ (Fin d) := WithLp.toLp 2 (fun i => ((a i : ℝ)+1/2)/(2:ℝ)^n)
lemma ambientGridCenter_apply {d : ℕ} (n : ℕ) (a : Fin d → ℤ) (i : Fin d) :
ambientGridCenter n a i = ((a i : ℝ)+1/2)/(2:ℝ)^n := rfl
lemma ambientGridCenter_mem {d : ℕ} (n : ℕ) (a : Fin d → ℤ) :
ambientGridCenter n a ∈ ambientGridCell n a := by
intro i
change (a i:ℝ) ≤ (2:ℝ)^n*(((a i:ℝ)+1/2)/(2:ℝ)^n) ∧
(2:ℝ)^n*(((a i:ℝ)+1/2)/(2:ℝ)^n) < (a i:ℝ)+1
have ht : (2:ℝ)^n ≠ 0 := by positivity
field_simp
constructor <;> linarith
lemma ambientGridCenter_injective {d : ℕ} (n : ℕ) :
Function.Injective (ambientGridCenter (d := d) n) := by
intro a b hab
have hx := ambientGridCell_disjoint (n := n) (a := a) (b := b)
by_contra hne
exact Set.disjoint_left.mp (hx hne) (ambientGridCenter_mem n a)
(hab.symm ▸ ambientGridCenter_mem n b)
lemma ambientGridCenter_coordinate_bound {d n : ℕ} {a : Fin d → ℤ}
{x : EuclideanSpace ℝ (Fin d)} {r : ℝ} (h : dist (ambientGridCenter n a) x ≤ r)
(i : Fin d) : |(a i:ℝ)+1/2-(2:ℝ)^n*x i| ≤ (2:ℝ)^n*r := by
have hc : |ambientGridCenter n a i-x i| ≤ r := by
exact (PiLp.norm_apply_le (ambientGridCenter n a-x) i).trans h
have ht : 0 < (2:ℝ)^n := by positivity
have hc' := mul_le_mul_of_nonneg_left hc ht.le
rw [← abs_of_pos ht,← abs_mul] at hc'
rw [abs_of_pos ht] at hc'
convert hc' using 1
congr 1
rw [ambientGridCenter_apply]
field_simp
lemma ambientGridCenter_index_bounds {d n : ℕ} {a : Fin d → ℤ}
{x : EuclideanSpace ℝ (Fin d)} {r : ℝ} (h : dist (ambientGridCenter n a) x ≤ r)
(i : Fin d) :
⌊(2:ℝ)^n*x i⌋-(⌈(2:ℝ)^n*r+1⌉₊:ℤ) ≤ a i ∧
a i ≤ ⌊(2:ℝ)^n*x i⌋+(⌈(2:ℝ)^n*r+1⌉₊:ℤ) := by
have hh := abs_le.mp (ambientGridCenter_coordinate_bound h i)
have hf := Int.floor_le ((2:ℝ)^n*x i)
have hf' := Int.lt_floor_add_one ((2:ℝ)^n*x i)
have hK := Nat.le_ceil ((2:ℝ)^n*r+1)
constructor <;> apply (Int.cast_le (R := ℝ)).mp <;> push_cast <;> linarith
theorem ambientGridCenter_ball_card {d : ℕ} (n : ℕ) (P : Finset (Fin d → ℤ))
(x : EuclideanSpace ℝ (Fin d)) {r : ℝ} (hr : 0 ≤ r)
(hP : ∀ a ∈ P, dist (ambientGridCenter n a) x ≤ r) :
(P.card : ℝ) ≤ (2*(2:ℝ)^n*r+5)^d := by
classical
let K : ℕ := ⌈(2:ℝ)^n*r+1⌉₊
let F : Fin d → ℤ := fun i => ⌊(2:ℝ)^n*x i⌋
let B := Fintype.piFinset (fun i : Fin d => Finset.Icc (F i-(K:ℤ)) (F i+K))
have hPB : P ⊆ B := by
intro a ha
simp only [B,Fintype.mem_piFinset,Finset.mem_Icc]
exact fun i => ambientGridCenter_index_bounds (hP a ha) i
have hBc : B.card=(2*K+1)^d := by
have hI (i : Fin d) : (Finset.Icc (F i-(K:ℤ)) (F i+K)).card=2*K+1 := by
rw [Int.card_Icc]
have he : (F i+(K:ℤ)+1-(F i-K)) = (2*K+1:ℕ) := by push_cast; ring
rw [he,Int.toNat_natCast]
simp [B,Fintype.card_piFinset,hI]
have hK : (K:ℝ) ≤ (2:ℝ)^n*r+2 := by
have hh := (Nat.ceil_lt_add_one (by positivity : (0:ℝ) ≤ (2:ℝ)^n*r+1)).le
dsimp [K]; linarith
calc
_ ≤ (((2*K+1)^d:ℕ):ℝ) := by exact_mod_cast (Finset.card_le_card hPB).trans_eq hBc
_ = (2*(K:ℝ)+1)^d := by push_cast; rfl
_ ≤ _ := pow_le_pow_left₀ (by positivity) (by linarith) d
theorem translated_ambientGridCenter_ball_card {d : ℕ} (n : ℕ)
(P : Finset (Fin d → ℤ)) (b x : EuclideanSpace ℝ (Fin d)) {r : ℝ} (hr : 0 ≤ r)
(hP : ∀ a ∈ P, dist (b+ambientGridCenter n a) x ≤ r) :
(P.card : ℝ) ≤ (2*(2:ℝ)^n*r+5)^d := by
apply ambientGridCenter_ball_card n P (x-b) hr
intro a ha
convert hP a ha using 1
rw [dist_eq_norm,dist_eq_norm]
congr 1
abel
end CurrentFalconer
end
end
end OAI

Xet Storage Details

Size:
7.47 kB
·
Xet hash:
43a8bd6060292809739f43c52444418f0e3337f75d068d2be07ad0721ecbe4cf

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.