A Categorical Semanticsfor Linear Logical Frameworks

A Categorical Semantics
for Linear Logical Frameworks

Matthijs Vákár Department of Computer Science,
University of Oxford, Oxford, United Kingdom
Abstract

A type theory is presented that combines (intuitionistic) linear types with type dependency, thus properly generalising both intuitionistic dependent type theory and full linear logic. A syntax and complete categorical semantics are developed, the latter in terms of (strict) indexed symmetric monoidal categories with comprehension. Various optional type formers are treated in a modular way. In particular, we will see that the historically much-debated multiplicative quantifiers and identity types arise naturally from categorical considerations. These new multiplicative connectives are further characterised by several identities relating them to the usual connectives from dependent type theory and linear logic. Finally, one important class of models, given by families with values in some symmetric monoidal category, is investigated in detail.

Matthijs Vákár

1 Introduction

Starting from Church’s simply typed -calculus (or intuitionistic propositional type theory), two extensions in perpendicular directions depart:

  • following the Curry-Howard propositions-as-types interpretation dependent type theory (DTT) [1] extends the simply typed -calculus from a proof-calculus of intuitionistic propositional logic to one for predicate logic;

  • linear logic [2] gives a more detailed resource sensitive analysis, exposing precisely how many times each assumption is used in proofs.

A combined linear dependent type theory is one of the interesting directions to explore to gain a more fine-grained understanding of homotopy type theory [3] from a computer science point of view, explaining its flow of information. Indeed, many of the usual settings for computational semantics are naturally linear in character, either because they arise as -co-Kleisli categories (coherence space and game semantics) or for more fundamental reasons (quantum computation).

Combining dependent types and linear types is a non-trivial task, however, and despite some work by various authors that we shall discuss, the precise relationship between the two systems remains poorly understood. The discrepancy between linear and dependent types is the following.

  • The lack of structural rules in linear type theory forces us to refer to each variable precisely once - for a sequent , occurs uniquely in .

  • In dependent type theory, types can have free variables - , where is free in . Crucially, if , may also be free in .

What does it mean for to occur uniquely in in a dependent setting? Do we count its occurrence in ? The usual way out, which we shall follow too, is to restrict type dependency on intuitionistic terms. Although this seems very limiting - for instance, we do not obtain an equivalent of the Girard translation, embedding DTT in the resulting system -, it is not clear that there is a reasonable alternative. Moreover, as even this limited scenario has not been studied extensively, we hope that a semantic analysis, which was so far missing entirely, may shed new light on the old mystery of linear type dependency.

Historically, Girard’s early work in linear logic already makes movements to extend a linear analysis to predicate logic. Although it talks about first-order quantifiers, the analysis appears to have stayed rather superficial, omitting the identity predicates which, in a way, are what make first-order logic tick. Closely related is that an account of internal quantification, or a linear variant of Martin-Löf’s type theory, was missing, let alone a Curry-Howard correspondence.

Later, linear types and dependent types were first combined in a Linear Logical Framework [4], where a syntax was presented that extends a Logical Framework with linear types (that depend on terms of intuitionistic types). This has given rise to a line of work in the computer science community [5, 6, 7]. All the work seems to be syntactic in nature, however, and seems to be mostly restricted to the asynchronous fragment in which we only have -, -, -, and -types. An exception is the Concurrent Logical Framework [8], which treats synchronous connectives resembling our -, -, -, and -types. An account of additive disjunctions and identity types is missing entirely.

On the other hand, similar ideas, this time at the level of categorical semantics and specific models (from homotopy theory, algebra, and physics), have emerged in the mathematical community [9, 10, 11, 12]. In these models, as with Girard, a notion of comprehension was missing and, with that, a notion of identity type. Although, in the past year, some suggestions have been made on the nLab and nForum of possible connections between the syntactic and semantic work, no account of the correspondence was published, as far as the author is aware.

The point of this paper111This paper is based on the technical report [13] where proofs and more discussion can be found. Independently, Krishnaswami et al. [14] developed a roughly equivalent syntax and gave an operational rather than a denotational semantics. There, type dependency is added to Benton’s LNL calculus, rather than to DILL. is to close this gap between syntax and semantics and to pave the way for a proper semantic analysis of linear type dependency, treating a range of type formers including the crucial -types222To be precise: extensional -types. Intensional -types remain a topic of investigation, due to the subtlety of dependent elimination rules in a linear setting.

