Comprehensive Category Theory Cheatsheet: From Fundamentals to Advanced Concepts

Introduction: Understanding Category Theory

Category theory is a unifying framework and language for mathematics that focuses on the relationships between mathematical structures rather than their internal compositions. Developed in the 1940s by Samuel Eilenberg and Saunders Mac Lane, it has evolved into a powerful toolset with applications across mathematics, computer science, physics, and even linguistics. Category theory abstracts away specific details to reveal deeper patterns and connections, allowing mathematicians to transfer insights between seemingly unrelated fields and providing a foundation for understanding computational concepts like data types, functional programming, and database schemas.

Core Concepts and Definitions

Fundamental Category Definition

A category C consists of:

  1. A collection of objects: Obj(C)
  2. A collection of morphisms (or arrows): Hom(C)
  3. For each morphism f, a specified domain (source) and codomain (target) object: f: A → B
  4. For each object A, an identity morphism: id<sub>A</sub>: A → A
  5. A composition operation for morphisms: g ∘ f, defined when cod(f) = dom(g)

Subject to the axioms:

  • Associativity: (h ∘ g) ∘ f = h ∘ (g ∘ f)
  • Identity: f ∘ id<sub>A</sub> = f and id<sub>B</sub> ∘ f = f for any f: A → B

Types of Categories

Category TypeDefinitionExamples
Small CategoryBoth objects and morphisms form setsFinite groups, finite graphs
Locally Small CategoryHom(A,B) is a set for any objects A and BMost familiar categories
Discrete CategoryOnly identity morphisms existSets with only identity functions
Thin/Preorder CategoryAt most one morphism between any two objectsPartially ordered sets
GroupoidEvery morphism has an inverseGroups, fundamental groupoid
Monoidal CategoryEquipped with a tensor product operation(Vect, ⊗), (Set, ×)
Cartesian ClosedHas products and exponential objectsSet, Top, other “nice” categories
ToposHas subobject classifier (internal logic)Set, sheaves on topological spaces

Common Categories

CategoryObjectsMorphismsNotes
SetSetsFunctionsPrototype of many categories
GrpGroupsGroup homomorphismsAlgebraic structures
RingRingsRing homomorphismsAlgebraic structures
Vect<sub>K</sub>Vector spaces over field KLinear transformationsLinear algebra formalized
TopTopological spacesContinuous functionsStudy of topological properties
PosPartially ordered setsOrder-preserving mapsCategories related to order
CatSmall categoriesFunctors“Category of categories”
HaskTypesFunctionsModels functional programming

Functors and Natural Transformations

Functor Definition

A functor F: C → D between categories C and D consists of:

  1. A mapping of objects: For each object A in C, F(A) is an object in D
  2. A mapping of morphisms: For each morphism f: A → B in C, F(f): F(A) → F(B) in D

Preserving:

  • Identity: F(id<sub>A</sub>) = id<sub>F(A)</sub>
  • Composition: F(g ∘ f) = F(g) ∘ F(f)

Types of Functors

Functor TypeDefinitionExamples
CovariantStandard functors (as above)Homology functors, forgetful functors
ContravariantReverses direction of arrows: F(f: A → B) = F(f): F(B) → F(A)Dual space, power set
EndofunctorDomain and codomain are the same categoryList functor, identity functor
FaithfulInjective on Hom-setsForgetful functors
FullSurjective on Hom-setsInclusion of full subcategories
Fully FaithfulBijective on Hom-setsEmbeddings
Essentially SurjectiveEvery object in codomain is isomorphic to image of some objectPart of equivalence of categories
Adjoint FunctorsPair F: C → D, G: D → C with bijection Hom<sub>D</sub>(FX,Y) ≅ Hom<sub>C</sub>(X,GY)Free/forgetful, product/exponential

Natural Transformations

A natural transformation η: F ⇒ G between functors F, G: C → D consists of:

  1. For each object X in C, a morphism η<sub>X</sub>: F(X) → G(X) in D

Such that for any morphism f: X → Y in C, the following diagram commutes:

F(X) --F(f)--> F(Y)
  |               |
  |η_X            |η_Y
  v               v
G(X) --G(f)--> G(Y)

Expressed as an equation: η<sub>Y</sub> ∘ F(f) = G(f) ∘ η<sub>X</sub>

