home / skills / plurigrid / asi / pun-decomposition

pun-decomposition skill

/skills/pun-decomposition

This skill analyzes how a pun maps a surface to multiple valid meanings, revealing context shifts and enabling robust disambiguation.

npx playbooks add skill plurigrid/asi --skill pun-decomposition

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

Files (1)
SKILL.md
7.6 KB
---
name: pun-decomposition
description: Pun Decomposition Skill (MINUS -1)
version: 1.0.0
---


# Pun Decomposition Skill (MINUS -1)

> *"A pun exploits multiple valid decompositions of the same phonetic surface."*

## Core Insight

A **pun** is an information reflow that maps a single surface form to multiple semantic contexts. The humor arises from the unexpected context switch—the inductive bias favors one parse, but the pun activates another.

```
pun : Surface → {Context₁, Context₂, ...}
where each Contextᵢ has a valid decomposition
```

## Neighbor Awareness (Braided Monoidal)

This skill knows its neighbors in the triad:

| Position | Skill | Trit | Role |
|----------|-------|------|------|
| **Left** | gestalt-hacking | 0 | Perceptual grouping exploitation |
| **Self** | pun-decomposition | -1 | Multiple parse validation |
| **Right** | acsets | 0 | Schema-aware decomposition |

**Yang-Baxter coherence**: `(σ₁⊗id)(id⊗σ₁)(σ₁⊗id) = (id⊗σ₁)(σ₁⊗id)(id⊗σ₁)`

## GF(3) Triads

```
pun-decomposition (-1) ⊗ gestalt-hacking (0) ⊗ gay-mcp (+1) = 0 ✓  [Core Pun]
pun-decomposition (-1) ⊗ acsets (0) ⊗ topos-generate (+1) = 0 ✓  [Schema Pun]
pun-decomposition (-1) ⊗ reflow (0) ⊗ gay-mcp (+1) = 0 ✓  [Reflow Pun]
three-match (-1) ⊗ gestalt-hacking (0) ⊗ gay-mcp (+1) = 0 ✓  [Pattern Match]
```

## Pun as Gestalt Attack

From the gestalt hacking thread:

```rust
enum GestaltPrinciple {
    Proximity,    // Close morphemes group
    Similarity,   // Similar sounds group  
    Closure,      // Incomplete parse completed
    Continuity,   // Smooth phonetic path preferred
    FigureGround, // Dominant meaning masks secondary
}
```

A pun exploits **Closure** and **FigureGround**:
- **Closure**: The listener completes the parse with the expected meaning
- **FigureGround**: The secondary meaning lurks in background until activated

## Decomposition Types

### Morphemic Decomposition

```ruby
# "I'm reading a book about anti-gravity. It's impossible to put down."
{
  surface: "put down",
  decompositions: [
    { parse: ["put", "down"], meaning: "place on surface", trit: 1 },
    { parse: ["put-down"], meaning: "stop reading", trit: -1 },
  ],
  inductive_bias: 0.7,  # Favors first parse
  pun_strength: 0.3     # Second parse activation
}
```

### Phonetic Decomposition

```ruby
# "Time flies like an arrow. Fruit flies like a banana."
{
  surface: "flies like",
  decompositions: [
    { parse: ["flies", "like"], pos: ["verb", "prep"], trit: 1 },
    { parse: ["flies", "like"], pos: ["noun", "verb"], trit: -1 },
  ],
  gestalt_principle: :figure_ground,
  context_switch: "arrow → banana"
}
```

### Etymological Decomposition

```ruby
# From the reflow skill:
{
  word: "trimester",
  decomposition: ["tri-", "mester"],
  trits: [0, 0],
  gf3_sum: 0,  # Balanced!
  resonance: :strong
}

{
  word: "semester", 
  decomposition: ["se-", "mester"],  # se- = six (2×3)
  trits: [0, 0],
  gf3_sum: 0,  # Also balanced via factorization
  resonance: :moderate
}
```

## ACSet Schema for Puns

```julia
@present SchPun(FreeSchema) begin
  Surface::Ob
  Parse::Ob
  Morpheme::Ob
  Meaning::Ob
  
  surface::Hom(Parse, Surface)
  morphemes::Hom(Morpheme, Parse)
  meaning::Hom(Parse, Meaning)
  
  # Attributes
  Text::AttrType
  Trit::AttrType
  Bias::AttrType
  
  text::Attr(Surface, Text)
  trit::Attr(Parse, Trit)
  bias::Attr(Parse, Bias)
end

@acset_type Pun(SchPun, index=[:surface, :meaning])
```

## Inductive Bias as Prior

The inductive bias determines which decomposition is "default":

```
P(parse₁ | surface) = softmax(bias₁ / τ)
P(parse₂ | surface) = softmax(bias₂ / τ)

where τ = temperature (context sensitivity)
```

At low temperature (focused context), one parse dominates.
At high temperature (open context), multiple parses activate → PUN.

## OpenGame Structure

From gestalt hacking thread:

```
┌─────────────────────────────────────────────────────────┐
│  PunGame ∆                                              │
│  ─────────────────────────────────────────────────────  │
│  play     :: Surface → ∆ [Parse]     ← enumerate parses │
│  evaluate :: [Parse] → Meaning       ← select by context│
│                                                         │
│  Pun = play produces multiple; evaluate oscillates      │
└─────────────────────────────────────────────────────────┘
```

## Defense: 2-Poisson Disambiguation

When puns attack comprehension, use stochastic sampling:

