import Mathlib import OAI.MeasureTheory.Falconer.Geometry.BinBands import OAI.MeasureTheory.Falconer.Model import OAI.MeasureTheory.FalconerCompletion.Measures.LocalDistanceCollisionBound namespace OAI /-! Quantitative estimates for the distance-set construction. -/ open _root_.OAI.PlanarFalconer section section open Set MeasureTheory open scoped ComplexConjugate RealInnerProductSpace namespace GraphLiteralSupport namespace CurrentFalconer open Set Metric MeasureTheory open scoped RealInnerProductSpace variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] lemma norm_linear_error_identityND (a v : V) (ha : 0<‖a‖) : ‖v‖-inner ℝ (‖a‖⁻¹ • a) v = (‖v-a‖^2-(‖v‖-‖a‖)^2)/(2*‖a‖) := by rw [real_inner_smul_left,norm_sub_sq_real,real_inner_comm v a] field_simp [ne_of_gt ha] ring lemma norm_linear_errorND (a v : V) (ha : 0<‖a‖) : 0 ≤ ‖v‖-inner ℝ (‖a‖⁻¹ • a) v ∧ ‖v‖-inner ℝ (‖a‖⁻¹ • a) v ≤ ‖v-a‖^2/(2*‖a‖) := by have hn : ‖‖a‖⁻¹ • a‖=1 := by rw [norm_smul,Real.norm_eq_abs,abs_of_pos (inv_pos.mpr ha),inv_mul_cancel₀ (ne_of_gt ha)] constructor · have hh := (le_abs_self (inner ℝ (‖a‖⁻¹ • a) v)).trans (abs_real_inner_le_norm _ _) rw [hn,one_mul] at hh linarith · rw [norm_linear_error_identityND a v ha] gcongr exact sub_le_self _ (sq_nonneg _) lemma distance_linearizationND (x y c e : V) {δ ρ : ℝ} (hρ : 0<ρ) (hsep : ρ ≤ ‖c-e‖) (hx : dist x c ≤ δ) (hy : dist y e ≤ δ) : |dist x y-inner ℝ (‖c-e‖⁻¹ • (c-e)) (x-y)| ≤ 2*δ^2/ρ := by have hδ : 0 ≤ δ := dist_nonneg.trans hx have hce : 0<‖c-e‖ := hρ.trans_le hsep have hh := norm_linear_errorND (c-e) (x-y) hce have hnear : ‖(x-y)-(c-e)‖ ≤ 2*δ := by have he : (x-y)-(c-e)=(x-c)-(y-e) := by abel rw [he] exact (norm_sub_le _ _).trans (by simpa only [dist_eq_norm, two_mul] using add_le_add hx hy) rw [dist_eq_norm,abs_of_nonneg hh.1] calc _ ≤ ‖(x-y)-(c-e)‖^2/(2*‖c-e‖) := hh.2 _ ≤ (2*δ)^2/(2*ρ) := by gcongr _ = _ := by ring lemma normalized_direction_distND (a v : V) (ha : 0<‖a‖) (hv : 0<‖v‖) : dist (‖a‖⁻¹ • a) (‖v‖⁻¹ • v) ≤ 2*‖a-v‖/‖a‖ := by have he : ‖a‖⁻¹ • a-‖v‖⁻¹ • v = ‖a‖⁻¹ • (a-v)+(‖a‖⁻¹-‖v‖⁻¹) • v := by simp only [smul_sub,sub_smul]; abel have hn : ‖(‖a‖⁻¹-‖v‖⁻¹) • v‖=|‖v‖-‖a‖|/‖a‖ := by rw [norm_smul,Real.norm_eq_abs] have he : ‖a‖⁻¹-‖v‖⁻¹=(‖v‖-‖a‖)/(‖a‖*‖v‖) := by field_simp rw [he,abs_div,abs_mul,abs_of_pos ha,abs_of_pos hv] field_simp rw [dist_eq_norm,he] calc _ ≤ ‖‖a‖⁻¹ • (a-v)‖+‖(‖a‖⁻¹-‖v‖⁻¹) • v‖ := norm_add_le _ _ _ = ‖a-v‖/‖a‖+|‖v‖-‖a‖|/‖a‖ := by rw [hn,norm_smul,Real.norm_eq_abs,abs_of_pos (inv_pos.mpr ha)]; ring _ ≤ ‖a-v‖/‖a‖+‖a-v‖/‖a‖ := by gcongr simpa only [norm_sub_rev] using abs_norm_sub_norm_le v a _ = _ := by ring end CurrentFalconer end GraphLiteralSupport end end section section open Set MeasureTheory open scoped ComplexConjugate RealInnerProductSpace namespace GraphLiteralSupport namespace CurrentFalconer open Set Metric MeasureTheory open scoped ENNReal RealInnerProductSpace variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MeasurableSpace V] [BorelSpace V] [SecondCountableTopology V] open PlanarFalconer omit [MeasurableSpace V] [BorelSpace V] [SecondCountableTopology V] in lemma projection_direction_changeND (y y' c e v : V) {δ ε w : ℝ} (hy : dist y c ≤ δ) (hy' : dist y' c ≤ δ) (he : dist e v ≤ ε) (hproj : |inner ℝ (y-y') e| ≤ w) : |inner ℝ (y-y') v| ≤ w+2*δ*ε := by have hδ : 0 ≤ δ := dist_nonneg.trans hy have hd : ‖y-y'‖ ≤ 2*δ := by rw [← dist_eq_norm] exact (dist_triangle y c y').trans (by rw [dist_comm c y']; linarith) have hh := abs_real_inner_le_norm (y-y') (v-e) rw [inner_sub_right] at hh have hev : ‖v-e‖ ≤ ε := by simpa only [← dist_eq_norm,dist_comm v e] using he have hh' : |inner ℝ (y-y') v-inner ℝ (y-y') e| ≤ 2*δ*ε := hh.trans (mul_le_mul hd hev (norm_nonneg _) (by positivity)) have htri := abs_add_le (inner ℝ (y-y') v-inner ℝ (y-y') e) (inner ℝ (y-y') e) simp only [sub_add_cancel] at htri linarith theorem suffix_witness_local_collisionND (μ : Measure V) [IsFiniteMeasure μ] {P Q : Set V} (hP : MeasurableSet P) (hQ : MeasurableSet Q) (c c' x₀ y₀ : V) {δ ρ w W : ℝ} (hρ : 0<ρ) (hw : 0