ConceptDefinitionExamples
Natural IsomorphismNatural transformation where each component is an isomorphismBetween equivalent categories
Dinatural TransformationGeneralization for functors of multiple argumentsEvaluation map for dual spaces
MateRelated natural transformations under adjunctionUnit/counit correspondence
Horizontal/Vertical CompositionWays to compose natural transformationsBuilding complex transformations

Universal Properties and Constructions

Limit and Colimit Definition

  • A limit of a diagram F: J → C is an object lim F together with morphisms π<sub>j</sub>: lim F → F(j) that are universal among such cones
  • A colimit of a diagram F: J → C is an object colim F together with morphisms i<sub>j</sub>: F(j) → colim F that are universal among such cocones

Common Universal Constructions

ConstructionUniversal PropertyDiagram PatternExamples
ProductUniversal from separate maps to componentsA ← X → BSets: A×B, Topological spaces: A×B with product topology
CoproductUniversal from components to single objectA → X ← BSets: disjoint union, Groups: free product
EqualizerUniversal for maps equalized by parallel morphismsA ⇉ B → ESets: {x ∈ A | f(x) = g(x)}, kernel in Abelian categories
CoequalizerUniversal for maps that equalize when composedC ← A ⇉ BSets: quotient by equivalence relation
PullbackUniversal object with maps to two objects over a thirdP → B<br>↓ ↓<br>A → CFiber products, restriction of bundles
PushoutUniversal object receiving maps from two objects under a thirdA ← C → B<br>↓ ↓<br>PAmalgamated sums, attaching spaces in topology
Terminal ObjectEvery object has unique map to itA → 1Sets: singleton, Categories: unit category
Initial ObjectUnique map from it to every object0 → ASets: empty set, Categories: empty category

Step-by-Step Construction Process

  1. Identify the pattern: Determine which universal construction matches your problem
  2. Express as a diagram: Draw the appropriate diagram in your category
  3. Check existence: Verify the category has the required limits/colimits
  4. Compute the construction: Explicit construction depends on category:
    • In Set: Products are cartesian products, equalizers are subsets, etc.
    • In Top: Similar to Set but with appropriate topologies
    • In Abstract categories: May need to rely on universal property

Advanced Concepts and Structures

Adjunctions

An adjunction between categories C and D consists of functors F: C → D (left adjoint) and G: D → C (right adjoint) with natural bijection:

Hom<sub>D</sub>(FX, Y) ≅ Hom<sub>C</sub>(X, GY)

Equivalently characterized by:

  • Unit: natural transformation η: 1<sub>C</sub> ⇒ G∘F
  • Counit: natural transformation ε: F∘G ⇒ 1<sub>D</sub>
  • Satisfying the triangle identities:
    • (ε<sub>F(X)</sub> ∘ F(η<sub>X</sub>)) = id<sub>F(X)</sub>
    • (G(ε<sub>Y</sub>) ∘ η<sub>G(Y)</sub>) = id<sub>G(Y)</sub>
PropertyDescriptionExample
UniquenessRight adjoint to F is unique up to isomorphism 
PreservationLeft adjoints preserve colimits; right adjoints preserve limits 
CompositionAdjoints compose: If F⊣G and H⊣K then HF⊣GK 
RAPLRight Adjoint Preserves Limits (and Left Adjoint Preserves coLimits)Key theorem in category theory

Examples of Adjoint Pairs

Left Adjoint (F)Right Adjoint (G)CategoriesDescription
FreeForgetfulAlgebraic categoriesF creates free structure; G forgets structure
Product with XExponential Y<sup>X</sup>Cartesian closedCurrying in functional programming
Inverse image f*Direct image f<sub>*</sub>SheavesGeometric morphisms
Disjoint unionDiagonalSetRelationship between product and coproduct
SuspensionLoop spacePointed spacesFundamental to algebraic topology

Monads and Comonads

A monad (T, η, μ) on a category C consists of:

  1. An endofunctor T: C → C
  2. A natural transformation η: 1<sub>C</sub> ⇒ T (unit)
  3. A natural transformation μ: T² ⇒ T (multiplication)

Satisfying the associativity and unit laws:

  • μ ∘ Tμ = μ ∘ μT (associativity)
  • μ ∘ ηT = μ ∘ Tη = 1<sub>T</sub> (unit laws)
