Keywords

1 Introduction

Lambek’s correspondence between cartesian closed categories and the simply-typed \(\uplambda \)-calculus is one of the central pillars of categorical semantics. One way of stating it categorically is to say that the syntax of typed \(\uplambda \)-terms over a signature of base types and constants forms the free cartesian closed category (for a readable overview, see [9, 27]). The existence of this syntactic model gives completeness: if an equation holds in every model, it holds in the free one, and hence in the syntax. The free property then gives soundness: for any interpretation of basic types and constants in a cartesian closed category \( (\mathcal {C}, { \mathrm {\Pi } } , \Rightarrow ) \) one has a functor \( \llbracket - \rrbracket \) from the syntactic model to \(\mathcal {C}\), which is exactly the semantic interpretation of \(\uplambda \)-terms. The fact this functor is required to preserve cartesian closed structure amounts to showing that the semantic interpretation is sound with respect to the usual \(\beta \eta \)-laws. All this justifies calling the simply-typed \(\uplambda \)-calculus the internal language of cartesian closed categories.

This framework is powerful, but hides a fundamental mismatch: morphisms \(A\rightarrow B\) in a category are unary—they have just one input—but terms-in-context such as \({x_1 : A_1, \dots , x_n : A_n \vdash t: B}\) can have many inputs. The standard solution (e.g. [9, 23]) is to use categorical products to model contexts, so a term \(t\) as above corresponds to a map \(\prod _{i=1}^n A_i \rightarrow B\) out of the product.

Despite its evident success, this solution remains somewhat unsatisfactory, in two ways (see also [21]). First, it forces us to conflate two different syntactic classes, namely contexts and product types. As a result, some encoding is required to construct the syntactic model: the interpretation of \(x: A, y: B\vdash t: C\) is a term in context \(p : A\times B\). This adds complexity to the construction, and results in the somewhat unintuitive fact that the semantic interpretation of a term \(t\) in the syntactic model may not be just \(t\) itself. In turn, this complicates the proof of completeness.

Second, we are forced to include products in our type theory if we want a category-theoretic internal language—even though the calculus without products likely has a stronger claim to being called ‘the’ simply-typed \(\uplambda \)-calculus (e.g. see Church’s original definition [8]). This raises the question: what categorical structure has the simply-typed \(\uplambda \)-calculus without products as its internal language?

This paper. This paper has three main aims. First, to explain how removing the mismatch between terms-in-context and morphisms outlined above clarifies the semantic interpretation of simply-typed \(\uplambda \)-calculi. To achieve this, one needs to move from the unary setting of categories to a multi-ary setting, in which we have multimaps \(A_1, \dots , A_n \rightarrow B\). These ideas are not new, but are under-appreciated, and I hope this will provide self-contained introduction for a wider audience. Second, to initiate a multi-ary investigation of the semantics of (cartesian) combinatory logic, in the style of Hyland’s investigation of similar ideas for the untyped \(\uplambda \)-calculus ([18, 19]). Finally, to use these results to define a categorical semantics for the simply-typed \(\uplambda \)-calculus without products.

Outline. In Sections 2 to 6, we explain how the multi-ary perspective yields a slick way to derive the unary semantic interpretation and syntactic model, together with soundness and completeness results (Section 4.2). We also show how important type-theoretic constructions such as products and exponentials can be derived from the semantics. This framework accommodates different choices of structural rules, such as whether the language is ordered, linear, or cartesian.

The idea of using multi-ary constructions goes back to Lambek ([25, 26]), and has recently been exploited to great effect in a very general setting by Shulman [40]. Particular cases can also be found in the works of Hyland ([18, 19]), Hyland & de Paiva [20] and Blanco & Zeilberger [7]. A reader familiar with these approaches will likely be unsurprised by the technical development below. However, we believe these ideas deserve to be more widely known, so spend time making them explicit in a concrete setting.

In Section 7 we introduce a multi-ary model of (cartesian) combinatory logic, called SK-clones, and prove that the sub-category of extensional SK-clones is equivalent to the category of closed clones modelling simply-typed \(\uplambda \)-calculus without products. This provides a categorical statement of the classical correspondence between \(\uplambda \)-calculus and extensional combinatory logic (e.g. [5, 15]).

Finally, in Section 8 we introduce a version of Eilenberg & Kelly’s closed categories ([10, 11]), called SK-categories, and show that the category of SK-categories is equivalent to the category of extensional SK-clones, and so to the category of closed clones. Hence, SK-categories are a categorical model for the simply-typed \(\uplambda \)-calculus without products. SK-categories are a cartesian version of the prounital-closed categories of Uustalu, Veltri & Zeilberger ([43, 44]), which in turn are closely related to an (incomplete) suggestion of Shulman’s [39].

Jacobs has also isolated a structure that is sound and complete for simply-typed \(\uplambda \)-calculus without products [21]. His approach, which fits into his elegant general framework [22], is also predicated on a careful distinction between contexts and products. His models are certain indexed categories, with the contexts encoded by the indexing: this makes them feel closer to multi-ary structures. In SK-categories, by contrast, contexts are modelled within the category itself by using the closed structure (cf. [35, §4.4]). Moreover, unlike other work relating closed categories to multi-ary structures, SK-categories do not force us to include a unit object in the corresponding type theory (cf. [31]).

Technical preliminaries. For a set \(S\) we write \(S^{\star }\) for the set of finite sequences over \(S\), and use Greek letters \(\varGamma , \varDelta , \dots \) to denote elements of \(S^{\star }\). The empty string is denoted \(\diamond \), and the length of \(\varGamma \) by \(| \varGamma |\). Where the length of a sequence is clear, we write simply \( {A}_{\bullet } \) for \(A_1, \dots , A_n\). Contexts are assumed to be ordered lists.

We call multimaps of the form \(A\rightarrow B\) unary and a multimap \(\diamond \rightarrow B\) nullary.