. Firstly, in section 2, we present a syntax, intuitionistic linear dependent type theory (ILDTT), a natural blend of the dual intuitionistic linear logic (DILL) [15] and dependent type theory (DTT) [16] which generalises both. Secondly, in section 3, we present a complete categorical semantics, an obvious combination of linear/non-linear adjunctions [15] and comprehension categories [17]. Finally, in section 4, an important class of models is studied: families with values in a symmetric monoidal category.

2 Syntax

We assume the reader has some familiarity with the formal syntax of dependent type theory and linear type theory. In particular, we will not go into syntactic details like -conversion, name binding, capture-free substitution of for in (write ), and pre-syntax. Details on all of these topics can be found in [16].

We next present the formal syntax of ILDTT. We start with a presentation of the judgements that will represent the propositions in the language and then discuss its rules of inference: first its structural core, then the logical rules for a series of optional type formers. We conclude this section with a few basic results about the syntax.

Judgements

We adopt a notation for contexts, where is ‘an intuitionistic region’ and is ‘a linear region’, as in DILL [15]. The idea will be that we have an empty context and can extend an existing context with both intuitionistic and linear types that are allowed to depend on .

Our language will express judgements of the following six forms.

ILDTT judgement Intended meaning is a valid context is a type in (intuitionistic) context is a term of type in context and are judgementally equal contexts and are judgementally equal types in (intuitionistic) context and are judgementally equal terms of type in context

Figure 1: Judgements of ILDTT.

Structural Rules

We will use the following structural rules, which are essentially the structural rules of dependent type theory where some rules appear in both an intuitionistic and a linear form. We present the rules per group, with their names, from left-to-right, top-to-bottom.

Rules for context formation (C-Emp, Int-C-Ext, Int-C-Ext-Eq, Lin-C-Ext, Lin-C-Ext-Eq):                                                                                                                                                                                   Variable declaration/axiom rules (Int-Var, Lin-Var):                                                                                                

Figure 2: Context formation and variable declaration rules.

The standard rules expressing that judgemental equality is an equivalence relation (C-Eq-R, C-Eq-S, C-Eq-T, Ty-Eq-R, Ty-Eq-S, Ty-Eq-T, Tm-Eq-R, Tm-Eq-S, Tm-Eq-T):                                                                                                                                                                                                                The standard rules relating typing and judgemental equality (Tm-Conv, Ty-Conv):                                                                                                                             

Figure 3: A few standard rules for judgemental equality.

Exchange, weakening, and substitution rules (Int-Weak, Int-Exch, Lin-Exch, Int-Ty-Subst, Int-Ty-Subst-Eq, Int-Tm-Subst, Int-Tm-Subst-Eq, Lin-Tm-Subst, Lin-Tm-Subst-Eq):                                                 (if is not free in )                                                                                                                                                                      

Figure 4: Exchange, weakening, and substitution rules. Here, represents a statement of the form , , , or , such that all judgements are well-formed.

Logical Rules

We describe some (optional) type and term formers, for which we give type formation (denoted -F), introduction (-I), elimination (-E), computation rules (-C), and (judgemental) uniqueness principles (-U). We also assume the obvious rules to hold that state that the type formers and term formers respect judgemental equality. Moreover, , , , and are name binding operators, binding free occurences of within their scope.

We demand -U-rules for the various type formers in this paper, as this allows us to give a natural categorical semantics. This includes -types: we study extensional identity types. In practice, when building a computational implementation of a type theory like ours, one would probably drop some of these rules to make the system decidable, which would correspond to switching to weak equivalents of the categorical constructions presented here.333In that case, in DTT, one would usually demand some stronger ‘dependent’ elimination rules, which would make propositional equivalents of the -U-rules provable, adding some extensionality to the system, while preserving its computational properties. Such rules are problematic in ILDTT, however, both from a syntactic and semantic point of view and a further investigation is warranted here.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Figure 5: Rules for linear equivalents of some of the usual type formers from DTT (-F, -I, -E, -C, -U, -F, -I, -E, -C, -U, -F, -I, -E, -C, -U).

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              

                                                                                             

