Skip to content
Back to skills

Algebraic Rewriting

ASecurity

Category-theoretic graph rewriting with DPO, SPO, and SqPO pushouts for C-Sets. Declarative transformation of acset data structures.

  • 61 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 6, 2026
designgogitdocumentation

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add plurigrid/asi --skill algebraic-rewriting --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Algebraic Rewriting?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Algebraic Rewriting
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/plurigrid-algebraic-rewriting/badge)](https://www.skillsdirectory.com/skills/plurigrid-algebraic-rewriting)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: algebraic-rewriting
description: Category-theoretic graph rewriting with DPO, SPO, and SqPO pushouts for C-Sets. Declarative transformation of acset data structures.
metadata:
  trit: -1
  color: "#0BAD20"
---

# 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 ecosystem


## Para(Optic) atlas

Part of: `para-mensch-commons`.

Files in this skill

  • CONCOMITANT_SKILLS.md2.8 KB
  • SKILL.md2.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.