install
source · Clone the upstream repo
git clone https://github.com/plurigrid/asi
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/plurigrid/asi "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/bkp-interleaving" ~/.claude/skills/plurigrid-asi-bkp-interleaving && rm -rf "$T"
manifest:
skills/bkp-interleaving/SKILL.mdsource content
BKP Interleaving Hub
"The BKP theorem is not five separate results — it is one theorem with five faces." — Synthesis of Blackwell, Kelly & Power (1989)
Trit: 0 (ERGODIC - meta-coordinator) Color: #26D826 (Green) Status: Production Ready Type: Interleaving Hub (not standalone)
Overview
This skill is the deep interleaving of the five BKP 2-monad theory skills:
| Skill | Trit | Role | BKP Face |
|---|---|---|---|
| codescent | -1 | Validator | Coherence verification |
| 2-monad | 0 | Coordinator | Strictness grid |
| doctrinal-adjunction | 0 | Coordinator | Mate correspondence |
| graded-monad | 0 | Coordinator | Index transport |
| flexible-algebra | +1 | Generator | Bicolimit production |
GF(3) Balance: (-1) + 0 + 0 + 0 + (+1) = 0 ✓
1. The BKP Diamond
The five skills form a diamond dependency graph where every edge is a mathematical theorem:
codescent (-1) ╱ │ ╲ ╱ │ ╲ ╱ │ ╲ 2-monad (0) ────── graded (0) ──── doctrinal (0) ╲ │ ╱ ╲ │ ╱ ╲ │ ╱ flexible-alg (+1) Theorem paths (each edge = published result): codescent → 2-monad: "Codescent of bar resolution yields strict T-algebra" (Lack 2002) codescent → flexible-algebra: "Codescent object is flexible" (BKP 1989, Theorem 4.2) codescent → graded-monad: "Graded codescent checks index coherence" (Fujii 2019) codescent → doctrinal-adjunction: "Strictification confirms doctrinal structure" (Kelly 1974) 2-monad → flexible-algebra: "T-Alg has PIE-bicolimits via flexibility" (BKP 1989, Main Theorem) 2-monad → graded-monad: "Graded monad = monad in [ΣM, Cat]" (Street 1972) 2-monad → doctrinal-adjunction: "Adjunction between T-algebras lifts via mates" (Kelly 1974) graded-monad → flexible-algebra: "Graded algebras have flexible representatives" (Katsumata 2014) graded-monad → doctrinal-adjunction: "Index functor adjunction is doctrinal" (Fujii 2019) doctrinal-adjunction → flexible-algebra: "Biadjoint produces flexible algebras" (BKP 1989, §5)
2. Unified Julia Schema (All 5 Combined)
using Catlab.CategoricalAlgebra @present SchBKP(FreeSchema) begin # ═══ FROM 2-MONAD ═══ TwoCategory::Ob Algebra::Ob Morphism::Ob TwoCell::Ob alg_carrier::Hom(Algebra, TwoCategory) alg_action::Hom(Algebra, Algebra) mor_source::Hom(Morphism, Algebra) mor_target::Hom(Morphism, Algebra) cell_source::Hom(TwoCell, Morphism) cell_target::Hom(TwoCell, Morphism) Strictness::AttrType # {-1, 0, +1} for colax/pseudo/lax alg_strictness::Attr(Algebra, Strictness) mor_strictness::Attr(Morphism, Strictness) # ═══ FROM DOCTRINAL ADJUNCTION ═══ Adjunction::Ob LaxCell::Ob ColaxCell::Ob adj_left::Hom(Adjunction, Algebra) adj_right::Hom(Adjunction, Algebra) lax_source::Hom(LaxCell, Adjunction) colax_source::Hom(ColaxCell, Adjunction) mate_lax_to_colax::Hom(LaxCell, ColaxCell) mate_colax_to_lax::Hom(ColaxCell, LaxCell) lax_strictness::Attr(LaxCell, Strictness) colax_strictness::Attr(ColaxCell, Strictness) # ═══ FROM CODESCENT ═══ Level0::Ob # A (source) Level1::Ob # B (face maps) Level2::Ob # C (coherence) CoherenceCell::Ob d0_01::Hom(Level0, Level1) d1_01::Hom(Level0, Level1) d0_12::Hom(Level1, Level2) d1_12::Hom(Level1, Level2) d2_12::Hom(Level1, Level2) s0::Hom(Level1, Level0) sigma_source::Hom(CoherenceCell, Level2) sigma_target::Hom(CoherenceCell, Level2) CodescentObj::Ob cods_map::Hom(Level1, CodescentObj) CocycleStatus::AttrType cocycle::Attr(CoherenceCell, CocycleStatus) # ═══ FROM FLEXIBLE ALGEBRA ═══ FreeAlgebra::Ob PseudoMorphism::Ob section::Hom(Algebra, FreeAlgebra) retraction::Hom(FreeAlgebra, Algebra) classifier::Hom(Algebra, FreeAlgebra) ps_source::Hom(PseudoMorphism, Algebra) ps_target::Hom(PseudoMorphism, Algebra) IsFlexible::AttrType flexible::Attr(Algebra, IsFlexible) # ═══ FROM GRADED MONAD ═══ Grade::Ob GradeMorph::Ob GradedEndo::Ob GradedMult::Ob grade_src::Hom(GradeMorph, Grade) grade_tgt::Hom(GradeMorph, Grade) tensor::Hom(Grade, Grade) unit_grade::Hom(Grade, Grade) endo_grade::Hom(GradedEndo, Grade) mult_left::Hom(GradedMult, Grade) mult_right::Hom(GradedMult, Grade) mult_result::Hom(GradedMult, Grade) EffectLabel::AttrType grade_label::Attr(Grade, EffectLabel) # ═══ CROSS-SKILL MORPHISMS (THE MIXING) ═══ # Codescent → Algebra: strictification output cods_to_alg::Hom(CodescentObj, Algebra) # Algebra → FreeAlgebra → CodescentObj: bar resolution bar_resolve::Hom(Algebra, Level1) # Adjunction → Morphism: lift to T-Alg adj_to_mor::Hom(Adjunction, Morphism) # Grade → Algebra: graded algebra family graded_alg::Hom(Grade, Algebra) # CodescentObj → flexible check cods_flexible::Attr(CodescentObj, IsFlexible) # GradedMult → TwoCell: graded multiplication as 2-cell graded_mult_cell::Hom(GradedMult, TwoCell) # LaxCell → GradeMorph: index category morphism lax_grade::Hom(LaxCell, GradeMorph) # PseudoMorphism → LaxCell: pseudo ↝ lax via classifier pseudo_to_lax::Hom(PseudoMorphism, LaxCell) # CoherenceCell → ColaxCell: cocycle as colax cell cocycle_to_colax::Hom(CoherenceCell, ColaxCell) end @acset_type BKPSystem(SchBKP, index=[:alg_carrier, :mor_source, :mor_target, :adj_left, :adj_right, :d0_01, :d1_01, :cods_map, :section, :retraction, :grade_src, :grade_tgt, :endo_grade, :cods_to_alg, :graded_alg])
Cross-Morphism Semantics
| Cross-Morphism | Source Skill | Target Skill | Theorem |
|---|---|---|---|
| codescent | 2-monad | Bar resolution → strict algebra |
| 2-monad | codescent | Pseudo algebra → bar construction |
| doctrinal-adj | 2-monad | Lifted adjunction → T-morphism |
| graded-monad | 2-monad | Grade m → T_m-algebra |
| codescent | flexible-alg | Codescent object is flexible |
| graded-monad | 2-monad | μ_{m,n} as 2-cell |
| doctrinal-adj | graded-monad | Lax cell indexed by grade |
| flexible-alg | doctrinal-adj | Classifier factorizes pseudo → lax |
| codescent | doctrinal-adj | Cocycle data → colax structure |
3. Pentadic Propagator Chains
Chain 1: The Full BKP Pipeline
TRIGGER: New pseudo T-algebra P arrives graded-monad Identify index category M for P │ scope:change ▼ 2-monad Locate P in strictness grid (pseudo row) │ scope:compose ▼ codescent Form bar resolution T³P ⇛ T²P ⇉ TP │ scope:verify Check cocycle conditions ▼ flexible-algebra Codescent object is flexible retract │ scope:compose ▼ doctrinal-adj Lift any adjunction to T-Alg via mates RESULT: P strictified + flexibility verified + adjunctions lifted
Chain 2: Graded Strictification
TRIGGER: Graded monad T_M with pseudo M-algebra 2-monad View T_M as monad in [ΣM, Cat] │ scope:compose ▼ graded-monad Decompose by grade: T_{-1}, T_0, T_{+1} │ scope:change ▼ codescent Graded bar resolution (one per grade) │ scope:verify GF(3) cocycle: σ_m ⊗ σ_n = σ_{m⊗n} ▼ doctrinal-adj Index functor F: M → M' lifts adjunction │ scope:compose ▼ flexible-algebra Graded flexible algebras generate bicolimits RESULT: GF(3)-graded strictification with index transport
Chain 3: Doctrinal Descent
TRIGGER: Adjunction f ⊣ u between T-algebras doctrinal-adj Compute mate: lax ū ↦ colax f̄ │ scope:compose ▼ 2-monad Place ū in strictness grid (lax column) │ scope:change ▼ codescent Verify codescent of ū-indexed diagram │ scope:verify Cocycle: ū coherent iff mate f̄ coherent ▼ graded-monad Grade the adjunction by effect type │ scope:compose ▼ flexible-algebra f-algebras flexible iff u-algebras flexible RESULT: Adjunction graded + mates verified + flexibility propagated
Chain 4: Effect System Compilation
TRIGGER: Programming language with graded effects graded-monad Parse effect annotations as grades m ∈ M │ scope:compose ▼ doctrinal-adj Effect handlers = doctrinal adjunction │ scope:change (handler u ⊣ effectful f) ▼ 2-monad Effect system = 2-monad on programming cat │ scope:compose ▼ codescent Compile: strictify pseudo-effect-algebra │ scope:verify Verify: no effect leaks (cocycle check) ▼ flexible-algebra Optimize: flexible = can reorder effects RESULT: Effect system compiled with GF(3) conservation
Chain 5: The Coherence Engine
TRIGGER: "Is this pseudo-algebraic structure coherent?" codescent ←── Start: form codescent diagram │ ├──→ 2-monad Which 2-monad T? │ │ │ ├──→ graded-monad Is it graded over M? │ │ │ │ │ └──→ doctrinal-adj Any adjunctions to lift? │ │ │ │ └────────────────────┘ │ │ └──────→ flexible-algebra ←───┘ │ ▼ VERDICT: Coherent iff 1. Cocycle satisfied (codescent) 2. Grid placement correct (2-monad) 3. Index compatible (graded-monad) 4. Mates consistent (doctrinal-adj) 5. Retract exists (flexible-algebra)
4. Five-Skill Composition Theorems
Theorem A: The BKP Pentad
For any 2-monad T on K, the following are equivalent: (i) Every pseudo T-algebra has a codescent strictification [codescent] (ii) The inclusion J: T-Alg_s → T-Alg has a left biadjoint [2-monad] (iii) Every strict T-algebra equivalent to a pseudo one is flexible [flexible-algebra] (iv) The mate correspondence lifts all T-algebra adjunctions [doctrinal-adjunction] (v) For graded T, strictification respects grades [graded-monad] Proof uses all 5 skills in circular dependency: (i) → (iii) → (ii) → (iv) → (v) → (i)
Theorem B: Graded BKP
For M-graded 2-monad T_M: codescent(-1) ⊗ 2-monad(0) ⊗ flexible-algebra(+1) = 0 applied grade-by-grade gives: For each m ∈ M: codescent_m(-1) ⊗ T_m(0) ⊗ flexible_m(+1) = 0 With cross-grade coherence via: doctrinal-adjunction (mates between grades) graded-monad (μ_{m,n} multiplication) GF(3) CONSERVATION: If M = GF(3) itself, then: T_{-1} : validator computations (codescent) T_0 : coordinator computations (2-monad, doctrinal, graded) T_{+1} : generator computations (flexible-algebra) μ : T_m ∘ T_n → T_{m+n mod 3} Conservation: sum of grades ≡ 0 (mod 3) at every composition
Theorem C: The Mate Pentagon
Five skills form a pentagon of mate correspondences: codescent ←─── (strictify) ──── 2-monad │ │ (cocycle) (grid-place) │ │ ▼ ▼ flexible-alg ←── (retract) ─── doctrinal-adj │ │ (generate) (grade-index) │ │ └──────── (graded-flex) ────────┘ │ graded-monad Each edge is a mate correspondence under some adjunction. The pentagon commutes: traversing either way gives same result.
5. SDF Deep Interleaving
The 5 skills map to 4 distinct SDF chapters, creating a covering:
| Skill | SDF Chapter | Concept Cluster |
|---|---|---|
| 2-monad | Ch.6 Layering | Strictness layers, metadata |
| doctrinal-adj | Ch.5 Evaluation | Mate computation, interpretation |
| codescent | Ch.4 Pattern Matching | Cocycle matching, verification |
| flexible-alg | Ch.8 Degeneracy | Redundancy, retract paths |
| graded-monad | Ch.6 Layering | Grade layers, effect tracking |
Cross-Chapter Flows
Ch.4 (Pattern Match) Ch.5 (Evaluation) codescent doctrinal-adj "match cocycle" "evaluate mate" │ │ └──────── Ch.6 (Layering) ─────┘ 2-monad + graded-monad "layer strictness + grades" │ Ch.8 (Degeneracy) flexible-algebra "redundant paths = flexibility"
Insight: The 4 SDF chapters form their own diamond mirroring the BKP diamond.
6. Composite GF(3) Triads (Cross-Skill)
Primary Pentad Triads
# All 5 participate (via representatives) codescent (-1) ⊗ 2-monad (0) ⊗ flexible-algebra (+1) = 0 ✓ [BKP Core] codescent (-1) ⊗ doctrinal-adjunction (0) ⊗ flexible-algebra (+1) = 0 ✓ [Lifting] codescent (-1) ⊗ graded-monad (0) ⊗ flexible-algebra (+1) = 0 ✓ [Graded-BKP] # Cross-skill with external neighbors codescent (-1) ⊗ graded-monad (0) ⊗ operad-compose (+1) = 0 ✓ [Graded-Operadic] sheaf-cohomology (-1) ⊗ doctrinal-adjunction (0) ⊗ synthetic-adjunctions (+1) = 0 ✓ [Adjunction-Monad] segal-types (-1) ⊗ 2-monad (0) ⊗ free-monad-gen (+1) = 0 ✓ [Free-Forgetful] linear-logic (-1) ⊗ graded-monad (0) ⊗ flexible-algebra (+1) = 0 ✓ [Resource-Flexible] covariant-fibrations (-1) ⊗ doctrinal-adjunction (0) ⊗ flexible-algebra (+1) = 0 ✓ [Fibered-Flexible]
Novel Triads (Discovered by Mixing)
# codescent validates what graded-monad coordinates for flexible-algebra to generate codescent (-1) ⊗ graded-monad (0) ⊗ flexible-algebra (+1) = 0 ✓ [Graded-Flex-Codescent] "For each grade m, the codescent of T_m-algebra is flexible" # codescent validates what doctrinal-adj coordinates for free-monad-gen to generate codescent (-1) ⊗ doctrinal-adjunction (0) ⊗ free-monad-gen (+1) = 0 ✓ [Free-Codescent] "Codescent of free resolution lifts doctrinally" # linear-logic constrains what 2-monad coordinates for flexible-algebra to generate linear-logic (-1) ⊗ 2-monad (0) ⊗ flexible-algebra (+1) = 0 ✓ [Resource-Algebraic] "Linear resource tracking → graded flexibility" # segal-types constrain what graded-monad coordinates for flexible-algebra to generate segal-types (-1) ⊗ graded-monad (0) ⊗ flexible-algebra (+1) = 0 ✓ [Segal-Graded-Flex] "Segal condition on graded composition → flexible graded algebras"
7. The BKP State Machine
States: {PSEUDO, BAR, CODESCENT, STRICT, FLEXIBLE, LIFTED, GRADED} Transitions (each fires a propagator chain): PSEUDO ──[bar_resolve]──→ BAR 2-monad: form T³P ⇛ T²P ⇉ TP BAR ──[codescent_compute]──→ CODESCENT codescent: compute universal cocone CODESCENT ──[cocycle_check]──→ STRICT (if cocycle satisfied) codescent: verify σ₀(d₀) ∘ σ₁(d₀) = σ₀(d₁) CODESCENT ──[cocycle_fail]──→ PSEUDO (if cocycle violated) codescent: report violation, return to start STRICT ──[flexibility_check]──→ FLEXIBLE flexible-algebra: verify retract of free exists FLEXIBLE ──[doctrinal_lift]──→ LIFTED doctrinal-adjunction: compute mates for all adjunctions LIFTED ──[grade_decompose]──→ GRADED graded-monad: decompose by effect grades GRADED ──[grade_compose]──→ STRICT graded-monad: μ_{m,n} recombines graded algebras Any state ──[2-monad-locate]──→ Same state + grid position 2-monad: identify position in strictness grid
┌──────────────────────────────────────────────┐ │ │ ▼ │ PSEUDO ──→ BAR ──→ CODESCENT ──→ STRICT │ │ │ │ fail │ ┌────┘ │ │ ▼ │ └── FLEXIBLE ──→ LIFTED ──→ GRADED
8. Commands (Unified Pipeline)
# Full BKP pipeline just bkp-pipeline pseudo-alg # PSEUDO → BAR → CODESCENT → STRICT → FLEXIBLE → LIFTED → GRADED # Individual steps just bkp-bar-resolve T pseudo-alg # Form bar resolution (2-monad + codescent) just bkp-strictify pseudo-alg # Codescent-based strictification just bkp-flex-check strict-alg # Check flexibility (retract of free) just bkp-doctrinal-lift f u T # Lift adjunction via mates just bkp-grade-decompose T M # Decompose by grades # Cross-skill verification just bkp-pentad-verify # Run all 5 coherence checks just bkp-pentagon-commute # Verify mate pentagon commutes just bkp-gf3-graded-check T # GF(3) conservation per grade # Exploration just bkp-diamond # Display dependency diamond just bkp-chains # List all propagator chains just bkp-state T pseudo-alg # Show current BKP state machine position
9. Deep Mixing Examples
Example 1: Monoidal Category Coherence
Problem: Show every monoidal category is monoidally equivalent to a strict one. Step 1 [2-monad]: T = free strict monoidal category monad on Cat Step 2 [graded-monad]: Grade by associator complexity (ℕ-graded) Step 3 [codescent]: Bar resolution of pseudo T-algebra (monoidal cat) Step 4 [codescent]: Verify pentagonal cocycle (Mac Lane's pentagon) Step 5 [flexible-algebra]: Codescent object is flexible strict monoidal Step 6 [doctrinal-adjunction]: Monoidal adjunctions lift automatically All 5 skills fire. Mac Lane coherence = BKP pentad for free-monoid 2-monad.
Example 2: Effect System Compilation
Problem: Compile graded effect types to efficient code. Step 1 [graded-monad]: Parse effect types as grades M = {IO, State, Error} Step 2 [2-monad]: Effect system = 2-monad on category of computations Step 3 [doctrinal-adjunction]: Effect handler = doctrinal adjunction (handler is right adjoint, effectful code is left adjoint) Step 4 [codescent]: Strictify: pseudo-effect-algebra → strict (eliminate unnecessary effect coercions) Step 5 [flexible-algebra]: Flexible = effects can be reordered (commutativity up to retract) Result: Optimized effect compilation with GF(3) conservation: IO(-1) + State(0) + Error(+1) = 0 per computation block
Example 3: IES Session Type Verification
Problem: Verify session types for distributed protocol. Step 1 [graded-monad]: Session steps are grades (Protocol category M) Step 2 [2-monad]: Session monad = 2-monad on typed channels Step 3 [doctrinal-adjunction]: Client/server = adjoint pair Mate: lax(server) ↔ colax(client) Step 4 [codescent]: Protocol coherence = cocycle condition (sequential composition respects protocol graph) Step 5 [flexible-algebra]: Flexible session = can buffer/reorder messages without breaking protocol GF(3) conservation per session: Send(-1) + Route(0) + Recv(+1) = 0 per protocol round
10. Neighbor Awareness (Meta-Level)
Inbound (skills that use the BKP hub)
| Source | Fires When |
|---|---|
| open-games | Para(Optic) needs 2-monadic structure |
| linear-logic | Resource tracking needs graded effects |
| topos-adhesive-rewriting | Adhesive rewriting in T-Alg |
| acsets-algebraic-databases | C-Set migration via Kan + doctrinal |
| segal-types | Validate categorical structure |
| sheaf-cohomology | Descent = dual of codescent |
Outbound (BKP hub provides to)
| Target | Provides |
|---|---|
| free-monad-gen | Free T-algebras for retraction |
| kan-extensions | Lan/Ran via doctrinal adjunction |
| synthetic-adjunctions | Adjunction generation + lifting |
| infinity-operads | Operadic algebras via 2-monadic structure |
| elements-infinity-cats | ∞-categorical codescent |
| gf3-tripartite | GF(3) as index category for graded monad |
11. References
- Blackwell, R., Kelly, G.M. & Power, A.J. (1989). "Two-dimensional monad theory." JPAA 59:1-41
- Kelly, G.M. (1974). "Doctrinal adjunction." LNM 420:257-280
- Lack, S. (2002). "Codescent objects and coherence." JPAA 175:223-241
- Lack, S. (2010). "A 2-categories companion." IMA Vol. Math. Appl. 152:105-191
- Fujii, S. (2019). "Towards a formal theory of graded monads." FSCD 4:1-17
- Katsumata, S. (2014). "Parametric effect monads." POPL
- Street, R. (1972). "The formal theory of monads." JPAA 2:149-168
- Weber, M. (2015). "Operads as polynomial 2-monads." TAC 30:1659-1712
SDF Interleaving
Primary Chapter: 6. Layering (shared with 2-monad + graded-monad)
The BKP hub layers all 5 skills. Each layer adds structure:
Layer 0: Raw type (no monad) Layer 1: 2-monad T identified [2-monad] Layer 2: Strictness grid position [2-monad] Layer 3: Bar resolution formed [codescent] Layer 4: Cocycle verified [codescent] Layer 5: Flexibility checked [flexible-algebra] Layer 6: Adjunctions lifted [doctrinal-adjunction] Layer 7: Grades decomposed [graded-monad]
GF(3) Balanced Triad
codescent (-1) + bkp-interleaving (0) + flexible-algebra (+1) = 0 ✓
Skill Trit: 0 (ERGODIC - meta-coordination)