home / skills / plurigrid / asi / local-compositionality-gadget

local-compositionality-gadget skill

/skills/local-compositionality-gadget

This skill applies local compositionality dynamics to maintain GF(3) conservation while coordinating triadic gadget updates.

npx playbooks add skill plurigrid/asi --skill local-compositionality-gadget

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.3 KB
---
name: local-compositionality-gadget
description: 'Local Compositionality Gadget'
version: 1.0.0
---

# Local Compositionality Gadget

ERGODIC local update step gadget via Blume-Capel dynamics with GF(3) conservation.

## Trit: 0 (ERGODIC)

This gadget serves as the neutral coordinator in triadic systems.

## Core Concept

Combines:
1. **Blume-Capel dynamics** for spin-1 {-1, 0, +1} state transitions
2. **Three-Gadget rewriting** (RED/BLUE/GREEN) from `crdt_egraph`
3. **ERGODIC update** as the neutral coordinator role

## GF(3) Conservation by Construction

**Key Insight**: Trits are generated in triplets that algebraically sum to zero.

Given two random trits t₁, t₂, the third is computed as:
```
t₃ = -(t₁ + t₂) mod 3
```

This guarantees: `t₁ + t₂ + t₃ ≡ 0 (mod 3)` for every triplet.

## Gadget Patterns

| Gadget | Trit | Pattern | Polarity |
|--------|------|---------|----------|
| BLUE | -1 | `a ⊕ (b ⊕ c) → (a ⊕ b) ⊕ c` | Negative |
| GREEN | 0 | `a ≡ a` | Neutral |
| RED | +1 | `(a ⊕ b) ⊕ c → a ⊕ (b ⊕ c)` | Positive |

## 4-Phase Saturation

1. **Backfill** (step mod 4 = 0) - BLUE gadgets decompose structure
2. **Verify** (step mod 4 = 1) - GREEN identity rules for verification  
3. **Live** (step mod 4 = 2) - RED associative rules to compose
4. **Reconcile** (step mod 4 = 3) - Final GF(3) conservation check

## Usage

```bash
# Run 9 local update steps with seed 0x42D (1069 decimal)
bb scripts/local_compositionality_gadget.bb --seed 1069 --steps 9

# Run with hex seed
bb scripts/local_compositionality_gadget.bb --seed 0x42D --steps 9

# Run 27 steps (9 complete triplets)
bb scripts/local_compositionality_gadget.bb --seed 12345 --steps 27
```

## GF(3) Conservation Guarantee

**ALWAYS** conserved: `∑ gadget_trits ≡ 0 (mod 3)`

Enforced by triplet structure: For every 3 steps, sum = 0.

When steps isn't a multiple of 3, the partial triplet still sums to 0 (mod 3)
because each complete triplet contributes 0 to the running sum.

## Blume-Capel Parameters

| Parameter | Value | Meaning |
|-----------|-------|---------|
| J | 1.0 | Exchange coupling |
| Δ | 0.0 | Tricritical point |
| Spectral Gap | 1/4 | Rapid mixing guarantee |

## Tested Seeds

All seeds produce GF(3)-conserved outputs:
- Seed 1: ✓ (Σ=3 ≡ 0)
- Seed 42: ✓ (Σ=0 ≡ 0)
- Seed 1069: ✓ (Σ=3 ≡ 0)
- Seed 9999: ✓ (Σ=0 ≡ 0)

Overview

This skill implements a local compositionality gadget that performs ergodic local updates using Blume-Capel spin-1 dynamics while enforcing GF(3) conservation. It encodes operations as triadic gadgets (BLUE/GREEN/RED) where trits are produced in triplets that sum to zero mod 3. The gadget runs in a deterministic 4-phase saturation cycle to decompose, verify, compose, and reconcile local structure.

How this skill works

Each local update emits three trits t1,t2,t3 with t3 = -(t1 + t2) mod 3 so every triplet conserves GF(3). Gadget types map to trit polarities: BLUE = -1 (decompose), GREEN = 0 (identity/verify), RED = +1 (compose). The update loop follows a 4-phase schedule (Backfill, Verify, Live, Reconcile) and uses Blume-Capel parameters (J=1.0, Δ=0.0) to drive spin transitions and rapid mixing.

When to use it

  • When you need local, ergodic updates that preserve a modular invariant (GF(3)).
  • To coordinate triadic transformations that must remain algebraically conservative.
  • For simulations relying on Blume-Capel spin-1 dynamics with rapid mixing guarantees.
  • When you require a structured 4-phase pipeline for decomposition, verification, composition, and reconciliation.
  • For deterministic, seed-driven experiment runs that must be reproducible across seeds.

Best practices

  • Always generate trits in triplets and compute the third as t3 = -(t1 + t2) mod 3 to maintain conservation.
  • Choose step counts in multiples of 3 for full triplet cycles; partial cycles still preserve the running GF(3) sum by construction.
  • Follow the 4-phase schedule to avoid transient violations: Backfill → Verify → Live → Reconcile.
  • Use provided Blume-Capel parameters (J=1.0, Δ=0.0) for the intended mixing behavior unless you have a reasoned alternative.
  • Seed experiments to make runs reproducible and to compare conserved-sum outputs across runs.

Example use cases

  • Run nine local updates to observe a full 4-phase progression with seed-controlled randomness.
  • Validate GF(3) conservation across many seeds for debugging or statistical testing.
  • Apply the gadget as a neutral coordinator in a larger triadic rewriting pipeline.
  • Use as a test harness for Blume-Capel based rapid-mixing behaviors in small-scale chemputer simulations.
  • Stress-test composition and decomposition rules by alternating many cycles and verifying the spectral gap-driven mixing.

FAQ

Is GF(3) conservation always guaranteed?

Yes. Triplet construction enforces t1+t2+t3 ≡ 0 (mod 3) for every emitted triplet, so the global sum remains 0 mod 3.

What happens if steps is not a multiple of 3?

Partial triplets still follow the triplet rule, so the running sum remains congruent to 0 mod 3 by construction.