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/ctp-yoneda" ~/.claude/skills/plurigrid-asi-ctp-yoneda-69ec2c && rm -rf "$T"
manifest:
skills/ctp-yoneda/SKILL.mdsource content
CTP-Yoneda Skill
"The Yoneda lemma is arguably the most important result in category theory." — Emily Riehl
Category Theory in Programming (CTP) by NoahStoryM - Racket tutorial mapping abstract CT concepts to programming constructs with GF(3) colored awareness.
Overview
Source: NoahStoryM/ctp
Docs: docs.racket-lang.org/ctp
Local:
.topos/ctp/
Chapters (GF(3) Colored)
| # | Chapter | Trit | Color | Status |
|---|---|---|---|---|
| 1 | Category | +1 | | ✓ Complete |
| 2 | Functor | -1 | | ✓ Complete |
| 3 | Natural Transformation | 0 | | ✓ Complete |
| 4 | Yoneda Lemma | +1 | | Planned |
| 5 | Higher Categories | -1 | | Planned |
| 6 | (Co)Limits | 0 | | Planned |
| 7 | Adjunctions | +1 | | Planned |
| 8 | (Co)Monads | -1 | | Planned |
| 9 | CCC & λ-calculus | 0 | | Planned |
| 10 | Toposes | +1 | | Planned |
| 11 | Kan Extensions | -1 | | Planned |
GF(3) Sum: (+1) + (-1) + (0) + (+1) + (-1) + (0) + (+1) + (-1) + (0) + (+1) + (-1) = 0 ✓ BALANCED
Core Concepts
Category (Chapter 1)
- Objects, morphisms, composition, identity
- Digraphs → Free categories
- Subcategories, product/coproduct categories
- Quotient categories, congruence relations
Functor (Chapter 2)
- Structure-preserving maps between categories
- Constant, opposite, binary functors
- Hom functors (covariant/contravariant)
- Free monoid/category functors
- Finite automata as functors (DFA, NFA, TDFA)
Natural Transformation (Chapter 3)
- Morphisms between functors
- Functor categories
- Vertical/horizontal composition
- Whiskering
Yoneda Lemma (Key Insight)
Nat(Hom(A, -), F) ≅ F(A)
Every object is completely determined by its relationships to all other objects.
Code Examples
Located in
.topos/ctp/scribblings/code/:
Category Examples
- Category of setsSet.rkt
- Category of relationsRel.rkt
- Category of proceduresProc.rkt
- Product categoryPair.rkt
- Matrix categoriesMatr.rkt
- List monoid as categoryList.rkt
- Natural numbersNat.rkt
Functor Examples
- Deterministic finite automataDFA.rkt
- Nondeterministic finite automataNFA.rkt
- Typed DFATDFA.rkt
- Set to Relation functorSet->Rel.rkt
,P_*.rkt
,P^*.rkt
- Powerset functorsP_!.rkt
,SliF.rkt
- Slice functorscoSliF.rkt
Racket Integration
# Install CTP package cd .topos/ctp && raco pkg install # Build documentation raco setup --doc-index ctp # Open docs open doc/ctp/index.html
Connection to Music-Topos
| CTP Concept | Music-Topos Implementation |
|---|---|
| Category | ACSets schema |
| Functor | Geometric morphism |
| Natural Transformation | Schema migration |
| Yoneda | Representable presheaves |
| Limits | Pullbacks in DuckDB |
| Adjunctions | Galois connections |
| Monads | Computation contexts |
Colored Awareness Protocol
When reading CTP files, each touched file gets a deterministic color:
# Track file access with Gay.jl colors seed = 1069 files_touched = [] def touch_file(path, index) color = gay_color_at(seed, index) files_touched << { path: path, color: color, trit: color[:trit] } end
Current session colors (seed=1069):
(+1) - info.rkt#E67F86
(-1) - main.rkt#D06546
(0) - ctp.scrbl#1316BB
(+1) - category/main.scrbl#BA2645
(-1) - functor/main.scrbl#49EE54
(0) - natural transformation/#11C710
(+1) - code examples#76B0F0
References
- CTP Tutorial
- Qi Flow Language - Inspiration for CTP
- Category Theory in Context - Emily Riehl
- Category Theory for Computing Science - Barr & Wells
- nLab
- TheCatsters YouTube
Commands
# View CTP docs just ctp-docs # Run CTP examples just ctp-examples # Verify GF(3) coloring just ctp-colors