cfahlgren1's picture
download
raw
16.6 kB
import Mathlib
import OAI.MeasureTheory.FalconerCompletion.Recursion.CellPath
namespace OAI
/-! Graph energies and pair estimates. -/
section
section
open Set MeasureTheory
open scoped ComplexConjugate RealInnerProductSpace
namespace GraphLiteralSupport
namespace CurrentFalconer.TreeND
variable {d : ℕ}
noncomputable def intervalRamp (a b u : ℝ) : ℝ := min u b - min u a
theorem intervalRamp_increment {a b u v : ℝ} (hab : a ≤ b) (huv : u ≤ v) :
0 ≤ intervalRamp a b v - intervalRamp a b u ∧
intervalRamp a b v - intervalRamp a b u ≤ v-u := by
unfold intervalRamp
simp only [min_def]
split_ifs <;> constructor <;> linarith
noncomputable def finiteRampProfile (d c : ℕ → ℝ) (K : ℕ) (u : ℝ) : ℝ :=
∑ i ∈ Finset.range K, c i * intervalRamp (d (i+1)) (d i) u
theorem finiteRampProfile_continuous (d c : ℕ → ℝ) (K : ℕ) :
Continuous (finiteRampProfile d c K) := by
apply continuous_finsetSum
intro i _
exact continuous_const.mul ((continuous_id.min continuous_const).sub
(continuous_id.min continuous_const))
theorem intervalRamp_sum (d : ℕ → ℝ) (K : ℕ) (u : ℝ) :
(∑ i ∈ Finset.range K, intervalRamp (d (i+1)) (d i) u) = min u (d 0)-min u (d K) := by
induction K with
| zero => simp
| succ K ih => rw [Finset.sum_range_succ,ih]; unfold intervalRamp; ring
theorem finiteRampProfile_zero (d c : ℕ → ℝ) (K : ℕ) (hd : ∀ i, 0 ≤ d i) :
finiteRampProfile d c K 0 = 0 := by
simp [finiteRampProfile,intervalRamp, min_eq_left (hd _)]
theorem finiteRampProfile_increment (d c : ℕ → ℝ) (K : ℕ) {N C u v : ℝ}
(hd : Antitone d) (h0 : d 0 = N) (hK : d K = 0)
(hc : ∀ i < K, 0 ≤ c i ∧ c i ≤ C)
(hu : 0 ≤ u) (huv : u ≤ v) (hv : v ≤ N) :
0 ≤ finiteRampProfile d c K v - finiteRampProfile d c K u ∧
finiteRampProfile d c K v - finiteRampProfile d c K u ≤ C*(v-u) := by
have he : finiteRampProfile d c K v - finiteRampProfile d c K u =
∑ i ∈ Finset.range K, c i * (intervalRamp (d (i+1)) (d i) v -
intervalRamp (d (i+1)) (d i) u) := by
simp only [finiteRampProfile, ← Finset.sum_sub_distrib, mul_sub]
rw [he]
have hr (i : ℕ) := intervalRamp_increment (hd (Nat.le_succ i)) huv
constructor
· exact Finset.sum_nonneg fun i hi => mul_nonneg (hc i (Finset.mem_range.mp hi)).1 (hr i).1
· calc
_ ≤ ∑ i ∈ Finset.range K, C * (intervalRamp (d (i+1)) (d i) v -
intervalRamp (d (i+1)) (d i) u) :=
Finset.sum_le_sum fun i hi => mul_le_mul_of_nonneg_right
(hc i (Finset.mem_range.mp hi)).2 (hr i).1
_ = C*(v-u) := by
rw [← Finset.mul_sum,Finset.sum_sub_distrib,intervalRamp_sum,intervalRamp_sum,h0,hK]
rw [min_eq_left hv,min_eq_right (hu.trans huv),min_eq_left (huv.trans hv),min_eq_right hu]
ring
noncomputable def blockSlope (L : Finset (CellPath d)) (F : (CellPath d) → List ℕ)
(N B i : ℕ) (p : (CellPath d)) : ℝ :=
(Nat.log 2 (labeledChildren L F (blockDepth N B (i+1)) (blockDepth N B i) p).card : ℝ) /
(N:ℝ) / ((blockDepth N B i : ℝ)-(blockDepth N B (i+1) : ℝ))
noncomputable def regularizedProfile (L : Finset (CellPath d)) (F : (CellPath d) → List ℕ)
(N B K : ℕ) (p : (CellPath d)) : ℝ → ℝ :=
finiteRampProfile (fun i => (blockDepth N B i : ℝ)) (fun i => blockSlope L F N B i p) K
theorem blockSlope_bounds {N : ℕ} (hN : 0 < N) {L : Finset (CellPath d)}
(hL : L ⊆ dyadicPaths N) (F : (CellPath d) → List ℕ) (B i : ℕ) (p : (CellPath d)) :
0 ≤ blockSlope L F N B i p ∧ blockSlope L F N B i p ≤ (d:ℝ)/(N:ℝ) := by
have hN' : 0 < (N:ℝ) := by exact_mod_cast hN
have hd := blockDepth_antitone N B (Nat.le_succ i)
have hd' : (blockDepth N B (i+1):ℝ) ≤ (blockDepth N B i:ℝ) := by exact_mod_cast hd
have hb := child_bin_le hd (Nat.sub_le _ _) hL F p
have hb' : (Nat.log 2 (labeledChildren L F (blockDepth N B (i+1))
(blockDepth N B i) p).card:ℝ) ≤ (d:ℝ)*((blockDepth N B i:ℝ)-(blockDepth N B (i+1):ℝ)) := by
have hbR : (Nat.log 2 (labeledChildren L F (blockDepth N B (i+1))
(blockDepth N B i) p).card:ℝ) ≤ ((d*(blockDepth N B i-blockDepth N B (i+1)):ℕ):ℝ) := by
exact_mod_cast hb
simpa only [Nat.cast_mul,Nat.cast_ofNat,Nat.cast_sub hd] using hbR
unfold blockSlope
constructor
· positivity
· by_cases he : (blockDepth N B i:ℝ)-(blockDepth N B (i+1):ℝ) = 0
· rw [he,div_zero]; positivity
· have hp : 0 < (blockDepth N B i:ℝ)-(blockDepth N B (i+1):ℝ) := lt_of_le_of_ne (sub_nonneg.mpr hd') (Ne.symm he)
apply (div_le_iff₀ hp).mpr
apply (div_le_iff₀ hN').mpr
have heq : (d:ℝ)/(N:ℝ)*((blockDepth N B i:ℝ)-(blockDepth N B (i+1):ℝ))*(N:ℝ) =
(d:ℝ)*((blockDepth N B i:ℝ)-(blockDepth N B (i+1):ℝ)) := by field_simp
rw [heq]
exact hb'
theorem regularizedProfile_continuous (L : Finset (CellPath d)) (F : (CellPath d) → List ℕ)
(N B K : ℕ) (p : (CellPath d)) : Continuous (regularizedProfile L F N B K p) :=
finiteRampProfile_continuous _ _ _
theorem regularizedProfile_zero (L : Finset (CellPath d)) (F : (CellPath d) → List ℕ)
(N B K : ℕ) (p : (CellPath d)) : regularizedProfile L F N B K p 0 = 0 :=
finiteRampProfile_zero _ _ _ (fun _ => Nat.cast_nonneg _)
theorem regularizedProfile_increment {N : ℕ} (hN : 0 < N) {L : Finset (CellPath d)}
(hL : L ⊆ dyadicPaths N) (F : (CellPath d) → List ℕ) {B : ℕ} (hB : 0 < B)
(p : (CellPath d)) {u v : ℝ} (hu : 0 ≤ u) (huv : u ≤ v) (hv : v ≤ N) :
0 ≤ regularizedProfile L F N B (N/B+1) p v - regularizedProfile L F N B (N/B+1) p u ∧
regularizedProfile L F N B (N/B+1) p v - regularizedProfile L F N B (N/B+1) p u ≤
(d:ℝ)*(v-u)/(N:ℝ) := by
have hh := finiteRampProfile_increment (fun i => (blockDepth N B i:ℝ))
(fun i => blockSlope L F N B i p) (N/B+1)
(fun _ _ h => Nat.cast_le.mpr (blockDepth_antitone N B h)) (by simp [blockDepth])
(by simp [blockDepth_terminal N hB]) (fun i _ => blockSlope_bounds hN hL F B i p) hu huv hv
simpa only [regularizedProfile, div_mul_eq_mul_div] using hh
theorem regularizedProfile_adjusted_increment {N : ℕ} (hN : 0 < N) {L : Finset (CellPath d)}
(hL : L ⊆ dyadicPaths N) (F : (CellPath d) → List ℕ) {B : ℕ} (hB : 0 < B)
(p : (CellPath d)) {u v : ℝ} (hu : 0 ≤ u) (huv : u ≤ v) (hv : v ≤ N) :
|(regularizedProfile L F N B (N/B+1) p v-(d:ℝ)/2*v/(N:ℝ))-
(regularizedProfile L F N B (N/B+1) p u-(d:ℝ)/2*u/(N:ℝ))| ≤ (d:ℝ)/2*(v-u)/(N:ℝ) := by
have hh := regularizedProfile_increment hN hL F hB p hu huv hv
apply abs_le.mpr
constructor <;> simp only [sub_div,mul_div_assoc] at * <;> nlinarith
theorem intervalRamp_at_upper {a b : ℝ} (hab : a ≤ b) : intervalRamp a b b = b-a := by
simp [intervalRamp,min_eq_right hab]
theorem intervalRamp_at_lower {a b : ℝ} (hab : a ≤ b) : intervalRamp a b a = 0 := by
simp [intervalRamp,min_eq_left hab]
theorem intervalRamp_of_le {a b u : ℝ} (hab : a ≤ b) (hu : u ≤ a) : intervalRamp a b u = 0 := by
simp [intervalRamp,min_eq_left hu,min_eq_left (hu.trans hab)]
theorem intervalRamp_of_ge {a b u : ℝ} (hab : a ≤ b) (hu : b ≤ u) : intervalRamp a b u = b-a := by
simp [intervalRamp,min_eq_right hu,min_eq_right (hab.trans hu)]
theorem finiteRampProfile_block_difference (d c : ℕ → ℝ) (hd : Antitone d)
{K i : ℕ} (hi : i < K) :
finiteRampProfile d c K (d i) - finiteRampProfile d c K (d (i+1)) =
c i*(d i-d (i+1)) := by
classical
simp only [finiteRampProfile, ← Finset.sum_sub_distrib]
rw [Finset.sum_eq_single i]
· rw [intervalRamp_at_upper (hd (Nat.le_succ i)), intervalRamp_at_lower (hd (Nat.le_succ i))]
ring
· intro j _ hji
rcases lt_or_gt_of_ne hji with h | h
· rw [intervalRamp_of_le (hd (Nat.le_succ j)) (hd (by omega : j+1 ≤ i)),
intervalRamp_of_le (hd (Nat.le_succ j)) (hd (by omega : j+1 ≤ i+1))]
ring
· rw [intervalRamp_of_ge (hd (Nat.le_succ j)) (hd (by omega : i ≤ j)),
intervalRamp_of_ge (hd (Nat.le_succ j)) (hd (by omega : i+1 ≤ j))]
ring
· intro h; exact (h (Finset.mem_range.mpr hi)).elim
theorem finiteRampProfile_knots_telescope (d c : ℕ → ℝ) (hd : Antitone d)
{K i : ℕ} (hi : i ≤ K) :
(∑ j ∈ Finset.range i, c j*(d j-d (j+1))) =
finiteRampProfile d c K (d 0) - finiteRampProfile d c K (d i) := by
induction i with
| zero => simp
| succ i ih =>
rw [Finset.sum_range_succ,ih (by omega)]
rw [← finiteRampProfile_block_difference d c hd (by omega : i < K)]
ring
theorem blockSlope_mul_gap {N : ℕ} {L : Finset (CellPath d)} (hL : L ⊆ dyadicPaths N)
(F : (CellPath d) → List ℕ) (B i : ℕ) (p : (CellPath d)) :
blockSlope L F N B i p * ((blockDepth N B i:ℝ)-(blockDepth N B (i+1):ℝ)) =
(Nat.log 2 (labeledChildren L F (blockDepth N B (i+1)) (blockDepth N B i) p).card:ℝ)/(N:ℝ) := by
have hd := blockDepth_antitone N B (Nat.le_succ i)
have hb := child_bin_le hd (Nat.sub_le _ _) hL F p
by_cases he : (blockDepth N B i:ℝ)-(blockDepth N B (i+1):ℝ) = 0
· have he' : blockDepth N B i = blockDepth N B (i+1) := by exact_mod_cast sub_eq_zero.mp he
have hk : Nat.log 2 (labeledChildren L F (blockDepth N B (i+1)) (blockDepth N B i) p).card = 0 := by
exact Nat.eq_zero_of_le_zero (hb.trans_eq (by rw [he',Nat.sub_self,Nat.mul_zero]))
simp [blockSlope,hk]
· unfold blockSlope
exact div_mul_cancel₀ _ he
noncomputable def blockLogProduct (L : Finset (CellPath d)) (F : (CellPath d) → List ℕ)
(N B i : ℕ) (p : (CellPath d)) : ℕ :=
∑ j ∈ Finset.range i,
Nat.log 2 (labeledChildren L F (blockDepth N B (j+1)) (blockDepth N B j) p).card
theorem blockProduct_eq_pow (L : Finset (CellPath d)) (F : (CellPath d) → List ℕ)
(N B i : ℕ) (p : (CellPath d)) : blockProduct L F N B i p = 2 ^ blockLogProduct L F N B i p := by
unfold blockProduct blockBin blockLogProduct
rw [← Finset.prod_pow_eq_pow_sum]
theorem regularizedProfile_grid {N : ℕ} {L : Finset (CellPath d)} (hL : L ⊆ dyadicPaths N)
(F : (CellPath d) → List ℕ) {B : ℕ} (hB : 0 < B) (p : (CellPath d))
{i : ℕ} (hi : i ≤ N/B+1) :
regularizedProfile L F N B (N/B+1) p (blockDepth N B i) =
((blockLogProduct L F N B (N/B+1) p:ℝ)-(blockLogProduct L F N B i p:ℝ))/(N:ℝ) := by
let d := fun i => (blockDepth N B i:ℝ)
let c := fun i => blockSlope L F N B i p
have hd : Antitone d := fun _ _ h => Nat.cast_le.mpr (blockDepth_antitone N B h)
have htel (j : ℕ) (hj : j ≤ N/B+1) := finiteRampProfile_knots_telescope d c hd hj
have hsum (j : ℕ) : (∑ k ∈ Finset.range j, c k*(d k-d (k+1))) =
(blockLogProduct L F N B j p:ℝ)/(N:ℝ) := by
unfold c d
simp only [blockSlope_mul_gap hL F B _ p, ← Finset.sum_div, blockLogProduct, Nat.cast_sum]
have hi' := htel i hi
have hK := htel (N/B+1) le_rfl
rw [hsum] at hi' hK
have hz : finiteRampProfile d c (N/B+1) (d (N/B+1)) = 0 := by
change regularizedProfile L F N B (N/B+1) p _ = 0
rw [show d (N/B+1) = 0 by simp [d,blockDepth_terminal N hB], regularizedProfile_zero]
rw [hz] at hK
change finiteRampProfile d c (N/B+1) (d i) = _
rw [sub_div]
linarith
theorem regularizedProfile_reference_grid {N : ℕ} (hN : 0 < N)
{L : Finset (CellPath d)} (hL : L ⊆ dyadicPaths N)
(F : (CellPath d) → List ℕ) {B : ℕ} (hB : 0 < B) (p : (CellPath d))
{i : ℕ} (hi : i ≤ N/B+1) :
((2:ℝ)^N) ^ (-regularizedProfile L F N B (N/B+1) p (blockDepth N B i)) =
(blockProduct L F N B i p:ℝ)/(blockProduct L F N B (N/B+1) p:ℝ) := by
rw [regularizedProfile_grid hL F hB p hi, blockProduct_eq_pow,blockProduct_eq_pow]
simp only [Nat.cast_pow,Nat.cast_ofNat]
rw [← Real.rpow_natCast (2:ℝ) N, ← Real.rpow_mul (by norm_num : (0:ℝ) ≤ 2)]
have hN' : (N:ℝ) ≠ 0 := by exact_mod_cast hN.ne'
have he : (N:ℝ) * -(((blockLogProduct L F N B (N/B+1) p:ℝ)-(blockLogProduct L F N B i p:ℝ))/(N:ℝ)) =
(blockLogProduct L F N B i p:ℝ)-(blockLogProduct L F N B (N/B+1) p:ℝ) := by field_simp; ring
rw [he,Real.rpow_sub (by norm_num : (0:ℝ) < 2),Real.rpow_natCast,Real.rpow_natCast]
theorem finiteRampProfile_affine_block (d c : ℕ → ℝ) (hd : Antitone d)
{K i : ℕ} (hi : i < K) {u v : ℝ} (hu : d (i+1) ≤ u) (huv : u ≤ v) (hv : v ≤ d i) :
finiteRampProfile d c K v - finiteRampProfile d c K u = c i*(v-u) := by
classical
simp only [finiteRampProfile,← Finset.sum_sub_distrib]
rw [Finset.sum_eq_single i]
· simp only [intervalRamp,min_eq_left hv,min_eq_right (hu.trans huv),
min_eq_left (huv.trans hv),min_eq_right hu]
ring
· intro j _ hji
rcases lt_or_gt_of_ne hji with h | h
· rw [intervalRamp_of_le (hd (Nat.le_succ j)) (hv.trans (hd (by omega : j+1 ≤ i))),
intervalRamp_of_le (hd (Nat.le_succ j)) ((huv.trans hv).trans (hd (by omega : j+1 ≤ i)))]
ring
· rw [intervalRamp_of_ge (hd (Nat.le_succ j)) ((hd (by omega : i+1 ≤ j)).trans (hu.trans huv)),
intervalRamp_of_ge (hd (Nat.le_succ j)) ((hd (by omega : i+1 ≤ j)).trans hu)]
ring
· intro h; exact (h (Finset.mem_range.mpr hi)).elim
end CurrentFalconer.TreeND
end GraphLiteralSupport
end
end
section
section
open Set MeasureTheory
open scoped ComplexConjugate RealInnerProductSpace
namespace GraphLiteralSupport
namespace CurrentFalconer.TreeND
noncomputable def massBinCandidates (N : ℕ) (w : ℝ) : Finset ℕ := by
classical
exact (Finset.range (N+1)).filter fun k => (2:ℝ)^k ≤ (2:ℝ)^(N)*w
noncomputable def leafMassBin (N : ℕ) (w : ℝ) : ℕ :=
if h : (massBinCandidates N w).Nonempty then (massBinCandidates N w).max' h else 0
theorem massBinCandidates_nonempty {N : ℕ} {w : ℝ}
(hw : 1 ≤ (2:ℝ)^(N)*w) : (massBinCandidates N w).Nonempty := by
classical
exact ⟨0,by simp [massBinCandidates,hw]⟩
theorem leafMassBin_le (N : ℕ) (w : ℝ) : leafMassBin N w ≤ N := by
classical
unfold leafMassBin
split_ifs with h
· exact Nat.le_of_lt_succ (Finset.mem_range.mp
(Finset.mem_filter.mp ((massBinCandidates N w).max'_mem h)).1)
· omega
theorem leafMassBin_lower {N : ℕ} {w : ℝ} (hw : 1 ≤ (2:ℝ)^(N)*w) :
(2:ℝ)^(leafMassBin N w) ≤ (2:ℝ)^(N)*w := by
classical
unfold leafMassBin
rw [dite_eq_left (massBinCandidates_nonempty hw)]
exact (Finset.mem_filter.mp ((massBinCandidates N w).max'_mem (massBinCandidates_nonempty hw))).2
theorem leafMassBin_upper {N : ℕ} {w : ℝ} (hw : w ≤ 1) :
(2:ℝ)^(N)*w < (2:ℝ)^(leafMassBin N w+1) := by
classical
by_cases hk : leafMassBin N w < N
· by_contra h
have hm : leafMassBin N w+1 ∈ massBinCandidates N w := by
exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega),not_lt.mp h⟩
have hh : leafMassBin N w+1 ≤ leafMassBin N w := by
conv_rhs => rw [leafMassBin, dite_eq_left ⟨_,hm⟩]
exact Finset.le_max' _ _ hm
omega
· have he : leafMassBin N w = N := by have := leafMassBin_le N w; omega
rw [he, pow_succ]
have hp : 0 < (2:ℝ)^(N) := by positivity
nlinarith
noncomputable def leafBinEndpoint (N k : ℕ) : ℝ := (2:ℝ)^k / (2:ℝ)^(N)
theorem leafBinEndpoint_pos (N k : ℕ) : 0 < leafBinEndpoint N k := by
unfold leafBinEndpoint; positivity
theorem leaf_mass_bin_bounds {N : ℕ} {w : ℝ}
(hlo : 1 ≤ (2:ℝ)^(N)*w) (hhi : w ≤ 1) :
leafBinEndpoint N (leafMassBin N w) ≤ w ∧
w < 2 * leafBinEndpoint N (leafMassBin N w) := by
have hp : 0 < (2:ℝ)^(N) := by positivity
constructor
· exact (div_le_iff₀ hp).mpr (by simpa [mul_comm] using leafMassBin_lower hlo)
· have hu := leafMassBin_upper (N := N) hhi
rw [pow_succ] at hu
unfold leafBinEndpoint
rw [← mul_div_assoc]
exact (lt_div_iff₀ hp).mpr (by nlinarith)
theorem ratio_bounds_of_mass_bounds {x t s u v C : ℝ}
(hs : 0 < s) (hu : 0 < u) (hv : 0 < v) (hC : 0 < C)
(hx : u*s ≤ x ∧ x ≤ C*u*s) (ht : v*s ≤ t ∧ t ≤ C*v*s) :
(u/v)/C ≤ x/t ∧ x/t ≤ C*(u/v) := by
have htpos : 0 < t := (mul_pos hv hs).trans_le ht.1
have hxn : 0 ≤ x := (mul_pos hu hs).le.trans hx.1
constructor
· have hh : (u*s)/(C*v*s) ≤ x/t := div_le_div₀ (by positivity) hx.1 htpos ht.2
convert hh using 1; field_simp
· have hh : x/t ≤ (C*u*s)/(v*s) := div_le_div₀ (by positivity) hx.2 (mul_pos hv hs) ht.1
convert hh using 1; field_simp
end CurrentFalconer.TreeND
end GraphLiteralSupport
end
end
end OAI

Xet Storage Details

Size:
16.6 kB
·
Xet hash:
06d78af1af688e0c4bc1c84e07f42567649c6ee2109fcfb4a95198aeba91a916

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