import Mathlib namespace OAI section noncomputable section namespace LogConcaveSampling.OracleCompiler open scoped Classical inductive RoutineKind where | mean | sample deriving DecidableEq structure RoutineLabel where kind : RoutineKind b : ℝ p : ℝ def RoutineLabel.terminal (L : RoutineLabel) : Prop := L.p≤L.b inductive RoutineStep (t : ℝ) : RoutineLabel → RoutineLabel → Prop where | meanFinal (b p : ℝ) : RoutineStep t ⟨.mean,b,p⟩ ⟨.mean,b+t,p⟩ | sampleFinal (b p : ℝ) : RoutineStep t ⟨.sample,b,p⟩ ⟨.mean,b,p⟩ | internal (k k' : RoutineKind) (b p : ℝ) : RoutineStep t ⟨k,b,p⟩ ⟨k',b-10*t,p-1/4⟩ def RoutineLabel.rank (t : ℝ) (L : RoutineLabel) : ℕ := 2*⌈(L.p-L.b)/t⌉₊+(match L.kind with | .mean => 0 | .sample => 1) lemma ceil_gap_drop {t x y : ℝ} (ht : 0 have hd := ceil_gap_drop ht (show 0 simp [RoutineLabel.rank] | internal k k' b p => have hd := ceil_gap_drop ht (show 0 cases k' <;> simp only [RoutineLabel.rank] <;> omega theorem routine_induction {t : ℝ} (ht : 0 by_cases hL : L.terminal · exact hbase L hL · apply hstep L hL intro C hc exact ih _ (hn ▸ hc.rank_lt ht hs hL) C rfl end LogConcaveSampling.OracleCompiler end end end OAI