feat(uc): coherence shapes for interleaving; the process model's laws as instances - #191
Open
dtumad wants to merge 5 commits into
Open
feat(uc): coherence shapes for interleaving; the process model's laws as instances#191dtumad wants to merge 5 commits into
dtumad wants to merge 5 commits into
Conversation
…ion` The UC composition theorems only ever consume five equalities: `plug_comm` and the four residual-context factorizations `close_par_left`, `close_par_right`, `close_wire_left`, `close_wire_right`. Until now those were derived inside `Emulates` from the full `HasPlugWireFactor` bundle, which a process model cannot honestly reach: at strong sampler equivalence `interleave unit p` has one more path per step than `p`, so the unit and snake laws have no path bijection. `OpenTheory/PlugFactorization.lean` states the five laws as the class `HasPlugFactorization` on top of `IsLawful`, moves the residual-context formers `parContextLeft`, `parContextRight`, `wireContextLeft`, `wireContextRight` there (they are plain `map`/`wire` composites and are now exposed), proves that every `HasPlugWireFactor` theory is an instance, and re-exports the laws under their existing names, so downstream uses through the strict bundle are unchanged. `Emulates` derives every observation's `RespectsFactorization` from the new class (`respectsFactorization_of_hasPlugFactorization`), and `OpenTheory.pi` lifts the class pointwise. Tests pin that the free model and its families reach the class by instance search and that the whole `Emulates` composition suite elaborates from the class alone. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtHsoefgvyzMtfdyqjLVhT
…tion `ProcessOver.interleaveRouted` keeps the shape of `interleave` and adds a routing hook: after the scheduled side completes a step path, a route may update the other side's state from that path. With the trivial routes it is `interleave` on the nose, and the `mapContext` distribution laws hold verbatim because routes never see the decoration. `OpenProcess.mapHom` re-decorates an open process along an arbitrary node-context hom (`mapBoundary` is the boundary-morphism case), `OpenNodeContext.PreservesActivation` names the homs that silence cannot see (with instances for every structural hom), and `OpenProcess.interleaveRouted` lifts routing to open processes with samplers, with `mapHom` pushing through it on either side. The extensionality helpers `OpenProcess.ext_of_step_eq` and `OpenProcess.heq_step_of_processOver_eq` move out of `OpenProcessModel` and become public. `PolyFunTest/Interaction/UC/RoutedPlugExamples.lean` closes a reactive process against a reactive context by routing every emitted packet across the plug, over the possibilistic `SetM` monad: the real and ideal one-time pad are sampler-bisimilar via the key bijection, a fixed distinguisher reaches both verdicts against either, and it provably never reaches the verdict `false` against a protocol that leaks its plaintext. The structural `plug` of `openTheory` erases packets, so no statement of that shape is available there. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtHsoefgvyzMtfdyqjLVhT
Add `OpenProcessCoherence.lean`: silence of a composite step
(`isSilentStep_interleave{Routed}_{left,right}_iff`), the three shapes
every process-model coherence law is an instance of — reassociation,
commutation, re-homing — with left/right absorption of a silent unit,
and the congruence of activation equivalence under `interleave`
(`interleave_congr_{left,right}`) and `mapHom` (`mapHom_congr`), lifting
delay bisimulations through silent prefixes.
`OpenProcessInterleave.lean` gains the normalization equalities
`mapHom_interleave`, `mapBoundary_interleave`, and
`interleave_mapHom_{left,right}` that push outer re-decoration into the
injections, and exposes `PreservesActivation` for downstream unfolding.
The acceptance test re-derives `par_assoc`, `par_comm`, the left unit
law, and the `plug_par_left` factorization from the generic theorems:
normalize, apply one shape, chain through the congruence.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EtHsoefgvyzMtfdyqjLVhT
Rewrite every law of `openTheory` up to activation equivalence as one instance of `OpenProcessCoherence`: `simp only [openTheory]` exposes the nesting of `interleave`s, the normalization equalities push boundary adaptation into the injections, and reassociation, commutation, re-homing, or unit absorption closes the goal. Each proof is now at most twenty lines; the `implicit_reducible` workaround is gone. The traced laws that had no up-to-equivalence version before — `wire_assoc`, `wire_par_superpose`, and `wire_comm` — are added the same way. Scheduler silence is stated once (`schedulerNode_isActivated`, `map_schedulerNode_isActivated`) and the unit and identity wire get their silence lemmas. All existing names and statements are kept. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EtHsoefgvyzMtfdyqjLVhT
…hapes
Rewrite the four `openTheory_plug_{par,wire}_{left,right}_activation_equiv`
laws as chains of the `OpenProcessCoherence` shapes: normalize the
boundary adaptations into the injections, reassociate the source
`plug (compose W₁ W₂) K`, and commute the inner pair under
`OpenProcess.interleave_congr_right`; the `_right` variants first commute
the composite under `interleave_congr_left`. Each proof is about twenty
lines instead of two hundred; statements, names, `Leaf`, and the
scheduler truth tables consumed by the sampler-aware laws are unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EtHsoefgvyzMtfdyqjLVhT
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.
Five commits, each validated on its own and best reviewed one at a time. Together they replace the one-off proofs of the process model's activation-level laws by three generic coherence shapes, add the traced laws that had no proof before, and name the strict target a process model can honestly reach.
HasPlugFactorization(OpenTheory/PlugFactorization.lean). The UC composition theorems only ever consume five equalities:plug_command the residual-context factorizationsclose_par_left,close_par_right,close_wire_left,close_wire_right. They become a class on top ofIsLawful, strictly weaker thanHasPlugWireFactor: everyHasPlugWireFactortheory is an instance (hasPlugFactorization_of_hasPlugWireFactor, priority 100) andOpenTheory.pilifts it pointwise.Emulatesderives every observation'sRespectsFactorizationfrom the class alone. The residual-context formersparContextLeft,parContextRight,wireContextLeft,wireContextRightmove to the new module and are exposed.Concurrent/RoutedInterleave.lean,UC/OpenProcessInterleave.lean).ProcessOver.interleaveRoutedkeeps the shape ofinterleaveand adds a routing hook: after the scheduled side completes a step path, a route may update the other side's state from that path; with trivial routes it isinterleaveon the nose.OpenProcess.mapHomre-decorates an open process along an arbitrary node-context hom (mapBoundaryis the boundary-morphism case),OpenNodeContext.PreservesActivationnames the homs that silence cannot see (instances for every structural hom), andOpenProcess.interleaveRoutedlifts routing to open processes with samplers.UC/OpenProcessCoherence.lean). Silence of a composite step; the three shapes every activation-level law is an instance of (reassociation, commutation, re-homing) with left and right absorption of a silent unit; congruence ofOpenProcessActivationEquivunderinterleaveandmapHom, lifting delay bisimulations through silent prefixes.OpenProcessInterleavegains the normalization equalities (mapHom_interleave,mapBoundary_interleave,interleave_mapHom_left,interleave_mapHom_right) that push outer re-decoration into the injections.UC/OpenProcessModel.lean). Every law ofopenTheoryup to activation equivalence is nowsimp only [openTheory], normalization, one shape, and the congruence. Proofs are at most twenty lines and theimplicit_reducibleworkaround is gone. The traced lawswire_assoc,wire_par_superpose, andwire_comm, which had no up-to-equivalence version before, are added the same way.UC/OpenProcessFactorization.lean). The fouropenTheory_plug_{par,wire}_{left,right}_activation_equivlaws become chains of the shapes, about twenty lines each instead of two hundred.Every existing law keeps its name and statement.
Public API delta
Interaction/Concurrent/RoutedInterleave,Interaction/UC/OpenProcessInterleave,Interaction/UC/OpenProcessCoherence,Interaction/UC/OpenTheory/PlugFactorization(DAG entries indocs/wiki/repo-map.md;OpenProcessModelnow importsOpenProcessCoherence).OpenTheory.HasPlugFactorization. The instancerespectsFactorization_of_hasPlugWireFactorinEmulatesis replaced byrespectsFactorization_of_hasPlugFactorizationwith the weaker hypothesis. The five laws and the four residual-context formers keep their names and namespace but now live inOpenTheory/PlugFactorizationwith[HasPlugFactorization T]hypotheses.OpenProcess.ext_of_step_eq,OpenProcess.heq_step_of_processOver_eq(fromOpenProcessModeltoOpenProcessInterleave).ProcessOver.interleaveRouted,OpenProcess.mapHom,OpenProcess.interleaveRouted,OpenNodeContext.PreservesActivation,isSilentStep_interleave{Routed}_{left,right}_iff,interleave_{assoc,comm,rehome}_activationEquiv,interleave_unit_{left,right}_activationEquiv,OpenProcess.interleave_congr_{left,right},OpenProcess.mapHom_congr,mapBoundary_eq_mapHom,openTheory_{wire_assoc,wire_par_superpose,wire_comm}_activation_equiv,schedulerNode_isActivated,map_schedulerNode_isActivated,openTheoryUnit_isSilentStep,openTheoryIdWire_isSilentStep.Semantics
HasPlugFactorizationis exactly whatEmulatesconsumes, and it is the strict target a process model can honestly aim for: at strong sampler equivalenceinterleave unit phas one more path per step thanp, so the unit and snake laws ofHasPlugWireFactoradmit no path bijection (recorded in theuc.mdledger row).interleaveRoutedthe scheduled side steps, the route sees the completed path and updates the frozen side.RoutedPlugExamplescloses a reactive process against a reactive context by routing every emitted packet across the plug. It runs over the possibilisticSetMmonad with no probability: the real and ideal one-time pad are sampler-bisimilar via the key bijection, a fixed distinguisher reaches both verdicts against either, and it never reaches the verdictfalseagainst a protocol that leaks its plaintext. The structuralplugofopenTheoryerases packets, so no statement of that shape is available there.PreservesActivationinjections and silent scheduler nodes; the model's instances supply both by instance search plusschedulerNode_isActivated.Tests
PolyFunTest/ModuleAPI/Interaction.lean: the five factorization laws,interleave_eq_interleaveRouted,mapBoundary_eq_mapHom, silence undermapHom,interleave_comm_activationEquiv, andwire_assocandwire_par_superposeonopenTheory.PolyFunTest/Interaction/UC/PlugFactorizationExamples.lean(the free model reaches the class through its strict instance, a family of theories reaches it pointwise, and the wholeEmulatessuite elaborates from the class alone with no unit, identity wire, or snake law in scope),RoutedPlugExamples.lean(above),OpenProcessCoherenceExamples.lean(re-derivespar_assoc,par_comm, the left unit law, andplug_par_leftfrom the shapes: normalize, one shape, chain through the congruence).Validation
mainate4099b4(feat(tocslib): add polynomial-time single-tape toolkit #178). The Lean sources of every commit are byte-identical to the versions validated during development; only the wiki DAG entries and the canary file were merged (one blank line restored).git diff --check,scripts/check-imports.sh,scripts/check-modules.sh, and both docs-integrity checks.lake build && lake teston commits 1, 2, 4, and 5 (the tip)../scripts/validate.sh --lint --test --axiomsat the tip of the stack (dtumad/uc-quotient-theory, which contains this PR): lint passes forPolyFunandToCslib; the axiom sweep reports 11255 declarations across 291 modules with zerosorryand zero non-standard axioms.Audit note
simp only [openTheory]and the normalization equalities); whetherPreservesActivationholds for the composite injections the model uses (instances for the six structural homs and composition); whether routing changesinterleavefor trivial routes (rfl); whether a fixed distinguisher can be fooled by routing (the leaky-protocol example).Emulatesno longer needs the unit and snake laws; the process model's proofs no longer depend onimplicit_reducible; the traced laws now have up-to-equivalence versions.openTheoryitself.HasPlugWireFactor,openTheory, and theEmulatesnames generically (Computational.lean,Standard.lean,Runtime.lean,AsyncSecurity.lean); none of the moved, renamed, or added declarations is referenced there, and VCVio pins PolyFun atc0c9236(28 commits behindmain), so nothing moves downstream until a deliberate bump.Stack
1 of 3: this PR →
dtumad/uc-sampler-coherence→dtumad/uc-quotient-theory.dtumad/uc-drop-machineidis independent. The later PRs are based on this branch; merge bottom-up, after which the next PR is retargeted tomain.🤖 Generated with Claude Code
https://claude.ai/code/session_01EtHsoefgvyzMtfdyqjLVhT