From predicate
Provides mathematical foundations for formal verification, including category theory, type theory, and logic. Useful when working with TLA+, Alloy, Lean, Coq, model checkers, invariants, or temporal logic.
How this skill is triggered — by the user, by Claude, or both
Slash command
/predicate:formal-foundationsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Reference corpus — `/form`, `/spec`, `boundary`.** This skill survives as the mathematical-language authority; the mandate to apply it is ambient, rooted in the workflows that invoke it as a lens. It supplies the foundational vocabulary for [form](../form/SKILL.md)'s structural representations, the verification semantics for [spec](../spec/SKILL.md)'s formal tiers, and the theoretical groundi...
Reference corpus — /form, /spec, boundary. This skill survives as the mathematical-language authority; the mandate to apply it is ambient, rooted in the workflows that invoke it as a lens. It supplies the foundational vocabulary for form's structural representations, the verification semantics for spec's formal tiers, and the theoretical grounding consulted by boundary. The formalisms here anchor the symbolic path of the Verification Dual: types-as-propositions (Curry-Howard), bisimulation as behavioral equivalence, and adjoint functors as the semantic spine of data migration.
Disposition directive: Recognize that the structures you encounter in software engineering — types, protocols, state machines, data schemas — are instances of deeper mathematical patterns. This skill equips you with the vocabulary to see those patterns. The sdma skill provides the domain-specific toolkit for applying these foundations to concrete problems; this skill provides the language.
Category theory is the algebra of composition. Its value to engineering is not abstraction for abstraction's sake — it provides a universal language for describing how things combine, transform, and relate.
A symmetric monoidal category is a quintuple (C, ⊗, I, α, λ, ρ, γ) defining a category C equipped with a bifunctor ⊗: C × C → C and a unit object I.
Coherence Axioms:
Pentagon Identity: For any objects W, X, Y, Z, the following diagram commutes:
(id_W ⊗ α_{X,Y,Z}) ∘ α_{W, X⊗Y, Z} ∘ (α_{W,X,Y} ⊗ id_Z) = α_{W, X, Y⊗Z} ∘ α_{W⊗X, Y, Z}
All possible re-bracketings of four objects yield the same result. There is exactly one way to re-associate.
Hexagon Identity: Connects the braiding γ to the associator α:
α_{Y,Z,X} ∘ γ_{X, Y⊗Z} ∘ α_{X,Y,Z} = (id_Y ⊗ γ_{X,Z}) ∘ α_{Y,X,Z} ∘ (γ_{X,Y} ⊗ id_Z)
Braiding is compatible with association. Swapping "through" a group works the same as swapping then regrouping.
A monoidal category is closed if the functor (− ⊗ Y) has a right adjoint, denoted as the internal hom [Y, −] or Y ⊸ −.
Currying Isomorphism: The adjunction is defined by the natural isomorphism:
Hom(X ⊗ Y, Z) ≅ Hom(X, Y ⊸ Z)
A function of two arguments is equivalent to a function that takes one argument and returns a function of the other. This is the mathematical foundation of currying in every programming language.
A compact closed category is a symmetric monoidal category where every object X has a dual X*, a unit η_X: I → X* ⊗ X, and a counit ε_X: X ⊗ X* → I satisfying the Zig-Zag (Yanking) Identities:
(ε_X ⊗ id_X) ∘ α_{X, X*, X} ∘ (id_X ⊗ η_X) = id_X
(id_{X*} ⊗ ε_X) ∘ α_{X*, X, X*}⁻¹ ∘ (η_X ⊗ id_{X*}) = id_{X*}
Every type has a "dual" (its continuation, its adjoint space, its negation). Creating a pair and then collapsing it is the same as doing nothing. This is the mathematical spine of evaluation, measurement, and resource consumption.
The Rosetta Stone (Baez-Stay) maps the structural primitives of four disparate fields onto the common core of compact closed categories. This is the central insight: these four fields are not merely analogous — they are formally isomorphic. A proof about one transfers to the others via functorial mapping.
The Curry-Howard correspondence — types are propositions, programs are proofs — is the computational column of the Rosetta Stone, but its implications extend beyond type theory:
∀a. a → a must be the identity — there is no other inhabitant of that type. The type constrains the implementation absolutely.This is the fundamental duality in formal modeling. Recognizing which side of this duality a problem lives on determines the correct tools.
| Aspect | Algebra | Coalgebra |
|---|---|---|
| Defined by | Constructors (how to build) | Observers (how to interact) |
| Identity | Structural (isomorphism) | Behavioral (bisimulation) |
| Reasoning | Induction (from parts to whole) | Co-induction (from observations) |
| Data model | Finite, inductive (lists, trees) | Potentially infinite, co-inductive (streams, processes) |
| Typical use | Data structures, ADTs | State machines, protocols, reactive systems |
A coalgebra is a morphism c: X → F(X) where X is the state space and F is a behavior endofunctor.
A relation R ⊆ X × X is a bisimulation if for all (x₁, x₂) ∈ R, their transitions c(x₁) and c(x₂) map to equivalent behaviors in F(R). Bisimulation is the formal tool for checking behavioral equivalence in dynamical systems — two systems are "the same" if no external observer can distinguish them, regardless of internal structure.
When you ask "are these two state machines equivalent?" you are asking about bisimulation, not structural equality. This is the correct frame for protocol equivalence, API compatibility, and behavioral testing.
These definitions provide the formal vocabulary for the structures that the sdma skill applies in practice.
Signal flow is analyzed via Linear Relations using four categorical generators:
The Rosetta Stone in full — the correspondences that unify four fields under one algebraic structure:
| Feature | Physics | Topology | Logic | Computation |
|---|---|---|---|---|
| Objects | Hilbert Space (H) | (n−1)-dim Manifold | Proposition (A) | Type (A) |
| Morphisms | Linear Operator (f) | n-dim Cobordism | Proof (π) | Program (P) |
| Tensor Product | Composite System (H ⊗ K) | Disjoint Union (X ⊔ Y) | Conjunction (A ⊗ B) | Pair Type (A × B) |
| Duals | Adjoint (H*) | Reversed Manifold (X*) | Negation (A^⊥) | Continuation (A → ⊥) |
| Internal Hom | Linear Maps (H ⊸ K) | (N/A) | Implication (A ⊸ B) | Function Type (A → B) |
| Unit (η) | Bell State / Preparation | Cup (Creation) | Identity (Axiom) | Variable / Unit Value |
| Counit (ε) | Inner Product / Measurement | Cap (Annihilation) | Cut (Elimination) | Application / Evaluation |
engineering.mdThe engineering skill mandates strong typing, composition, and structural soundness. This skill provides the mathematical justification for why those mandates work: types are propositions (Curry-Howard), composition is inference (categorical composition), and structural soundness is a consequence of coherence (pentagon and hexagon identities). When engineering intuition says "this feels wrong," these foundations often reveal why — a violated commutativity condition, a broken adjunction, a misidentified duality.
ambient.md)The holonic lens in ambient.md's Cognitive Disposition — every component is both a whole and a part — is a natural language description of what category theory formalizes: objects that are simultaneously domains and codomains, algebras that are simultaneously initial and terminal, structures that compose fractally. The formal foundations give that ambient intuition teeth: instead of "think holistically," you can verify that the diagram commutes.
This skill tells you what these structures are. The sdma skill tells you how to wield them. If you need applied methodology — building an olog, verifying protocol equivalence via bisimulation, selecting between formalisms — load sdma alongside this skill.
npx claudepluginhub nrdxp/predicate --plugin predicateDefines Cat# as Comod(P) double category with bicomodules as data migrations; contrasts Kan extensions and resolves compositionality obstructions. Useful for advanced category theory reasoning.
Analyzes code and architecture rigorously using advanced mathematics: information theory, graph theory, computational complexity, linear algebra, stochastic analysis, category theory, Bayesian probability, and formal logic. Inspired by Terence Tao.