```rust
impl PunDefender {
    fn disambiguate(&mut self, surface: &str) -> Parse {
        let parses = self.decompose(surface);
        
        if parses.len() > 1 {
            // Multiple valid parses detected
            let (_, selected) = self.poisson.next_arrival(0.0);
            // Use Poisson timing to break tie
            parses[selected.to_usize() % parses.len()].clone()
        } else {
            parses[0].clone()
        }
    }
}
```

## LMBIH Seed Integration

Using the LMBIH seed (327833753928) for pun coloring:

```ruby
# XIP-7074D4: LMBIH Etymological Resonance
seed = 327833753928  # "LMBIH".bytes → hex
index = 43

color_at(seed, index)  # => #7074D4 (purple-blue)

# The pun lives in the purple-blue spectrum:
# - Blue = validation (checking parses)
# - Purple = blend of generation + validation
```

## Commands

```bash
just pun-decompose "time flies"     # Enumerate parses
just pun-triad gestalt acsets       # Show GF(3) triad
just pun-bias 0.7                   # Set inductive bias
just pun-attack closure             # Test gestalt attack
```

## Related Skills

- **gestalt-hacking** (left neighbor): Perceptual grouping exploitation
- **acsets** (right neighbor): Schema-aware decomposition storage
- **reflow**: Cross-context meaning preservation
- **three-match**: Colored subgraph isomorphism for parse matching
- **etymological-resonance**: Morpheme-level decomposition

## Files

- [etymological_resonance.rb](file:///Users/bob/ies/music-topos/lib/etymological_resonance.rb)
- [gestalt hacking thread](https://ampcode.com/threads/T-019b3e8d-1ab1-7548-ab74-fdd531cda57f)
- [chromatic verifier thread](https://ampcode.com/threads/T-019b0ce1-815d-773b-b2ce-f5ef9b26e48d)



## Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

### Graph Theory
- **networkx** [○] via bicomodule
  - Universal graph hub

### Bibliography References

- `algorithms`: 19 citations in bib.duckdb



## SDF Interleaving

This skill connects to **Software Design for Flexibility** (Hanson & Sussman, 2021):

### Primary Chapter: 5. Evaluation

**Concepts**: eval, apply, interpreter, environment

### GF(3) Balanced Triad

```
pun-decomposition (+) + SDF.Ch5 (−) + [balancer] (○) = 0
```

**Skill Trit**: 1 (PLUS - generation)

### Secondary Chapters

- Ch1: Flexibility through Abstraction
- Ch4: Pattern Matching
- Ch10: Adventure Game Example

### Connection Pattern

Evaluation interprets expressions. This skill processes or generates evaluable forms.
## Cat# Integration

This skill maps to **Cat# = Comod(P)** as a bicomodule in the equipment structure:

```
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
```

### GF(3) Naturality

The skill participates in triads satisfying:
```
(-1) + (0) + (+1) ≡ 0 (mod 3)
```

This ensures compositional coherence in the Cat# equipment structure.

Overview

This skill analyzes and enumerates multiple valid decompositions of the same phonetic or morphological surface to expose pun-like ambiguities. It frames puns as surfaces that map to multiple parses and computes which parse is preferred by inductive bias versus which is latent. The skill is geared toward validation, analysis, and controlled generation of pun contexts.

How this skill works

The skill decomposes an input surface into candidate parses across morphemic, phonetic, and etymological axes. It attaches attributes like trit, bias, and gestalt principle to each parse and ranks parses using a softmax prior with a temperature parameter to model context sensitivity. It can enumerate parses, show triadic coherence with neighbor skills, and simulate disambiguation strategies such as Poisson sampling to model comprehension dynamics.

When to use it

  • When you need to analyze why an utterance yields multiple plausible meanings.
  • When designing jokes, wordplay, or creative text that relies on controlled ambiguity.
  • When validating parsing schemas that must account for alternative morphemic or phonetic segmentations.
  • When modeling listener comprehension under varying contextual focus (temperature).
  • During linguistic research into figure-ground and closure effects in perception.

Best practices

  • Provide the full surface phrase to capture contextual cues that shift inductive bias.
  • Start with morphemic and phonetic decompositions before adding etymological analysis for robust coverage.
  • Adjust temperature to model narrow vs. open contexts; low τ reveals dominant parse, high τ surfaces puns.
  • Use Poisson or stochastic tie-breakers to simulate human timing-based disambiguation.
  • Record trit and bias attributes for each parse to enable triad coherence checks with neighboring skills.

Example use cases

  • Analyze a candidate joke to see which parse the audience will likely accept as primary and which will act as the punchline.
  • Build a generator that produces ambiguous phrases by optimizing for balanced biases and high pun strength.
  • Integrate into a validation pipeline that flags text with multiple high-probability parses for editorial review.
  • Model conversational agents that intentionally activate secondary parses by increasing temperature or priming figure-ground cues.
  • Teach a class on humor mechanics by visualizing parse graphs and ACSet schemas for classic puns.

FAQ

How do you model which meaning dominates?

Dominance is modeled by a bias prior per parse and a temperature τ; softmax(bias/τ) gives parse probabilities—low τ amplifies the strongest bias.

Can this skill generate puns or only analyze them?

It supports both: enumeration and scoring for analysis, and controlled generation by selecting surfaces with balanced biases and high pun strength.

What disambiguation strategy simulates human comprehension?

Stochastic sampling with Poisson timing is recommended to model timing-based selection and interruptions that resolve ambiguity.