annotation program

Catlab.jl is the Julia library for applied category theory at the heart of the AlgebraicJulia ecosystem: generalized algebraic theories (GATs) via @theory, symbolic presentations via @present, finite sets and functions (FinSet, FinFunction), ACSets (@acset_type, @acset), limits and colimits, wiring diagrams, and graphics.

Sources: Kittenlab (which builds a toy version of Catlab step by step); AlgebraicJulia documentation.

Version note. All Julia code in this wiki was checked against Catlab v0.16.x (the API used by the current documentation and by Kittenlab). Catlab v0.17 moved to GATlab-style explicit models (meet[SubobjectElementWise()](U, V) instead of meet(U, V), etc.); most FinSet/FinFunction/ACSet code is unchanged, but lattice operations on subobjects and some theory-level calls differ.

Running the Julia tabs

using Pkg
Pkg.add(name = "Catlab", version = "0.16")          # the version the snippets were run against
Pkg.add(url = "https://github.com/AlgebraicJulia/Kittenlab.jl")   # optional: Kittenlab's own package
Pkg.add(name = "AlgebraicRewriting", version = "0.4")   # graph rewriting (Double-Pushout Rewriting note)

Every Julia tab in the vault begins with a Docs: line pointing at the relevant section of the Catlab v0.16 documentation (e.g. FinSets, Limits, CSets, data migration, graphs, wiring diagrams), the GATlab standard library (theories such as ThCategory), the ACSets.jl API, the Catlab vignettes that follow 7 Sketches, or the Kittenlab lectures. Notes whose code is plain Julia say so. The current Catlab release (v0.17+) is documented at the stable docs; for most FinSet/ACSet code the v0.16 pages still describe the same functions.

Snippets are self-contained unless a Builds on: line says otherwise. The Kittenlab-style mini-library is spread over a few notes, and the chains are:

Snippets that start with using Catlab shadow the mini-library’s Category, Functor, FinFunction, …, so run them in a fresh session (or module).

Kittenlab’s own mini-library (src/Categories.jl, FinSets.jl, Functors.jl, NaturalTransformations.jl, FinCats.jl, Diagrams.jl, Graphs.jl) is reproduced across Category, Functor, Natural Transformation, Presentation of a Category, Diagram and Graph; it takes a “middle path”: Julia types guide implementation and dispatch but are not relied on for correctness.

Where to look

ConceptCatlab
CategoryCatlab.Theories.ThCategory, FreeCategory
PreorderThPreorder, FreePreorder, ThThinCategory
Symmetric Monoidal CategoryThSymmetricMonoidalCategory, FreeSymmetricMonoidalCategory
Category of Finite SetsFinSet, FinFunction, Catlab.CategoricalAlgebra.FinSets
Category of RelationsCatlab.CategoricalAlgebra.FinRelations
Presentation of a Category / Database Schema / schemas@present, FreeSchema, FinCat
C-Set / Functor @acset_type, @acset, FinDomFunctor
Natural Transformation / Graph HomomorphismACSetTransformation, homomorphism(s), isomorphisms, is_natural
Graph, Symmetric GraphGraph, SymmetricGraph, path_graph, cycle_graph
Monoid Action, Finite State Machine, Discrete Dynamical SystemACSets on a one-object schema (@acset_type)
Limit, Colimit, Pushout, Pullbacklimit, colimit, pushout, pullback, coequalizer
Data migration DeltaMigration, SigmaMigration, migrate
Cospan, Decorated Cospan, Structured CospanCospan, StructuredCospan, OpenCSet
Hypergraph Category / UWDs@relation, oapply, UndirectedWiringDiagram
Prop / Signal Flow GraphThBiproductCategory, @theory, Catlab.Programs
Operadoapply (operad algebras), Catlab.WiringDiagrams
Subobject latticeSubobject, meet, join, top, bottom