import Mathlib import OAI.MeasureTheory.FalconerCompletion.Measures.AmbientGridCell3 namespace OAI /-! Recursive policies and quantitative depth estimates. -/ section section open Set MeasureTheory open scoped ComplexConjugate RealInnerProductSpace namespace GraphLiteralSupport namespace Attempt4FullFar open Set Metric lemma exists_far_separation_powerND (d : ℕ) : ∃ k : ℕ, 1000*(d+1:ℝ)<(2:ℝ)^k ∧ (2:ℝ)^k<4000*(d+1:ℝ) := by obtain ⟨n,hn,hn'⟩ := exists_nat_pow_near (x := 1000*(d+1:ℝ)) (y := (2:ℝ)) (by have hd : (0:ℝ)≤d := Nat.cast_nonneg d; linarith) (by norm_num) refine ⟨n+1,hn',?_⟩ rw [pow_succ] nlinarith def farSeparatedGridND {d : ℕ} (b : ℕ) (K : ℝ) (X Y : Fin d → ℤ) : Prop := K/(8*(2:ℝ)^b)≤dist (ambientGridCenter b X) (ambientGridCenter b Y) ∧ dist (ambientGridCenter b X) (ambientGridCenter b Y)≤4*K/(2:ℝ)^b theorem farSeparatedGridND_of_lengths {d b : ℕ} {K : ℝ} (hK : 16*(d+1:ℝ)≤K) {X Y : Fin d → ℤ} {x y : EuclideanSpace ℝ (Fin d)} (hx : x∈ambientGridCell b X) (hy : y∈ambientGridCell b Y) (hlo : K/(4*(2:ℝ)^b)≤dist x y) (hhi : dist x y≤K/(2:ℝ)^b) : farSeparatedGridND b K X Y := by have htp : 0<(2:ℝ)^b := by positivity have hcx := ambientGridCell_dist_le hx (ambientGridCenter_mem b X) have hcy := ambientGridCell_dist_le hy (ambientGridCenter_mem b Y) have hxy := dist_triangle4 x (ambientGridCenter b X) (ambientGridCenter b Y) y have hcc := dist_triangle4 (ambientGridCenter b X) x y (ambientGridCenter b Y) rw [dist_comm x (ambientGridCenter b X)] at hxy rw [dist_comm y (ambientGridCenter b Y)] at hcc have hscale := div_le_div_of_nonneg_right hK htp.le have hscale' : 16*((d+1:ℝ)/(2:ℝ)^b)≤K/(2:ℝ)^b := by simpa only [mul_div_assoc] using hscale have he₁ : K/(4*(2:ℝ)^b)=(K/(2:ℝ)^b)/4 := by ring have he₂ : K/(8*(2:ℝ)^b)=(K/(2:ℝ)^b)/8 := by ring have he₃ : 4*K/(2:ℝ)^b=4*(K/(2:ℝ)^b) := by ring dsimp [farSeparatedGridND] rw [he₂,he₃] rw [he₁] at hlo constructor <;> linarith theorem farSeparatedGridND_partner_card {d : ℕ} (b : ℕ) {K : ℝ} (hK : 0≤K) (X : Fin d → ℤ) (P : Finset (Fin d → ℤ)) (hP : ∀ Y∈P, farSeparatedGridND b K X Y) : (P.card:ℝ)≤(8*K+5)^d := by have hh := ambientGridCenter_ball_card b P (ambientGridCenter b X) (r := 4*K/(2:ℝ)^b) (by positivity) (fun Y hY => by rw [dist_comm]; exact (hP Y hY).2) convert hh using 1 congr 1 field_simp; ring theorem exists_far_common_depthND {D₁ D₂ K : ℝ} (hD₁ : 0