\newarrow
Corresponds¡—¿
\newarrowDotscorresponds¡…¿
\newarrowEquals=====
\newarrowIntoC—¿
\newarrowEmbed¿—¿
\newarrowDepTo—-triangle
\newarrowDotsTo….¿
\newarrowDotsDepTo….triangle
\newarrowdLine=====
Categories with Dependence and Semantics of Type Theories
**Norihiro Yamada
[email protected]
University of Oxford
**
Abstract
In order to capture the categorical counterpart of the path from simple type theories (STTs) to dependent type theories (DTTs) that faithfully reflect syntactic phenomena, we introduce a generalization of cartesian closed categories (CCCs), called cartesian closed categories with dependence (CCCwDs).
Indeed, CCCwDs are a categorical concept as they are defined in terms of universal properties that naturally generalize those of CCCs; also, CCCwDs have a direct counterpart of terms, and moreover their strict version induces categories with families that support strict 1-, Π- and Σ-types, i.e., a ‘binder-free’ formulation of the core part of DTTs.
As a main theorem, we prove that CCCwDs give a sound and complete interpretation of the (1, Π, Σ)-fragment of Martin-Löf type theory (MLTT), a canonical representative of DTTs.
Moreover, we establish a 2-equivalence between the 2-category of contextual (in a suitable sense similar to contextual categories by Cartmell) CCCwDs and the 2-category of MLTTs.
In addition, we show that the 2-category of constant (in a suitable sense that abstractly captures simple types) contextual CCCwDs is 2-equivalent to the 2-category of contextual CCCs, which is well-known to be 2-equivalent to the 2-category of simply-typed λ-calculi equipped with 1- and ×-types, a canonical representative of STTs.
In this manner, we show that the categorical path from constant contextual CCCwDs to contextual CCCwDs corresponds to the syntactic path from STTs to DTTs, and also clarify its relation with the interpretation of STTs in CCCs.
As a ‘by-product’, fundamental concepts in category theory, e.g., categories, isomorphisms, functors, natural transformations, limits, adjoints, etc. are naturally generalized.
Hence, the present work also sets out a general theory of ‘categories for dependence’.
Contents
-
1 Introduction
-
2 Preliminaries
-
2.1 The Syntax of Martin-Löf Type Theories
-
2.1.1 Contexts
-
2.1.2 Structural Rules
-
2.1.3 Unit Type
-
2.1.4 Dependent Function Types
-
2.1.5 Dependent Pair Types
-
2.1.6 Context Morphisms and Generalized Substitution
-
2.1.7 Martin-Löf Type Theories as Algebraic Theories
-
2.1.8 Pre-Syntax
-
2.1.9 Simply-Typed Lambda-Calculi as Sub-Theories
-
2.2 Categories with Families
-
2.2.1 Categories with Families
-
2.2.2 Interpretation of MLTTs in CwFs
-
2.2.3 Interpretation of STLCs in CCCs
-
3 Categories with Dependence
-
3.1 Categories and Functors with Dependence
-
3.1.1 Categories with Dependence
-
3.1.2 Functors with Dependence
-
3.2 Semi-Cartesian Categories, Functors and Natural Transformations with Dependence
-
3.2.1 Semi-Cartesian Categories with Dependence
-
3.2.2 Semi-Cartesian Functors with Dependence
-
3.2.3 Natural Transformations with Dependence
-
3.2.4 The 2-Category of Semi-Cartesian Categories with Dependence
-
3.2.5 Categories of Dependent Objects
-
3.2.6 Isomorphisms between Dependent Objects
-
3.3 Cartesian Categories and Functors with Dependence
-
3.3.1 Cartesian Categories with Dependence
-
3.3.2 Dependent Limits
-
3.3.3 Cartesian Functors with Dependence
-
3.3.4 The 2-Category of Cartesian Categories with Dependence
-
3.4 Cartesian Closed Categories and Functors with Dependence
-
3.4.1 Cartesian Closed Categories with Dependence
-
3.4.2 Cartesian Closed Functors with Dependence
-
3.4.3 The 2-Category of Cartesian Closed Categories with Dependence
-
4 Equivalence between CtxCCCs and ConCtxCCCwDs
-
4.1 Contextual Cartesian Closed Categories
-
4.2 Contextual Cartesian Closed Categories with Dependence
-
4.3 Equivalence between CtxCCCs and ConCtxCCCwDs
-
5 Correspondence between MLTTs and CCCwDs
-
5.1 Algebras for MLTTs
-
5.2 Theory-Category Correspondence between MLTTs and CCCwDs
-
6 Conclusion and Future Work
1 Introduction
In mathematics, category theory [ML13] studies algebra of morphisms, which originated from the work in algebraic topology by Samuel Eilenberg and Saunders Mac Lane in 1940s.
Later, it has turned out to be extremely general, giving a synthetic formulation of various concepts in mathematics, physics, logic and computer science [BS10, MM12, Pie91, LS88].
In logic and computer science, type theories [Hin97, Pie02] refer to a particular kind of formal logical systems or programming languages, in which proofs or terms are always typed in contexts.
Historically, the concept of types was first introduced to his theory of types by Bertrand Russell in 1900s to circumvent the well-known paradox in foundations of mathematics discovered by himself, and later types were also incorporated by Alonzo Church into his λ-calculus in 1940s to save it from another yet similar paradox, which led to type theories in their modern form.
An important concept in type theories is dependent types [Hof97], which are types that may contain free variables.
A type theory is dependent if it has dependent types; otherwise it is (and its types are) simple.
Under the Curry-Howard isomorphism [SU06], the generalization of simple type theories (STTs) to dependent type theories (DTTs) corresponds in logic to the path from propositional logic to predicate logic, where simple types and dependent types correspond to propositions and predicates, respectively.
For concreteness, we focus on simply-typed λ-calculi (STLCs) [Chu40] and Martin-Löf type theories (MLTTs) [ML82, ML84, ML98] in this article for they are canonical representatives of STTs and DTTs, respectively.
Categorical logic [Pit01, Jac99, LS88] is the study of connections between categories and type theories.
In categorical logic, syntax and semantics of type theories are both captured by categories with additional structures, and interpretations by functors preserving those structures.
For syntax, such a categorical reformulation abstracts tedious syntactic formalisms (such as capture-free substitution) and enables one to focus on the abstract essence of type theories; also, neat categorical structures in a sense ‘justify’ the corresponding syntactic concepts.
For semantics, on the other hand, categorical semantics provides a convenient framework to establish concrete semantics of type theories as in general it is simpler and subsumes more interpretations than the traditional set-theoretic semantics. Moreover, by theory-category correspondences [Pit01, Tay99], one may regard categories as a syntax-independent abstraction of type theories, or conversely, type theories as a symbolic presentation of (strict) categories.
Categorical semantics of STTs has been well-established, namely cartesian closed categories (CCCs) [Pit01, Jac99, LS88], but it is not quite the case for DTTs.
More specifically, abstract semantics of DTTs is typically either:
-
Categorical yet indirect (in the sense that there is no counterpart of terms); or
2. 2.
Direct yet not categorical (often called algebraic or equational).
Note that CCCs are a categorical concept, and they give a direct semantics of STTs, in which terms are interpreted by morphisms.
▶ Remark.
Categorical concepts are usually defined in terms of universal properties, and thus they are weak, i.e., identified only up to isomorphisms, while type-theoretic concepts are strict, i.e., identified on-the-nose.
Therefore, strictly speaking, one must employ strict structures to give a semantics of type theories; for instance, a fibred category has a substitution as a part of the structure [Jac99].
However, as long as a semantics employs the strict version of weak concepts, it would be fair to regard the semantics as categorical.
In fact, categorical semantics of DTTs has mathematical elegance, capturing type-theoretic phenomena in terms of categorical concepts, but usually they do not directly correspond to the syntax, having no counterpart of terms in particular.
We regard this indirectness as a problem:
It would be difficult to say that indirect semantics faithfully captures DTTs since terms are a primitive concept that plays a central role in the syntax;
Direct semantics of DTTs would be interesting as an abstraction of type dependence as it is a natural and fundamental phenomenon which arises not only in DTTs but also in a variety of mathematical instances, e.g., see the set-theoretic example below; and
It is harder to work with indirect semantics of DTTs since intuition from the syntax is not directly applicable.
For instance, in locally cartesian closed categories (LCCCs) [See84] and categories with attributes (CwAs) [Car86, Mog91, Pit01], each term Γ⊢f:A in a DTT is identified with the context morphism [Hof97, Pit01] (idΓ,f):Γ→Γ,x:A because there is no direct counterpart of terms in these frameworks.
In the syntax, however, f and (idΓ,f) are not identified, and the former is clearly more primitive than the latter.
In terms of the set-theoretic semantics, a context ⊢Γ ctx, a type Γ⊢A type and a term Γ⊢f:A in a DTT should be, intuitively speaking, interpreted respectively as a set Γ, an indexed set A=(Aγ)γ∈Γ and a function f:Γ→⋃γ∈ΓAγ such that f(γ)∈Aγ for all γ∈Γ, but those categorical frameworks, specialized to the set-theoretic semantics, interpret the term Γ⊢f:A as the function ⟨idΓ,f⟩:(γ∈Γ)↦(γ,f(γ))∈Γ×⋃γ∈ΓAγ.
This point holds also for other categorical semantics of DTTs such as comprehension categories [Jac99], display map categories [Lam89, Tay87, HP89, Tay99] and indexed categories [Cur89, Obt89].
In contrast, algebraic semantics of DTTs such as categories with families (CwFs) [Dyb96, Hof97] is closer to the syntax, having a direct counterpart of terms, but it appears mathematically ad-hoc because it just employs an equational characterization that is not the strict version of weak concepts, i.e., it is not quite categorical.
Indeed, this point is one of the main motivations for the recent work on natural models of homotopy type theory (NMs) [Awo16] by Awodey; it gives a categorical reformulation of CwFs.
However, it seems difficult to take the resulting categorical structure as a generalization of CCCs; at least, its relation with the standard interpretation of STLCs in CCCs remains unclear.
This point is unsatisfactory if one takes account of the rather simple relation between STTs and DTTs.
To summarize, we have not yet found a categorical and direct counterpart of the path from STTs to DTTs.
We are concerned with such a counterpart for mathematical as well as practical points of view.
From the mathematical standpoint, such a categorical structure is of interest in its own right because it would accurately capture the abstract essence of dependent types, which are a natural and fundamental concept not only in logic and computation but also (as we shall see) in many other mathematical instances, e.g., in sets as illustrated above.
From the practical viewpoint, a direct correspondence with the syntax would make it much more convenient as a tool to establish concrete semantics of DTTs since each semantic concept has a direct type-theoretic counterpart, which delivers useful intuition.
If a direct semantics is in addition defined categorically, then in general it has fewer structures and axioms than an algebraic semantics so that it is simpler to verify that a concrete structure forms a semantics of DTTs through the former than the latter.
Motivated by these points, we introduce cartesian closed categories with dependence (CCCwDs) in order to capture DTTs in a mathematically natural as well as true-to-syntax fashion.
Roughly, categories with dependence (CwDs) are categories equipped with direct counterparts of types and terms, called dependent (D-) objects and dependent (D-) morphisms, respectively, that satisfy certain axioms, where categories constitute a special case.
A CwD is semi-cartesian if it has a terminal object and semi-dependent pair spaces (semi-Σ-spaces), which correspond respectively to the empty context and context extensions in DTTs. Let us note that strict semi-cartesian CwDs (SCCwDs) coincide with CwFs, and thus they are nothing new; our contribution is in defining a natural cartesian closed structure on SCCwDs.
An SCCwD is cartesian if it has a unit D-object and dependent pair spaces (Σ-spaces), which are generalizations of a terminal object and binary products in the sense that they are defined in terms of universal properties that naturally generalize those of a terminal object and binary products, respectively; in fact, a unit D-object and Σ-spaces form instances of generalized limits, called dependent (D-) limits.
An SCCwD is closed if it has dependent map spaces (Π-spaces), which are, similarly to Σ-spaces, a generalization of exponentials.
As a mathematical ‘justification’ of these structures as a natural generalization of CCCs, we prove that unit D-objects, Σ- and Π-spaces satisfy certain expected properties, e.g., they are unique up to isomorphisms, Σ- and Π-spaces are respectively left and right adjoints to each other (up to projections), etc., and give several non-syntactic instances of CCCwDs.
We then show that CCCwDs give a sound and complete semantics of the (1, Π, Σ)-fragment of MLTT.
Moreover, we establish a 2-equivalence between the 2-category CtxCCCD of contextual (in a suitable sense similar to contextual categories by Cartmell) CCCwDs (CtxCCCwDs) and the 2-category MLTT of MLTTs, which can be seen as a dependent version of the theory-category correspondence between STLCs and CCCs [Pit01, Cro93].
In addition, we verify that the 2-category ConCtxCCCD of constant (in a suitable sense that abstractly captures simple types) CtxCCCwDs is 2-equivalent to the 2-category CtxCCC of contextual CCCs (CtxCCCs).
In this manner, we demonstrate that the categorical path from constant CtxCCCwDs to CtxCCCwDs corresponds to the syntactic path from STTs to DTTs, and also clarify its relation with the standard interpretation of STTs in CCCs.
These results may be summarized schematically as:
{diagram}
where the conventional 2-equivalence between CtxCCC and the 2-category STLC of STLCs is recovered by composing the two 2-equivalences on the lower side in the diagram.
Notably, CCCwDs interpret MLTTs by giving rise to CwFs that support strict 1-, Π- and Σ-types.
This construction is rather canonical, and the term models of MLTTs form such CwFs via CtxCCCwDs; in this sense, CCCwDs are a refinement of CwFs.
Also, constant CtxCCCwDs refine CtxCCCs for the former more faithfully captures STLCs than the latter.
Finally, as a ‘by-product’, fundamental concepts in category theory such as categories, isomorphisms, functors, natural transformations, limits and adjoints are naturally generalized.
Thus, the present work also sets out a general theory of ‘categories of dependence’ though we mostly focus on what is relevant to the main results to keep the paper of a reasonable length, leaving a more thorough treatment as future work.
Related Work.
NMs by Awodey [Awo16] are another categorical and direct semantics of MLTTs, and thus most relevant to the present work.
The mathematical structures of CCCwDs are, however, a priori very different from those of NMs, in particular the relation between NMs and CCCs is not immediately clear, though we leave a detailed comparison of the two as future work.
Also, to the best of our knowledge, the theory-category correspondences between CtxCCCwDs and MLTTs as well as between constant CtxCCCwDs and CtxCCCs are new.
Plan of the Paper.
The rest of the paper proceeds as follows.
We first review the syntax of MLTTs in Section 2.1 and the interpretation of MLTTs in CwFs in Section 2.2, where we also present the syntax of STLCs and the interpretation of them in CCCs.
Then, we introduce CwDs and morphisms between them in Section 3.1, and SCCwDs and morphisms between them in Section 3.2.
We then consider generalized terminal objects and binary products in SCCwDs and show that they interpret 1- and Σ-types in Section 3.3, and we present generalized exponentials and prove that they interpret Π-types in Section 3.4.
Along with these developments, we give a basic theory of CwDs, generalizing some basic part of category theory.
The next two sections are devoted to certain 2-equivalences: Section 4 establishes a 2-equivalence between ConCtxCCCD and CtxCCC, and Section 5 gives a theory-category correspondence between MLTTs and CtxCCCwDs.
Finally, Section 6 draws a conclusion and proposes future work.
2 Preliminaries
As a preparation, we review the syntax of MLTTs (in Section 2.1) and the interpretation of them in CwFs (in Section 2.2).
If the reader is already familiar with these concepts, then she or he is encouraged to skip the present section and come back later in the ‘call-by-need’ fashion.
There are, however, mainly four reasons to present these concepts explicitly:
-
To define the term models (or the classifying CwFs) of MLTTs;
2. 2.
To show that strict CCCwDs are a refinement of CwFs that support 1-, Σ- and Π-types;
3. 3.
To prove a theory-category correspondence between MLTTs and contextual CCCwDs; and
4. 4.
To explain a gap between the CCC- and CwF-semantics of STLCs.
2.1 The Syntax of Martin-Löf Type Theories
We first review the syntax of MLTTs, following the presentations of [Hof97, Pit01], and also present the syntax of STLCs as sub-theories of MLTTs.
Note that we mainly focus on the syntax; see, e.g., [NPS90, ML84] for a general introduction to MLTTs.
A Martin-Löf type theory (MLTT) [ML75, ML84, ML98] is a formal logical system similar to natural deduction [Gen35, TS00] except that vertices of a derivation tree are judgements, for which we usually write J possibly with subscripts. There are the following six kinds of judgements (followed by their intended meanings):
⊢Γ ctx (Γ is a context);
Γ⊢A type (A is a type in the context Γ);
Γ⊢a:A (a is a term (or program) of type A in the context Γ);
⊢Γ=Δ ctx (Γ and Δ are (judgmentally) equal contexts);
Γ⊢A=B type (A and B are (judgmentally) equal types in the context Γ); and
Γ⊢a=a′:A (a and a′ are (judgmentally) equal terms of type A in the context Γ).
That is, an MLTT consists of axioms J and (inference) rules J0 J1 J2…Jk , which are to make a conclusion from hypotheses by constructing a derivation tree exactly as natural deduction does.
As often expressed as ‘an MLTT internalizes the Curry-Howard isomorphism [SU06]’, its contexts, types and terms represent respectively assumptions (or premises), formulas and proofs in logic as well.
Therefore, e.g., the judgement Γ⊢a:A can be read as ‘the formula A has a proof a under the assumption Γ’, and so on.
▶ Convention.
We assume a countably infinite set V of variables, written x, y, z, etc. possibly with subscripts.
We write FV(E) for the set of all free variables occurring in an expression E.
▶ Notation.
Greek capital letters Γ, Δ, Θ, etc. range over contexts, capital letters A, B, C, etc. over types, and lower-case letters a, b, c, etc. over terms. Strictly speaking, they are equivalence classes of symbols with respect to α-equivalence ≡ [Han94] as usual.
Each type construction in an MLTT is defined by its formation, introduction, elimination and computation rules.
The formation rule stipulates how to form the type, and the introduction rule defines canonical terms of the type, which in turn defines terms of the type (including non-canonical ones).
Then, the elimination and computation rules describe respectively how to consume terms of the type and the result of such a consumption (in the form of an equation), both of which are easily justified by the introduction rule.
Below, following the presentation of [Hof97], we first recall the MLTT with 1-, Π- and Σ-types in the strict sense, i.e., with uniqueness rules, for which we write MLTT(1,Π,Σ), in Sections 2.1.1-2.1.5.
It is the minimal MLTT for us, and it corresponds to the dependently-typed version of the STLC equipped with 1- and ×-types.
We then introduce a general class of MLTTs based on the framework of dependently-typed algebraic theories [Pit01] (or generalized algebraic theories [Car86]) in Sections 2.1.6 and 2.1.7.
Strictly speaking, this class is more general than what one usually considers as the class of MLTTs because additional types are not necessarily defined by the four kinds of rules mentioned above.
We need this generality for the theory-category correspondence between the 2-categories of MLTTs and of contextual CCCwDs in Section 5.
2.1.1 Contexts
A context is a finite sequence x1:A1,x2:A2,…,xn:An of pairs of a variable xi and a type Ai such that the variables x1,x2,…,xn are pair-wise distinct.
We write ♢ for the empty context, i.e., the empty sequence ϵ; we usually omit ♢ when it occurs on the left-hand side of the turnstile ⊢.
We have the following axiom and rules for contexts:
[TABLE]
The rules Ctx-Emp and Ctx-Ext determine that contexts are exactly finite sequences of pairs of a variable and a type.
The rule Ctx-ExtEq is a congruence rule, i.e., it states that judgmental equality is preserved under the rule Ctx-Ext, i.e., the ‘context extension’.
▶ Convention.
We will henceforth skip writing down congruence rules for other constructions.
2.1.2 Structural Rules
Next, we collect the inference rules for all types as structural rules:
[TABLE]
The rule Var states the reasonable idea that we may give an element xj:Aj if it occurs in the context just by ‘copy-catting’ it.
The next nine rules stipulate that every judgmental equality is an equivalence relation.
The rules Ty-Conv and Tm-Conv formalize the idea that judgements should be preserved under the exchange of judgmentally equal contexts and/or types.
The following weakening and substitution rules are admissible (or derivable) in MLTTs, but it is convenient to present them explicitly:
[TABLE]
where J[a/x] (resp. Δ[a/x]) denotes the capture-free substitution [Han94] of a for x in J111Here, J denotes the righthand side of an arbitrary judgement. (resp. Δ).
2.1.3 Unit Type
We proceed to introduce specific type constructions.
Let us begin with the simplest type, called the unit type (or the 1-type) 1 in the strict sense, which is the type that has just one canonical term ⋆.
Thus, from the logical point of view, it represents the simplest true formula.
Its rules are the following:
[TABLE]
The formation rule 1-Form states that 1 is an atomic type in the sense that we may form it without assuming any other types.
The introduction rule 1-Intro defines that it has just one canonical term, viz., ⋆.
Thus, the uniqueness rule 1-Uniq should make sense, from which the remaining rules 1-Elim and 1-Comp immediately follow if we define R1(P,p,t)≡df.p.
▶ Convention.
Thus, we henceforth omit the last two rules.
2.1.4 Dependent Function Types
Let us introduce a central non-atomic type construction, called dependent function types (or Π-types) in the strict sense.
The Π-type Πx:AB is intended to represent the space of dependent functions from A to B, and thus it is a generalization of the function type A⇒B in STLCs.
The rules of Π-types are the following:
[TABLE]
▶ Notation.
We often omit the superscript A on λxA.b and write A⇒B for Πx:AB if x∈FV(B).
The formation rule Π-Form states that we may form the Π-type Πx:AB from types A and B, where B may depend on A.
The introduction rule Π-Intro defines how to construct the canonical terms of Πx:AB, viz., λ-abstractions; it is the usual way of defining a function f from A to B, i.e., to specify its output f(a):B[a/x] on each input a:A.
Then, the elimination and computation rules Π-Elim and Π-Comp should make sense by the introduction rule.
Finally, the uniqueness rule Π-Uniq stipulates that terms of Π-types are only canonical ones.
2.1.5 Dependent Pair Types
Another important non-atomic type construction is dependent sum types (or Σ-types) in the strict sense.
The Σ-type Σx:AB represents the spaces of dependent pairs of a:A and b:B[a/x], and thus it is a generalization of the product type A×B in STLCs.
The rules of Σ-types are the following:
[TABLE]
where
[TABLE]
are projections constructed by Σ-Elim.
▶ Notation.
We usually abbreviate [z:Σx:AB]C, [x:A,y:B]g and πiA,B(p) respectively as C, g and πi(p) if it does not bring any confusion.
We often write A×B for Σx:AB if x∈FV(B).
The formation rule Σ-Form is the same as the case of Π-types.
The introduction rule Σ-Intro specifies that canonical terms of a Σ-type Σx:AB are pairs ⟨a,b⟩:Σx:AB of terms a:A and b:B[a/x]; they are in particular dependent pairs for the type B[a/x] of the second component b depends on the first component a:A.
Again, the elimination and computation rules Σ-Elim and Σ-Comp should make sense by the introduction rule.
Finally, the uniqueness rule Σ-Uniq stipulates that terms of Σ-types are only canonical ones, i.e., dependent pairs.
2.1.6 Context Morphisms and Generalized Substitution
We have presented the theory MLTT(1,Π,Σ).
Next, let us review a derived concept in the syntax: A context morphism [Hof97, Pit01] from a context ⊢Δ ctx to another ⊢Γ ctx such that FV(Δ)∩FV(Γ)=∅, where we assume without loss of generality Γ≡x1:A1,x2:A2,…,xn:An ctx, is a finite sequence g≡(g1,g2,…,gn):Δ→Γ of terms
[TABLE]
In addition, we say that parallel context morphisms g,g′:Δ→Γ are (judgmentally) equal and write g=g′:Δ→Γ if so are their corresponding component terms, i.e.,
[TABLE]
Given any syntactic expression E, we define the generalized substitution E[g/x] of g for x in E (we often abbreviate it as E[g]), where x≡(x1,x2,…,xn) and FV(E)∩FV(x)=∅, to be the expression
[TABLE]
i.e., what is obtained from E by simultaneously substituting gi for xi in E for i=1,2,…,n.
Then, it is shown in [Hof97] that if Γ,Θ⊢E is a judgement that is derivable in MLTT(1,Π,Σ), then so is the generalized substitution Δ,Θ[g]⊢E[g]. Clearly, it subsumes the rules Weak and Subst.
Given another context morphism f:Θ→Δ, we define the composition g∘f:Θ→Γ by:
[TABLE]
Also, we have the identity context morphism on ⊢Γ ctx:
[TABLE]
It has been shown in [Hof97] that contexts and context morphisms derivable in MLTT(1,Π,Σ) modulo judgmental equality = form a category.
This suggests reformulating the derived notion of substitution as primitive, leading to the notion of CwFs in Section 2.2.
Note in particular that singleton lists of terms are context morphisms, but terms themselves are not.
As we shall see in later sections, this point is captured by the CwF-semantics yet ignored by the CCC-semantics of STLCs.
2.1.7 Martin-Löf Type Theories as Algebraic Theories
Now, we are ready to present a general class of MLTTs, in which MLTT(1,Π,Σ) is the minimal theory.
Our formulation is based on the framework of dependently-typed algebraic theories [Pit01] (or generalized algebraic theories [Car86]).
▶** Definition 2.1.1**** (GMLTTs).**
A generalized MLTT (GMLTT) is a quadruple T=(LT,ST,CT,AT), where:
LT is a finite set of symbols, called the alphabet of T, such that LT∩V=∅ and it contains every non-variable symbol that occurs in a type or a term in MLTT(1,Π,Σ);
ST is a subset of the set (LT∪V)∗, whose elements are called sorts of T;
CT is a subset of the set LT∗, whose elements C are called constants of T and equipped with finite sequences FT(C) of
the form (A1,A2,…,Ak)∈ST∗ or ((A1,A2,…,Ak),B)∈ST∗×ST, called the format of C; and
AT is a set of judgements of the form A=A′:Ty or a=a′:A, called axioms of T, where A,A′∈ST and a,a′∈(LT∪V)∗.
▶ Convention.
Let T be a GMLTT.
A constant C∈CT with a format of the form (A1, A2, …, Ak) is particularly called a type-constant and written C∈CT(A1, A2, …, Ak).
Similarly, a constant F∈CT with a format of the form ((A1, A2, …, Ak),B) is particularly called a term-constant and written F∈CT(A1, A2, …, Ak;B); we also write FTdom(F) for the sequence (A1, A2, …, Ak) and FTcod(F) for the sort B.
We write CTTy and CTTm for the set of all type-constants and the set of all term-constants in T, respectively.
▶** Definition 2.1.2**** (Theorems of GMLTTs).**
Let T be a GMLTT.
Contexts, types and terms in T are judgements of the forms ⊢Γ ctx, Γ⊢A type and Γ⊢a:A, respectively, obtained by the axioms and rules in Sections 2.1.1-2.1.5 plus the following two rules:
[TABLE]
We define T(Δ,Γ) to be the set of all context morphisms Δ→Γ that consist of terms in T, called context morphisms in T.
Equalities in T are the judgements of the form ⊢Γ=Γ′ ctx, Γ⊢A=A′ type or Γ⊢a=a′:A obtained by the axioms and rules in Sections 2.1.1-2.1.5 plus the following two rules:
[TABLE]
Inhabited types and equalities in T are called theorems in T.
▶ Notation.
We write Γ⊢TJ to mean that the judgement Γ⊢J is derivable in a GMLTT T.
▶** Definition 2.1.3**** (Well-formed GMLTTs).**
A GMLTT T is well-formed if there is at least one rule to apply for each constant (resp. axiom) of T.
Well-formedness of a GMLTT T virtually means that:
For each type-constant C∈CT(A1,A2,…,Ak), there is a context morphism f:Γ→x1:A1,x2:A2,…,xk:Ak in T;
For each term-constant F∈CT(A1,A2,…,Ak;B), there are a context morphism f:Γ→x1:A1,x2:A2,…,xk:Ak in T and a type x1:A1,x2:A2,…,xk:Ak⊢B type in T;
For each axiom of the form A=A′:Ty∈AT, there are a context morphism f:Γ→Δ in T and types Δ⊢A type and Δ⊢A′ type in T; and
For each axiom of the form a=a′:A∈AT, there are a context morphism f:Γ→Δ in T and terms Δ⊢a:A and Δ⊢a′:A in T.
▶ Example 2.1.4.
Clearly, the minimal GMLTT Φ coincides with MLTT(1,Π,Σ).
▶ Example 2.1.5.
MLTT(1,Π,Σ) equipped with the natural number type N, or MLTT(1,Π,Σ,N), can be presented as a well-formed GMLTT N such that:
LN=df.LΦ∪{N,zero,succ,RN };
S_{\mathcal{N}}\stackrel{{\scriptstyle\mathrm{df.}}}{{=}}\{\mathsf{A}\mid\mathsf{\Gamma\vdash_{\mathcal{N}}A\ type}\ \text{for some \mathsf{\vdash_{\mathcal{N}}\Gamma\ ctx}}\ \!\};
CN contains the type-constant N∈CN(ϵ) and the term-constants zero∈CN(ϵ;N), succ∈CN(N;N) and RPN∈CN(A1,A2,…,Ak,P[zero/y],P⇒P[succ(y)/y];P) for each type of the form x1:A1,x2:A2,…,xk:Ak,y:N⊢NP type, where RPN is an abbreviation of RN(P); and
AN contains the equations
[TABLE]
for each triple of a type of the form Γ,y:N⊢NP type and two terms of the forms Γ⊢Ncz:P[zero/y] and Γ,y:N⊢Ncs:P⇒P[succ(y)/y], where Γ≡x1:A1,x2:A2,…,xk:Ak and x≡x1,x2,…,xk.
We may recover the conventional rules of N-type as follows.
Given a type Γ,y:N⊢NP type and terms Γ⊢Ncz:P[zero/y] and Γ,y:N⊢Ncs:P⇒P[succ(y)/y], where Γ≡x1:A1,x2:A2,…,xk:Ak, we obtain Γ⊢NN type by Type-Const, and Γ⊢Nzero:N and Γ,y:N⊢Nsucc(y):N by Term-Const.
Moreover, we get Γ,y:N⊢Ncz:P[zero/y] by Weak, whence Γ,y:N⊢NRPN(x,cz,cs):P by Term-Const, where x≡x1,x2,…,xk.
Finally, we obtain the equations
[TABLE]
by Term-Eq.
▶ Example 2.1.6.
MLTT(1,Π,Σ) equipped with identity types Id, or MLTT(1,Π,Σ,Id), can be presented as a well-formed GMLTT I such that:
LI=df.LΦ∪{Id,refl,RId };
S_{\mathcal{I}}\stackrel{{\scriptstyle\mathrm{df.}}}{{=}}\{\mathsf{A}\mid\mathsf{\Gamma\vdash_{\mathcal{I}}A\ type}\ \text{for some \mathsf{\vdash_{\mathcal{I}}\Gamma\ ctx}}\ \!\};
CI contains the type-constant IdB∈CI(B,B) and the term-constants reflB∈CI(A1,A2,…,Ak,B;IdB(y,y)) and RPId∈CI(A1,A2,…,Ak,P[w/y,w/z,reflB(w)/v],B,B,IdB(y,z);P) for each pair of types of the forms Γ⊢IB type and Γ,y:B,z:B,v:IdB(y,z)⊢IP type, where Γ≡x1:A1,x2:A2,…,xk:Ak, and IdB, reflB and RPId are abbreviations of Id(B), refl(B) and RId(P), respectively;
AI contains the equation
[TABLE]
for each quadruple of types Γ⊢IB type and Γ,y:B,z:B,v:IdB(y,z)⊢IP type, and terms Γ,w:B⊢Ip:P[w/y,w/z,reflB(x,w)/v] and Γ⊢Ib:B, where Γ≡x1:A1,x2:A2,…,xk:Ak and x≡x1,x2,…,xk.
We may recover the conventional rules of Id-types as follows.
Given a type Γ⊢IB type and terms Γ⊢Ib:B and Γ⊢Ib′:B, where Γ≡x1:A1,x2:A2,…,xk:Ak, we obtain the type Γ⊢IIdB(b,b′) type by Type-Const; also, we have Γ,y:B⊢IIdB(y,y) type, whence we get the term Γ⊢IreflB(x,b):IdB(b,b) by Term-Const, where x≡x1,x2,…,xk.
Moreover, given a type Γ,y:B,z:B,v:IdB(y,z)⊢IP type and terms Γ,w:B⊢Ip:P[w/y,w/z,reflB(x,w)/v] and Γ⊢Iq:IdB(b,b′), we get the term Γ,w:B⊢IRPId(x,p,b,b′,q):P[b/y,b′/z,q/v] by Term-Const and the equality
[TABLE]
by Term-Eq.
▶ Convention.
Henceforth, we shall focus on well-formed GMLTTs and call them MLTTs.
2.1.8 Pre-Syntax
Contexts, types and terms in MLTTs have been given together with the judgement of typing.
Alternatively, we may first give a larger class of (possibly non-valid) expressions by a simpler induction (on lengths of expressions), which should be called pre-contexts, pre-types and pre-terms, and then carve out the valid syntax as its subclass by the typing rules.
For certain purposes, pre-syntax is useful.
For instance, the interpretation of MLTTs in CwFs is easier to give on pre-syntax than on syntax [Hof97, Pit01].
Following this method, we need pre-syntax in Section 5, and therefore we recall it here:
▶** Definition 2.1.7**** (Pre-syntax of MLTTs [Hof97]).**
The expressions called pre-contexts Γ, pre-types A, pre-terms a and pre-context morphisms f in an MLTT T are given by the grammar:
[TABLE]
where x∈V, C∈CTTy and F∈CTTm.
2.1.9 Simply-Typed Lambda-Calculi as Sub-Theories
Since we shall compare our semantics of simply-typed λ-calculi (STLCs) with the standard CCC-semantics, we present them as sub-theories of MLTTs for a simple comparison of the two.
Let us first present the minimal STLC, which is equipped with finite product types 1 and ×; it corresponds to the non-dependently-typed version of MLTT(1,Π,Σ), where ⇒- and ×-types in the former correspond respectively to Π- and Σ-types in the latter.
We call it the equational theory λ1,×=.
Roughly, the theory λ1,×= is obtained from MLTT(1,Π,Σ) by restricting types to closed (i.e., with no free variables) ones and eliminating the rules for (judgmental) equalities between contexts and between types as there are only the trivial equalities (i.e., α-equivalence).
Thus, it is a formal system to deduce the following judgements:
⊢Γ ctx (Γ is a context);
⊢A type (A is a (closed) type);
Γ⊢a:A (a is a term of type A in the context Γ); and
Γ⊢a=a′:A (a and a′ are equal terms of type A in the context Γ).
Speifically, λ1,×= consists of the following axioms and rules:
[TABLE]
where we again omit describing congruence rules.
Following a standard convention, we write A⇒B and A×B for Πx:AB and Σx:AB, respectively, since there are no dependent types in λ1,×=.
Note that ×-Elim and ×-Comp are admissible in MLTT(1,Π,Σ) by Σ-Elim and Σ-Comp as described in [Hof97], and vice versa in λ1,×=; the other rules are just inherited from MLTT(1,Π,Σ).
It is easy to see that the theory λ1,×= coincides with the standard equational (with respect to βη-equivalence) theory of the STLC equipped with finite product types [Cro93, Jac99, LS88].
Accordingly, the general class of STLCs is as follows:
▶** Definition 2.1.8**** (STLCs).**
An STLC is a quadruple T=(LT,ST,CT,AT), where:
LT is a finite set of symbols, called the alphabet of T, such that LT∩V=∅ and it contains every non-variable symbol that occurs in a type or a term in λ1,×=;
ST is a subset of the set LT∗, whose elements are called sorts of T;
CT is a subset of the set LT∗, whose elements C are called constants of T and equipped with finite sequences FT(C) of
the form ϵ∈ST∗ or ((A1,A2,…,Ak),B)∈ST∗×ST, called the format of C; and
AT is a set of judgements of the form a=a′:A, called axioms of T, where A∈ST and a,a′∈(LT∪V)∗
where the same convention is applied as in the case of MLTTs.
▶** Definition 2.1.9**** (Theorems of STLCs).**
Let T be an STLC.
Contexts, types and terms in T are judgements of the forms ⊢Γ ctx, ⊢A type and ⊢a:A, respectively, obtained by the axioms and rules given above in this section plus the following two rules:
[TABLE]
Equalities in T are the judgements of the form Γ⊢a=a′:A obtained by the axioms and rules given above in this section plus the following rule:
[TABLE]
Inhabited types and equalities in T are also called theorems in T.
▶** Definition 2.1.10**** (Well-formed STLCs).**
An STLC T is well-formed if there is at least one rule to apply for each constant (resp. axiom) of T.
▶ Convention.
We shall focus on well-formed STLCs and simply call them STLCs.
It is clear that STLCs are just the non-dependently-typed version of MLTTs, and our notion of STLCs coincides with the standard notion of (equational) STTs [LS88, Cro93, Pit01].
2.2 Categories with Families
Next, we review categories with families (CwFs) and their semantic type formers as well as the interpretation of MLTT(1,Π,Σ) in CwFs that support 1-, Π- and Σ-types in the strict sense.
2.2.1 Categories with Families
▶** Definition 2.2.1**** (CwFs [Dyb96, Hof97]).**
A category with families (CwF) is a tuple
[TABLE]
where:
C is a category equipped with a specified terminal object T∈C;
Ty assigns, to each object Γ∈C, a set Ty(Γ), called the set of all types in the context Γ;
Tm assigns, to each pair of an object Γ∈C and a type A∈Ty(Γ), a set Tm(Γ,A), called the set of all terms of type A in the context Γ;
For each morphism ϕ:Δ→Γ in C, _{_} induces a function _{ϕ}:Ty(Γ)→Ty(Δ), called the substitution on types, and a family (_{ϕ}A:Tm(Γ,A)→Tm(Δ,A{ϕ}))A∈Ty(Γ) of functions, called the substitutions on terms;
_._ assigns, to each pair of a context Γ∈C and a type A∈Ty(Γ), a context Γ.A∈C, called the comprehension of A;
p associates each pair of a context Γ∈C and a type A∈Ty(Γ) with a morphism p(A):Γ.A→Γ
in C, called the first projection associated to A;
v associates each pair of a context Γ∈C and a type A∈Ty(Γ) with a term vA∈Tm(Γ.A,A{p(A)})
called the second projection associated to A; and
⟨_,_⟩_ assigns, to each triple of a morphism ϕ:Δ→Γ in C, a type A∈Ty(Γ) and a term g∈Tm(Δ,A{ϕ}), a morphism ⟨ϕ,g⟩A:Δ→Γ.A
in C, called the extension of ϕ by g
that satisfies, for all Γ,Δ,Θ∈C, A∈Ty(Γ), ϕ:Δ→Γ, φ:Θ→Δ, f∈Tm(Γ,A) and g∈Tm(Δ,A{ϕ}), the following equations:
(Ty-Id) A{idΓ}=A;
(Ty-Comp) A{ϕ∘φ}=A{ϕ}{φ};
(Tm-Id) f{idΓ}A=f;
(Tm-Comp) f{ϕ∘φ}A=f{ϕ}A{φ}A{ϕ};
(Cons-L) p(A)∘⟨ϕ,g⟩A=ϕ;
(Cons-R) vA{⟨ϕ,g⟩A}A{p(A)}=g;
(Cons-Nat) ⟨ϕ,g⟩A∘φ=⟨ϕ∘φ,g{φ}A{ϕ}⟩A;
(Cons-Id) ⟨p(A),vA⟩A=idΓ.A.
▶ Notation.
We often omit the subscript A in _{_}A and ⟨_,_⟩A if it does not cause any ambiguity.
CwFs are very close to the syntax, which is best described by the following term model:
▶** Definition 2.2.2**** (The term model T(1,Π,Σ) [Hof97]).**
The CwF of contexts and context morphisms of MLTT(1,Π,Σ) modulo =, called the term model T(1,Π,Σ), is defined as follows:
The category T(1,Π,Σ) consists of contexts and context morphisms of MLTT(1,Π,Σ) as defined in Section 2.1 modulo (judgmental) equality =.
Let us write [Γ] (resp. [A], [a]) for the equivalence class of a context ⊢Γ ctx (resp. a type Γ⊢A type, a term Γ⊢a:A).
Given [Γ]∈T(1,Π,Σ), we define Ty([Γ])=df.{[A] ∣ Γ⊢A type } and Tm([Γ],[A])=df.{[a] ∣ Γ⊢a:A }. Below, we represent these equivalence classes by their arbitrary representatives.
The functions _{_} are generalized substitutions _[_] on types and terms in Section 2.1.
The terminal object is (the equivalence class of) the empty context ⊢♢ ctx.
Given ⊢Γ ctx∈T(1,Π,Σ) and Γ⊢A type∈Ty(Γ), we define Γ.A=df.⊢Γ,x:A ctx, where x∈V∖FV(Γ).
Assume ⊢Γ=x1:A1,x2:A2,…,xn:An ctx. Then, we define p(A)=df.⟨x1,x2,…,xn⟩:Γ.A→Γ and vA=df.Γ,x:A⊢x:A∈Tm(Γ.A,A[p(A)]).
Given ϕ:Δ→Γ and Δ⊢g:A[ϕ]∈Tm(Γ,A[ϕ]), we define ⟨ϕ,g⟩A=df.(ϕ,g):Γ→Δ.A.
There are various non-syntactic instances of CwFs, e.g., sets [Hof97], groupoids [HS98] and games [AJV15, Yam17].
We skip describing these CwFs and leave the details to the references.
Nevertheless, CwFs model only the fragment of MLTTs that is common to all types; we need to equip them with semantic 1-, Π- and Σ-type formers [Hof97] in order to model MLTT(1,Π,Σ).
▶** Definition 2.2.3**** (CwFs with 1-type [Hof97]).**
A CwF C supports 1-type if:
(Unit-Form) For any Γ∈C, there is a type 1Γ∈Ty(Γ);
(Unit-Intro) For any Γ∈C, there is a term ⋆Γ∈Tm(Γ,1Γ);
(Unit-Subst) For any morphism ϕ:Δ→Γ in C, we have 1Γ{ϕ}=1Δ; and
(⋆-Subst) For any morphism ϕ:Δ→Γ in C, we have ⋆Γ{ϕ}=⋆Δ.
It supports 1-type in the strict sense if it additionally satisfies:
(Unit-Uniq) f=⋆Γ for any f∈Tm(Γ,1Γ).
▶** Definition 2.2.4**** (CwFs with Π-types [Hof97]).**
A CwF C supports Π-types if:
(Π-Form) For any Γ∈C, A∈Ty(Γ) and B∈Ty(Γ.A), there is a type Π(A,B)∈Ty(Γ);
(Π-Intro) For any f∈Tm(Γ.A,B), there is a term λA,B(f)∈Tm(Γ,Π(A,B));
(Π-Elim) For any h∈Tm(Γ,Π(A,B)) and a∈Tm(Γ,A), there is a term AppA,B(h,a)∈Tm(Γ,B{a}), where a=df.⟨idΓ,a⟩A:Γ→Γ.A;
(Π-Comp) We have AppA,B(λA,B(f),a)=f{a};
(Π-Subst) For any Δ∈C and ϕ:Δ→Γ in C, we have Π(A,B){ϕ}=Π(A{ϕ},B{ϕ+}, where ϕ+=df.⟨ϕ∘p(A{ϕ}),vA{ϕ}⟩A:Δ.A{ϕ}→Γ.A;
(λ-Subst) For any g∈Tm(Γ.A,B), we have λA,B(g){ϕ}=λA{ϕ},B{ϕ+}(g{ϕ+}); and
(App-Subst) We have AppA,B(h,a){ϕ}=AppA{ϕ},B{ϕ+}(h{ϕ},a{ϕ}).
It supports Π-types in the strict sense if it additionally satisfies:
(λ-Uniq) λA,B(AppA{p(A)},B{p(A)+}(k,vA)){p(A)}=k for any k∈Tm(Γ.A,Π(A,B){p(A)}).
▶** Definition 2.2.5**** (CwFs with Σ-types [Hof97]).**
A CwF C supports Σ-types if:
(Σ-Form) For any Γ∈C, A∈Ty(Γ) and B∈Ty(Γ.A), there is a type Σ(A,B)∈Ty(Γ);
(Σ-Intro) There is a morphism PairA,B:Γ.A.B→Γ.Σ(A,B) in C;
(Σ-Elim) Given P∈Ty(Γ.Σ(A,B)) and f∈Tm(Γ.A.B,P{PairA,B}), there is a term RA,B,PΣ(f)∈Tm(Γ.Σ(A,B),P);
(Σ-Comp) RA,B,PΣ(f){PairA,B}=f;
(Σ-Subst) For any Δ∈C and ϕ:Δ→Γ in C, Σ(A,B){ϕ}=Σ(A{ϕ},B{ϕ+});
(Pair-Subst) p(Σ(A,B))∘PairA,B=p(A)∘p(B), ϕ⋆∘PairA{ϕ},B{ϕ+}=PairA,B∘ϕ++, where ϕ⋆=df.⟨ϕ∘p(Σ(A,B){ϕ}),vΣ(A,B){ϕ}⟩Σ(A,B):Δ.Σ(A,B){ϕ}→Γ.Σ(A,B), ϕ++=df.⟨ϕ+∘p(B{ϕ+}),vB{ϕ+}⟩B:Δ.A{ϕ}.B{ϕ+}→Γ.A.B; and
(RΣ-Subst) RA,B,PΣ(f){ϕ⋆}=RA{ϕ},B{ϕ+},P{ϕ⋆}Σ(f{ϕ++}).
It supports Σ-types in the strict sense if it satisfies:
(RΣ-Uniq) g=RA,B,PΣ(f) for any g∈Tm(Γ.Σ(A,B),P) such that g{PairA,B}=f.
In light of Definition 2.2.2, it is straightforward to see what these semantic type formers in the term model T(1,Π,Σ) are; thus, we leave their details to [Hof97].
▶** Proposition 2.2.6**** (Well-defined T(1,Π,Σ) [Hof97]).**
The term model T(1,Π,Σ) is a well-defined CwF that supports 1-, Π- and Σ-types in the strict sense.
Now, one may see clearly why CwFs equipped with those semantic type formers are not categorical: They are not a strict version of some weak concepts defined by universal properties.
The work [Awo16] by Awodey is an attempt to address this point.
2.2.2 Interpretation of MLTTs in CwFs
Now, let us recall the interpretation of MLTT(1,Π,Σ) in CwFs that support 1-, Π-, Σ-types in the strict sense [Hof97].
Since a deduction tree of a judgement in MLTT(1,Π,Σ) is not necessarily unique in the presence of the rules Ty-Con and Tm-Con, a priori we cannot define an interpretation by induction on deduction trees.
For this point, a standard approach is to define an interpretation [[_]] on pre-syntax by induction on the lengths of expressions, which is partial, and show that it is total and well-defined on every valid or well-typed syntax (i.e., judgement) and preserves judgmental equality as the corresponding semantic equality [Str12, Hof97, Pit01].
By this soundness result, a posteriori we may describe the interpretation [[_]] of the syntax by induction on derivation trees of judgements:
▶** Definition 2.2.7**** (Interpretation of MLTT(1,Π,Σ) in CwFs [Hof97]).**
The interpretation [[_]] of MLTT(1,Π,Σ) in a CwF C=(C,Ty,Tm,_{_},T,_._,p,v,⟨_,_⟩_) that supports semantic type formers 1=(1,⋆), Π=(Π,λ,App), Σ=(Σ,Pair,RΣ) in the strict sense is defined as follows:
(Ct-Emp) [[⊢♢ ctx]]=df.T;
(Ct-Ext) [[⊢Γ,x:A ctx]]=df.[[⊢Γ ctx]].[[Γ⊢A type]];
(1-Form) [[Γ⊢1 type]]=df.1[[Γ]];
(Π-Form) [[Γ⊢Πx:AB type]]=df.Π([[Γ⊢A type]],[[Γ,x:A⊢B type]]);
(Σ-Form) [[Γ⊢Σx:AB type]]=df.Σ([[Γ⊢A type]],[[Γ,x:A⊢B type]]);
(Var) [[Γ,x:A⊢x:A]]=df.v[[A]], [[Γ,x:A,Δ,y:B⊢x:A]]=df.[[Γ,x:A,Δ⊢x:A]]{p([[Γ,x:A,Δ⊢B type]])};
(Ty-Con) [[Δ⊢A type]]=df.[[Γ⊢A type]];
(Tm-Con) [[Δ⊢a:B]]=df.[[Γ⊢a:A]];
(1-Intro) [[Γ⊢⋆:1]]=df.⋆[[Γ]];
(Π-Intro) [[Γ⊢λx. b:Πx:AB]]=df.λ[[A]],[[B]]([[Γ,x:A⊢b:B]]);
(Σ-Intro) [[Γ⊢(a,b):Σx:AB]]=df.Pair[[A]],[[B]]∘⟨[[Γ⊢a:A]],[[Γ⊢b:B[a/x]]]⟩;
(Π-Elim) [[Γ⊢f(a):B[a/x]]]=df.App[[A]],[[B]]([[Γ⊢f:Πx:AB]],[[Γ⊢a:A]]⟩); and
(Σ-Elim) [[Γ⊢RΣ(C,g,p):C[p/z]]]=df.R[[A]],[[B]],[[C]]Σ([[Γ,x:A,y:B⊢g:C[(x,y)/z]]])∘[[Γ⊢p:Σx:AB]]
where the hypotheses of the rules are as presented in Section 2.1, [[Γ⊢a:A]]=df.⟨id[[Γ]],[[a]]⟩:[[Γ]]→[[Γ]].[[A]] and [[Γ⊢p:Σx:AB]]=df.⟨id[[Γ]],[[p]]⟩:[[Γ]]→[[Γ]].[[Σx:AB]].
▶** Theorem 2.2.8**** (Soundness of CwFs [Hof97]).**
If ⊢Γ=Γ′ ctx (resp. Γ⊢A=A′ type, Γ⊢a=a′:A) in MLTT(1,Π,Σ), then [[Γ]]=[[Γ′]] (resp. [[A]]=[[A′]], [[a]]=[[a′]]) for the interpretation [[_]] of MLTT(1,Π,Σ) in any CwF that supports 1-, Π- and Σ-types in the strict sense.
By Proposition 2.2.6, this interpretation is also complete:
▶** Theorem 2.2.9**** (Completeness of CwFs [Hof97]).**
Given ⊢Γ ctx and ⊢Δ ctx (resp. Γ⊢A type and Γ⊢B type, Γ⊢a:A and Γ⊢a′:A) in MLTT(1,Π,Σ), if [[Γ]]=[[Δ]] (resp. [[A]]=[[B]], [[a]]=[[a′]]) for the interpretation [[_]] in any CwF that supports 1-, Σ- and Π-types in the strict sense, then there is a judgement ⊢Γ=Δ ctx (resp. Γ⊢A=B type, Γ⊢a=a′:A) in MLTT(1,Π,Σ).
For λ1,×= is a sub-theory of MLTT(1,Π,Σ), any CwF that supports 1-, Π- and Σ-types in the strict sense clearly interprets λ1,×=, and it is not hard to see that the interpretation is sound and complete as well.
2.2.3 Interpretation of STLCs in CCCs
The standard categorical semantics of λ1,×= is in CCCs, where contexts and types are both interpreted by objects, and terms by morphisms:
▶** Definition 2.2.10**** (Interpretation of λ1,×= in CCCs [LS88, Pit01, Jac99, Cro93]).**
The interpretation [[_]] of the equational theory λ1,×= in a CCC C=(C,T,×,π,⇒,ev) is given by:
(Ct-Emp) [[⊢♢ ctx]]=df.T;
(Ct-Ext) [[⊢Γ,x:A ctx]]=df.[[⊢Γ ctx]]×[[⊢A type]];
(1-Form) [[⊢1 type]]=df.T;
(⇒-Form) [[⊢A⇒B type]]=df.[[⊢A type]]⇒[[⊢B type]];
(×-Form) [[⊢A×B type]]=df.[[⊢A type]]×[[⊢B type]];
(Var) [[x1:A1,x2:A2,…,xj:Aj,…,xn:An⊢xj:Aj]]=df.πj;
(1-Intro) [[Γ⊢⋆:1]]=df. ![[Γ]];
(⇒-Intro) [[Γ⊢λx. b:A⇒B]]=df.λ[[A]],[[B]]([[Γ,x:A⊢b:B]]);
(×-Intro) [[Γ⊢(a,b):A×B]]=df.⟨[[Γ⊢a:A]],[[Γ⊢b:B]]⟩;
(⇒-Elim) [[Γ⊢f(a):B]]=df.ev[[A]],[[B]]∘⟨[[Γ⊢f:A⇒B]],[[Γ⊢a:A]]⟩; and
(×-Elim) [[Γ⊢πi(p):Ai]]=df.πi∘[[Γ⊢p:A1×A2]]
where the hypotheses of the rules are as presented in Section 2.1, and πj is constructed from the first and second projections in the obvious manner.
▶ Remark.
As each judgement in λ1,×= has a unique derivation, Definition 2.2.10 has no problem.
In light of the rather simple relation between MLTT(1,Π,Σ) and λ1,×=, i.e., the restriction of the former to closed types is the latter, the gap between the interpretations of λ1,×= in Definitions 2.2.7 and 2.2.10 should not be the case.
We shall address this problem in Section 4.
3 Categories with Dependence
We have reviewed all the necessary backgrounds; the main contents of the paper begin from the present section.
It is structured roughly as follows.
First, Section 3.1 introduces categories with dependence (CwDs) and morphisms between CwDs, called functors with dependence (FwDs).
Then, Section 3.2 defines CwDs with generalized finite products, called semi-cartesian CwDs (SCCwDs), and morphisms between them, called semi-cartesian FwDs (SCFwDs).
The semi-cartesian structure enables us to define morphisms between SCFwDs, called natural transformations with dependence (NTwDs), and moreover the 2-category of SCCwDs (0-cells), SCFwDs (1-cells) and NTwDs (2-cells).
Next, Section 3.3 gives a full generalization of finite products; we call CwDs with them cartesian CwDs (CCwDs).
Finally Section 3.4 defines a closed structure on CCwDs; we call CCwDs with the closed structure cartesian closed CwDs (CCCwDs), where morphisms between these concepts, cartesian FwDs (CFwDs) and cartesian closed FwDs (CCFwDs), are also defined.
These concepts constitute the 2-category of CCCwDs (0-cells), CCFwDs (1-cells) and NTwDs (2-cells) between them.
Along with these developments, we show that:
Strict SCCwDs coincide with CwFs;
Strict CCwDs induce CwFs that support 1- and Σ-types in the strict sense; and
Strict CCCwDs induce CwFs that support 1-, Σ- and Π-types in the strict sense.
Thus, in particular, we establish an interpretation of MLTT(1,Π,Σ) in CCCwDs; it is easy to see that this interpretation is sound and complete.
3.1 Categories and Functors with Dependence
Let us begin with a very simple generalization of categories to capture type dependence in DTTs, called categories with dependence (CwDs), and morphisms between them, called functors with dependence (FwDs).
3.1.1 Categories with Dependence
The idea of CwDs comes from CwFs: To take counterparts of types and terms as primitive, rather than to induce or compose them, which stands in sharp contrast to other categorical semantics of DTTs mentioned in the introduction.
▶** Definition 3.1.1**** (CwDs).**
A category with dependence (CwD) is a category C equipped with:
Dependent (D-) objects such that each D-object A is assigned a unique object Γ∈C, called the base of A, where A is said to be over Γ, and the class of all D-objects over Γ is written DC(Γ);
Dependent (D-) morphisms such that each D-morphism f is assigned a unique pair of an object Γ∈C and a D-object A∈DC(Γ), called the domain and the codomain of f, respectively, where the class of all D-morphisms whose domain and codomain are Γ and A, respectively, are written DC(Γ,A);
For each morphism ϕ:Δ→Γ in C a (class) function _{ϕ}C:DC(Γ)→DC(Δ) and a family (_{ϕ}C,A)A∈DC(Γ) of (class) functions _{ϕ}C,A:DC(Γ,A)→DC(Δ,A{ϕ}C), which are all called dependent (D-) compositions, that satisfy for any Θ,Δ,Γ∈C, A∈DC(Γ), ϕ∈C(Δ,Γ),φ∈C(Θ,Δ) and a∈DC(Γ,A) the equations A{idΓ}C=A, a{idΓ}C,A=a, A{ϕ∘φ}C=A{ϕ}C{φ}C and a{ϕ∘φ}C,A=a{ϕ}C,A{φ}C,A{ϕ}C.
▶ Notation.
We often omit the subscript C on DC and _{_}C as well as the subscripts C and/or A on _{_}C,A if it brings no ambiguity.
We write a:Γ\rightarrowtriangleA as a notation for a∈D(Γ,A).
Given a CwD C, we write ob(C) or C0 (resp. ar(C) or C1, dob(C) or C2, dar(C) or C3) for the class of all objects in C (resp. all morphisms in C, all D-objects in C, all D-morphisms in C).
▶ Remark.
CwDs are nothing new; a CwD is just a substructure of a CwF (Definition 2.2.1), consisting of the underlying category, types, terms and substitutions of the CwF, where we have assigned new names to the last three components.
▶ Notation.
Let us write U(C) for the underlying category of a given CwD C.
In an MLTT, assuming that each type has at least one non-variable term, a type is constant in the sense that it does not contain any free variable iff it is invariant (except its context) with respect to a generalized substitution.
Thus, it seems natural to define:
▶** Definition 3.1.2**** (Constant CwDs).**
Let C be a CwD.
A D-object A∈DC(Γ) is constant if A{ϕ1}C=A{ϕ2}C for all Δ∈C and ϕ1,ϕ2:Δ→Γ in C.
A CwD is constant if its D-objects are all constant.
▶ Example 3.1.3.
Each category C can be seen as a constant CwD D(C) as follows.
We define DD(C)(Γ)=df.ob(C) and DD(C)(Δ,Γ)=df.C(Δ,Γ) for all Δ,Γ∈C.
Given ϕ:Δ→Γ in C, we define the D-composition _{ϕ}:DD(C)(Γ)→DD(C)(Δ) to be the identity function on ob(C), and the D-composition _{ϕ}Θ:DD(C)(Γ,Θ)→DD(C)(Δ,Θ) for any Θ∈DD(C)(Γ) to be the pre-composition function with ϕ, i.e., f↦f∘ϕ for all f∈DD(C)(Γ,Θ).
We call this kind of CwDs categories seen as CwDs.
Moreover, the operation U, restricted to CwDs D such that DD(Γ)=ob(D), DD(Δ,Γ)=D(Δ,Γ), _{ϕ}=idob(D) and _{ϕ}Θ=(_)∘ϕ for all Δ,Γ,Θ∈D and ϕ:Δ→Γ in D, is clearly the inverse of the operation D.
Hence, CwDs are generalized categories.
▶ Remark.
It is also possible to regard each category C as a constant CwD d(C) by Dd(C)(Γ)=df.∅, but it does not reflect our view on CwDs as generalized categories.
This point will be clearer shortly as we proceed.
Also, it seems natural to lift smallness and local smallness of categories as follows:
▶** Definition 3.1.4**** (Small CwDs).**
A CwD C is small if so is the underlying category U(C), and the class of all D-objects in C and the class of all D-morphisms in C are both sets.
▶** Definition 3.1.5**** (Locally small CwDs).**
A CwD C is locally small if so is the underlying category U(C), and the class DC(Γ,A) is a set for any Γ∈C and A∈DC(Γ).
▶ Example 3.1.6.
The category Sets of sets and functions gives rise to a non-constant locally small CwD.
A D-object over a set X in Sets is an indexed set A={Ax∈Sets∣x∈X }, called a dependent (D-) set over X.
A D-morphism X\rightarrowtriangleA in Sets is a function f:X→⋃x∈XAx that satisfies f(x)∈Ax for all x∈X, called a dependent (D-) function from X to A.
Given a function ϕ:Y→X, the D-compositions in Sets are given by A{ϕ}=df.{Aϕ(y)∣y∈Y } and f{ϕ}=df.f∘ϕ:(y∈Y)↦f(ϕ(y))∈Aϕ(y)=(A{ϕ})y.
It is straightforward to define the substructure relation between CwDs:
▶** Definition 3.1.7**** (SubCwDs).**
A CwD C is a subCwD of another D if U(C) is a subcategory of U(D), and the dependence of C is the corresponding part of the dependence of D, i.e., for all Δ,Γ∈C, A∈DC(Γ), f∈DC(Γ,A) and ϕ:Δ→Γ in C we have A∈DD(Γ), f∈DD(Γ,A), A{ϕ}C=A{ϕ}D and f{ϕ}C=f{ϕ}D.
▶** Definition 3.1.8**** (Full and wide subCwDs).**
A CwD C is a full subCwD (resp. wide subCwD) of a CwD D if C is a subCwD of D, U(C) is a full (resp. wide) subcategory of U(D), and DC(Γ,A)=DD(Γ,A) for all Γ∈C and A∈DC(Γ) (resp. DC(Γ)=DD(Γ) for all Γ∈C).
▶ Example 3.1.9.
Similarly to the CwD Sets, there is a non-constant locally small CwD Rel whose underlying category is the category Rel of sets and relations.
D-objects in Rel are D-sets, D-morphisms X\rightarrowtriangleA in Rel are relations R⊆X×⋃x∈XAx such that (x,a)∈R⇒a∈Ax, D-compositions in Rel are given by A{ϕ}=df.{⋃(y,x)∈ϕAx∣y∈Y }, i.e., A{ϕ}y=df.⋃(y,x)∈ϕAx for all y∈Y and R{ϕ}=df.R∘ϕ={(y,a)∣∃x∈X. (y,x)∈ϕ∧(x,a)∈R } for any relation ϕ⊆Y×X.
It is straightforward to see that Sets is a wide subCwD of Rel, lifting the relation between the categories Sets and Rel.
▶ Example 3.1.10.
There is a non-constant locally small CwD Mon whose underlying category is the category Mon of monoids and monoid homomorphisms.
A D-object over a monoid M=(∣M∣,⋅M,eM) in Mon is a triple A=(∣A∣,⋅A,eA) of an indexed set ∣A∣=(Am)m∈∣M∣, a binary operation ⋅A on the union ⋃∣A∣=df.⋃m∈∣M∣Am satisfying a⋅Aa′∈Am⋅Mm′ for all m,m′∈∣M∣, a∈Am and a∈Am′, and an element eA∈AeM such that the triple ⋃A=(⋃∣A∣,⋅A,eA) forms a monoid, called a dependent (D-) monoid over M, and a D-morphism M\rightarrowtriangleA in Mon is a monoid homomorphism f:M→⋃A such that f(m)∈Am for all m∈∣M∣.
Given a monoid homomorphism ϕ:N→M, the D-composition A{ϕ}=(∣A{ϕ}∣,⋅A{ϕ},eA{ϕ}) is given by A{ϕ}n=df.Aϕ(n) for each n∈∣N∣, ⋅A{ϕ}=df.⋅A↾⋃∣A{ϕ}∣ and eA{ϕ}=df.eA, and the D-composition f{ϕ} is simply given by the function composition f∘ϕ.
One may wonder, as in the case of the CwDs Sets, Rel and Mon, whether D-morphisms are always certain morphisms in the underlying category; however, it is not the case.
For instance, in the term model T(1,Π,Σ) regarded as a CwD, i.e., its types, terms and substitutions are regarded respectively as D-objects, D-morphisms and D-compositions, note that morphisms (or context morphisms) are certain lists of D-morphisms (or terms).
There are other non-trivial CwDs whose D-morphisms are not certain morphisms:
▶ Example 3.1.11.
There is a non-constant locally small CwD GPD whose underlying category is the category GPD of groupoids and functors between them [HS98].
A D-object over a groupoid G in GPD is any functor A:G→GPD, called a dependent (D-) groupoid.
In order to define D-morphisms in GPD, it is convenient (though not strictly necessary) to first employ the Grothendieck construction G.A∈GPD of G and A, which is given by:
An object of G.A is a pair (g,a) of objects g∈G and a∈A(g);
A morphism (g,a)→(g′,a′) in G.A is a pair (ϕ,f) of a morphism ϕ:g→g′ in G and a morphism f:A(ϕ)(a)→a′ in A(g′);
The composition (g,a)→(ϕ,f)(g′,a′)→(ϕ′,f′)(g′′,a′′) in G.A is the pair (ϕ′∘ϕ,f′∘A(ϕ′)(f));
The identity id(g,a):(g,a)→(g,a) in G.A is the pair (idg,ida); and
The inverse of (ϕ,f):(g,a)→(g′,a′) is the pair (ϕ−1,A(ϕ−1)(f−1)):(g′,a′)→(g,a).
Then, a D-morphism G\rightarrowtriangleA in GPD is a pair μ=(μ0,μ1) of maps μ0:ob(G)→⋃g∈Gob(A(g)) and μ1:ar(G)→⋃g∈Gar(A(g)) such that
[TABLE]
for all g,g′,g′′∈G, ϕ:g→g′ and ψ:g′→g′′ in G, i.e., the pairing ⟨idG,μ⟩ is a functor G→G.A.
Note that it is impossible to turn μ into a morphism in GPD for there is no groupoid to serve as the codomain of μ; we have employed G.A to make this point clear.
Finally, given a morphism F:H→G in GPD, the D-composition A{F}:H→GPD is the composition A∘F of functors, and the D-composition μ{F}:H\rightarrowtriangleA{F} is given by μ{F}i=μi∘Fi for i=1,2.
▶ Example 3.1.12.
Similarly to GPD, the category CAT of small categories and functors between them forms a non-constant locally small CwD.
A D-object over a category C in CAT is a functor X:C→CAT, called a dependent (D-) category, and a D-morphism C\rightarrowtriangleX in CAT is a pair F=(F0,F1) of maps F0:ob(C)→⋃Γ∈Cob(X(Γ)) and F1:ar(C)→⋃Γ∈Car(X(Γ)) such that
[TABLE]
for all Δ,Γ,Θ∈C, ϕ:Δ→Γ and ψ:Γ→Θ in C, called a dependent (D-) functor, where the category C.X is the Grothendieck construction of C and X (discarding the structure of inverses).
Finally, D-compositions in CAT are defined exactly as in the case of GPD.
Now, one may wonder what is an appropriate notion of isomorphisms between D-objects for it is a fundamental principle in category theory to regard isomorphic objects as essentially the same.
Thinking of the CwD Sets as an example, it sounds fair to say that two D-sets A and A′ are isomorphic if they are over sets X and X′, respectively, such that there is a bijection ι:X→∼X′, and Ax is isomorphic to Aι(x)′ for each x∈X because then the structures of A and A′ as D-sets are essentially the same.
However, the second condition does not make sense for an arbitrary CwD (i.e., we cannot always talk about the components Ax).
We need additional conditions on CwDs, which will be introduced in Section 3.2, to talk about isomorphisms between D-objects.
Next, note that the asymmetry of the domain and the codomain of D-morphisms prohibits us from defining the ‘opposite CwDs’ just by ‘flipping’ morphisms and D-morphisms in a given CwD.
However, we may ‘flip’ only morphisms, not D-morphisms, taking this operation as the ‘opposite’ construction on CwDs.
Thus, we do not need any new concepts for this construction; it suffices to consider CwDs whose underlying categories are opposite categories.
Nevertheless, it is often convenient to give the explicit definition:
▶** Definition 3.1.13**** (Contravariant CwDs).**
A contravariant CwD is a category C equipped with a pair (DC,_{_}C), called the dependence of C, where:
DC assigns to each object Γ∈C a class DC(Γ) of dependent (D-) objects over Γ and to each pair of Γ∈C and A∈DC(Γ) a class DC(Γ,A) of dependent (D-) morphisms from Γ to A;
_{_}C assigns to each morphism ϕ:Δ→Γ in C a (class) function _{ϕ}C:DC(Δ)→DC(Γ) and a family (_{ϕ}C,A)A∈DC(Γ) of (class) functions _{ϕ}C,A:DC(Δ,B)→DC(Γ,B{ϕ}C), which are all called contravariant dependent (D-) compositions that satisfy:
[TABLE]
for any Θ,Δ,Γ∈C, B∈DC(Δ), ϕ∈C(Δ,Γ),ψ∈C(Γ,Θ) and b∈DC(Δ,B).
▶ Notation.
We write Cop for the opposite category of a given category C, and ϕop:Γ→Δ in Cop for the ‘flipped’ morphism ϕ:Δ→Γ in C.
▶ Remark.
A contravariant CwD C is nothing other than a CwD Cop described in terms of the category C.
▶ Notation.
The notations for CwDs are also applied to contravariant CwDs.
We are now ready to define:
▶** Definition 3.1.14**** (Opposites).**
Given a CwD C, its opposite Cop is the contravariant CwD such that U(Cop)=df.U(C)op, DCop=df.DC and _{_}Cop=df._{_}C∘(_)op.
Dually, the opposite Dop of a contravariant CwD D is the CwD defined in the same manner.
For a contravariant CwD C is just a CwD Cop, by the principle of duality [ML13, Awo10], it suffices to focus only on (covariant) CwDs.
However, just for convenience, we occasionally describe contravariant ones Cop explicitly in terms of C like Definition 3.1.13.
3.1.2 Functors with Dependence
Next, let us generalize functors by taking into account D-objects and D-morphisms:
▶** Definition 3.1.15**** (FwDs).**
A functor with dependence (FwD) between CwDs C and D is a quadruple F=(F0,F1,F2,F3), written F:C→D, of maps Fi:Ci→Di that satisfies:
-
∀Δ,Γ∈C,ϕ∈C(Δ,Γ). F1(ϕ)∈D(F0(Δ),F0(Γ));
2. 2.
∀Γ∈C,A∈DC(Γ). F2(A)∈DD(F0(Γ));
3. 3.
∀Γ∈C,A∈DC(Γ),a∈DC(Γ,A). F3(a)∈DD(F0(Γ),F2(A));
4. 4.
∀Δ,Γ,Θ∈C,ϕ∈C(Δ,Γ),ψ∈C(Γ,Θ). F1(ψ∘ϕ)=F1(ψ)∘F1(ϕ);
5. 5.
∀Γ∈C. F1(idΓ)=idF0(Γ);
6. 6.
∀Δ,Γ∈C,ϕ∈C(Δ,Γ),A∈DC(Γ). F2(A{ϕ}C)=F2(A){F1(ϕ)}D; and
7. 7.
∀Δ,Γ∈C,ϕ∈C(Δ,Γ),A∈DC(Γ),a∈DC(Γ,A). F3(a{ϕ}C)=F3(a){F1(ϕ)}D.
▶ Convention.
We usually abbreviate each Fi (i=0,1,2,3) as F, which would not bring any confusion in practice.
That is, an FwD F:C→D is just a functor U(F)=df.(F0,F1):U(C)→U(D) equipped with maps F2 and F3 on D-objects and D-morphisms, respectively, with analogous structure-preserving properties.
▶ Example 3.1.16.
Given a functor F:C→D, there are the obvious FwDs D(F):D(C)→D(D).
We call this kind of FwDs functors seen as FwDs.
Conversely, FwDs between categories seen as CwDs coincide with functors.
In this sense, FwDs are a generalization of functors.
Note also that there are the trivial FwDs d(F):d(C)→d(D).
▶ Example 3.1.17.
There is an FwD (_)∗:Sets→Mon that maps:
[TABLE]
where X∗=(X∗,∗,ϵ) is the free monoid over X, ϕ∗ (resp. f∗) maps each x1x2…xk∈X∗ to ϕ(x1)ϕ(x2)…ϕ(xk)∈Y∗ (resp. to f(x1)f(x2)…f(xk)∈∏i=1kAxi), and ∏i=1kAxi is the product of monoids Axi for i=1,2,…,k.
▶** Definition 3.1.18**** (Fullness and faithfulness of FwDs).**
An FwD F:C→D is full (resp. faithful) if so is the underlying functor U(F), and the function FΓ,A:DC(Γ,A)→DD(F(Γ),F(A)) that maps f↦F(f) for all f∈DC(Γ,A) is surjective (resp. injective) for each pair of an object Γ∈C and a D-object A∈DC(Γ) in C.
Just for convenience, let us write down explicitly the contravariant case:
▶** Definition 3.1.19**** (Contravariant FwDs).**
A contravariant FwD from a contravariant CwD C to a CwD D is an FwD F:Cop→D.
Dually, a contravariant FwD from D to C is a contravariant FwD Dop→Cop, i.e., an FwD D→Cop.
▶ Example 3.1.20.
Given a locally small CwD C and an object Δ∈C, we obtain an FwD C(Δ,_):C→Sets that maps each object Γ∈C to the set C(Δ,Γ), each morphism α∈C(Γ,Γ′) to the function C(Δ,α):C(Δ,Γ)→C(Δ,Γ′) that maps (ϕ∈C(Δ,Γ))↦α∘ϕ∈C(Δ,Γ′), each D-object A∈DC(Γ) to the D-set C(Δ,A)=df.(DC(Δ,A{ϕ}C))ϕ∈C(Δ,Γ), and each D-morphism f∈DC(Γ,A) to the D-function C(Δ,f):C(Δ,Γ)\rightarrowtriangleC(Δ,A) that maps (ϕ∈C(Δ,Γ))↦f{ϕ}C∈DC(Δ,A{ϕ}C)=C(Δ,A)ϕ.
Dually, given a locally small contravariant CwD D and an object Δ∈D, we obtain a contravariant FwD D(_,Δ):D→Sets that maps each object Γ∈D to the set D(Γ,Δ), each morphism β∈D(Γ′,Γ) to the function D(β,Δ):D(Γ,Δ)→D(Γ′,Δ) that maps (φ∈D(Γ,Δ))↦φ∘β∈D(Γ′,Δ), each D-object A∈DD(Γ) to the D-set D(A,Δ)=df.(DD(Δ,A{φ}D))φ∈D(Γ,Δ), and each D-morphism f∈DD(Γ,A) to the D-function D(f,Δ):D(Γ,Δ)\rightarrowtriangleD(A,Δ) that maps (φ∈D(Γ,Δ))↦f{φ}D∈DD(Δ,A{φ}D)=D(A,Δ)φ.
As expected, small CwDs and FwDs between them form a category:
▶** Definition 3.1.21**** (The category CD).**
The category CD is given by:
Objects are small CwDs;
Morphism C→D are FwDs C→D;
The composition C→FD→GE is the quadruple (G0∘F0,G1∘F1,G2∘F2,G3∘F3); and
The identity idC:C→C is the quadruple (idC0,idC1,idC2,idC3).
It is easy to check that CD is a well-defined locally small category, and there is the obvious forgetful functor U:CD→CAT, which has the functor d:CAT→CD as the left adjoint.
On the other hand, there seems no sensible way to lift the category CD to a CwD.
One may define a D-object over a small CwD C to be an FwD C→CAT or a functor U(C)→CD, but neither works very well.
3.2 Semi-Cartesian Categories, Functors and Natural Transformations with Dependence
As we have seen above, CwDs and FwDs are natural generalizations of categories and functors, respectively, which subsume several concrete instances.
However, we cannot yet have morphisms between parallel FwDs because we cannot define morphisms between D-objects at the moment.
Thus, CwDs and FwDs are in some sense incomplete structures.
On the other hand, we need additional structures on CwDs in order to interpret the empty context Ctx-Emp and context extensions Ctx-Ext in MLTTs.
The present section addresses these two problems by introducing CwDs with generalized binary products, called semi-dependent pair (semi-Σ-) spaces.
We call CwDs with a terminal object and semi-Σ-spaces semi-cartesian CwDs (SCCwDs); their strict version coincides with CwFs, and thus they interpret the empty context and context extensions.
We also define FwDs that preserve the semi-cartesian structure of CwDs, called semi-cartesian FwDs (SCFwDs) and morphisms between parallel SCFwDs, called natural transformations with dependence (NTwDs), which constitute 1-cells and 2-cells of the 2-category of SCCwDs (0-cells), respectively.
Moreover, as promised before, we lift this 2-category to a 2-CwD, the 2-dimensional generalization of CwDs.
3.2.1 Semi-Cartesian Categories with Dependence
▶** Definition 3.2.1**** (Semi-Σ-spaces).**
Let C be a CwD.
A semi-dependent pair (semi-Σ-) space of an object Γ∈C and a D-object A∈D(Γ) is an object
[TABLE]
together with a morphism
[TABLE]
in C, called the first projection on Γ.A, and a D-morphism
[TABLE]
in C, called the second projection on Γ.A, such that for any Δ∈C, ϕ:Δ→Γ and g:Δ\rightarrowtriangleA{ϕ} in C there exists a unique morphism
[TABLE]
in C, called the semi-dependent pairing of ϕ and g, that satisfies the equations
[TABLE]
▶ Notation.
We often omit the superscript Γ.A on πiΓ.A (i=1,2).
▶** Definition 3.2.2**** (SCCwDs).**
A semi-cartesian CwD (SCCwD) is a CwD C that has:
A terminal object T∈C; and
A semi-Σ-pair space Γ←π1Γ.A\rightarrowtriangleπ2A{π1} of any Γ∈C and A∈DC(Γ).
See the following diagram that depicts the universal property of semi-Σ-spaces:
{diagram}
where the thick arrow A{π1}⇒A{ϕ} denotes the transformation of the codomain of π2 when ⟨ϕ,g⟩ is composed with π2.
Clearly, it generalizes the universal property of binary products in the sense that for a category seen as a CwD the diagram coincides with that of binary products; in other words, for a category seen as a CwD, semi-Σ-spaces Γ.A are just binary products Γ×A.
In this sense, SCCwDs are a generalization of cartesian categories.
On the other hand, unlike binary products, we do not even have a sensible way to formulate, let alone prove, that a terminal object is unit for semi-Σ-spaces, or semi-Σ-spaces are associative, due to the asymmetry of semi-Σ-spaces.
We need unit D-objects and Σ-spaces in Section 3.3 to address this point.
Similarly to the case of binary products, we may easily establish:
▶** Proposition 3.2.3**** (Uniqueness of semi-Σ-spaces).**
Semi-Σ-spaces are unique up to isomorphisms.
▶** Lemma 3.2.4**** (Semi-dependent pairings as comprehensions).**
Let C be an SCCwD, and Θ,Δ,Γ∈C, A∈D(Γ), φ:Θ→Δ, ϕ:Δ→Γ and g:Δ\rightarrowtriangleA{ϕ} in C.
Then, we have:
[TABLE]
Note that the equations (5) and (6) correspond respectively to the axioms Cons-Nat and Cons-Id for CwFs, and thus Lemma 3.2.4 particularly implies that an SCCwD is a CwF except that a terminal object, comprehensions, projections and extensions are not parts of the structure, and comprehensions and extensions are called semi-Σ-spaces and semi-dependent pairings, respectively.
Hence, CwFs are the strict version of SCCwDs.
Nevertheless, we require some equation for our notion of strict SCCwDs:
▶** Definition 3.2.5**** (Strict SCCwDs).**
A strict SCCwD is an SCCwD C equipped with a terminal object T∈C and a semi-Σ-space Γ←π1Γ.A\rightarrowtriangleπ2A{π1} that satisfies:
[TABLE]
for each Γ∈C and A∈DC(Γ).
We shall need this equation for the proof of Theorem 3.4.15.
▶ Example 3.2.6.
A category C seen as a CwD D(C) is semi-cartesian iff C is cartesian.
We call this kind of SCCwDs cartesian categories seen as SCCwDs.
▶ Example 3.2.7.
The CwD Sets is semi-cartesian.
Any singleton set {∙} is a terminal object, and given a set X and an indexed set A over X the set {(x,a)∣x∈X,a∈Ax } of semi-dependent pairs (x,a) is a semi-Σ-space X.A together with the projection functions as the projections.
Semi-dependent pairings are just pairings of functions.
▶ Example 3.2.8.
The CwD Rel is semi-cartesian.
The empty set ∅ is a terminal (as well as initial) object, and given a set X and an indexed set A over X the disjoint union X+⋃x∈XAx is a semi-Σ-space X.A together with the first projection π1=df.{(ι1(x),x)∣x∈X }⊆X.A×X and the second projection π2=df.{(ι2(a),a)∣a∈⋃x∈XAx }⊆X.A×⋃z∈X.AA{π1}z, where ιi (i=1,2) are the ‘tags’ for the disjoint union X.A.
Given a set Y, a relation R⊆Y×X and a D-relation S⊆Y×⋃y∈YA{R}y, the semi-dependent pairing of R and S is given by ⟨R,S⟩=df.{(y,ι1(x))∣(y,x)∈R }∪{(y,ι2(a))∣(y,a)∈S }.
▶ Example 3.2.9.
The CwD Mon is semi-cartesian.
A terminal object in Mon or a terminal monoid is any monoid T whose underlying set is singleton.
Given a monoid M and a D-monoid A over M, the semi-Σ-space M.A is given by ∣M.A∣=df.{(m,a)∣m∈∣M∣,a∈Am }, ⋅M.A:((m,a),(m′,a′))↦(m⋅Mm′,a⋅Aa′) and eM.A=df.(eM,eA), where projections and semi-dependent pairings are the obvious ones as in Sets.
▶ Example 3.2.10.
The CwD GPD is semi-cartesian.
A terminal object in GPD is any groupoid T with just one object ⋆ and the identity id⋆.
Given a groupoid G and a D-groupoid A:G→GPD, the semi-Σ-space G.A is the Grothendieck construction of G and A, where projections and semi-dependent pairings are the obvious ones.
▶ Example 3.2.11.
The CwD CAT is semi-cartesian in the same manner as the case of GPD.
Just for clarity, we explicitly write down the contravariant case because the directions of morphisms in this case are slightly trickier:
▶** Definition 3.2.12**** (Contravariant semi-Σ-spaces).**
Let C be a contravariant CwD.
A contravariant semi-Σ-space of an object Γ∈C and a D-object A∈DC(Γ) is an object Γ.A∈C together with a morphism π1:Γ→Γ.A in C, called the contravariant first projection on Γ.A, and a D-morphism π2:Γ.A\rightarrowtriangleA{π1} in C, called the contravariant second projection on Γ.A, such that for any Δ∈C, φ:Γ→Δ and g:Δ\rightarrowtriangleA{φ} in C there exists a unique morphism ⟨φ,g⟩:Γ.A→Δ in C, called the contravariant semi-dependent pairing of φ and g, that satisfies ⟨φ,g⟩∘π1=φ and π2{⟨φ,g⟩}=g.
▶** Definition 3.2.13**** (Semi-cartesian contravariant CwDs).**
A contravariant CwD C is semi-cartesian iff it has a terminal object T∈C and a contravariant semi-Σ-space Γ→π1Γ.A\rightarrowtriangleπ2A{π1} of any pair of an object Γ∈C and a D-object A∈DC(Γ).
Clearly, the opposite of an SCCwD is a semi-cartesian contravariant CwD; the semi-cartesian contravariant CwDs which we shall consider occur mostly in this manner.
3.2.2 Semi-Cartesian Functors with Dependence
Next, following the general principle of category theory that morphisms are structure-preserving, let us define:
▶** Definition 3.2.14**** (SCFwDs).**
A semi-cartesian FwD (SCFwD) is an FwD F:C→C′ between SCCwDs C and C′ such that:
The object F(T)∈C′ is terminal in C′ for any terminal object T∈C; and
The diagram F(Γ)←F(π1Γ.A)F(Γ.A)\rightarrowtriangleF(π2Γ.A)F(A){F(π1Γ.A)} in C′ is a semi-Σ-space in C′ for any semi-Σ-space Γ←π1Γ.AΓ.A\rightarrowtriangleπ2Γ.AA{π1Γ.A} in C.
If C and C′ are both strict, written C=(C,T,_._,π) and C′=(C′,T′,_.′_,π′), then F is strict iff
[TABLE]
for any semi-Σ-space Γ←π1Γ.AΓ.A\rightarrowtriangleπ2Γ.AA{π1Γ.A} in C.
▶ Remark.
Note that the first projection π1 is ‘fliped’ under semi-cartesian contravariant FwDs.
Let F:C→C′ be an SCFwD.
It is easy to see that there is a unique isomorphism ιT′F(T):T′→∼F(T) in C′ for any terminal objects T∈C and T′∈C′, and similarly given semi-Σ-spaces Γ←π1Γ.A\rightarrowtriangleπ2A{π1} in C and F(Γ)←π1′F(Γ).′F(A)\rightarrowtriangleπ2′F(A){π1′} in C′ there is a unique isomorphism ιF(Γ).′F(A)F(Γ.A):F(Γ).′F(A)→∼F(Γ.A) in C′.
Moreover, given that C and C′ are both strict, F is strict iff these isomorphisms are all identities.
▶ Notation.
We often abbreviate the isomorphism ιT′F(T) (resp. ιF(Γ).′F(A)F(Γ.A)) as ι.
▶ Example 3.2.15.
Clearly, (resp. strict) finite-product-preserving (or cartesian) functors C→D coincide with (resp. strict) SCFwDs D(C)→D(D) for any (resp. strict) cartesian categories C and D. We call this kind of (resp. strict) SCFwDs (resp. strict) cartesian functors seen as (resp. strict) SCFwDs.
Thus, (resp. strict) SCFwDs are generalized (resp. strict) cartesian functors.
▶ Example 3.2.16.
Given a locally small SCCwD C and an object Δ∈C, the FwD C(Δ,_):C→Sets is semi-cartesian: For any semi-Σ-space Γ←π1Γ.A\rightarrowtriangleπ2A{π1} in C, we have the semi-Σ-space
[TABLE]
in Sets, i.e., C(Δ,Γ).C(Δ,A)≅C(Δ,Γ.A), where semi-dependent pairings of C(Δ,Γ.A) are the obvious ‘point-wise’ semi-dependent pairings in C.
Dually, given a locally small semi-cartesian contravariant CwD D and Δ∈D, the contravariant FwD D(_,Δ):D→Sets is semi-cartesian: Given a contravariant semi-Σ-space Γ→π1Γ.A\rightarrowtriangleπ2A{π1} in D, we have the semi-Σ-space
[TABLE]
in Sets, i.e., D(Γ,Δ).C(A,Δ)≅C(Γ.A,Δ), where semi-dependent pairings of C(Γ.A,Δ) are again the ‘point-wise’ contravariant semi-dependent pairings in D.
The following lemma generalizes well-known properties of cartesian functors:
▶** Lemma 3.2.17**** (SCFwD-lemma).**
Let F:C→D be an SCFwD, and Γ,Δ∈C, A∈DC(Γ), B∈DC(Δ), ϕ:Δ→Γ, g:Δ\rightarrowtriangleA{ϕ} and h:Δ.B\rightarrowtriangleA{ϕ∘π1Δ.B} in C.
Then, we have:
-
F(π1Γ.A)∘ιF(Γ).F(A)F(Γ.A)=π1F(Γ).F(A):F(Γ).F(A)→F(Γ);
2. 2.
F(π2Γ.A){ιF(Γ).F(A)F(Γ.A)}=π2F(Γ).F(A):F(Γ).F(A)\rightarrowtriangleF(A){π1F(Γ).F(A)};
3. 3.
F(⟨ϕ,g⟩)=ιF(Γ).F(A)F(Γ.A)∘⟨F(ϕ),F(g)⟩:F(Δ)→F(Γ.A); and
4. 4.
(ιF(Γ).F(A)F(Γ.A))−1∘F(⟨ϕ∘π1Δ.B,h⟩)∘ιF(Δ).F(B)F(Δ.B)=⟨F(ϕ)∘π1F(Δ).F(B),F(h){ιF(Δ).F(B)F(Δ.B)}⟩:F(Δ).F(B)→F(Γ).F(A).
Proof.
The equations 1 and 2 follow from the definition of the canonical isomorphism ιF(Γ).F(A)F(Γ.A):F(Γ).F(A)→∼F(Γ.A), i.e., ιF(Γ).F(A)F(Γ.A)=df.⟨F(π1Γ.A),F(π2Γ.A)⟩−1, and for the equation 3 we have:
[TABLE]
as well as:
[TABLE]
Hence, by the universal property of semi-dependent pairings, we may conclude that
[TABLE]
whence F(⟨ϕ,g⟩)=ιF(Γ).F(A)F(Γ.A)∘⟨F(ϕ),F(g)⟩:F(Δ)→F(Γ.A), establishing the equation 3.
Finally, the equation 4 is an immediate corollary of the equations 1 and 3.
∎
3.2.3 Natural Transformations with Dependence
Note that the additional semi-cartesian structure on SCCwDs C enables us to define a morphism between D-objects D∈DC(Δ) and C∈DC(Γ) to be a pair (ϕ,f) of a morphism ϕ:Δ→Γ and a D-morphism f:Δ.D\rightarrowtriangleC{ϕ∘π1} in C.
Based on this idea, it seems a reasonable idea to define a morphism between SCFwDs F,G:C→D to be a pair (η,t) of a family η=(ηΓ)Γ∈C of morphisms ηΓ:F(Γ)→G(Γ) in D and a family t=(tΓ,A)Γ∈C,A∈DC(Γ) of D-morphisms tΓ,A:F(Γ).F(A)\rightarrowtriangleG(A){ηΓ∘π1} in D such that the diagrams
{diagram}
commute for any Γ,Δ∈C, A∈DC(Γ), B∈DC(Δ), φ:Γ→Δ and g:Γ.A\rightarrowtriangleB{φ∘π1} in C.
Nevertheless, this concept turns out to be too general as morphisms between SCFwDs.
For instance, such morphisms between cartesian functors seen as SCFwDs do not coincide with natural transformations, and Theorem 4.3.7 would not hold if we adopted them as morphisms between SCFwDs.
Fortunately, however, the right one is simpler:
▶** Definition 3.2.18**** (NTwDs).**
A natural transformation with dependence (NTwD) between SCFwDs F,G:C→D is a pair (η,t) of a family η=(ηΓ)Γ∈C of morphisms ηΓ:F(Γ)→G(Γ) in D and a family t=(tΓ,A)Γ∈C,A∈DC(Γ) of D-morphisms tΓ,A:F(Γ).F(A)\rightarrowtriangleG(A){ηΓ∘π1} in D such that η forms a natural transformation (NT) U(F)⇒U(G):U(C)→U(D), and the pair is coherent in the sense that for any Γ,Δ∈C, A∈DC(Γ), B∈DC(Δ), φ:Γ→Δ and g:Γ.A\rightarrowtriangleB{φ∘π1} in C it satisfies the equation
[TABLE]
where the semi-Σ-spaces Γ.A∈C and G(Γ).G(A)∈D are arbitrary.
Let us see that the coherence axiom (8) makes the diagram
{diagram}
commutes for any Γ,Δ∈C, A∈DC(Γ), B∈DC(Δ), φ:Γ→Δ and g:Γ.A\rightarrowtriangleB{φ∘π1} in C.
First, by the coherence of (η,t) and the naturality of η, we have:
[TABLE]
as well as:
[TABLE]
whence it suffices to show:
[TABLE]
Then, by the naturality of η, we have:
[TABLE]
and thus, it is immediate that:
[TABLE]
Next, note that NTwDs (η,t) between strict SCFwDs F,G:C→D are essentially NTs η:U(F)⇒U(G):U(C)→U(D) because t may be completely recovered from η by the equation tΓ,A=π2{ηΓ.A} for any Γ∈C and A∈DC(Γ).
This point plays an essential role for the commutative diagram in the proof of Theorem 4.3.7.
▶ Notation.
We write (η,t):F⇒G to mean that the pair (η,t) is an NTwD from an SCCwD F to another G, or even (η,t):F⇒G:C→D if we would like to indicate F,G:C→D.
We skip describing contravariant NTwDs explicitly because now it should be clear for the reader what they are.
More generally, we shall focus on covariant cases in the rest of the paper.
▶ Example 3.2.19.
An NT η:F⇒G:C→D gives rise to an NTwD D(η)=df.(η,t(η)):D(F)⇒D(G):D(C)→D(D) by t(η)Γ,A=df.ηA∘π2F(Γ).F(A) for all Γ∈C and A∈DC(Γ), as well as another d(η)=df.(η,∅):d(F)⇒d(G):d(C)→d(D).
We call the first kind NTs seen as NTwDs.
Conversely, an NTwD (ϵ,s):J⇒K:L→R such that J and K are cartesian functors seen as SCFwDs and sΓ,A=ϵA∘π2F(Γ).F(A) for all Γ∈L and A∈DL(Γ) coincides with an NT.
Hence, NTwDs are a generalization of NTs.
▶ Example 3.2.20.
Given a locally small SCCwD C and a morphism ϕ:Δ→Γ in C, we may give an NTwD (η(ϕ),t(ϕ)):C(Γ,_)⇒C(Δ,_):C→Sets by defining for any Θ∈C and C∈DC(Θ)
[TABLE]
Note that η(ϕ)Θ maps each morphism φ:Γ→Θ in C to the morphism φ∘ϕ:Δ→Θ in C, and t(ϕ)Θ,C maps each pair (φ,g)∈C(Γ,Θ).C(Γ,C) to the D-morphism g{ϕ}∈DC(Δ,C{φ}{ϕ}) in C.
It is easy to see that the pair (η(ϕ),t(ϕ)) satisfies the required naturality condition.
Similarly to the case of NTs, it is straightforward to define vertical composition of NTwDs:
▶** Definition 3.2.21**** (Vertical composition of NTwDs).**
The vertical composition (ϵ,s)∘(η,t):F⇒H:C→D of NTwDs (η,t):F⇒G:C→D and (ϵ,s):G⇒H:C→D is given by:
[TABLE]
Note that the vertical composition on the first components is just the conventional vertical composition on NTs.
It is easy to see that vertical composition of NTwDs is well-defined:
▶** Proposition 3.2.22**** (Well-defined VC of NTwDs).**
NTwDs are closed under vertical composition.
Proof.
It suffices to show that the coherence 8 is preserved under vertical composition.
Let (η,t):F⇒G:C→D and (ϵ,s):G⇒H:C→D be NTwDs.
Then, we have:
[TABLE]
for any Γ∈C and A∈DC(γ), which establishes the coherence 8 on the vertical composition (ϵ,s)∘(η,t)=(ϵ∘η,s∘t).
∎
As one may have already expected, we also have horizontal composition of NTwDs:
▶** Definition 3.2.23**** (Horizontal composition of NTwDs).**
The horizontal composition (η′,t′)⊙(η,t):F′∘F⇒G′∘G:C→E of NTwDs (η,t):F⇒G:C→D and (η′,t′):F′⇒G′:D→E is given by:
[TABLE]
Again, note that the horizontal composition on the first components is just the horizontal composition on NTs.
It is not hard to see that horizontal composition on NTwDs is well-defined:
▶** Proposition 3.2.24**** (Well-defined HC of NTwDs).**
NTwDs are closed under horizontal composition.
Proof.
Let (η,t):F⇒G:C→D and (η′,t′):F′⇒G′:D→E be NTwDs.
We show that horizontal composition (η′,t′)⊙(η,t):F′∘F⇒G′∘G:C→E satisfies the coherence (8):
[TABLE]
for any Γ∈C and A∈DC(γ), completing the proof.
∎
3.2.4 The 2-Category of Semi-Cartesian Categories with Dependence
We are now ready to define the 2-category of small SCCwDs, SCFwDs and NTwDs.
Let us first define the following preliminary concept:
▶** Definition 3.2.25**** (SCFwD-categories).**
Given SCCwDs C and D, the category [C,D], called the SCFwD-category from C to D is given by:
Objects are SCFwDs C→D;
Morphisms F→G are NTwDs F⇒G;
The composition F→(η,t)G→(ϵ,s)H is the vertical composition (ϵ,s)∘(η,t); and
The identity idF is the pair ((idF(Γ))Γ∈C,(π2F(Γ).F(A))Γ∈C,A∈DC(Γ)).
It is easy to see that SCFwD-categories are well-defined.
We are now ready to define:
▶** Definition 3.2.26**** (The 2-category SCCD).**
The 2-category SCCD is defined by:
0-cells (or objects) are small SCCwDs;
Given 0-cells C and D, the hom-category SCCD(C,D) is the SCFwD-category [C,D];
Given 0-cells C, D and E, the composition functor [C,D]×[D,E]→[C,E] maps
[TABLE]
for all F,G∈[C,D], F′,G′∈[D,E], (η,t)∈[C,D](F,G) and (η′,t′)∈[D,E](F′,G′); and
Given a 0-cell C, the functor 1→[C,C] maps
[TABLE]
where ⋆ is the unique object of the terminal category 1.
▶** Theorem 3.2.27**** (Well-defined SCCD).**
The structure SCCD in fact forms a 2-category.
Proof.
Let us just show that SCCD satisfies the interchange law since the other axioms are easier to verify.
Let C, D and E be SCCwDs, F,G,H:C→D and F′,G′,H′:D→E SCFwDs, and (η,t):F⇒G, (ϵ,s):G⇒H, (η′,t′):F′⇒G′ and (ϵ′,s′):G′⇒H′ NTwDs. We have to establish the equation:
[TABLE]
which is equivalent to:
[TABLE]
which is reduced to:
[TABLE]
because the equation of the first components is just the well-known interchange law for the 2-category CAT of small categories, functors and NTs.
Then, observe that:
[TABLE]
for all Γ∈C and A∈DC(Γ), which establishes the equation (9).
∎
By this 2-categorical structure of small SCCwDs, we may employ the notions of adjunctions and equivalences between 0-cells in an arbitrary 2-category to define adjunctions and equivalences between small SCCwDs.
Clearly, we may unpack these definitions and define adjunctions and equivalences between large SCCwDs as well.
3.2.5 Categories of Dependent Objects
This section introduces a 2-functor (_)D:SCCD→CAT, which will turn out to be very useful for the rest of the paper.
Let us begin with the operation on 0-cells:
▶** Definition 3.2.28**** (Categories of D-objects).**
Given an SCCwD C, the category of D-objects in C is the category CD given by:
ob(CD)=df.{(Γ,C)∣Γ∈C,C∈DC(Γ) };
CD((Δ,D),(Γ,C))=df.{(ϕ,f)∣ϕ∈C(Δ,Γ),f∈DC(Δ.D,C{ϕ∘π1}) };
(Δ,D)→(ϕ,f)(Γ,C)→(ψ,g)(Θ,E)=df.(ψ∘ϕ,g{⟨ϕ∘π1,f⟩}C);
id(Γ,C)=df.(idΓ,π2).
It is straightforward to check that CD is a well-defined category for any SCCwD C, and there is the obvious forgetful functor pC:CD→C.
This construction may be seen as a categorical abstraction of the syntactic comprehension category of a DTT [Jac99].
Note that each morphism (ϕ,f):(Δ,D)→(Γ,C) in CD induces a morphism ⟨ϕ∘π1,f⟩:Δ.D→Γ.C in C; however, we have not taken ⟨ϕ∘π1,f⟩ as a morphism (Δ,D)→(Γ,C) in CD since otherwise we cannot define the composition of these morphisms as given above (as semi-Σ-spaces are unique only up to isomorphisms).
Next, let us lift this construction to SCFwDs as follows:
▶** Definition 3.2.29**** (Functors between categories of D-objects).**
Each SCFwD F:C→D induces the functor FD:CD→DD that maps each object (Δ,D)∈CD to the object (F(Δ),F(D))∈DD and each morphism (ϕ,f) in CD to the morphism (F(ϕ),F(f){ιF(Δ).F(D)F(Δ.D)}) in DD.
By the equation 4 in Lemma 3.2.17 (for the preservation of composition), it is easy to see that the functor FD:CD→DD is well-defined for any SCFwD F:C→D.
It is even simpler for the case of NTwDs:
▶** Definition 3.2.30**** (NTwDs as NTs).**
An NTwD (η,t):F⇒G:C→D gives rise to an NT (η,t)D=df.(ηΓ,tΓ,A)(Γ,A)∈CD:FD⇒GD:CD→DD.
It is easy to see that this construction (_)D on NTwDs is well-defined.
It in essence implies that an NTwD (η,t):F⇒G:C→D can be seen as an NT (η,t)D:FD⇒GD:CD→DD such that components of η do not depend on D-objects of C, where the two commutative diagrams
{diagram}
for (η,t) in D is unified into the following commutative diagram
{diagram}
in DD for any Γ,Δ∈C, A∈DC(Γ), B∈DC(Δ), φ:Γ→Δ and g:Γ.A\rightarrowtriangleB{φ∘π1} in C.
Thus, we may just apply known results on NTs to NTwDs; for instance:
▶** Lemma 3.2.31**** (Naturality of vertical inverses of NTwDs).**
Given an NTwD (η,t):F⇒G:C→D, if a pair (ϵ,s) of a family ϵ=(ϵΓ)Γ∈C of morphisms ϵΓ:G(Γ)→F(Γ) in D and a family s=(sΓ,A)Γ∈C,A∈DC(Γ) of D-morphisms sΓ,A:G(Γ).G(A)\rightarrowtriangleF(A){ϵΓ∘π1} in D satisfies the equations
[TABLE]
for all Γ∈C and A∈DC(Γ), then the pair (ϵ,s) is an NTwD G⇒F.
Now, let us summarize the constructions (_)D given so far as follows:
▶** Definition 3.2.32**** (The 2-functor (_)D).**
The 2-functor (_)D:SCCD→CAT is given by C↦CD for small SCCwDs C, F↦FD for SCFwDs F and (η,t)↦(η,t)D for NTwDs (η,t).
▶** Proposition 3.2.33**** (Well-defined (_)D).**
The map (_)D is in fact a 2-functor SCCD→CAT.
Proof.
It suffices to show that (_)D preserves composition and identities.
We first show the preservation of composition of 1-cells.
Let C, D and E be SCCwDs.
Given SCFwDs F:C→D and G:D→E, the object-maps of (G∘F)D and GD∘FD clearly coincide.
For their arrow-maps, consider any morphism (ϕ,f):(Δ,D)→(Γ,C) in C; then, we have:
[TABLE]
where it is easy to show ιG∘F(Δ).G∘F(D)G∘F(Δ.D)=G(ιF(Δ).F(D)F(Δ.D))∘ιG(F(Δ)).G(F(D))G(F(Δ).F(D)) by the equations 1, 2 and 3 of Lemma 3.2.17.
Hence, we have shown that (G∘F)D=GD∘FD.
Finally, the preservation of 1-cell identities is immediate, and the preservations of vertical and horizontal compositions of 2-cells, and of vertical and horizontal 2-cell identities are rather trivial.
∎
Given an SCCwD C and an object Γ∈C, we have the subcategory of CD whose objects are pairs (Γ,C) and morphisms are pairs (idΓ,f), where C and f vary, but Γ is fixed.
Then, we may focus on the second components of such pairs, which is equivalent to the following category:
▶** Definition 3.2.34**** (Categories of fixed objects).**
Given an SCCwD C and an object Γ∈C, the category of a fixed object Γ on C is the category CΓ given by:
ob(CΓ)=df.DC(Γ);
CΓ(A,B)=df.DC(Γ.A,B{π1});
A→fB→gC=df.g{⟨π1,f⟩}; and
id(Γ,A)=df.π2.
This structure will be essential when we prove that our generalizations of binary products and exponentials are certain adjoints, and thus they are unique up to isomorphisms.
3.2.6 Isomorphisms between Dependent Objects
Next, we define isomorphisms between D-objects as promised before:
▶** Definition 3.2.35**** (Isomorphisms between D-objects).**
Let C be an SCCwD.
Given Γ,Δ∈C, A∈DC(Γ) and B∈DC(Δ), an isomorphism between A and B is an isomorphism (Γ,A)→∼(Δ,B) in CD.
We call A and B isomorphic and write A≅B iff there is an isomorphism between them.
It is easy to see that an inverse of an isomorphism between D-objects is unique.
▶ Example 3.2.36.
In the SCCwD Sets, D-sets A∈DSets(X) and B∈DSets(Y) are isomorphic iff there is a bijection φ:X→∼Y, and the sets Ax and Bφ(x) are bijective for each x∈X.
Note that it is a fundamental property of functors to preserve isomorphisms between objects.
Similarly, SCFwDs preserve isomorphisms between D-objects as well:
▶** Proposition 3.2.37**** (Preservation of isomorphisms between D-objects under SCFwDs).**
SCFwDs preserve isomorphisms between D-objects.
Proof.
Let F:C→D be an SCFwD, and (ϕ,f):(Δ,D)→∼(Γ,C) in CD.
Let (ψ,g) be the inverse of (ϕ,f), i.e., ψ∘ϕ=idΔ, ϕ∘ψ=idΓ, g{⟨ϕ∘π1,f⟩}=π2 and f{⟨ψ∘π1,g⟩}=π2.
It suffices to establishes the isomorphisms (F(ϕ),F(f){ι}):(F(Δ),F(B))≅(F(Γ),F(A)):(F(ψ),F(g){ι}) in DD.
Clearly, F(ψ)∘F(ϕ)=F(ψ∘ϕ)=F(idΔ)=idF(Δ); and we have:
[TABLE]
Similarly, we have F(ϕ)∘F(ψ)=idF(Γ) and F(f){ι}{⟨F(ψ)∘π1,F(g){ι}⟩}=π2, which completes the proof.
∎
3.3 Cartesian Categories and Functors with Dependence
We have seen in the last section that strict SCCwDs are CwFs, and thus they give a semantics of MLTTs yet without any specific type constructions.
In this section, we give a generalization of terminal objects and semi-Σ-spaces, called unit D-objects and Σ-spaces, which respectively interpret 1- and Σ-types in MLTTs.
We also introduce SCFwDs that preserve these structures.
3.3.1 Cartesian Categories with Dependence
A naive idea to interpret 1-types is to employ D-objects that are to be called terminal.
Note that we may define limits for D-objects and D-morphisms in any SCCwD C to be just limits in the category CD.
Therefore, we may define:
▶** Definition 3.3.1**** (Terminal and initial D-objects).**
A D-object A∈DC(Γ) in an SCCwD C is terminal (resp. initial) iff so is the pair (Γ,A) in the category CD.
Since a terminal (resp. initial) D-object in an SCCwD is unique up to isomorphisms, we may call it the terminal (resp. initial) D-object.
Notice, however, that terminal D-objects cannot interpret 1-type because their universal property does not exactly match the uniqueness rule 1-Uniq.
Thus, we introduce:
▶** Definition 3.3.2**** (Unit D-objects).**
A D-object 1∈DC(T) in an SCCwD C is unit iff T∈C is a terminal object in C, and there is a unique D-morphism !Γ:Γ\rightarrowtriangle1{!Γ}222Note the notational difference between !Γ and !Γ. for each object Γ∈C.
▶ Example 3.3.3.
In a cartesian category C seen as an SCCwD D(C), a terminal object T over itself is also a unit D-object.
▶** Proposition 3.3.4**** (Uniqueness of unit D-objects).**
Unit D-objects are unique up to isomorphisms.
Proof.
Let 1∈DC(T) and 1′∈DC(T′) be both unit D-objects in an SCCwD C.
Then, we have (!T′,!1′):(T,1)≅(T′,1′):(!T,!1) in the category CD, i.e., 1≅1′ in C.
∎
It is almost immediate by the definition that unit D-objects capture 1-type in MLTTs:
▶** Theorem 3.3.5**** (Unit D-objects interpret the 1-type).**
A strict SCCwD equipped with a unit D-object gives rise to a CwF that supports 1-type in the strict sense.
Proof.
Let C be a strict SCCwD equipped with a unit D-object 1∈DC(T).
For each object Γ∈C, we define 1Γ=df.1{!Γ}∈DC(Γ), which interprets the rule Unit-Intro.
Then, it is clear how the remaining axioms for a CwF C that supports 1-type in the strict sense are satisfied.
∎
Note that unit D-objects are terminal, but not necessarily vice versa.
In fact, this pattern will occur repeatedly: Limits in the category of D-objects CD on an SCCwD C in general do not give interpretations of type constructions of MLTTs in C, but their stronger version does.
Next, let us consider (binary) products of D-objects.
However, if we define the binary product of D-objects A∈DC(Γ) and B∈DC(Γ.A) in an SCCwD C as the binary product (Γ,A)×(Γ.A,B) in the category CD, then it would be a D-object A×B∈DC(Γ×Γ.A) in C, which does not match the rule Σ-Form.
Instead, what we need to interpret Σ-types is the following:
▶** Definition 3.3.6**** (Σ-spaces).**
Let C be an SCCwD.
Given Γ∈C, A∈DC(Γ) and B∈DC(Γ.A), a dependent pair (Σ-) space of A and B in C is a D-object Σ(A,B)∈DC(Γ) together with D-morphisms
[TABLE]
in C, called the first and second projections of Σ(A,B), respectively, such that for any ϕ:Δ→Γ, g:Δ\rightarrowtriangleA{ϕ} and h:Δ\rightarrowtriangleB{⟨ϕ,g⟩} in C there exists a unique D-morphism
[TABLE]
in C, called the dependent pairing of g and h, that satisfies
[TABLE]
▶ Notation.
We often omit the superscript Σ(A,B) on ϖiΣ(A,B) (i=1,2).
The universal property of a dependent pairing \Lbagg,h\Rbag:Δ\rightarrowtriangleΣ(A,B){ϕ} may be described as the following commutative diagram:
{diagram}
▶** Proposition 3.3.7**** (Uniqueness of Σ-spaces).**
Σ-spaces are unique up to isomorphisms.
Proof.
Similar to the proof of the uniqueness of semi-Σ-spaces.
∎
▶** Definition 3.3.8**** (CCwDs).**
A cartesian CwD (CCwD) is an SCCwD C that has:
A unit D-object 1∈DC(T);
A Σ-space A{π1}\leftarrowtriangleϖ1Γ.Σ(A,B)\rightarrowtriangleϖ2B{⟨π1,ϖ1⟩} for any triple of Γ∈C, A∈DC(Γ) and B∈DC(Γ.A).
A strict CCwD is a strict SCCwD C=(C,T,_._,π) equipped with a unit D-object 1∈DC(T) and a family Σ=(Σ(A,B))Γ∈C,A∈DC(Γ),B∈DC(Γ.A) of Σ-spaces Σ(A,B)∈DC(Γ) that is coherent in the sense that for any Δ,Γ∈C, A∈DC(Γ), B∈DC(Γ.A) and ϕ:Δ→Γ in C it satisfies
[TABLE]
where ϕ+=df.⟨ϕ∘π1,π2⟩:Δ.A{ϕ}→Γ.A and ϕ⋆=df.⟨ϕ∘π1,π2⟩:Δ.Σ(A,B){ϕ}→Γ.Σ(A,B).
▶ Example 3.3.9.
A cartesian category C seen as an SCCwD D(C) is a CCwD as we may define Σ(A,B)=df.A×B, ϖ1Σ(A,B)=df.π1A×B∘π2Γ×(A×B) and ϖ2A×B=df.π2A×B∘π2Γ×(A×B) for any Γ∈C, A∈DD(C)(Γ) and B∈DD(C)(Γ.A).
We call it a cartesian category seen as a CCwD.
▶** Proposition 3.3.10**** (Associativity of Σ-spaces).**
Let C be an SCCwD, and Γ∈C, A∈DC(Γ), B∈DC(Γ.A) and C∈DC(Γ.Σ(A,B)).
Then, we have isomorphisms
[TABLE]
Proof.
For brevity, let us omit the subscripts and superscripts, and write Pair and Triple for the isomorphisms to establish.
Let us define:
[TABLE]
which has ⟨⟨π1,ϖ1⟩,ϖ2⟩:Γ.Σ(A,B)→Γ.A.B as the inverse Pair−1.
Similarly, we define:
[TABLE]
which has the inverse Triple−1=df.(idΓ,\Lbag\Lbagϖ1,ϖ1{⟨⟨π1,ϖ1⟩,ϖ2⟩}\Rbag,ϖ2{⟨⟨π1,ϖ1⟩,ϖ2⟩}\Rbag).
∎
▶ Notation.
For strict SCCwDs, we rather write PairA,B and TripleA,B,C for PairΓ.Σ(A,B)Σ(Γ.A,B) and TripleΣ(Σ(A,B),C)Σ(A,Σ(B,C{PairΓ.Σ(A,B)Σ(Γ.A,B)})), respectively.
Even for non-strict SCCwDs, however, we often abuse the notation and employ PairA,B and TripleA,B,C for brevity.
▶** Proposition 3.3.11**** (Unit law of Σ-spaces).**
Let C be an SCCwD, and Γ∈C and A∈DC(Γ).
If 1∈DC(T) is a unit D-object, then we have Σ(1{!Γ},A{π1})≅A≅Σ(A,1{!Γ}).
Proof.
Immediate from Proposition 3.3.7.
∎
Thus, as promised before, we have shown that Σ-spaces have a unit D-object 1 and satisfy associativity, generalizing the corresponding properties of binary products.
Now, let us show that coherent Σ-spaces capture strict Σ-types in MLTTs:
▶** Theorem 3.3.12**** (Coherent Σ-spaces interpret Σ-types).**
A strict SCCwD equipped with coherent Σ-spaces induces a CwF that supports Σ-types in the strict sense.
Proof.
Let C=(C,T,_._,π) be a strict SCCwD equipped with a coherent family of Σ-spaces Σ=(Σ,ϖ,\Lbag,_\Rbag).
We equip the corresponding CwF C with Σ-types in the strict sense as follows:
(Σ-Form) Given Γ∈C, A∈DC(Γ) and B∈DC(Γ.A), we have:
[TABLE]
(Σ-Intro) As in the proof of Proposition 3.3.10, we define:
[TABLE]
with the inverse given by:
[TABLE]
(Σ-Elim) Given P∈DC(Σ(Γ,Σ(A,B))) and f∈DC(Σ(Σ(Γ,A),B),P{PairA,B}), let us define:
[TABLE]
(Σ-Comp) We clearly have:
[TABLE]
(Σ-Subst) By the axiom (12).
(Pair-Subst) We clearly have:
[TABLE]
as well as:
[TABLE]
where
[TABLE]
(RΣ-Subst) We have:
[TABLE]
(Σ-Uniq) Finally, given g∈DC(Γ.Σ(A,B),P) such that g{PairA,B}=f, we have:
[TABLE]
which completes the proof.
∎
Note that strict Σ-types in CwFs are reformulated more concisely as strict Σ-spaces in SCCwDs.
In particular, we have rather induced the morphism PairA,B:Γ.A.B→Γ.Σ(A,B) from projections, which seems rather canonical, while it is taken as primitive in NMs [Awo16].
On the other hand, strict Σ-types in CwFs do not always induce Σ-spaces in the corresponding strict SCCwDs as, e.g., there are no obvious projections ϖi.
However, we claim that strict CCwDs are a refinement of CwFs that support 1- and Σ-types in the strict sense, rather than a restriction, as the following instances, including the term models, are formed via CCwDs:
▶ Example 3.3.13.
The SCCwD Sets is cartesian.
A unit D-object in Sets is any singleton D-set 1=(1∙)∙∈T such that 1∙=T.
Given a set X and D-sets A over X and B over X.A, the Σ-space Σ(A,B) in Sets is the D-set ({(a,b)∣a∈Ax,b∈B(x,a) })x∈X over X equipped with the obvious projections and dependent pairings.
The SCCwD Rel is also cartesian in a similar manner.
▶ Example 3.3.14.
The SCCwD GPD is cartesian.
A unit D-object in GPD is a D-groupoid 1:T→GPD that maps ⋆↦T and id⋆↦idT.
Given D-groupoids A:Γ→GPD and B:Γ.A→GPD, the Σ-space Σ(A,B):Γ→GPD in GPD maps each object γ∈Γ to the groupoid A(γ).Bγ, where the D-groupoid Bγ:A(γ)→GPD maps each object a∈A(γ) to the groupoid B(γ,a) and each isomorphism α:a→∼a′ in A(γ) to the functor B(idγ,α):B(γ,a)→B(γ,a′), and each isomorphism ϕ:γ→∼γ′ in Γ to the functor A(ϕ).B(ϕ,A(ϕ)):A(γ).Bγ→A(γ′).Bγ′ that maps each object (a,b)∈A(γ).Bγ to the groupoid (A(ϕ)(a),B(ϕ,A(ϕ))(b)) and each isomorphism (α,β):(a,b)→(a′,b′) in A(γ).Bγ to the functor (A(ϕ)(α),B(ϕ,A(ϕ))(β)):(A(ϕ)(a),B(ϕ,A(ϕ))(b))→(A(ϕ)(a′),B(ϕ,A(ϕ))(b′)).
The projections and dependent pairings of Σ(A,B) are the obvious ones.
▶ Example 3.3.15.
In a similar manner, we may show that the SCCwD CAT is also cartesian.
▶ Example 3.3.16.
The term model T(1,Π,Σ) is a strict CCwD.
The unit D-object is ♢⊢1 type, and the Σ-space of Γ⊢A type and Γ,x:A⊢B type is Γ⊢Σ(A,B) type equipped with projections
[TABLE]
and the dependent pairing of Δ⊢g:A[d] and Δ⊢h:B[⟨d,g⟩], where d:Δ→Γ, is the term
[TABLE]
3.3.2 Dependent Limits
We have seen that a unit D-object and Σ-spaces model 1- and Σ-types in MLTTs.
However, one may wonder if there is any systematic way to understand these constructions, which would be similar to limits that subsume finite products.
This section briefly addresses this point by introducing the notion of dependent limits (D-limits), which is a natural generalization of limits.
As such, the present section is a detour, and thus the reader may skip it without any problem.
▶** Definition 3.3.17**** (D-cones).**
Given an FwD F:I→C, a dependent (D-) cone to F is a triple (Θ,ϕ,f) of an object Θ∈C, a family ϕ=(ϕi)i∈I of morphisms ϕi:Θ→F(i) in C and a family f=(fi,X)i∈I,X∈DI(i) of D-morphisms fi,X:Θ\rightarrowtriangleF(X){ϕi} such that for any morphism μ:i→j in I the diagram
{diagram}
in C commutes, and for any D-morphism x:i\rightarrowtriangleX in I the diagram
{diagram}
in C commutes.
▶** Definition 3.3.18**** (Categories of D-cones).**
Given an FwD F:I→C, the category DCones(F) is defined by:
Objects are D-cones to F;
A morphism (Θ,ϕ,f)→(Ξ,ψ,g) is a morphism σ:Θ→Ξ in C such that the diagrams
{diagram}
in C commute for all i∈I and X∈DI(i);
Composition in DCones(F) is the composition in C;
Identities in DCones(F) are the identities in C.
It is easy to see that DCones(F) is a well-defined category for any FwD F:I→C.
We are now ready to define:
▶** Definition 3.3.19**** (D-limits).**
Let C be a CwD and I a small CwD.
A dependent (D-) limit of shape I in C is the terminal object in the category DCones(F) for any FwD F:I→C.
Clearly, D-limits in a category C seen as a CwD D(C) coincide with limits in C; in this sense, D-limits generalize limits.
On the other hand, by the asymmetry of the domain and codomain of D-morphisms, what should be called dependent (D-) colimits would be more complicated than D-limits.
For the lack of space, we leave the concept of D-limits as future work.
▶ Example 3.3.20.
Let ∅ denote the trivial CwD which has no objects.
The D-limit of shape ∅ in a CwD C is just a terminal object of C.
If we focus on a terminal object of the form T.A∈C, where T∈C is terminal and A∈DC(T), then such D-objects A coincides with unit D-objects:
-
Given an object Γ∈C, there is a D-morphism Γ→!ΓT.A\rightarrowtriangleπ2A{π1}⇒A{!Γ};
2. 2.
Any D-morphism f:Γ\rightarrowtriangleA{!Γ} coincides with π2{!Γ} because
[TABLE]
This pattern applies to Σ-spaces as well:
▶ Example 3.3.21.
Let I be an SCCwD with three objects i,i.X,i.X.Y∈I and two D-objects X∈DI(i) and Y∈DI(i.X).
The D-limit of shape I in a SCCwD C is any diagram
{diagram}
in C such that for any diagram
{diagram}
in C there exists a unique morphism Υ(ϕ,g,h):Δ→Θ such that the diagram
{diagram}
commutes.
Note that we have omitted semi-Σ-spaces and semi-dependent pairings in the above diagrams because they are redundant.
If Θ is of the form Γ.C for some C∈DC(Γ), then ψ=π1, and thus the D-object C coincides with the Σ-space Σ(A,B) up to isomorphisms.
We may further study the concept of D-limits in its own right; for instance, similarly to finite limits, how can we characterize finite D-limits in terms of just a few instances of finite D-limits?
Nevertheless, for the lack of space, we leave it as future work.
3.3.3 Cartesian Functors with Dependence
It is now clear what would be morphisms between CCwDs:
▶** Definition 3.3.22**** (CFwDs).**
A cartesian FwD (CFwD) is an SCFwD F:C→C′ between CCwDs C and C′ such that:
The D-object F(1)∈DC′(F(T)) is unit in C′ for each unit D-object 1∈DC(T);
The diagram F(A){F(π1)}\leftarrowtriangleF(ϖ1)F(Γ.Σ(A,B))\rightarrowtriangleF(ϖ2)F(B){ιF(Γ).F(A)F(Γ.A)}{⟨F(π1),F(ϖ1)⟩} in C′ is a Σ-space of F(A)∈DC′(F(Γ)) and F(B){ιF(Γ).F(A)F(Γ.A)}∈DC′(F(Γ).F(A)) in C′ for a Σ-space A{π1}\leftarrowtriangleϖ1Γ.Σ(A,B)\rightarrowtriangleϖ2B{⟨π1,ϖ1⟩} of any A∈DC(Γ) and B∈DC(Γ.A) in C.
Moreover, given that C and C′ are both strict, written C=(C,T,_._,π,1,Σ,ϖ) and C′=(C′,T′,_.′_,π′,1′,Σ′,ϖ′), F is strict iff it is a strict SCFwD, F(1)=1′, and the diagram
[TABLE]
in C′ coincides with the Σ-space
[TABLE]
in C′ for any A∈DC(Γ) and B∈DC(Γ.A) in C.
Given a CFwD F:C→D, there is an isomorphism
[TABLE]
between D-objects in D for any Σ-space Σ(A,B)∈DC(Γ) in C.
It is easy to see that F is strict iff (idF(Γ),ιA,BF) is the identity for any Σ-space Σ(A,B)∈DC(Γ) in C.
▶ Example 3.3.23.
A cartesian functor F:C→D seen as an SCFwD D(F):D(C)→D(D) is a CFwD because unit D-objects and Σ-spaces are just finite products.
Let us call this kind of CFwDs cartesian functors seen as CFwDs.
Thus, CFwDs are generalized cartesian functors.
▶ Example 3.3.24.
Given a locally small CCwD C and an object Δ∈C, the SCFwD C(Δ,_):C→Sets is cartesian.
Given a unit D-object 1∈DC(T), the D-set C(Δ,1) is unit in Sets because it is a singleton D-set C(Δ,1)=(C(Δ,1{!Δ}))!Δ∈C(Δ,T), and the set C(Δ,1{!Δ}) is a singleton set.
Moreover, given a Σ-space A{π1}\leftarrowtriangleϖ1Γ.Σ(A,B)\rightarrowtriangleϖ2B{⟨π1,ϖ1⟩} of any D-objects A∈DC(Γ) and B∈DC(Γ.A) in C, it is not hard to see that the diagram
[TABLE]
is a Σ-space of D-sets C(Δ,A)∈DSets(C(Δ,Γ)) and C(Δ,B)∈DSets(C(Δ,Γ.A)) in Sets.
3.3.4 The 2-Category of Cartesian Categories with Dependence
It is now clear there is the following 2-category:
▶** Definition 3.3.25**** (The 2-category CCD).**
The 2-category CCD is a sub-2-category of SCCD whose 0-cells are small CCwDs and 1-cells are CFwDs.
▶** Theorem 3.3.26**** (Well-defined CCD).**
The structure CCD is a well-defined sub-2-category of SCCD.
3.4 Cartesian Closed Categories and Functors with Dependence
This is the last section on the basic theory of CwDs, in which we introduce a closed structure on SCCwDs.
On the one hand it gives a categorical semantics of strict Π-types in MLTTs, and on the other hand it provides a categorical generalization of the 2-category CCC of small CCCs.
3.4.1 Cartesian Closed Categories with Dependence
We would like to equip CCwDs with a closed structure to form a generalization of CCCs.
Then, as a generalization of exponentials, the following construction seems appropriate:
▶** Definition 3.4.1**** (Pseudo-Π-spaces).**
Let C be an SCCwD, Γ∈C, A∈DC(Γ) and B∈DC(Γ.A).
A pseudo-dependent map (pseudo-Π-) space from A to B in C is a D-object
[TABLE]
equipped with a D-morphism
[TABLE]
in C, called the dependent (D-) evaluation of Π(A,B), where
[TABLE]
such that for any D-morphism in C of the form f:Γ.A\rightarrowtriangleB there exists a unique D-morphism
[TABLE]
in C, called the dependent (D-) currying of f, that satisfies the equation
[TABLE]
where
[TABLE]
Pseudo-Π-spaces, D-evaluations and D-currying are, as their names suggest, intended to be generalizations of exponentials, evaluations and currying, respectively.
To make this point explicit, let us draw the following commutative diagram that depicts the universal property of a pseudo-Π-space Π(A,B)∈DC(Γ):
{diagram}
which can be given in a CCC C=(C,T,×,p,⇒,ev) by:
{diagram}
Unfortunately, however, pseudo-Π-spaces are not unique up to isomorphisms because the canonical morphisms between pseudo-Π-spaces from the same D-object A∈DC(Γ) to the same D-object B∈DC(Γ.A) (specifically, they are A,B and A,B in the proof of Proposition 3.4.8 below) are not inverses to each other.
By a similar mechanism, they do not give rise to functors.
In other words, pseudo-Π-spaces are a categorically incomplete structure.
To overcome this point, let us define:
▶** Definition 3.4.2**** (Π-spaces).**
A pseudo-Π-space Π(A,B) from A∈DC(Γ) to B∈DC(Γ.A) in an SCCwD C is a dependent map (Π-) space from A to B in C iff for any D-object C∈DC(Γ) the pair Π(A,B){π1}=(Π(A,B){π1},devΠ(A,B){π1}) such that
[TABLE]
is a pseudo-Π-space from A{π1}∈DC(Γ.C) to B{π1⋆A}∈DC(Γ.C.A{π1}) in C that satisfies
[TABLE]
for any D∈DC(Γ), h:Γ.C.A{π1}\rightarrowtriangleB{π1⋆A} and g:Γ.D\rightarrowtriangleC{π1} in C, where
[TABLE]
The additional universal properties (15) and (16) of a Π-space Π(A,B)∈DC(Γ) may be depicted as the following commutative diagrams:
{diagram}
where Λ(h{⟨π1,g⟩+})=df.ΛΠ(A,B){π}(h{⟨π1,g⟩+A{π1}}).
Proposition 3.4.8 below verifies the uniqueness of Π-spaces up to isomorphisms, where the additional axioms (15) and (16) play essential roles.
Also, it is straightforward to see that Π-spaces (and pseudo-Π-spaces) in a cartesian category seen as a CCwD coincide with exponentials, where note that D-evaluations do not depend on objects, and thus they are essentially the same as evaluations.
We then define the promised generalization of CCCs as follows:
▶** Definition 3.4.3**** (SCCCwDs).**
A semi-cartesian closed CwD (SCCCwD) is an SCCwD C that has for any triple of Γ∈C, A∈DC(Γ) and B∈DC(Γ.A) a Π-space from A to B in C.
A strict SCCCwD is a strict SCCwD C equipped with a family Π=(Π(A,B))Γ∈C,A∈DC(Γ),B∈DC(Γ.A) of Π-spaces Π(A,B)∈DC(Γ) in C that is coherent in the sense that it satisfies the equations
[TABLE]
for any Δ,Γ∈C, A∈DC(Γ), B∈DC(Γ.A) and ϕ:Δ→Γ in C, where
[TABLE]
▶** Definition 3.4.4**** (CCCwDs).**
A cartesian closed CwD (CCCwD) is a CCwD that is semi-cartesian closed.
A strict CCCwD is a strict CCwD that is strictly semi-cartesian closed.
Note that the coherence axioms (17) and (18) on strict SCCCwDs are necessary to interpret strict Π-types in MLTTs; see the proof of Theorem 3.4.15 below.
Now, let us prove some of the expected properties of Π-spaces, including their uniqueness up to isomorphisms (Proposition 3.4.8), as a generalization of exponentials.
▶** Lemma 3.4.5**** (Transpositions in pseudo-Π-spaces).**
Let C be an SCCwD, Γ∈C, A∈DC(Γ) and B∈DC(Γ.A).
If Π(A,B)∈DC(Γ) is a pseudo-Π-space from A to B in C, then there is a bijection
[TABLE]
Proof.
There is the function DC(Γ.A,B)→DC(Γ,Π(A,B)) that maps f↦ΛΠ(A,B)(f), and also there is the inverse DC(Γ,Π(A,B))→DC(Γ.A,B) that maps g↦devΠ(A,B){(g)+A{π1}}, where it is easy to verify that these maps are inverses to each other and thus left to the reader.
∎
▶ Notation.
By Lemma 3.4.5, it is legitimate to write ΛΠ(A,B)−1:DC(Γ,Π(A,B))→DC(Γ.A,B) for the map
[TABLE]
▶** Lemma 3.4.6**** (First Π-lemma).**
Let C be an SCCwD, Γ∈C, A∈DC(Γ) and B∈DC(Γ.A).
If Π(A,B)∈DC(Γ) is a Π-space from A to B in C, then we have:
[TABLE]
Proof.
By the universal property of the pseudo-Π-space Π(A,B){π1}∈DC(Γ.Π(A,B)) in C, it suffices to establish the equation
[TABLE]
Then, observe that:
[TABLE]
which completes the proof.
∎
▶** Lemma 3.4.7**** (Second Π-lemma).**
Let C=(C,T,_._,π,Π,dev) be a strict SCCCwD.
Given Δ,Γ∈C, ϕ:Δ→Γ, A∈DC(Γ), B∈DC(Γ.A) and f:Γ.A\rightarrowtriangleB in C, we have:
[TABLE]
Proof.
By the universal property of the coherent family Π of the Π-spaces in C, it suffices to show the equation
[TABLE]
Then, we have:
[TABLE]
which completes the proof.
∎
▶** Proposition 3.4.8**** (Uniqueness of Π-spaces).**
In any SCCwD C, every Π-space in C is unique up to isomorphisms.
More precisely, if Γ∈C, A∈DC(Γ) and B∈DC(Γ.A), and Π(A,B),Π′(A,B)∈DC(Γ) are both Π-spaces from A to B in C, then Π(A,B)≅Π′(A,B).
Proof.
First, we have the following two D-morphisms in C:
[TABLE]
It suffices to show that these D-morphisms are inverses to each other.
Then, observe that:
[TABLE]
By symmetry, we also have A,B{⟨π1,A,B⟩}=π2.
Moreover, the D-morphism
[TABLE]
where
[TABLE]
satisfies
[TABLE]
And again by symmetry, devΠ′(A,B){⟨π1,A,B⟩+A{π1}}=devΠ(A,B), completing the proof.
∎
At this point, we hope that the reader has been convinced that Π-spaces are a reasonable generalization of exponentials.
Then, let us define a generalization of CCCs:
▶** Definition 3.4.9**** (SCCCwDs).**
A semi-cartesian closed CwD (SCCCwD) is an SCCwD C that has Π-spaces, i.e., a Π-space Π(A,B)∈DC(Γ) for any Γ∈C, A∈DC(Γ) and B∈DC(Γ.A).
An SCCCwD is strict if it is a strict SCCwD equipped with specified Π-spaces.
▶** Definition 3.4.10**** (CCCwDs).**
A cartesian closed CwD (CCCwD) is a CCwD that is semi-cartesian closed.
A CCCwD is strict if it is a strict CCwD equipped with specified Π-spaces.
▶ Example 3.4.11.
As observed above, a (resp. strict) cartesian category C seen as a (resp. strict) CCwD D(C) is closed iff so is C.
Hence, (resp. strict) CCCwDs are a generalization of (resp. strict) CCCs.
Let us call this kind of CCCwDs CCCs seen as CCCwDs.
▶ Example 3.4.12.
The CCwD Sets is cartesian closed. Given X∈Sets, A∈DSets(X) and B∈DSets(X.A), we define Π(A,B) to be the D-set
[TABLE]
Given a D-function f:X.A\rightarrowtriangleB, its D-currying ΛA,B(f):X→Π(A,B) maps
[TABLE]
and the D-evaluation devA,B:X.Π(A,B).A{π1}\rightarrowtriangleB{π1+A} maps
[TABLE]
It is easy to see that these Π-spaces in Sets satisfy the required axioms.
▶ Example 3.4.13.
The CCwD GPD is cartesian closed.
Given a groupoid Γ, and D-groupoids A:Γ→GPD and B:Γ.A→GPD, there is the D-groupoid Π(A,B):Γ→GPD defined by:
First, as shown in [HS98], the set DGPD(Γ,A) may be seen as the groupoid whose objects are D-groupoid morphisms f:Γ\rightarrowtriangleA, where note that f=df.⟨idΓ,f⟩:Γ→Γ.A is a functor, and isomorphisms f→g are families η=(ηγ)γ∈Γ of isomorphisms ηγ:f(γ)→g(γ) in A(γ) such that η=(ηγ)γ∈Γ, where ηγ=df.(idγ,ηγ):f(γ)→g(γ), forms an NT f→g.
Then, again as shown in [HS98], the D-groupoid Π(A,B):Γ→GPD maps each object γ∈Γ to the groupoid
[TABLE]
and each isomorphism ϕ:γ→∼γ′ in Γ to the functor
[TABLE]
that maps each D-groupoid homomorphism f∈DGPD(A(γ),Bγ) to another
[TABLE]
and each isomorphism η:f→∼g in DGPD(A(γ),Bγ) to the natural isomorphism
[TABLE]
whose component on each a′∈A(γ′) is given by:
[TABLE]
The D-evaluation devA,B:Γ.Π(A,B).A{π1}\rightarrowtriangleB{π1+A} in GPD is the D-groupoid homomorphism that maps
[TABLE]
and the D-currying Λ(h):Γ\rightarrowtriangleΠ(A,B) of a D-groupoid homomorphism h:Γ.A\rightarrowtriangleB maps
[TABLE]
It is not hard to see that these Π-spaces in GPD satisfy the required axioms.
▶ Example 3.4.14.
The term model T(1,Π,Σ) is a CCCwD. Π-spaces are given by Π-Form, devA,B by Π-Elim for terms Γ,f:Π(A,B),x:A⊢f(x):B[f(x)] and D-currying by Π-Intro.
Now, let us prove that a coherent family of Π-spaces interprets strict Π-types in MLTTs:
▶** Theorem 3.4.15**** (Coherent Π-spaces interpret Π-types).**
A strict SCCCwD induces a CwF that supports Π-types in the strict sense.
Proof.
Let C=(C,T,_._,π,Π,dev) be a strict SCCCwD.
We equip the corresponding CwF C with Π-types in the strict sense as follows:
(Π-Form) Given Γ∈C, A∈DC(Γ) and B∈DC(Σ(Γ,A)), we have:
[TABLE]
(Π-Intro) Given f∈DC(Γ.A,B), we define:
[TABLE]
(Π-Elim) Recall that there is the inverse ΛΠ(A,B)−1 of the D-currying map ΛΠ(A,B) as shown in the proof of Lemma 3.4.5.
Given g∈DC(Γ,Π(A,B)) and a∈DC(Γ,A), we define:
[TABLE]
where a=⟨idΓ,a⟩:Γ→Σ(Γ,A).
(Π-Comp) It is easy to see that:
[TABLE]
(Π-Subst) By the axiom (17).
(λ-Subst) By Lemma 3.4.7.
(App-Subst) It is easy to see that:
[TABLE]
where a{ϕ}=df.⟨idΔ,a{ϕ}⟩:Δ→Σ(Δ,A{ϕ}).
(Π-Uniq) Given k∈Tm(Γ.A,Π(A,B){π1}), observe that:
[TABLE]
which completes the proof.
∎
Hence, Theorems 2.2.8, 3.3.5, 3.3.12 and 3.4.15 implies:
▶** Corollary 3.4.16**** (CCCwDs and CwFs).**
A strict CCCwD induces a CwF that supports 1-, Σ- and Π-types in the strict sense, and thus it gives a sound interpretation of MLTT(1,Π,Σ).
Also, since the term model T(1,Π,Σ) forms a strict CCCwD, we have:
▶** Theorem 3.4.17**** (Completeness theorem).**
The interpretation of MLTT(1,Π,Σ) in CCCwDs is complete in the sense of Theorem 2.2.9.
Since Σ- and Π-spaces in CCCwDs are respectively generalizations of binary products and of exponentials in CCCs, respectively, it is expected that the former is left adjoint to the latter.
Let us see that it is in fact the case (up to the first projections) as follows.
First, let us consider Σ-spaces.
Clearly, we have the correspondence
{diagram}
where Γ∈C, B,D∈DC(Γ) and C∈DC(Γ.B), which induces an adjunction
{diagram}
where the functor _{π1Γ.B}:CΓ→CΓ.B maps
[TABLE]
and the functor Σ(B,_):CΓ.B→CΓ maps
[TABLE]
whose functorialities are both easy to verify.
Next, let us think of Π-spaces.
Note that Lemma 3.4.5 gives the bijective correspondence
{diagram}
for any Γ∈C, B∈CΓ and C∈CΓ.B, but it is not an adjunction.
Then, following the term model construction of DTTs in [Jac99], we slightly modify this correspondence into
{diagram}
for each A∈CΓ, which gives an adjunction
{diagram}
where Π(B,_):CΓ.B→CΓ maps
[TABLE]
whose functoriality (specifically the preservation of composition) is by the axioms (15) and (16).
Therefore, we may compose the two adjunctions to obtain the adjunction:
{diagram}
which particularly implies the correspondence
{diagram}
between Σ and Π up to the first projections.
3.4.2 Cartesian Closed Functors with Dependence
Again, following the general recipe that morphisms are structure-preserving, let us define:
▶** Definition 3.4.18**** (CCFwDs).**
A cartesian closed FwD (CCFwD) is a CFwD F:C→D between CCCwDs C and D such that the diagram
[TABLE]
forms a Π-space from F(A)∈DD(F(Γ)) to F(B){ιF(Γ).F(A)F(Γ.A)}∈DD(F(Γ).F(A)) in D for any Γ∈C, A∈DC(Γ) and B∈DC(Γ.A) in C.
If C and D are both strict, F is strict iff it is a strict CFwD, and the diagram
[TABLE]
coincides with the Π-space
[TABLE]
for any Γ∈C, A∈DC(Γ) and B∈DC(Γ.A) in C.
▶ Example 3.4.19.
A (resp. strict) cartesian closed functor F:C→D seen as a CFwD D(F):D(C)→D(D) is clearly (resp. strictly) closed.
▶ Example 3.4.20.
Given a locally small CCCwD C and an object Δ∈C, the CFwD C(Δ,_):C→Sets is closed.
In fact, given a Π-space Γ.Π(A,B).A{π1}\rightarrowtriangledevΠ(A,B)B{π1+A} in C, the diagram
[TABLE]
in Sets forms a Π-space from the D-set C(Δ,A)∈DSets(C(Δ,Γ)) to another C(Δ,B)∈DSets(C(Δ,Γ.A)).
3.4.3 The 2-Category of Cartesian Closed Categories with Dependence
Finally, let us summarize what we have established in this section as the following 2-category:
▶** Definition 3.4.21**** (The 2-category CCCD).**
The 2-category CCCD is the sub-2-category of CCD whose 0-cells are small CCCwDs and 1-cells are CCFwDs.
▶** Theorem 3.4.22**** (Well-defined CCCD).**
CCCD* is a well-defined sub-2-category of CCD.*
Proof.
It suffices to show that the composition G∘F:C→E of any CCFwDs F:C→D and G:D→E is again a CCFwD.
But then, it is immediate because the equation
[TABLE]
holds for any Γ∈C and A∈DC(Γ) in C by the universal property of semi-Σ-spaces.
∎
We have established a generalization of CCCs, whose strict version gives a categorical yet direct semantics of MLTTs.
In the rest of the paper, we shall make these relations with CCCs and with MLTTs more precise by establishing certain 2-equivalences.
4 Equivalence between CtxCCCs and ConCtxCCCwDs
This section is devoted to establish a 2-equivalence between the 2-category of contextual CCCs and the 2-category of constant contextual CCCwDs, where contextuality refers to strictness plus reachability [Pit01] of any object from a terminal object via binary products or semi-Σ-spaces.
The rest of the section proceeds roughly as follows.
We first define contextual CCCs and contextual CCCwDs in Section 4.1 and Section 4.2, respectively.
And then, we establish the promised 2-equivalence (Theorem 4.3.7) in Section 4.3.
4.1 Contextual Cartesian Closed Categories
Let us begin with introducing contextual CCCs, which are similar to contextual categories given by Cartmell [Car86]:
▶** Definition 4.1.1**** (CtxCCCs).**
A contextual CCC (CtxCCC) is a strict CCC, i.e., a CCC C equipped with specified finite products (T,×,p) and exponentials (⇒,ev), together with a class AC⊆ob(C) of objects in C, whose elements are called atomic objects in C, such that T∈AC, and each object Δ∈C has a unique finite sequence Δ1,Δ2,…,Δ#(Δ)∈AC∗ of atomic objects in C that satisfies
[TABLE]
where × is left associative.
We call the natural number #(Δ) the length of Δ.
Note that in STTs each context is of the form ♢,x1:A1,x2:A2,…,xk:Ak.
Atomic objects in contextual CCCs are a categorical abstraction of such atomic constituents xi:Ai of contexts.
▶** Definition 4.1.2**** (CtxCCFs).**
A contextual cartesian closed functor (CtxCCF) is a strict cartesian closed functor F:C→D between CtxCCCs C and D that preserves atomic objects, i.e.,
[TABLE]
▶** Definition 4.1.3**** (The 2-category CtxCCC).**
The 2-category CtxCCC is the sub-2-category of the 2-category CCC of small CCCs whose 0-cells are small CtxCCCs, 1-cells are CtxCCFs, and 2-cells are NTs.
Clearly, CtxCCC is a well-defined 2-category.
4.2 Contextual Cartesian Closed Categories with Dependence
Next, let us define the contextual analogue of SCCwDs:
▶** Definition 4.2.1**** (CtxSCCwDs).**
A contextual SCCwD (CtxSCCwD) is a strict SCCwD C=(C,T,_._,π) such that:
Each constant D-object A∈DC(Γ) satisfies
[TABLE]
for a unique D-object A∈DC(T), called the core of A; and
Each object Δ∈C has a unique finite sequence D1∈DC(T),D2∈DC(T.D1),…,D♯(Δ)∈DC(T.D1.D2…D♯(Δ)−1) of D-objects that satisfies
[TABLE]
where we call the natural number #(Δ) the length of Δ.
▶** Lemma 4.2.2**** (CtxSCCwD-lemma).**
Let F:C→C′ be a strict SCFwD between CtxSCCwDs C and C′. Then, we have:
-
A{ϕ}=A{!Δ};
2. 2.
F(!Γ)= !F(Γ); and
3. 3.
F(A)=F(A)**
for any objects Δ,Γ∈C, morphism ϕ:Δ→Γ in C and constant D-object A∈DC(Γ).
Proof.
The first and the second equations are immediate, and the third equation follows from the second.
∎
▶** Definition 4.2.3**** (CtxCCCwDs).**
A contextual CCCwD (CtxCCCwD) is a strict CCCwD such that the underlying strict SCCwD is contextual.
▶** Definition 4.2.4**** (The 2-category CtxCCCD).**
The 2-category CtxCCCD is the sub-2-category of CCCD whose 0-cells are small CtxCCCwDs, 1-cells are strict CCFwDs, and 2-cells are NTwDs.
▶** Definition 4.2.5**** (The 2-category ConCtxCCCD).**
The 2-category ConCtxCCCD is the full sub-2-category of CtxCCCD whose 0-cells are all constant.
4.3 Equivalence between CtxCCCs and ConCtxCCCwDs
Finally, we define 2-functors D:CtxCCC⇄ConCtxCCCD:S, and show that they constitute a 2-equivalence between the 2-categories.
Let us begin with defining the functor D:CtxCCC→ConCtxCCCD, which just summarizes the operation D described so far:
▶** Definition 4.3.1**** (The 2-functor D).**
The 2-functor D:CtxCCC→ConCtxCCCD maps:
Each CtxCCC C=(C,AC,T,×,p,⇒,ev) to the constant CtxCCCwD D(C) such that:
[TABLE]
for all Δ,Γ∈D(C), Θ∈DD(C)(Γ), Ξ∈DD(C)(Γ.Θ), ψ∈DD(C)(Γ,Θ) and ϕ:Δ→Γ in D(C);
Each CtxCCF F:C→D to the strict CCFwD D(F):D(C)→D(D) given by:
[TABLE]
Each NT η:F⇒G:C→D to the NTwD D(η)=df.(η,tD(η)):D(F)⇒D(G):D(C)→D(D), where tD(η) is given by:
[TABLE]
for all Γ∈D(C) and Θ∈DD(C)(Γ).
▶ Remark.
The domain of D must be CtxCCC, not CCC, since the domain of the functor S given below must be ConCtxCCCD.
▶** Lemma 4.3.2**** (Well-defined D).**
The 2-functor D is well-defined.
Proof.
Straightforward.
∎
Next, we need a preliminary operation before defining the 2-functor S:
▶** Definition 4.3.3**** (Right-shifting).**
Let C be a constant CtxCCCwD, where T∈C is the specified terminal object.
Given an object Δ∈C such that Δ=T, we define a D-object RC(Δ)∈DC(T), called the right-shifting of Δ, by induction on the length of Δ:
[TABLE]
together with a morphism rC(Δ):T.RC(Δ)→Δ and a D-morphism ℓC(Δ):Δ\rightarrowtriangleRC(Δ){!Δ} given by:
[TABLE]
▶ Notation.
We often omit the subscript C on RC, rC and ℓC if it does not bring any confusion.
▶** Lemma 4.3.4**** (Right-shifting-lemma).**
Given a constant CtxCCCwD C, where T∈C is the specified terminal object, the operations RC, rC and ℓC are all well-defined, and we have:
[TABLE]
for all Δ∈C such that Δ=T.
Proof.
By induction on the length of Δ.
∎
Now, we are ready to define:
▶** Definition 4.3.5**** (The 2-functor S).**
The 2-functor S:ConCtxCCCD→CtxCCC maps each constant CtxCCCwD D=(D,T,_._,π,1,Σ,ϖ,Π,dev) to the CtxCCC S(D) given by:
The underlying category is D equipped with the terminal object T∈D;
AS(D)=df.{T}∪{T.A∣A∈dob(D)};
Given Δ,Γ∈S(D), we define the product of Δ and Γ by:
[TABLE]
Given Γ,Δ∈S(D), we define the exponential ΓΔ×Δ→evΔ,ΓΓ, where ΓΔ=df.Δ⇒Γ, by induction on the length of Γ:
[TABLE]
and maps each CtxCCF F and NTwD (η,t) to their respective restrictions
[TABLE]
to 0-cells and 1-cells.
▶** Lemma 4.3.6**** (Well-defined S).**
The 2-functors S is well-defined.
Proof.
Let D=(D,T,_._,π,1,Σ,ϖ,Π,dev) be a constant CtxCCCwD.
It suffices to show that the binary products and the exponentials in S(D) are well-defined since then it is clearly contextual.
Let us first consider binary products.
Given Θ,Δ,Γ∈S(D), ϕ:Θ→Δ and ψ:Θ→Γ in S(D), we define the pairing (ϕ,ψ):Θ→Δ×Γ of ϕ and ψ to be
[TABLE]
Then, we have:
[TABLE]
and
[TABLE]
Moreover, given φ:Θ→Δ.RC(Γ){!} in S(D), we have:
[TABLE]
Hence, the diagram Δ←p1Δ×Γ→p2Γ is a well-defined product of Δ and Γ.
Next, let us consider the exponential Δ⇒Γ from Δ to Γ.
Since the base case Γ=T is trivial, assume Γ=Γ′.A for some Γ′∈D and A∈DD(Γ′).
Given ϑ:Θ×Δ→Γ′.A in S(D), we define:
[TABLE]
such that:
[TABLE]
and for any κ:Θ→(Δ⇒Γ) in S(D) we have:
[TABLE]
which establishes that the exponential Δ⇒Γ in S(D) is well-defined.
∎
▶** Theorem 4.3.7**** (DS-theorem).**
There is the 2-equivalence:
[TABLE]
Proof.
First, the 2-natural isomorphism η:idCtxCCC→∼S∘D has the identity CtxCCF idC:C→∼C as the component ηC:C→∼S∘D(C) for each CtxCCC C, whose naturality is obvious.
Next, the 2-natural isomorphism ϵ:D∘S→∼idConCtxCCCD has for each constant CtxCCCwD D as the component ϵD:D∘S(D)→D the strict CCFwD D∘S(D)→D that maps objects and morphisms in D∘S(D) to themselves, D-objects T.A∈DD∘S(D)(Γ) (resp. T∈DD∘S(D)(Γ)) to A{!Γ}∈DD(Γ) (resp. 1{!Γ}∈DD(Γ)), and D-morphisms f∈DD∘S(D)(Γ,T.A) (resp. !Γ∈DD∘S(D)(Γ,T)) to π2{f}∈DD(Γ,A{!Γ}) (resp. !Γ∈DD(Γ,1{!Γ})), which has the obvious inverse.
For naturality of ϵ, let D,D′∈ConCtxCCCD; then, it is easy to see that the diagram
{diagram}
commutes by Lemma 4.2.2, which completes the proof.
∎
In particular, the 2-natural isomorphism ϵ:D∘S→∼idConCtxCCCD in the proof of Theorem 4.3.7 induces for each constant CtxCCCwD D, an object Γ∈D and a D-object A∈DD(Γ) the bijective correspondence
[TABLE]
between D-morphisms Γ\rightarrowtriangleA and morphisms Γ→T.A in D.
In the term models of STLCs, this explains why we may identify terms and singleton context morphisms.
Combined with the main result in the next section, we may recover the conventional interpretation of STLCs in CCCs from our interpretation of them in CtxCCCwDs.
5 Correspondence between MLTTs and CCCwDs
In this final section, analogous to the 2-categorical correspondence between CCCs and STLCs, we establish a 2-categorical correspondence between CCCwDs and MLTTs.
5.1 Algebras for MLTTs
▶** Definition 5.1.1**** (Structures for MLTTs).**
Let T be an MLTT and C=(C,T,_._,π,1,Σ,ϖ,Π,dev) a strict CCCwD.
A structure for T in C is an assignment S of:
A pair of an object S(FT(C))∈C and a D-object S(C)∈DC(S(FT(C))) to each type-constant C∈CT;
A triple of an object S(FTdom(F))∈C, a D-object S(FTcod(F))∈DC(S(FTdom(F))) and a D-morphism S(F)∈DC(S(FTdom(F)),S(FTcod(F))) to each term-constant F∈CT.
▶** Definition 5.1.2**** (The partial interpretation of MLTTs by structures).**
Let T be an MLTT and C=(C,T,_._,π,1,Σ,ϖ,Π,dev) a strict CCCwD.
Any structure S for T in C induces the partial interpretation [[_]]S of MLTT(1,Π,Σ) in the induced CwF C that supports 1-, Π- and Σ-types in the strict sense that extends Definition 2.2.7 to T by:
[TABLE]
for all type-constants C∈CT(A1,A2,…,Ak), term-constants F∈CT(A1,A2,…,Ak;B) and pre-context morphisms f.
▶ Remark.
It is partially defined because f may not be a well-defined context morphism with the appropriate domain and codomain.
▶** Definition 5.1.3**** (Algebras for MLTTs).**
An algebra for an MLTT T (or a T-algebra) in a strict CCCwD C is a structure S for T in C such that the induced partial interpretation [[_]]S satisfies:
If C∈CT(A1,A2,…,Ak) is a type-constant, and ⊢Tx1:A1,x2:A2,…,xk:Ak ctx, then [[x1:A1,x2:A2,…,xk:Ak]]S≃S(FT(C))333It of course means that both sides are defined because so is the right-hand side. The same remark is applied to similar cases below.;
If F∈CT(A1,A2,…,Ak;B) is a term-constant, and x1:A1,x2:A2,…,xk:Ak⊢TB type, then [[x1:A1,x2:A2,…,xk:Ak]]S≃S(FTdom(F)) and [[B]]S≃S(FTcod(F));
If A=A′:Ty∈AT, then [[A]]S≃[[A′]]S;
If a=a′:A∈AT, then [[a]]S≃[[a′]]S.
▶** Lemma 5.1.4**** (Substitution lemma).**
Let T be an MLTT.
Given an algebra S for T in a strict CCCwD C, the induced interpretation [[_]]S of T in C satisfies:
[TABLE]
for all pre-types A, pre-terms a and pre-context morphisms f and f in T.
Proof.
Since the lemma has been established for MLTT(1,Π,Σ) by induction on the lengths of the pre-syntax A, a and g in [Hof97], it suffices to consider the case A≡C(h) and a≡F(h) for some C∈CTTy and F∈CTTm.
Then, observe that:
[TABLE]
for any pre-context morphism f in T.
In the same manner, we may show that [[F(h)]]S{[[f]]S}≃[[F(h)[f]]]S for any pre-context morphism f in T.
Finally, [[g]]S{[[f]]S}≃[[g∘f]]S for any pre-context morphisms f and g in T may be shown by induction on the length of g, completing the proof.
∎
▶** Theorem 5.1.5**** (Soundness of algebras for MLTTs).**
The interpretation [[_]]S of an MLTT T in a strict CCCwD C induced by an algebra S for T in C is sound.
Proof.
It suffices to consider the additional four rules: Type-Const, Term-Const, Type-Eq and Term-Eq.
Let us first consider a type Γ⊢C(f) type generated by the rule Type-Const, where C∈CT(A1,A2,…,Ak).
Since T is well-formed, f is a context morphism Γ→Δ in T, where Δ≡df.x1:A1,x2:A2,…,xk:Ak.
By the induction hypothesis, [[f]]S is a morphism [[Γ]]S→[[Δ]]S in C.
Also, S(FT(C))=[[Δ]]S for S is a T-algebra.
Therefore, we have:
[TABLE]
Similarly, with the help of Lemma 5.1.4, we may handle the rule Term-Const.
Finally, the remaining two rules Type-Eq and Term-Eq are even simpler to deal with.
∎
▶** Definition 5.1.6**** (Generic models of MLTTs).**
Let T be an MLTT.
The generic model of T is a structure G for T in the classifying CCCwD Cl(T) defined by:
[TABLE]
for all type-constants C∈CT(A1,A2,…,Ak) and term-constants F∈CT(A1,A2,…,Ak;B).
▶** Lemma 5.1.7**** (G-lemma).**
The generic model G of any MLTT T is an algebra for T in the classifying CCCwD Cl(T).
Moreover, the induced interpretation [[_]]G of T in Cl(T) by G satisfies:
-
[[⊢Γ ctx]]G=[⊢Γ ctx]* for any context ⊢Γ ctx in T;*
2. 2.
[[Γ⊢A type]]G=[Γ⊢A type]* for any type Γ⊢A type in T;*
3. 3.
[[Γ⊢a:A]]G=[Γ⊢a:A]* for any term Γ⊢a:A in T;*
4. 4.
[[Γ⊢A type]]G=[[Γ⊢A′ type]]G* iff Γ⊢A=A′ type is a theorem of T for any types Γ⊢A type and Γ⊢A′ type in T; and*
5. 5.
[[Γ⊢a:A]]G=[[Γ⊢a′:A]]G* iff Γ⊢a=a′:A is a theorem of T for any terms Γ⊢a:A and Γ⊢a′:A in T.*
Proof.
Again, it suffices to consider the four rules, but it is just straightforward.
∎
▶** Lemma 5.1.8**** (Universal property of generic models).**
Let S be an algebra for an MLTT T in a CCCwD C.
Then, there exists a strict CCFwD US:Cl(T)→C such that US∘[[_]]G=[[_]]S, and such a CCFwD US is unique up to NIwDs.
Proof.
Since the proof just follows the proof of the corresponding statement in [Pit01], here we just give a proof sketch.
Let us define the CCFwD US:Cl(T)→C by:
[TABLE]
It is easy to verify that US is cartesian closed.
Also, we may show that US∘[[_]]G=[[_]]S by induction on derivations of judgements.
Finally, uniqueness of US is straightforward to establish.
∎
▶** Definition 5.1.9**** (Morphisms between algebras for MLTTs).**
Let T be an MLTT, and S and R T-algebras in a strict CCCwD C.
A T-morphisms from S to R is an NTwD US→UR.
▶** Definition 5.1.10**** (Categories of algebras for MLTTs).**
Given an MLTT T and a strict CCCwD C, the category T-ALG(C) is given by:
Objects are T-algebras in C;
Morphisms S→R are T-morphisms from S to R;
Composition is the vertical composition of NTwDs; and
Identities are identity NTwDs.
Given an MLTT T, if we regard T-algebras S in a strict CCCwD C as the strict CCFwDs US:Cl(T)→C, then the category T-ALG(C) is clearly a subcategory of CCCD(Cl(T),C).
It then turns out that this construction constitutes the following equivalence of categories:
▶** Corollary 5.1.11**** (Equivalence between algebras and interpretations).**
Given an MLTT T and a strict CCCwD C, we have T-ALG(C)≃CCCD(Cl(T),C).
Proof.
Let us define the functor U(_)T,C:T-ALG(C)→CCCD(Cl(T),C) that maps T-algebras S in C to the induced CCFwDs US:Cl(T)→C, and 1- and 2-cells in T-ALG(C) to themselves.
Then, it suffices to show that this functor U(_)T,C is essentially surjective on objects.
Let F:Cl(T)→C be any CCFwD.
Note that F is completely determined up to NIwDs by its restriction to types of the form Γ⊢TC(f) type, where C∈CTTy, and terms of the form Γ⊢TF(f):B(f), where F∈CTTm.
But then, this restriction of F clearly defines a T-algebra S in C such that US≅F, which completes the proof.
∎
5.2 Theory-Category Correspondence between MLTTs and CCCwDs
▶** Definition 5.2.1**** (The 2-category MLTT).**
The 2-category MLTT is given by:
0-cells are MLTTs;
The hom-category MLTT(T,T′) for each pair T,T′∈MLTT is T-ALG(Cl(T′));
The composition functor MLTT(T,T′)×MLTT(T′,T′′)→MLTT(T,T′′) for each triple T,T′,T′′∈MLTT is given by the composition of CCFwDs and the horizontal composition of NTwDs; and
The functor 1→MLTT(T,T) for each T∈MLTT maps the unique object ⋆∈1 to the generic model G of T and the unique morphism id⋆ to the identity NTwD idUG.
Note that the 2-category MLTT is essentially the sub-2-category of CCCD whose 0-cells are the classifying CCCwDs of MLTTs, and 1-cells are the CCFwDs US induced by algebras S for MLTTs.
Thus, it is easy to see that MLTT is a well-defined 2-category.
Moreover, we have:
▶** Theorem 5.2.2**** (Theory-category correspondence between MLTTs and CCCwDs).**
The 2-categories MLTT and CCCD are 2-equivalent.
More precisely, the 2-functor Cl:MLTT→CCCD is essentially surjective on objects, and the functor ClT,T′:MLTT(T,T′)→CCCD(Cl(T),Cl(T′)) constitues an equivalence MLTT(T,T′)≃CCCD(Cl(T),Cl(T′)) for all T,T′∈MLTT.
Proof.
By Corollary 5.1.11, it suffices to show that the 2-functor Cl is essentially surjective on objects.
Then, given a CCCwD C, the standard ‘theory-construction’ Th induces an MLTT Th(C) such that Cl(Th(C))≅C, which completes the proof.
∎
6 Conclusion and Future Work
We have generalized CCCs, viz., CCCwDs, and proved that they give a categorical semantics of MLTTs in a true-to-syntax fashion.
We have also analyzed the relation between the standard interpretation of STLCs in CCCs and ours in CCCwDs by establishing a 2-equivalence between CtxCCCs and constant CtxCCCwDs.
For these results, it would be fair to say that we have discovered the categorical counterpart of the path from STTs to DTTs.
As immediate future work, we would like to consider additional structures on CCCwDs to interpret other type constructions in MLTTs, e.g., identity types, well-founded tree types and universes.
Moreover, it may be possible to extend the present framework as a semantics of homotopy type theory (HoTT) [Uni13].
Finally, it would be interesting to develop a general theory of categories with dependence in its own right, generalizing major theorems in category theory.
Acknowledgements.
The author was supported by Funai Overseas Scholarship.
Also, he is grateful to Samson Abramsky for fruitful discussions.