Skip to content

tsondru/catgraph

Repository files navigation

catgraph workspace

Category-theoretic graph structures in Rust. The catgraph crate (v0.12.2, slim baseline) is a strict Rust implementation of Fong & Spivak, Hypergraph Categories (2019). Applied-CT extensions (catgraph-applied v0.5.4) track Fong & Spivak, Seven Sketches in Compositionality (2018). Wolfram-physics extensions live in a third workspace crate (catgraph-physics v0.3.0). Magnitude of enriched categories (catgraph-magnitude v0.1.1) is anchored to Bradley & Vigneaux, Magnitude of Language Models (2025). Categorical Deep Learning substrate (catgraph-dl v0.3.1) is anchored to Gavranović et al., Categorical Deep Learning is an Algebraic Theory of All Architectures (ICML 2024).

Members

Crate Path Purpose
catgraph v0.12.2 catgraph/ Strict Fong-Spivak 2019 paper implementation: cospans, spans, Frobenius algebras, hypergraph categories, Theorem 1.2 equivalence, spider theorem (Thm 6.55), Corel<Λ> (F&S 2018 Ex 6.64; v0.12.0), Cospan::compose_with_quotient additive API, parallel feature (WASM + native, W.1).
catgraph-physics v0.3.0 catgraph-physics/ Wolfram-physics extensions: hypergraph DPO rewriting, multiway evolution, gauge theory, branchial spectral analysis.
catgraph-applied v0.5.4 catgraph-applied/ Applied CT extensions. Tier 1 (v0.3.x): generic DecoratedCospan<F> (Def 6.75, Thm 6.77), Petri nets as hypergraph category, wiring diagrams, E_n operads, Temperley-Lieb, linear combinations. Tier 2 (v0.4.0): props + Free(G) (Def 5.2, 5.25), OperadAlgebra with Circ (Def 6.99, Ex 6.100), OperadFunctor with canonical E₁↪E₂ (Rough Def 6.98). Tier 3 (v0.5.x): Rig + 4 concrete rigs (Def 5.36), SignalFlowGraph<R> (Def 5.45), MatR<R> (Def 5.50), sfg_to_mat functor (Thm 5.53), Presentation<G> with CC decision engine + Layer-1 Joyal-Street NF short-circuit, EnrichedCategory<V> + LawvereMetricSpace<T>, CompleteFunctor<G> + MatrixNFFunctor<R> closing Thm 5.60 semantically (v0.5.2); F64Rig ring + field ops prereq for catgraph-magnitude (v0.5.3); Operadic for WiringDiagram InterCircle: Clone widening (v0.5.4).
catgraph-magnitude v0.1.1 catgraph-magnitude/ Magnitude of enriched categories. Anchored to BV 2025: Mag(tM) via Tsallis q-entropy decomposition (Prop 3.10), Shannon recovery (Rem 3.11), Möbius inversion. LmCategory materialized transition table. WeightedCospan<Λ, Q> for agent-coalition weight graphs. No tokio, no serde, no rayon.
catgraph-dl v0.3.1 catgraph-dl/ Categorical Deep Learning substrate. Anchored to Gavranović et al., ICML 2024 (CDL). Para(M, C) 2-category over (Set, ×, 1) (CDL §3.1) + MonoidalCategory / Actegory<M> / Comonoid<M> traits + DiagonalComonoid weight tying (CDL Theorem G.10) + tie_weights consumer-facing API + SetCategoryDefaults opt-in marker for (Set, ×, 1)-flavoured ZSTs (v0.3.0). F-algebras / coalgebras with verify_commutes (CDL Defs 2.3, 2.8, B.2) + Z2 group-action GDL recovery test (CDL Example 2.6). Recursive FreeMnd<F, Z> / CofreeCmnd<F, Z> via GAT projection + ListEndo<A> / TreeEndo<A> bijections (CDL Prop B.18 / Examples B.19, B.20). Five architecture unrollers — FoldingRnn, RecursiveNn, UnfoldingRnn, MealyCell, MooreCell — with FreeMnd-equivalence tests reifying CDL Remark 2.13. Private hopf_fibration namespace stub for Dudzik's transcript-only carry-operation conjecture (NOT in published CDL paper; FE-paper-§6 evidence note confirms no preprint). No tokio, no serde, no rayon.

Sibling repositories

These are separate repos that depend on catgraph and/or catgraph-physics:

Repo Purpose
catgraph-surreal SurrealDB persistence layer for catgraph and catgraph-physics types (v0.11.1)
catgraph-coalition Agent coalitions over SurrealDB live-query messaging; CatDL Quantale widening at v0.4.0 (private repo)
irreducible Computational irreducibility framework (Gorard 2023) using catgraph and catgraph-physics (v0.6.5)

Workspace umbrella tags

Sibling repos pin to a single workspace umbrella tag (NOT each crate's individual version tag) for cargo source-identity deduplication. See CLAUDE.md for the full table.

Umbrella tag SHA Crate versions
v0.12.2 d0b30d5 catgraph v0.12.2 + catgraph-applied v0.5.4 + catgraph-magnitude v0.1.1
v0.13.0 4f8bda8 adds catgraph-dl v0.2.0
v0.13.1 ac699f6 catgraph-dl v0.3.0
v0.13.2 12ad5fd catgraph-dl v0.3.1 (current)

Build

cargo build --workspace
cargo test --workspace
cargo clippy --workspace -- -W clippy::pedantic

Each crate has its own README and CLAUDE.md:

License

MIT — see LICENSE.

About

Cospans, spans, hypergraph rewriting (DPO), multiway evolution, discrete curvature, Petri nets, Frobenius algebras, wiring diagrams, E_n operads, compact closed categories, and lattice gauge theory in Rust — applied category theory for compositional systems, with SurrealDB persistence

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages