feat(coinductive): oracle strategies and DynComputation-backed oracle machines - #498
Merged
Conversation
… machines Reintroduce the coinductive machine layer over current PolyFun: - OracleStrategy/OracleHandler/ProbHandler and the strategy run theory (runAgainst, kleisli iteration, evalSystem, typed transcripts via FreeM.Path) as OracleSpec specializations of PFunctor.DynSystem. - OracleMachine := DynComputation spec.toPFunctor, inheriting Implements, ImplementsWithin, runWith, seqComp, wrap, and the simulation proof method from PolyFun rather than wrapping a bespoke machine type. - The simulateQ bridges (runWith_eq_simulateQ) are definitional, and implements_iff_behavior_eq records that the implementation relation is behavior equality in the cofree carrier. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🤖 PR SummaryAddREADME Statistics
Lean Declarations ✏️ Added: 84 declaration(s)
📄 **Per-File Summaries**
Last updated: 2026-07-25 18:28 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.
|
dtumad
marked this pull request as ready for review
July 25, 2026 18:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fresh implementation of the coinductive machine layer, replacing the closed reference draft
#482. That draft wrapped
PFunctor.PointedMachinefrom the closed PolyFun#29 branch; upstreamreplaced that API with the merged
DynComputationstack (PolyFun#34–#37), so this layer isrebuilt against the current pin rather than rebased.
The intended dictionary is unchanged, but more of it is now definitional or inherited:
OracleComp spec αPFunctor.FreeM spec.toPFunctor αQueryImpl spec mPFunctor.Handler m spec.toPFunctorOracleStrategy S specPFunctor.DynSystem S spec.toPFunctorOracleMachine spec α βDynComputation spec.toPFunctor α βM.Implements/M.ImplementsWithinDynComputation.Implements/.ImplementsWithinVCVio introduces no parallel model of interaction: the machine type, both implementation
relations, fuelled execution (
runWith), sequential composition (ImplementsWithin.seqComp),interface transport (
wrap), and the simulation proof method(
implementsWithin_of_isSimulation) are all consumed from PolyFun directly. The VCVio layer isthe
OracleSpecreading plus the probabilistic semantics.The two-carrier reading
Machines are the intensional, state-carrying presentation (the carrier that cost and
complexity notions must live on); behaviors are the extensional carrier. The upstream
unbounded relation is already stated as behavior equality —
— recorded here as
implements_iff_behavior_eq(anIff.rfl). So implementation facts provedfor machines are mate-facts about behaviors by definition, and remain consumable if a
behavior-first model of the interaction layer lands later.
What this adds
VCVio/OracleComp/Coinductive/DynSystem.lean—OracleStrategy,OracleHandler,ProbHandler, and the strategy run theory:runAgainst, kleisli iteration underprobabilistic handlers, the
OracleComp-as-coalgebra run (advance,evalSystem,runProgram), typed transcripts viaPFunctor.FreeM.Path, reduction lenses, and thedenotational query-bound bridges.
VCVio/OracleComp/Coinductive/Machine.lean—OracleMachine,OracleComp.toMachine(via
DynComputation.ofFreeM, implementing byimplements_ofFreeM), the definitionalsimulateQbridges,implements_iff_behavior_eq, and theImplementsWithinreadings:simulateQ_run_eq(any lawfulQueryImpl),runWithInput_ofFn_eq(deterministic), andprobOutput_none_runWithInput(no mass on fuel exhaustion).Deliberately out of scope
ImplementsWithin.seqCompis consumed from PolyFun as-is.wrapIface(the pointed re-cut ofDynSystem.wrapwith itsrunK_wrapIfaceadjunctionagainst responder pullback) waits for the responder layer, where the handler-level pullback
(
Handler.Stateful.reindex) gives the right statement.Validation
lake build(2995 jobs, green)scripts/check-extern-isolation.sh,scripts/check-interop-isolation.shsorry/axioms; the two salvaged-and-rewritten files build with zero warnings