Figure 6: Rules for the usual linear type formers in each context (-F, -I, -E, -C, -U, -F, -I, -E, -C, -U, -F, -I, -E, -C, -U, -F, -I, -U, -F, -I, -E1, -E2, -C1, -C2, -U, -F, -E, -U, -F, -I1, -I2, -E, -C1, -C2, -U, -F, -I, -E, -C, -U).

Finally, we add rules that say we have all the possible commuting conversions, which from a syntactic point of view restore the subformula property and from a semantic point of view say that our rules are natural transformations (between hom-functors), which simplifies the categorical semantics significantly. We represent these schematically, following [15]. That is, if is a linear program context, i.e. a context built without using , then (abusing notation and dealing with all the -constructors in one go) the following rules hold.

                                              if does not bind any free variables in or ;     if does not bind any free variables in ;                                                if does not bind any free variables in or or .

Figure 7: Commuting conversions.
Remark 1

Note that all type formers that are defined context-wise (, , , , , , , and ) are automatically preserved under the substitutions from Int-Ty-Subst (up to canonical isomorphism444By an isomorphism of types and in context , we here mean a pair of terms and together with a pair of judgemental equalities and .), in the sense that is isomorphic to for an -ary type former . Similarly, for or , we have that is isomorphic to and is isomorphic to . This gives us Beck-Chevalley conditions in the categorical semantics.

Remark 2

The reader can note that the usual formulation of universes for DTT transfers very naturally to ILDTT, giving us a notion of universes for linear types. This allows us to write rules for forming types as rules for forming terms, as usual. We do not choose this approach and define the various type formers in the setting without universes.

Some Basic Results

As the focus of this paper is the syntax-semantics correspondence, we will only briefly state a few syntactic results. For some standard metatheoretic properties for (a system equivalent to) the -fragment of our syntax, we refer the reader to [4]. Standard techniques and some small adaptations of the system should be enough to extend the results to all of ILDTT.

We will only note the consistency of ILDTT both as a type theory (not, for all , ) and as a logic (ILDTT does not prove that every type is inhabited).

Theorem 2.1 (Consistency)

ILDTT with all its type formers is consistent, both as a type theory and as a logic.

Proof (sketch)

This follows from model-theoretic considerations. Later, in section 3, we shall see that our model theory encompasses that of DTT, for which we have models exhibiting both types of consistency.

To give the reader some intuition for these linear - and -types, we suggest the following two interpretations.

Theorem 2.2 ( and as Dependent and )

Suppose we have -types. Let , where is not free in . Then,

  1. is isomorphic to , if we have -types and -types;

  2. is isomorphic to , if we have -types and -types.

In particular, we have the following stronger version of a special case.

Theorem 2.3 ( as )

Suppose we have - and -types. Let . Then, satisfies the rules for . Conversely, if we have - and -types, then satisfies the rules for .

A second interpretation is that and generalise and . Indeed, the idea is that that (or their infinitary equivalents) is what they reduce to when taken over discrete types. The subtlety in this result is the definition of a discrete type. The same phenomenon is observed in a different context in section 4.

For our purposes, a discrete type is a strong sum of (a sum with a dependent -E-rule). Let us for simplicity limit ourselves to the binary case. For us, the discrete type with two elements will be , where has a strong/dependent -E-rule (note that this is not our -E). Explicitly, is a type with the following -F-, -I-, and -E-rules (and the obvious -C- and -U-rules):

                                                                                                                                                 

Figure 8: Rules for a discrete type , with -C- and -U-rules omitted for reasons of space.
Theorem 2.4 ( and as Infinitary Non-Discrete and )

If we have a discrete type and a type family , then

  1. satisfies the rules for ;

  2. satisfies the rules for .

3 Categorical Semantics

We now introduce a notion of categorical model for which soundness and completeness results hold with respect to the syntax of ILDTT in presence of - and -types555In case we are interested in the case without - and -types, the semantics easily generalises to strict indexed symmetric multicategories with comprehension.. This notion of model will prove to be particularly useful when thinking about various (extensional) type formers.

Definition 1

