algebraic-rewriting
Category-theoretic graph rewriting with DPO, SPO, and SqPO pushouts for C-Sets. Declarative transformation of acset data structures.
Best use case
algebraic-rewriting is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Category-theoretic graph rewriting with DPO, SPO, and SqPO pushouts for C-Sets. Declarative transformation of acset data structures.
Teams using algebraic-rewriting should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/algebraic-rewriting/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How algebraic-rewriting Compares
| Feature / Agent | algebraic-rewriting | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Category-theoretic graph rewriting with DPO, SPO, and SqPO pushouts for C-Sets. Declarative transformation of acset data structures.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Algebraic Rewriting
## Overview
**AlgebraicRewriting.jl** is a Julia library for performing category-theoretic rewrites over C-Sets and other Catlab.jl data structures.
## Rewriting Approaches
| Type | Description | Use Case |
|------|-------------|----------|
| **DPO** | Double Pushout | Safe deletion (no dangling edges) |
| **SPO** | Single Pushout | Greedy deletion |
| **SqPO** | Sesqui-Pushout | Cloning + deletion |
## Core Concepts
### Rewrite Rules
A rewrite rule consists of:
- **L** (left) - Pattern to match
- **K** (interface) - What to preserve
- **R** (right) - Replacement pattern
```julia
using AlgebraicRewriting
# Define a rule: merge two vertices
L = @acset Graph begin V=2; E=1; src=[1]; tgt=[2] end
K = @acset Graph begin V=1 end
R = @acset Graph begin V=1 end
rule = Rule(L, K, R)
```
### Apply Rewriting
```julia
G = @acset Graph begin
V = 4
E = 3
src = [1, 2, 3]
tgt = [2, 3, 4]
end
# Find matches and rewrite
matches = homomorphisms(L, G)
G′ = rewrite(rule, G, matches[1])
```
## Double Pushout (DPO)
```
L ←─ K ─→ R
↓ ↓ ↓
G ←─ D ─→ H
```
The context D ensures no "dangling edges" after deletion.
## Sesqui-Pushout (SqPO)
Supports cloning via the final pullback complement:
```julia
# Clone a vertex
L = @acset Graph begin V=1 end
K = @acset Graph begin V=1 end
R = @acset Graph begin V=2 end
clone_rule = Rule(L, K, R; type=:SqPO)
```
## Gay.jl Integration
```julia
# sRGB boundary learning with rewriting seed
gay_seed!(0xabfca37b6b4bc699)
# Forward mode autodiff
∂params = Enzyme.gradient(Forward, loss, params, seed)
```
## Documentation
- [Full Documentation](https://algebraicjulia.github.io/AlgebraicRewriting.jl/dev/)
- [Brown 2022](https://arxiv.org/abs/2111.03784) - Theoretical foundation
## Repository
- **Source**: plurigrid/AlgebraicRewriting.jl (fork of AlgebraicJulia)
- **Seed**: `0xabfca37b6b4bc699`
- **Index**: 496/1055
- **Color**: #c25d0b
## GF(3) Triad
```
algebraic-rewriting (-1) ⊗ acsets-hatchery (0) ⊗ gay-monte-carlo (+1) = 0 ✓
```
## Related Skills
- `acsets-hatchery` - ACSet data structures
- `topos-adhesive-rewriting` - Adhesive categories
- `dpo-rewriting` - Graph transformation
- `world-a` - AlgebraicJulia ecosystemRelated Skills
topos-adhesive-rewriting
Adhesive categories for incremental query updating and pattern rewriting
homoiconic-rewriting
Unified homoiconic graph rewriting - λ-calculus, interaction nets, ACSets, CUDA parallelism
categorical-rewriting-triad4
Categorical Rewriting: Triad 4 (World Transformation)
Safe Rewriting Advisor
**Category**: Graph Optimization + Remediation
codex-self-rewriting
Lisp machine self-modification patterns via MCP Tasks and Narya bridge types
acsets-algebraic-databases
ACSets (Attributed C-Sets): Algebraic databases as in-memory data structures. Category-theoretic formalism for relational databases generalizing graphs and data frames.
zx-calculus
Coecke's ZX-calculus for quantum circuit reasoning via string diagrams with Z-spiders (green) and X-spiders (red)
zulip-cogen
Zulip Cogen Skill 🐸⚡
zls-integration
zls-integration skill
zig
zig skill
zig-syrup-bci
Multimodal BCI pipeline in Zig: DSI-24 EEG, fNIRS mBLL, eye tracking IVT, LSL sync, EDF read/write, GF(3) conservation
zig-programming
zig-programming skill