Probabilistic loops as chains of distributions #
A bounded loop OracleComp.iterate count step initial that is run with a probabilistic stateful
handler, or evaluated as a closed program, has the law of the count-step chain
Nat.iterate (fun dist => dist.bind next) count (PMF.pure start). In this form, two loops can be
compared one step at a time with Probability.PMF.RepInv.iterate and
Probability.PMF.HiddenCoupling.iterate.
Main results #
Cslib.OracleComp.run_interpret_iterate_pmf: a loop run with a probabilistic stateful handler is the chain on the joint program and handler state.Cslib.ProbComp.eval_iterate: a closed loop evaluates to the chain of its step laws.Cslib.ProbComp.eval_iterate_congr: steps with the same law give loops with the same law.
theorem Cslib.OracleComp.run_interpret_iterate_pmf {ι : Type u} {spec : OracleSpec ι} {State Hidden : Type v} (handler : (q : ι) → StateT Hidden PMF (spec q)) (count : ℕ) (step : State → OracleComp spec State) (initial : State) (hidden : Hidden) :
Running a loop with a probabilistic stateful handler gives the count-step chain of
distributions on the joint program and handler state.
theorem Cslib.ProbComp.eval_iterate {State : Type} (count : ℕ) (step : State → ProbComp State) (initial : State) :
A closed loop evaluates to the count-step chain of its step laws.