CatColab: formal, interoperable, conceptual modeling

Applied Category Theory 2025

Evan Patterson

Topos Institute

2025-06-02

Introducing CatColab

This talk describes work in progress on CatColab, a collaborative environment for formal, interoperable, conceptual modeling.

formal
models are mathematical objects that can be critiqued with clarity
interoperable
models, and modeling languages, can be interoperated with each other
conceptual
modeling languages are well adapted to concepts used by practitioners

Outline

  1. Demo
  2. Mathematics behind CatColab

Credits

As of June 2025, the core development team for CatColab is:

  • Kris Brown
  • Kevin Carlson
  • Owen Lynch
  • Jason Moggridge
  • Evan Patterson

I am also grateful for support from colleagues, collaborators, and funders.

Demo

Will a few of the logics currently available in CatColab:

  1. Causal loop diagrams
  2. System structure diagrams, aka primitive stock-flow diagrams
  3. Database schemas

Try it yourself:

Warning

CatColab is early alpha software under active development.

Mathematics

Mathematical foundation for CatColab is the framework of double theories:

  1. “Cartesian double theories: A double-categorical framework for categorical logic” (Lambert and Patterson 2024)
  2. “Products in double categories, revisited,” Section 10: “Finite-product double theories” (Patterson 2024)

This talks focuses on special cases already implemented in CatColab

Motivation

Formal languages are the syntactic counterpart to categorical structures:

Logic/language Categorical structure
Algebraic theories Cartesian categories
Typed lambda theories Cartesian closed categories
Resource theories Symmetric monoidal categories
Statistical theories Markov categories
… …
  • Many (though not all) of these categorical structures are known to be models of double theories
  • But we’re starting with simpler examples, often not regarded as logics at all

Simple double theories

Definition

A simple double theory is a strict double category.

This is a concept with an attitude, understood as a categorified theory:

  • object = “object type”
  • arrow (vertical morphism) = “operation on objects”
  • proarrow (horizontal morphism) = “morphism type”
  • cell = “operation on morphisms”
  • \(f\) = object operation with input type \(x\) and output type \(w\)
  • \(\alpha\) = morphism operation with input type \(m\) and output type \(n\)

Models of simple double theories

Definition

A model of a simple double theory \(\mathbb{T}\) is

  • a lax double functor \(M: \mathbb{T} \to \mathbb{S}\mathsf{pan}\), or equivalently
  • a normal lax double functor \(M: \mathbb{T} \to \mathbb{P}\mathsf{rof}\)

Such models are categorified copresheaves:

Idea 1-dimensional 2-dimensional
Schema/theory Category \(\mathsf{C}\) Double category \(\mathbb{D}\)
Semantics \(\mathsf{Set}\) \(\mathbb{S}\mathsf{pan}\ (= \mathbb{S}\mathsf{et})\)
Instance/model Functor \(\mathsf{C} \to \mathsf{Set}\) Lax functor \(\mathbb{D} \to \mathbb{S}\mathsf{pan}\)

Discrete double theories

Simplifying still further:

Definition

A discrete double theory is

  • a simple double theory having only trivial arrows and cells, or equivalently
  • a double category of the form \(\mathbb{D}\mathsf{isc}(\mathsf{B}) := \mathbb{H}(\mathsf{B})\) for some category \(\mathsf{B}\)

Such a double theory has only object and morphism types, no operations.

Fact

A model of a discrete double theory \(\mathbb{D}\mathsf{isc}(\mathsf{B})\) is equivalent to a category sliced over \(\mathsf{B}\):

\[ \mathsf{Lax}(\mathbb{D}\mathsf{isc}(\mathsf{B}), \mathbb{S}\mathsf{pan}) \simeq \mathsf{Cat}/\mathsf{B}. \]

Discrete tabulator theories

We now extend discrete double theories with a kind of double limit.

