Running a program under a cost budget, computably #
Machine.evalData runs a program to completion and is only partial recursive; and
Cost.evalWithin, which reads off the result of a run within a budget, is noncomputable —
it picks a witness out of an existential with Classical.choice. Neither can be used to
compute anything, and the tabulation of a verifier's game (blueprint
rem:compression-abstract, item 3) has to compute: it runs the decider on every answer tuple
under the decider's own time bound and fills in an acceptance table.
Machine.runForD p x k is the computable version: iterate the machine's step function
3 k times from the initial configuration and read off the result if the configuration
reached is final. Three facts make it right:
- a derivation of cost
tis a machine run of at most3 tsteps (Machine.eval_steps_count— the free steps, entering a loop and returning to aconsorletframe, are each matched with a paid one), so the budget3 kis enough for every run of cost at mostk; - final configurations are fixed by the step function (
Machine.step_final), so iterating past the end is harmless and no exact step count is needed; - the step function is primitive recursive on the encoded configurations
(
Machine.primrec_stepData), so the whole is (Machine.primrec_runForD).
runForD_eq_some and runs_of_runForD are the two directions of its correctness, and
runForD_isSome_iff the decision procedure they add up to: for a program that halts within
the budget on the input, whether it returns a given value is decidable, which is what
boundedness buys the tabulation.
Finality of a configuration as a Bool, so that the budgeted run is a plain branch.
Equations
Instances For
Running p on x under a cost budget k: iterate the step function 3 k times and
read off the result if the configuration reached is final. Total and computable.
Equations
- One or more equations did not get rendered due to their size.