Skip to content

plurigrid/asi / ies/music-topos/.codex/skills/topos-generate

topos-generate

Verified

Topos Generation Skill (PLUS +1)

FileKindSize
SKILL.mdskill md4.3 KB
---
name: topos-generate
description: Topos Generation Skill (PLUS +1)
source: local
license: UNLICENSED
---

# Topos Generation Skill (PLUS +1)

> Sheaf-theoretic model generation via forcing

**Trit**: +1 (PLUS)  
**Color**: #D82626 (Red)  
**Role**: Generator/Creator

## Core Concept

A topos E generates models via:
- **Subobject classifier** Ω (truth values)
- **Internal language** (Mitchell-Bénabou)
- **Forcing semantics** (Kripke-Joyal)

```
      E^op
        ↓ yoneda
    [E^op, Set]
        ↓ sheafification
     Sh(E, J)  ← topos!
```

## Subobject Classifier Ω

In Set: Ω = {0, 1} = Bool
In Sh(X): Ω = {open subsets of X}
In Sh(C,J): Ω = sieves

```
For any mono m: A ↣ B
∃! χ_m: B → Ω such that:

    A ───→ 1
    ↓      ↓ true
    B ──→ Ω
       χ_m
```

## Internal Language (Mitchell-Bénabou)

Every topos has an internal type theory:

```
Types      ↔ Objects
Terms      ↔ Morphisms  
Predicates ↔ Subobjects
∧, ∨, →    ↔ Ω operations
∀, ∃       ↔ Quantifiers via adjoints
```

### Internal Logic
```
⟦A ∧ B⟧ = ⟦A⟧ ×_Ω ⟦B⟧
⟦A → B⟧ = Ω^{⟦A⟧ → ⟦B⟧}
⟦∀x:X. φ(x)⟧ = ∏_{x:X} ⟦φ(x)⟧
```

## Kripke-Joyal Forcing

Stage-wise truth at object U:

```
U ⊩ φ ∧ ψ  ⟺  U ⊩ φ and U ⊩ ψ
U ⊩ φ → ψ  ⟺  ∀f:V→U. V ⊩ φ ⟹ V ⊩ ψ  
U ⊩ ∀x:X.φ ⟺  ∀f:V→U, ∀a:X(V). V ⊩ φ[a/x]
U ⊩ ∃x:X.φ ⟺  ∃ cover {Uᵢ→U}, ∃aᵢ:X(Uᵢ). Uᵢ ⊩ φ[aᵢ/x]
```

## Integration with Cider/Clojure

```clojure
(ns topos.generate
  (:require [acsets.core :as acs]))

;; Subobject classifier for finite topos
(defn omega [topos]
  (let [sieves (all-sieves (:site topos))]
    {:object sieves
     :true (maximal-sieve topos)
     :false (empty-sieve)}))

;; Force a proposition at stage
(defn force [stage prop env]
  (case (:type prop)
    :and (and (force stage (:left prop) env)
              (force stage (:right prop) env))
    :implies (every? (fn [morphism]
                       (let [stage' (compose stage morphism)]
                         (if (force stage' (:antecedent prop) env)
                           (force stage' (:consequent prop) env)
                           true)))
                     (covers stage))
    :forall (every? (fn [[morphism witness]]
                      (force (compose stage morphism) 
                             (:body prop) 
                             (assoc env (:var prop) witness)))
                    (all-witnesses stage (:type prop)))
    :exists (some (fn [[cover witnesses]]
                    (every? (fn [[morph wit]]
                              (force (compose stage morph)
                                     (:body prop)
                                     (assoc env (:var prop) wit)))
                            (zip cover witnesses)))
                  (all-covers-with-witnesses stage (:type prop)))))

;; Generate model satisfying formula
(defn generate-model [topos formula]
  (let [stages (objects topos)]
    (for [stage stages
          :when (force stage formula {})]
      {:stage stage
       :witnesses (collect-witnesses stage formula)})))
```

## Forcing for Set Theory

Cohen forcing generates new sets:

```
P = partial functions ω → 2 (finite approximations)
G = generic filter (added by forcing)

M[G] = { interpretation of names under G }
```

## GF(3) Triads

```
sheaf-cohomology (-1) ⊗ dialectica (0) ⊗ topos-generate (+1) = 0 ✓
temporal-coalgebra (-1) ⊗ open-games (0) ⊗ topos-generate (+1) = 0 ✓
three-match (-1) ⊗ kan-extensions (0) ⊗ topos-generate (+1) = 0 ✓
```

## Commands

```bash
# Generate subobject classifier
just topos-omega site

# Force proposition at stage
just topos-force stage "∀x. φ(x)"

# Generate satisfying model
just topos-model formula

# Internal language translation
just topos-internal formula
```

## Topos Models in Practice

| Topos | Generates | Application |
|-------|-----------|-------------|
| Set | Classical sets | Standard math |
| Sh(X) | Varying sets over X | Geometry |
| Sh(G) | G-sets | Symmetry |
| Eff | Computable functions | Computability |
| Dialectica | Proof-relevant math | Type theory |

## References

- Mac Lane & Moerdijk, "Sheaves in Geometry and Logic"
- Johnstone, "Sketches of an Elephant"
- Awodey, "Category Theory" §8
- nLab: https://ncatlab.org/nlab/show/forcing
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall