introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
12.5 kB
import OAI.Analysis.DiamondDistortion.DiamondGraph
namespace OAI
universe u v
noncomputable section
open scoped BigOperators Classical Topology
open Set
namespace DiamondDistortion
namespace Diamond
variable {X : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X]
lemma norm_center_le {x y : X} {R : ℝ} (hp : β€–x+yβ€– ≀ R) (hm : β€–x-yβ€– ≀ R) :
β€–xβ€– ≀ R := by
have he : x=(1/2:ℝ) β€’ ((x+y)+(x-y)) := by module
calc
β€–xβ€– = (1/2:ℝ)*β€–(x+y)+(x-y)β€– := by
conv_lhs => rw [he]
rw [norm_smul,Real.norm_eq_abs,abs_of_pos (by norm_num : (0:ℝ)<1/2)]
_ ≀ (1/2:ℝ)*(β€–x+yβ€–+β€–x-yβ€–) := mul_le_mul_of_nonneg_left (norm_add_le _ _) (by norm_num)
_ ≀ R := by linarith
lemma norm_deviation_le {x y : X} {R : ℝ} (hp : β€–x+yβ€– ≀ R) (hm : β€–x-yβ€– ≀ R) :
β€–yβ€– ≀ R := norm_center_le (x := y) (y := x) (by simpa only [add_comm] using hp)
(by simpa only [norm_sub_rev] using hm)
lemma slope_lower {k : β„•} (f : Vertex k β†’ X) {s : ℝ}
(hl : βˆ€ u v,s*distance k u v ≀ β€–f u-f vβ€–) (e : Edge k) : s ≀ β€–slope f eβ€– := by
have he := hl (endpoint k e false) (endpoint k e true)
rw [distance_edge] at he
rw [slope,norm_smul,Real.norm_eq_abs,abs_of_pos (by positivity : 0<(2:ℝ)^k),norm_sub_rev]
calc
s = (2:ℝ)^k*(s*(1/(2:ℝ)^k)) := by field_simp
_ ≀ _ := mul_le_mul_of_nonneg_left he (by positivity)
lemma slope_upper {k : β„•} (f : Vertex k β†’ X) {L : ℝ}
(hu : βˆ€ u v,β€–f u-f vβ€– ≀ L*distance k u v) (e : Edge k) : β€–slope f eβ€– ≀ L := by
have he := hu (endpoint k e false) (endpoint k e true)
rw [distance_edge] at he
rw [slope,norm_smul,Real.norm_eq_abs,abs_of_pos (by positivity : 0<(2:ℝ)^k),norm_sub_rev]
calc
_ ≀ (2:ℝ)^k*(L*(1/(2:ℝ)^k)) := mul_le_mul_of_nonneg_left he (by positivity)
_ = _ := by field_simp
lemma old_lower {X : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X] {k : β„•} (f : Vertex (k+1) β†’ X) {s : ℝ}
(hl : βˆ€ u v,s*distance (k+1) u v ≀ β€–f u-f vβ€–) :
βˆ€ u v,s*distance k u v ≀ β€–f (Sum.inl u)-f (Sum.inl v)β€– := by
intro u v
simpa only [distance_old] using hl (Sum.inl u) (Sum.inl v)
/-- Abstract multiplicative backward iteration, retaining every all-pairs lower
bound and making no assertion of an attained stage supremum. -/
lemma iterate_contraction {s D c : ℝ} (hc : 0 ≀ c) (hc1 : c ≀ 1)
(hstep : βˆ€ (x : X) (z : β„• β†’ X) (R : ℝ),0 ≀ R β†’ R ≀ D β†’ s ≀ β€–xβ€– β†’
(βˆ€ i,β€–x+z iβ€– ≀ R) β†’ (βˆ€ i,β€–x-z iβ€– ≀ R) β†’
(βˆ€ i j,i β‰  j β†’ 2*s ≀ β€–z i-z jβ€–) β†’ β€–xβ€– ≀ c*R)
(k : β„•) (f : Vertex k β†’ X) {L : ℝ} (hL : 0 ≀ L) (hLD : L ≀ D)
(hl : βˆ€ u v,s*distance k u v ≀ β€–f u-f vβ€–)
(hb : βˆ€ e,β€–slope f eβ€– ≀ L) : s ≀ c^k*L := by
induction k generalizing L with
| zero => simpa using (slope_lower f hl ()).trans (hb ())
| succ n ih =>
have hold : βˆ€ e,β€–slope (fun v => f (Sum.inl v)) eβ€– ≀ c*L := by
intro e
apply hstep _ (deviation f e) L hL hLD (slope_lower _ (old_lower f hl) e)
Β· intro i
simpa only [slope_plus_deviation] using hb (e,i,false)
Β· intro i
simpa only [slope_minus_deviation] using hb (e,i,true)
Β· exact fun _ _ hij => deviation_separated f hl e hij
have hcL : c*L ≀ D := (mul_le_of_le_one_left hL hc1).trans hLD
have h := ih (fun v => f (Sum.inl v)) (mul_nonneg hc hL) hcL (old_lower f hl) hold
simpa only [pow_succ,mul_assoc] using h
/-- Abstract additive backward iteration. The existence of old edges ensures
nonnegativity of each improved bound, including the last nonempty stage. -/
lemma iterate_additive {s D Ξ΄ : ℝ} (hΞ΄ : 0 ≀ Ξ΄)
(hstep : βˆ€ (x : X) (z : β„• β†’ X) (R : ℝ),0 ≀ R β†’ R ≀ D β†’ s ≀ β€–xβ€– β†’
(βˆ€ i,β€–x+z iβ€– ≀ R) β†’ (βˆ€ i,β€–x-z iβ€– ≀ R) β†’
(βˆ€ i j,i β‰  j β†’ 2*s ≀ β€–z i-z jβ€–) β†’ β€–xβ€– ≀ R-Ξ΄)
(k : β„•) (f : Vertex k β†’ X) {L : ℝ} (hL : 0 ≀ L) (hLD : L ≀ D)
(hl : βˆ€ u v,s*distance k u v ≀ β€–f u-f vβ€–)
(hb : βˆ€ e,β€–slope f eβ€– ≀ L) : s+(k:ℝ)*Ξ΄ ≀ L := by
induction k generalizing L with
| zero => simpa using (slope_lower f hl ()).trans (hb ())
| succ n ih =>
have hold : βˆ€ e,β€–slope (fun v => f (Sum.inl v)) eβ€– ≀ L-Ξ΄ := by
intro e
apply hstep _ (deviation f e) L hL hLD (slope_lower _ (old_lower f hl) e)
Β· intro i
simpa only [slope_plus_deviation] using hb (e,i,false)
Β· intro i
simpa only [slope_minus_deviation] using hb (e,i,true)
Β· exact fun _ _ hij => deviation_separated f hl e hij
have hnew : 0 ≀ L-Ξ΄ := (norm_nonneg _).trans (hold (baseEdge n))
have h := ih (fun v => f (Sum.inl v)) hnew (by linarith) (old_lower f hl) hold
push_cast
linarith
def SquareLens (X : Type*) [NormedAddCommGroup X] (b : ℝ) : Prop :=
βˆ€ (x : X) (z : β„• β†’ X) (R Ξ΅ : ℝ),0 ≀ R β†’ 0 < Ξ΅ β†’
(βˆ€ i,β€–x+z iβ€– ≀ R) β†’ (βˆ€ i,β€–x-z iβ€– ≀ R) β†’
(βˆ€ i j,i β‰  j β†’ Ξ΅ ≀ β€–z i-z jβ€–) β†’ β€–xβ€–^2+b*Ξ΅^2 ≀ R^2
lemma squared_stretch_loss_general {b : ℝ} (hX : SquareLens X b) (k : β„•) (f : Vertex k β†’ X)
{s B : ℝ} (hs : 0 < s)
(hl : βˆ€ u v,s*distance k u v ≀ β€–f u-f vβ€–)
(hb : βˆ€ e,β€–slope f eβ€–^2 ≀ B) : s^2*(1+4*b*(k:ℝ)) ≀ B := by
induction k generalizing B with
| zero =>
have h := slope_lower f hl ()
have h0 := hb ()
norm_num
nlinarith [sq_nonneg (s-β€–slope f ()β€–)]
| succ n ih =>
have hB : 0 ≀ B := (sq_nonneg _).trans (hb (baseEdge (n+1)))
have hold : βˆ€ e,β€–slope (fun v => f (Sum.inl v)) eβ€–^2 ≀ B-4*b*s^2 := by
intro e
have hp : βˆ€ i,β€–slope (fun v => f (Sum.inl v)) e+deviation f e iβ€– ≀ Real.sqrt B := by
intro i
rw [slope_plus_deviation]
exact (Real.le_sqrt (norm_nonneg _) hB).mpr (hb _)
have hm : βˆ€ i,β€–slope (fun v => f (Sum.inl v)) e-deviation f e iβ€– ≀ Real.sqrt B := by
intro i
rw [slope_minus_deviation]
exact (Real.le_sqrt (norm_nonneg _) hB).mpr (hb _)
have h := hX (slope (fun v => f (Sum.inl v)) e) (deviation f e)
(Real.sqrt B) (2*s) (Real.sqrt_nonneg _) (by positivity) hp hm
(fun _ _ hij => deviation_separated f hl e hij)
rw [Real.sq_sqrt hB] at h
nlinarith
have hind := ih (fun v => f (Sum.inl v)) (old_lower f hl) hold
push_cast
nlinarith only [hind]
lemma squared_transfer {b : ℝ} (_hb : 0 < b) (hX : SquareLens X b)
(k : β„•) (f : Vertex k β†’ X) (D s : ℝ) (h : HasDistortion k f D s) :
1+4*b*(k:ℝ) ≀ D^2 := by
obtain ⟨hD,hs,h⟩ := h
have hbound : βˆ€ e,β€–slope f eβ€–^2 ≀ (D*s)^2 := by
intro e
have hh := slope_upper f (fun u v => (h u v).2) e
exact (sq_le_sqβ‚€ (norm_nonneg _) (mul_nonneg (by linarith) hs.le)).mpr hh
have h' := squared_stretch_loss_general hX k f hs (fun u v => (h u v).1) hbound
have hp : 0 < s^2 := sq_pos_of_pos hs
have hmul : s^2*(1+4*b*(k:ℝ)) ≀ s^2*D^2 := by nlinarith only [h']
exact (mul_le_mul_iff_rightβ‚€ hp).mp hmul
lemma normalized_distortion {k : β„•} (f : Vertex k β†’ X) {D s : ℝ}
(h : HasDistortion k f D s) :
HasDistortion k (fun v => s⁻¹ β€’ f v) D 1 := by
obtain ⟨hD,hs,h⟩ := h
refine ⟨hD,by norm_num,?_⟩
intro u v
rw [← smul_sub,norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hs.le)]
have hl := mul_le_mul_of_nonneg_left (h u v).1 (inv_nonneg.mpr hs.le)
have hu := mul_le_mul_of_nonneg_left (h u v).2 (inv_nonneg.mpr hs.le)
have he : s⁻¹*(s*distance k u v)=distance k u v := by field_simp
have he' : s⁻¹*(D*s*distance k u v)=D*distance k u v := by field_simp
rw [he] at hl
rw [he'] at hu
simpa only [one_mul,mul_one] using And.intro hl hu
lemma upper_one_normalization {k : β„•} (f : Vertex k β†’ X) {D s : ℝ}
(h : HasDistortion k f D s) :
βˆ€ u v,D⁻¹*distance k u v ≀ β€–(D*s)⁻¹ β€’ f u-(D*s)⁻¹ β€’ f vβ€– ∧
β€–(D*s)⁻¹ β€’ f u-(D*s)⁻¹ β€’ f vβ€– ≀ distance k u v := by
obtain ⟨hD,hs,h⟩ := h
have hD0 : 0 < D := by linarith
have hDs : 0 < D*s := mul_pos hD0 hs
intro u v
rw [← smul_sub,norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hDs.le)]
have hl := mul_le_mul_of_nonneg_left (h u v).1 (inv_nonneg.mpr hDs.le)
have hu := mul_le_mul_of_nonneg_left (h u v).2 (inv_nonneg.mpr hDs.le)
have he : (D*s)⁻¹*(s*distance k u v)=D⁻¹*distance k u v := by field_simp
have he' : (D*s)⁻¹*(D*s*distance k u v)=distance k u v := by field_simp
rw [he] at hl
rw [he'] at hu
exact ⟨hl,hu⟩
def RadialLens (X : Type*) [NormedAddCommGroup X] (C : ℝ) : Prop :=
βˆ€ (x : X) (z : β„• β†’ X) (R Ξ΅ : ℝ),0 ≀ R β†’ 0 < Ξ΅ β†’
(βˆ€ i,β€–x+z iβ€– ≀ R) β†’ (βˆ€ i,β€–x-z iβ€– ≀ R) β†’
(βˆ€ i j,i β‰  j β†’ Ξ΅ ≀ β€–z i-z jβ€–) β†’ Ξ΅^2/4 ≀ C^2*R*(R-β€–xβ€–)
theorem radial_transfer {C : ℝ} (hC : 0 < C) (hX : RadialLens X C)
(k : β„•) (f : Vertex k β†’ X) (D s : ℝ) (hf : HasDistortion k f D s) :
(k:ℝ) ≀ C^2*D*(D-1) := by
obtain ⟨hD,_,h⟩ := normalized_distortion f hf
have hD0 : 0 < D := by linarith
have hP : 0 < C^2*D := mul_pos (sq_pos_of_pos hC) hD0
let Ξ΄ : ℝ := 1/(C^2*D)
have hΞ΄ : 0 ≀ Ξ΄ := by dsimp [Ξ΄]; positivity
have hstep : βˆ€ (x : X) (z : β„• β†’ X) (R : ℝ),0 ≀ R β†’ R ≀ D β†’ 1 ≀ β€–xβ€– β†’
(βˆ€ i,β€–x+z iβ€– ≀ R) β†’ (βˆ€ i,β€–x-z iβ€– ≀ R) β†’
(βˆ€ i j,i β‰  j β†’ 2*1 ≀ β€–z i-z jβ€–) β†’ β€–xβ€– ≀ R-Ξ΄ := by
intro x z R hR hRD hx hp hm hsep
have he := hX x z R 2 hR (by norm_num) hp hm (by simpa using hsep)
have hxr := norm_center_le (hp 0) (hm 0)
have hmul := mul_le_mul_of_nonneg_right
(mul_le_mul_of_nonneg_left hRD (sq_nonneg C)) (sub_nonneg.mpr hxr)
have hh : 1 ≀ C^2*D*(R-β€–xβ€–) := by norm_num at he; exact he.trans hmul
have hh' : Ξ΄ ≀ R-β€–xβ€– := (div_le_iffβ‚€ hP).mpr (by nlinarith only [hh])
linarith
have hi := iterate_additive hΞ΄ hstep k (fun v => s⁻¹ β€’ f v) hD0.le le_rfl
(fun u v => by simpa using (h u v).1)
(fun e => slope_upper _ (fun u v => by simpa using (h u v).2) e)
have hquot : (k:ℝ)/(C^2*D) ≀ D-1 := by
dsimp [Ξ΄] at hi
rw [mul_one_div] at hi
linarith
have hmul := (div_le_iffβ‚€ hP).mp hquot
nlinarith only [hmul]
def UnitLensBound (X : Type*) [NormedAddCommGroup X] (Ξ΅ ρ : ℝ) : Prop :=
βˆ€ (x : X) (z : β„• β†’ X), (βˆ€ i,β€–x+z iβ€– ≀ 1) β†’ (βˆ€ i,β€–x-z iβ€– ≀ 1) β†’
(βˆ€ i j,i β‰  j β†’ Ξ΅ ≀ β€–z i-z jβ€–) β†’ β€–xβ€– ≀ ρ
theorem backward {Ξ± ρ : ℝ} (hΞ± : 0 < Ξ±) (_hΞ±1 : Ξ± ≀ 1) (hρ : 0 ≀ ρ) (hρ1 : ρ < 1)
(hX : UnitLensBound X (2*Ξ±) ρ) (k : β„•) (f : Vertex k β†’ X)
(hl : βˆ€ u v,Ξ±*distance k u v ≀ β€–f u-f vβ€–)
(hu : βˆ€ u v,β€–f u-f vβ€– ≀ distance k u v) : Ξ± ≀ ρ^k := by
have hstep : βˆ€ (x : X) (z : β„• β†’ X) (R : ℝ),0 ≀ R β†’ R ≀ 1 β†’ Ξ± ≀ β€–xβ€– β†’
(βˆ€ i,β€–x+z iβ€– ≀ R) β†’ (βˆ€ i,β€–x-z iβ€– ≀ R) β†’
(βˆ€ i j,i β‰  j β†’ 2*Ξ± ≀ β€–z i-z jβ€–) β†’ β€–xβ€– ≀ ρ*R := by
intro x z R hR hR1 hx hp hm hs
have hxr := norm_center_le (hp 0) (hm 0)
have hR0 : 0 < R := lt_of_lt_of_le hΞ± (hx.trans hxr)
have hscale (u : X) : β€–R⁻¹ β€’ uβ€–=R⁻¹*β€–uβ€– := by
rw [norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hR)]
have hi : R⁻¹*R=1 := inv_mul_cancelβ‚€ hR0.ne'
have hinv : 1 ≀ R⁻¹ := by
rw [← one_div]
exact (le_div_iffβ‚€ hR0).mpr (by simpa using hR1)
have hb := hX (R⁻¹ β€’ x) (fun i => R⁻¹ β€’ z i)
(fun i => by
rw [← smul_add,hscale]
exact (mul_le_mul_of_nonneg_left (hp i) (inv_nonneg.mpr hR)).trans hi.le)
(fun i => by
rw [← smul_sub,hscale]
exact (mul_le_mul_of_nonneg_left (hm i) (inv_nonneg.mpr hR)).trans hi.le)
(fun i j hij => by
rw [← smul_sub,hscale]
exact (le_mul_of_one_le_left (by positivity : 0 ≀ 2*Ξ±) hinv).trans
(mul_le_mul_of_nonneg_left (hs i j hij) (inv_nonneg.mpr hR)))
rw [hscale] at hb
have hh := mul_le_mul_of_nonneg_left hb hR
rw [← mul_assoc,mul_inv_cancelβ‚€ hR0.ne',one_mul] at hh
simpa only [mul_comm] using hh
have h := iterate_contraction hρ hρ1.le hstep k f (by norm_num : (0:ℝ) ≀ 1) le_rfl hl
(fun e => slope_upper f (fun u v => by simpa using hu u v) e)
simpa only [mul_one] using h
end Diamond
end DiamondDistortion
end
end OAI