Survey

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Transcript

Nominal Lawvere Theories: A Category Theoretic Account of Equational Theories with Names Ranald Clouston1 Logic and Computation Group, Research School of Computer Science, The Australian National University, Canberra, ACT 0200, Australia Abstract Names, or object-level variables, are a ubiquitous feature in programming languages and other computational applications. Reasoning with names, and related constructs like binding and freshness, often poses conceptual and technical challenges. Nominal Equational Logic (NEL) is a logic for reasoning about equations in the presence of freshness side conditions. This paper gives a category theoretic account of NEL theories, by analogy with Lawvere’s classic correspondence between equational theories and small categories with finite products. This development reveals the abstract structure behind reasoning with equations modulo freshness. Keywords: Lawvere theories, equational logic, nominal sets, fresh names, permutation actions. 1. Introduction 1.1. Names in Computing When we reason about programming languages, logics, process calculi and various other computational applications, we very frequently encounter names, also known as object-level variables. Names and their associated constructs, such as scope, binding, α-equivalence, and capture-avoiding substitution, are now widely recognised as posing significant conceptual and technical Email address: ranald.clouston@anu.edu.au (Ranald Clouston) The author gratefully acknowledges the supervision of Andrew Pitts, and the comments of the anonymous reviewers of this paper and its earlier conference abstract. This research was supported in part by the Woolf Fisher Trust. 1 Preprint submitted to Journal of Computer and System Sciences March 7, 2013 stumbling blocks to fully formal (for example, machine-assisted) metareasoning. For example, the POPLmark challenge [1], a set of concrete benchmarks for mechanising the metatheory of programming languages, recognises coping with binding as one of the main technical challenges. The name-related phenomenon that this paper is concerned with is that of equations that are modulated by side conditions stating certain names are ‘not in the free names of’ certain metavariables. These are often called freshness conditions. Freshness becomes a non-trivial property in the presence of metavariables that stand in for terms whose set of free names we may only have partial information about, and binders which may render names that appear in a term’s concrete syntax anonymous in its abstract syntax. The main reason to study this particular phenomenon is that it is ubiquitous. First, α-equivalence, the very property that defines binding, has this format. Second, many other interesting properties have this format also: First-order logic: Φ ⊃ (∀a. Ψ) = ∀a. (Φ ⊃ Ψ) if a is fresh for Φ; λ-calculus: λ a. f a =η f if a is fresh for f ; π-calculus: (νa x) | y = νa (x | y) if a is fresh for y. (Note here the distinction between the name a, which is part of the objectlevel syntax of these examples, and the metavariables Φ, Ψ, f, x, y. One way to understand this distinction is that a metavariable is always understood to be standing in for some set of possible terms, whereas a name is not replacing the a in the first example above with a first-order logic formula would not give rise to a well-formed formula. It is in order to avoid confusion on this point that we call object-level variables ‘names’ and reserve the word ‘variable’ to the meta-level case.) The second reason to study this phenomena is that it puts us quite close to the familiar and well studied world of equational logic and universal algebra, so a good theory of equations modulo freshness can conceivably be extended to give ‘fresh versions’ of the classic concepts and results of this world. Indeed, this has been done quite successfully over the last few years, with fresh versions produced of term rewriting [2], Birkhoff-style closure conditions [3], categorial universal algebra [4], and monoid theory [5], to name a few. This paper represents a contribution to this research effort. 2 1.2. Nominal Sets Each of the examples cited at the end of the last section, along with this paper, have in common that they use the nominal sets model. This model originated with [6, 7] with the notion of Fraenkel-Mostowski sets, or FM-sets, and was based on nonstandard set theory. In the later [8] the name ‘nominal sets’ was coined for the previously unnamed construction of [7, Section 3]. It is this construction, which requires basic group theory and no axiomatic set theory, which has been most heavily applied, although in Section 4.5 of this paper we observe that FM-sets are an important (indeed, paradigmatic) example of our category theoretic constructions. In the nominal sets model the most elementary notion is that of name permutation. Such permutations form a group, and the standard notion of group action allows us to define the action of a (bijective) renaming on a set, such as a set of terms. From this, with an additional finiteness condition, we can formalise the set of free names of a term abstractly as the support of that term, and hence define freshness, α-equivalence, and so forth. The nominal sets model is only one of a large family of possible approaches to the problems of names; others include combinatory logic [9], de Bruijn indices [10], higher order abstract syntax [11], and locally nameless representations (e.g. [12]). It is outside the scope of this paper to adjudicate the competing merits of these systems (see e.g. the discussion of [13, 14]). However, we will note that the nominal sets model offers the signal advantage of pairing its theory of syntax with an appealing semantics. This mathematical model allows us to put syntactic issues to one side where appropriate, and in this paper to perform category theory internal to the category of nominal sets with a minimum of difficulty. It is not clear how this work would proceed under any other model of names. 1.3. Nominal Equational Logic How, then, do we use the nominal sets model to reason about equations modulo freshness? This was answered in [15] by Nominal Equational Logic (NEL), which provided syntax, semantics, and sound and complete proof rules to do exactly that. Later papers on NEL addressed the problem of representing binders [16], and of providing proof rules that use only equality, and not freshness, as a first class logical connective [17]. These results (although not the more recent developments to them) are given in full technical detail in the author’s thesis [18]. 3 It should be briefly noted at this stage that NEL is not the only answer to the question of equations modulo freshness on the market, with the independently produced Nominal Algebra (NA) [19, 20] addressing the same problem. A quick discussion of these logics’ similarities and differences can be found in [17, Section 6]. Many (perhaps most) results from NEL are transferable to NA and vice versa. However, it is not clear that this is true of the results of this paper, as will be discussed in Section 8. 1.4. Lawvere Theories Lawvere Theories [21] provided the historically first category theoretic account of equational logic and universal algebra. They have since perhaps been surpassed in fame by the concept of algebras for a monad (e.g. [22, Chapter VI]), as monads relate to the fundamental category theoretic notion of adjoint functors, and have found computer science application for modelling side effects [23]. See [24] for a discussion of this history. Nonetheless, Lawvere Theories have remained a live research topic, largely because Lawvere’s view gives a category theoretic account of equational theories, which the monad-based view does not in any obvious sense. Therefore, from the point of view of the study of equational theories (a common point of view in the field of universal algebra), Lawvere Theories are highly useful. In particular, constructions on categories, such as sum, product, and monoidal tensors, can be applied through Lawvere’s translation to equational theories, where applying these constructions to the theories directly would often be obscure and difficult. We are only just beginning to explore the computational applications of such constructions; for example see [25] for a recent paper in this vein. Lawvere’s account (in the many-sorted case) identifies equational theories with small categories with finite products. We call such categories Lawvere Theories. This correspondence is achieved through the construction of a classifying category for each equational theory, and internal language for each Lawvere Theory: classifying category ) equational theories j Lawvere theories internal language It is the construction of the classifying category that is key. The objects of this category are tuples of sorts, which we can consider sorting environments. 4 The arrows are tuples of correctly sorted terms modulo provable equivalence, and composition is term substitution. We also have a correspondence between algebras for a theory T in any Lawvere theory C, and finite product preserving functors from the classifying category of T into C. We refer to [26, Chapter 3] for details. This gives a useful and elegant account of equational logic. But what of the myriad logics out there, many motivated by computational applications, that extend equational logic in various ways? Can Lawvere-style accounts be developed for them? This question has yet to be the subject of a concentrated research program, but we now have such accounts for at least dependently sorted equational logic [27], partial equational logic [28], inequational logic [29], and second-order equational logic [30]. The contribution of this paper is to give such a Lawvere-style account of Nominal Equational Logic. 1.5. Overview of Contributions Section 2 gives an introduction to the nominal sets model, and Section 3 gives an introduction to the syntax and proof theory of Nominal Equational Logic. This paper is intended to be self-contained, but proofs and discussions in these sections have been kept brief and the reader is referred to [8] and [18] for more leisurely introductions to nominal sets and NEL respectively. The main question of this paper is what structure we must impose on a category to produce a correspondence between such categories and NEL theories. Section 4 defines that structure. As NEL is an extension of standard equational logic, we would expect finite products and smallness to be required, and indeed they are. What further structure is required? If we are to even interpret NEL in a category theoretic setting, let alone develop a correspondence, we must interpret the two constructs that are new to NEL. The first are the suspended permutations that are key to the nominal sets model; the second are the freshness side conditions discussed in Section 1.1. These are handled by two novel category theoretic structures called internal Perm-actions and fresh subobjects respectively. We further require that the finite products are well behaved with respect to the internal Perm-action, and call a category with all this structure a Nominal Lawvere Theory. Section 5 shows that NEL can be interpreted in any Nominal Lawvere Theory, and defines the notion of algebra in Nominal Lawvere Theories. Section 6 constructs the classifying category of a theory, whose objects are ‘freshness environments’ rather than sorting environments. This gives rise to a completeness proof (Theorem 6.3) that is considerably less syntactic 5 and difficult than that of [15]. Section 7 contains the proofs of the main correspondences of the paper, while Section 8 points to some future research directions. The main results of this paper were first published as an extended abstract in the proceedings of the conference WoLLIC 2011 [31], for which this is a special issue. They are also available in the author’s thesis [18, Chapter 7]. We do not claim this paper as a substantial scientific advance on this previous work, although some aspects of the presentation have been improved; rather we have used the extra space to provide more discussion, examples and proof details, to help the reader sort through the technical difficulty of these results. 2. Nominal Sets This section introduces the basic mathematics of the nominal sets model, which we will use to define the syntax and proof theory of Nominal Equational Logic in Section 3, and also refer to as we develop the category theoretic account of NEL from Section 4 on. Definition 2.1. Fix a countably infinite set A of atoms, which we will use as names. The set Perm of (finite) permutations consists of all bijections π : A → A whose domain supp(π) , {a | π(a) 6= a} (1) is finite. Perm is a group whose identity is the permutation ι leaving all atoms unchanged, and multiplication is permutation composition π 0 π(a) = π 0 (π(a)). Example 2.2. (i) Perm is generated by transpositions (a b) that map a to b, b to a and leave all other atoms unchanged. (ii) Let A(n) , {(a1 , . . . , an ) ∈ An | ai 6= aj for 1 ≤ i < j ≤ n} . All the tuples of atoms we use in this paper will be from this set. Take ~a = (a1 , a2 . . . , an ), ~a0 = (a01 , a02 . . . , a0n ) ∈ A(n) with disjoint underlying sets. Then we define their generalised transposition as (~a ~a0 ) , (a1 a01 ) (a2 a02 ) · · · (an a0n ) . 6 Definition 2.3. A Perm-set is a set X equipped with a function, or Permaction, (π, x) 7→ π · x from Perm × X to X such that (i) ι · x = x; (ii) π · (π 0 · x) = ππ 0 · x. This is the standard notion of group action, which will be discussed further in Section 4.1 from a category theoretic point of view. Definition 2.4. Given a Perm-set X, we say that a set of atoms a ⊆ A supports x ∈ X if for all π ∈ Perm, supp(π) ∩ a = ∅ implies that π · x = x. Definition 2.5. A nominal set is a Perm-set X with the finite support property: for each x ∈ X there exists some finite a ⊆ A supporting x. If an element x is finitely supported then there is a unique least such support set [7, Prop. 3.4], which we write supp(x) and call the support of x. This may be read as the set of free names of a term. If a ∩ supp(x) = ∅ for some a ⊆ A we say that a is fresh for x and write a # x, capturing the not free in relation. Example 2.6. (i) Any set becomes a nominal set under the trivial Permaction π · x = x, with finite support property supp(x) = ∅; (ii) The set of atoms A is itself a nominal set with Perm-action π · a = π(a) and supp(a) = {a}; (iii) Perm is a nominal set with Perm-action given by conjugation: π · π 0 = ππ 0 π −1 , and support as in (1); (iv) λ-terms with names drawn from A form a nominal set, with Permaction defined by traversing through a term permuting atoms as they appear in λ-abstractions, or on their own as object-level variables. The support of each term is simply the set of all atoms it mentions; this is obviously finite. More interestingly, the λ-terms modulo α-abstraction also form a nominal set under the same Perm-action; the support of each equivalence class of terms is now exactly the set of free names of any representative term of that class. (v) Finite products of nominal sets are themselves nominal sets, given S the element-wise Perm-action and supp(x1 , . . . , xn ) = 1≤i≤n supp(xi ). The same Perm-action and supports apply to the disjoint product A(n) of Example 2.2(ii). 7 (vi) Most of the standard set theoretic operations on nominal sets, such as union and intersection, yield nominal sets. However, given a Perm-set X, say we defined a Perm-action on the powerset P(X) in the obvious way: π · S , {π · x | x ∈ S} . (2) Even if X is a nominal set, this P(X) need not be. For example, a subset of A is finitely supported under (2) if and only if it is finite or cofinite (has finite complement). To stay inside the world of nominal sets we therefore need to restrict ourselves to the finitely supported powerset [7, Ex. 3.5]: Pf s (X) , {S ⊆ X | S is finitely supported in P(X)} . Lemma 2.7. Given a nominal set X, element x ∈ X, permutations π, π 0 ∈ Perm, and finite set of atoms a ⊆ A, (i) a # x implies π · a # π · x; (ii) Order a as ~a ∈ A(n) , and let ~a0 ∈ A(n) be a tuple of the same size that is chosen fresh, in the sense that supp(~a0 ) # (a, x). Then a # x ⇐⇒ x = (~a ~a0 ) · x . (iii) supp(π) # x implies π · x = x. Proof. Standard results; see e.g. [32] or [15]. Definition 2.8. Given Perm-sets X, Y we can define a Perm-action on functions f : X → Y by (π · f )(x) , π · (f (π −1 · x)) . (3) Hence if f maps x 7→ y then π · f maps π · x 7→ π · y. Even if X, Y are nominal sets it does not follow that all functions between them are finitely supported; a finitely supported function is simply one that does have this property under (3). In the particular case that f has empty support, we call it equivariant. This is equivalent to the condition that π · (f (x)) = f (π · x) for all permutations π. Definition 2.9. The category Nom has as objects the nominal sets, and as arrows the equivariant functions between them. 8 3. Nominal Equational Logic This section presents Nominal Equational Logic (NEL), a logic for equality in the presence of names, permutations and freshness side conditions. More strictly speaking, we here see Nominal Equational-only Logic (NEoL), as we give no first-class logical connective for freshness, unlike the logic originally presented in [15]. Freshness connectives are instead treated as syntactic sugar (Definition 3.10). The reason for this presentation is that we wish to give a category theoretic interpretation of NEL, and while equality is a standard categorial concept, freshness is not. Fortunately, in [17] it was shown that the logic without this first-class freshness connective is precisely as powerful as the logic with it, so both can safely be given the label NEL. This version of NEL also mildly generalises that of [15] by using a nominal set, rather than mere set, of sorts, for reasons discussed in Remark 7.5. We hope that giving these logics the same name is an acceptable abuse of notation. Note also that the proof rules given in Figure 1 are slightly simpler than (but logically equivalent to) those presented in the journal version of this paper [31]. This improvement is discussed in [17]. Definition 3.1. A NEL-signature Σ is specified by (i) a nominal set SortΣ , whose elements are called the sorts of Σ; (ii) a nominal set OpΣ , whose elements are called the operation symbols of Σ; (iii) an equivariant typing function mapping each operation symbol op ∈ OpΣ to a type consisting of a finite list ~s = (s1 . . . , sn ) of sorts of Σ and another s ∈ SortΣ . We write this op : ~s → s. Where n = 0 we write op : s. Equivariance of the typing function means that given op : ~s → s, we have π · op : π ·~s → π · s. Example 3.2. A NEL-signature for the untyped λ-calculus can be defined by letting our sorts be the singleton (with trivial Perm-action) {tm} and operation symbols be {var a | a ∈ A} ∪ {lam a | a ∈ A} ∪ {app} representing object-level variables, lambda-abstractions and application respectively. The Perm-action on these operations symbols is π · var a , var π(a) , π · lam a , lam π(a) , 9 π · app , app . The typing function is var a : tm, lam a : (tm) → tm, app : (tm, tm) → tm . Definition 3.3. Fix a countably infinite set Var of variables. Then the terms over Σ are t ::= π x | op t · · · t for π ∈ Perm, x ∈ Var and op ∈ OpΣ . We call π x a suspension. This is a standard construct of nominal syntax, indicating that a permutation is suspended over a (meta)variable, ready to be applied when that variable is replaced by some term. We will write ι x simply as x. We call op t1 · · · tn a constructed term. The sorting environments SEΣ are partial functions Γ : Var * SortΣ with finite domain. We define the set Σs (Γ) of terms of sort s in Γ by (i) if π ∈ Perm and x ∈ dom(Γ) then π x ∈ Σπ·Γ(x) (Γ); (ii) if op : (s1 , . . . , sn ) → s and ti ∈ Σsi (Γ) for 1 ≤ i ≤ n, then op t1 · · · tn ∈ Σs (Γ). Definition 3.4. Because terms contain operation symbols and permutations drawn from nominal sets, it is natural to define a Perm-action upon them. In fact, as observed first in [19] there are two reasonable such notions. • The meta-level Perm-action, (π, t ∈ Σs (Γ)) 7→ π · t ∈ Σπ·s (π · Γ), is π · (π 0 x) π · (op t1 · · · tn ) , , ππ 0 π −1 x ; (π · op)(π · t1 ) · · · (π · tn ) . The set of all terms are finitely supported under this action, which traverses through the term and permutes all atoms it encounters. • The object-level Perm-action, (π, t ∈ Σs (Γ)) 7→ π ∗ t ∈ Σπ·s (Γ), is π ∗ (π 0 x) π ∗ (op t1 · · · tn ) , , ππ 0 x ; (π · op)(π ∗ t1 ) · · · (π ∗ tn ) . The set of all terms are in general not finitely supported under this action. For example, the term x is not emptily supported, despite containing no atoms, because applying any π to it gives the different term π x each time. 10 We will make use of both these actions, but it is the object-level action we turn to first to define substitution: Definition 3.5. Given Γ, Γ0 ∈ SEΣ , a substitution σ : Γ → Γ0 is a map from each x ∈ dom(Γ) to σ(x) ∈ ΣΓ(x) (Γ0 ). Given a term t ∈ Σs (Γ), the term t{σ} ∈ Σs (Γ0 ) is defined by (π x){σ} (op t1 · · · tn ){σ} , , π ∗ σ(x) ; op t1 {σ} · · · tn {σ} . Lemma 3.6. The following properties hold for the definition above: (i) t{id } = t, where id : Γ → Γ is the identity substitution, x 7→ ι x; (ii) (t{σ}){σ 0 } = t{σ; σ 0 }, where (σ; σ 0 ) : Γ → Γ00 is the composition of σ : Γ → Γ0 and σ 0 : Γ0 → Γ00 , given by (σ; σ 0 )(x) , σ(x){σ 0 }. Proof. (i) is trivial; (ii) follows by induction on the structure of t, with the suspension case using the lemma (π ∗ t){σ} = π ∗ (t{σ}), which itself follows by induction on t. The next lemma uses substitution to relate the two Perm-actions of Definition 3.4: Lemma 3.7. Given t ∈ Σs (Γ) and π ∈ Perm, π · t = π ∗ t{π −1 −} where (π −1 −) : Γ → π · Γ is the substitution mapping each x 7→ π −1 x. Proof. An easy induction on the structure of t; see [15, Lemma 5.2] or [19, Lemma 2.3]. Definition 3.8. A freshness environment is a partial function ∇ with finite domain on Var, mapping each x ∈ dom(∇) to a pair (a, s) where a is a finite set of atoms, s ∈ SortΣ , and a # s. The set of freshness environments FEΣSis then a nominal set under the action (π · ∇)(x) = (π · a, π · s); supp(∇) is x∈dom(∇) supp(∇(x)). If ∇(xi ) = (ai , si ) for 1 ≤ i ≤ n, we write ∇ as (a1 ≈ x 1 : s 1 , . . . , an ≈ xn : s n ) . 11 (4) The intended meaning is that ai is fresh for xi , which has sort si . These environments will capture the freshness side conditions we discussed in the introduction. We will abbreviate {a} ≈ x : s as a ≈ x : s and ∅ ≈ x : s as x:s If ∇ is as above and a is a finite set of atoms fresh for (s1 , . . . , sn ) then a we define a new freshness environment ∇≈ by a , (a1 ∪ a ≈ x 1 : s 1 , . . . , an ∪ a ≈ xn : s n ) . ∇≈ (5) Each ∇ ∈ FEΣ gives rise to a sorting environment ∇: ∈ SEΣ by taking the second projection. Definition 3.9. A NEL-judgement has the form ∇ ` t ≈ t0 : s where ∇ ∈ FEΣ , s ∈ SortΣ and t, t0 ∈ Σs (∇: ). A NEL-theory T is a collection of such judgements, which we call its axioms. Definition 3.10. We introduce freshness judgements not as first class members of the logic, as in [15], but as syntactic sugar: Given t ∈ Σs (∇: ) and finite a ⊆ A such that a # s, 0 supp(~a ) ∇ `T a ≈ t : s , ∇≈ `T t ≈ (~a ~a0 ) ∗ t : s where ~a ∈ A(n) is an ordering of a and ~a0 ∈ A(n) is a tuple of the same size such that supp(~a0 ) # (∇, a, t). Demonstrating that this definition really does capture the correct notion of freshness was the subject of the paper [17]. Example 3.11. Equations with freshness side conditions can now be written as NEL judgements with minimal effort. For example, η-equivalence for the untyped λ-calculus (Example 3.2) is simply (η) (a ≈ x : tm) ` lam a (app x var a ) ≈ x : tm . β-equivalence is slightly more involved, as it is defined in terms of captureavoiding substitution. We could follow [20, Ex. 2.15], which uses the related system of Nominal Algebra to define explicit operation symbols and axioms for capture-avoiding substitution, technically giving us the λσ-calculus. Alternatively, we can fold the definitions of that paper into a more involved definition of β-equivalence: 12 (β1 ) (a ≈ x : tm, y : tm) ` app (lam a x) y ≈ x : tm (β2 ) (y : tm) ` app (lam a var a ) y ≈ y : tm (β3 ) (x : tm, b ≈ y : tm) ` app (lam a (lam b x)) y ≈ lam b (app (lam a x) y) : tm (β4 ) (x1 : tm, x2 : tm, y : tm) ` app (lam a (app x1 x2 )) y ≈ app (app (lam a x1 ) y) (app (lam a x2 ) y) : tm (β5 ) (b ≈ x : tm) ` app (lam a x) var b ≈ (a b) x : tm Our final issue is how to define α-equivalence; that is, how do we say that lam a binds the atom a in its argument? Dealing with binding in general is the subject of [16], but in this case it is simply done by asserting that a is not a free name of lam a t for any term t: (α0 ) (x : tm) ` a ≈ lam a x : tm recalling this is syntactic sugar for the equational judgement (α) (b ≈ x : tm) ` lam a x ≈ lam b (a b) x : tm Example 3.12. For the π-calculus [33], let our sorts be {tm} and our operation symbols include {res a | a ∈ A} ∪ {in a,b | (a, b) ∈ A × A} ∪ {par } representing restriction, input and parallel composition (and in addition to symbols for output and so forth). The Perm-actions on these operation symbols are π · res a , res π(a) , π · in a,b , in π(a),π(b) , π · par , par while the typing function is res a : (tm) → tm, in a,b : (tm) → tm, The axioms for binding are then (α1 ) (x : tm) ` a ≈ res a : tm (α2 ) (x : tm) ` b ≈ in a,b x : tm 13 par : (tm, tm) → tm . (refl) (trans) ∇`t≈t:s ∇ ∈ FEΣ , t ∈ Σs (∇: ) ∇ ` t ≈ t0 : s ∇ ` t0 ≈ t00 : s ∇ ` t ≈ t00 : s (subst) (weak) (symm) ∇ ` t ≈ t0 : s ∇ ` t0 ≈ t : s ∇ ` t ≈ t0 : s ∇ ≤ ∇0 ∈ FEΣ ∇0 ` t ≈ t0 : s ∇0 ` σ ≈ σ 0 ∇0 ` σ : ∇ ∇ ` t ≈ t0 : s σ, σ 0 : ∇: → (∇0 ): ∇0 ` t{σ} ≈ t0 {σ 0 } : s (atm-elim) (susp) a ∇≈ ` t ≈ t0 : s a # (∇, t, t0 ) ∇ ` t ≈ t0 : s (ds(π, π 0 ) ≈ x : s) ` π x ≈ π 0 x : π · s ds(π, π 0 ) # s Figure 1: Proof rules for NEL (α3 ) (b ≈ x : tm) ` in a,a x ≈ in a,b (a b) x : tm The other axioms for structural congruence are simple to write down, e.g. (−) (x : tm, a ≈ y : tm) ` res a (par x y) ≈ par (res a x) y Definition 3.13. [Logical Consequence] The set of theorems of a NELtheory T is the least set of judgements containing the axioms of T and closed under the rules of Fig. 1. We write ∇ `T t ≈ t0 : s to indicate that the judgement is a theorem of T. Fig. 1 uses the following new pieces of notation: • In (weak) the relation ∇ ≤ ∇0 holds if dom(∇) ⊆ dom(∇0 ) and for all x ∈ dom(∇) we have ∇(x) = (a, s) and ∇0 (x) = (a0 , s) so that a ⊆ a0 . • Let ∇ be as (4), so for each 1 ≤ i ≤ n we have ai asserted fresh for xi of sort si . In rule (subst) ∇0 ` σ ≈ σ 0 stands for the hypotheses ∇0 ` σ(xi ) ≈ σ 0 (xi ) : si for 1 ≤ i ≤ n; 14 • Taking ∇ as above, in rule (subst) ∇0 ` σ : ∇ stands for the hypotheses ∇ 0 ` ai ≈ σ(xi ) : si . Note that this is sugared according to Definition 3.10. We need this condition to stop a term with an atom a in its support getting substituted in for a variable x for which we have guaranteed a’s freshness. • In (susp), The disagreement set of π and π 0 is ds(π, π 0 ) , {a | π(a) 6= π 0 (a)} . Note also that (atm-elim) and (susp) carry side conditions relating to freshness. These do not refer to the sugared freshness connective ≈ . Rather, they refer to the not-in-the-support-of relation # of Definition 2.5 over the nominal sets FEΣ (Definition 3.8), Pf s (A) (Example 2.6), and Σs (∇: ) (with respect to the meta-level action of Definition 3.4). 4. Nominal Lawvere Theories This section will provide the necessary structure that a category must possess to correspond to a NEL-theory. In particular, we will see the new categorial constructs of internal Perm-actions and fresh subobjects, which will allow us to interpret the new NEL constructs of suspensions and freshness environments respectively. 4.1. Internal G-actions This section, and the next, are developed in terms of a general group G, with identity e, multiplication (g 0 , g) 7→ g 0 g and inverses g 7→ g −1 . The definitions are given in this generality to emphasise that they do not depend on the specific structure of any particular group, and to support comments made about generalised nominal sets in Section 8. However from Section 4.3 on we will set G to be Perm, the group of finite atom permutations, and the reader is encouraged to read these sections in that light. Let C be any category, with objects ob C and arrows ar C. Definition 4.1. A category C has an internal G-action if for each g ∈ G and C ∈ ob C there is a an arrow gC ∈ ar C with domain C such that (i) eC is the identity arrow idC ; 15 0 (ii) (g 0 g)C = gg·C ◦ gC , where g · C is the codomain of gC . We will sometimes write gC as g where this does not cause confusion. Remark 4.2. G may be considered as a category with one object •, whose identity is e and composition is multiplication. Definition 4.1 then asks that the map ar G × ob C → ar C respects the category structure of G. As natural as this requirement might seem, the construction does not seem to be an example of any widely known category theoretic concept. It is, however, equivalent to a cofunctor G → C, in the sense of [34, Chapter 4]. This is not shorthand for ‘contravariant functor’, but rather a generalisation of the comorphisms of [35]. Lemma 4.3. Given a category C with an internal G-action, we can define a functor from G to the category of categories, mapping • 7→ C, and each g to an endofunctor on C written g · − : C → C: • g · C is defined to be the codomain of gC ; • Given a C-arrow f : C → D, g · f : g · C → g · D is defined to be the arrow g·C (g −1 )g·C /C f /D gD /g·D . (6) (Compare this to the definition for functions (3)). Proof. Functoriality of the functor from G, and the functor g · −, requires that, for all g, g 0 ∈ G, C ∈ ob C and f, f 0 ∈ ar C, we check (i) (ii) (iii) (iv) e · f = f (and hence e · C = C); g 0 · (g · f ) = g 0 g · f (and hence g 0 · (g · C) = g 0 g · C); g · idC = idg·C ; g · (f 0 ◦ f ) = (g · f 0 ) ◦ (g · f ). These properties follow easily from Definition 4.1. Example 4.4. (i) Any category C has the trivial internal G-action defined by setting gC = idC for all g ∈ G, C ∈ C. g · − is then the identity endofunctor idC . (ii) G itself has an internal G-action, with g• = g. Following (6), g · g•0 is the conjugation (gg 0 g −1 )• . 16 (iii) A G-set is a functor from G to the category of sets, or equivalently a set X equipped with a function (g, x) 7→ g · x : G × X → X, such that e · x = x and g 0 · (g · x) = g 0 g · x. This function is called a G-action. Another point of view is to consider the G-set X itself as a category, whose objects are elements of X, arrows are pairs (g, x) : x → g · x, identity on x is (e, x), and composition (g 0 , g · x) ◦ (g, x) is (g 0 g, x). This category is called an action groupoid (e.g. [36]), and is evidently equipped with an internal G-action. Definition 4.5. The category GSet of G-sets has as arrows functions f : X → Y that are equivariant: g · (f (x)) = f (g · x). Following the precedent that each functor from G to the category of sets defines a G-set, we can say a functor from G to the category of categories, as with Lemma 4.3, defines a G-category. Remark 4.6. The small G-categories are easily seen to be equivalent to the categories internal in GSet, in the sense of [37, Chapter B2]. That is, ob C and ar C are G-sets, and the domain, codomain, identity and composition maps are equivariant. Why, then, do we not employ this reasonably familiar setting, rather than starting with the novel internal G-actions? The next example will show that the converse of Lemma 4.3 does not hold; not all G-categories are induced by internal G-actions. Intuitively, internal G-actions are more powerful because they witness the G-action on the category via arrows of the category. Example 4.7. Given a G-set X, consider the category whose objects are elements of X and arrows are identities only. We can define G-actions on the objects and arrows of this category in the obvious way, mapping x 7→ g · x and idx 7→ idg·x , but there is evidently no internal G-action using the arrows of the category that generates these G-actions. Lemma 4.8. The following results hold for all internal G-actions: (i) Each gC : C → g · C is iso, with inverse (g −1 )g·C ; (ii) The arrows gC : C → g · C are the components of a natural transformation g : idC → ˙ (g · −); Proof. Easy consequences of Definition 4.1 and (6). 17 Lemma 4.9. Suppose we have small categories C, C 0 equipped with internal G-actions, and a functor F : C → C 0 that strictly preserves that action, so F (gC ) = gF C for all C ∈ obC. Then (i) F is internal to GSet; (ii) Given two such functors F, F 0 , any natural transformation φ : F → ˙ F0 is internal to GSet. Proof. F (g·C) is the codomain of F (gC ), and g·F C is the codomain of gF C , but these arrows are equal so g·F C = F (g·C). Now (g·F f )◦gF C = gF C 0 ◦F f by naturality (Lemma 4.8(ii)), which is F (gC 0 ) ◦ F f = F (g · f ) ◦ F (gC ) = F (g·f )◦gF C . But gF C is iso (Lemma 4.8(i)) and hence epi, so g·F f = F (g·f ). This proves (i). (ii) is straightforward. 4.2. Equivariant finite products Following Lawvere’s standard account, we will require that our category C has finite products. These are given by assigning to each finite collection of C-objects C1 , . . . , Cn and each 1 ≤ i ≤ n a projection arrow pri (C1 , . . . , Cn ) : C1 × · · · × Cn → Ci . We will generally write pri (C1 , . . . , Cn ) as pri , and the nullary product object as 1. However, we will need to go one step further to ask that these finite products be equivariant: Definition 4.10. A G-category C with all finite products is said to have equivariant finite products if, for all g ∈ G, the endofunctor g · − : C → C preserves all finite products. We must therefore check: (i) g · 1 = 1; (ii) g · (pri (C1 , . . . , Cn )) = pri (g · C1 , . . . , g · Cn ). Remark 4.11. It is easy to confirm that equipping a small G-category with equivariant finite products is equivalent to requiring that it has products internal to GSet, in the sense that the maps defining the terminal object, product objects, projection arrows and unique arrows induced are all equivariant functions. Example 4.12. (i) If a category C with finite products is equipped with the trivial internal G-action of Example 4.4(i), then those products are evidently equivariant. 18 (ii) Given a G-set X, let [X] be the category whose objects are finite (possibly empty) lists of elements of X, and arrows (x1 , . . . , xm ) → (y1 , . . . , yn ) are functions {1, . . . , n} → {1, . . . , m} (note the reversed direction). [X] has as terminal object the empty list ( ), and binary products defined by concatenation: (x1 , . . . , xm ) × (y1 , . . . , yn ) , (x1 , . . . , xm , y1 , . . . , yn ) with pr1 (i) = i for 1 ≤ i ≤ m and pr2 (j) = m + j for 1 ≤ j ≤ n. Now because X is a G-set we can define a G-action on ob [X] elementwise: g · (x1 , . . . , xm ) , (g · x1 , . . . , g · xm ) . The internal G-action g(x1 ,...,xm ) is simply the identity on {1, . . . , m}; under these definitions it is routine to check that [X] has equivariant finite products. 4.3. Finite Support Definition 4.13. Let C be a category equipped with an internal Permaction. A set of atoms a ⊆ A supports a C-object C if for all π ∈ Perm, supp(π) ∩ a = ∅ implies that π · C = C. Support for C-arrows is defined similarly. The internal Perm-action is said to be finitely supported if all objects and arrows of C have finite support. In practice we need only check C-arrows, as each object C has the same support as its identity idC . Note that the internal Perm-actions πC themselves have finite support, contained in supp(π) ∪ supp(C). Note also, building on Remark 4.6, that such a C is not just internal to GSet, but to Nom (Definition 2.9) also. Example 4.14. (i) The category C with trivial internal Perm-action has empty support for all arrows. (ii) The one-object category Perm has each arrow π supported by supp(π). (iii) If we consider a nominal set X as an action groupoid, following Example 4.4(iii), then each arrow (π, x) : x → π · x is supported by supp(π) ∪ supp(x). (iv) Given a nominal set X, the category [X] of Example 4.12(ii) has arrows (x1 , . . . , xm ) → (y1 , . . . , yn ) supported by supp(x1 , . . . , xm , y1 , . . . , yn ). 19 4.4. Fresh Subobjects The definition below is the most involved of this paper. Intuitively, the fresh subobject of an object C with respect to a finite set of atoms a is the subobject formed by removing all ‘elements’ of C whose support intersects with a. Formally, the definition is structured as follows. The first four properties (i)-(iv) can be thought of as requirements that the construction of fresh subobjects respect or preserve certain structure: empty set, union, Permaction and products. Properties (v)-(vii) should be thought of as the arrow theoretic analogues of the logical structure of freshness. Definition 4.15. A category C with internal Perm-action and finite products has fresh subobjects if for each finite set of atoms a and C-object C such that a # C, there is a C-arrow iaC with codomain C so that the following conditions a is defined to be its domain): hold (where C ≈ (i) (ii) (iii) (iv) i∅C is the identity idC ; 0 0 iaC∪ a = iaC ◦ iaC ≈ a ; π·a a π · iC = iπ·C ; iaC1 ×···×Cn = iaC1 × · · · × iaCn : 0 ∅ C≈ RRRRi∅C || C (C RRRR ) kk5 C k k k kkkkidC π ≈ a ≈ a0 ) ia ≈ a C / C≈ a || ia C 0 a ∪ a C≈ a ∪ a0 iC /C ≈ a TTTTiaC π −1 gggg3 C g g TTTT g g g ) a · (C ≈ ) VV π·iaC kkk C k VVVV k k VV+ ukk π || π · C 3 h h h hhhhh π·a (π · C)≈ iπ·a π·C a a (C1 × · · · × Cn )≈ [[[[i[C1 ×···×Cn || ≈ a [[[[[[[[ [[C c c cc cc1 1 cccaccccc a c c ≈ a iC ×···×iCn 1 C1 × · · · × Cn 20 × · · · × Cn (v) (Fresh permutations): Given π ∈ Perm, if supp(π) # C then πC ≈ supp(π) is the identity idC ≈ supp(π) ; (vi) (Fresh epis): If we have a finite set of atoms a and parallel C-arrows a a f :C→ → D such that f ◦ iC = g ◦ iC and a # (f, g), then f = g; (vii) (Fresh arrows): Suppose we have sets of atoms a, a0 which may be ordered ~a, ~a0 ∈ A(n) , and a C-arrow f : D → C. If a # C, a0 # (a, f ) 0 0 a and (~a ~a0 )C ◦ f ◦ iaD = f ◦ iaD , then we have a unique fˆ : D → C ≈ such a ˆ that iC ◦ f = f : 0 D ≈ a0 ia D /D CC CC f CC fˆ CC ! a C≈ ia C /Cg (7) (~a ~a0 )C Where there is no confusion we will abbreviate iaC to ia , or simply i. Example 4.16. The two examples of Example 4.12 both have the trivial fresh subobjects iaC = idc . Note that with [X], the fresh subobject a (x1 , . . . , xm )≈ need only be defined where a # (x1 , . . . , xm ). 4.5. FM-categories and Nominal Lawvere Theories Definition 4.17. A category equipped with a finitely supported internal Perm-action, equivariant finite products and fresh subobjects is an FMcategory. If it is small, it is a Nominal Lawvere Theory. Remark 4.18. The two categories of Example 4.16 are FM-categories. [X] is further a Nominal Lawvere Theory, and any small category C with the trivial definitions is likewise. However, these examples are not wholly convincing as their fresh subobjects are trivial, and so the complexities of Definition 4.15 are not yet well motivated. However, we will next give the natural and well-known example of FM-sets [7], and show that they fulfill every aspect of our definition. This justifies the ‘FM-category’ terminology used above. We will see another example of an FM-category, the classifying category of a NEL-theory, in Section 6. 21 Definition 4.19. The defined by V0 Vα+1 Vλ familiar von Neumann hierarchy of sets (e.g. [38]) is , , , ∅ P(Vα ) S α<λ Vα (λ a limit ordinal) . We then define the von Neumann universe as [ V , Vα α as α ranges over the ordinals. Similarly, we define the Fraenkel-Mostowski hierarchy, or FM-hierarchy, of nominal sets by FM0 FMα+1 FMλ , , , ∅ A + Pf s (FMα ) S (λ a limit ordinal) . α<λ FMα Note the inclusion of atoms and the restriction of powerset to the finitely supported subsets. Each stage of this hierarchy is a nominal set by Example 2.6. The Fraenkel-Mostowski universe, or FM-universe, is defined to be [ FM , FMα α as α ranges over the ordinals. Definition 4.20. FM is divided at each stage past ∅ by disjoint union, into atoms and sets. We call these sets the FM-sets. The permutation action on FM-sets is defined in the evident way: π · X = {π · x | x ∈ X} . (8) Definition 4.21. We can formulate most of the usual set theoretic constructions with FM-sets, with the exception of any construct that would require infinite support (notably, choice). In particular, given FM-sets X, Y , we define FM-functions X → Y in the usual way, noting that as members of the FM-hierarchy they must have finite support under the action (ref. (3)): (π · f )(x) = π · f (π −1 · x) . 22 (9) Definition 4.22. The FM-sets and FM-functions between them form a category FM-Set. Similarly, for any limit ordinal λ, the FM-sets and FMfunctions between them that are contained in FMλ form a small category FMλ -Set. Lemma 4.23. FM-Set is an FM-category, given the definitions of internal Perm-action and fresh subobjects presented below. Proof. Given any FM-set X define π · X as (8). Then the internal Permaction πX : X → π · X is πX (x) , π · x . This clearly obeys Definition 4.1. The Perm-action on FM-functions, following (6), is exactly (9), so we know by construction that this internal Perm-action is finitely supported. The terminal object {∅} has empty support as required (terminal objects such as {a} that have non-empty support are not a problem, so long as there exists some emptily supported such object). It is easy to confirm that all other finite products, defined in the usual way, are also equivariant. Given an FM-set X and finite set of atoms a, the fresh subobject iaX is the inclusion into X from the FM-set a , {x ∈ X | a # X} . X≈ Conditions (i)-(iv) of Definition 4.15 are easy consequences of these fresh supp(π) subobjects being inclusions. (v) follows because for all x ∈ X ≈ , π·x = x by Lemma 2.7(iii), so πX ≈ supp(π) = idX ≈ supp(π) . a , where a # (f, g). Then let (vi): Say f (x) = g(x) for all x ∈ X ≈ (n) ~a ∈ A be an ordering of a and, given any x ∈ X, let ~a0 ∈ A(n) be a fresh tuple with supp(~a0 ) # (a, f, g, x). Then a # (~a ~a0 ) · x by Lemma 2.7(i), so (~a ~a0 ) · f (x) = f ((~a ~a0 ) · x) = g((~a ~a0 ) · x) = (~a ~a0 ) · g(x). Apply (~a ~a0 ) to both sides to get f (x) = g(x). (vii): The meaning of the unique arrow fˆ in 0 a Y≈ i /Y fˆ CC CC f CC CC C! a X≈ i /X h (~a ~a0 ) is that a is fresh for all elements of the image of f . 23 The top-right direction tells us that a0 # y ∈ Y implies (~a ~a0 )·f (y) = f (y). This, combined with the fact that a0 # (a, f ), tells us that a # f (y) by Lemma 2.7(ii). Now take any y ∈ Y , and introduce another tuple ~a00 of the same size such that supp(~a00 ) # (a, a0 , f, y). a0 # (~a0 ~a00 ) · y, so by the above paragraph, a # f ((~a0 ~a00 ) · y). But this equals (~a0 ~a00 ) · f (y). Applying (~a0 ~a00 ) to both sides finally gives us a # f (y). Corollary 4.24. The small subcategory FMλ -Set is a Nominal Lawvere Theory for any limit ordinal λ. The example of FM-sets above shows that the Fresh Arrows condition allows us to talk about the freshness of atoms over the image of an arrow, in an entirely arrow-theoretic way without discussion of elements. The next definition and lemma show how this condition can be used in practice. Definition 4.25. Suppose that a # (f : C → D) in C. Let ~a ∈ A(n) be an ordering of a and ~a0 ∈ A(n) be a fresh tuple of the same size. (~a ~a0 ) defines a natural transformation idC → ˙ (~a ~a0 ) · − by Lemma 4.8(ii), so 0 a ∪ supp(~a ) C≈ (~a ~a0 ) /C i f /D (~a ~a0 ) /C 0 a ∪ supp(~a ) C≈ i f /D commutes. But (~a ~a0 )C ≈ a ∪ supp(~a0 ) is the identity by Definition 4.15(v), so 0 (~a ~a ) ◦ f ◦ i = f ◦ i. Therefore by Def. 4.15(vii), the Fresh Arrows condition, a we induce a unique arrow which we will call f ≈ : 0 a ∪ supp(~a ) C≈ i / C≈ a a f≈ i f a D≈ /C i /D g (~a ~a0 ) By the uniqueness of this arrow this assignment is functorial, in the sense a a a a that (idC )≈ = idC ≈ a and (g ◦ f )≈ = g≈ ◦ f≈ . a Lemma 4.26. All fresh subobjects iaC : C ≈ → C are mono. 24 ≈ a , and take ~a as an ordering Proof. Say ia ◦ f = ia ◦ g for f, g : D → →C supp(~a0 ) 0 of a and ~a as a fresh tuple of the same size. (~a ~a0 )C ◦ iaC ◦ f ◦ iD = a ∪ supp(~a0 ) ≈ supp(~a0 ) 0 0 ◦f by Definition 4.25. By the naturality of (~a ~a ), (~a ~a )C ◦ iC supp(~a0 ) Definition 4.15(v) and Definition 4.25 again, this equals iaC ◦ f ◦ iD . Therefore by Def. 4.15(vii) we have a unique arrow: 0 supp(~a ) D≈ /D i f g a / C≈ i a C≈ / i /Cg (~a ~a0 ) But i ◦ f = i ◦ g, so by uniqueness f = g. Definition 4.27. Given FM-categories C, C 0 , an FM-functor F : C → C 0 is a functor that strictly preserves (i) the internal Perm-action: F πC = πF C ; (ii) finite products: F 1C = 1F C and F (pri (C1 , C2 )) = pri (F C1 , F C2 ); (iii) fresh subobjects: F iaC = iaF C . F M (C, C 0 ) is the category of FM-functors C → C 0 and natural transformations between them. 5. Algebras for NEL in FM-categories Typically, we would interpret Nominal Equational Logic into the category FM-Set of FM-sets and FM-functions. In this section we will see that FM-categories have all the structure we need to interpret NEL, with the internal Perm-action giving us suspensions, and fresh subobjects giving us our freshness environments. Definition 5.1. Given a NEL-signature Σ and FM-category C, a Σ-structure M in C is defined by (i) An equivariant function M J−K : SortΣ → ob C; (ii) An equivariant function M J−K : OpΣ → ar C where M JopK : M Js1 K × · · · × M Jsn K → M JsK if op has type (s1 , . . . , sn ) → s. 25 Where the structure in question is clear we will write M JsK as JsK and so forth. Definition 5.2. Given a freshness environment ∇ as (4) and a Σ-structure in an FM-category C we define the C-object an a1 × · · · × Jsn K≈ . J∇K , Js1 K≈ Given a term t ∈ Σs (∇: ) the value arrow J∇ ` t : sK is a C-arrow J∇K → JsK: J∇ ` π xi : si K J∇ ` op t1 · · · tn : sK , , πJsi K ◦ iaJsii K ◦ pri ; JopK ◦ hJ∇ ` t1 : s1 K, . . . , J∇ ` tn : sn Ki . Lemma 5.3. (i) J∇ ` π ∗ t : π · sK = πJsK ◦ J∇ ` t : sK; (ii) Given ∇ ≤ ∇0 there exists an arrow weak : J∇0 K → J∇K such that for any t ∈ Σs (∇: ), J∇0 ` t : sK = J∇ ` t : sK ◦ weak; a a (iii) J∇≈ ` t : sK = J∇ ` t : sK ◦ iaJ∇K , where ∇≈ is as (5); (iv) If ∇ is as (4) then J∇ ` t : sK = J(x1 : s1 , . . . , xn : sn ) ` t : sK ◦ (iaJs11 K × · · · × iaJsnn K ) . (v) Given Γ ∈ SEΣ with domain {x1 , . . . , xn }, a substitution σ : Γ → ∇: , and a term t ∈ Σs (Γ), J∇ ` t{σ} : sK = JΓ0 ` t : sK ◦ h. . . , J∇ ` σ(xi ) : Γ0 (xi )K, . . .i where Γ0 is the freshness environment defined by Γ0 (x) , (∅, Γ(x)). Proof. (i) follows by induction on the structure of t, using the naturality of the internal Perm-action π in the constructed term case. (ii): take ∇ as (4) and say ∇0 (xi ) = (ai ∪ a0i , si ) for 1 ≤ i ≤ n. Then set 0 0 weak , hia1 ◦ pr1 , . . . , ian ◦ prn i . The result follows by another induction on t, and (iii) is an immediate corollary. (iv) is another induction on t and (v) likewise, using (i) in the suspension case. 26 Definition 5.4. A structure M in an FM-category C satisfies the judgement ∇ ` t ≈ t0 : s if M J∇ ` t : sK = M J∇ ` t0 : sK If M satisfies all axioms of a theory T then it is a T-algebra in C. Definition 5.5. Suppose ∇ ` a ≈ t : s is satisfied, so by Definitions 3.10 and supp(~a0 ) supp(~a0 ) 5.4, J∇≈ ` t : sK = J∇≈ ` (~a ~a0 ) ∗ t : sK. Then by Lemma 5.3(i) 0 0 and (iii), J∇ ` t : sK ◦ isupp(~a ) = (~a ~a0 ) ◦ J∇ ` t : sK ◦ isupp(~a ) . By Definition 4.15(vii) a unique arrow is induced which we will call J∇ ` a ≈ t : sK: 0 supp(~a ) J∇K≈ i / J∇K J∇`a ≈ t:sK CC CCJ∇`t:sK CC CC ! a JsK≈ i / JsK j (~a ~a0 ) Lemma 5.6. Take ∇ as (4). (i) Given a term t ∈ Σs (∇: ) and substitution σ : ∇: → (∇0 ): , if the arrows J∇0 ` ai ≈ σ(xi ) : si K are defined for 1 ≤ i ≤ n then J∇0 ` t{σ} : sK equals σ(x1 ) : s1 K, . . . , J∇0 ` an ≈ σ(xn ) : sn Ki ; J∇ ` t : sK ◦ hJ∇0 ` a1 ≈ (ii) (iii) (iv) (v) idJ∇K = hJ∇ ` a1 ≈ x1 : s1 K, . . . , J∇ ` an ≈ xn : sn Ki; a a iaJ∇K = hJ∇≈ x1 : s1 K, . . . , J∇≈ xn : sn Ki; ` a1 ≈ ` an ≈ πJ∇K = hJ∇ ` π · a1 ≈ π x1 : π · s1 K, . . . , J∇ ` π · an ≈ π xn : π · sn Ki; Take ∇1 , ∇2 with disjoint domain. Then prj (J∇1 K, J∇2 K) is hJ∇1 ∪ ∇2 ` a1 ≈ x1 : s1 K, . . . , J∇1 ∪ ∇2 ` an ≈ xn : sn Ki if ∇j is (4) for j = 1, 2. Proof. (i) follows by Lemma 5.3(iv) and (v). For (ii)-(v) we first need to confirm that the arrows in question exist, following Definition 5.5. For example, for (ii), we need that 0 0 iai ◦ pri ◦ isupp(~ai ) = (~ai ~a0i ) ◦ iai ◦ pri ◦ isupp(~ai ) where ~ai orders ai and ~a0i is a fresh tuple of the same size. We’ll explicitly prove a slightly simpler version of this, where ∇ = (a ≈ x : s), so we do not 27 have to worry about the projection arrows. Then by the naturality of (~a ~a0 ) we have 0 i i / JsK≈ a / JsK JsK≈ a ∪ supp(~a ) (~a ~a0 ) (~a ~a0 ) 0 JsK≈ a ∪ supp(~a ) i / JsK≈ supp(~a0 ) i / JsK But the left-most arrow (~a ~a0 )JsK≈ a ∪ supp(~a0 ) is the identity by Definition 4.15(v). Adding our projections back in causes no problem by Definition 4.15(iv). The cases for (iii)-(v) follow similarly. The equalities (ii), (iii) and (v) then follow by applying iai ◦ pri to each side, as iai is mono (Lemma 4.26) and projections jointly mono. (iv) follows by applying iπ·ai ◦ pri to each side. Theorem 5.7 (Soundness). If M is a T-algebra in C and ∇ `T t ≈ t0 : s then M satisfies that judgement. Proof. We need to show closure under the proof rules of Fig. 1. Closure under (refl), (symm) and (trans) is trivial, and (weak) follows immediately from Lemma 5.3(ii). (subst): Given ∇ as (4) the arrows J∇0 ` a1 ≈ σ(x1 ) : s1 K (Definition 5.5) are defined for 1 ≤ i ≤ n, so by Lemma 5.6(i) σ(x1 ) : s1 K, . . .i J∇0 ` t{σ} : sK = J∇ ` t : sK ◦ hJ∇0 ` a1 ≈ and similarly for t0 {σ 0 }. We have J∇ ` t : sK = J∇ ` t0 : sK, while iai ◦ J∇0 ` ai ≈ σ(xi ) : si K = J∇0 ` σ(xi ) : si K = J∇0 ` σ 0 (xi ) : si K = iai ◦ J∇0 ` ai ≈ 0 ai σ (xi ) : si K. But i is mono by Lemma 4.26, so we are done. (atm-elim): J∇ ` t : sK ◦ ia = J∇ ` t0 : sK ◦ ia by Lemma 5.3(iii), so J∇ ` t : sK = J∇ ` t0 : sK by Definition 4.15(vi). 0 0 (susp:) we need to prove that π ◦ ids(π,π ) = π 0 ◦ ids(π,π ) . Now π −1 ◦ π 0 ◦ 0 0 0 0 −1 0 ids(π,π ) = ids(π,π ) ◦ π −1 πJsK π ), ≈ ds(π,π 0 ) by naturality, but ds(π, π ) = supp(π 0 so we can apply Definition 4.15(v) to make this equal ids(π,π ) . Applying the 0 identity π −1 ◦ π to the front gives us π −1 ◦ π ◦ ids(π,π ) . But π −1 is iso, and therefore mono, so we are done. Definition 5.8. A Σ-homomorphism M → M 0 in C is an equivariant function h− from SortΣ to C-arrows, with hs : M JsK → M 0 JsK, such that hs ◦ M JopK = M 0 JopK ◦ (hs1 × · · · × hsn ) 28 (10) for all op : (s1 , . . . , sn ) → s. The T-algebras in C and Σ-homomorphisms between them form the category C T . 6. The Classifying Category Given a NEL-theory T, this section defines a nominal Lawvere theory called the classifying category, Cl(T). This construction gives rise to a simple completeness proof, and will be used for the key correspondences of this paper in the next section. Lemma 6.1. Fix an ordering v1 , v2 , . . . on the set of variables Var and let T be a theory over a signature Σ. Then the following constructions define a nominal Lawvere theory, which we will call the classifying category and write Cl(T). Objects: ob Cl(T) is the set of freshness environments whose domain is an initial sublist of Var, {v1 , . . . , vn }, so the typical object is v1 : s1 , . . . , an ≈ vn : sn ) . ∇ = (a1 ≈ (11) Arrows: Taking ∇ as (11), Cl(T)-arrows f : ∇0 → ∇ are defined by ∇0 ` (a1 ≈ [t1 ] : s1 , . . . , an ≈ [tn ] : sn ) (12) where, for 1 ≤ i ≤ n, (i) ti ∈ Σsi ((∇0 ): ); (ii) ∇0 `T ai ≈ ti : si (recall Definition 3.10); (iii) [ti ] is the equivalence class of terms u such that ∇0 `T ti ≈ u : si . Identity: The identity on ∇ (11) is [v1 ] : s1 , . . . , an ≈ [vn ] : sn ) . id∇ , ∇ ` (a1 ≈ Composition: Given f (12), g = ∇ ` (a01 ≈ [t01 ] : s01 , . . . , a0m ≈ [t0m ] : s0m ), g ◦ f , ∇0 ` (a01 ≈ [t01 {σ}] : s01 , . . . , a0m ≈ [t0m {σ}] : s0m ) where σ is the substitution (Definition 3.5) σ(vi ) = ti for 1 ≤ i ≤ n. 29 Finitely supported internal Perm-action: Given ∇ (11), π∇ , ∇ ` (π · a1 ≈ [π v1 ] : π · s1 , . . . , π · an ≈ [π vn ] : π · sn ) . Equivariant finite products: The terminal object of Cl(T) is the empty freshness environment. Given ∇ (11) and ∇0 = (a01 ≈ v1 : s01 , . . . , a0m ≈ 0 vm : sm ), their binary product ∇ × ∇ is (a1 ≈ v 1 : s 1 , . . . , an ≈ vn : sn , a01 ≈ vn+1 : s01 , . . . , a0m ≈ vn+m : s0m ) with projections pr1 pr2 , , [v1 ] : s1 , . . . , an ≈ [vn ] : sn ) ; ∇ × ∇0 ` (a1 ≈ 0 0 0 [vn+1 ] : s1 , . . . , a0m ≈ [vn+m ] : s0m ) . ∇ × ∇ ` (a1 ≈ a Fresh subobjects: Define ∇≈ by applying (5) to (11). Then a ia∇ , ∇≈ ` (a1 ≈ [v1 ] : s1 , . . . , an ≈ [vn ] : sn ) . Proof. Many of the arrows used in this definition rely on Definition 5.5 for their existence. Let’s take identity as an example: we need to show that vi : si for 1 ≤ i ≤ n. Unsugaring, this asks that ∇ `T ai ≈ 0 supp(~a ) ∇≈ `T vi ≈ (~a ~a0 ) vi : si where ~a orders ai and ~a0 is a fresh copy. Now ai ∪ supp(~a0 ) ≈ vi : si `T vi ≈ (~a ~a0 ) vi : si by (susp), and then we use (weak) to get our result. The existence of the other arrows follows similarly, using (subst) in the composition case. Cl(T) is a category by Lemma 3.6. Checking Definition 4.1 for the internal Perm-action is straightforward. Now taking the Cl(T)-arrow f as (12), and applying Lemma 3.7, we get [π · t1 ] : π · s1 , . . . , π · an ≈ [π · tn ] : π · sn ) . π · f = π · ∇0 ` (π · a1 ≈ So the action of π on terms is the meta-level Perm-action of Definition 3.4. But this is exactly the action under which terms are finitely supported. Freshness environments, finite lists of atoms and sorts themselves are similarly 30 finitely supported, and so our internal Perm-action is also. Checking the equivariance of our finite products is straightforward. Finally, we need to confirm our fresh subobjects obey Definition 4.15. (i)(iv) are clear. (v) asks that π∇≈ supp(π) is the identity so long as supp(π) # ∇. This in turn asks that supp(π) ∇≈ ` π vi ≈ vi : si for 1 ≤ i ≤ n. This follows by (susp) and (weak). (vi) is simply an application of (atm-elim). For (vii), say we have f as (12). The unique arrow fˆ can then only be [t1 ] : s1 , . . . , an ∪ a ≈ [tn ] : sn ) . ∇0 ` (a1 ∪ a ≈ If this arrow exists, it clearly has the desired unique property. To confirm that it exists asks that ∇ 0 ` T ai ∪ a ≈ ti : si . ∇ 0 ` T ai ≈ ti : si holds by construction; ∇0 `T a ≈ ti : si is equivalent to 0 a ∇0≈ `T ti ≈ (~a ~a0 ) ∗ ti : si which is exactly the original commuting property of the diagram (7). These two freshness judgements can then be unsugared and put together with (subst) and (trans). Definition 6.2. Define the generic algebra G by GJsK GJopK , , (v1 : s) (v1 : s1 , . . . , vn : sn ) ` (∅ ≈ [op v1 · · · vn ] : s) for op : (s1 , . . . , sn ) → s. It is easy to prove that G is a T-algebra in Cl(T). Theorem 6.3 (Completeness). Given a NEL-theory T, if ∇ ` t ≈ t0 : s is satisfied by all T-algebras in all nominal Lawvere theories then ∇ `T t ≈ t0 : s. Proof. If ∇ ` t ≈ t0 : s is satisfied by the generic algebra G in Cl(T) then ∇ `T t ≈ t0 : s by the definition of Cl(T)-arrows. 31 7. Category-theory correspondence In this section we will derive the major results of the paper, giving accounts of algebras in terms of functors (Theorem 7.3) and NEL-theories in terms of categories (Theorem 7.6). Lemma 7.1. Given FM-categories C, C 0 and an algebra M ∈ ob C T , we can define a functor, called the modelling functor, M (−) : F M (C, C 0 ) → C 0T from the category of FM-functors C → C 0 (Definition 4.27) to the category of T-algebras in C 0 (Definition 5.8), by • M (F )JsK , F (M JsK) and M (F )JopK , F (M JopK); • M (φ)s , φM JsK . Proof. The maps s 7→ M (F )JsK and op 7→ M (F )JopK are equivariant by Lemma 4.9, so M (F ) is a Σ-structure. Given t ∈ Σs (∇: ), M (F )J∇ ` t : sK = F (M J∇ ` t : sK) (13) by induction on the structure of t, so if M ∈ ob C T then M (F ) ∈ ob (C 0 T ). s 7→ M (φ)s is equivariant by Lemma 4.9, and (10) holds because natural transformations between finite product preserving functors commute with those products. Lemma 7.2. Given ∇ as (11), a T-homomorphism h : M → M 0 , and a term t ∈ Σs (∇: ), an a1 × · · · × h≈ hs ◦ M J∇ ` t : sK = M 0 J∇ ` t : sK ◦ (hs≈ sn ) . 1 Proof. By induction on the structure of t. Theorem 7.3. Given any NEL-theory T and FM-category C, there is an isomorphism F M (Cl(T), C) ∼ = CT between the category of FM-functors Cl(T) → C (Definition 4.27) and the category of T-algebras in C (Definition 5.8). 32 Proof. We will show that the modelling functor (Lemma 7.1) for the generic algebra (Def. 6.2) is an isomorphism G(−) : F M (Cl(T), C) → C T . Let the inverse G−1 (−) : C T → F M (Cl(T), C) be G−1 (M )(∇) G−1 (M )(f ) G−1 (h)∇ , , , M J∇K hM J∇0 ` a1 ≈ t1 : s1 K, . . . , M J∇0 ` an ≈ tn : sn Ki ≈ an ≈ a1 hs1 × · · · × hsn . (14) ≈ a where ∇ is (11), f : ∇0 → ∇ is (12) and hsi i is defined by Definition 4.25. For any T-algebra M in C, G−1 (M ) is an FM-functor Cl(T) → C by Lemma 5.6. Given a T-homomorphism h : M → M 0 , we can show that iai ◦ pri ◦ G−1 (M 0 )(f ) ◦ G−1 (h)∇0 = iai ◦ pri ◦ G−1 (h)∇ ◦ G−1 (M )(f ) by Lemma 7.2 and Definitions 4.25 and 5.5. But iai ◦ pri are jointly mono, so G−1 (h) is a natural transformation G−1 (M ) → ˙ G−1 (M 0 ). −1 T That G(G (−)) is the identity on C follows easily; the converse holds as follows. Given an FM-functor F : Cl(T) → C and Cl(T)-object ∇ we have G−1 (G(F ))(∇) = G(F )J∇K = F (GJ∇K) = F ∇ because F preserves finite products and GJ∇K = ∇. Now iai ◦ pri ◦ G−1 (G(F ))(f ) = F (GJ∇0 ` ti : si K) by (13), which equals F (∇ ` (∅ ≈ [ti ] : si )) = iai ◦ pri ◦ f . But iai ◦ pri are jointly mono so we have equality on objects. Finally, given a natural transformation φ : F → ˙ F 0 we must show that G−1 (G(φ))∇ = φ∇ . This follows by applying iai ◦ pri to each side as above. Definition 7.4. Given a nominal Lawvere theory C, define the signature Sg(C) by setting SortSg(C) = ob C and OpSg(C) , {f : (C1 , . . . , Cn ) → C | f : C1 × · · · × Cn → C ∈ ar C} with Perm-actions defined via the internal Perm-action on C. We use smallness here, as our sorts and operation symbols must form nominal sets. Note that one arrow can give rise to multiple operation symbols; for example, f : C1 ×C2 → C induces operation symbols (C1 ×C2 ) → C and (C1 , C2 ) → C. Let M (C) be the Sg(C)-structure in C which we define by M (C)JCK = C and M (C)Jf K = f , then let T h(C) be the Sg(C)-theory whose axioms are all the judgements that are satisfied by M (C), so M (C) is trivially an algebra of C T h(C) . T h(C) is called the internal language of C. 33 Remark 7.5. It is clear that nominal Lawvere theories require a (possibly non-trivial) Perm-action on their objects; without this we could not adequately represent freshness environments in the classifying category. The translation from nominal Lawvere theories back to NEL-theories, if it is not to lose information, then requires that our sorts may form any nominal set. Note that this is only a mild generalisation of previous presentations of NEL [15], as by Example 2.6(i) any set may be considered a nominal set under the trivial Perm-action. Theorem 7.6. For any Nominal Lawvere Theory C there is an equivalence Cl(T h(C)) ' C . Proof. The equivalence functor is G−1 (M (C)) : Cl(T h(C)) → C, defined by Definition 7.4 and (14). We will show that it is full, faithful and (essentially) surjective. Full: Take any C-arrow f : G−1 (M (C))(∇0 ) → G−1 (M (C))(∇). Then (v1 : G−1 (M (C))(∇0 )) ` (∅ ≈ [f v1 ] : G−1 (M (C))(∇)) is a Cl(T h(C))-arrow. Applying G−1 (M (C)) to this arrow gives us M (C)Jf K = f. [t1 ] : C1 , . . .) Faithful: Say we have Cl(T h(C))-arrows f = ∇0 ` (a1 ≈ and f 0 = ∇0 ` (a1 ≈ [t01 ] : C1 , . . .) so that G−1 (M (C))(f ) = G−1 (M (C))(f 0 ). Applying the jointly mono iai ◦ pri to each side gives us M (C)J∇0 ` ti : Ci K = M (C)J∇0 ` t0i : Ci K, so ∇0 `T h(C) ti ≈ t0i : Ci by definition and f = f 0 . Surjective: For any C-object C, G−1 (M (C))(v1 : C) = C. Remark 7.7. How about the converse of this theorem, which asks that T ' T h(Cl(T)) ? For this statement to make sense we need to have a good notion of theory morphism T → T0 . What would such a morphism look like? The definition of this is similar enough to the standard equational logic case that we will not labour the details. Suppose that T, T0 are over signatures Σ, Σ0 respectively. A signature morphism Σ → Σ0 is an equivariant map from Σ-sorts to tuples of Σ0 -sorts and Σ-operation symbols to tuples of (properly typed) Σ0 -operation symbols. These maps extend in the obvious ways to 34 maps from sorting environments, freshness environments, well-sorted terms, and judgements of Σ to tuples of their equivalents in Σ0 . This signature morphism is a theory morphism T → T0 if the T-axioms are sent to tuples of Σ0 -judgements that are provably true in T0 . A much more succinct (and, again, standard for equational logic) statement of this is that theory morphisms T → T0 are exactly the FM-functors between their classifying categories, Cl(T) → Cl(T0 ). Under this definition the ‘converse’ of Theorem 7.6 is actually a corollary of it, and so we have a full correspondence between NEL-theories and nominal Lawvere theories. 8. Further Work In this section we will briefly canvas five possible research directions that build on the results of this paper. Relationship with algebras for a monad. One concern about the results presented above is that the constructions of Section 4 are quite complex and are not special cases of standard category theory in any obvious way. The theorems of Section 7 should nonetheless reassure us that these constructions are the correct ones. However, it may still be the case that we could get to (an equivalent definition of) Nominal Lawvere Theories by some more appealing route. The most promising start to such a result seems to be [4], in which universal algebra for monads is constructed abstractly in the category of nominal sets. The equational logic which is extracted from this abstract construction is larger than NEL and Nominal Algebra, but it is shown how it can be cut down to a ‘uniform’ fragment that is equivalent to these logics. It is an open question what a Lawvere theoretic account of theories for this large non-uniform NEL would look like, and what the fragment of this logic equivalent to NEL would look like from this point of view. The categorial treatments of names in [39, 40] may also be applicable here. Alternative equational presentations. As discussed in Remark 7.5 it is essential to our development that Nominal Lawvere Theories are constructed entirely internal to the category of nominal sets. In particular, we need nominal sets of sorts in general. This is something of a shame, because the examples we have of NEL theories tend to only need sets of sorts, and because the relationship between this work and the closely related logic of Nominal Algebra (NA) [20], which only has a set of sorts, becomes murky. Is there an easy to state correspondence between NEL theories whose signatures have 35 sets only of sorts, and some subclass of Nominal Lawvere Theories? Once we have this, we might also like to investigate the design choice of NA to employ sets only of operation symbols, with the sole exception of atom constants: elements of the nominal set A are used as constants over a specified name sort. Under this view, the λ-abstraction operator lam is binary, accepting an atom as its first argument and term as its second, and producing a term. The name operator var is unary, sending an atom to a term. What conditions must we place on Nominal Lawvere Theories to capture NEL theories with these ‘NA-style’ restrictions? Generalised Nominal Sets. Nominal sets are Perm-sets with the finite support property. In the recent [41] it was shown that an analogue of the finite support property can be defined for groups G other than Perm, and that some of the G-nominal sets we can hence define have computational applications, modelling automata on data words. This raises the intriguing possibility that NEL, Nominal Lawvere Theories, and other developments on nominal sets could be usefully generalised along these lines. This paper, by teasing out the abstract structure of nominal equational reasoning, helps to show where some of the difficulties of such generalisation might lie. Internal G-actions and equivariant finite products (Sections 4.1 and 4.2) pose no problems, and that finite support (Section 4.3) can be generalised is the point of [41]. However, fresh subobjects (Section 4.4) are more tricky, because Definition 4.15(v) requires that the group Perm itself forms a nominal set. We could impose this condition, but it is not clear that there are useful examples beyond Perm for which it holds. Constructions on theories. The great advantage of Lawvere’s view over the monad-based perspective is that equational theories become first class mathematical entities, amenable to category theoretic manipulations. This advantage has led to computational applications in recent years, as discussed in [24]. We can now develop similar constructions on NEL theories. Some, such as product and sum, seem fairly easy. Others, such as functor space and separated product (a standard nominal sets operation where elements are paired only when they have disjoint support) seem more technically demanding. Most importantly, we would like to have compelling applications to motivate these constructions. A general view of Lawvere theories. Generalising Lawvere Theories is a relatively new topic, but has now given rise to a range of special purpose Lawvere-like constructions for equational-like logics, such as those mentioned in Section 1.4, and of course this paper. We have also seen generalisations de36 veloped from the point of view of the category theory [42]. We have however not really seen these points of view brought together. Doing so represents an ambitious but potentially fruitful future research direction. References [1] B. E. Aydemir, A. Bohannon, M. Fairbairn, J. N. Foster, B. C. Pierce, P. Sewell, D. Vytiniotis, G. Washburn, S. Weirich, S. Zdancewic, Mechanized metatheory for the masses: The POPLmark challenge, in: Theorem Proving in Higher Order Logics (TPHOLs), Vol. 3603 of Lecture Note in Computer Science, 2005, pp. 50–65. [2] M. Fernández, M. J. Gabbay, Nominal rewriting, Information and Computation 205 (6) (2007) 917–965. [3] M. J. Gabbay, Nominal algebra and the HSP theorem, Journal of Logic and Computation 19 (2) (2009) 341–367. [4] A. Kurz, D. Petrişan, On universal algebra over nominal sets, Mathematical Structures in Computer Science 20 (2) (2010) 285–318. [5] A. Kurz, T. Suzuki, E. Tuosto, Nominal monoids, Tech. Rep. CS-10-004, University of Leicester (October 2010). [6] M. J. Gabbay, A. M. Pitts, A new approach to abstract syntax involving binders, in: Logic in Computer Science (LICS), IEEE Computer Society Press, 1999, pp. 214–224. [7] M. J. Gabbay, A. M. Pitts, A new approach to abstract syntax with variable binding, Formal Aspects of Computing 13 (2002) 341–363. [8] A. M. Pitts, Nominal logic: A first order theory of names and binding, in: Theoretical Aspects of Computer Software (TACS 2001), Vol. 2215 of Lecture Notes in Computer Science, 2001, pp. 219–242. [9] H. B. Curry, R. Feys, Combinatory Logic, Vol. I, North-Holland, 1958. [10] N. G. de Bruijn, Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem, Indagationes Mathematicae 34 (1972) 381–392. 37 [11] F. Pfenning, C. Elliot, Higher-order abstract syntax, in: Programming Language Design and Implementation (PLDI), ACM Press, New York, 1988, pp. 199–208. [12] A. Charguéraud, The locally nameless representation, Journal of Automated Reasoning (2011) 1–46. [13] J. Cheney, Logic column 14: Nominal logic and abstract syntax, SIGACT News 36 (4) (2005) 47–69. [14] K. Crary, R. Harper, Logic column 16: Higher-order abstract syntax: Setting the record straight, SIGACT News 37 (4) (2006) 93–96. [15] R. Clouston, A. M. Pitts, Nominal equational logic, in: Computation, Meaning and Logic: Articles dedicated to Gordon Plotkin, Vol. 172 of Electronic Notes in Theoretical Computer Science, 2007, pp. 223–257. [16] R. Clouston, Binding in nominal equational logic, in: Mathematical Foundations of Programming Semantics (MFPS 2010), Vol. 265 of Electronic Notes in Theoretical Computer Science, 2010, pp. 259–276. [17] R. Clouston, Nominal logic with equations only, in: Logical Frameworks and Meta-languages: Theory and Practice (LFMTP 2011), Vol. 71 of Electronic Proceedings in Theoretical Computer Science, 2011, pp. 44– 57. [18] R. Clouston, Equational logic for names and binders, Ph.D. thesis, University of Cambridge (2009). [19] M. J. Gabbay, A. Mathijssen, One-and-a-halfth-order logic, in: Principles and Practice of Declarative Programming (PPDP), ACM Press, 2006, pp. 189–200. [20] M. J. Gabbay, A. Mathijssen, Nominal (universal) algebra: equational logic with names and binding, Journal of Logic and Computation 19 (6) (2009) 1455–1508. [21] F. W. Lawvere, Functorial semantics of algebraic theories, Ph.D. thesis, Columbia University (1963). [22] S. Mac Lane, Categories for the Working Mathematician, 2nd Edition, Springer-Verlag, 1998. 38 [23] E. Moggi, Computational lambda-calculus and monads, in: Logic in Computer Science (LICS), IEEE Computer Society Press, 1989, pp. 14– 23. [24] M. Hyland, J. Power, The category theoretic understanding of universal algebra: Lawvere theories and monads, in: Computation, Meaning and Logic: Articles dedicated to Gordon Plotkin, Vol. 172 of Electronic Notes in Theoretical Computer Science, 2007, pp. 437–458. [25] J. Power, Indexed Lawvere theories for local state, in: Models, Logics and Higher-Dimensional Categories: A Tribute to the Work of Mihaly Makkai, American Mathematical Society, 2011, pp. 268–282. [26] R. L. Crole, Categories for Types, Cambridge University Press, 1993. [27] J. Cartmell, Generalised algebraic theories and contextual categories, Annals of Pure and Applied Logic 32 (1986) 209–243. [28] L. Schröder, Classifying categories for partial equational logic, in: Category Theory and Computer Science (CTCS’02), Vol. 69 of Electronic Notes in Theoretical Computer Science, 2003, pp. 305–322. [29] G. D. Plotkin, Some varieties of equational logic, in: Algebra, Meaning, and Computation: Essays dedicated to Joseph A. Goguen, Lecture Notes in Computer Science, 2006, pp. 150–156. [30] M. Fiore, O. Mahmoud, Second-order algebraic theories, in: Mathematical Foundations of Computer Science (MFCS 2010), Vol. 6281 of Lecture Notes in Computer Science, 2010, pp. 368–380. [31] R. Clouston, Nominal Lawvere theories, in: Workshop on Logic, Language, Information and Computation (WoLLIC), Vol. 6642 of Lecture Notes in Computer Science, 2011, pp. 67–83. [32] A. M. Pitts, Alpha-structural recursion and induction, Journal of the ACM 53 (2006) 459–506. [33] R. Milner, J. Parrow, D. Walker, A calculus of mobile processes, I, Information and Computation 100 (1992) 1–40. [34] M. Aguiar, Internal categories and quantum groups, Ph.D. thesis, Cornell University (1997). 39 [35] P. J. Higgins, K. C. H. Mackenzie, Duality for base-changing morphisms of vector bundles, modules, Lie algebroids and Poisson structures, Mathematical Proceedings of the Cambridge Philosophical Society 114 (1993) 471–488. [36] A. Bak, R. Brown, G. Minian, T. Porter, Global actions, groupoid atlases and related topics, Journal of Homotopy and Related Structures 1 (1) (2006) 101–154. [37] P. L. Johnstone, Sketches of an Elephant: A Topos Theory Compendium, Vol. 1, Oxford University Press, 2002. [38] J. R. Shoenfield, Axioms of set theory, in: J. Barwise (Ed.), Handbook of Mathematical Logic, North-Holland, Amsterdam, 1977, pp. 321–344. [39] M. Menni, About N-quantifiers, Applied Categorical Structures 11 (5) (2003) 421–445. [40] U. Schöpp, Names and binding in type theory, Ph.D. thesis, University of Edinburgh (2006). [41] M. Bojanczyk, B. Klin, S. Lasota, Automata with group actions, in: Logic in Computer Science (LICS), IEEE Computer Society Press, 2011, pp. 355–364. [42] S. Lack, J. Rosický, Notions of Lawvere theory, Applied Categorical Structures 19 (1) (2011) 363–391. 40