Recall that the tabulator of a profunctor \(P: \mathsf{C} \mathrel{\mkern 3mu\vcenter{\hbox{$\scriptstyle+$}}\mkern-13mu{\to}}\mathsf{D}\) is its category of elements \(\int P\), having

  • as objects, triples \(c \in \mathsf{C}\), \(d \in \mathsf{D}\), and \(p: c \dashrightarrow d\) in \(P\);
  • as morphisms \((c,d,p) \to (c',d',p')\), morphisms \(f: c \to c'\) in \(\mathsf{C}\) and \(g: d \to d'\) in \(\mathsf{D}\) making the square commute.

Definition

A discrete tabulator theory is a double category with tabulators, having only trivial arrows and cells (identities and projections).

A model of a discrete tabulator theory \(\mathbb{T}\) is a normal lax functor \(M: \mathbb{T} \to \mathbb{P}\mathsf{rof}\) that preserves tabulators.

Examples

The mathematics behind our examples:

  1. Causal loop diagrams
  2. Database schemas
  3. System structure diagrams

Causal loop diagrams

Causal loop diagrams (and also regulatory networks) are

  • signed graphs, or
  • free signed categories


Let \(\mathsf{Sgn}:= \{\pm 1\} \cong \mathbb{Z}_2\) be the group of nonzero signs.

Definition

A signed category is a category \(\mathsf{C}\) equipped with a functor \(\mathsf{C} \to \mathsf{Sgn}\).

So, the category of signed categories is the slice

\[ \mathsf{SgnCat} := \mathsf{Cat}/\mathsf{Sgn}. \]

Causal loop diagrams via double theories

Theory

The theory of signed categories is the discrete double theory generated by

  • a object type \(x\)
  • a morphism type \(n: x \mathrel{\mkern 3mu\vcenter{\hbox{$\scriptstyle+$}}\mkern-13mu{\to}}x\) (for “negative”)

subject to the equation \(n \odot n = \mathrm{id}_x\) (where \(\mathrm{id}_x: x \mathrel{\mkern 3mu\vcenter{\hbox{$\scriptstyle+$}}\mkern-13mu{\to}}x\) is “positive”).

Equivalently,

\[ \mathbb{T}_{\mathsf{SgnCat}} := \mathbb{D}\mathsf{isc}(\mathsf{Sgn}), \]

so

\[ \mathsf{Lax}(\mathbb{T}_{\mathsf{SgnCat}}, \mathbb{S}\mathsf{pan}) \simeq \mathsf{Cat}/\mathsf{Sgn} = \mathsf{SgnCat}. \]

Free signed categories

What’s the point about thinking of signed graphs as free signed categories?

Motifs are morphisms between free signed categories, e.g.,

  • Positive/reinforcing feedback loops are morphisms out of:

  • Negative/balancing feedback loops are morphisms out of:

Diagrams as free categorical structures

This phenomenon is generic:

Slogan

Diagrammatic languages are free categorical structures whenever it makes sense for arrows to compose.

A famous example:

Example

Petri nets are free symmetric/commutative monoidal categories.

Coming in a future version of CatColab!

Database schemas

A basic notion of database schema is a finitely presented profunctor

where \(\mathrm{Mapping} := \mathrm{Hom}_{\mathrm{Entity}}\) and \(\mathrm{AttrOp} := \mathrm{Hom}_{\mathrm{AttrType}}\).

In SQL jargon:

  • “Entity” = table
  • “Mapping” = foreign key
  • “Attr” = data attribute
  • “AttrType” = data type, such as TEXT or REAL

Schemas via double theories

Theory

The theory of profunctors is the “walking proarrow” \(\mathbb{D}\mathsf{isc}(\mathsf{2})\), a discrete double theory freely generated by

  • two objects \(0,1\)
  • one proarrow \(0 \mathrel{\mkern 3mu\vcenter{\hbox{$\scriptstyle+$}}\mkern-13mu{\to}}1\).

A model is a profunctor, either directly or indirectly via “barrels”:

\[ \mathsf{Lax}(\mathbb{D}\mathsf{isc}(\mathsf{2}), \mathbb{S}\mathsf{pan}) \simeq \mathsf{Cat}/\mathsf{2}. \]

In future versions of CatColab:

  • Database instances as modules over models of double theories
  • Algebraic databases a la Schultz et al. (2017)

System structure diagrams

A system structure diagram, the qualitative counterpart to a stock-flow diagram, consists of:

  • stocks, say of wheat or of people
  • flows, going from an upstream stock to a downstream stock
  • links, going from a source stock to a target flow

In categorical terms, links go from objects to morphisms!

System structure diagrams via double theories

Theory

The theory of categories with links is the discrete tabulator theory freely generated by

  • an object type \(x\)
  • a morphism type \(\ell: x \mathrel{\mkern 3mu\vcenter{\hbox{$\scriptstyle+$}}\mkern-13mu{\to}}\top \mathrm{id}_x\)

where \(\top \mathrm{id}_x\) denotes the tabulator of the hom-type on \(x\)

A system structure diagram is then a free category with links, which implies:

  • Links compose with flows in certain ways to give composite links
  • A richer notion of morphism between system structure diagrams

References

Aduddell, Rebekah, James Fairbanks, Amit Kumar, Pablo S. Ocal, Evan Patterson, and Brandon T. Shapiro. 2024. “A Compositional Account of Motifs, Mechanisms, and Dynamics in Biochemical Regulatory Networks.” Compositionality 6 (2). https://doi.org/10.32408/compositionality-6-2.
Ahrens, Benedikt, and Peter LeFanu Lumsdaine. 2019. “Displayed Categories.” Logical Methods in Computer Science 15 (1). https://doi.org/10.23638/LMCS-15(1:20)2019.
Baez, John C., Fabrizio Genovese, Jade Master, and Michael Shulman. 2021. “Categories of Nets.” In 2021 36th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS), 1–13. https://doi.org/10.1109/LICS52264.2021.9470566.
Carlson, Kevin. 2024. “Introducing CatColab.” Topos Institute. 2024. https://topos.site/blog/2024-10-02-introducing-catcolab/.
Lambert, Michael, and Evan Patterson. 2024. “Cartesian Double Theories: A Double-Categorical Framework for Categorical Doctrines.” Advances in Mathematics 444: 109630. https://doi.org/10.1016/j.aim.2024.109630.
Meadows, Donella H. 2008. Thinking in Systems: A Primer. Chelsea Green Publishing.
Patterson, Evan. 2024. “Products in Double Categories, Revisited.” https://arxiv.org/abs/2401.08990.
Patterson, Evan, Owen Lynch, and James Fairbanks. 2022. “Categorical Data Structures for Technical Computing.” Compositionality 4 (5). https://doi.org/10.32408/compositionality-4-5.
Roig, Gabriel Goren, Joshua Meyers, and Emilio Minichiello. 2024. “Presenting Profunctors.” https://arxiv.org/abs/2404.01406.
Schultz, Patrick, David I. Spivak, Christina Vasilakopoulou, and Ryan Wisnesky. 2017. “Algebraic Databases.” Theory and Applications of Categories 32 (16): 547–619. http://www.tac.mta.ca/tac/volumes/32/16/32-16abs.html.