feat(interaction): allowed-systems sub-theories and relativized emulation - #130
Open
dtumad wants to merge 4 commits into
Open
feat(interaction): allowed-systems sub-theories and relativized emulation#130dtumad wants to merge 4 commits into
dtumad wants to merge 4 commits into
Conversation
…tion Adds `SubTheory T`, a boundary-indexed membership predicate on `T.Obj` carrying closure under `map`, `par`, and `wire`, with `plug` closure and containment of the structural generators split off as mixins. This is the allowed-systems parameter a UC development fixes before stating security: instantiable at a corruption discipline, at a resource bound, or at their meet. `EmulatesWithin` cuts the plug quantifier of `Emulates` down to a sub-theory and restates the composition suite against it. Each theorem gains exactly one hypothesis — the untouched component must itself be allowed — because the residual context handed to the inductive step is built from that component. `OpenSyntax/AtomSubTheory.lean` instantiates the machinery on the free model, where a sub-theory generated by allowed atoms transfers along interpretation into any target sub-theory accepting those atoms. Purely additive: no existing declaration changes, and relativizing to `SubTheory.top` recovers the unrelativized judgments verbatim. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…work Both cost real iterations while building the sub-theory layer and are not specific to it: a predicate whose leading argument is implicit cannot be passed as an argument, and a `def` downstream proofs compute with needs `@[expose]` even inside a `public section`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Summary
PolyFun/Interaction/UC/SubTheory.lean(new).SubTheory Tbundles a boundary-indexedmem : ∀ {Δ}, T.Obj Δ → Propwith closure undermap,par, andwire. Closure underplugis theIsPlugClosedmixin, free forHasPlugWireFactortheories viaplug_eq_wire; containment of the unit and identity wires is theIsStructuralmixin. Plus the order≤withtop,inf, andSubTheory.generatedwith its induction principlegenerated_le.PolyFun/Interaction/UC/EmulatesWithin.lean(new).EmulatesWithin D real ideal Obsrestricts the plug quantifier ofEmulatestoD. The composition suite is restated against it, along withUCSecureWithin, whose simulator must map allowed contexts to allowed contexts.emulatesWithin_top_iffanducSecureWithin_top_iffrecover the unrelativized judgments.PolyFun/Interaction/UC/OpenSyntax/AtomSubTheory.lean(new).atomSubTheoryis the sub-theory ofExpr.theorygenerated by an allowed set of atoms plus the identity wires;interpretSubTheoryis the pullback along interpretation;mem_interpret_of_atomstransfers allowedness from atoms to whole networks.PolyFunTest/Interaction/UC/SubTheoryExamples.lean(new),AGENTS.md, both wiki pages, regeneratedPolyFun.lean.Why
OpenTheorysays how open systems compose. It has never said which open systems one is allowed to build, and every UC development needs that second notion — a corruption model restricts the machines a real protocol may use, an efficiency requirement restricts the machines anyone may use. Nothing predicate-on-objects existed anywhere in the repo before this PR.The reason to make it a first-class object rather than a side condition is the closure fields. Read
memas "implementable within a fixed resource discipline"; thenmem_parandmem_wiresay a network of implementable systems is implementable. That property is normally assumed about a machine model, because stated globally over networks there is no finite obligation to discharge. Here a network is built from four operations, so the assumption is four fields — andSubTheory.generated_lereduces "everything in this protocol class is implementable" to "each generator is".Two things fall out that are worth naming:
EmulatesWithin.par_leftneedsD.mem W₂because the plug it hands to the inductive hypothesis isparContextLeft W₂ K. An abstract account of UC imposes "the map exhibiting the emulation lies in the allowed sub-category" by convention; here there is nowhere else it could come from.UCSecureWithin's first conjunct is thatsimulate ssends allowed contexts to allowed contexts. Under a resource instantiation that reads "the simulator is efficient".Deliberately excluded: any cost, probability, or machine content.
SubTheoryis theOpenTheory-level sibling ofPFunctor.StepClass— a bundled predicate plus its closure proofs, passed explicitly, with mixins for optional structure and an order along which results transport — and the two are meant to meet later at an instantiation ofmemin terms of realizability, not to share code. Nothing here depends onPolyFun/Realizability/.Two design notes that cost iterations and are recorded in the source:
SubTheory.generatedtakes its generator predicate's boundary explicitly. A predicate whose leading argument is implicit has its implicits inserted eagerly when passed as an argument, leaving the boundary as an unsolvable metavariable at every use site.memescapes this only because it is a projection applied to a knownSubTheory.atomSubTheoryneeds no reasoning about theExprquotient. A predicate defined by recursion onRawwould have to be shown invariant under all ofRaw.Equiv;generatedis defined by the operations of the theory, which act on the quotient already.Validation
green (
lake build --wfail,check-modules.sh,check-imports.sh,check-docs-integrity.py,lake lint,lake test). Nosorry, no disabled linters.No-regression evidence:
git diff --statagainst this PR's base touches no existing.leanfile — onlyAGENTS.md, the two wiki pages, the generatedPolyFun.lean, and four new files.Emulates.leanis untouched.emulatesWithin_top_iff/ucSecureWithin_top_iffare the machine-checked form of "this is a conservative extension", and the test file carries a canary thatEmulates.par_composestill reachesExpr.theoryby synthesis alone.plug_composeis exercised on the process-backedopenTheory, which reaches it throughObservation.IsSchedulingInsensitiverather than any strict factorization.Axiom footprints:
SubTheory.generated_le,EmulatesWithin.plug_compose,emulatesWithin_top_iff, anducSecureWithin_top_iffare axiom-free;EmulatesWithin.par_compose,wire_compose, andmem_interpret_of_atomsare within[propext, Classical.choice, Quot.sound].Downstream: VCVio imports
PolyFun.Interaction.UC.Emulatesbut never usesEmulatesorObservation— it re-derives the suite inComputational.lean— so this cannot break it, despite the import suggesting otherwise.Stacked on #121; retarget to
mainonce that merges so the full CI matrix runs (PRs not based onmainonly get 3 checks).🤖 Generated with Claude Code