Std.Do / mvcgen bridge for the Interaction / UC runtime #
Equip the runtime primitives in VCVio.Interaction.UC.Runtime
(Spec.sampleTranscript, Concurrent.StepOver.sample,
Concurrent.ProcessOver.runSteps) with the equational and Hoare-triple
machinery mvcgen needs, so users can prove triples about UC executions
in the same style as VCVio.ProgramLogic.Unary.HandlerSpecs.
Architecture #
The runtime primitives are defined by structural recursion over the
Interaction.Spec tree (for transcript sampling) or over fuel ℕ (for
runSteps). Neither recursion is walked by mvcgen, so we expose the
recursive equations as @[simp] lemmas and provide a closed-form
runSteps_triple_preserves_invariant for the most common
"fuel-indexed invariant" pattern.
The bridge is intentionally monad-parametric: every result is phrased
for an arbitrary [Monad m] [WPMonad m ps]. This covers both
m = ProbComp (coin-flip-only protocols) and
m = OracleComp superSpec (shared random oracle / CRS protocols),
since both carry Std.Do.WPMonad instances via
VCVio.ProgramLogic.Unary.StdDoBridge.
Main results #
Spec.sampleTranscript_done,Spec.sampleTranscript_node— rfl-level unfolding ofSpec.sampleTranscriptfor base and step cases.Concurrent.StepOver.sample_eq— unfoldsStepOver.samplein terms ofsampleTranscript.Concurrent.ProcessOver.runSteps_zero,Concurrent.ProcessOver.runSteps_succ— base and step unfolding ofrunStepson fuel.Concurrent.ProcessOver.runSteps_triple_preserves_invariant— lifts a per-step invariant triple to a whole-runStepstriple, by induction on fuel.
All equations are proved by rfl and are tagged @[simp] so that
mvcgen can walk an exposed sampleTranscript / sample / runSteps
body in one simp pass before the usual do-block traversal.
Invariant preservation for runSteps #
If every one-step execution preserves an invariant I on the
process state, then runSteps n preserves I for any fuel n.
This is the process-runtime analogue of
OracleComp.ProgramLogic.StdDo.simulateQ_triple_preserves_invariant:
a generic invariant lemma that factors out the fuel induction so
downstream proofs stay inside the Std.Do world.
Smoke test: increment process #
A minimal worked example demonstrating the bridge: an always-increment
process over Proc := ℕ whose every step advances the counter by one
without consuming any moves. The counter is trivially monotone and the
whole-execution corollary follows directly from
runSteps_triple_preserves_invariant.