Categorical Logic: Structure, Quantification, and Internal Languages

How categories provided structural interpretations of proof, function types, quantifiers, and mathematical foundations.

A logical operation can be described by a symbolic rule. It can also be characterized by what constructions it permits and how those constructions compose.

Categorical logic develops the second approach. Products describe pairing, function objects describe abstraction and application, and adjunctions describe the relationship between substitution and quantification.

The purpose is not to replace formulas with unfamiliar vocabulary. A structural description can reveal that apparently different languages have the same mathematical organization, or that the same formal language admits several kinds of interpretation.

The categorical background

Samuel Eilenberg and Saunders Mac Lane introduced category theory in their 1945 paper on natural equivalences, in a setting shaped by algebra and topology.

A category has objects, arrows between objects, identity arrows, and associative composition. Sets with functions form a category. Groups with homomorphisms form another. The arrows specify which relationships the category treats as structure-preserving.

Alexander Grothendieck's work on sheaves and toposes arose from geometry. F. William Lawvere's work in the 1960s brought categorical methods directly into logic and foundations. Joachim Lambek developed close connections between categories, deductive systems, and typed lambda calculus.

Portrait of Joachim Lambek
Joachim Lambek (1922–2014)
Sources and credit for Joachim Lambek

Andrej Bauer.. Via Wikimedia Commons. Image source · CC BY-SA 2.5 si · Biographical dates

Portrait of Samuel Eilenberg
Samuel Eilenberg (1913–1998)
Sources and credit for Samuel Eilenberg

Konrad Jacobs, Erlangen. Via Wikimedia Commons. Image source · CC BY-SA 2.0 de · Biographical dates

Portrait of Saunders Mac Lane
Saunders Mac Lane (1909–2005)
Sources and credit for Saunders Mac Lane

Konrad Jacobs. Via Wikimedia Commons. Image source · CC BY-SA 2.0 de · Biographical dates

Portrait of Alexander Grothendieck
Alexander Grothendieck (1928–2014)
Sources and credit for Alexander Grothendieck

Konrad Jacobs, Erlangen, Copyright by MFO / Original uploader was AEDP at it.wikipedia. Via Wikimedia Commons. Image source · CC BY-SA 4.0 · Biographical dates

Portrait of F. William Lawvere
F. William Lawvere (1937–2023)
Sources and credit for F. William Lawvere

Andrej Bauer Bmannaa at en.wikipedia. Via Wikimedia Commons. Image source · CC BY-SA 2.5 · Biographical dates

These developments supplied several related projects: semantics for formal languages, structural accounts of theories, and proposed axioms for mathematics itself. Their aims should be distinguished even when they use the same categorical tools.

Proofs as composable arrows

Suppose an arrow f:ABf:A\to B represents a construction taking evidence for AA to evidence for BB. Another arrow g:BCg:B\to C can be composed with it:

gf:AC.g\circ f:A\to C.

Composition expresses a basic form of inference. Identity arrows represent using an assumption directly.

This interpretation alone does not provide every connective. A category must possess suitable additional structure to interpret them.

It also raises a question about proof identity. If two derivations differ only by eliminating an introduction–elimination detour, should they represent the same arrow? A categorical model often identifies proofs according to specified equations. The choice of equations is part of the interpretation.

Products and conjunction

A product A×BA\times B comes with projections

π1:A×BA,π2:A×BB.\pi_1:A\times B\to A,\qquad \pi_2:A\times B\to B.

Given arrows f:XAf:X\to A and g:XBg:X\to B, there is a unique pairing

f,g:XA×B\langle f,g\rangle:X\to A\times B

whose composites with the projections are ff and gg.

In sets, the pairing sends xx to (f(x),g(x))(f(x),g(x)). In the logical interpretation, evidence for XX supplies both AA and BB, hence their conjunction.

The equations

π1f,g=f,π2f,g=g\pi_1\circ\langle f,g\rangle=f,\qquad \pi_2\circ\langle f,g\rangle=g

correspond to simplifying a proof that first forms a conjunction and then immediately selects a component.

The product is characterized by this universal property. A particular implementation of ordered pairs is secondary to the role they perform.

Function types and cartesian closure

A cartesian closed category has finite products and suitable exponential objects BAB^A. The exponential represents a function type from AA to BB.

Its characteristic relationship is

Hom(X×A,B)Hom(X,BA).\operatorname{Hom}(X\times A,B) \cong \operatorname{Hom}(X,B^A).

A construction using an XX-input and an AA-input to produce a BB corresponds to a construction that uses the XX-input to produce a function from AA to BB.

In sets, this is currying:

h(x,a)(x(ah(x,a))).h(x,a)\quad\longleftrightarrow\quad \bigl(x\mapsto(a\mapsto h(x,a))\bigr).

