Module 9: Coends and the Integration Calculus

Coends are the categorical generalization of integration and trace. This module develops the coend calculus — including the Fubini theorem for coends and the Ninja Yoneda Lemma — and identifies coends in the ML operations you already know: tensor contraction, variable marginalization, belief propagation, and the partition function. The central payoff is a precise diagnosis of when Z is tractable: it is a question about which category you integrate over, not about probability theory per se.

Learning Objectives

  • Define ends and coends via the wedge and cowedge conditions.
  • Compute simple coends explicitly in Set and Vect.
  • State and apply the Fubini theorem for coends: iterated coends commute.
  • Identify tensor contraction as a coend over an index category.
  • Identify probabilistic marginalization as a coend over the marginalized variable.
  • Explain why the partition function Z is a coend and characterize when it is tractable.

Materials

Key Concepts

Central Concepts from Prerequisites