import Mathlib import OAI.Probability.LogConcave.Complexity.Envelope namespace OAI section noncomputable section namespace LogConcaveSampling.OracleCompiler open Filter MeasureTheory ProbabilityTheory open scoped Classical NNReal Topology theorem exists_primitive_producer {κ P : ℝ} (hκ : 0<κ) (hP : 1≤P) : ∃t : ℝ,0 hbud L hL 1 hRd le_rfl⟩ have ha := uniform_routine_accuracy hκ ht hts hw hwt (show P≤J by dsimp [J]; linarith) (show N=numericalLayerCount J from rfl) hb hnum ⟨.sample,1,P⟩ (topLabel_admissible (by linarith) ht.le hsmall) have hq : LogPowerRate (fun d : ℕ => (d:ℝ)^(-κ)) (κ*1) := by simpa only [mul_one] using LogPowerRate.power κ have hqp : ∀ᶠ d : ℕ in atTop,0<(d:ℝ)^(-κ) := by filter_upwards [eventually_ge_atTop (1:ℕ)] with d hd exact Real.rpow_pos_of_pos (by exact_mod_cast hd) _ obtain ⟨K,hK,e,her,hep,he⟩ := ha _ hq hqp refine ⟨t,ht,hts,hsmall,K,hK,e,her,hep,?_⟩ filter_upwards [he,hb,exists_source_shape hκ ht hw n N] with d hd hbd hshape obtain ⟨C,hC⟩ := hshape obtain ⟨B,hB,hbud⟩ := hbd C hC refine ⟨constructRoutine d C ht (by linarith) ⟨.sample,1,P⟩,B,?_,?_,?_⟩ · simpa only [hC.D_eq] using hB · intro r exact hbud _ (topLabel_admissible (by linarith) ht.le hsmall) r 1 (Or.inr rfl) · intro F lam hF hlam hlam1 exact hd C hC hF hlam hlam1 end LogConcaveSampling.OracleCompiler end end end OAI