The relationship makes abstraction and application structural. Lambek's work connects this organization with the simply typed lambda calculus, under the relevant equations on terms.

Cartesian closure does not automatically interpret every feature of a modern programming language. General recursion, state, exceptions, and dependent types require further structure or a different semantic treatment.

Quantifiers as adjoints to substitution

Lawvere's account of quantification provides a particularly concrete example of categorical logic.

Let f:XYf:X\to Y be a function. A predicate on YY can be represented by a subset TYT\subseteq Y. Substitution along ff produces the inverse image

f(T)={xX:f(x)T}.f^*(T)=\{x\in X:f(x)\in T\}.

For a subset SXS\subseteq X, define

f(S)={yY:xS, f(x)=y},\exists_f(S)=\{y\in Y:\exists x\in S,\ f(x)=y\},

and

f(S)={yY:every x with f(x)=y belongs to S}.\forall_f(S)= \{y\in Y:\text{every }x\text{ with }f(x)=y\text{ belongs to }S\}.

The key relationships are

f(S)TSf(T),\exists_f(S)\subseteq T \quad\Longleftrightarrow\quad S\subseteq f^*(T),

and

f(T)STf(S).f^*(T)\subseteq S \quad\Longleftrightarrow\quad T\subseteq\forall_f(S).

These are adjunctions between partially ordered sets of predicates. Existential quantification is left adjoint to substitution; universal quantification is right adjoint.

To see the first equivalence directly, every image of an element of SS lies in TT exactly when every element of SS maps into TT. The equation expresses the logical rule through the behavior of substitution.

A finite calculation

Take X={1,2,3}X=\{1,2,3\} and Y={a,b,c}Y=\{a,b,c\}, with f(1)=f(2)=af(1)=f(2)=a and f(3)=bf(3)=b. Let S={1,3}S=\{1,3\}.

Then

f(S)={a,b}.\exists_f(S)=\{a,b\}.

Both aa and bb have a preimage in SS.

But

f(S)={b,c}.\forall_f(S)=\{b,c\}.

The fiber above aa contains 22, which is not in SS. The fiber above bb contains only 33, which is in SS. The fiber above cc is empty, so every member of that fiber belongs to SS vacuously.

Ordinary quantification over a variable appears by taking ff to be a projection, such as X×YYX\times Y\to Y. Quantifying removes the XX-coordinate while retaining the parameters in YY.

Lawvere's “Adjointness in Foundations” develops the broader structural viewpoint. The elementary calculation here illustrates why the language of adjunctions is mathematically informative.

Toposes and internal logic

An elementary topos has finite limits, exponentials, and a subobject classifier. These structures support an internal logical language with a rich interpretation of predicates and functions.

Lawvere and Myles Tierney developed the elementary account around the end of the 1960s, drawing connections with the geometric toposes arising from Grothendieck's work.

The category of sets is a familiar example, but sheaf and other toposes behave differently. Their internal logic is generally intuitionistic; excluded middle requires additional conditions.

This does not mean that an ordinary mathematical observer has changed the external rules used to study the category. One can reason classically about a topos whose internal language does not validate excluded middle. External metatheory and internal logic occupy different levels.

The distinction parallels the separation between a theory and the mathematics used to study its models, now in a structural setting.

Semantics and foundations

Lawvere's Elementary Theory of the Category of Sets, ETCS, proposes structural axioms for a category behaving like sets and functions.

That foundational proposal differs from merely interpreting an existing type theory in a category. Categorical semantics can be carried out inside set theory without replacing set theory as the surrounding foundation.

Conversely, a categorical foundation must specify its own strength. Questions about natural numbers, choice, replacement-like principles, and large collections cannot be settled by the word “category” alone.

Categorical logic therefore broadens the forms that a foundation or model can take. It does not dissolve the need for precise axioms.

From mathematical functions to executable languages

The categorical and type-theoretic accounts clarify the structure of functions and proofs. Executable languages add recursion, evaluation strategies, data representation, and practical type inference.

The next note follows that development while retaining the distinction between a mathematical function, a potentially partial computation, and a proof.

Sources and further reading

  • Samuel Eilenberg and Saunders Mac Lane, “General Theory of Natural Equivalences” (1945).
  • F. William Lawvere, “An Elementary Theory of the Category of Sets” (1964).
  • Joachim Lambek, “Deductive Systems and Categories,” parts I and II (1968–1969).
  • F. William Lawvere, “Adjointness in Foundations” (1969); reprint with later commentary.
  • F. William Lawvere, “Quantifiers and Sheaves” (1971).
  • Joachim Lambek and Philip J. Scott, Introduction to Higher Order Categorical Logic (1986).