ConceptDefinitionExamples
Kleisli CategoryCategory where objects are from C, morphisms are C(A,TB)Computational effects
Eilenberg-Moore CategoryCategory of T-algebrasAlgebraic structures
Distributive LawInteraction between two monadsCombining computational effects
ComonadDual notion to monadCellular automata, streams

Derived Concepts from Monads

  • Monad from adjunction: Any adjunction F ⊣ G gives rise to a monad GF
  • Algebra for a monad: Object A with structure map TA → A satisfying laws
  • Monad morphism: Natural transformation between monads preserving structure

Category Theory in Computer Science

Types and Programming

Categorical ConceptProgramming InterpretationExamples in Code
ObjectsTypesInt, String, Boolean
MorphismsFunctionsf : Int -> String
ProductTuple/record types(Int, String), {x: Int, y: String}
CoproductSum types/unionsEither<A,B>, enum
Terminal objectUnit type(), void, Unit
Initial objectEmpty/bottom typeNothing, Void
FunctorContainer types with mapList<A>, Option<A>
MonadComposable computational effectsIO<A>, Promise<A>, Either<E,A>
Natural transformationPolymorphic functiondef sequence[F[_],A](lfa: List[F[A]]): F[List[A]]

Functorial Design Patterns

PatternCategorical FoundationProgramming Example
FunctorPreserves structure under transformationmap in collections
ApplicativeMonoidal functorsApplying functions in effectful contexts
MonadComposable effectsSequencing operations with context
LensCategory of coalgebrasComposable getters/setters
OpticsProfunctor representationGeneralized lens, prism, traversal
F-AlgebraAlgebras for an endofunctorRecursive data structures

Common Challenges and Solutions

Navigating Abstraction

ChallengeApproachExample
Excessive abstractionWork in concrete categories firstUnderstand in Set before general case
Visualizing conceptsUse diagrams and concrete examplesDraw commutative diagrams
Connecting to applicationsStart with motivating examplesHow monads model effects
Learning pathBuild from fundamentalsCategories → functors → natural transformations → adjunctions

Common Mistakes to Avoid

  • Forgetting that not all diagrams commute
  • Over-generalizing without checking conditions
  • Neglecting to verify functor laws
  • Assuming familiar properties of Set in other categories
  • Confusing different kinds of universal properties

Advanced Applications

Theoretical Mathematics

AreaCategorical ConceptApplication
Algebraic TopologyFunctorsHomology and cohomology theories
Algebraic GeometrySheaves, topoiScheme theory, cohomology
Logic and FoundationsTopoiAlternative set theories, intuitionistic logic
Representation TheoryMonoidal categoriesTensor categories, quantum groups
Differential GeometrySmooth categoriesSynthetic differential geometry

Applied Category Theory

FieldKey ConceptsApplications
Database TheoryFunctorial data migrationSchema evolution, query composition
Quantum PhysicsMonoidal categoriesQuantum circuits, ZX-calculus
Systems BiologyOperads, decorated cospansReaction networks, compositionality
Machine LearningEnriched categories, bicategoriesNeural network architectures
Programming LanguagesCartesian closed categoriesType systems, semantics
Network TheoryDecorated graphsCommunication protocols, resource theories

Resources for Further Learning

Introductory Books

  • “Category Theory for Programmers” by Bartosz Milewski
  • “Conceptual Mathematics: A First Introduction to Categories” by Lawvere and Schanuel
  • “Basic Category Theory” by Tom Leinster
  • “Category Theory in Context” by Emily Riehl

Advanced Texts

  • “Categories for the Working Mathematician” by Saunders Mac Lane
  • “Sheaves in Geometry and Logic” by MacLane and Moerdijk
  • “Higher Topos Theory” by Jacob Lurie
  • “Category Theory for Scientists” by David Spivak

Online Resources

Key Research Journals

  • Theory and Applications of Categories
  • Journal of Pure and Applied Algebra
  • Advances in Mathematics
  • Higher Structures

This cheatsheet provides a foundation for category theory study but is not exhaustive. The field is vast and continually evolving, with new applications emerging across mathematics and beyond. As with any mathematical discipline, mastery comes through working through examples, solving problems, and connecting abstract concepts to concrete applications.

Scroll to Top