import Mathlib import OAI.MeasureTheory.Falconer.Estimates.ActualOuterMasks import OAI.MeasureTheory.Falconer.Estimates.Assembly import OAI.MeasureTheory.Falconer.Model import OAI.MeasureTheory.Falconer.Recursion.BranchTransitions import OAI.MeasureTheory.Falconer.Recursion.Ledger import OAI.MeasureTheory.Falconer.Recursion.Potential import OAI.MeasureTheory.FalconerCompletion.Estimates.SourceWeightedErrorGeneral import OAI.MeasureTheory.FalconerCompletion.Recursion.RecursiveRules namespace OAI /-! Recursive policies and quantitative depth estimates. -/ open _root_.OAI.PlanarFalconer section section open Set MeasureTheory open scoped ComplexConjugate RealInnerProductSpace namespace GraphLiteralSupport.CurrentFalconer.TreeND open Set MeasureTheory Filter PlanarFalconer open scoped ContDiff Classical variable {n : ℕ} theorem uniform_recursive_profile_with_overhead (hn : 1≤n) (Ctest : ℝ) {sig kap theta : ℝ} (hsig : 0 simp only [g,hb,hqeq,eps,Dstar] congr 2 ring dsimp only [terminal] rw [mul_left_comm] exact mul_le_mul_of_nonneg_left hh' (by positivity) have htcap : ∀ state : BranchState,state.Valid e.N sig → state.finish ≤ state.start+100*sourcePolicyBlock e.N kap → ∀ y,e.energies ((2:ℝ)^ell) W total Ψ state y → y≤terminal := by intro state hv ht y hy have hh := hterminal e (by omega) he hq B₀ s hd _ state hv (by simpa only [hqeq] using ht) y hy apply hh.trans apply mul_le_mul (le_max_right Hr Ht) _ (by positivity) (by positivity) apply Real.rpow_le_rpow_of_exponent_le (one_le_pow₀ (by norm_num)) have hdim := mul_le_mul_of_nonneg_right (recursiveLoss_dim_self n Ctest) hsig.le dsimp only [L] change 100*(n+1:ℝ)*(e.q:ℝ)/e.N+4*(n+2:ℝ)*sig≤200*((n+1:ℝ)/2)*(e.q:ℝ)/e.N+C*sig+theta/2 dsimp only [C] have halg : 200*((n+1:ℝ)/2)*(e.q:ℝ)/e.N=100*(n+1:ℝ)*(e.q:ℝ)/e.N := by ring rw [halg] linarith only [hdim,htheta] have hind := DimensionalPolicy.weighted_branch_energy_induction e.profile e.N (sourcePolicyBlock e.N kap) (ell+2) D sig C sig eps (H*((e.N:ℝ)+1)) terminal floor (E*((2:ℝ)^e.N)^(-T)) (H*((2:ℝ)^e.N)^g) (E*((2:ℝ)^e.N)^(-4*(n+2:ℝ))) root (e.energies ((2:ℝ)^ell) W total Ψ) hNp hqp hsig (by nlinarith [Nat.cast_nonneg (α:=ℝ) e.N]) (by positivity) (by positivity) (fun state u l hv hstep => (hvalid e.N (by omega) e.profile state u l hv hstep).1) hbdepth htcap (by intro state hv hr hw M hM hfloorM hchildren y hy obtain ⟨j,b,hb,hbs⟩ := hr have hidx : (b.state 0).index=0 := by rw [hb]; exact hi have hindex := ((hdepth e.N (by omega) e.profile j b hidx).2.2.2 j le_rfl).2 rw [hbs,←hJe] at hindex have hh := hrules e (by omega) he hqeq hJe B₀ s hd state hv (by omega) (by simpa only [hqeq] using hw) M hM hfloorM (fun u l hstep z hz => by have hstep' := hstep rw [hqeq] at hstep' have hh := hchildren u l hstep' z hz simpa only [hCe,C] using hh) y hy exact hh.trans (add_le_add (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (le_max_left Hr Ht) (by positivity)) hM) le_rfl)) htermWeight (fun j b hb => (mul_le_mul_of_nonneg_left hfloor (b.weight_pos C sig eps).le).trans (htermWeight j b hb)) (by intro j b hb have hh := herror e.N (by omega) e.profile hA j b dsimp only [C] at * rw [mul_left_comm] have hh' := mul_le_mul_of_nonneg_left hh hE simpa only [neg_mul] using hh') let b : DimensionalPolicy.PolicyBranch e.profile e.N (sourcePolicyBlock e.N kap) (ell+2) sig 0 := ⟨fun _ => root,fun _ => .low,fun _ _ => hv,by omega⟩ have hh := hind 0 b rfl x hx simpa only [DimensionalPolicy.PolicyBranch.weight_zero,one_mul,Nat.sub_zero] using hh end GraphLiteralSupport.CurrentFalconer.TreeND end end section section open Set MeasureTheory open scoped ComplexConjugate RealInnerProductSpace namespace GraphLiteralSupport.CurrentFalconer.TreeND open Set MeasureTheory Filter PlanarFalconer open scoped ContDiff Classical variable {n : ℕ} noncomputable def profileDimLoss (n : ℕ) (C : ℝ) : ℝ := 500*((n+1:ℝ)/2)+200*recursiveLoss n C lemma profileDimLoss_nonneg (n : ℕ) (C : ℝ) : 0≤profileDimLoss n C := by have h := (recursiveLoss_pos n C).le unfold profileDimLoss positivity theorem uniform_actual_recursive_profile (hn : 1≤n) (Ctest : ℝ) {sig kap eta : ℝ} (hsig : 0 min (A 0 n) (A 1 n) ≤ β)).sup id lemma entryDepthND_spec (A : Fin 2 → ℕ → ℝ) (N : ℕ) {β : ℝ} (h0 : min (A 0 0) (A 1 0) ≤ β) : entryDepthND A N β ≤ N ∧ min (A 0 (entryDepthND A N β)) (A 1 (entryDepthND A N β)) ≤ β ∧ ∀ n, entryDepthND A N β min (A 0 n) (A 1 n)) N β h0 have he : entryDepthND A N β=c := by apply le_antisymm · apply Finset.sup_le intro i hi have hi' := Finset.mem_filter.mp hi have hiN : i ≤ N := by simpa using Finset.mem_range.mp hi'.1 dsimp only [id_eq] by_contra hic exact (not_lt_of_ge hi'.2) (hlast i (by omega) hiN) · apply Finset.le_sup (f := id) exact Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega),hc⟩ rw [he] exact ⟨hcN,hc,hlast⟩ theorem entry_profile_boundsND (A : Fin 2 → ℕ → ℝ) {N : ℕ} (hN : 0