section ‹Code generation› theory GPV_Code imports "Generative_Probabilistic_Value" "PMF_Code" begin lemma inline_code [code]: "inline oracle gpv s = GPV (map_spmf (λresult. case result of Inl xs ⇒ Pure xs | Inr (out, oracle', rpv) ⇒ IO out (λinput. bind_gpv (oracle' input) (λ(x, s'). inline oracle (rpv x) s'))) (inline1 oracle gpv s))" by(rule gpv.expand)(simp add: inline_sel) lemmas [code] = inline1.simps exec_gpv.simps export_code inline exec_gpv bind_gpv map_gpv lift_spmf in Haskell module_name GPV file code end