feat(uc): sampler-level coherence shapes and the scheduled theory's laws - #192
Open
dtumad wants to merge 1 commit into
Open
feat(uc): sampler-level coherence shapes and the scheduled theory's laws#192dtumad wants to merge 1 commit into
dtumad wants to merge 1 commit into
Conversation
Add `OpenProcessSamplerCoherence.lean`: the coherence shapes of `interleave` up to `OpenProcessSamplerEquiv R` — left and right plug factorization, commutation, re-homing, and a derived reassociation — for identically decorated leaves and internal scheduler nodes, with the two nested scheduler draws of a regrouping as the only transport hypothesis. Draws take two samplers per nesting so that the shared sampler of `openTheory` and the mass-dependent samplers of `scheduledOpenTheory` are both instances. Sampler equivalence is a congruence for `interleave` and `mapHom` once the relation family is bind-congruent on the right (`MonadRelFamily.IsBindCongr`; instances for `eq` and `top`) and the injections relabel traces (`OpenNodeContext.EmitsAlong`). Supporting notions move down: `IsInternalNode`, `EmitsAlong`, and the trace relabelling lemma to `OpenProcessInterleave`; the silence and boundary-trace unfoldings of composite-step branches to `OpenProcessCoherence`; `TraceList.mapPartial` to `PFunctor/Trace`. The leaf type of ternary regroupings lives in the new module under its old name. `OpenProcessSamplerFactorization.lean` becomes instances of the shapes with its hypotheses unchanged, plus the congruence laws of the theory. `ScheduledSamplerFactorization.lean` identifies the mass-aware draws with the nested draws, restates `IsCoherent` in the form the shapes consume, proves the five plug laws of `scheduledOpenTheory` from coherence alone, and packages them as `Observation.scheduledSampler` respecting factorization; `scheduledOpenTheory` is now `IsLawful`. 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.
One commit on top of
dtumad/uc-activation-coherence: the coherence shapes of the previous PR, now up toOpenProcessSamplerEquiv R, and the laws of the mass-aware scheduled theory as their instances.OpenProcessSamplerCoherence.leanproves the shapes ofinterleaveup toOpenProcessSamplerEquiv R(left and right plug factorization, commutation, re-homing, and a derived reassociation) for identically decorated leaves and internal scheduler nodes, with the two nested scheduler draws of a regrouping as the only transport hypothesis. Draws take two samplers per nesting so that the shared sampler ofopenTheoryand the mass-dependent samplers ofscheduledOpenTheoryare both instances. Sampler equivalence is a congruence forinterleaveandmapHomonce the relation family is bind-congruent on the right (MonadRelFamily.IsBindCongr; instances foreqandtop) and the injections relabel traces (OpenNodeContext.EmitsAlong).OpenProcessSamplerFactorization.leanbecomes instances of the shapes with its hypotheses unchanged, plus the congruence laws of the theory.ScheduledSamplerFactorization.leanidentifies the mass-aware draws with the nested draws, restatesIsCoherentin the form the shapes consume, proves the five plug laws ofscheduledOpenTheoryfrom coherence alone, and packages them asObservation.scheduledSamplerrespecting factorization;scheduledOpenTheoryis nowIsLawful.Public API delta
Interaction/UC/OpenProcessSamplerCoherence: the shapesinterleave_factorLeft_samplerEquiv,interleave_factorRight_samplerEquiv,interleave_comm_samplerEquiv,interleave_rehome_samplerEquiv,interleave_assoc_samplerEquiv; the congruencesOpenProcess.interleave_congr_{left,right}_samplerEquiv,OpenProcess.mapHom_congr_samplerEquiv; the nested drawsnestedDrawLeft,nestedDrawFactorLeft,nestedDrawFactorRightwith their_bindlemmas; the path equivalencesleftBranchPathEquiv,rightBranchPathEquivand the named treesnestedLeftTree,factorLeftTree,factorRightTree.schedulerFlip(and its_up_*lemmas),flipInterleavePathEquiv,parLeftPathEquiv,parRightPathEquiv,samplePath_interleave_flip,samplePath_interleave_congr_scheduler, andOpenProcessFactorization.LeaftoOpenProcessSamplerCoherence;OpenNodeContext.IsInternalNode,OpenNodeContext.EmitsAlong(exposed; instances for the six structural homs and composition), andboundaryTrace_map_of_emitsAlongtoOpenProcessInterleave; the silence and boundary-trace unfoldings of composite-step branches toOpenProcessCoherence;PFunctor.TraceList.mapPartial(withmapPartial_one,mapPartial_mul) toPFunctor/Trace.MonadRelFamily.IsBindCongrwith instances forMonadRelFamily.eqandMonadRelFamily.top.OpenProcessSamplerFactorization: the fiveopenTheory_plug_*_sampler_equivlaws andopenTheory_{par_comm,par_assoc,wire_comm}_sampler_equivkeep their statements and hypotheses; newopenTheory_{map,par,wire,plug}_congr_{left,right}_sampler_equiv; closed-composite (close_comp_*) and tensor-reindexing lemmas the instances use.ScheduledSamplerFactorization:BinaryScheduler.{sourceDraw_eq_nestedDrawLeft, leftDraw_eq_nestedDrawFactorLeft, rightDraw_eq_nestedDrawFactorRight},BinaryScheduler.IsCoherent.{flip_rel, nestedDrawLeft_rel_factorLeft, nestedDrawLeft_rel_factorRight},scheduledOpenTheory_plug_{comm,par_left,par_right,wire_left,wire_right}_sampler_equiv,Observation.scheduledSampler,Observation.respectsFactorization_scheduledSampler;samplePath_interleave_assoc_{left,right}and the*Draw_bindlemmas keep their statements.scheduledOpenTheorygainsIsLawful.Semantics
ContextHom.comp g₁ f₁ = g₁'and so on), scheduler nodes that areIsInternalNode(including re-decorated ones), and one draw relation. This is stronger than necessary (equal boundaries would do) but it is the literal content of "a regrouping only moves scheduler nodes", and every instance in the model isrfl-level or a tensor reindexing.IsBindCongris needed only by the congruence theorems and the derivedpar_assoc; the plug laws,IsCoherent, and everything VCVio #572 consumes need nothing new. VCVio'soutputRel(equality of output distributions) should satisfy it, since bind with pointwise output-equal continuations gives equal output distributions; that is to be checked when VCVio bumps its pin (to note on VCVio#633).BinaryScheduler.{sourceDraw, leftDraw, rightDraw},IsFlat,IsCoherent,scheduledOpenTheory, and theMonadRelFamilyfields are unchanged;codex/uc-scheduler-denotation(VCVio #572) uses exactly these plus the_bindlemmas ofScheduledSamplerFactorization, which keep their statements.uc.md). A newgotchas.mdentry records why the tree shapes are named abbreviations: pattern-matching lambdas inside statements elaborate to declaration-local matchers, sorwandsimpcannot match them across declarations.Tests
PolyFunTest/ModuleAPI/Interaction.lean:nestedDrawLeft_bind,IsBindCongr.bind_congr_right,interleave_comm_samplerEquiv,respectsFactorization_scheduledSampler,openTheory_wire_comm_sampler_equiv.PolyFunTest/Interaction/UC/SamplerCoherenceExamples.lean: the shapes on both instances,openTheory(laws conditional on the scheduler-transport facts) andscheduledOpenTheory(laws fromIsCoherentalone); atMonadRelFamily.topevery hypothesis is trivial, so both sampler observations respect factorization outright and the wholeEmulatessuite applies; sampler equivalence is a congruence for the theory at the exact and forgetful families.Validation
dtumad/uc-activation-coherence(itself onmainate4099b4). The Lean sources are byte-identical to the version validated during development; only the wiki ledger row and the canary file were merged.git diff --check,scripts/check-imports.sh,scripts/check-modules.sh, both docs-integrity checks,lake build && lake test../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.main; CI for this head is dispatched manually withgh workflow run.Audit note
EmitsAlongholds for the composite injections (instances and.comp).scheduledOpenTheoryis nowIsLawfulwith its five plug laws proved from coherence alone; the sampler-aware laws ofopenTheoryno longer carry their own path-bijection proofs.par_assocwithoutIsBindCongr; any probabilistic instance (VCVio).Stack
2 of 3:
dtumad/uc-activation-coherence→ this PR →dtumad/uc-quotient-theory. Based ondtumad/uc-activation-coherence; review this PR's single commit only, and merge it after its base, once it is retargeted tomain.🤖 Generated with Claude Code
https://claude.ai/code/session_01EtHsoefgvyzMtfdyqjLVhT