definition example

A diagram in a Category is a Functor from a category , the indexing category (or shape). It is drawn as a Graph whose vertices and arrows are labeled by objects and morphisms of . The diagram commutes if for every parallel pair in — equivalently, factors through the Preorder Reflection of .

Sources: 7 Sketches Definition 3.51, Eq. (3.50), Definition 3.92; Kittenlab Lecture 6 (“a commutative diagram is a way of writing an equation between composites of morphisms”), 9; DaoFP §3 (commuting diagrams as equalities of arrows), §9.4–9.5 (” stands for diagram”); CTfS §2.2 (commutative diagrams of sets, Applications 2.2.1.1–2.2.1.2), Definition 4.5.2.1, Example 4.5.2.2, Exercises 4.5.2.3–4.5.2.5

  • Commuting diagrams as scientific claims (CTfS §2.2). The central dogma “DNA makes RNA makes protein” is a commutative triangle: translating DNA triplets to amino acids equals transcribing to RNA and then translating. Two methods for predicting the future state of a mechanical system — the Lagrangian followed by and the Hamiltonian followed by — agreeing is the commutativity of a square. In an Olog a commuting diagram is a fact, marked with a check mark ✓.
  • Commuting vs. non-commuting shapes (CTfS Example 4.5.2.2). A commutative square is a functor out of , where the two composites are equal; a square that is not claimed to commute is a functor out of the free category on the square-shaped graph, where they are different morphisms. So “does the diagram commute?” is a question about the indexing category. Likewise a chain and a loop at look alike but are indexed by and by the monoid respectively (CTfS Exercise 4.5.2.5).
  • The naturality square of a Natural Transformation is a commutative diagram of shape “square” (Eq. 3.50).
  • A diagram of shape the discrete is a pair of objects; of shape the Walking Arrow, a morphism; of shape , a Cospan; , a Span; , a parallel pair; , the empty diagram. A -set is a diagram in of shape a schema.
  • Cones and cocones are natural transformations and ; their universal versions are limits and colimits. Diagrams of shape in form the Functor Category .
  • Kittenlab’s Diagram type stores a functor out of a finitely presented category as a dictionary of objects and morphisms; Catlab’s FinDomFunctor/Diagram likewise. Equality of morphisms is what commuting diagrams assert: “equality of set elements is the essence of all the commuting diagrams in category theory” (DaoFP Preface).

Docs: FinSets · FinCats · Theories & presentations — Kittenlab Lecture 6

# Catlab: a diagram of shape the "pushout span" in FinSet
using Catlab
@present SchSpan(FreeSchema) begin
  (A, B, C)::Ob
  f::Hom(A, B); g::Hom(A, C)
end
D = FinDomFunctor(Dict(:A => FinSet(2), :B => FinSet(3), :C => FinSet(3)),
                  Dict(:f => FinFunction([1, 2], 3), :g => FinFunction([2, 3], 3)),
                  FinCat(SchSpan))
is_functorial(D)
# Catlab also has `Diagram` (a diagram with its shape) and `colimit(D)` / `limit(D)`
-- a diagram is a functor J ⥤ C
#check CategoryTheory.Limits.WalkingParallelPair    -- shape for (co)equalizers
#check CategoryTheory.Limits.WalkingSpan            -- shape for pushouts
#check CategoryTheory.Limits.WalkingCospan          -- shape for pullbacks
-- a diagram as a finite category (graph + equations) mapped into a category, stored per generator
data Diagram ob hom = Diagram { objs :: [(String, ob)], homs :: [(String, hom)] }