feat(coinductive): probabilistic responders, wired runs, and the IND-CPA responder presentation - #499
Conversation
…the IND-CPA responder presentation Reintroduce the responder layer over current PolyFun, replacing the closed reference draft #483: - ProbResponder: stateful probabilistic challengers as SPMF Kleisli-Mealy coalgebras, definitionally interchangeable with stateful QueryImpls; smart constructors are reducible so responder State spellings stay interchangeable during unification. - Strategy wiring stepAgainst/iterateAgainst as PolyFun stepWith/iterWith at SPMF (renamed from the legacy wireK* family, whose runK namesake no longer exists). - OracleMachine.runAgainst: fuelled machine-vs-responder runs, with the wrap/pullback interface adjunction factored through the new DynComputation.unroll_wrap and ProbResponder.liftM_mapLens_pullback rather than fuel induction. - IND-CPA: the cached LR oracle as a responder, the machine-level distribution bridge, and message swapping as a lens with the reduction a one-line instance of the generic adjunction. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🤖 PR SummaryThis PR adds a probabilistic responder layer to the coinductive oracle machine framework, replacing the retired Statistics
Lean Declarations ✏️ Added: 47 declaration(s)
📋 **Additional Analysis**The diff is largely well-structured and adheres to the documentation, style, and attribution requirements. Two new files violate the prologue layout by missing a blank line between the copyright header and the imports block, as required by the style guide. 📄 **Per-File Summaries**
Last updated: 2026-07-25 18:56 UTC. |
Build Timing Report
Incremental Rebuild Signal
This compares a clean project build against an incremental rebuild in the same CI job; it is a lightweight variability signal, not a full cross-run benchmark. Slowest Current Clean-Build FilesShowing 20 slowest current targets, with comparison against the selected baseline when available.
|
Motivation
Fresh implementation of the responder layer, replacing the closed reference draft #483. That
draft was stacked on the retired
PointedMachineAPI; this version sits on the merged machinelayer (#498) and on PolyFun's current
Handler.Stateful/stepWith/iterWith(PolyFun#101),which delivered the generic stateful-handler theory the old draft had to hand-roll.
The guiding principle is unchanged: cryptography in VCVio is a thin probabilistic layer over
PolyFun interaction. The existing cached IND-CPA oracle remains the source of truth; this PR
gives it a PolyFun-compatible responder presentation via lenses.
What this adds
Coinductive/Responder.lean—ProbResponder spec: stateful probabilistic challengers asMealy coalgebras in the Kleisli category of
SPMF(a joint answer/next-state draw — essentialfor lazily sampled oracles, where the cached entry must be the answer actually returned).
Definitionally interchangeable with
QueryImpl spec (StateT State SPMF); the deterministic(
Id) sibling of PolyFun'sResponder.equivStateHandler. Constructors from handlers, handlerfamilies, deterministic responders, and stateful
ProbCompimplementations (the lazy randomoracle is the motivating instance). Strategy wiring
stepAgainst/iterateAgainstis PolyFun'sstepWith/iterWithatm := SPMF, plustranscriptAgainstonQueryLog.Coinductive/WiredRun.lean—OracleMachine.runAgainst: fuelled machine-vs-responderruns, definitionally
runWithatm := StateT R.State SPMF. The step laws are inherited fromDynComputationbounded execution; the memoryless collapse recovers the plain handler run.The interface-wrapping adjunction
runAgainst_wrap— wrapping the adversary forward alonga lens equals pulling the responder back — is now a two-step factoring rather than a fuel
induction:
DynComputation.unroll_wrap(added inMachine.lean; pureFreeM-level, anupstream candidate) composed with
ProbResponder.liftM_mapLens_pullback(handler-levelnaturality, machine-free).
INDCPA/Oracle.lean— the cached LR oracle asIND_CPA_responder(a thinofStateQueryImplwrapper;IND_CPA_queryImpl'stays the source of truth), the machine-leveldistribution bridge
runAgainst_IND_CPA_responder_eq, and left/right message swapping as aPolyFun lens whose machine reduction
runAgainst_IND_CPA_swapis a one-line instance of thegeneric adjunction.
Naming and API notes
wireK*names are gone: they referenced the oldrunK(fuel-krun on theretired
PointedMachine), which no longer exists. The run family is nowrunAgainst/stepAgainst/iterateAgainst/transcriptAgainst, matching thepattern-runs-on-matter vocabulary (
runAgainst= run the adversary pattern against thechallenger matter).
@[reducible]: statements freely mix(pullback w R).Statewith
R.State(and similar), and keeping those interchangeable at reducible transparency iswhat lets
rw/simptraverse such goals — the earlier draft needed trailingrfls exactlywhere this was missing. Remaining handler-layer normalization uses PolyFun#103's
handler_nfsimp set.Proposed PolyFun follow-ups
DynComputation.unroll_wrap(unrolling commutes withwrap) belongs next to the otherbounded-execution lemmas.
liftM_mapLens_pullback—FreeM.liftM h (FreeM.mapLens w f) = FreeM.liftM (fun t => w.toFunB t <$> h (w.toFunA t)) ffor any lawful monad — isHandler-level naturality with no responder content.Deliberately out of scope
PresentationHomterritory upstream).Validation
lake build(3002 jobs, green; only pre-existingsorrywarnings onmain)scripts/check-extern-isolation.sh,scripts/check-interop-isolation.shsorry/axioms; no linter warnings in the added files