By a strict indexed symmetric monoidal category with comprehension, we will mean the following data.

  1. A category with a terminal object .

  2. A strict indexed symmetric monoidal category over , i.e. a contravariant functor into the category of (small) symmetric monoidal categories and strong monoidal functors We will also write for the action of on a morphism of .

  3. A comprehension schema, i.e. for each and a representation for the functor

    We will write its representing object666Really, would be a better notation, where we think of as an adjunction inducing , but it would be very verbose. and universal element . We will write for the isomorphism , if .

Remark 3

Note that this notion of model reduces to a standard notion of model for DTT in the case the monoidal structures on the fibre categories are Cartesian: a reformulation of split comprehension categories with - and -types. To get a precise fit with the syntax, the extra demand called “fullness” is usually put on these [17]. The fact that we leave out this last condition precisely allows for non-trivial -types (i.e. ones such that ) in our models of ILDTT. Every model of DTT is, in particular, a (degenerate) model of ILDTT, though. We will see that the type formers of ILDTT also generalise those of DTT.

Theorem 3.1 (Soundness)

We can soundly interpret ILDTT with - and -types in a strict indexed symmetric monoidal category with comprehension.

Proof (sketch)

The idea is that a context will be (inductively) interpreted by a pair of objects , , a type in context by an object of , and a term in context by a morphism . Generally, the interpretation of the propositional linear type theory in intuitionistic context will happen in as would be expected.

The crux is that Int-C-Ext (), Int-Var (), and Int-Subst (by ) are interpreted through the comprehension, as is Int-Weak (through of the obvious morphism in ).

Finally, Soundness is a trivial verification.

Theorem 3.2 (Completeness)

In fact, this interpretation is complete.

Proof (sketch)

We see this through the construction of a syntactic category.

In fact, we would like to say that the syntax is even an internal language for such categories. This is almost true, can be made entirely true by either putting the restriction on our notion of model that excludes any non-trivial morphisms into objects that are not of the form . Alternatively, we can extend the syntax to talk about context morphisms explicitly [18]. Following the DTT tradition, we have opted against the latter.

We will next characterise the categorical description of the various type formers. First, we note the following.

Theorem 3.3 (Comprehension Functor)

A comprehension schema on a strict indexed symmetric monoidal category defines a morphism of indexed categories, where is the full sub-indexed category of (by making a choice of pullbacks) on the objects of the form and where
{diagram}M_Δ(A⟶aB):=p_Δ,A & \rTo^p_Δ,A,a{p_Δ,A}∘v_Δ,A & p_Δ,B.

Note that is a display map category and hence a model of DTT [17]. We will think of it as the intuitionistic content of . We will see that the comprehension functor will give us a unique candidate for -types: , where is a monoidal adjunction. We conclude that, in ILDTT, the -modality is uniquely determined by the indexing. This is worth noting, because, in propositional linear type theory, we might have many different candidates for -types.

Theorem 3.4 (Semantic Type Formers)

For the other type formers, we have the following. A model of ILDTT with - and -types…

  1. …supports -types iff all the pullback functors have left adjoints that satisfy the Beck-Chevalley condition in the sense that the canonical map is an iso, where and , and that satisfy Frobenius reciprocity in the sense that the canonical morphism is an isomorphism , for all , .

  2. …supports -types iff all the pullback functors have right adjoints that satisfy the dual Beck-Chevalley condition for pullbacks of the form : the canonical is an iso.

  3. …supports -types iff factors over the category of symmetric monoidal closed categories and their homomorphisms.

  4. …supports - and -types iff factors over the category of Cartesian categories with symmetric monoidal structure and their homomorphisms.

  5. …supports - and -types iff factors over the category of co-Cartesian categories with a distributive symmetric monoidal structure and their homomorphisms.

  6. …that supports -types, supports -types iff all the comprehension functors have a strong monoidal left adjoint and is a morphism of indexed categories: for all , . Then interprets the comodality in context .

  7. … that supports -types, supports Id-types iff for all , we have left adjoints that satisfy a Beck-Chevalley condition: is an iso. Now, interprets . Above, {diagram}Δ.A & \rTo^diag_Δ,A:=⟨id_Δ.A,v_Δ,A & Δ.A.A{p_Δ,A}.

The semantics of suggests an alternative definition for the notion of a comprehension: if we have -types in a strong sense, it is a derived notion!

Theorem 3.5 (Lawve