acsets-relational-thinking
БесплатноБез исполняемых скриптовНе проверенACSets (Attributed C-Sets) for categorical database design and DPO rewriting
от plurigrid★ 73 звезды на GitHubОб этом скилле
SKILL: ACSets Relational Thinking
Version: 2.0.0 Trit: 0 (ERGODIC) Domain: database, category-theory, rewriting Source: Topos Institute RelationalThinking Course + AlgebraicJulia
Overview
ACSets (Attributed C-Sets) are functors X: C → Set where C is a small category (schema). This skill integrates:
- RelationalThinking Course - Topos Institute's pedagogical approach
- DPO Rewriting - Double Pushout graph transformation
- Self-Play Loop - Query → Execute → Evaluate → Refine
- GF(3) Conservation - Triadic skill composition
Core Concept: C-Set as Functor
Schema (Category C) Instance (Functor X: C → Set)
┌─────────────────┐ ┌─────────────────────────────┐
│ E ──src──→ V │ X │ X(E) = {e1, e2, e3} │
│ ←──tgt── │ ───→ │ X(V) = {v1, v2} │
└─────────────────┘ │ X(src): e1↦v1, e2↦v1, e3↦v2│
│ X(tgt): e1↦v2, e2↦v2, e3↦v1│
└─────────────────────────────┘
Schema Definition
Basic Graph Schema
using Catlab.CategoricalAlgebra
@present SchGraph(FreeSchema) begin
V::Ob # Vertices (object)
E::Ob # Edges (object)
src::Hom(E, V) # Source morphism
tgt::Hom(E, V) # Target morphism
end
@acset_type Graph(SchGraph, index=[:src, :tgt])
Entity-Subtype Hierarchy (from RelationalThinking Ch8)
@present SchKitchen(FreeSchema) begin
Entity::Ob
Food::Ob
food_in_on::Hom(Food, Entity)
food_is_entity::Hom(Food, Entity)
Kitchenware::Ob
ware_in_on::Hom(Kitchenware, Entity)
ware_is_entity::Hom(Kitchenware, Entity)
BreadLoaf::Ob
bread_loaf_is_food::Hom(BreadLoaf, Food)
Knife::Ob
knife_is_ware::Hom(Knife, Kitchenware)
end
@acset_type Kitchen(SchKitchen)
DPO Rewriting (Double Pushout)
The Pattern: L ← K → R
L ←──l── K ──r──→ R
│ │ │
match│ │ │
↓ ↓ ↓
G ←───── D ──────→ H
pushout pushout
complement
- L = Find (what to match)
- K = Keep (overlap preserved)
- R = Replace (new structure)
- G = Host graph
- H = Result graph
Rule Definition
using AlgebraicRewriting
# Slice bread rule: adds BreadSlice when knife + loaf present
slice_bread = @migration(SchKitchen, begin
L => @join begin
loaf::BreadLoaf
knife::Knife
end
R => @join begin
loaf::BreadLoaf
slice::BreadSlice
food_in_on(bread_slice_is_food(slice)) == food_in_on(bread_loaf_is_food(loaf))
knife::Knife
end
K => @join begin
loaf::BreadLoaf
knife::Knife
end
end)
rule = make_rule(slice_bread, yKitchen)
Apply Rewrite
matches = get_matches(rule, state)
new_state = rewrite_match(rule, matches[1])
Self-Play Loop
The ACSet self-refinement monad:
Query₀ → Execute → Evaluate → Mine Patterns → Refine → Query₁ → ...
Implementation
struct SelfRefinementLoop
schema::Presentation
state::ACSet
patterns::Vector{Pattern}
generation::Int
end
function step!(loop::SelfRefinementLoop, rule::Rule)
# Find matches
matches = get_matches(rule, loop.state)
# Evaluate each match
evaluations = [evaluate_match(m, loop.patterns) for m in matches]
# Mine new patterns from successful evaluations
new_patterns = mine_patterns(evaluations)
append!(loop.patterns, new_patterns)
# Apply best match
best = argmax(e -> e.score, evaluations)
loop.state = rewrite_match(rule, matches[best.index])
loop.generation += 1
loop
end
Convergence Criterion
function converged(loop::SelfRefinementLoop; threshold=0.95)
recent = loop.patterns[end-10:end]
stability = std([p.score for p in recent])
stability < (1 - threshold)
end
GF(3) Integration
Trit Assignment
function acset_to_trits(g::Graph, seed::UInt64)
rng = SplitMix64(seed)
trits = Int[]
for e in parts(g, :E)
h = next_u64!(rng)
hue = (h >> 16 & 0xffff) / 65535.0 * 360
trit = hue < 60 || hue >= 300 ? 1 :
hue < 180 ? 0 : -1
push!(trits, trit)
end
trits
end
# Conservation check
gf3_conserved(trits) = sum(trits) % 3 == 0
Synergistic Triads Containing ACSets
clj-kondo-3color (-1) ⊗ acsets (0) ⊗ rama-gay-clojure (+1) = 0 ✓
three-match (-1) ⊗ acsets (0) ⊗ gay-mcp (+1) = 0 ✓
slime-lisp (-1) ⊗ acsets (0) ⊗ cider-clojure (+1) = 0 ✓
hatchery-papers (-1) ⊗ acsets (0) ⊗ frontend-design (+1) = 0 ✓
Orthogonal Bundles
ACSets participates in the STRUCTURAL bundle:
| Direction | Skills | Behavior |
|---|---|---|
| STRUCTURAL | clj-kondo(-1) ⊗ acsets(0) ⊗ rama-gay(+1) | Schema validation → transport → generation |
| TEMPORAL | three-match(-1) ⊗ unworld(0) ⊗ gay-mcp(+1) | Reduction → derivation → coloring |
| STRATEGIC | proofgeneral(-1) ⊗ glass-bead(0) ⊗ rubato(+1) |
Установить acsets-relational-thinking в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл acsets-relational-thinking?
ACSets (Attributed C-Sets) for categorical database design and DPO rewriting
Как установить скилл acsets-relational-thinking?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл acsets-relational-thinking запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic