Categorical Logic
Total Page:16
File Type:pdf, Size:1020Kb
Categorical Logic Jonas Frey April 2, 2017 1 Algebraic theories and Lawvere theories 1.1 Signatures and structures 1 Definition 1.1 A signature is a family Σ = (Σn) of sets. For n ∈ , the n∈N N elements of Σn are called n-ary operations. ♦ Definition 1.2 Let C be a category with finite products and Σ a signature. 1.A Σ-structure A in C consists of • an object A ∈ C (we use the same letter for the structure and the underlying object), and n • for every n ∈ N and f ∈ Σn a morphism fA : A → A. 2.A morphism of Σ-structures A, B is an arrow g : A → B between the underlying objects such that the square gn An Bn fA fB g A B commutes for all n ∈ N and f ∈ Σn. ♦ It is easy to see that morphisms of Σ-structures commute, and we denote the category of Σ-structures in C and their morphisms by Σ-Str(C)2. 1.2 Interpretation of terms Definition 1.3 The set T (Σ) of terms over Σ is inductively defined as follows. 1These could more precisely be called ‘algebraic signature’, to distinguish them from the ‘first-order signatures’ in the next section, but I simply write signature since it’s shorter. 2 In the course I wrote C-Str(Σ), but now I want the notation to be consistent with [1, Def. 1.2.1] 1 • Variables3 x, y, z, . are terms over Σ. • If f ∈ Σn and t1 . tn are terms over Σ, then f(t1 . tn) is a term over Σ. For n ∈ N we write Tn(Σ) ⊆ T (Σ) for the set of terms containing only the variables x1 . xn. ♦ Definition 1.4 Given a signature Σ, a Σ-structure A in a finite-product cate- gory C, and a term t ∈ Tn(Σ), the interpretation n t A : A → A J K of t w.r.t. to A is defined as follows by induction on the structure of t. n pi • xi A = (A −→ A) (i-th projection for 1 ≤ i ≤ n) J K h t ,..., t i n 1 A n A k fA • f(t1 . tn) A = (A −−−−−−−−−−→J K J K A −−→ A) (for f ∈ Σk) ♦ J K Strictly speaking, the notation t A is ambiguous without specifying the n, since we can always view a term in nJ Kvariables as a term in m variables for m ≥ n. In the following the n will always be clear from the context; a more rigorous notation will be introduced in the next section, where we use ‘terms in context’, which are terms with explicit variable declarations. Lemma 1.5 (Substitution Lemma) Let Σ be a signature, and A a Σ-structure. Then for t ∈ Tn(Σ) and u1 . un ∈ Tk(Σ) we have t[u1/x1, . , un/xn] A = t A ◦ h u1 A,..., un Ai. J K J K J K J K Proof. By structural induction on t. 1.3 Algebraic theories and models Definition 1.6 1. An algebraic theory is a pair (Σ,E) where Σ is a signa- ture, and E = (En ⊆ Tn(Σ) × Tn(Σ))n∈N is a set of families of n-ary equations (a pair (t, u) ∈ En represents an equation t = u). 2.A model of an algebraic theory (Σ,E) in a category C with finite products is a Σ-structure A such that n t A = u A : A → A J K J K for all n ∈ N and (t, u) ∈ En (in this situation we say that A satisfies the equation t = u). 3. The category Σ-Mod(C) of models of (Σ,E) in C is the full subcategory of Σ-Str(C) whose objects are the models of (Σ,E). ♦ 3 Formally we assume there is a given countable set {x1, x2, x2,... } of variables, but in practice we often write x, y, z, . for variables instead of using subscripts. 2 1.4 Lawvere theories Lawvere4 theories are presentations of algebraic theories as ‘syntactic categories’. They are more canonical than representations of theories via signatures and equations, since e.g. the theory of groups can be represented using different signatures, but the Lawvere theory is unique up to isomorphism of categories. The central fact about Lawvere theories is that in the Lawvere-theoretic presentation, models of a theory (Σ,E) in a finite-product category C corre- spond to finite-product preserving functors from the associated Lawvere theory L(Σ,E) to C, and morphisms of models correspond to natural transformations between such functors. This is known as functorial semantics. Definition 1.7 Given an algebraic theory (Σ,E), the binary relation =E is the least binary relation on T (Σ) closed under the following rules. (ax) If (t, u) ∈ En then t =E u. (refl) t =E t (trans) If s =E t and t =E u then s =E u (sym) If s =E t then t =E s (cong) If t1 =E u1, . tn =E un then s[t1/x1, . , tn/xn] =E s[u1/x1, . , un/xn] (subs) If s =E t then s[u1/x1, . , un/xn] =E t[u1/x1, . , un/xn] We write T (Σ,E) = T (Σ)/=E and Tn(Σ,E) = Tn(Σ)/=E for the set of terms (and the terms in n variables) modulo =E. ♦ Intuitively, =E is the least congruence relation on on T (Σ) containing E, or more precisely it is the least equivalence relation on T (Σ) which contains E and is closed under the operations and substitution. It is easy to see that the equations satisfied by a Σ-structure are closed under (refl), (trans), (sym), (cong), and (subs), whence we have the following lemma. Lemma 1.8 Let (Σ,E) be an algebraic theory, and let A be a model of (Σ,E) in a finite-product category C. Then we have t =E u ⇒ t A = u A J K J K for all n ∈ and t, u ∈ T (Σ). N n Definition 1.9 The Lawvere theory L(Σ,E) of an algebraic theory (Σ,E) is the category defined as follows: 4William Lawvere, born 1937, is commonly viewed as the founder of categorical logic. 3 • for each n ∈ N there is an object [n] ∈ L(Σ,E) m • hom([n], [m]) = Tn(Σ,E) for n, m ∈ N • (u1 . un) ◦ (t1 . tm) = (u1[~t/~x], . , un[~t/~x]) where (t ...t ) (u ...u ) [k] −−−−−→1 m [m] −−−−−−→1 n [n] is a composable pair of morphisms and [~t/~x] is short for [t1/x1, . , tm/xm] • id[n] = (x1 . xn) ♦ Thus morphisms in L(Σ,E) are tuples of =E-equivalence classes of terms, com- position is simultaneous substitution, and identities are tuples of equivalence classes of variables. Since we are dealing with equivalence classes we have to check if the composition is well-defined, i.e. if substituting equivalent terms into equivalent terms yields equivalent terms. But this follows directly from (cong) and (subs) in Def. 1.7. Associativity and identity laws are easily verified, thus L(Σ,E) is a well-defined category. Moreover we have the following: Lemma 1.10 For every algebraic theory (Σ,E), the Lawvere theory L(Σ,E) has strict finite products. Proof. [0] is the terminal object, binary product spans are given by (x ...x ) (x ,...,x ) [m] ←−−−−−−1 m [m + n] −−−−−−−−−−→m+1 m+n [n]. for m, n ∈ N, and the pairing operation is given by h(~t), (~u)i = (~t, ~u):[k] → [m + n] for (~t):[k] → [m] and (~u):[k] → [n]. Here’s the central theorem about Lawvere theories. Theorem 1.11 For every algebraic theory (Σ,E) and finite-product category C, the category Σ-Mod(C) of (Σ,E)-models in C is equivalent to the category FP(L(Σ,E), C) of finite-product preserving functors from L(Σ,E) to C and arbitrary natural transformations between them5. Proof. The fine print: for simplicity we assume that C has strictly associative and unital finite products, and that the functors in FP(L(Σ,E), C) strictly preserve finite products. By filling in ∼= ∼= suitable ‘coherence isomorphisms’ of the form γA,B : F (A × B) −→ FA × FB and γ1 : F 1 −→ 1, we can obtain a proof that works without these ‘strictness’ assumptions, but this would only obscure the central ideas. We construct a functor I : FP(L(Σ,E), C) → Σ-Mod(C) 5 L(Σ,E) Thus FP(L(Σ,E), C) is a full subcategory of the functor category C . 4 as follows. Every (strictly) product preserving F : L(Σ,E) → C gets mapped to the Σ-structure IF whose underlying object is F [1], and where operations f ∈ Σn are interpreted as F (f(~x):[n]→[1]) fIF = (F [n] −−−−−−−−−−→ F [1]). With this definition we show easily that t IF = F (t): F [n] → F [1] J K for all t ∈ Tn(Σ) (by induction on t), from which it follows that IF satisfies the equations in E, since for any n ∈ N and (s, t) ∈ En we can argue s IF = F (s) = F (t) = t IF J K J K where the middle equation holds since we have s and t represent the same morphism in L(Σ,E). We define the morphism part of I by I(η) = η[1] for η : F → G, and to check that this is a morphism of Σ-structures we have to show that ηn F [n] [1] G[n] fIF fIG η F [1] G commutes for all f ∈ Σn.