We define a signature \(\mathcal {S}\) to be a set \( |\mathcal {S}| \) of basic sorts with sets \(\mathcal {S}(\varGamma ; B)\) of constants \(c : \varGamma \rightarrow B\) for each \(\big ( \varGamma , B\big ) \in |\mathcal {S}| ^{\star } \times |\mathcal {S}| \). A homomorphism of signatures \({f: \mathcal {S}\rightarrow \mathcal {S}'}\) is a map \( |f| : |\mathcal {S}| \rightarrow |\mathcal {S}'| \) with maps \(\mathcal {S}(A_1, \dots , A_n; B) \rightarrow \mathcal {S}'(fA_1, \dots , fA_n; fB)\) for each \(\big ( (A_1, \dots , A_n), B\big ) \in |\mathcal {S}| ^{\star } \times |\mathcal {S}| \). We write \(\textbf{Sig}\) for the category of signatures and their homomorphisms. One could also consider versions of higher-order constants, which may use the language’s constructs. This extension does not change the theory significantly, and would require introducing multiple categories of signatures, so we do not seek this extra generality here (for an outline of this more general approach, see e.g. [38, §5.3.1]).

We assume familiarity with the simply-typed \(\uplambda \)-calculus, as in e.g. [9]. We denote the simply-typed \(\uplambda \)-calculus with constants and base types given by a signature \(\mathcal {S}\), and both product and exponential types modulo \(\alpha \beta \eta \)-equality, by \( \varLambda ^{\times , \rightarrow }_{\mathcal {S}}\). We write \( \varLambda ^{\times }_{\mathcal {S}}\) and \( \varLambda ^{\rightarrow }_{\mathcal {S}}\) for the fragments with just products and just exponentials, respectively. Here we focus on the typed cases: the untyped versions—both in the syntax and the multi-ary models—are recovered by fixing a single base type \(\star \) such that \(\varTheta (\star , \dots , \star ) = \star \) for each type constructor \(\varTheta \).

We also assume familiarity with the basics of cartesian categories, cartesian closed categories, and monoidal categories, as in e.g. [27, 30]. To avoid having to treat the unit type as a special case, cartesian categories are assumed to have n-ary products \(\textstyle {\prod }_n\) for all \(n\in \mathbb {N}\). We also work with functors preserving structure strictly: this simplifies the exposition without any great loss of generality. Thus, \(\textbf{MonCat}\), \(\textbf{SMonCat}\) and \(\textbf{CartCat}\) denote the categories of monoidal categories, symmetric monoidal categories, and cartesian categories, respectively, with functors preserving all the data on the nose.

2 Multicategories and clones

We begin with an intuitive overview of the place of multi-ary structures in semantics. A multi-ary structure has multimaps \(A_1, \dots , A_n \rightarrow B\) with multiple inputs and one output; unlike the morphisms in a category, multimaps correspond directly to terms-in-context. As a result, it is often easier to construct a multi-ary free model than it is to construct a unary one, and the interpretation of a term-in-context \(t\) in the free model is given by \(t\) itself. Moreover, every multi-ary structure gives rise to a unary one by restricting to multimaps with one input. The multi-ary semantics therefore factors the unary one, as shown:

(1)

One can then ‘read off’ the syntactic category, together with a guarantee that it has the right structure, by restricting the free multi-ary structure to unary maps. Similarly, the usual semantic interpretation in (say) a cartesian closed category \(\mathcal {C}\) is exactly the interpretation that arises by extending \(\mathcal {C}\) to a multi-ary structure. This gives an algebraic justification for encoding contexts as products: this is how one extends a cartesian closed category to a multi-ary structure. (For the details of these points, see Section 4.2.)

The multi-ary perspective also provides a unifying framework for type theories with different structural rules. The simply-typed \(\uplambda \)-calculus is cartesian: it admits the structural rules of weakening, contraction, and permutation (as in e.g. [9, Fig. 3.2]). The corresponding multi-ary structures are certain abstract clones. Ordered type theories (e.g. [24, 36]), also known as planar type theories (e.g. [2, 46]), do not admit weakening, contraction, or permutation, and correspond to certain multicategories. Linear type theories (e.g. [16]), which admit only permutation, correspond to certain symmetric multicategories (see also the alternative ‘tangled’ option in [33]). Since abstract clones and symmetric multicategories may be seen as special cases of multicategories, we can develop a theory of how to add structure to cartesian, linear, and ordered type theories by analysing how to add structure to multicategories.

2.1 Multicategories, clones, and their internal languages

We now introduce multicategories and abstract clones and show how they correspond to certain type theories. An even more general framework for syntax, allowing multi-ary domains and codomains as well as both cartesian and linear contexts, is provided by Shulman’s recent work with polycategories [40]. Clones, and their correspondence with syntax, also play a key role in the ‘algebraic syntax’ programme of Fiore and collaborators initiated in [13] (see e.g. [3, 4, 12]).

Definition 1

([25]). A multicategory \(\mathbb {M}\) consists of a set \( |\mathbb {M}| \) of objects and sets \(\mathbb {M}(\varGamma ; B)\) of multimaps for every \(\varGamma \in |\mathbb {M}| ^{\star }\) and \(B\in |\mathbb {M}| \), together with

  1. 1.

    An identity multimap \(\textrm{Id}_{A} \in \mathbb {M}(A; A)\) for every \(A\in |\mathbb {M}| \);

  2. 2.

    For any \(A_1, \dots , A_n, B\in |\mathbb {M}| \) and \((\varDelta _i \in |\mathbb {M}| ^{\star })_{i=1, \dots , n}\), a composition map

    $$\begin{aligned} \mathbb {M}(A_1, \dots , A_n; B) \times \textstyle {\prod }_{i= 1}^n \mathbb {M}(\varDelta _i; A_i) &\rightarrow \mathbb {M}(\varDelta _1, \dots , \varDelta _n; B) \\ \big ( t, (u_1, \dots , u_n) \big ) &\mapsto {t} \circ \langle u_1, \dots , u_n \rangle \end{aligned}$$

subject to an associativity law and two unit laws (see e.g. [28, p. 35]). A multicategory functor \(f: \mathbb {M}\rightarrow \mathbb {N}\) consists of a map \( |f| : |\mathbb {M}| \rightarrow |\mathbb {N}| \) with maps \(f_{ {A}_{\bullet } , B} : \mathbb {M}(A_1, \dots , A_n; B) \rightarrow \mathbb {N}( fA_1, \dots fA_n; fB)\) for every \(A_1, \dots , A_n, B\in |\mathbb {M}| \), such that substitution and the identity are preserved (see e.g. [28, p. 39]).

Definition 2

([20, 32]). A symmetric multicategory consists of a multicategory \(\mathbb {M}\) together with a symmetric group action: for each \(A_1, \dots , A_n \in |\mathbb {M}| \) and \(\sigma \in S_n\) one has \((-) \bullet \sigma : \mathbb {M}(A_1, \dots , A_n; B) \rightarrow \mathbb {M}(A_{\sigma 1}, \dots , A_{\sigma n}; B) \) compatible with substitution and satisfying unit and associativity laws (e.g. [28, p. 54]). A symmetric multicategory functor is a multicategory functor which preserves the action.

We write \(\textbf{Multicat}\) (resp. \(\textbf{SMulticat}\)) for the category of (symmetric) multicategories and their functors, and write \(t: {\varGamma \rightarrow B}\) for \(t\in \mathbb {M}(\varGamma ; B)\).

Example 1

Every monoidal category \((\mathcal {C}, \otimes , I)\) induces a multicategory \(\mathcal {T}{\mathcal {C}}\). The objects are those of \(\mathcal {C}\), with multimaps \((\mathcal {T}{\mathcal {C}})(A_1, \dots , A_n; B) := \mathcal {C}(\bigotimes _{i=1}^n A_i, B)\) for a chosen n-ary bracketing of the tensor product. This determines functors \(\textbf{MonCat}\rightarrow \textbf{Multicat}\), and \(\textbf{SMonCat}\rightarrow \textbf{SMulticat}\) (see e.g. [28, p. 39]); we denote both of these by \(\mathcal {T}\).

Lambek [25] essentially observed that every multicategory has an internal language, as follows. One identifies multimaps \(t: A_1, \dots , A_n \rightarrow B\) with terms \(x_1 : A_1, \dots , x_n : A_n \vdash {t: B}\), for a fixed ordering of an infinite set of variables \(\{ x_1, x_2, \dots \}\). The identity \(\textrm{Id}_{A}\) is identified with the variable \(x: A\), and the composition operation becomes a formal substitution operation on the language. Stated in this way, the three axioms become well-known properties of substitution: the unit laws say \( {x}[{u}] = u\) and \( {t}[{x_1, \dots , x_n}] = t\), and the associativity law is a linear version of the so-called Substitution Lemma (e.g. [5, Lemma 2.1.16]).

The next result shows this terminology does not differ too much from the notion of internal language in the introduction. For a signature \(\mathcal {S}\) and \(\varGamma := ({x_i : A_i})_{i=1, \dots , n}\), write \( \mathcal {O} _{\mathcal {S}}\) for the ordered language generated by the two rules on the left below, and \( \mathfrak {L} _{\mathcal {S}}\) for the linear language generated by all three rules:

figure a

Substitution is defined as usual, so that the following rule is admissible:

(2)

With this rule as composition, \( \mathcal {O} _{\mathcal {S}}\) and \( \mathfrak {L} _{\mathcal {S}}\) define a syntactic multicategory \(\textrm{Syn}( \mathcal {O} _{\mathcal {S}})\) and a syntactic symmetric multicategory \(\textrm{Syn}( \mathfrak {L} _{\mathcal {S}})\), respectively. These define left adjoints to the functors \(\textbf{Multicat}\rightarrow \textbf{Sig}\) and \(\textbf{SMulticat}\rightarrow \textbf{Sig}\) sending a (symmetric) multicategory \(\mathbb {M}\) to the signature with objects \( |\mathbb {M}| \) and constants \(\big \{ \mathbb {M}(\varGamma ; B) \big \}_{\varGamma \in |\mathbb {M}| ^{\star }, B\in |\mathbb {M}| }\); we denote both these functors by \( \textrm{U} \).

Lemma 1

\(\textrm{Syn}( \mathcal {O} _{\mathcal {S}})\) (resp. \(\textrm{Syn}( \mathfrak {L} _{\mathcal {S}})\)) is the free multicategory (resp. symmetric multicategory) on \(\mathcal {S}\).

Thus, the internal language of a symmetric multicategory is the core of Abramsky’s linear \(\uplambda \)-calculus [1]. To recover a cartesian language, we use (multi-sorted) abstract clones. These differ from multicategories in that the result of substituting \((u_i : \varDelta \rightarrow A_i)_{i=1, 2}\) into \(t: A_1, A_2 \rightarrow B\) yields a multimap of type \(\varDelta \rightarrow B\), not \(\varDelta , \varDelta \rightarrow B\). Abstract clones are equivalently cartesian multicategories (see e.g. [18]), but this formulation is less natural syntactically: it amounts to adding explicit duplication and deletion operations to the language.

Definition 3

An abstract clone \(\mathbb {C}\) consists of a set \( |\mathbb {C}| \) of sorts and sets \(\mathbb {C}(\varGamma ; B)\) of multimaps for every \(\varGamma \in |\mathbb {C}| ^{\star }\) and \(B\in |\mathbb {C}| \), together with

  1. 1.

    Projection multimaps \( \textsf{p}_{i}^{ {A}_{\bullet } } \in \mathbb {C}(A_1, \dots , A_n; A_i)\) for every \(A_1, \dots , A_n \in |\mathbb {C}| \);

  2. 2.

    For every \(A_1, \dots , A_n, B\in |\mathbb {C}| \) and \(\varDelta \in |\mathbb {C}| ^{\star }\), a substitution operation

    $$\begin{aligned} \mathbb {C}(A_1, \dots , A_n; B) \times \textstyle {\prod }_{i= 1}^n \mathbb {C}(\varDelta ; A_i) &\rightarrow \mathbb {C}(\varDelta ; B) \\ \big ( t, (u_1, \dots , u_n) \big ) &\mapsto {t}[{u_1, \dots , u_n}] \end{aligned}$$

subject to an associativity law and two unit laws for any \(t\in \mathbb {C}(A_1, \dots , A_n; B)\), \(\big ( u_i \in \mathbb {C}(B_1, \dots , B_m; A_i) \big )_{i=1, \dots ,n}\) and \(\big ( v_j \in \mathbb {C}(\varTheta ; B_j) \big )_{j =1 , \dots , m}\):

$$\begin{aligned} \big ( {t}[ {u}_{\bullet } ] \big )[ {v}_{\bullet } ] = {t} \big [ \dots , {u_{i}}[{ {v}_{\bullet } }] , \dots \big ] , { \textsf{p}_{i}^{ {A}_{\bullet } } }[{u_1, \dots , u_n}] = u_i , {t}[{ \textsf{p}_{1}^{ {A}_{\bullet } } , \dots , \textsf{p}_{n}^{ {A}_{\bullet } } }] = t\end{aligned}$$

A homomorphism of clones \(f: \mathbb {C}\rightarrow \mathbb {D}\) consists of a map \( |f| : |\mathbb {C}| \rightarrow |\mathbb {D}| \) and maps \(f_{ {A}_{\bullet } , B} : \mathbb {C}(A_1, \dots , A_n; B) \rightarrow \mathbb {D}( fA_1, \dots fA_n; fB)\) for every \(A_1, \dots , A_n, B\in |\mathbb {C}| \), such that \( f( \textsf{p}_{i}^{ {A}_{\bullet } } ) = \textsf{p}_{i}^{ {(fA)}_{\bullet } } \) and \(f{\big ( {t}[{u_1, \dots , u_n}] \big )} = {(ft)}[{fu_1, \dots , fu_n}] \). We write \(\textbf{Clone}\) for the category of clones and clone homomorphisms.

Example 2

(cf. Example 1). Any cartesian category \( (\mathcal {C}, { \mathrm {\Pi } } ) \) determines a clone \(\mathcal {P}\mathcal {C}\) with sorts the objects of \(\mathcal {C}\) and \((\mathcal {P}{\mathcal {C}}) {\big ( A_1, \dots , A_n ; B\big ) } := \mathcal {C}( \textstyle {\prod }_{i=1}^n A_i ; B)\).

We distinguish between clones and multicategories by using \([\dots ]\) for a clone’s substitution operation and \(\langle \dots \rangle \) for a multicategory’s composition operation. Every multicategory, and hence every clone, has an underlying category.

Definition 4

The nucleus \( \overline{\mathbb {M}} \) of a multicategory or clone \(\mathbb {M}\) is the category with the same objects and \( \overline{\mathbb {M}} (A, B) := \mathbb {M}(A; B)\). This defines functors \( \overline{(-)} : \textbf{Multicat}\rightarrow \textbf{Cat}\) and \( \overline{(-)} : \textbf{Clone}\rightarrow \textbf{Cat}\) to the category of small categories.

The internal language of a clone is a cartesian version of that for multicategories. Write \( \varLambda _\mathcal {S}\) for the language below; substitution is defined as usual.

figure b

Identifying variables with projections, we get a syntactic clone \(\textrm{Syn}( \varLambda _\mathcal {S})\).

Lemma 2

The canonical forgetful functor \( \textrm{U} : \textbf{Clone}\rightarrow \textbf{Sig}\) has a left adjoint, and the free clone on \(\mathcal {S}\) is \(\textrm{Syn}( \varLambda _\mathcal {S})\).

Example 3

The languages \( \varLambda ^{\times }_{\mathcal {S}}, \varLambda ^{\rightarrow }_{\mathcal {S}}\) and \( \varLambda ^{\times , \rightarrow }_{\mathcal {S}}\) each induce syntactic clones we denote by \(\textrm{Syn}( \varLambda ^{\times }_{\mathcal {S}}), \textrm{Syn}( \varLambda ^{\rightarrow }_{\mathcal {S}})\) and \(\textrm{Syn}( \varLambda ^{\times , \rightarrow }_{\mathcal {S}})\), respectively.

3 Universal properties for multicategories

In this section we generalise the categorical notion of universal arrows (as in e.g. [30, §3]) to give a notion of universal property for multicategories. This will provide a uniform way to introduce new connectives to a type theory. One could also define the required conditions directly (see [7, 40]), but here we wish to emphasise that they arise from category-theoretic ideas.

Definition 5

(cf. [17]). Let \(f: \mathbb {M}\rightarrow \mathbb {N}\) be a multicategory functor.

  1. 1.

    A universal arrow from \(f\) to \(Y\in |\mathbb {N}| \) is a pair \((R\in |\mathbb {M}| , \rho : fR\rightarrow Y)\) such that for every \(t: fA_1, \dots , fA_n \rightarrow Y\) there exists a unique multimap \({t}^{\#} : A_1, \dots , A_n \rightarrow R\) such that \( {\rho } \circ \langle f({t}^{\#}) \rangle = t\).

  2. 2.

    A universal arrow from \(X_1, \dots , X_n \in |\mathbb {N}| \) to \(f\) is a pair \((R\in |\mathbb {M}| , \rho : X_1, \dots , X_n \rightarrow fR)\) such that for every \(t: X_1, \dots , X_n \rightarrow fB\) there exists a unique multimap \({t}^{\#} : R\rightarrow B\) such that \( {f({t}^{\#})} \circ \langle \rho \rangle = t\).

We extend this definition—and hence our notion of universal property—to clones by using the next observation (cf. the fact a cartesian category is monoidal).

Lemma 3

There is a faithful functor \(\textrm{M}: \textbf{Clone}\rightarrow \textbf{Multicat}\) sending a clone \(\mathbb {C}\) to the multicategory with the same objects and hom-sets, and composition given using substitution in \(\mathbb {C}\) and the projections.

Definition 5 does not involve ‘global’ conditions like naturality, so is particularly amenable to a type-theoretic interpretation. As in the categorical setting, however, it can be rephrased using natural isomorphisms (cf. [30, §3.2]).

Lemma 4

Let \(f: \mathbb {M}\rightarrow \mathbb {N}\) be a multicategory functor.

  1. 1.

    Giving a universal arrow from \(f\) to \(X\in |\mathbb {N}| \) is equivalent to giving \(R\in \mathbb {M}\) and an isomorphism \(\phi _{ {A}_{\bullet } } : \mathbb {M}(A_1, \dots , A_n; R) \xrightarrow {\cong } \mathbb {N}(fA_1, \dots , fA_n; Y)\), natural in the sense that the left diagram below commutes for any \(t: A_1, \dots , A_n \rightarrow B\);

  2. 2.

    Giving a universal arrow from \(X_1, \dots , X_n \in |\mathbb {N}| \) to \(f\) is equivalent to giving \(R\in |\mathbb {M}| \) and an isomorphism \(\psi _{B} : \mathbb {M}(R; B) \xrightarrow {\cong }\mathbb {N}(X_1, \dots , X_n; fB)\), natural in the sense that the right diagram below commutes for any \({u: B\rightarrow C}\).

figure c

A corollary is that giving a right adjoint to a multicategory functor \(f: \mathbb {N}\rightarrow \mathbb {M}\) in Hermida’s 2-category of multicategories [17] is equivalent to giving a mapping \(g_0 : |\mathbb {M}| \rightarrow |\mathbb {N}| \) and a universal arrow \(fg(X) \rightarrow X\) from \(f\) to \(X\) for each \(X\in |\mathbb {N}| \).

4 Product structure

We now have enough to define products for multicategories, and hence for clones. An n-ary product is exactly a limit over the discrete category with n objects. Rephrasing in terms of universal arrows (e.g. [30, §3]) we get that equipping a category \(\mathcal {C}\) with n-ary products is exactly equipping it with a universal arrow from the diagonal functor \(\varDelta ^{(n)} : \mathcal {C}\rightarrow \mathcal {C}^{\times n}\) to \((A_1, \dots , A_n)\) for every \({A_1, \dots , A_n \in \mathcal {C}}\).

Since \(\textbf{Multicat}\) has finite products defined in much the same way as the category of small categories \(\textbf{Cat}\), we may make the following definition. The prefix ‘cartesian’ is already used for multicategories, so we use ‘finite-products’.

Definition 6

An fp-multicategory is a multicategory \(\mathbb {M}\) equipped with a universal arrow \(\big ( \prod _{i=1}^n A_i, (\pi _1^{ {A}_{\bullet } }, \dots , \pi _n^{ {A}_{\bullet } }) \big )\) from the diagonal functor \(\varDelta ^{(n)} : \mathbb {M}\rightarrow \mathbb {M}^{\times n}\) to \((A_1, \dots , A_n)\) for every \(n \in \mathbb {N}\) and \(A_1, \dots , A_n \in |\mathbb {M}| \).

Asking for \(\mathbb {M}\) to have finite products is equivalent to asking for a product object \(\prod _{i=1}^n A_i\) and unary multimaps \(\big ( \pi _i^{ {A}_{\bullet } } : \prod _{i=1}^n A_i \rightarrow A_i \big )_{i=1, \dots , n}\) for each \(A_1, \dots , A_n \in |\mathbb {M}| \), such that composition induces isomorphisms \(\mathbb {M}\big (\varGamma ; \textstyle {\prod }_{i=1}^n A_i\big ) \cong \prod _{i=1}^n \mathbb {M}(\varGamma ; A_i)\). In the internal language, this amounts to the following rules:

(3)

We can now derive the rules for \({\&}\) in linear \(\uplambda \)-calculus [1]. Indeed, given \(\varGamma , x: A_i, \varTheta \vdash t: B\), from (3) we get \(\varGamma , p : \prod _{i=1}^n A_i, \varTheta \vdash {t}[{\pi _i^{ {A}_{\bullet } }(p) / x}] : B\). This suggests the following. Let \( \mathcal {O} ^{{\&}} _{\mathcal {S}}\) (resp. \( \mathfrak {L} ^{{\&}} _\mathcal {S}\)) be the extension of \( \mathcal {O} _\mathcal {S}\) (resp. \( \mathfrak {L} _\mathcal {S}\)) with

figure d

where we write \(\langle u_i \rangle _{i=1}^n\) for \(\langle u_1, \dots , u_n \rangle \). This syntax defines a free property. To see this, say a multicategory functor \(f\) (strictly) preserves finite products if it preserves all the data on the nose, so that \(f(\textstyle {\prod }_{i=1}^n A_i) = \textstyle {\prod }_{i=1}^n fA_i\), \(f( \pi _i^{ {A}_{\bullet } } ) = \pi _i^{ {fA}_{\bullet } }\), and \(f(\langle t_1, \dots , t_n \rangle ) = \langle ft_1, \dots , ft_n \rangle \). Write \(\textbf{fpMulticat}\) for the category of fp-multicategories and product-preserving functors, and \(\textbf{fpSMulticat}\) for the subcategory of symmetric multicategories with finite products, with functors preserving both structures.

Lemma 5

The composite forgetful functor \(\textbf{fpMulticat}\rightarrow \textbf{Multicat}\rightarrow \textbf{Sig}\) has a left adjoint, and the free fp-multicategory on \(\mathcal {S}\) is \(\textrm{Syn}( \mathcal {O} ^{{\&}} _{\mathcal {S}})\). This extends to symmetric structure: replace \(\textbf{fpMulticat}\) by \(\textbf{fpSMulticat}\) and \( \mathcal {O} ^{{\&}} \) by \( \mathfrak {L} ^{{\&}} \).

Returning to the cartesian setting, we define products in a clone using the corresponding structure for multicategories and Lemma 3.

Definition 7

A cartesian clone \( (\mathbb {C}, { \mathrm {\Pi } } ) \) is a clone \(\mathbb {C}\) equipped with a choice of finite products on \(\textrm{M}\mathbb {C}\). A (strict) homomorphism of cartesian clones is a clone homomorphism \(f\) that strictly preserves all the product structure. We write \(\textbf{CartClone}\) for the category of cartesian clones and strict homomorphisms.

Writing \(\pi _i(t)\) for the multimap \( {\pi _i^{ {A}_{\bullet } }}[{t}] \), the rules (3) translate directly to the usual product rules of \(\uplambda \)-calculus. So cartesian clones exactly capture \( \varLambda ^{\times }\).

Lemma 6

The composite forgetful functor \(\textbf{CartClone}\rightarrow \textbf{Clone}\rightarrow \textbf{Sig}\) has a left adjoint, and \(\textrm{Syn}( \varLambda ^{\times }_{\mathcal {S}})\) is the free cartesian clone on \(\mathcal {S}\).

Using the characterisation of universal arrows in terms of natural isomorphisms we get the following refinement of Example 2.

Example 4

For any cartesian category \( (\mathcal {C}, { \mathrm {\Pi } } ) \) the induced clone \(\mathcal {P}\mathcal {C}\) is cartesian, essentially by definition; this extends to a functor \(\mathcal {P}: \textbf{CartCat}\rightarrow \textbf{CartClone}\). Moreover, if \( (\mathbb {C}, { \mathrm {\Pi } } ) \) is a cartesian clone, then so is its nucleus \( \overline{\mathbb {C}} \). Hence \( \overline{(-)} \) restricts to a functor \(\textbf{CartClone}\rightarrow \textbf{CartCat}\).

The two functors in this example are actually adjoints, yielding our first version of the schema in (1). The unit is identity-on-objects and sends \(t: A_1, \dots , A_n \rightarrow B\) to \( {t}[{\pi _1^{ {A}_{\bullet } }, \dots , \pi _n^{ {A}_{\bullet } }}] : \prod _{i=1}^n A_i \rightarrow B\).

Proposition 1

The functor \( \overline{(-)} : \textbf{CartClone}\rightarrow \textbf{CartCat}\) fits into the following diagram of adjunctions:

figure e

Moreover, \( \textrm{U} \circ \mathcal {P}\) is equal to the canonical forgetful functor \(\textbf{CartCat}\rightarrow \textbf{Sig}\). Hence, the free cartesian category on \(\mathcal {S}\) is canonically isomorphic to \( \overline{\textrm{Syn}( \varLambda ^{\times }_{\mathcal {S}})} \).

4.1 Cartesian structure from representability

In the preceding section we defined products using a multi-ary version of the familiar universal property. There is another way to define ‘monoidal structure’ in a multicategory: Hermida’s representability [17]. From the perspective of linear logic, the finite product structure explored above corresponds to the additive conjunction \({\&}\); Hermida’s representability will correspond to the multiplicative conjunction \(\otimes \). We shall also see that, for clones, the two are equivalent.

Definition 8

A representable multicategory is a multicategory \(\mathbb {M}\) equipped with a universal arrow \(\Big ( {{{\,\mathrm{\textrm{T}}\,}}}(X_1, \dots , X_n), \rho _{ {X}_{\bullet } } : X_1, \dots , X_n \rightarrow {{\,\mathrm{\textrm{T}}\,}}(X_1, \dots , X_n) \Big )\) from \(X_1, \dots , X_n\) to the identity \(\textrm{id}_{\mathbb {M}}\) for each \(X_1, \dots , X_n \in { |\mathbb {M}| }\); we write \({{\,\mathrm{\textrm{T}}\,}}_{i=1}^n X_i\) for \({{\,\mathrm{\textrm{T}}\,}}(X_1, \dots , X_n)\). These universal arrows must be closed under composition, so

$$ X_1, \dots , X_n, Y_1, \dots , Y_m \xrightarrow { \langle \rho _{ {X}_{\bullet } }, \rho _{ {Y}_{\bullet } } \rangle } {{\,\mathrm{\textrm{T}}\,}}_{i=1}^n X_i, {{\,\mathrm{\textrm{T}}\,}}_{j=1}^m Y_j \xrightarrow {\rho } {{{\,\mathrm{\textrm{T}}\,}}}{\big ( {{{\,\mathrm{\textrm{T}}\,}}}_{i=1}^n X_i, {{\,\mathrm{\textrm{T}}\,}}_{j=1}^m Y_j \big )} $$

must also be universal. A representable multicategory functor \(f\) is a multicategory functor that preserves all the universal arrows, so that \(f({{\,\mathrm{\textrm{T}}\,}}_{i=1}^n A_i) = {{\,\mathrm{\textrm{T}}\,}}_{i=1}^n fA_i\), \(f(\rho _{ {A}_{\bullet } }) = \rho _{f {A}_{\bullet } }\) and \(f({t}^{\#}) = {ft}^{\#}\). Write \(\textbf{RepMulticat}\) for the category of representable multicategories, and \(\textbf{SRepMulticat}\) for the category of representable multicategories whose underlying multicategories are also symmetric, with functors preserving both structures.

Example 5

(cf. Example 1). The multicategory \(\mathcal {T}\mathcal {C}\) induced by a monoidal category \( (\mathcal {C}, \otimes , I) \) is representable. We therefore obtain functors \(\textbf{MonCat}\rightarrow \textbf{RepMulticat}\) and \(\textbf{SMonCat}\rightarrow \textbf{SRepMulticat}\); we denote them both \(\mathcal {T}\).

A representable multicategory is a multicategory equipped with rules which are dual to those in (3) in the sense that the universal arrow goes the other direction. Indeed, writing \(x_1 \otimes \dots \otimes x_n\) for \(\rho _{ {A}_{\bullet } }\), and \(\mathtt {let\,}{(x_1, \dots , x_n)}\mathtt {\,be\,}{p}\mathtt {\,in\,}{t}\) for \({t}^{\#}\), and extending this to all terms by

$$\begin{aligned} \begin{aligned} u_1 \otimes \dots \otimes u_n &:= {(x_1 \otimes \dots \otimes x_n)}[{u_1 / x_1, \dots , u_n / x_n}] \\ \mathtt {let\,}{(x_1, \dots , x_n)}\mathtt {\,be\,}{u}\mathtt {\,in\,}{t} &:= {\big ( \mathtt {let\,}{(x_1, \dots , x_n)}\mathtt {\,be\,}{p}\mathtt {\,in\,}{t} \big )}[{ u/ p }] \end{aligned} \end{aligned}$$

we obtain the following rules, where \(\varGamma := (x_i : A_i)_{i=1, \dots , n}\):

(4)
$$\begin{aligned} \mathtt {let\,}{(x_1, \dots , x_n)}\mathtt {\,be\,}{p}\mathtt {\,in\,}{ {t}[{\otimes _{i=1}^n x_i / p}] } = t , \mathtt {let\,}{(x_1, \dots , x_n)}\mathtt {\,be\,}{\otimes _{i=1}^n x_i}\mathtt {\,in\,}{t} = t\end{aligned}$$

We write \( \mathcal {O} ^{\otimes } _{\mathcal {S}}\) (resp. \( \mathfrak {L} ^{\otimes } _\mathcal {S}\)) for the extension of \( \mathcal {O} _{\mathcal {S}}\) (resp. \( \mathfrak {L} _{\mathcal {S}}\)) with these rules. This is essentially the tensor fragment of Abramsky’s linear \(\uplambda \)-calculus [1]. The connection with multicategories was already made in by Hyland  & de Paiva [20], who showed this type theory arises from Lambek’s monoidal multicategories [26].

Lemma 7

The composite forgetful functor \(\textbf{RepMulticat}\rightarrow \textbf{Multicat}\rightarrow \textbf{Sig}\) has a left adjoint, and the free representable multicategory on \(\mathcal {S}\) is the syntactic multicategory \(\textrm{Syn}( \mathcal {O} ^{\otimes } _\mathcal {S})\). The same holds for symmetric structure, if one replaces \(\textbf{RepMulticat}\) by \(\textbf{SRepMulticat}\) and \( \mathcal {O} ^{\otimes } \) by \( \mathfrak {L} ^{\otimes } \).

Combining this lemma with Lemma 5, one sees that a multicategory equipped with representable and finite-product structure corresponds to a linear type theory with both \(\otimes \) and \({\&}\).

We can also obtain a linear version of Proposition 1. Hermida [17] showed that the 2-category of representable multicategories is 2-equivalent to the 2-category of monoidal categories, and Weber showed this extends to the symmetric case [45]. From these constructions one can extract functors \(\mathcal {T}: \textbf{RepMulticat}\rightarrow \textbf{MonCat}\) and \(\mathcal {T}_\textrm{sym}: \textbf{SRepMulticat}\rightarrow \textbf{SMonCat}\) sending a (symmetric) representable multicategory to a (symmetric) monoidal structure on its nucleus, together with equivalences \(\textbf{RepMulticat}\simeq \textbf{MonCat}\) and \(\textbf{SRepMulticat}\simeq \textbf{SMonCat}\). So we get the following.

Proposition 2

The functors \(\mathcal {N}\) and \(\mathcal {N}_{\textrm{sym}}\) fit into the following diagram of adjunctions, where in each case the right-hand adjunction is an equivalence:

figure f

Moreover, \( \textrm{U} \circ \mathcal {T}\) and \( \textrm{U} \circ \mathcal {T}_\textrm{sym}\) are both equal to the canonical forgetful functor to \(\textbf{Sig}\). Hence, the free monoidal (resp. symmetric monoidal) category on a signature \(\mathcal {S}\) is canonically isomorphic to \( \mathcal {N}{\big (\textrm{Syn}( \mathcal {O} ^{\otimes } _\mathcal {S})\big )} \) (resp. \(\mathcal {N}{\big (\textrm{Syn}( \mathfrak {L} ^{\otimes } _\mathcal {S})\big )}\)).

We now turn to studying representability in the cartesian setting.

Definition 9

A representable clone is a clone \(\mathbb {C}\) equipped with a choice of representable structure on \(\textrm{M}\mathbb {C}\). A representable clone homomorphism is a clone homomorphism which preserves the representable structure as in Definition 8.

A cartesian clone makes the projections primitive (recall (3)), but a representable clone makes the pairing operation primitive (recall (4)). It turns out these perspectives are equivalent. In the proof-theoretic setting such ideas are well-studied (cf. the equivalence of G-systems and N-systems in [42, §3.3]); the categorical statement has also been made by Pisani [34] and Shulman [40].

Proposition 3

Equipping a clone \(\mathbb {C}\) with representable structure is equivalent to equipping \(\mathbb {C}\) with cartesian structure.

In Proposition 2 we gave an equivalence of categories but in Proposition 1 we only gave an adjunction. We can now upgrade the latter to an equivalence. Indeed, \( \overline{(-)} \circ \mathcal {P}\) is equal to the identity. On the other hand, if \( (\mathbb {C}, { \mathrm {\Pi } } ) \) is a cartesian clone then by Proposition 3 and Lemma 4 we have a multi-natural isomorphism \(\mathbb {C}(A_1, \dots , A_n; B) \cong \mathbb {C}(\prod _{i=1}^n A_i; B) = \mathcal {P}( \overline{\mathbb {C}} )(A_1, \dots , A_n; B)\).

Corollary 1

([34]). The functors \(\mathcal {P}\) and \( \overline{(-)} \) of Proposition 1 define an adjoint equivalence \(\textbf{CartClone}\simeq \textbf{CartCat}\).

4.2 Recovering the semantic interpretation and syntactic model

We now show how the usual semantic interpretation, syntactic model, and soundness and completeness results can be derived from the multi-ary framework. Although we shall not pursue the point in detail for reasons of space, essentially the same argument holds for all the calculi considered in this paper.

Semantic interpretation and soundness. We recover the usual semantic interpretation of \( \varLambda ^{\times }\) in a cartesian category by Lemma 6 and Example 4 as follows. Let \( \textrm{U} : \textbf{CartCat}\rightarrow \textbf{Sig}\) be the functor sending a cartesian category \( (\mathcal {C}, { \mathrm {\Pi } } ) \) to the signature with objects those of \(\mathcal {C}\) and constants \(\big \{ \mathcal {C}(\prod _{i=1}^n A_i, B) \big \}_{A_1, \dots , A_n, B\in \mathcal {C}}\). An interpretation \({s: \mathcal {S}\rightarrow \textrm{U} \mathcal {C}}\) of basic types and constants in \(\mathcal {C}\) is exactly an interpretation \(s: \mathcal {S}\rightarrow \textrm{U} (\mathcal {P}\mathcal {C})\) in the induced cartesian clone. The unique extension \(s \llbracket - \rrbracket : \textrm{Syn}( \varLambda ^{\times }_\mathcal {S}) \rightarrow \mathcal {P}\mathcal {C}\) sends a term \(x_1 : A_1, \dots , x_n : A_n \vdash t: B\) to a multimap \(s \llbracket x_1 : A_1, \dots , x_n : A_n \rrbracket \rightarrow s \llbracket B \rrbracket \) in \(\mathcal {P}\mathcal {C}\), which is exactly a map \(\prod _{i=1}^n s \llbracket A_i \rrbracket \rightarrow s \llbracket B \rrbracket \) in \(\mathcal {C}\). It is not hard to show this coincides with the usual, inductively defined semantic interpretation. Unlike with the unary approach, we do not need to prove soundness with respect to \(\beta \eta \) as a separate lemma: this holds immediately from the fact \(s \llbracket - \rrbracket \) is a cartesian clone homomorphism.

Moreover, for any objects \(A_1, \dots , A_n\) in a cartesian clone one can construct a ‘multi-isomorphism’ \((A_1, \dots , A_n) \cong \prod _{i=1}^n A_i\) (see [38, Lemma 4.2.16]). Hence, in a cartesian simple type theory with products, contexts must coincide with product types. Together with the preceding, this provides a mathematical explanation for the identification of contexts and product types in the interpretation of \( \varLambda ^{\times , \rightarrow }\).

Syntactic model. We extract the construction from Proposition 1. For a signature \(\mathcal {S}\) the cartesian category \( \overline{\textrm{Syn}( \varLambda ^{\times }_{\mathcal {S}})} \) has objects the types of \( \varLambda ^{\times }_\mathcal {S}\) and morphisms \(A\rightarrow B\) given by \(\alpha \beta \eta \)-equivalence classes of terms \(x: A\vdash t: B\) for a fixed variable \(x\). Composition is substitution and the identity on \(A\) is the variable \(x: A\). The projections are \(x: \prod _{i=1}^n A_i \vdash \pi _i^{ {A}_{\bullet } }(x) : A_i\) and the pairing of the maps \(( x: C\vdash t_i : A_i )_{i=1, 2}\) is \(x: C\vdash \langle t_1, t_2 \rangle : A_1 \times A_2\). The usual proofs that this is indeed cartesian (see e.g. [9, Chapter 3]) have been replaced by the simple observation of Example 4.

Completeness. Once again, the proof is largely category-theoretic. Note first that the functor \( \overline{(-)} : \textbf{CartClone}\rightarrow \textbf{CartCat}\) is faithful. One can prove this directly using Proposition 3 or infer it from Corollary 1 and the fact any equivalence is fully faithful. In any case, it follows by standard results (e.g. [37, Lemma 4.5.13]) that the unit \(\eta '\) of the adjunction \( \overline{(-)} \dashv \mathcal {P}\) is monic. Just as in \(\textbf{Cat}\), any monomorphism of clones is injective on objects and injective on multimaps. It suffices, therefore, to find a semantic interpretation \(\iota \llbracket - \rrbracket \) which is equal to a component of \(\eta '\). This is accomplished by the next lemma.

Lemma 8

Let be adjunctions with units \(\eta : \textrm{id}_{\mathcal {C}} \Rightarrow \textrm{U} F\) and \(\eta ' : \textrm{id}_{\mathcal {D}} \Rightarrow \textrm{U} 'F'\). Then for any \(C \in \mathcal {C}\), the unit \(\eta '_{FC} : FC \rightarrow \textrm{U} 'F'FC\) is the unique map h such that the following diagram commutes:

figure h

In the setting of Proposition 1 this lemma implies that the component \(\eta '_{F\mathcal {S}} : \textrm{Syn}( \varLambda ^{\times }_\mathcal {S}) \rightarrow \mathcal {P}\big ( \overline{\textrm{Syn}( \varLambda ^{\times }_\mathcal {S})} )\) of the unit for the adjunction \( \overline{(-)} \dashv \mathcal {P}\) is exactly the unique cartesian clone homomorphism \(\iota \llbracket - \rrbracket \) extending the obvious interpretation \(\iota := \mathcal {S}\hookrightarrow \overline{\textrm{Syn}( \varLambda ^{\times }_\mathcal {S})} \) of base types and constants in the free cartesian category. By our preceding discussion, this clone homomorphism is injective on multimaps: so if \(\iota \llbracket t \rrbracket = \iota \llbracket t' \rrbracket \) then \(t = t'\) in \(\textrm{Syn}( \varLambda ^{\times }_\mathcal {S})\), hence \(t =_{\beta \eta } t'\).

5 Closed structure

To define closed structure, we follow Lambek’s definition and simply upgrade the hom-set definition of exponentials to multicategories.

Definition 10

([26]). A closed multicategory is a multicategory \(\mathbb {M}\) equipped with an object \( {[A, B]} \) and multimap \(\textrm{eval}_{A, B} : {[A, B]} , A\rightarrow B\) for every \(A, B\in |\mathbb {M}| \), such that composition induces isomorphisms as shown:

(5)

A (strict) closed multicategory functor is a multicategory functor \(f\) which preserves all the data: \(f( {[A, B]} ) = {[fA, fB]} \), \(f(\textrm{eval}_{A, B}) = \textrm{eval}_{fA, fB}\) and \(f(\varLambda t) = \varLambda (ft)\). We write \(\textbf{ClMulticat}\) for the category of closed multicategories and their functors, and \(\textbf{ClSMulticat}\) for the category of symmetric multicategories with closed structure, and functors preserving both of these.

Example 6

If \( (\mathcal {C}, \otimes , I, {[-, =]} ) \) is a closed (symmetric) monoidal category then the induced (symmetric) multicategory \(\mathcal {T}\mathcal {C}\) is also closed.

Closed multicategories allow us to model exponentials without requiring a tensor product. Writing out the rules in the internal language, we get the map \(\varLambda ^{A}\) in (5) as the usual abstraction rule, and the evaluation map as the application \(f : A\multimap B, x : A\vdash f \, x : B\). We then see that \(\varDelta , f : A\multimap B, x: A\vdash u[f \, x / y] : C\) whenever \(\varDelta , y : B\vdash u : C\), so we recover a small adaptation of Abramsky’s rules for exponentials. Write \( \mathcal {O} ^{\multimap } _\mathcal {S}\) (resp. \( \mathfrak {L} ^{\multimap } _\mathcal {S}\)) for the extension of \( \mathcal {O} _{\mathcal {S}}\) (resp. \( \mathfrak {L} _\mathcal {S}\)) with the following rules and the \(\beta \eta \)-laws familiar from \( \varLambda ^{\rightarrow }\):

figure i

Lemma 9

([20]). The composite forgetful functor \(\textbf{ClMulticat}\rightarrow \textbf{Multicat}\rightarrow \textbf{Sig}\) has a left adjoint, and the free closed multicategory on \(\mathcal {S}\) is the syntactic multicategory \(\textrm{Syn}( \mathcal {O} ^{\multimap } _\mathcal {S})\). The same holds for symmetric structure, if one replaces \(\textbf{ClMulticat}\) by \(\textbf{ClSMulticat}\) and \( \mathcal {O} ^{\multimap } \) by \( \mathfrak {L} ^{\multimap } \).

For the cartesian case, we follow the same procedure as in Section 4.

Definition 11

A closed clone is a clone \(\mathbb {C}\) equipped with a closed structure on \(\textrm{M}\mathbb {C}\). We write \(\textbf{ClClone}\) for the category of closed clones and clone homomorphisms preserving the closed structure as in Definition 10.

Example 7

If \( (\mathcal {C}, { \mathrm {\Pi } } , \Rightarrow ) \) is a cartesian closed category, the clone \(\mathcal {P}\mathcal {C}\) is closed.

Definition 11 recovers the usual \(\beta \eta \)-laws for exponentials in \( \varLambda ^{\rightarrow }\), complete with the weakenings that are usually implicit. Writing \(f \, x\) for \(\textrm{eval}\), we get the following equations in the internal language when \(\varGamma := (x_i : A_i)_{i=1, \dots , n}\):

$$ {( f \, x) }{ \big [ { {(\uplambda {x} \, . \,{t})}[{x_1 / x_1, \dots , x_n / x_n}] / f, x/ x } \big ] } = t , \uplambda {x} \, . \,{ {( f \, x) }{ \big [ { {t}[{x_1 / x_1, \dots , x_n / x_n}] / f} \big ] } } = t$$

Lemma 10

The composite forgetful functor \(\textbf{ClClone}\rightarrow \textbf{Clone}\rightarrow \textbf{Sig}\) has a left adjoint, and the free closed clone on \(\mathcal {S}\) is the syntactic clone \(\textrm{Syn}( \varLambda ^{\rightarrow }_\mathcal {S})\).

6 Cartesian closed structure

The development above makes defining cartesian closed structure straightforward. For reasons of space we restrict ourselves to the cartesian case, but similar remarks apply to the linear and ordered cases.

Definition 12

A cartesian closed clone is a clone equipped with both closed structure and cartesian structure. We write \(\textbf{CCClone}\) for the category of cartesian closed clones and homomorphisms that strictly preserve both structures.

By Lemmas 6 and 10, we already have a free property .

Lemma 11

The composite forgetful functor \(\textbf{CCClone}\rightarrow \textbf{Clone}\rightarrow \textbf{Sig}\) has a left adjoint, and \(\textrm{Syn}( \varLambda ^{\times , \rightarrow }_{\mathcal {S}})\) is the free cartesian closed clone on \(\mathcal {S}\).

The nucleus of any cartesian closed clone \( (\mathbb {C}, { \mathrm {\Pi } } , \Rightarrow ) \) is also cartesian closed:

$$ \overline{\mathbb {C}} (A\times B, C) = \mathbb {C}(A\times B; C) \cong \mathbb {C}(A, B; C) \cong \mathbb {C}(A; {{B} \Rightarrow {C}} ) = \overline{\mathbb {C}} (A, {{B} \Rightarrow {C}} ) $$

Similarly, by Examples 4 and 7, for any cartesian closed category \( (\mathcal {C}, { \mathrm {\Pi } } , \Rightarrow ) \) the induced category \(\mathcal {P}\mathcal {C}\) is cartesian closed. Proposition 1 then restricts as follows.

Proposition 4

The functor \( \overline{(-)} : \textbf{CCClone}\rightarrow \textbf{CCCat}\) fits into the following diagram, in which the right-hand adjunction is an equivalence:

figure j

Moreover, \( \textrm{U} \circ \mathcal {P}\) is equal to the canonical forgetful functor \(\textbf{CCCat}\rightarrow \textbf{Sig}\). Hence, the free cartesian closed category on \(\mathcal {S}\) is canonically isomorphic to \( \overline{\textrm{Syn}( \varLambda ^{\times , \rightarrow }_{\mathcal {S}})} \).

As in Section 4.2, the preceding two results are enough to recover the sound semantic interpretation of \( \varLambda ^{\times , \rightarrow }\), and the usual syntactic model.

7 Cartesian combinatory logic and SK-clones

In this section we begin a multi-ary investigation of cartesian combinatory logic, and give a categorical statement of the classical correspondence between combinatory logic and \( \varLambda ^{\rightarrow }\) (for which see e.g. [6, 15]). In Section 8 we shall use this to define SK-categories and show they are sound and complete for \( \varLambda ^{\rightarrow }\).

We briefly recapitulate the rules of typed combinatory logic \(\textsf{CL}_\mathcal {S}\) over a signature \(\mathcal {S}\); for a fuller account see e.g. [6]. Types are as in \( \varLambda ^{\rightarrow }\). Terms are given by the grammar \( t, u{::}= x\,\big | \, c \in \mathcal {S}(\varGamma ; B) \,\big | \, (t \, u) \,\big | \, \textsf{S} \,\big | \, \textsf{K} \): we have variables, constants and an application operation as in \( \varLambda ^{\rightarrow }\) and, for any context \(\varGamma \) and types \(A, B\) and \(C\), two combinators \(\varGamma \vdash \textsf{S} ^{\varGamma }_{A, B, C} : {{ \big ( {{A} \Rightarrow {( {{B} \Rightarrow {C}} )}} \big ) } \Rightarrow {\big ( {{( {{A} \Rightarrow {C}} )} \Rightarrow {( {{A} \Rightarrow {C}} )}} \big )}} \) and \(\varGamma \vdash \textsf{K} ^{\varGamma }_{A, B} : {{A} \Rightarrow { ( {{B} \Rightarrow {A}} ) }} \). Substitution is as in \( \varLambda ^{\rightarrow }\), where the combinators \( \textsf{Z} \in \{ \textsf{S} , \textsf{K} \}\) satisfy \( { \textsf{Z} }[{u_1 / x_1, \dots , u_n / x_n}] = \textsf{Z} \) so that \( \textsf{Z} ^{\varGamma }\) is the weakening of \( \textsf{Z} ^{\diamond }\).

The correlate of \(\beta \)-equality is weak equality \(=_{\textrm{w}}\), which is the smallest congruence containing \( \textsf{S} \, x \, y \, z = (x \, z ) \, (y \, z ) \) and \( \textsf{K} \, x \, y = x\). The correlate of \(\beta \eta \)-equality is extensional weak equality \(=_{\textrm{wext}}\), which extends \(=_{\textrm{w}}\) with the rule

(6)

We write \( \textsf{CL}^{\textrm{w}} \) for combinatory logic with weak equality and \( \textsf{CL}^{\textrm{wext}} \) for combinatory logic with extensional weak equality. The usual encoding of \( \textsf{CL}^{\textrm{w}} \) in \( \varLambda ^{\rightarrow }\) sends \( \textsf{S} \) and \( \textsf{K} \) to \(\uplambda {f} \, . \,{\uplambda {g} \, . \,{\uplambda {x} \, . \,{ (f \, x) \, (g \, x ) } } }\) and \(\uplambda {x} \, . \,{\uplambda {y} \, . \,{x}}\), respectively.

The next definition may be obtained by seeing that \( \textsf{CL}^{\textrm{w}} \) can be presented as an algebraic theory, and that clones are equivalent to algebraic theories (e.g. [29, 41]). We implicitly bracket application to the left, so \( t {{\,\mathrm{\cdot }\,}}u {{\,\mathrm{\cdot }\,}}v := ( t {{\,\mathrm{\cdot }\,}}u ) {{\,\mathrm{\cdot }\,}}v \). We also write \( {(-)}^{\varDelta ; \varTheta }\) for the weakening map \(\mathbb {C}(\varGamma ; B) \rightarrow \mathbb {C}(\varDelta , \varGamma , \varTheta ; B)\) sending \(t\) to \( { t}{ \big [ { \textsf{p}_{| \varDelta | + 1}^{\varDelta , \varGamma , \varTheta } , \dots , \textsf{p}_{| \varDelta | + | \varGamma |}^{\varDelta , \varGamma , \varTheta } , } \big ] } \); when \(\varGamma \) is empty we write just \( {(-)}^{\varDelta }\).

Definition 13

An SK-clone is a clone \(\mathbb {C}\) equipped with a mapping \( {[-, {=}]} : |\mathbb {C}| \times |\mathbb {C}| \rightarrow |\mathbb {C}| \), nullary multimaps \( \textsf{S} _{A, B, C} \in \mathbb {C}{\big (\diamond ; {\big [ {[A, {[B, C]} ]} , {[ {[A, B]} , {[A, C]} ]} \big ]} \big )}\) and \( \textsf{K} _{A, B} \in \mathbb {C}{\big (\diamond ; {[A, {[B, A]} ]} \big )}\) for every \(A, B, C\in |\mathbb {C}| \), and a binary application operation \(( - {{\,\mathrm{\cdot }\,}}{=} ): \mathbb {C}(\varGamma ; {[A, B]} ) \times \mathbb {C}(\varGamma ; A) \rightarrow \mathbb {C}(\varGamma ; B)\) for every \(\varGamma \in |\mathbb {C}| ^{\star }\) and \(B\in |\mathbb {C}| \), such that the following axioms hold whenever they are well-typed:

$$\begin{aligned} {( t {{\,\mathrm{\cdot }\,}}u )}[{v_1, \dots , v_n}] = {t}[{v_1, \dots , v_n}] {{\,\mathrm{\cdot }\,}} {u}[{v_1, \dots , v_n}] &, ({ \textsf{K} } _{A, B}) ^{A, B} {{\,\mathrm{\cdot }\,}} \textsf{p}_{1}^{} {{\,\mathrm{\cdot }\,}} \textsf{p}_{2}^{} = \textsf{p}_{1}^{} \\ ({ \textsf{S} } _{A, B, C}) ^{ {[A, {[B, C]} ]} , {[A, B]} , A} {{\,\mathrm{\cdot }\,}} \textsf{p}_{1}^{} {{\,\mathrm{\cdot }\,}} \textsf{p}_{2}^{} {{\,\mathrm{\cdot }\,}} \textsf{p}_{3}^{} &= ( \textsf{p}_{1}^{} {{\,\mathrm{\cdot }\,}} \textsf{p}_{3}^{} ) {{\,\mathrm{\cdot }\,}}( \textsf{p}_{2}^{} {{\,\mathrm{\cdot }\,}} \textsf{p}_{3}^{} ) \end{aligned}$$

A homomorphism of SK-clones is a clone homomorphism that preserves application, \( \textsf{S} \) and \( \textsf{K} \): \( f( \textsf{S} _{A, B, C}) = \textsf{S} _{fA, fB, fC} , f( \textsf{K} _{A, B}) = \textsf{K} _{fA, fB}\) and \(f( t {{\,\mathrm{\cdot }\,}}u ) = ft {{\,\mathrm{\cdot }\,}}fu \). We write \(\textbf{SKClone}\) for the category of SK-clones and their homomorphisms.

Lemma 12

The composite forgetful functor \(\textbf{SKClone}\rightarrow \textbf{Clone}\rightarrow \textbf{Sig}\) has a left adjoint, and the free SK-clone on \(\mathcal {S}\) is the syntactic clone \(\textrm{Syn}( \textsf{CL}^{\textrm{w}} _\mathcal {S})\).

A core feature of the syntax of combinatory logic, which is at the heart of the correspondence between the terms of \( \textsf{CL}^{\textrm{wext}} \) and \( \varLambda ^{\rightarrow }\), is the admissibility of bracket extension algorithms (see e.g. [5, §7.1]). To express this in the typed setting, we use the following notation. For a binary operation \( {[-, {=}]} \) on a set \(S\) we define \( {[ - ; {=} ]} : S^\star \times S\rightarrow S\) inductively as follows:

$$ {[ \diamond ; B ]} := B\quad , \quad {[ A ; B ]} := {[A, B]} \quad , \quad {[ \varGamma , A ; B ]} := {[ \varGamma ; {[A, B]} ]} $$

With this notation, bracket abstraction amounts to saying that if \(\varGamma := (x_i : A_i)_{i=1, \dots , n}\) and \(\varGamma \vdash t: B\) in \( \textsf{CL}^{\textrm{w}} \), there exists a closed term \(\diamond \vdash {t}^{\textrm{c}} : {[ \varGamma ; B ]} \) such that \( {( {t}^{\textrm{c}} )}^{\varGamma } \, x_1 \, \ldots \, x_n =_{\textrm{w}}t\). The extensionality axiom (6) then says that \( {t}^{\textrm{c}} \) is unique: in other words, \(t\mapsto {t}^{\varGamma } \, x_1 \, \ldots \, x_n\) is an isomorphism.

We now translate this into clone-theoretic terms. For any SK-clone \(\mathbb {C}\) we obtain the operation \(t\mapsto {t}^{\varGamma } \, x_1 \, \ldots \, x_n\) as the composite below:

$$\begin{aligned} i_{\varGamma ; B} := \Big ( \mathbb {C}(\diamond ; {[ \varGamma ; B ]} ) \xrightarrow {\textrm{w}^{\varGamma }} \mathbb {C}(\varGamma ; {[ \varGamma ; B ]} ) \xrightarrow { (-) {{\,\mathrm{\cdot }\,}} \textsf{p}_{1}^{\varGamma } \cdot \dots \textsf{p}_{| \varGamma |}^{\varGamma } } \mathbb {C}(\varGamma ; B) \Big ) \end{aligned}$$
(7)

For \(\varGamma := \diamond \) this is just the identity. The admissibility of bracket abstraction in the syntax of \( \textsf{CL}^{\textrm{w}} \) is then captured by the next lemma. Typically bracket abstraction algorithms restrict to closed constants, because an open constant may have no corresponding closed term. We restrict in the same way. Call a signature \(\mathcal {S}\) nullary if \(\mathcal {S}(\varGamma ; A) = \varnothing \) whenever \(\varGamma \ne \diamond \), and write \(\textbf{Sig}_0 \hookrightarrow \textbf{Sig}\) for the full subcategory of nullary signatures.

Lemma 13

Let \(\mathcal {S}\) be a nullary signature. Then for any \(\varGamma \in |\textrm{Syn}( \textsf{CL}^{\textrm{w}} _\mathcal {S})| ^{\star }\) and \(B\in |\textrm{Syn}( \textsf{CL}^{\textrm{w}} _\mathcal {S})| \) there exists a map \( {(-)}^{\textrm{c}} \) such that \( i_{\varGamma ; B} \circ {(-)}^{\textrm{c}} = \textrm{id}_{\textrm{Syn}( \textsf{CL}^{\textrm{w}} _\mathcal {S})}\).

Because bracket abstraction is defined by induction on the syntax, we cannot straightforwardly define it in an arbitrary SK-clone. We can, however, consider the sub-category of SK-clones (= semantic models of \( \textsf{CL}^{\textrm{w}} \)) which admit bracket abstraction in the sense that each \( i_{\varGamma ; B} \) has a retraction. The extensional models are then those for which this retract \( {(-)}^{\textrm{c}} \) also satisfies uniqueness.

Definition 14

An SK-clone \(\mathbb {C}\) is extensional if for every \(\varGamma \in |\mathbb {C}| ^{\star }\) and \(B\in |\mathbb {C}| \) the map \( i_{\varGamma ; B} \) defined in (7) is invertible. We write \( \textbf{SKClone}_{\textrm{ext}} \) for the full subcategory of \(\textbf{SKClone}\) consisting of just the extensional SK-clones.

Lemma 14

The composite forgetful functor \( \textbf{SKClone}_{\textrm{ext}} \rightarrow \textbf{Clone}\rightarrow \textbf{Sig}_0\) has a left adjoint, and the free extensional SK-clone on a nullary signature \(\mathcal {S}\) is the syntactic clone \(\textrm{Syn}( \textsf{CL}^{\textrm{wext}} _\mathcal {S})\).

7.1 Extensional SK-clones are closed clones

In this section we outline why \( \textbf{SKClone}_{\textrm{ext}} \) is equivalent to \(\textbf{ClClone}\), thereby giving a category-theoretic equivalence not just between the syntax of \( \textsf{CL}^{\textrm{wext}} \) and \( \varLambda ^{\rightarrow }\) but also between their models. The proof uses extensionality or the \(\eta \)-law to pass from arbitrary multimaps to nullary ones, from which one can build a strict closed clone. We shall rely heavily on the following simple observation.

Lemma 15

Let \(\mathbb {C}\) be a clone and \(X:= \big \{ X(\varGamma ; B) \big \}_{\varGamma \in |\mathbb {C}| ^\star , B\in |\mathbb {C}| }\) a family of sets together with an isomorphism \(\big \{ \nu _{\varGamma ; A} : \mathbb {C}(\varGamma ; A) \rightarrow X(\varGamma ; A) \big \}_{\varGamma , A}\) between \(X\) and the hom-sets of \(\mathbb {C}\) in the functor category \(\big [ |\mathbb {C}| ^{\star } \times |\mathbb {C}| , \textbf{Set}\big ]\). Then \(X\) acquires a canonical clone structure and \(\nu \) becomes an isomorphism of clones.

We now introduce strict closed clones.

Definition 15

A strict closed clone is a closed clone \( (\mathbb {C}, \Rightarrow , \textrm{eval}) \) such that every \(\varLambda ^{A} : \mathbb {C}(\varGamma , A; B) \rightarrow \mathbb {C}(\varGamma , {{A} \Rightarrow {B}} )\) is the identity. We write \(\iota : \textbf{ClClone}_{\textrm{st}} \hookrightarrow \textbf{ClClone}\) for the full subcategory consisting of just the strict closed clones.

Any closed clone \( (\mathbb {C}, \Rightarrow , \textrm{eval}) \) determines a strict closed clone \( \textrm{S} \mathbb {C}\) and a clone isomorphism \(\lambda _{\mathbb {C}} : \mathbb {C}\rightarrow \textrm{S} \mathbb {C}\) by applying Lemma 15 to the isomorphisms \(\mathbb {C}(\varGamma ; B) \cong \mathbb {C}(\diamond ; {\varGamma \Rightarrow B} )\) arising from the closed structure. This extends to a functor \( \textrm{S} : \textbf{ClClone}\rightarrow \textbf{ClClone}_{\textrm{st}} \) sending \(f: (\mathbb {C}, \Rightarrow , \textrm{eval}) \rightarrow (\mathbb {D}, \Rightarrow , \textrm{eval}) \) to the composite \(\lambda _{\mathbb {D}} \circ f\circ \lambda _{\mathbb {C}}^{-1}\). A short calculation shows that the isomorphisms \(\lambda \) make \( \textrm{S} : \textbf{ClClone}\leftrightarrows \textbf{ClClone}_{\textrm{st}} : \iota \) into an equivalence of categories.

We play a similar game for turning extensional SK-clones into (strict) closed clones. Indeed, for any extensional SK-clone we have isomorphisms \(\mathbb {C}(\varGamma ; B) \cong \mathbb {C}(\diamond ; {[ \varGamma ; B ]} )\) defining a strict closed clone \( \textrm{L} \mathbb {C}\) with \(( \textrm{L} \mathbb {C})(\varGamma ; B) := \mathbb {C}(\diamond ; {[ \varGamma ; B ]} )\), and hence a functor \( \textrm{L} : \textbf{SKClone}_{\textrm{ext}} \rightarrow \textbf{ClClone}_{\textrm{st}} \) in a similar fashion to \( \textrm{S} \).

Finally, for any closed clone \( (\mathbb {C}, \Rightarrow , \textrm{eval}) \) we get an extensional SK-clone \( \textrm{E} \mathbb {C}\) with the same underlying clone by taking application to be application in \( \varLambda ^{\rightarrow }\), so \( t {{\,\mathrm{\cdot }\,}}u := {\textrm{eval}_{A, B}}[{t, u}] \), and encoding the combinators as usual.

Theorem 1

There exist equivalences of categories

figure k

8 A categorical model of \( \varLambda ^{\rightarrow }\)

In Propositions 1 and 4 we recovered a unary semantic interpretation of \( \varLambda ^{\times }\) and \( \varLambda ^{\times , \rightarrow }\) from our clone-theoretic ones. But we do not have a corresponding result for \( \varLambda ^{\rightarrow }\). In this section we fill this gap: we introduce SK-categories and show they play the role for \( \varLambda ^{\rightarrow }\) that cartesian closed categories play for \( \varLambda ^{\times , \rightarrow }\). Our definition is inspired by closed categories ([10, 11]), which axiomatise an ‘internal’ version of the hom-functor \(\mathcal {C}(-, {=})\) in the form of a functor \( {[-, {=}]} : {\mathcal {C}}^{\textrm{op}} \times \mathcal {C}\rightarrow \mathcal {C}\). Closed categories have a unit object, corresponding to requiring a unit type (cf. [31]); our definition avoids this (see also [39, 43]).

Recall that in the presence of contravariance, dinaturality and extranaturality are the right replacements for naturality (see e.g. [30, §IX.4]).

Definition 16

An SK-category consists of a category \(\mathcal {C}\) and functors \( {[-, {=}]} : {\mathcal {C}}^{\textrm{op}} \times \mathcal {C}\rightarrow \mathcal {C}\) and \(U: \mathcal {C}\rightarrow \textbf{Set}\), together with

  1. 1.

    Maps \( {S}_{C, D, E} : {[C, {[D, E]} ]} \rightarrow {[ {[C, D]} , {[C, E]} ]} \) dinatural in \(C\) and natural in \(D\) and \( E\);

  2. 2.

    Maps \( K^{C}_{D} : D\rightarrow {[C, D]} \) extranatural in \(C\) and natural in \(D\);

  3. 3.

    Maps \( \varepsilon _{C, D} : U {[C, D]} \times \textrm{U} C\rightarrow UD\) extranatural in \(C\) and natural in \(D\);

This data is subject to the condition that \(U\circ {[-, {=}]} = \mathcal {C}(-, {=}) : {\mathcal {C}}^{\textrm{op}} \times \mathcal {C}\rightarrow \textbf{Set}\) and the 7 axioms of Figure 1a. An SK-functor \((F, \phi , \psi )\) is a functor \(F: \mathcal {C}\rightarrow \mathcal {D}\) with natural transformations as below, such that the axioms of Figure 1b hold.

figure l

We call \( (F, \phi , \psi ) \) strict if \(\phi \) is the identity, and write \( \textbf{SKCat} \) for the category of SK-categories and strict SK-functors.

Fig. 1.
figure 1

Extra axioms for Definition 16

We think of \(UC\) as the set of multimaps \(\diamond \rightarrow C\) and \( \varepsilon _{} {}\) as a formal application operation \(( - {{\,\mathrm{\cdot }\,}}{=} )\). Axioms (1) and (2) are the weak equality laws from \(\textsf{CL}\). Axioms (3) and (4) ensure compatibility between the category structure and the corresponding \(\textsf{CL}\) constructions: for example, axiom (3) implies \(U(f)(x) = f {{\,\mathrm{\cdot }\,}}x \), and axiom (4) says that composition coincides with \( \textsf{S} \, ( \textsf{K} \, -) \, ({=})\), corresponding to the weak equality \( \textsf{S} \, ( \textsf{K} \, f) \, g \, x = f \, (g \, x)\). Axioms (5) – (7) are coherence laws.

Every extensional SK-clone determines an SK-category. Because we follow [11] and ask for an equality \(U {[A, B]} = \mathcal {C}(A, B)\) in the definition of SK-categories, but in general an extensional SK-clone \( (\mathbb {C}, {[-, {=}]} , \textsf{S} , \textsf{K} , {{\,\mathrm{\cdot }\,}} ) \) only has an isomorphism \(\mathbb {C}(A; B) \cong \mathbb {C}(\diamond ; {[A, B]} )\), we need to strictify in the same manner as Section 7.1. As a notational shorthand, we write \( \textsf{I} , \textsf{B} \) and \( \mathsf {B'} \) for the closed multimaps satisfying the equations below in the internal language of \(\mathbb {C}\) (see e.g. [6, 15]):

$$ { \textsf{I} }^{A} {{\,\mathrm{\cdot }\,}}x = x , \textsf{B} ^{ {{B} \Rightarrow {C}} , {{A} \Rightarrow {B}} , A} {{\,\mathrm{\cdot }\,}}x {{\,\mathrm{\cdot }\,}}y {{\,\mathrm{\cdot }\,}}z = x {{\,\mathrm{\cdot }\,}}( y {{\,\mathrm{\cdot }\,}}z ) , ( \textsf{B} ') ^{ {{A} \Rightarrow {B}} , {{B} \Rightarrow {C}} , A} {{\,\mathrm{\cdot }\,}}x {{\,\mathrm{\cdot }\,}}y {{\,\mathrm{\cdot }\,}}z = y {{\,\mathrm{\cdot }\,}}( x {{\,\mathrm{\cdot }\,}}z ) $$

The category \( \textrm{N} \mathbb {C}\) has objects \( |\mathbb {C}| \) and hom-sets \(( \textrm{N} \mathbb {C})(A, B) := \mathbb {C}(\diamond ; {[A, B]} )\) (cf. [14]). The identity on \(A\) is \( \textsf{I} _{A}\) and the composite of \(t\) and \(t'\) is \( \textsf{B} {{\,\mathrm{\cdot }\,}}t {{\,\mathrm{\cdot }\,}}t' \). For \(U\) we take \(UA:= \mathbb {C}(\diamond ; A)\) with the action on maps given by application. For \( {[-, {=}]} \) the action on objects is given by the SK-structure, with the action on maps given by \( {[X, t]} := \textsf{B} {{\,\mathrm{\cdot }\,}}t \) and \( {[t, X]} := \textsf{B} ' {{\,\mathrm{\cdot }\,}}t \). The maps \( {S}_{} \) and \( K^{}_{} \) are given by the corresponding combinators, and \( \varepsilon _{} \) is the application operation in \(\mathbb {C}\). This extends to a functor \( \textrm{N} : \textbf{SKClone}_{\textrm{ext}} \rightarrow \textbf{SKCat} \).

The internal language of SK-categories is \( \textsf{CL}^{\textrm{wext}} \), and hence \( \varLambda ^{\rightarrow }\). We write \( \textrm{U} \) for the functor which sends an SK-category \( (\mathcal {C}, U, {[-, {=}]} , {S}_{} , K^{}_{} , \varepsilon _{} ) \) to the signature with base types \( |\mathcal {C}| \) and constants \(U {[\varGamma , B]} \).

Proposition 5

The forgetful functor \( \textrm{U} : \textbf{SKCat} \rightarrow \textbf{Sig}\) has a left adjoint, and the free SK-category on \(\mathcal {S}\) is \( \textrm{N} \big ( \textrm{Syn}( \textsf{CL}^{\textrm{wext}} _\mathcal {S}) \big ) \cong ( \textrm{N} \circ \textrm{E} )\big ( \textrm{Syn}( \varLambda ^{\rightarrow }_\mathcal {S}) \big ) \).

Using Theorem 1, we now obtain a version of Propositions 1 and 4 for \( \varLambda ^{\rightarrow }\).

Theorem 2

The composite \( \textrm{N} \circ \iota : \textbf{ClClone}_{\textrm{st}} \rightarrow \textbf{SKCat}\) is invertible; hence we get the diagram below, in which the right-hand adjunction is an equivalence:

figure m

Moreover, \( \textrm{U} \circ \textrm{Cl} \) is equal to the forgetful functor \(\textbf{SKCat}\rightarrow \textbf{Sig}\), so the free SK-category on \(\mathcal {S}\) is canonically isomorphic to \(( \textrm{N} \circ \textrm{E} )(\textrm{Syn}( \varLambda ^{\rightarrow }_{\mathcal {S}}))\).

Recall that a closed monoidal category is a monoidal category \( (\mathcal {D}, \otimes , I) \) such that every \({(-) \otimes D}\) has a right adjoint \( {[D, -]} \), and that in a closed category \(\mathcal {C}\) giving every \( {[C, -]} \) a \(\mathcal {C}\)-enriched left adjoint is equivalent to giving closed monoidal structure ([10, 11, 43]). Theorem 2 and Proposition 4 imply a cartesian version.

Corollary 2

Equipping a category \(\mathcal {C}\) with cartesian closed structure is equivalent to equipping \(\mathcal {C}\) with SK-structure and natural isomorphisms \(\mathcal {C}(I, {[C, D]} ) \cong \mathcal {C}(C, D)\) and \(\mathcal {C}(C\otimes D, E) \cong \mathcal {C}(C, {[D, E]} )\) for every \(C, D, E\in \mathcal {C}\).