Asi ctp-yoneda

CTP-Yoneda Skill

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.md
source 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)

#ChapterTritColorStatus
1Category+1
#E67F86
✓ Complete
2Functor-1
#D06546
✓ Complete
3Natural Transformation0
#1316BB
✓ Complete
4Yoneda Lemma+1
#BA2645
Planned
5Higher Categories-1
#49EE54
Planned
6(Co)Limits0
#11C710
Planned
7Adjunctions+1
#76B0F0
Planned
8(Co)Monads-1
#E59798
Planned
9CCC & λ-calculus0
#5333D9
Planned
10Toposes+1
#7E90EB
Planned
11Kan Extensions-1
#1D9E7E
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

  • Set.rkt
    - Category of sets
  • Rel.rkt
    - Category of relations
  • Proc.rkt
    - Category of procedures
  • Pair.rkt
    - Product category
  • Matr.rkt
    - Matrix categories
  • List.rkt
    - List monoid as category
  • Nat.rkt
    - Natural numbers

Functor Examples

  • DFA.rkt
    - Deterministic finite automata
  • NFA.rkt
    - Nondeterministic finite automata
  • TDFA.rkt
    - Typed DFA
  • Set->Rel.rkt
    - Set to Relation functor
  • P_*.rkt
    ,
    P^*.rkt
    ,
    P_!.rkt
    - Powerset functors
  • SliF.rkt
    ,
    coSliF.rkt
    - Slice functors

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 ConceptMusic-Topos Implementation
CategoryACSets schema
FunctorGeometric morphism
Natural TransformationSchema migration
YonedaRepresentable presheaves
LimitsPullbacks in DuckDB
AdjunctionsGalois connections
MonadsComputation 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. #E67F86
    (+1) - info.rkt
  2. #D06546
    (-1) - main.rkt
  3. #1316BB
    (0) - ctp.scrbl
  4. #BA2645
    (+1) - category/main.scrbl
  5. #49EE54
    (-1) - functor/main.scrbl
  6. #11C710
    (0) - natural transformation/
  7. #76B0F0
    (+1) - code examples

References

Commands

# View CTP docs
just ctp-docs

# Run CTP examples
just ctp-examples

# Verify GF(3) coloring
just ctp-colors