feat(framework): deferred-sampling + relational-coupling engine#465
Conversation
Reusable, scheme-independent additions underpinning the GPV/Verified-zkEVM#188 and MLDSA/Verified-zkEVM#228 EUF-CMA proofs: the deferred-sampling toolbox (DeferredSampling, ProbeEps), the relational simulateQ coupling engine (Relational/SimulateQ, ProgrammingOracle), and two cost-bound lemmas (EvalDist/Defs/Basic). Pure additions. Claude-Session: https://claude.ai/code/session_01C7GAM6ykxZoXwDXmtdLqrA
Remove the memoryless ε-probe layer (`probeStepEps`/`probeManyEps` + their bounds): a self-contained abstraction with zero references anywhere in the tree. The first-fire theory that is actually used is the hidden-target `readMany`/`hiddenReadList`/`drawList` layer, which is retained. Rewrite the module docstring to describe the retained content, fix the two cross-references that mentioned the removed layer, and drop the now-unused `D` type variable. No statement or proof of any retained declaration changes (build green). Claude-Session: https://claude.ai/code/session_01C7GAM6ykxZoXwDXmtdLqrA
… API removal) Restore `probEvent_le_of_relTriple_simulateQ_run` verbatim alongside the more general `relTriple_simulateQ_run_mono` / `probEvent_le_of_relTriple_imp` it had been generalized into, so this PR is purely additive and no external caller of the specialized lemma breaks. Its proof still goes through the surviving `relTriple_simulateQ_run` + `probEvent_le_of_relTriple`. Claude-Session: https://claude.ai/code/session_01C7GAM6ykxZoXwDXmtdLqrA
Drop the packaged averaged-state-measure telescopers (avgBadM_le_threaded_linear, avgBadM_le_of_steps*), the PMF-typed avgBad layer and its mass/pushforward helpers, and the explicit-list ProbeEps bridges. Downstream proofs telescope directly from the retained bare-measure primitives (avgBadM, postStepOutM, avgBadM_query_bind_eq_tsum_output, tsum_tsum_postStepOutM_mul). Claude-Session: https://claude.ai/code/session_01DaNGD9nDo3Grwk58nsjS77
🤖 PR SummaryFailed to generate AI summary. Please check the per-file summaries and statistics below. Statistics
Lean Declarations ✏️ Removed: 1 declaration(s)
✏️ Added: 60 declaration(s)
Coverage Notes
Partially Analyzed Files
📄 **Per-File Summaries**
Last updated: 2026-07-02 19:09 UTC. |
| /-! ## Expectation algebra for nonnegative functionals -/ | ||
|
|
||
| /-- Expectation of a nonnegative functional under a `pure` computation. -/ | ||
| lemma tsum_probOutput_pure_mul {β : Type} (y : β) (f : β → ℝ≥0∞) : |
There was a problem hiding this comment.
Could you add this in VCVio/EvalDist/Monad/* somewhere and state it over a general monad instead? Also I think this could reasonably be simp.
There was a problem hiding this comment.
Done in e110e6e — moved to VCVio/EvalDist/Monad/Basic.lean (new Expectation algebra section), stated over a general monad with [MonadLiftT m SPMF] [LawfulMonadLiftT m SPMF], and tagged @[simp].
|
|
||
| /-- Tonelli-style rearrangement: the expectation of a nonnegative functional under a | ||
| `bind` is the outer expectation of the inner expectations. -/ | ||
| lemma tsum_probOutput_bind_mul {α β : Type} (oa : ProbComp α) |
There was a problem hiding this comment.
These three other tsum lemmas could be generalized too I think.
There was a problem hiding this comment.
Done — all four now live there. tsum_probOutput_map_mul additionally takes [LawfulMonad m], and tsum_probOutput_mul_of_const_on_support takes [MonadLiftT m SetM] [EvalDistCompatible m] for the support reasoning. The general map lemma also subsumes the private tsum_probOutput_map_mul that ReplayFork.lean was carrying, so that copy is gone too. The two downstream PRs (#466, #467) are rebased onto this.
| (`evalDist_bind_const_neverFails`). See | ||
| `FiatShamirWithAbort.evalDist_deferredDrawRead_eq_drawList_tapeDrawRead` for a worked | ||
| instance. -/ | ||
| def Factorizes {γ τ : Type} (run : ProbComp γ) (tape : ProbComp τ) |
There was a problem hiding this comment.
If you wanted to try I think this theory could also be abstracted into m with LawfulMonadLiftT m SPMF, but we could leave it at ProbComp for now and generalizing later when there is a consumer.
There was a problem hiding this comment.
Agreed — leaving the Factorizes theory at ProbComp for now as you suggest. Both current consumers (the GPV tape factorization in #466 and the Fiat–Shamir-with-abort coupling in #467) instantiate at ProbComp, so I'd rather generalize to [LawfulMonadLiftT m SPMF] once a genuinely monad-parametric consumer exists.
…er any monad Move tsum_probOutput_pure_mul (now simp), tsum_probOutput_bind_mul, tsum_probOutput_map_mul, and tsum_probOutput_mul_of_const_on_support from the deferred-sampling module to EvalDist/Monad/Basic, stated over a general monad with an SPMF lift. The general map lemma subsumes ReplayFork's private copy. Requested in PR Verified-zkEVM#465 review. Claude-Session: https://claude.ai/code/session_01DaNGD9nDo3Grwk58nsjS77
|
Review addressed in e110e6e: the four expectation-algebra lemmas now live in |
dtumad
left a comment
There was a problem hiding this comment.
Thanks, I think this looks good to merge now.
…ot lemmas; adapt WithAbort to Lean 4.31 Drop the two private WithAbort copies of the expectation-algebra lemmas that landed at the EvalDist root in Verified-zkEVM#465 (tsum_probOutput_map_mul et al.) and re-point their uses. Toolchain adaptation: zero_le' deprecation, simpa post-simp defeq checks replaced by default-transparency exact/unfold at the local-spec sites, gcongr reflexive-factor discharge, and a direct Mathlib.Data.Nat.Choose.Cast import for Nat.cast_choose_two. Claude-Session: https://claude.ai/code/session_01DaNGD9nDo3Grwk58nsjS77
Adds the deferred-sampling and relational-coupling engine that the GPV/#188 and MLDSA/#228 security proofs build on. Purely additive: no existing declaration is changed or removed.
What's included
VCVio/OracleComp/QueryTracking/RandomOracle/DeferredSampling.lean— expectation algebra for deferred draws: i.i.d. bind-commutation (evalDist_bind_comm), the ε-multiplicity kernel (tsum_probOutput_fresh_mul_count_le), theFactorizesfront-tape predicate withevalDist_step_commute_tape, and the state-relation transfer lemmatsum_probOutput_simulateQ_run_mul_of_rel.VCVio/OracleComp/QueryTracking/RandomOracle/ProbeEps.lean— hidden-target read games: single-targetq·εbound (probEvent_hiddenReadMany_le), i.i.d. multi-keyn·q·εbound (probEvent_hiddenReadList_le), the averagedE[n]·q·εbridge, single-draw deferral (probEvent_bind_fire_le_of_gen), and the explicit front-blockdrawList.VCVio/ProgramLogic/Relational/SimulateQ.lean(additions) — relational-triple monotonicity/implication lemmas, the single-world expected-query-slack accumulator (probEvent_bad_simulateQ_run_le_expectedQuerySlack), and the bare-measure averaged-bad primitives (avgBadM,postStepOutM,avgBadM_query_bind_eq_tsum_output,tsum_tsum_postStepOutM_mul) used by the aborting-signer coupling.VCVio/ProgramLogic/Relational/ProgrammingOracle.lean(additions) — TV-distance-to-bad-event bounds for programmed random oracles, including the caching/programming bridge consumed by the GPV reduction.VCVio/EvalDist/Defs/Basic.lean(additions) — the first-moment boundprobEvent_le_tsum_probOutput_mul_cost(+ support-restricted variant).A soundness note for reviewers of the averaged-bad layer: the per-output invariant threading is stated over un-normalized sub-probability state measures (
postStepOutMhas no output-conditioning division), which is the formulation that avoids the mass-concentration pathology of a per-output conditioned invariant. The packaged PMF-typed telescoping layer that earlier drafts carried was dropped — both downstream consumers telescope directly from the bare-measure primitives, so only the consumed API ships.Verification
lake buildof the full CI library set: green.#print axiomson the load-bearing engine lemmas (probEvent_le_of_relTriple_simulateQ_run,probEvent_bad_simulateQ_run_le_expectedQuerySlack,tvDist_simulateQ_randomOracle_withProgramming_le_probEvent_bad,probEvent_hiddenReadList_le,probEvent_bind_fire_le_of_gen,tsum_probOutput_fresh_mul_count_le,evalDist_step_commute_tape,tsum_probOutput_simulateQ_run_mul_of_rel): all[propext, Classical.choice, Quot.sound]— nosorryAx, no custom axioms.-Dweak.linter.mathlibStandardSet=true.Relation to the other PRs
The GPV/#188+Falcon PR and the MLDSA/#228 PR are stacked on this branch and consume this engine; this PR must merge first.