Note: This page is about categories (in the sense of category theory) built out of syntax, i.e. “term models”. The phrase “syntactic category” is also sometimes used to mean a grouping of syntactic objects, so that e.g. terms belong to one syntactic category and formulas? to another. For this usage, see also categorial grammar.

The syntactic category construction is the functor from theories to categories, denoted SynSyn or ConCon. Given a theory, it generates the walking model of that theory, i.e. a structured category of the appropriate sort which is generated by a model of that theory. Since the objects of the syntactic category are frequently taken to be the contexts in the theory, the syntactic category is also called the category of contexts.

The functor in the other direction associates to any category its internal logic.

Definition

Given a type theoryTT, its syntactic category or category of contextsCon(T)Con(T) is defined as follows.

A morphism from the context Γ\Gamma to the context Δ\Delta consists of a way of fulfilling the assumptions required by Δ\Delta by appropriately interpreting those provided by Γ\Gamma, generally by substituting terms available in Γ\Gamma for variables needed in Δ\Delta and proving whatever is necessary from the assumptions at hand.

More precisely, let Γ\Gamma and Δ\Delta be contexts of some type theoryTT of the form

In other words, to give such a morphism we must give, for each type (or assumption) required by Δ\Delta, a way to construct an element of that type (or a proof of that assumption) out of the data and assumptions contained in Γ\Gamma.

This might fit better after the motivating examples below; but maybe those examples don't make sense to a newcomer. This is incomplete, however, since it doesn't address contexts that include propositional hypotheses. —Toby

Properties

Structure

Depending on the type-forming operations available in TT, the category Con(T)Con(T) will have categorical structure. Roughly:

This is due to the objects of Con(T)Con(T) being contexts rather than types. A way to avoid this is to work instead with a syntactic cartesian multicategory.

In fact, Con(T)Con(T) is not just a structured category, it is a split model of type theory in any of the senses described there. In constructing formally an internal logic that involves dependent types, this is important to keep track of.

Note that in this way of presenting things, the names of the variables in Γ\Gamma do not appear; only the order in which the types appear in Γ\Gamma matters.

A less obvious interpretation of Γ\Gamma in Δ\Delta is the substitution

a≔b,b≔a. a \coloneqq b,\; b \coloneqq a .

There is no reason to keep variable names the same. (At this point, compare Γ\Gamma and ZZ; when the definition is complete, it ought to follow that these are isomorphic.)

Another, perhaps even less obvious, morphism Δ→Γ\Delta \to \Gamma is

a≔a2,b≔a3. a \coloneqq a^2,\; b \coloneqq a^3 .

Not only does this ignore that (ab)2=a2b2(a b)^2 = a^2 b^2; it also ignores the very existence of bb in Δ\Delta. (It also uses the existence of aa more than once. Ignoring and reusing information like this is not always allowed in substructural logics such as linear logic.)

We can interpret EE in Δ\Delta without renaming variables because the theory of a group allows us to derive the judgment

That is, we get a morphism from Δ\Delta to EE by performing the substitution

a≔a,b≔b a \coloneqq a,\; b \coloneqq b

and then inserting a proof of the above judgment. As it happens, the argument in such a proof is reversible, so you should expect that Δ\Delta and EE are also isomorphic.

Are there any morphisms from Γ\Gamma to Δ\Delta? The obvious substitution does not define a morphism, since the required fact cannot be proved. However, you get one using the substitution

a≔a,b≔a a \coloneqq a,\; b \coloneqq a

and then inserting a proof that

Γ⊢(aa)2=a2a2. \Gamma \;\vdash\; (a a)^2 = a^2 a^2 .

All the same, we would not want to say that Γ\Gamma and Δ\Delta are isomorphic contexts; although there are morphisms in each direction, composing them should never produce identity morphisms on both sides.

The category structure of Con(T)Con(T) can be seen explicitly as well. First, given a context Γ\Gamma, there is an obvious identity morphism where every variable is substituted for itself and every statement assumed is proved immediately from itself.

Given morphisms Γ→fΔ→gE\Gamma \overset{f}\to \Delta \overset{g}\to E, form the composite as follows: First, for each variable XX required by Γ\Gamma, ff tells us how to substitute a term TT built out of the variables in Δ\Delta, while gg tells us how to substitute a term from EE for each of these variables. So in the end, XX is expressed as a term T[g]T[g] involving variables available in EE. Also, by combining the proofs provided by ff and gg, we get the proofs required for their composite.

To really complete the definition of a category, I should also describe when two morphisms Γ→Δ\Gamma \to \Delta are equal. There are actually many options here; the most strict is to say that they are equal only if the substitutions and proofs used are syntactically identical, and the most weak is to say that any parallel morphisms are equal. Neither of these is very useful; for purposes of this example, let us require only that the expressions substituted for each variable XX in Γ\Gamma can be proved equal in the context Δ\Delta.

Now you should be able to prove that composition satisfies the axioms of a category.

Notice that the exact definition of equality of morphisms can depend heavily on the theory in question and your own purposes. For example, this definition makes sense only because we have a notion of proving equality of elements of a group. Also, you can sometimes place interesting conditions on whether two proofs count as equivalent, rather than requiring either syntactic identity or (as we do here) accepting proof irrelevance.

Exercise

Now that the category of contexts (in one sense) of the theory of a group has been completely defined, describe that category (up to equivalence) in terms familiar to an algebraist. In particular, compare it to the category of groups.

Answer

In rot13 (so that you have a chance to think about it yourself without accidentally seeing the answer): gur bccbfvgr bs gur pngrtbel bs svavgryl cerfragrq tebhcf.

The result of this exercise is true in more generality: it works for any finite-limit theory; see in particular Lawvere theory. Presumably there are also infinitary generalizations. There’s some general discussion in the Elephant.

Variations

Cartesian multicategories

Instead of a syntactic category, for a non-dependent type theory one can construct instead a syntactic cartesian multicategory (or, in the case of a linear type theory, a plain (symmetric) multicategory). This avoids the need to take the objects to be contexts rather than single types.

The syntactic site

For some doctrines, the syntactic category of any theory is naturally equipped with the structure of a site. For instance, if TT is a regular, coherent, or geometric theory, then Con(T)Con(T) is a regular, coherent, or geometric category, which comes with a naturally defined topology. When equipped with this topology, the syntactic category is called the syntactic site.