Runtime-bounded loops with private coins #
RealizesRand.iterate realizes a runtime-bounded loop whose body is a memory client with private
coins. The loop is any family loop d n a satisfying the iteration equations
loop d 0 a = pure a and loop d (n + 1) a = body (d, a) >>= loop d n. The client need not be
rewritten into a canonical form: a recursive client such as link methods (contractTimes n)
satisfies these equations directly. The native code is the loop of Realizes.iterateRuntime
(loopEmit) around the body's emitter.
Every body run must satisfy the body's domain, and the body's time and rand budgets must stay
within the uniform per-iteration budgets T and R, at every state that the loop reaches with
positive probability. With n iterations the loop then takes n * (T + 1) units of time and at
most n * R rand calls on every path. Its law is the law of the loop's run.
Main results #
RealizesRand.iterate: one uniform body certificate realizes a runtime-bounded loop.
The rule is original infrastructure over the existing native loop and ExecRandLaw.
Loops. One uniform body certificate realizes a runtime-bounded loop, given by its
iteration equations. The visible domain asks for the body's domain and per-iteration budgets at
every supported state reached after fewer than fuel iterations.