import Mathlib import OAI.MeasureTheory.Falconer.Model import OAI.MeasureTheory.Falconer.Recursion.MinimalDescriptorLength import OAI.MeasureTheory.Falconer.Recursion.PolicyDescriptors import OAI.MeasureTheory.FalconerCompletion.Graphs.SharedBinSupportCollision namespace OAI /-! Recursive policies and quantitative depth estimates. -/ open _root_.OAI.PlanarFalconer section section open Set MeasureTheory open scoped ComplexConjugate RealInnerProductSpace namespace GraphLiteralSupport namespace CurrentFalconer.TreeND open Set Metric MeasureTheory PlanarFalconer open scoped ENNReal RealInnerProductSpace variable {d : ℕ} noncomputable def nominalRadius (N : ℕ) (sig : ℝ) (l : ℕ) : ℝ := min 1 (1/(2:ℝ)^l*((2:ℝ)^N)^(50*sig)) lemma testWidth_gap (N : ℕ) (sig : ℝ) {J : ℕ} (hJ : 0 g ≤ p ∧ p ≤ N | .projection p t => p ≤ t ∧ t ≤ N lemma policyDescriptor_valid (A : ℕ → ℝ) {N q a t : ℕ} (hq : 0 < q) (ht : t ≤ N) {b : PolicyDescriptor} (hb : b ∈ policyDescriptorList A N q a t) : ValidDescriptor N b := by obtain ⟨s,u,_,hut,_,_,hpos,_,hbound⟩ := policyDescriptor_origin A hq hb cases b <;> simp only [descriptorLength,descriptorAnchor,ValidDescriptor] at * <;> omega lemma policyDescriptor_anchor_le_end (A : ℕ → ℝ) {N q a t : ℕ} (hq : 0 < q) {b : PolicyDescriptor} (hb : b ∈ policyDescriptorList A N q a t) : descriptorAnchor b ≤ t := by obtain ⟨_,u,_,hut,_,_,_,_,hu⟩ := policyDescriptor_origin A hq hb omega lemma uniform_descriptorGood_transfer {sig : ℝ} (hsig : 0 exact ⟨hw,(Nat.cast_le.mpr (fullParallelCount_transfer ρ g p P hg.1 hw hd (h₁ N ((le_max_left _ _).trans hN) g p hb.1 i))).trans hg.2⟩ | projection p t => apply And.intro hw apply (fullProjectionCollision_transfer ρ P hd ?_).trans hg.2 simp only [descriptorAnchor] at hP rw [hP] exact h₂ N ((le_max_right _ _).trans hN) p t hb.1 i lemma dyadic_ratio_nominal {a p l N : ℕ} {sig : ℝ} (hsig : 0 ≤ sig) (hl : a+l≤p) : (2:ℝ)^a/(2:ℝ)^p ≤ nominalRadius N sig l := by have hb : (2:ℝ)^a/(2:ℝ)^p ≤ 1/(2:ℝ)^l := by apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr rw [one_mul,← pow_add] exact pow_le_pow_right₀ (by norm_num) hl have hR : 1 ≤ ((2:ℝ)^N)^(50*sig) := Real.one_le_rpow (one_le_pow₀ (by norm_num)) (by positivity) apply le_min · exact (div_le_one (by positivity)).mpr (pow_le_pow_right₀ (by norm_num) (by omega)) · exact hb.trans (by simpa only [mul_one] using mul_le_mul_of_nonneg_left hR (by positivity : 0≤1/(2:ℝ)^l)) lemma same_tree_ancestor {P A : CellPath d} {a p : ℕ} (hP : P.length=p) (hA : A.length=a) (hap : a≤p) {x x' : EuclideanSpace ℝ (Fin d)} (hxA : x ∈ treeCell A) (hx : x ∈ treeCell P) (hx' : x' ∈ treeCell P) : x' ∈ treeCell A := by have hlen : (P.take a).length=A.length := by simp [List.length_take,hP,hA,hap] have he : P.take a=A := by by_contra hn exact Set.disjoint_left.mp (treeCell_disjoint hlen hn) (treeCell_subset_take _ _ hx) hxA simpa only [he] using treeCell_subset_take P a hx' lemma fine_radial_dist {X Y P Q : CellPath d} {a p : ℕ} {K : ℝ} (hK : 1000*(d+1:ℝ)