<<

First Order Logic with Dependent Sorts, with Applications to

by M. Makkai McGill University

Preliminary version (Nov 6, 1995)

Contents:

Introduction p. 1 §1. Logic with dependent sorts p. 14 §2. Formal systems p. 32 §3. Quantificational fibrations p. 39 §4. The syntax of first-order logic with dependent sorts as a fibration p. 47 §5. Equivalence p. 58 §6. Equivalence of categories, and diagrams of categories p. 77 §7. Equivalence of p. 110 Appendix A. An alternative introduction of logic with dependent sorts p. 127 Appendix B. A fibrational theory of L-equivalence p. 133 Appendix C. More on L-equivalence and p. 144 Appendix D. Calculations for §7. p. 161 Appendix E. More on equivalence and interpolation p. 174 References p. 198

The author' research is supported by NSERC Canada and FCAR Quebec

0 Introduction

1. This work introduces First-Order Logic with Dependent Sorts (FOLDS). FOLDS is inspired by Martin-Löf's Theory of Dependent Types (TDT) [M-L]; in fact, FOLDS may be regarded a proper part of TDT, similarly to ordinary first-order logic being a proper part of higher-order logic. At the same time, FOLDS is of a much simpler nature than the theory of dependent types. First of all, the expressive power of FOLDS is no more than that of ordinary first-order logic; in fact, FOLDS may be regarded as a constrained form of Multi-Sorted First-Order Logic (MSFOL). Secondly, the syntax of FOLDS is quite simple, only slightly more complicated than that of MSFOL.

In general terms, the significance of FOLDS is analogous to that of ordinary first-order logic (FOL). On the one hand, FOL has a simple and powerful semantic metatheory; on the other hand, FOL is the basis of a multitude of specific foundational . Correspondingly, FOLDS has a simple semantic metatheory, not essentially more complicated than that for FOL. It is one of the aims of this work to develop the basic semantic theory of FOLDS. On the other hand, I make a start on showing that FOLDS is good, and better than FOL, for the purposes of formal systems dealing with sets, categories, and more general categorical concepts.

FOLDS is very simple; for the understanding of the motivation for, and the basic mechanics of, FOLDS there is no need for any prior knowledge of the, by now, extensive literature of dependent types. I find the idea of FOLDS so simple and natural (we will also see that FOLDS is useful, which is another issue) that I am thoroughly surprised by the apparent fact that, in the literature, it has not so far been singled out for study. (Nevertheless, there are important pointers to FOLDS in the literature that I will point out below.) Incidentally, I decided to use the word "sort", instead of "type", in "first-order logic with dependent sorts", to emphasize the closeness of FOLDS to MSFOL, and because of the strongly-felt connotation, in phrases like "type-theory", of the word "type", that implies the presence of a higher-order structure; you would not say "multi-typed first-order logic", would you?

J. Cartmell [C] introduced a syntax of variable types for the purposes of a novel presentation of generalized algebraic theories; Cartmell's syntax was also "abstracted from ... Martin-Löf ". FOLDS differs in two ways from Cartmell's syntax. Firstly, in Cartmell's syntax, there are no logical operators in the usual sense; there are no propositional connectives, or quantifiers; FOLDS has them, with quantification constrained in the natural way already given

1 in TDT. Secondly, the type-structure of FOLDS is much simpler than that of Cartmell's syntax.

Cartmell's syntax may be characterized as the result of abstracting the structure of contexts, types, terms and equality out of TDT. FOLDS has the first two of these, contexts and types (although the latter are called "sorts"), but it does not have the third, terms (except in the rudimentary form of mere variables), and it has equality in a greatly restricted form only.

The restriction on the use of equality in FOLDS is a fundamental feature. FOLDS is to be used in formulating categorical situations in which, for example, equality of objects of a category is not an admissible primitive. The absence of term-forming operators, to be interpreted as functions, is a consequence of the absence of equality; it seems to me that the notion of "" is incoherent without equality.

It is convenient to regard FOLDS a logic without equality entirely, and deal with equality, as much as is needed of it , as extralogical primitives.

It is worth-while for the reader at this point to make a quick comparison of the way [C] formulates the theory of categories (pp. 212, 213 in [C]), and the way FOLDS formulates the same (see §1, p.11). Let me emphasize that essentially this particular instance of FOLDS have been introduced early on by G. Blanc [B], in his characterization (mathematically equivalent to P. Freyd's earlier characterization) of first-order properties of categories invariant under equivalence of categories. A. Preller [P] makes the specification of the specific instance of FOLDS clearer. The theme of invariance under equivalence is in fact the main theme for this work; see below.

The FOLDS formulation of the theory of categories is, admittedly, longer than the Cartmell formulation. It consists in writing out the axioms of "category" in essentially the usual first-order terms, with a special regard for the typing of variables. The main points to observe are that (1) no equality on objects is used; (2) equality of arrows is used only when the arrows already are assumed to be parallel; and (3) quantification on arrows is restricted to one hom- at a time.

The formulation in [C] is more "mathematical"; in particular, the essential algebraic nature of the concept of category is clear on it, whereas, because of the presence of the usual first-order operators that in general do not yield essentially algebraic concepts, in the FOLDS formulation the essential algebraic quality of the concept of category is obscured.

2 In the case of the theory of categories, the notions of context in the two formulations coincide; in fact, now a context is a finite diagram of objects and arrows represented by variables. Below, we will take a look at the formulations of the concept of a category with finite limits in the two frameworks, when the differences become greater.

The most obvious difference of the two formulations is that the one in FOLDS is purely relational, in Cartmell's syntax, purely operationaI. In FOLDS, the concepts of and composition are represented by relations, rather than operations as in [C]. The arity of a relation is the type of a particular context; the places of a relation are to be filled by variables forming a context of a given type. To give an example, in case of composition as a relation, the variables filling the places of the relation T (for (commutative) triangle) form a system consisting of variables U, V, W, u, v, w (not necessarily all distinct), related to each other by sorting data

U, V, W:O; u:A(U, V), v∈A(V, W), w∈A(U, W)

( O for "object", A for ""), or more pictorially,

G uBV v Lh A @ ; U w W

T then says of this diagram that it is commutative.

A general context in the FOLDS language for categories is a finite graph of object and arrow variables, with sorting data specifying which object variable is the domain of each arrow variable, and the same for codomain (when we say "graph", we mean to imply that there is no arrow-variable without a corresponding object-variable designated as its domain, or codomain).

An immediate consequence of the absence of operations in FOLDS is the simplification of the notions of context and type (sort) in FOLDS with respect to the Cartmell syntax. To see the effect of this, we take the example of the theory of categories with finite limits. Although this example is not discussed in [C], it is highly relevant to the subject of [C] as acknowledged by the title of section 6: "Essentially algebraic theories and categories with finite limits".

3 In the Cartmell syntax, would be introduced by the following introductory rules:

, , ∈ , ∈ , , ∈ , , , , , ∈ U V W Ob v Hom(V U) w Hom(W U):pb(0 U V W v w) Ob (here, the "informal syntax" allows writing , in place of the longer term) ; pb0 (v w) U, V, W∈Ob , v∈Hom(V, U) , w∈Hom(W, U) : , ∈ , , , , ∈ , , . pb10 (v w) Hom(pb (v w) V) pb 20 (v w) Hom(pb (v w) W)

(Of course, one has in mind the diagram

VA@v U OO pb (v, w) 1 w A@ pb (v, w) , W .) 0pb(2 v w)

There are further terms and rules expressing the of the pullback.

Now, in FOLDS, we have two possibilities. One is simply adopting the same language of categories as before; after all, pullbacks are first-order definable in the language of categories; in fact, pullbacks are definable in FOLDS over the language of categories. Another possibility would be adopting an additional primitive relation of arity the diagram

VA@v U OO p w A@ ; P q W we would do this if we wanted (as we may) to keep down the quantifier complexity of the axioms of the resulting theory. In either case, appropriate first-order axioms, formulated in FOLDS, are adopted.

Now, compare the notions of context and type (sort) in the Cartmell formulation, to those in the FOLDS formulations, in this example. In either of the FOLDS formulations, the notions of context and type remain the same as in the previous example of the theory of categories; in particular, contexts are finite graphs of variables. However, in the Cartmell formulation, because of the presence of terms of arbitrarily high complexity, both of the type of an object

4 and of an arrow, contexts and types of arbitrarily high complexity will come up. In particular, the second rule above features a type with a place filled by a term which is not a variable.

This example explains the reason for the complexity of the definition the general concept of theory in Cartmell's syntax; see section 6, loc.cit. In particular, the definition of "type" cannot be made independent of the axioms of the theory in question; what counts as a well-formed type depends on what axioms are present. This is not at all unexpected; M. Coste's earlier syntax for essentially algebraic theories [Co] (not referred to in [C]) also had this feature. In contrast, in FOLDS, there is no such complication in the definition of "type" ("sort").

Let me point out another aspect in which FOLDS is simpler than Cartmell's syntax. In FOLDS, one never substitutes in a sort expression; in the , there is a substitution rule, but it does not effect sorts. Related to this is the circumstance that the sorting of variables can be given rigidly; that is, when we say that the variable x is sort X , where the sort X may contain further variables, we mean a formal, once-for-all specification concerning x .In FOLDS, in contrast to Cartmell's syntax, it is impossible to have the same variable x to be declared of types X and Y unless X and Y are literally the same.

I consider the just-described feature of FOLDS to be of foundational importance. The view underlying FOLDS is that sort-declarations are not subject to logical manipulation; they are not propositions; one cannot negate a sort-declaration. One cannot ask whether x is of sort X within logic; the variable x being of sort X is purely notational, or conventional, matter. More pointedly, membership in a set is not a matter for logic; what is the matter for logic is whether certain elements, declared to belong to various sets, do or do not satisfy certain predicates. One should compare simple type theory (higher-order logic), in which typing of variables is also absolute. The difference in FOLDS is only that the type of a variable may also contain variables; however, the latter variables are uniquely determined from the variable being typed.

There is an important difference between the FOLDS-formulation and the Cartmell formulation, indicated above, of the notion of category with finite limits; in fact, the very notions formulated, not just their formulation, differ. Cartmell's syntax formalizes the notion of category with specified finite limits; FOLDS (in our application) formalizes the notion of category with finite limits, with the latter defined only up to . Moreover, Cartmell's syntax cannot formalize the latter notion, for the simple reason that that notion is not an essentially algebraic one. Conversely, FOLDS, with the restriction that no equality on

5 objects is allowed, cannot formalize the notion of category with specified finite limits.

It is possible to recapture the full expressive power, and more, of Cartmell's syntax within the framework of FOLDS. This will essentially be shown in Appendix C, when discussing "global equality". However, FOLDS with global equality captures more than Cartmell's syntax; because of this, it fails to represent that syntax faithfully. Thus, Cartmell's syntax is not rendered superfluous, or redundant, in any sense by what we do here. There is a similar situation with Coste's syntax for essentially algebraic theories mentioned above. Coste's syntax is one using the unique existential quantifier; it can be easily subsumed under the simpler regular logic which uses the ordinary existential quantifier. The point of Coste's syntax, and of Cartmell's, is that they capture exactly the essentially algebraic doctrine. In , I want to stress the great practical value of Cartmell's syntax. It is, in my opinion, the most practical specification language for structures such as (possibly) higher dimensional categories, with (possible) additional structure.

In this work, I present two ways of introducing FOLDS, which, however, are ultimately equivalent; one in §1, the other in Appendix A. The one in Appendix A is the more direct one. It starts with a simultaneous inductive definition of the concepts of kind, context, sort and variable, together with some other auxiliary concepts. Kinds are the heads (names) of sorts; each sort is obtained by appropriately filling out the places of a kind by variables. After defining the syntax in a global manner, one isolates specific vocabularies, or similarity types, for the purposes of formulating specific theories in FOLDS.

On the other hand, the treatment in §1 starts with the idea of a vocabulary for FOLDS (DSV). It is interesting that the data for a DSV can be naturally and succinctly captured by a, usually finite, one-way category.One-waycategorieswereisolatedbyF.W.Lawverein[L];a category is one-way if its are trivial; in the skeletal case, this means that there are no non-trivial circuits of arrows. Subsequently, Lawvere observed that one-way categories are intimately related to the sketch-based syntax of [M1]. Their appearance in this paper is related to their role in [M1], although this fact is not worked out here. The DSV as a one-way category has objects the kinds and the relation-symbols; the latter are "top"-level objects in the category; the arrows between kinds represent the dependencies built into the syntax.

The formulation of FOLDS based on one-way categories is simpler than the "direct" approach. In fact, it can be put into a succinct algebraic form, in the form of certain hyperdoctrine-type

6 structures. We will exploit this possibility for the presentation of the Gödel and the Kripke completeness for FOLDS.

2. Let me indicate the foundational motivation behind this work.

P. Benaceraff, in a well-known paper [Ben] entitled "What numbers could not be", expressed a criticism of the set-theoretical reconstruction of mathematical concepts such as that of "". Benaceraff's point is that any one set-theoretical definition of "natural number" gives rise to truths, such as "17 has exactly seventeen members", that become false under an alternative, but equally legitimate set-theoretical definition of "natural number" (his illustration compares the von Neumann definition ( 0=∅ , n+1=n∪{n} ) and the Zermelo definition ( 0=∅ , n+1={n} ). Thus, the set-theoretical reconstruction of mathematics is inevitably cluttered with irrelevant and arbitrary truths.

The way out of this requires a in which one talks about the system (, 0, S) of the natural numbers in such a way that any property of (,0,S) that can be expressed in the language is necessarily invariant under isomorphism of structures of the form (A; a∈A, f:AA@A) . We quickly realize, as did Benaceraff, that in such a language, we cannot allow an equality predicate relating things belonging to various sets; we may contemplate equality of elements , of a fixed, but arbitrary, set only. As a a=Aa’ a a’ A consequence, we cannot allow an equality predicate whose arguments are sets; for if A and B are sets, A=B should imply that ∀a∈A.∃b∈B.a=b , but the last use of the equality predicate is not restricted to elements of a fixed set!

Doing mathematics under such restrictions is not as absurd as it may sound first. In fact, considering sets to be objects of a category, with functions as arrows, and using the FOLDS language of category theory mentioned above, one may do, specifically in the Lawvere-Tierney theory of elementary with a , a significantly large part of mathematics, without violating the said exclusions, and in fact, fully observing the above-italicized requirement.

One may contemplate a comprehensive language of abstract mathematics, with the property that in it, only "relevant", that is, suitably invariant, predicates can be expressed. In the case of properties of sets, "suitably invariant" means "invariant under isomorphism ()". In the contemplated foundational framework, sets are singled out among arbitrary totalities by the

7 quality of a set that an equality predicate on its elements as arguments is present as part of the "structure" of the set. The totality of all sets is not a set, since there is no equality predicate on sets as arguments.

But then, what kind of structure does the totality of all sets form? Answer: a category.The will be particular arrows. We quickly realize that, to do set-theory, we need more general arrows than isomorphisms. In category theory, equality of parallel arrows is fundamental; we stipulate that the arrows from a fixed object to another fixed object form a set. We find that there are other categories, such as that of groups and , which in many ways are similar to that of sets and functions. For instance, we do not want to have equality of groups as a primitive. Categories appear as generalizations of sets; every set is a category, a . There is, in general, no such thing as the "underlying set of the objects of a category", not because of size considerations, but rather because, in general, there is no equality predicate whose arguments are the objects of the category.

We find that the idea of an isomorphism of categories, let alone equality of categories, is incoherent; it is obvious that the notion of an isomorphism of two categories must involve reference to equality of objects in each of the categories. This entails that a totality of categories cannot be, in general, a category; in any category, the notion of isomorphism is well-defined. For totalities of categories, we must have a new type of structure, some kind of 2-dimensional category.

However, in our quest for the "perfectly invariant" language we quickly get into conflict with standard category theory. The trouble is that we must conclude that the notion of , surely a mainstay of the subject, is not acceptable. The problem with it is that it implicitly refers to equality of objects in the codomain category, in the requirement that its value at any given object in the domain category be uniquely determined. Is there a way out of this?

In an old paper ([Kel]), G. M. Kelly described a common situation one finds oneself when one wants to define a functor. It appears that all data are there to define the functor, still, it is not possible to canonically single out the value of the functor at an argument-object; one needs to make an arbitrary choice of a value, while it is also clear that it is immaterial what choice one makes. Frequently, the choice cannot be made without the . Kelly described in precise terms what the data are like before one makes the arbitrary choices. Relatively recently, without knowing about Kelly's paper, I also went through a similar consideration, and made a formal definition of the notion of anafunctor (a term suggested by D. Pavlovic),

8 anticipated by Kelly some thirty years ago (he did not give a name to the concept). (Related ideas occurred to R. Paré some time ago.) I have found that one can live, quite well actually, with anafunctors, without converting them into by making non-canonical choices. There is a basic category theory that, in its main outline, does not deviate too much from the standard one, and which uses anafunctors in place of functors; this theory gets by to a large extent without the Axiom of Choice. The beginnings of anafunctor theory is presented in [M2].

Let me emphasize that the work in [M2] is done in a traditional set-theoretic framework. The "perfectly invariant" foundation is not yet available for use; the mathematical work in [M2] is intended to help formulate such a foundation.

I envisage a foundational set-up, a of abstract concepts, in which we have sets, functions, categories and anafunctors as specific distinct kinds of entities. It is clear that we cannot stop here. We will have natural transformations of anafunctors. But the totality of all categories, anafunctors and natural transformations of the latter will form a new kind of entity, an anabicategory. This differs from a in that each composition operation of 1-cells, one for each triple of objects (0-cells), instead of being a functor, is an anafunctor. [M2] treats the afore-mentioned concepts.

The concepts of anafunctor and anabicategory mentioned above are "non-radical" revisions of established notions of category theory. As Kelly explained in [Kel], using a global version of the Axiom of Choice, anafunctors can be "converted" into functors. Technically, this amounts to saying that, under an appropriate Axiom of Choice, every anafunctor is isomorphic to a functor (this makes sense since a functor is canonically an anafunctor; "anafunctor" is a generalization of "functor"). Thus, under the full force of the usual set-theoretic foundations, anafunctors are of no importance. (Let me mention in this context that the global Axiom of Choice we have in mind is in fact meaningless in the Invariant Foundation, since it talks about a function with values which are sets, the very idea of which is inexpressible because of the lack of equality on sets. In fact, Kelly already in loc.cit. considered the global type of choice involved here more suspect than ordinary choice.)

The universe of the Invariant Foundation is not clearly defined as yet. It should contain ana-n-categories for all natural n’s; the totality of ana-n-categories, with their , etc., will form an ana-n+1-category. The task of formulating these concepts is closely related with the task of defining the general notion of "weak n-category", mentioned in [BD].

9 3. In the previous subsection, I gave an incomplete outline of the universe of the Invariant Foundation. The contribution of the present work is to the language of that foundation. The proposal is to use FOLDS as the basic language.

For any vocabulary L for FOLDS, taken (for convenience) completely without equality, I introduce the notion of L-equivalence of L-structures; this is the replacement for the notion of isomorphism for ordinary kinds of structure. An L-structure M is at the same time an ordinary structure for an ordinary language QLR ; the properties of M expressible in FOLDS are particular ordinary first-order properties of M as an QLR-structure, but not vice versa. It turns out (General Invariance , GIT) that the first-order properties that are invariant under L-equivalence are precisely the ones that are expressible in FOLDS over L . This indicates that L-equivalence is the right notion of "isomorphism" for structures for FOLDS.

As was mentioned above, anafunctors are a generalization of functors. But, upon closer look, we see that the requirements of the "logic of (generalized) equality" impose an additional condition on anafunctors. Whereas an anafunctor determines its value at a given argument up to isomorphism, meaning that any two possible values are isomorphic, in the case of a saturated anafunctor, the value is determined also no more than up to isomorphism, meaning that any object isomorphic to a possible value is also one. (The precise definition also relates to the given isomorphism between a possible value and a new object.) The requirement of saturation is an extension of the principle of substitutability of equal for equal, transferred to isomorphism from equality. Now, it turns out that every anafunctor, in particular every functor, has a canonically defined saturation, a parallel saturated anafunctor, to which it is isomorphic. The right notion of "functor" is "saturated anafunctor".

On the one hand, we have traditional types of categorical structures, examples which are (1) categories, (2) diagrams of categories, functors and natural transformations, and (3) bicategories, etc.. We have notions of equivalence for each of these kinds; e.g., the one for bicategories is usually called "biequivalence".

On the other hand, we have anaversions of each of the above kinds of structure. In particular, we have a canonical saturation of any structure of each of the above kinds; in case of the first (category), the saturation is identical to the original. Each kind of anastructure has a vocabulary L for FOLDS as its similarity type; as a result, we have the notion of L-equivalence for these anastructures. The chief point of the work here is that the concept of equivalence for traditional structures of a given kind, and the concept of L-equivalence for

10 their saturations correspond to each other. E.g., two bicategories are biequivalent iff their saturations are L-equivalent, where L is the FOLDS vocabulary for anabicategories.

The saturation A# of a categorical structure (e.g., bicategory) A is quite simply defined in terms of A ; in particular, the definition is a first-order interpretation. As a result, any first-order property, and in particular, any FOLDS property, of A# isalso,byadirect translation, a first-order property of A . Hence, it is meaningful to ask of a first-order property

P of A whether it is expressible as a FOLDS property of A# . We have the conclusion that this holds iff P is invariant under equivalence of the appropriate kind. E.g., a first-order property of a variable bicategory A is invariant under biequivalence iff it is expressible in FOLDS as a property of the saturation of A . This theorem is a result of a combination of the relation of the two kinds of equivalence mentioned above, and an appropriate generalization of the GIT.

The last result for categories is due to P. Freyd [F], and G. Blanc [B]; Blanc's formulation is closer to the spirit of this work. A detailed proof is available in [FS]. The methods of the present work are entirely different from Freyd's. Restricted to the case of categories, the former give stronger results, although the additional strength that I cannot reproduce by Freyd's methods seems of minor importance. More important is the fact that Freyd's methods employ the axiom of choice, through the use of the skeleton of a category, and thus do not generalize to "constructive category theory". In Appendix E, I give a proof of the GIT for intuitionistic FOLDS. This gives rise to an intuitionistic version of the Freyd-Blanc characterization theorem for properties of categories invariant under equivalence. This does not seem to be accessible by the methods of [FS].

The main mathematical results of the present work are thus syntactic characterizations of formulas that are invariant under equivalence, in various senses of "equivalence". For the statement of these results, there is no need to understand the anaconcepts. In fact, for the case of bicategories, I organized the presentation in a way that does not refer to anabicategories explicitly, although, in this way, I missed the proof of the full strength of the main result. By contrast, in the case of diagrams of categories, functors and natural transformations, the anaconcepts are displayed.

From the foundational point of view, the results give confirmation to the idea that FOLDS employed in the context of anastructures is a suitable foundational language. I expect that the

11 analysis started here will extend with similar results to higher dimensions. This is a concrete matter in the case of [GPS]; but I believe the case of general n-dimensional structures will soon be accessible too. I find it an interesting proposition, verified up to dimension 2 here, and conjectured to hold in all dimensions, that the appropriate notion of equivalence, "weak n-equivalence" in the terminology of [BD], has a form, namely L-equivalence for the saturations of the structures involved, which is of a general "logical nature"; the original notion of "weak n-equivalence" looks a priori to be a rather involved idea.

4. Let me give an overview of the contents. I have organized the material into seven sections and five appendices, with the obvious implication as to what parts I felt to be the more important ones. §1 is the basic introduction to the syntax and semantics of FOLDS. The reader may immediately look at Appendix A, which contains the alternative, "more logical", introduction of FOLDS. §2 contains the formal systems for the classical, intuitionistic and coherent versions of FOLDS. §3 is a purely algebraic (categorical) study of "fibrations with quantification". I deal with hyperdoctrine-like structures; specifically, fibrations in which the base category has finite limits, but there is a distinguished of arrows along which quantification is allowed. The applications to FOLDS is given in §4. I was surprised at the appropriateness of this simple idea for the purposes of FOLDS. The (Gödel, Kripke) completeness of the systems of §2 are thus seen to be a special case of something much more general.

§5 introduces the concept of L-equivalence, the main new concept of the work, and proves, in a suitably general form, the General Invariance Theorem (GIT). Appendices B and C are elaborations on the theme of L-equivalence. In Appendix C, I give, among others, proofs that follow the spirit of the treatment in [FS]. §§6 and 7 work out the conclusions concerning the three kinds of categorical structure we discussed above. In §6, the example of a single functor between two categories as a categorical structure is considered in some detail. In particular, fibrations are such structures. Appendix D contains some of calculations for §7.

Finally, Appendix E does two main things. One is the extension of the theory of L-equivalence to and Kripke models. The other is ordinary Craig interpolation and Beth definability for FOLDS.

I would like to thank George Janelidze and Dusko Pavlovic for valuable conversations on the

12 subject of this work.

13 §1. Logic with dependent sorts

First, we describe the kinds of structure which the assertions of logic with dependent sorts are about.

It is well-known from that the similarity types that are graphs (having sorts the objects, and unary sorted operation symbols only) are sufficient for all purposes. The simplest consideration here replaces a relation-symbol sorted as ⊂ × × by a new R A1 ... An p sort , and operations A@i , , , . Our first move is to restrict attention to R R Ai i=1 ... n one-way graphs; in fact, more conveniently, to one-way categories.

The concept of one-way category is due to F. W. Lawvere [L]. In [M1], I reproduce Lawvere's observation to the effect that categories of finite sketches obtained by the repeated use of the

second construction of [M1] starting from Set are exactly the ones of the form SetC , with C a finite one-way category.

A one-way category is one in which all are trivial (identities). In a skeletal one-way category, for any objects A and B , it is not possible that there are proper (non-identity) arrows in both direction AA@B and BA@A . As a consequence, there are no cycles (positive-length paths A@ A@ A@ of proper arrows with ). A01A ... An A0=An

We are mainly interested in finite, skeletal, one-way categories. However, for certain purposes, we need to relax the finiteness condition.

A category C has finite fan-out (I owe this concept to Jim Otto) if for every object A ,there are altogether finitely many arrows with domain A ; the set ${C(A, C): C∈Ob(C)} is finite. A simple category is one which is one-way, skeletal, and has finite fan-out.

A simple category is reverse-well-founded; in other words, it satisfies the ascending chain condition: there are no infinite paths A@ A@ A@ A@ A@ ( ω ) consisting A01A ... AnnA +1 ... n< of proper arrows. (Namely, any such would have to have the objects pairwise distinct, by An the above, and that would mean, a fortiori, infinitely many arrows out of .) A0

If L is a simple category, the set Ob(L) of objects is partitioned as in

14 ⋅ Ob(L)=abcL i< # i into non-empty levels ,for # , # the height of , # ≤ω , such that consist of the Li i< L L0 objects for which there is no proper arrow with domain , and such that, for , A A i>0 Li consists of those objects A for which all proper arrows AA@B have B∈L = abcL ,and

A maximal object in a simple category is one which is not the codomain of a proper arrow. Every object of the maximal level (if any) is maximal, but not necessarily conversely.

By a vocabulary for logic with dependent sorts,orDS vocabulary,orevenDSV, we mean a simple category given with a distinguished, but otherwise arbitrary (possibly empty) set of maximal objects. The distinguished maximal objects of the DSV are its relation symbols (or relations); the rest of its objects are its kinds. We write Rel(L) and Kind(L) for the sets of relations and of kinds of L , respectively.

DS vocabularies are our similarity types for structures for logic with dependent sorts; concomitantly, they figure as vocabularies for the syntax of logic with dependent sorts. Unlike in multisorted logic, the arrows of a DSV do not enter the syntax of FOLDS as operation-symbols; the role of the arrows in a DSV and their composition will serve to determine the "dependence structure" of the variables.

Here are some examples for DSV's .

A dc Lgraph : PP O

15

T dt =ct , dt =ct , t t t1021 0PPP1 2 dt =dt , di =ci . L :20 catA MN i I  dc relations: I , T PP O

A1 d c 1PP1 L : A dd =dc , cd =cc . 2-graph 1 1 1 1 dc PP O

Only non-identity arrows are shown. The proper arrows are those shown and their composites, among which we have the equalities shown, and no more. E.g., there are three distinct arrows A@ and have no relations. The dots in signify that T O. LgraphL 2-graphL cat I and T are relations.

For a DSV L , and an object A in it, we write AL for the set of proper arrows with domain A (the notation resembles the notation APL for the ). For an arrow denotes its codomain. p ,Kp

Given a DSV L , the intended structures for L ,the L-structures, are the functors M:LA@Set in which for each relation R∈Rel(L) the following holds: the family 〈 A@ 〉 of functions, indexed by the proper arrows in with M(p):M(R) M(Kpp ) ∈RL L domain R , is jointly monomorphic: for a, b∈M(R) ,if M(p)(a)=M(p)(b) for all p∈RjL , then a=b . The condition means that M(R) is essentially a subset of the set & M(K ) , actually a subset of M[R] ; here, for any A∈Ob(L) , p∈RL p

M[A]={〈 a 〉 ∈ & M(K ) : M(q)(a )=a whenever qp=p’}(1) def pppppp∈AL ’

( is the (joint pullback) of the diagram P A@Φ A@M (with Φ M[A] A (L-{1A }) L Set the ) mapping (AA@K) to M(K) ). We will usually (and without loss of generality) assume that in case R∈Rel(L) , the canonical

16 M x@ taking to is an inclusion of sets. m:M(R) M[R] a 〈 (Mp)(a) 〉 ∈ RpR Kp

We recognize that the -structures are the graphs, the -structures are the LgraphL 2-graph 2-graphs. Categories are particular -structures. If is a category, for as an Lcat M M -structure, , are the sets of objects and of arrows, and are Lcat M(O) M(A) M(d) M(c) the domain and codomain functions; as a consequence, M[T] is the set of triangles

VG u% gv LA @ U w W

in M ; by definition, M(T) is the set of commutative triangles, a subset of M[T] ; M(I) is the set of identity arrows. In fact, we realize that the -structures are exactly the Lcat category-sketches of [M1] .

For L aDSV,QLR denotes its underlying graph. Any (small) graph L can be used as a similarity type for multisorted logic; the L-structures are the graph-maps (diagrams) LA@Set ; C-valued L-structures are the diagrams LA@C . Multisorted first-order logic with L as vocabulary uses the objects of L as sorts and the arrows of L as sorted unary operation symbols; we always allow equality (to be interpreted in the standard way) when we refer to multisorted logic. For these matters, see [MR1]. First-order logic with dependent sorts over L will be a proper part of multisorted first order logic over QLQ .

To be sure, the QLR-structures are not exactly the L-structures; the latter are those among the former that satisfy a certain set Σ[L] of axioms over QLR , to be described next. Σ[L] consists of the following sentences:

∀x∈A.(,.0{q(p(x))=p’(x):p, p’∈AjL, q∈Arr(L) , qp=p’} ,

one for each A∈Ob(L) ( = Kind(L)∪Rel(L) );and

∀x∈R.∀y∈R.[( ,.0 p(x)=p(y))  x=y] , p∈RL one for each R∈Rel(L) .

17 One feature of logic with dependent sorts is that there will not be any operation symbols (explicitly) used in it; thus, the just-listed sentences are definitely not in logic with dependent sorts over L .

Let us explain the intuition behind logic with dependent sorts for the case when the vocabulary is . First of all, logic with dependent sorts is a (proper) part of what we know as Lcat ordinary multisorted logic over Q R , the (a) language of categories. In logic with Lcat dependent sorts over , we have variables ranging over ; we can quantify these Lcat O variables. However, instead of variables ranging over A , we will have ones that range over A(U, V) ,where U and V are variables of sort O . A(U, V) is a "dependent sort", one depending on the variables U and V .Avariable u ranging over A(U, V) is of sort A(U, V) , and we write u:A(U, V) . Of course, we should think of A(U, V) as hom(U, V) , and of u:A(U, V) as u:UA@V . In terms of the semantics of -structures, the interpretation of , in is ∈ . Lcat A(U V) M {a MA:(Md)(a)=(Mc)(a)} Thus, we have no variables ranging over all arrows at once; only ones ranging over arrows with a fixed domain and codomain.

An immediate consequence of this is that if a formula has the free variables U and V ,and also u:UA@V (that is, u:A(U, V) ), then forming ∀Uϕ should and will be illegal; the free variable u in ∀Uϕ has lost its fixed reference to a domain.

In FOLDS in general, and in particular over , we will have a restricted use of equality Lcat only. The reason for this is our main aim, which is to formulate languages for categorical structures in which all statements are invariant under the equivalence appropriate for the kind of categorical structure at hand. Typically, equivalences does not respect equality of certain kinds of entities; in the case of categories, equality of objects, in the case of bicategories, equality of objects (0-cells) and equality of 1-cells. In FOLDS with restricted equality, we will allow "fiberwise equality" over maximal kinds; in the case of , this means fiberwise Lcat equality over . The restrictions on equality in FOLDS over will correspond to the A Lcat intuition that in category theory, one should not refer to equality of objects, and equality on arrows should be mentioned only with reference to arrows which have the same domain and the same codomain.

The above remarks, made for the case , on how logic with dependent sorts over L = Lcat L is constrained with respect to ordinary first-order multi-sorted logic over QLR have natural extensions to the case of a general vocabulary L . The constraints will be built into the general

18 definition of the syntax.

Before giving the general definitions, to illustrate FOLDS (first-order logic with dependent sorts), we write down the axioms for category in this logic.

∀U:O.∃i:[email protected](i) ; ∀U:O.∀i:UA@U.∀j:UA@U.(I(i)UI(j)i=j) ; ∀U:O.∀V:O.∀W:O.∀u:UA@V.∀v:VA@W.∃w:[email protected](u, v, w) ; ∀U:O.∀V:O.∀W:O.∀u:UA@V.∀v:VA@W.∀w:UA@W.∀w’:UA@W (T(u, v, w)UT(u, v, w’)w=w’) ; ∀U:O.∀i:UA@U.∀u:[email protected](i, u, u) ; ∀U:O.∀i:UA@U.∀u:[email protected](u, i, u) ; ∀U:O.∀V:O.∀W:O.∀X:O. ∀u:UA@V.∀v:VA@W.∀w:UA@W.∀x:WA@X.∀y:VA@X.∀z:UA@X ((T(u, v, w)UT(v, x, y)UT(w, x, z))T(u, y, z)) .

We have applied certain abbreviations in writing these formulas. The atomic formula I(i) should be really I(U, i) ; U is also a variable in it; in fact, i:UA@U cannot appear anywhere without U . Similarly, T(u, v, w) is really T(U, V, W, u, v, w) .However,the abbreviations used are systematic, and can be made into a formal feature. Also, w=w’ is an atomic formula depending on all of the variables U, W, w, w’ ; it is written, more fully, as . w=A(U, W)w’

Many of the usual properties of categories, and of diagrams of objects and arrows in categories, can be expressed in FOLDS over . For instance, the definition of elementary Lcat (with operations defined by universal properties up to isomorphism, not specified as univalued operations) can be given as a finite set of sentences in FOLDS over ;the Lcat reader will find it easy to write down the axioms for elementary topos in the style of the above axioms for category. As Freyd [F] and Blanc [B] have shown, and as we will see below, this is closely related to the fact that the usual properties of categories, and of diagrams in categories, are invariant under equivalence of categories.

Let us turn to the formal specification of the syntax of logic with dependent sorts. We fix a DSV L . For a while, only the kinds in L will be used; let K be the full of L on the objects the kinds; K is a simple category, the category of kinds of L ;itmayregarded as a DSV without relations.

19 Note that kinds have been assigned a level in K ; levels range over the natural numbers less than k ,where k is the height of K . Recall that for any K∈K , we use the notation KK forthesetofallproper arrows A@ with domain . The set will figure as the p:K Kp K K K arity of the symbol K . In particular, the ones with empty arity are exactly the level-0 kinds.

We are going to define what sorts are, and what variables of a given sort are. These notions are relative to a given L (actually, to the category K of kinds of L ), which is considered fixed now.

When X is anything, we write x:X to mean that x = 〈 2, X, a 〉 for some (any) a . When we have defined sorts, and X is a sort, x:X is to be read as " x is a variable of sort X ".

By definition, a sort is an entity of the form

〈 , , 〈 〉〉 1 K xpp∈KK such that K is a kind, and for each p∈KK , and for

, , , X = 〈 1 K 〈 x 〉〉∈ p def pqpqKp K we have . xpp:X

We will also write 〈 〉 for 〈 , , 〈 〉〉; thus, a sort is obtained by K( xpp∈KK) 1 K xpp∈KK filling in the " pth " place of a kind K , for any p in the arity KK of K ,byasuitable variable .Thesort 〈 〉 is said to be of the kind . xpppK( x ∈KK) K

When X is a sort, and x:X ,thatis, x= 〈 2, X, a 〉 for some a , x is called a variable of sort X ; a is called the parameter of the variable x . Usually, the notation x:X will imply that X is a sort.

Note that every variable "carries" its own sort with it. This is in contrast with the practice of most of the relevant literature (see e.g. [C]), where variables are "locally" declared to be of certain definite sorts, but by themselves, they do not carry sort-information. For a sort 〈 〉 , ∈ ;andif ; X = K( xpp∈KK) Var(X)={def xp:p K K} x:X , Dep(x)def = Var(X) x depends on the variables in Dep(x) .

20 Note also that any parameter gives rise to a variable of a given sort; for any sort X , and for any a whatever, 〈 2, X, a 〉 is a variable of sort X . In the "purely syntactic" contexts, it suffices to restrict the parameters to be natural numbers (thereby ensuring a countable infinite recursive set of variables of each sort). However, for the purposes of model-theory, it is convenient to have a proper class of variables of each sort (as a consequence, we have a proper class of sorts). Let us call a variable natural when its parameter, as well as that of each variable it depends on, etc., is a natural number.

For a variable , let's write for the sort of ( ), and let's use the notation y Xyyy y:X

(1') y:X =K ( 〈 x , 〉 ∈ ) yy yppKy L

displaying the ingredients of the sort in dependence on . Also, let's write for Xy y a(y) the parameter of y .

The first question arising concerning the definition of "sort" is whether the constituent entities are also sorts; the answer is "yes". Assume 〈 , , 〈 〉〉is a sort. Applying XpppX = 1 K x ∈KK the definition of "sort" to ,for ∈ ,wewantthatfor Xppq K K

, , , (X )=〈 1 K 〈 x 〉〉∈ pq q (rq)prKq K

we have . But since and ,wehave xqp:(X p) qK=K q qp(rq)p = r(qp) (X p)= q ;and ,by being a sort. Xqpx qp:X qp X

Although the definition unambiguously defines what sorts and variables are, it is not (quite) clear, for instance, that for every K∈K , there are sorts of the kind K . We show that the sorts of the kind are in a bijective correspondence with families 〈 〉 of arbitrary K app∈KK entities ; the correspondence maps 〈 , , 〈 〉〉to apppX = 1 K x ∈KK 〈 〉 for which 〈 , , 〉 for a suitable . a(X)=def a(xpp) ∈KK xppp= 2 X a X p

We want to prove that for any 〈 〉 , there is a unique sort of the kind with app∈KK X K 〈 〉 . a(X)= app∈KK

Let ∈ and 〈 〉 be given. By recursion on the level of , for each ∈ , K K app∈KK Kp p K K we define (a sort, as it turns out), and the variable .Let ∈ . We put Xpppx :X p K K

21 , , ,and , , . X = 〈 1 K 〈 x 〉〉∈ x = 〈 2 X a 〉 p def pqpqKp K p def pp

Since for each ∈ , is of lower level than , the entity has been defined; q KpqpK K K px qp thus, and are defined for as well. This defines and for all . Xppx p X ppx p

Put 〈 , , 〈 〉〉. Then formed for as in the definition of "sort" is X def= 1 K xpp∈KK Xp X thesameasthe we just defined. Since , is a sort. Clearly, Xpppx :X X 〈 〉 . a(X)= app∈KK

The uniqueness of X with this property is (also) easily seen.

Let us remark that for kinds K of level 0 , there is exactly one sort of the kind K , namely K(∅) ; this can safely be identified with K itself.

Let us consider the case .Wehavethelevel- sort ; let us use the letters K =Lgraph 0 O U , V , W , ... for denoting variables of sort O ; U:O , etc. The level-1 sorts are of the form 〈 〉 with , : , for which we write , .Thus,we A( xpp) ∈{d,c}x d xc O A(xdcx ) have sorts A(U, V) , A(V, U) , A(U, U) , ... Let us use u , v , for variables of level 1 ;we may have u:A(U, V) , which we paraphrase as u:UA@V .

In the case of , the ones listed are all the sorts and variables. Lgraph

For , we have the additional sorts of the kind . Let us write for the K =L2-graphA 1d 10 arrow ,and for . Writing dd11 =dc c 10111cd =cc . A K ={d,c,d,c} 101011 for , we see that the sorts A(x ,x ,x ,x ) A( 〈 x 〉 ∈ ) 1dcdc10 10 1 1pp{d 10 ,c 10 ,d 1 ,c 1 } of level-2 are those

A(U, V, u, v) for which U:O , V:O , u:UA@V and v:UA@V . Here, U and V ,aswellas u and v , may coincide. We would like to paraphrase A(U, V, u, v) as

A@u A(UVA@ ) . v

22 Before we complete the definition of the syntax of logic with dependent sorts, let us discuss the semantics of sorts. To begin with an example, let us take .Now,we K =L2-graph know that the intended K-structures are the functors KA@Set . But we may take a different view. We may say that a K-structure M consists of aset MO , for each A, B∈M(O) ,aset MA(A, B) , and for each , ∈ and , ∈ , ,aset , ; , . A B M(O) f g MA(A B) MA(1 A B f g) This way of thinking of a K-structure emphasizes that an "arrow" f cannot be conceived of before its "domain and codomain" A, B, which have to be elements of MO ,havebeengiven; there is a similar consideration for "2-cells". Also note that this kind of K-structure is not literally the same as a functor KA@Set . The main difference is that, in the new version of the concept, we are not saying anything about the sets MA(A, B) being disjoint from each other for distinct pairs (A, B) . Recall the two different styles of definition of "category" (or "2-category"). The one in which arrows determine their domain and codomain is in the spirit of our notion of structure in the original sense; the other in which we talk about a function A, B@hom(A, B) assigning a hom-set to pairs of objects is related to the new concept.

The second version of the concept of K-structure has the following general form. A -structure is given by specifying when, for ∈ , the entities 〈 〉 are K M K K MK( app∈KK) defined, and when they are, what sets they are; such data are subject to the following condition:

(2) is defined iff for each  , is MK( 〈 a 〉 ∈  ) p∈K K MK(〈 a 〉 ∈  ) ppK K pqpqKp K defined and . a ∈ MK(〈 a 〉 ∈  ) ppqpqKp K

This formulation hides the recursive character of the concept. Once it is clarified, for all K of level less than , when 〈 〉 is defined, and if so, what set it is, then for any i MK( app∈KK) of level , is defined iff for all j , is K i MK( 〈 a 〉 ∈  ) p∈K K MK(〈 a 〉 ∈  ) ppK K pqpqKp K defined, and (note that each is of level ), and in that a ∈ MK(〈 a 〉 ∈  ) K

Any functor M:KA@Set gives rise to a K-structure in the new sense. For any K∈K ,define as in (1) ; declare that 〈 〉 is defined iff 〈 〉 ∈ ,and M[K] MK( app∈KK) app∈KK M[K]

23 in that case, put

,.0 .(3) MK( 〈 a 〉 ∈ )={a∈MK: (Mp)(a)=a } ppK K def p∈KK p

It is clear (using that M is a functor) that now, (2) is satisfied.

But conversely, "essentially all" K-structures in the second sense are obtained as functors KA@Set . The passage from a structure in the new sense to one in the old sense is as follows. Given a K-structure M in the new sense, for any K∈K , M(K) is defined as the of all defined sets 〈 〉 , indexed by the tuples 〈 〉 , and, for MK( app∈KK) app∈KK A@ , is given by 〈〈 〉 , 〉 ; this defines a functor p:K KpppM(p) M(p)( a ∈KK a )=ap KA@Set .

Making the statement that the two notions of K-structure are "essentially equivalent" precise would require defining what we mean by an isomorphism of two K-structures M and N in the new sense, and showing that the above two passages represent an equivalence of the category of functors KA@Set with natural isomorphisms as arrows on the one hand, and the category of K-structures in the new sense, with isomorphisms in the new sense between them as arrows on the other. We will not go through this exercise, and return to our original concept of " K-structure" (" L-structure"). However, the concept of an M-sort as a set of the form (3) will be used.

Let us now return to the full DS vocabulary L , and define what L-formulas in logic with dependent sorts are. We will have two versions: logic with dependent sorts with (restricted) equality, and logic with dependent sorts without equality. FOLDS with unrestricted equality also makes sense; however, it turns out to be essentially the same as full multisorted logic with equality over QLR (see Appendix C), hence, it is of no real interest.

Let us fix L .

Atomic formulas are defined very similarly to sorts. An atomic formula in logic with dependent sorts without equality is an entity of the form

〈 , , 〈 〉〉 3 R xpp∈RL

24 such that R is a relation in L , and for each p∈RL ,and

, , X = 〈 1,K 〈 x 〉〉∈ p def pqpqKp K we have . Under these conditions, the are sorts (just as with the definition of xpp:X X p "sort"). We write 〈 〉 for 〈 , , 〈 〉〉. R( xpp∈RL) 3 R xpp∈RL

In logic with (restricted) equality, we also have additional atomic formulas as follows. For any maximal kind (maximal object of ), sort 〈 〉 , and variables , , K K X=K( xpp∈KK) x y both of sort X ,wehavethat 〈 4, X, x, y 〉 , written as

x = y , X

is an atomic (equality) formula.

We define formulas ϕ and the set Var(ϕ) of the free variables of ϕ by a simultaneous induction. Any atomic formula is a formula; if ϕ 〈 〉 ϕ = R( xpp∈RL) , Var( )= ∈ ;if ϕ ϕ ∪ , . {xpX:p R L} :=: x = y , Var( )=Var(X) {x y}

The sentential connectives t , f , U ,V ,  , ¬ , can be applied in an unlimited manner; Var( ) for the compound formulas formed using connectives is defined in the expected way; e.g., Var(ϕUψ) = Var(ϕ)∪Var(ψ) .

Suppose ϕ is a formula, x is a variable such that there is no y∈Var(ϕ) with x∈Dep(y) . Then ∀xϕ , ∃xϕ are (well-formed) formulas;

∀ ϕ ∃ ϕ ϕ ∪ . Var( x )def = Var( x ) def = (Var( )-{x}) Dep(x)

All formulas are obtained as described. (Of course, we have some determinations such as ∀ ϕ 〈 ∀, , ϕ 〉 ,where ∀ (?), etc.) x def= x =7

Let us make some remark on logic with (restricted) equality. Just as in ordinary first-order logic, the syntax of logic with equality is the same as that of logic with equality, with the equality-symbol understood as another relation symbol; it is only the semantics that makes the difference.

25

Formally, for each maximal kind ,addto an additional relation , with morphisms K L EK e A@K0 subject to , for all ∈  ; let us denote by eq the EKA@K peK0=peK1 p K L L eK1 extension of by these . The equality formula corresponds to L x =X y where , , Up to the E(〈 z 〉 ∈  ) z =x z =y z =z =x . KrrEKKL e0 eK1 pepepK0 K1 exchange of these two formulas, for each maximal K , the syntax of FOLDS with (restricted) equality over L , and the syntax of FOLDS without equality over Leq coincide.

A context is a finite set Y of variables such that if y∈Y , then Dep(y)⊂Y .Itiseasytosee that for any formula ϕ , Var(ϕ) is a context.

We explain the semantics of logic with dependent sorts. Let M be any L-structure. Let Y be a context. We define

Y for all Y (4) M[ ]={〈 a 〉 ∈Y : a ∈MK( 〈 a 〉 ∈  ) y∈ } def yy y xy, pyp K L

(recall the notations (1') and (3)).

By recursion on the complexity of the formula ϕ ,wedefine M[Y:ϕ] , the interpretation of ϕ in M in the context Y , whenever Y is a context such that Var(ϕ)⊂Y ; we will have that Y ϕ ⊂ Y . For an atomic formula 〈 〉 , we stipulate, for any M[ : ] M[ ] R( xpp∈RK) 〈 〉 ∈ Y , ayy∈Y M[ ]

Y  〈 a 〉 ∈Y ∈ M[ :R( 〈 x 〉 ∈  )] 〈 a 〉 ∈  ∈ M(R) yy ppR K def xpp R K

(recall that ; clearly, automatically). M(R) ⊂ M[R] 〈 a 〉 ∈  ∈ M[R] xpp R K

In case of logic with equality,

〈 〉 ∈ Y  . a ∈Y M[ :u= v] a = a yy Xuvdef

For the propositional connectives, the clauses are the expected ones; e.g.,

26 Y U  〈 a 〉 ∈Y ∈ M[ :ψ θ] yy def 〈 〉 ∈ Y ψ and 〈 〉 ∈ Y θ . ayy∈Y M[ : ] ayy∈Y M[ : ]

Let us consider ∀ ψ , and a context Y such that ∀ ψ ⊂Y .Let 〈 〉 . x Var( x ) x:K( xpp∈KjL) First, assume that x∉Y ; this is the case in particular when

Y=Var(∀xψ)=(Var(ϕ)-{x})∪Dep(x) .

Let Y Y ⋅ ; Y is a context. When Y and , ’= ∪{x} ’ 〈 a 〉 ∈Y ∈M[ ] a∈MK( 〈 a 〉 ∈ j ) yy xpp K L let 〈 〉 denote 〈 〉 for which for ∈Y ,and .Wesee ayy∈Y(a/x) ayy’ ∈Y’ ayy’=a y a x’=a that 〈 〉 ∈ Y as follows. Note that for ∈Y ,wehave ∉ ayy∈Y(a/x) M[ ’] y x Dep(y) (since would imply that x Y ); as a consequence, x∈Dep(y) ∈ a’∈MK(〈 a’ 〉 ∈ yyxy, pyp K L is equivalent to for Y ; while for , the same holds by a ∈MK(〈 a 〉 ∈ y∈ y=x yyxy, pyp K L the assumption on a .Wedefine

〈 〉 ∈ Y ∀ ψ  ayy∈Y M[ : x ] def

for all ,wehave Y ; a∈MK( 〈 a 〉 ∈ j ) 〈 a 〉 ∈Y(a/x)∈M[ ’:ψ] xpp K L yy and

〈 〉 ∈ Y ∃ ψ  ayy∈Y M[ : x ] def

there is such that Y . a∈MK( 〈 a 〉 ∈ j ) 〈 a 〉 ∈Y(a/x)∈M[ ’:ψ] xpp K L yy

In the general case for Y ⊃ Var(∀xψ) ,define

〈 〉 ∈ Y ∀ ψ  〈 〉 ∈ Y ∀ ψ , ayy∈Y M[ : x ] ayy∈Y M[ : x ]

〈 〉 ∈ Y ∃ ψ  〈 〉 ∈ Y ∃ ψ , ayy∈Y M[ : x ] ayy∈Y M[ : x ]

where Y = Var(∀xψ) = Var(∃xψ) . It is clear that when x∉Y , the second definition gives the same answer as the first one.

27 As usual, we also write ϕ 〈 〉 for 〈 〉 ∈ Y ϕ . M [ ayy∈Y] ayy∈Y M[ : ]

This completes the definition of the standard, Set-valued semantics of FOLDS.

Let us note that when ϕ is a formula in logic with equality over L ,and ϕ is the corresponding formula in logic without equality over Leq , obtained by exchanging the equality subformulas for -formulas, and is an -structure, then Y ϕ Y ϕ ; EK M L M[ : ]=M[ : ] in the latter instance, denotes the standard eq-structure in which each is interpreted M L EK as true equality. In short, the semantics of logic with equality over L coincides with the semantics of logic without equality over Leq when the latter is restricted to standard structures.

Let us formulate a simple translation of logic with dependent sorts into ordinary multisorted logic. This amounts to a mapping ϕ@ϕ* of L-formulas ϕ of FOLDS to QLR-formulas of multisorted logic. Let us agree that every variable x:X , with X a sort of kind K , will be regarded, in multisorted logic over L , a variable of sort K . The mapping ϕ@ϕ**will be so defined that the free variables of ϕ are exactly the same as those of ϕ . Moreover, the essential property of the translation is that, for any L-structure M ,

ϕ 〈 〉  ϕ* 〈 〉 ; M [ ayy∈Y] M [ ayy∈Y] here, in the second instance, we referred to the usual notion of truth for multisorted logic. The definition is this: for an atomic formula ϕ 〈 〉 , :=: R( xpp∈RK)

* ,.0 ;(5) ϕ = R( 〈 x 〉 ∈  )=∃y∈R. p(y)= x def ppR K defp∈RL Kp p

for an equality formula ϕ , :=: x=Xy ϕ* def= x=Ky (here, X is a sort of the kind K );

28 ()* commutes with propositional connectives;

(∀xϕ)=**∀x( ,.0 p(x)= x  ϕ ) ; defp∈KL Kp p

(∃xϕ)=**∃x( ,.0 p(x)= x U ϕ ) defp∈KL Kp p

(in the last two clauses, 〈 〉 ). x:K( xpp∈KL)

We have a straightforward extension of the semantics of logic with dependent sorts to interpretations in categories so that the standard semantics will appear as the special when the target category is Set . First of all notice that the notion of C-valued L-structure makes sense for any category C ;itisthatofafunctor M:LA@C such that for any R∈Rel(L) ,the family 〈 〉 of morphisms in is jointly monomorphic. The use of the notation M(p) p∈RL C M:LA@C will imply that M is a C-valued L-structure. From now on, let us assume, at least, that C has finite limits.

Let M:LA@C . For any object A of L (kind or relation), we define M[A] as the limit (joint pullback) of the diagram P A@Φ A@M , with Φ the forgetful functor; vΦ A (L-{1A }) L C M maps A@ to . Let us write π ,or πM , for the limit p:A KppM(K ) pp A@ , and let π πM A@ be the canonical arrow for which M[A] M(KpAA ) = :M(A) M[A] π vπ . When is a relation , then π is a monomorphism; we also write M pA=M(p) A R Rm R for πMU. When is a kind , then and π A@ are defined for any RpA K U[K] :U(K) U[K] U:KA@C (formally, by using the above definition for K in place of L ); of course, when , then , πUMπ . U=M K U[K]=M[K] pp=

Continuing, let Y be a context; we will define M[Y] . We construct a graph 〈 Y 〉 and a diagram ΦY: 〈 Y 〉 A@L as follows. The objects of 〈 Y 〉 are the elements of Y , 〈 Y 〉 Y . The arrows of 〈 Y 〉 are 〈 , ; 〉 A@ , one for each ∈  such that Ob = y z p :y z p Ky L . Φ maps to , 〈 , ; 〉 A@ to A@ ( ). Y is defined z=xy, p Y y Kyypzy z p :y z p:K K =K M[ ] as the limit of the composite MΦY: 〈 Y 〉 A@C ; let us denote the projections for this limit by π πMMπ Y A@ ∈Y . yy= = Y, yy:M[ ] M(K)(y )

29 We define M[Y:ϕ] as a certain of M[Y] , by recursion on the complexity of ϕ .

Let ϕ be the atomic formula 〈 〉 , and let Y be a context such that R( xpp∈RL) ϕ ∈ j ⊂ Y .Let Y A@ be the arrow, given by the universal Var( )={xp:p R L} f:M[ ] M[R] property of the limit defining M[R] , for which π vf=π ( p∈RjL ). M[Y:ϕ] is defined pxp by the pullback

M[Y:ϕ]A@M(R) M y W y M mY, ϕ PPmR Y A@ M[ ] f M[R]

(that is, Y as a subobject of Y is represented by the monomorphism M ). M[ :ϕ] M[ ] mY, ϕ

For formulas built by a propositional connective from simpler formulas, the definition is the expected one. E.g.,

M[Y:ϕψ]=M[Y:ϕ]M[Y:ψ] ,

where on the right-hand-side, reference is made to the Heyting implication  in the subobject S(M[Y]) ; of course, M[Y:ϕψ] is defined if and only if the corresponding instance of Heyting implication is defined in S(M[Y]) .

Let ∉Y ,and ∀ ϕ ⊂Y .Wehave Y∪⋅ A@ Y for which π v π x Var( x ) f:M[ {x}] M[ ] yyf= ’ ( ∈Y ; π πMM, π π ⋅ ). Let ∃ , ∀ Y∪⋅ ⊃@ Y be the y y= Y, yy’= Y∪{x}, yff:S(M[ {x}]) S(M[ ]) ⋅ partial adjoints to f*:M[Y]A@M[Y∪{x}] , the latter defined by pulling back along f .Wedefine

Y ∃ ϕ ∃ Y∪⋅ ϕ , M[ : x ]= f(M[ {x}: ])

Y ∀ ϕ ∀ Y∪⋅ ϕ M[ : x ]= f(M[ {x}: ]) .

For M[Y:∃xϕ] or M[Y:∀xϕ] to be defined, it is necessary and sufficient that the corresponding instance of ∃ , respectively ∀ be defined. ff

30 For the coherent part of the language (atomic formulas, t , f , U , V , ∃ ) to be interpretable in the category, it suffices that C is a coherent category (see e.g. [MR1]). For the interpretation of the full language, it is suffices to have that C is a Heyting category (see e.g. [MR2]).

31 §2. Formal systems

In this section, a vocabulary L for logic with dependent sorts is assumed fixed. Relations, formulas, etc., are all from/over L .

For a formula ϕ , Var* (ϕ) is "the set of all variables in ϕ , free or bound". More precisely, Var**** (ϕ) = Var(ϕ) for atomic ϕ ; Var (ϕUψ) = Var (ϕ)∪Var (ψ) ,and similarly for the other connectives;

Var** (∀xϕ) = Var (∃xϕ)={x}∪Dep(x)∪Var * (ϕ) .

Let X , Y be contexts. A s:XA@Y is called a specialization if whenever x∈X , 〈 〉 ,wehave 〈 〉 is a sort, and . x:K( xpp∈KL) X=K( s(xpp) ∈KL) s(x):X The identity map XA@X is a specialization, the composite of specializations is a specialization. Moreover, if a specialization is a bijection, then its inverse is also a specialization, and the restriction of a specialization to a subset of its domain which is a context is also a specialization. A notation such as s:XA@Y will refer to a specialization.

For a sort X , resp. a formula ϕ , and a specialization s:XA@Y such that Var(X)⊂X ,resp. Var(ϕ)⊂X ,wedefine Xs ,resp. ϕs , "the result of substituting s(x) for all free occurrences of x in X ,resp.in ϕ , simultaneously for all x∈X ".

If is the sort 〈 〉 ,andifϕ is the atomic formula 〈 〉 ,we X K( xpp∈KL) R( xpp∈RL) put

〈 〉 , ϕj 〈 〉 . X s def= K( s(xpp) ∈KL) s def= R( s(xpp) ∈RL)

For the equality formula ϕ , ϕ . The property of :=: x=XXy s :=: s(x)= jss(y) s being a specialization ensures that Xjs is a sort, and ϕjs is a(n atomic) formula in both cases.

ϕUψ ϕ U ψ , ( ) s def=(s) ( s) and similarly for the other connectives.

32 Suppose ϕ = ∀xψ . Let us first assume that X=Var(∀xϕ) . Consider the sort X of x , x:X ;let y be a variable of sort Xs which is new in the sense that y∉Var* (ψ)∪X∪Y . Define t to be the function t:X∪{x}A@Y∪{y} for which tX = s ,and t(x)=y (note that x∉X ). Notice that Var(X)⊂X , Var(Xs)⊂Y , thus X∪{x} and Y∪{y} are contexts, and is a specialization. We put ∀ ψ ∀ ψ . For a general t ( x ) s def= y( t) s:XA@Y , (∀xψ)s is defined as (∀xψ)s’ , with s’=sVar(∀xψ) .Wemakea similar definition for ∃ in place of ∀ .

Since in the above description, y was not uniquely determined by the conditions given, substitution is not quite well-defined. We may correct this by making a particular, but artificial, choice of y . A better procedure is to identify the formulas obtained by different choices of y ; this we do by defining the on formulas of one being an alphabetic variant of the other. However, for defining "alphabetic variant" it is convenient to use substitution. As long as substitution is not "well-defined", what we have is a relation " ϕjs = θ " of three variables ϕ, s, θ rather than an operation (ϕ, s)@ϕs .

Let ϕ be a formula, x and u variables of the same sort (for which we write xJu ), and assume that for all v∈Var(ϕ) , x∉Dep(v) (that is, either x∉Var(ϕ) or it is a "top" element in Var(ϕ) ). Then the mapping

s:Var(ϕ)∪{x}A@Var(ϕ)∪{u} ,

defined by s(v)=v for v∈Var(ϕ)-{x} and s(x)=u , is a specialization. Under these conditions, we put ϕ @ ϕ [more precisely, ϕ @ θ iff (x u)=def s " (x u)= " " ϕs = θ " ].

The relation ϕψ ,"ϕ is an alphabetic variant of ψ ", is defined as follows.

If ϕ is atomic, then ϕψ iff ϕ = ψ . ϕ Uϕ  ψ iff ψ ψ Uψ for some ψ with ϕ ψ ( , ) ; and similarly for 12= 12 iiii=1 2 the other connectives. ∀xϕ  ψ iff ψ = ∀x’ϕ’ for some x’Jx and ϕ’ such that, for some u for which uJxJx’ and u∉Var** (ϕ)∪Var (ϕ') ,wehavethat ϕ(x@u)  ϕ’(x’@u) . Similarly for ∃ in place of ∀ . [More precisely, we should say, in place of ϕ(x@u)  ϕ’(x’@u) , that for some σ and τ such that " ϕ(x@u)=σ " and

33 " ϕ(x’@u)=τ ",wehave σ  τ .]

One shows in a routine manner that  is an equivalence relation, ϕψ implies that Var(ϕ) = Var(ψ) ,and  is compatible with substitution: if ϕ  ψ , " ϕs = ϕ’",and " ψs = ψ’"imply that ϕ’  ψ’ . In particular, substitution ()s is an operation on equivalence classes of  . Note that the logical operations are compatible with  ; ϕψ implies that ∀xϕ  ∀xψ , etc. Also, the semantics of alphabetic variants are identical. Henceforth, we identify alphabetic variants. In other words, a formula is, strictly speaking, an equivalence class of the "alphabetic variant" relation  .

When s:XA@Y , Var(ϕ)⊂X ,wehave Var(ϕjs)⊂Y . If, in addition, t:YA@Z , then (ϕs)t = ϕj(ts) .Also,ϕj1=X ϕ .

An entailment is an entity of the form ϕ  ψ ,where ϕ , ψ are formulas, X is a context, X and Var(ϕ) , Var(ψ) ⊂ X . We formulate rules of inference involving entailments. Each rule is a relation R ε , , ε ; ε between entailments ε , , ε , ε ; ( 0 ... n-1 n) 0 ... n-1 n ε , , ε are the premises, ε is the conclusion of the respective instance of R .We 0 ... n-1 n display instances of R in the form

εε ε R 01 n-1 . ε n

n may be 0 , in which case we have a rule with no premises, an axiom schema.

I. Structural rules:

(Taut)  ϕ  ϕ X

ϕ  ψψ σ XX (Cut)  ϕ  σ X

34 ϕ  ψ X (Subst)  ( s:XA@Y ) ϕs  ψs Y

II. Rules for the connectives

(t)  ψ  t X

(f)  f  ψ X

θ  ϕ θ  ψ XX (U)  θ  ϕUψ X

ϕ  θ ψ  θ XX (V)  ϕVψ  θ X

θUϕ  ψ X ()  θ  ϕψ X

(¬)  ( ¬θ abbreviates θf ) t  θV¬θ X

(UV)  (ϕVψ)Uθ  (ϕUθ)V(ψUθ) X

III. Quantifier rules

θ  ϕ X∪⋅ (∀) {x} ( x∉X ) θ  ∀xϕ X

35 ϕ  θ X∪⋅ (∃) {x} ( x∉X ) ∃xϕ  θ X

(U∃)  ( x∉Var(θ) ) θU∃xϕ  ∃x(θUϕ) X

IV. Equality axioms

(E )  1 t  x= x X X

(E )  2 x= y  y= x XXX

(E )  3 x= y U ϕ  ϕj(x@y) X X

In the rules, ϕ , ψ , θ and σ ranges over formulas, x over variables, X and Y over finite contexts. An implicit condition is that each entailment shown has to be well-formed. E.g.,in (t) and (f) , Var(σ)⊂X .In (∀) and (∃) , Var(θ) ⊂ X ;since x∉X is explicitly assumed, it follows that x∉Var(θ) . Note that, in the same rules, the condition for the well-formedness of ∀xϕ , ∃xϕ is satisfied as a consequence of the other provisos. More ⋅ precisely, if X is a context, Var(ϕ)⊂X∪{x} (in particular x∉X ), then ∀xϕ , ∃xϕ are well-formed. Namely, for y∈Var(ϕ) ,if y≠x , then y∈X , hence Dep(y)⊂X , and thus x∉Dep(y) ;andif y=x , then x∉Dep(x) anyway.

For , note that since is a sort of a maximal kind, ϕj @ is well-defined. (E3 ) X (x y)

The double-lined "rules" contain more than one rule. The double line indicates that inference can proceed in both directions. E.g., in (V) , three rules are contained: the one that infers the entailment below  from the two above  , and the ones allowing to infer either of the two entailments above  from the one below  .

We have coherent, classical and intuitionistic logic with dependent sorts, each with or without

36 equality. Coherent logic involves the (coherent) operators t , f , U , V , ∃ ; classical and intuitionistic logics involve the remaining two,  and ∀ . Coherent logic without equality has the rules all those not mentioning  and ∀ in their names; intuitionistic logic also has the additional rules () and (∀) (and then (UV),(U∃) become superfluous); classical logic has also the remaining rule (¬) . The versions with equality also have the rules and . (E),(E)12(E 3 )

A coherent formula is one built up by the coherent operators starting with the atomic formulas; an entailment ϕ  ψ is coherent if both ϕ , ψ are coherent formulas. A coherent theory in X logic with dependent logic is a pair T=(L, Σ) of a DS vocabulary L and a set Σ of coherent entailments over . is the least set of coherent -entailments that L Conscoh (T) L contains Σ as a subset, and is closed under the rules for coherent logic; we write T ε ,or ε , and say that ε is deducible from in coherent logic with dependent sorts, for T coh T ε∈ . Again, we have the versions with or without equality. Conscoh (T)

A theory in intuitionistic logic , or in classical logic (with dependent sorts) is defined similarly, mutatis mutandis. Again, we have logic with or without equality. Aside the exclusion of equality in the logics without equality, all formulas are used, in contrast to coherent logic. We have the concept T ε of deducibility for each of these logics with dependent sorts.

We have completeness theorems for the various logics (coherent, intuitionistic, classical) with dependent sorts. What these completeness theorems show is that logic with dependent sorts is "self-contained". The initial view of logic with dependent sorts is that it is a fragment of ordinary multi-sorted logic. The fact that truths in the fragment can be deduced by deductions using only formulas also in the fragment is a sign, indeed, a necessary sign, that the fragment deserves the designation "logic".

To formulate completeness, let us fix a semantic category C (in the first instance, C = Set ). Let M be a C-valued L-structure. Let us write M ϕ ψ for X M[X:ϕ] ≤ M[X:ψ] , and say that M satisfies the entailment ϕ ψ .Amodel of a M[X] X theory T=(L, Σ) is a C-valued L-structure that satisfies all entailments in Σ . For a theory , and an entailment ε , let us write ε , and say that the entailment ε is a T T C C-consequence of T , to mean that all C-valued models M of T satisfy ε .Foraclass C of categories, ε means that ε for all ∈C . T C T C C

37 is the category of all -valued models of ; it is a full subcategory of ModC (T) C T Fun(L,C) . We write Mod(T) when C = Set .

The completeness theorem for coherent logic, as well as for classical logic, with dependent sorts, with or without equality, is expressed by the equivalence

ε  ε T T Set

(of course, the symbol is to be taken in any one of the four distinct senses corresponding to the four logics listed; ε accordingly ranges over the entailments of the corresponding logic). The completeness theorem for intuitionistic logic with dependent sorts, with or without equality, is

ε  ε , T T Kr

where Kr (for Kripke) denotes the class of categories of the form SetP , with P any poset.

As usual (see e.g. [MR2]), the completeness theorem for intuitionistic logic with dependent sorts may be formulated in the style of Kripke's semantics.

We will prove of the completeness theorems in §4.

38 §3. Quantificational fibrations

The notation and terminology of [M3] is used. The particular kinds of fibrations introduced here do not appear in loc.cit., but most of the needed ingredients do.

E EC Let CP = CP be a fibration; let Q be a class of arrows in B . Assume: B BC

B has a terminal object, and pullbacks ( B is left exact) . Q is closed under pullbacks: when

AA@q B OO (1) W A’A@q’ B’ is a pullback, then q∈Q implies q’∈Q . Each fiber CA ( A∈B ) is a poset; in fact, it is a lattice (with top and bottom elements, denoted , ; the meet and join operations are written as U , V , or more simply as tAAf AA U , V if no confusion may arise).

For each A@ ∈Q , * CBAA@C has a left adjoint ∃ C ABA@C ,which (q:A B) q : q: satisfies the Beck-Chevalley condition with respect to all pullback squares (1), and which satisfies Frobenius reciprocity (see pp. 342 and 343 in [M3]).

(Note that a fibration with posetal fibers (the only ones we are interested in here) is the same as a functor

* BopA@Poset : AA@fBfAB @ C A@C

to the category Poset of posets and order-preserving maps. )

The data C , Q as described make the pair (C, Q) a UV∃-fibration. We may denote C, Q by C ; we may write Q for Q . Dropping the references to and V results in ( ) C fAA

39 the notion of U∃-fibration.

A M:CA@D of UV∃-fibrations is a morphism of fibrations (among others, ECDA@E , , A@ , A@ , P { P ; in practice, we omit the M=(M12M ) M 1:BCDB M2:ECCE BCCA@B subscripts and , and write for , etc.) that takes Q -arrows to 1 2 M(A) M1(A) C QD-arrows, induces lattice homomorphisms on the fibers, and preserves all instances of each ∃ ( ∈Q ). is conservative with respect to apair , of predicates over the same q q C M (X Y) base-object if ≤ implies ≤ ; is conservative if it is conservative for all A MX MAMY X AY M such (X, Y) .

The UV∃-fibrations and their morphisms form a category UV∃ .Infact,wecanmake UV∃ into a 2-category, by making UV∃(C,D) into a category; the latter is a full subcategory of [C, D] (see p. 348 in [M3]). An arrow

A@M CA@Ph D N

A is a h:M A@N satisfying MP ≤ NP for all A∈BC , P∈C (for 11 hA the notation ≤ , see p. 349 in [M3]; ≤  ≤ * ). X ffY X Y X fY

For a category C with pullbacks, P(C) ,thefibration of predicates of C , is the fibration C with base-category C for which CA=S(A) ,theU-semi-lattice of of A , and for f:AA@B , f*:S(B)A@S(A) is the usual pullback-mapping. To say that P(C) is a UV∃-fibration, with Q the class of all arrows in C , is the same as to say that C is a coherent category (see, e.g., [MR2]).

Consider P(Set) as a UV∃-fibration, with Q the class of all arrows in Set .Amodel of C is a morphism CA@P(Set) . Mod(C) is the category of models of C ; Mod(C)= UV∃(C,P(Set)) . More generally, let us write ModD (C) for UV∃(C,D) .

E Until further notice, fix C =(CP,Q) ,asmall UV∃-fibration. Proposition (5) below is the B

40 completeness theorem for UV∃-fibrations, the fact that there are enough models of C to distinguish between any pair of different predicates in a fiber. The ones preceding (5) are used for the proof of (5).

Let us write for , the terminal object of ;and for , for . C has the 1 1B B t t11f f disjunction property if for any X, Y ∈ C1,if XVY = t ,theneither X = t ,or Y = t . C has the existence property if whenever (! :AA@1)∈Q and X∈CA , we have that ∃ (X)=t A !A implies the existence of some c:1A@A such that c*(X)=t .

(1) Suppose C has the disjunction and the existence properties, and that t ≠ f (consistency). Then C has an initial object ; in fact, , given by Mod( ) M=(M12M ) and for ∈CA , A@ * is an initial object. M1=homB (1,-) X M2(X)={c:1 A : c (X)=t}

( M may be called the global-sections model CA@P(Set) ;wesay c:1A@A belongs to X over A if c*(X)=t .)

The proof is identical to that of 2.2, p. 351 in [M3], although the statement of the latter does not include that of the present proposition.

For a fibration C , X∈B and X∈CA , the "slice" fibration C/(A, X) was described in [M3]. The base-category of C/(A, X) is B/A ; the fiber over (BA@f A)∈B/A is ∈CBB≤ , ordered as C is. We have a canonical morphism {Y : Y fX} δ δ CA@C , that takes ∈ to × A@π’ ,and ∈CB to U⋅ = A, X: /(A X) B B (B A A) Y Y X def= π**Uπ ( ≤ ; π × A@ is the other projection). Y ’ X π’ X :B A B

For a UV∃-fibration C ,wedefinethe UV∃-fibration D = C/(A, X) by also putting BA@f C ( k+{  ) ∈ QD  f∈Q . A def

41 (2) C , is a UV∃-fibration, and δ CA@C , is a map of /(A X) A, X: /(A X) UV∃-fibrations.

The proof is essentially contained in Section 2 of [M3]. It is helpful to add to 2.4(i) and (ii) of [M3] that the forgetful functor B/AA@B creates pullbacks; with this, the required instances of the Beck-Chevalley and Frobenius reciprocity conditions become clear.

A@ Q CA (3) If (! :A 1)∈ and X∈ such that ∃ (X)=t , then δ , is A !A A X conservative. If V ,and , ∈CB ,theneither δ or δ is conservative X12X =ttt Y Z , X t, X 12 with respect to (Y, Z) .

See 2.7 in [M3].

By a straightforward transfinite iteration of the construction of C/(A, X) (compare 2.8 in [M3]), we conclude from (2) and (3) that

(4) For any given A∈B , X, Y∈CA ,therearea UV∃-fibration C* having the disjunction and existence properties, and a map CA@C* of UV∃-fibrations which is conservative with respect to (X, Y) .

(5) For any given A∈B , X, Y∈CA ,thereis M:CA@P(Set) ,amapof UV∃-fibrations, which is conservative with respect to (X, Y) .

Proof. In C , , with and δ δ , we have the /(A X) 1=1C/(A, X) = A, X

d :1A@δ(A):AA@A×A A  1 k+π’ A A

42 that belongs to δ ; moreover, belongs to δ over iff ≤ . Now, start with (X) dA (Y) A X Y X, Y over A in C such that XY ;passto C’=C/(A, X) ;in C’ , **δ  δ .By(4),thereis Φ C A@C *which is conservative with respect t=dAA(X) d (Y)=Y’ : ’ to (t, Y’) such that C* has the disjunction and existence properties. By (1), we have the global-sections model N:C*A@P(Set) . The global-sections model is automatically conservative with respect to any pair (t, Z) over 1 in its domain. We conclude that, for P=NvΦ : C’A@P(Set) , P is conservative with respect to (t, Y’) ,thatis,

**δ  δ P(dAA(X)) P(d (Y)) .

It follows that

P(δ(X))  P(δ(Y)) .

For M = Pvδ : CA@P(Set) , this means that M(X)  M(Y) .

A UV∃∀-fibration is a UV∃-fibration C such that

every fiber CA is a Heyting , and for all f:AA@B , f*:CBAA@C is a of Heyting algebra; and * for each q∈QC , q (also) has a right adjoint which satisfies the Beck-Chevalley condition with respect to all (relevant) pullback squares.

For a category C with pullbacks, to say that P(C) is a UV∃∀-fibration, with Q the class of all arrows in C , is the same as what we usually express by saying that C is a Heyting category (see [MR2]). Of course, Set is a Heyting category; more, for any (not necessarily small) category A , SetA is a Heyting category. See e.g. [MR2]. The coherent structure in SetAA(the UV∃-fibration structure in P(Set ) ), although not the full Heyting-structure, is "computed pointwise"; that is, the projections π P A A@P A: (Set ) (Set) ( A∈A ) are morphisms of UV∃-fibrations.

43 E C Given any small UV∃-fibration CP , we may form P(SetMod( ) ) , and we have the B evaluation morphism

Mod(C) e:C CA@P(Set ) X @ [M@M(X)]   PP A @ [M@M(A)]

of UV∃-fibrations.

Mod(C) (6) For a small UV∃∀-fibration C , e:C CA@P(Set ) is a morphism of UV∃∀-fibrations.

Proof. The proof is a variant of that of 5.1 in [M3]. The fact that e is conservative follows from (5). We need to show that preserves Heyting implications in the fibers, and ∀ 's; eC f we limit ourselves to the second task. By using the way the ∀ 's are computed in any f P(SetA ) , our task is as follows.

Assume CA@ , a morphism of UV∃-fibrations; A@ ∈Q , ∈CAB, ∀ ∈C M: Set (f:A B) X fX and ∈ ∀ . We want the existence of ∈ C , a homomorphism A@ b M(B)-M( fX) N Mod( ) h:M N and ∈ such that . a N(A)-N(X) hA(b)=(Nf)(a)

Let us use ordinary multisorted first-order logic to talk about models of C and homomorphisms between them. Consider the language L=L(C) whose sorts are the objects of B , operation-symbols are the arrows of B , and relation-symbols are all unary, and they correspond to the predicates P∈CA ; P is sorted P⊂A . It is clear that every M∈Mod(C) may be regarded an L-structure; morphisms in Mod(C) are exactly the morphisms of L-structures. Moreover, there is a (coherent) theory T=T(C) over L such that Mod(C) = Mod(T) .

For a given L-structure M , homomorphisms h:MA@N with varying N are in a 1-1

44 correspondence with models of Diag+ (M) , the positive diagram of M , which is a set of atomic sentences in the diagram language L(QMR) in which an individual constant a of sort A has been added to L for each sort and a∈M(A) ; the elements Diag+ (M) are those atomic sentences that are true in , . We may also define + as (M a)a∈QMR Diag (M) ∪ ,where contains all for which A@ in , D(bpM) D(M) D( bM) f(a)=Bb f:A B B ∈ , ∈ and ;and contains all where ∈ , a M(A) b M(B) (Mf)(a)=(b) D(p M) P(a) A B P∈CA and a∈M(P)⊂M(A) .

Returning to our task, let a be a new individual constant of sort A ; under the assumptions, we need the satisfiability of the set

∪ ∪ ∪ ¬ ∪ T D(bpM) D(M) { X(a)} {b=Bf(a)} .

Assume this fails. By compactness, there are finite subsets ⊂ , ⊂ such that D D(bpM) D’ D(M)

∪ ∪  T D D’ b=Bf(a) X(a).

Let 〈 〉 be distinct elements of , ∈ , each distinct from , such that cii

 ∀ 〈 〉 ∀ ∀ ,.0 U,.0 U  .(7) T zii

Working inside the category B with finite limits, we can construct as an appropriate finite limit an object together with morphisms π A@ , π A@ such that for any C ii:C C :C B  -structure , ,.0 〈 〉 〈 〉 iff there is ∈ with L N N ( D)[ cii

π , π (actually, is then uniquely given). In particular, there N( ii)(c)=c N( )(c)=b c  is an element ∈ such that π , π . For any α∈ ,let c M(C) M( ii)(c)=c M( )(c)=b D’ α***be the element of the fiber over given as follows: if α , α π ; C :=: P(zi) def= i(P)  if α , α**π .Let ,.0 α *α∈ ∈ CC . Notice that ∈ . :=: P(y) def= (P) Q = { : D’} c M(Q) Consider the pullback-square

45 ρ A× CA@A B gf PP A@ C π B

We claim that

g**(Q) ≤ a (X) .(8)

By (5), it suffices to check that this holds in each model N∈Mod(C) . Assume

∈ C , ∈ * , , ρ , π , N Mod( )=Mod(T) d N(g (Q)) c=(Ng)d a=(N )d cii=(N )c  π ;wehave , ,.0 〈 〉 〈 〉 by the defining b=(N )c b=(Nf)a N ( D)[ cii

of Q .Since N satisfies the sentence in (7), it follows that a∈NX , and thus d∈N(a*(X)) , which shows the claim.

Since ∈Q ,also ∈Q .By(8), ≤ ∀ ρ**π ∀ . However, in , ∈ , f g Q gf(X)= (X) M c M(Q) but ∉π*∀ ,since ∉∀ ; this is a contradiction. c ff(X) b (X)

A UV¬∃-fibration is a UV∃-fibration in which every fiber is a . Every UV¬∃-fibration is a UV∃∀-fibration.

Without essentially changing the concepts, in each of the various kinds of fibrations introduced above, the class Q of "quantifiable" arrows may be required, in addition, to be closed under composition. If (C, Q) is a "quantificational" fibration (of one of the four kinds introduced vv above), then, with Q the closure of Q under composition, (C, Q ) is again one of the same kind as the reader will readily see. Also, any morphism f:(C, Q)A@(C’, Q’) of one vv of the four kinds is a morphism f:(C, Q )A@(C’, Q’)of the same kind.

46 §4. The syntax of first–order logic with dependent sorts as a fibration

Let beaDSV;let be the full subcategory of the kinds. Consider the category L K B=BK which is the free finite-limit completion of K : i:KA@B , and for any category S with finite limits, i*:Lex(B,S)A@Fun(K,S) is an equivalence of categories ( Lex(B,S) is the category of left exact functors BA@S , Fun(K,S)=SK the category of all functors KA@S , i* is defined as composition with i ).

It is well-known that for any (small) category , can be given as K op K BK (Fp(Set )) ( Fp(M) is the full subcategory of finitely presentable objects of M ), with i:K⊂B the functor i:KA@(Fp(SetK ))op induced by Yoneda. (The small-colimit completion of A is op op Y:AA@Set(A )(; the finite-colimit completion of A is Y:AA@Fp(SetA ) ) ; op therefore, the finite limit completion of Aopis Y:A opA@(Fp(Set (A )op )) ).

Now, for any simple category K , Fp(SetK ) is the category of finite functors KA@Set ;a functor F:KA@Set is finite if El(F)={(K, a): K∈Ob(K), a∈FK} is a finite set. Namely, each finite functor is finitely presentable, the finite functors are closed under finite

colimits in SetK , and every functor is the filtered colimit of the collection of its finite subfunctors (the latter uses that K has finite fan-out); this suffices.

Thus, B can be taken to be the opposite of the category Fin(SetK ) of finite functors KA@Set ; the canonical functor i:KA@B is (induced by) Yoneda.

Let Con[K] be the category whose objects are the contexts (of variables over K ), and whose arrows are the specializations. I claim that

Con[K] J Fin(SetK ) .

Let F:KA@Set be a finite functor. I define a mapping

47 , @ F A@ (K a) yK, a : El(F) VAR into the class VAR of variables as follows:

FF〈 , 〉 y=K, a def 2,YK, a a where

FF . Y=, K( 〈 y , 〉 ∈ j ) K a Kp (Fp)(a) p K K

This is a legitimate definition by recursion on the level of . F is a type; this requires K YK, a that

( FF, K 〈 y , 〉 ∈ j )=Y , p Kqp(F(qp))(a) q K pK K p (Fp)(a) which is true since . Hence, F is a variable. (F(qp))(a)=(Fq)((Fp)(a)) yK, a

We let Y F , ∈ . It is immediate that Y is a context. We have a F def={y:(K, aFK a) El(F)} bijection

, @ F A@≅ Y . (K a) yK, aF : El(F)

If A@ is a natural transformation, we let Y A@Y be defined by h:F G s=shF : G FG Fj G s(y, )=y , . s is a specialization: this requires that Y , s =Y , , K aKhKK(a) K aKh (a) which is the same as h ((Fp)(a))=(Gp)(ha) ( p:KA@K ) , which holds by the Kp Kp naturality of h . It is immediate that we have a bijection

@ , A@≅ Y , Y . h shFG : Nat(F G) Spec( )

hk Also, if FA@GA@H , then s=svs ,and s=1Y . kh k h 1FF

48 Thus far, we have seen that we have the full and faithful functor

F Y @ F K A@ (1) Ph shP : Fin(Set ) Con[K] Y G G

Now, given a context Z ,define A@ by ∈Z ,and F=FZ:K Set FK ={z :Kz =K} A@ by ; is a finite functor. Moreover, we have the map Fp:FK FKpz(Fp)(z)=x , p F

@ F ZA@Y s : z y:, ; Kz zF s is a specialization since

, FF , z :K (〈 x , 〉 ∈ j ) y:K{, 〈 y , 〉 ∈ j zzppK K KzpzzK (Fp)(z) p K zK

FF and s(x, )=y, =y , , by the definition of F . z p KzzxK, pp(Fp)(z)

It is clear that s is a bijection, i.e., an isomorphism in Con[K] .

We have verified that (1) is an equivalence of categories, thus our claim.

It is easy to see that the of (1) consists of those contexts Z for which ∈Z @ , is a 1-1 function. z (Kz a(z))

It is clear that although the categories Fin(SetK ) , Con[K] are large, they are essentially small.

Thus, B , the free finite-limit completion of K , can be taken to be the opposite of the category Con[K] of contexts with specializations as arrows. To describe the canonical i:KA@B under the latest construal of the completion B , let us define, for any K∈K , the context

X K ∈ j (2) K def={xp:p K K}

49 for which 〈 K 〉 is a sort, and 〈 〉 .Inthe X =XK def = K( xpp∈KjK) a(X)= p p∈KjK definition of X , the only essential points are that 〈 K 〉 is a sort, and that the KppK( x ∈KjK) mapping @ K is 1-1. is "the most general sort" of the kind ; every other such sort p xpKX K is of the form for some specialization with domain X .Further,let XKKs s

X* X ∪⋅ , K def= KK{x }

where , and, for the sake of definiteness, is taken to be the specific variable for x:XKKx K which ( . Note that under the equivalence @Y between finite functors and a xKK )=1 F F contexts, X* is the context that corresponds to the , A@ . K K(K -):K Set

When a context X is considered an object of B = (Con[K])op , it is written as [X] . Arrows s:XA@Y of Con[K] correspond to arrows [s]:[Y]A@[X] .

The canonical embedding i:KA@B (having the universal property of the finite limit completion) has X* . i(K)=[ K]

The morphism A@ is taken by to the arrow p:K Kp i

[s ]:[X**]A@[X ] pK Kp for the specialization

K s :X**A@X :xps@ x( Kq:K A@K), x  s@ x. K (3) p KppKq qppq K p

Note that in the category , the object X is the same as for the " -valued B [ K] i[K] B Φ K-structure i:KA@B ", that is, the limit of the composite KP(K-{K})A@KA@i B .

We single out four classes of arrows in Q ⊂Q ⊂Q ⊂Q Q consists of the Con[K], 0123. 0 inclusion-arrows X A@X* ,where ranges over the kinds. Q consists of the incl: KK K 1 ⋅ inclusion-arrows of the form incl:XA@X∪{x} ,where X is any (finite) context, and

50 ⋅ X∪{x} is also a context (for this, it is necessary and sufficient that x∉X and Dep(x)⊂X ). Q is the class of all 1-1 arrows XA@Y where Y X . Finally, Q is 2 i: card( )=card( )+1 3 the class of all 1-1 arrows XA@Y .

⋅⋅ Every time s:YA@X is a specialization, and t:Y∪{y}A@X∪{x} extends s , with t(y)=x , we have the pushout diagram

⋅ YA@incl Y∪{y} st (4) P W P XA@X∪⋅ incl {x}

in . All arrows in Q are pushouts of ones in Q .Toseethis,foragiven Con[K] 10 ⋅ ⋅ XA@incl X∪{x} , (4) to X A@inclX *as YA@ incl Y∪{y} ,and s:X A@X KKxxK x K given by x . s(xpx )=x , p

It is clear that Q is the closure of Q under isomorphisms (meaning that A@ ∈Q iff 21q:A B 2 there is A@ ∈Q with some commutative q’:A’ B’ 1

AA@q B ≅PP { ≅ A@ A’ q’ B’).

(4) shows that any arrow A@ in Q has a pushout along any A@ that is again q:A B 1 a:A A’ in Q . Thus, Q is closed under pushout, and in fact it is the closure of Q under pushout. 12 0

Q is the closure of Q under composition. Indeed, given any inclusion XA@Y , there is a 32 i: finite sequence X X ⊂X ⊂ ⊂X ⊂X Y of contexts = 01... n-1 n= such that X X ; enumerate Y X as 〈 〉 n such that the level of card( i+1)=card( ii)+1 - y 1 K is non-increasing, and put X =X∪{x , ...x } . This shows that every inclusion yii 1 i XA@Y is the composite of arrows in Q ; since every 1-1 arrow is isomorphic to an i: 1 inclusion, the assertion follows.

51 Without talking about syntax, Q ∈Q may be described as the class of [ 00]={[q]: q } arrows of the form q:iKA@[K] ,where K∈K , i:KA@B=(Fin(SetK ))op is induced by Yoneda, and is the limit of the composite P A@Φ A@i . Q is the [K] K (K-{1K }) K B [ 2] closure of Q under pullback. Q is the class of all ; also, it is the [ 03] [ ] closure of Q under composition. [ 2]

≠ For the purposes for logic without equality, we let the class Q of arrows in B be either Q ( ∈Q }or Q ; both Q and Q are closed under pullback, and [ 22323] ={[q]:q [ ] [ ] [ ] the second class is the closure of the first under composition. (According the remarks at the of the last section, the two possible choices are essentially equivalent).

Corresponding to logic with equality, we have Q= , which is obtained by adding to Q≠ all ⋅⋅ isomorphic copies of arrows of the form [p] for p of the form p:X∪{x, y}A@X∪{x} such that x and y are distinct variables of the same type, their kind is a maximal one, and p is defined so that pX is the identity and p(x)=p(y)=x . Categorically, if we put X , X∪⋅ ,and A@ , ,wehave δ A@ × ,the A=[ ] B=[ {x}] q:B A q=[incl] [p]= =B B AB diagonal.

⋅ If s:X∪{x, y}A@Y ,thenfor x’=s(x) , y’=s(y) and X’=Y-{x’, y’} , X’ is a context, since no variable z can have x’∈Dep(z) or y’∈Dep(z) , by the maximality ⋅ assumption on the kind of x and y ; Y = X’∪{x’, y’} . We have a pushout

⋅ ⋅ X∪{x, y}A@p X∪{x} st PP X ∪⋅⋅, A@X ∪ ’ {x’ y’} p’ ’ {x’}

with the evident p’ and t . It follows that all pullbacks of the additional arrows in Q= are again of the same form, thus Q= is closed under pullback. Also, all the additional arrows in Q= are pullbacks of the specific ones where is a maximal kind, [pK] K X ∪⋅⋅, A@X ∪ ; here, X ∪ ⋅X* defined above, etc. pKKK: {x y} KK{x } KKK{x }=

52 Suppose T=(L, Σ) is a theory; there are six possibilities for the logic: coherent, intuitionistic, or classical, each with or without equality. We define a fibration E C =[T]=CP , with a set Q=QC of distinguished (quantifiable) arrows in B . B has been B given in the foregoing; we use Q≠ when we exclude equality, Q= otherwise, as Q .

A formula-in-a-context is an ordered pair (X, ϕ) , written as [X:ϕ] , such that X is a context, and ϕ is a formula with Var(ϕ)⊂X . With a given X , [X:ϕ] is called a formula-over X .

E X To define CP ,for [X]∈B , the fiber C[ ] is given as the set of equivalence classes B [X:ϕ]/X of formulas-over X under the equivalence relation

[X:ϕ]  [X:ψ]  T ϕψ and T ψϕ X XX

(the range of the formulas ϕ , ψ , and the deducibility relation is understood according to [X] the logic in question). In what follows, we will write [X:ϕ] for [X:ϕ]/X . C is partially ordered by

[X:ϕ] ≤ [X:ψ]  T ϕψ ; X X

by the rules (Taut) and (Cut) this is well-defined and it is a partial order. Finally, for XA@Y in ,thatis, Y A@ X , * X ϕ Y ϕj .By s: Con[K] [s]:[ ] [ ] [s]([: ])=[def : s] XY the rule (Subst) , [s]:* C A@C is a map of posets.

Since (ϕjs)jt = ϕjts ,and ϕjid = ϕ , we have a (pseudo)functor X@CX , ([X]A@[s]*[Y]) @ [s] ; thus, we have a fibration. The rules for connectives (not counting the last two) make sure that each fiber has the necessary (propositional) structure, where each operation is given by the corresponding syntactic operation on formulas; e.g., X ϕ U X ψ X ϕUψ . [ : ] [X] [ : ]=[ : ]

For X∪⋅⋅A@ X ( XA@X∪ the inclusion) in Q and [i]:[ {x}] [ ] i: {x} [ 1]

53 X ⋅ X X∪⋅ ϕ ∈C[ ∪{x}] ,wehave∃ X∪⋅ ϕ X ∃ ϕ ∈C[ ] ,and [ {x}: ] [i]([ {x}: ])=[ : x ] similarly for ∀ in place of ∃ . This follows from the rules (∃) and (∀) . As we pointed out ⋅ inSection2,if Var(ϕ)⊂X∪{x} , then ∀xϕ , ∃xϕ are well-formed. Since every arrow q in Q is an isomorphic copy of a composite of arrows in Q , the operation ∃ ,or [ 31] [ ] q ∀ , will be well-defined, and can be expressed in terms of ∃ ,or ∀ ,for ∈ Q . qrrr [ 1]

In the case of logic with equality, we have, for

⋅ ⋅ δ:[X∪{x}]A@[p] [X∪{x, y}] ,

an additional arrow in Q= , ∃ ⋅ X∪⋅ , , and more generally, δ(t[X∪{x}])=[ {x y}:x=Xy] ∃ X∪⋅⋅ϕ X∪ , U ϕ . This is F. W. Lawvere's observation on [δ]([ {x}: ])=[ {x y}: x=Xy ] the definition of equality in hyperdoctrines [L2]. The claimed equality can be deduced by using the rules of equality. We also have that

∀ X∪⋅⋅ϕ X∪ , ϕ . [δ]([ {x}: ])=[ {x y}: x=Xy ]

The fact that substitution is compatible with the logical operations gives that for any XY specialization s:YA@X , [s]:* C A@C preserves the (propositional) structure, and that the Beck-Chevalley conditions are fulfilled. We obtain a UV∃-fibration, a UV∃∀-fibration and a UV¬∃-fibration in the respective cases of coherent logic, intuitionistic logic and classical logic; the presence of the rules (UV),(U∃) ensures this in the coherent case, and that of (¬) in the classical case.

The construction [T] has the universal property of the fibration of the appropriate kind that is freely generated by T . In what follows, we describe this universal property in a somewhat incomplete way, namely, for "target" fibrations of the form P(C) , rather than arbitrary (suitably structured) fibrations.

For a relation ∈ , we make a definition of the context X analogously to X in R Rel(L) RK  (2) : X R ∈ j such that 〈 R 〉 is a well-formed atomic R def={xp:p R L} R def= R( xpp∈RjL)  formula, and α 〈 〉 . is the "most general" atomic formula using the relation (X)= p p∈RjL R

54 R . Moreover, for p∈RjL ,welet

K s :X**A@X :xpR@ x(q:K A@K), x @ x. R p KppRq qppq K p

Changing the meaning of the symbol ModD (C) , let us use the notation now in the variable sense of either of UV∃(C,D),UV∃∀(C,D),UV¬∃(C,D) as the context requires it, according to which logic we are dealing with. In what follows, C is a category having enough structure for the logic at hand: it is a coherent, a Heyting or a Boolean category in the three respective cases.

We have a "forgetful" functor

- A@ (5) ( ) : ModP(C) ([T]) ModC (T)

defined as follows. Given , ∈ ,wedefine - A@ , P=(P12P ) ModP(C) ([T]) P :L C --*∈ ,by X ;for A@ , -(see (3)) P ModC (T) P (K)=P1([ Kp]) p:K K P (p)=P1([sp]) (more briefly, - v , for the canonical embedding A@ ); for ∈ , P K=P1 i i:K B R Rel(L)  - the domain of a monomorphism representing the subobject X of P (R) m P2([ R:R]) X ; and for A@ , - v . P1([ Rp]) p:R K P (p)=P1([sp]) m

For A@ in (that is, A@ with properties), - v ;itis h:P Q ModP(C)11 ([T]) h:P Q h = h i easy to see that h---is an arrow P A@Q .

In the case of coherent logic, the functor (5) is full and faithful, and in the case of intuitionistic and classical logics,

- isoA@ iso ,(6) ( ) : ModP(C) ([T]) ModC (T) with both categories restricted to have only isomorphisms as arrows (thus, they are ), is full and faithful. The faithfulness is obvious; the fullness requires an easy proof by induction on the complexity of formulas.

55 In fact, in the case of coherent logic, (5), and in the other two cases, (6), is an equivalence of categories. Indeed, if M:LA@C is a model of T ,wedefine

[M]:[T] A@ P(C)

by X X , X ϕ X ϕ . The fact that is a model ensures [M]([12]) = M[ ] [M]([: ]) = M[ : ] M that [M] is well-defined (on equivalence classes); the rules of the logic, built into the definition of [T] , ensure that [M] is a morphism of fibrations with the appropriate preservation properties. Finally, we have - ≅ whose components are jM:[M] K M K canonical isomorphisms X* ≅ ,and is in fact an isomorphism M([ KM]) M(K) j - ≅ . jM:[M] M

The completeness theorem

ε  ε T T Set

for coherent logic with dependent sorts, with or without equality, is now an immediate consequence of 3.(5). Indeed,

T ϕ ψ  [X:ϕ] ≤ [X:ψ] in [T] X X by the construction of [T] ;  for all P:[T]A@P(Set) , P[X:ϕ] ≤ P[X:ψ] by 3.(5) ;  for all MT , M ϕ ψ X by the above description of the equivalence J , ModC (T) ModP(C) ([T])  T ϕ ψ Set X by definition.

3.(6) gives a proof of the completeness theorem for intuitionistic logic. 3.(6) says that there is a category K , namely Mod(T) , such that T has a conservative Heyting morphism into SetK ; changing here K into a small category, and then into a poset is an easy matter; see [MR2], [M3].

56 As it is well-known, completeness for classical logic follows from that for coherent logic directly.

In summary, it is worth emphasizing that the study of first-order logic with dependent sorts E without equality is the same as the study of "quantificational" fibrations (CP, Q) where the B base category is K op for a simple category , with Q being the class of B=((Set )fin ) K all epimorphisms in B . This is a remarkably simple algebraic description of the objects of our interest, even though it is not one that is conjured up immediately by the idea of "first-order logic with dependent sorts".

57 §5. Equivalence

Let L be a fixed DSV, K the full subcategory of its kinds.

We have defined what an L-structure is; even, what a C-valued L-structure is, for any C with finite limits. In what follows, we will make the minimal assumption that C is a (which is equivalent to saying that P(C) , with "total" Q ,isa U∃-fibration: just ignore f and V in the definition of UV∃-fibration).

The category of -valued -structures, , has objects the -valued -structures, C L StrC (L) C L and morphisms natural transformations; Str (L) is a full subcategory of CL (with L in C its last occurrence understood as a mere category). We write for . Str(L) StrSet (L)

Given ∈ ,wehave A@ , its -reduct, the structure of kinds associated M StrC (L) M K:K C K to . For any ∈ , we have the canonical monomorphism : x@ M R Rel(L) mR M(R) M[R]= (MK)[R] (see §1). For a natural transformation (f:UA@V) ∈ CK ,wehavethe canonical arrow A@ for which f[R]:U[R] V[R]

f U[R] A@[R] V[R] πUπV pPP { p A@ U(Kph ) V(K p ) Kp

for all p∈RL .If (h:MA@N) ∈ Str(L) , then

h M(R)A@R N(R) yy MN mR { mR PP (MK)[R]A@(NK)[R] h[R] which shows that hK:MKA@NK determines h (if any).

58 We have the forgetful functor E E A@ K ; E is faithful, by the last remark. C,LC= :Str (L) C E is a fibration. Indeed, given f:UA@V in CK ,and N over V (that is, NK=V ), then the Cartesian arrow h:MA@N over f is obtained by defining M and h such that MK = U , hK = f and, for all R∈Rel(L) ,

h M(R)A@R N(R) yy MW N mRmR PP U[R]A@V[R] f[R]

is a pullback (it is immediate to see that h so defined is Cartesian). As usual with fibrations, let us denote so defined by **, and the Cartesian arrow by θ A@ . M f (N) h f:f (N) N

E is a fibration with fibers that are .

When in particular C = Set (which is the most important case), a functor U:KA@Set is called separated if U(K)∩U(K’) = ∅ whenever K , K’ are distinct objects of K . For a separated U ,wedefine QUR=abcU(K) ; for a general U , we would put QUR= $ U(K)= K∈K K∈K {(K, a):k∈K, a∈U(K)} . Of course, every functor is isomorphic to a separated one. When f:UA@V ,and U is separated, for a∈QUR we may write h(a) without ambiguity for for which ∈ . For notational simplicity, we will restrict attention to separated hK(a) a U(K) functors KA@Set .

I will now isolate a property of a natural transformation f:UA@V in CK . Let first . We say that is very surjective if whenever ∈ , 〈 〉 ∈ ,the C = Set f K K app∈KK U[K] mapping

A@ @ f 〈 〉 : UK( 〈 a 〉 ∈  ) VK( 〈 fa 〉 ∈  ):a f(a) app∈KK ppK K ppK K

(see (3) in §1) is surjective.

For a general C (assumed to be regular), f:UA@V in CK is very surjective if for every

59 ∈ , the canonical map A@ × from the diagram below is K K p:U(K) P=U[K] V[K]V(K) surjective (a regular ):

fK U(K)G@ %V(K) {   πU p hL πV K { P K P  W P W U[K]A@V[K]. f[K]

It is clear that if f is an isomorphism (in CK ), then it is very surjective. It is easy to see (by induction on the level of K∈K ) that very surjective implies surjective (being a regular

epimorphism in CK ), but not necessarily conversely.

In this section, we consider logic with dependent sorts only without equality; all L-formulas are without equality.

(1) Let A@ in K be very surjective, and any ∈ over .Let f:U V C N StrC (L) V θ * A@ . h= f:M=f (N) N

(a) Let first C =Set . h is elementary with respect to logic without equality in the sense that for any context X and L-formula ϕ (in logic with dependent sorts and without equality) with ϕ ⊂X , and any 〈 〉 ∈ X , Var( ) axx∈X M[ ]

 ϕ 〈 〉   ϕ 〈 〉 M [ axx∈X] N [ haxx∈X].

(b) For a general C which is a Heyting category (to interpret all L-formulas), for any ϕ and X as above, there is a pullback

M[X:ϕ]A@N[X:ϕ] yyW PP (1b) U[X]A@V[X] fX

60 (the vertical are representatives for the subobjects M[X:ϕ]∈S(U[X]) , * N[X:ϕ]∈S(V[X]) ; in other words, (1b) says M[X:ϕ]=(fX) N[X:ϕ] ).

here, fX is the canonical map determined through by the definition of U[X] , V[X] as limits in C .

Obviously, (b) generalizes (a).

The proof for (a) can be given as a straightforward induction on the complexity of ϕ .The clause for atomic formulas is essentially the definition of M . For the propositional connectives, the induction step is automatic. By the in Set between ∃ and ∀ ,itis enough to handle the inductive step involving ∃ , which is done using the "very surjective" assumption. In Appendix B, I will take a "fibrational" view of the notion of equivalence, and give a detailed proof of the more general form (b) .

Let M , N be C-valued L-structures. We say that they are L-equivalent, and we write  , if there is a diagram M L N

G m tP n Wh MN

in such that , are very surjective, and and are Cartesian arrows StrC (L) m K n K m n in the fibration E . Paraphrased, this means that there exists a functor ∈ K and very C, L W C surjective maps m:WA@MK , n:WA@NK such that m**(M)=n (N) ,thatis,forall R∈Rel(L) ,

M(R)M NM(R)× W[R]=N(R)× W[R]A @N(R) yyM[R] N[R]  W y W  (1') PPP M[R]M N W[R] A @N[R] mn[R][R]

(where the equality means equality of subobjects of W[R] ). In case C =Set , (1') means that if ∈ , 〈 〉 ∈ , then R Rel(L) cpp∈RK W[R]

61 〈 〉 ∈  〈 〉 ∈ (1") mcpp∈RK M(R) ncpp∈RK N(R).

The data (W, m, n) are said to form an L-equivalence of M and N ; in notation, , ,  . (W m n):M L N

It is easy to see that the relation  is an equivalence relation (for a proof, see Appendix B). L It is also clear that isomorphism of L-structures implies L-equivalence.

Let us write ≡ for: σ  σ for all -sentences in logic with dependent sorts M L N M N L and without equality. We have

(2)(a)   ≡ M LLN M N .

This immediately follows from (1).

The word "equivalence" is used in " L-equivalence" because of the relationship to the various notions of "equivalence" used in category theory; see later.

At this point, the reader may want to look at Appendix C, which may help understand the concept of L-equivalence.

We now will exploit the fact that we have specified variables "with arbitrary parameters". In what follows, a context is a, not necessarily finite, set Y of variables such that y∈Y , x∈Dep(y) imply that x∈Y . When we want to refer to the previous sense of "context", we will say "finite context". A specialization is a map of contexts whose restriction to all finite subcontexts of the domain is a specialization in the original sense. Just as in case of finite contexts, there is a correspondence between contexts and functors F:KA@Set which is an equivalence of the categories K and , the category of all (small) contexts and Set Con∞ [K] specializations.

Given a context Y and an K-structure M , the set M[Y] is defined by the formula (1), §1

62 (which was the definition of M[Y] for finite Y ). Given a formula ϕ with Var(ϕ)⊂Y , Y ϕ is the subset of Y for which, for any 〈 〉 ∈ Y , M[ : ] M[ ] ayy∈Y M[ ]

〈 〉 ∈ Y ϕ  〈 〉 ∈ Y ϕ ayy∈Y M[ : ] ayy∈Y’ M[ ’: ]

for any (equivalently, some) finite context Y’ with Var(ϕ)⊂Y’⊂Y . As before, we write also ϕ 〈 〉 for 〈 〉 ∈ Y ϕ . M [ ayy∈Y] ayy∈Y M[ : ]

Suppose X is a context, , -structures, 〈 〉 ∈ X , 〈 〉 ∈ X . M N L a= axx∈X M[ ] b= bxx∈X N[ ] We write

 , , ,  , (3) (W m n):(M a) L (N b) if , ,  and there is 〈 〉 ∈ X such that and (W m n):M L N sxx∈X W[ ] msxx=a ns xx=b  for all ∈X . We write ,  , if there is , , such that (3) holds. x (M a) L (N b) (W m n)

  With , , X, , as above, we write , ≡ , for: for all -formulas ϕ with M N a b (M a) L (N b) L ϕ ⊂X ,wehave ϕ 〈 〉  ϕ 〈 〉 . Var( ) M [ axx∈X] N [ bxx∈X]

We have the following generalization of (2)(a) :

  (2)(b) ,  ,  , ≡ , ; (M a) LL(N b) (M a) (N b) this also follows immediately from (1) .

Let Y be a context, a variable such that ∉Y but Y∪⋅ is a context (thus, ∈Y x x {x} xx, p for all ∈ j ), and let Φ be a set of formulas in logic with dependent sorts over such p Kx K L ⋅ that Var(Φ)=abcVar(ϕ) ⊂ Y∪{x} ; such Φ is called a Y-set (of formulas; with x any ϕ∈Φ variable as described with respect to Y ). Let M be an L-structure, and 〈 〉 ∈ Y . We say that Φ is satisfiable in , if there is ∈Q R (more a= ayy∈Y M[ ] (M a) a M

63 precisely, ) such that , (of course, , a∈MK[〈 a 〉 ∈ j ] M ϕ[a a/x] a a/x x xx, pxp K K stands for 〈 〉⋅ for which for ∈Y ,and ). Φ is finitely ayy’ ∈Y∪{x} ayy’=a y a x’=a satisfiable in (M, a) if every finite subset of Φ is satisfiable in (M, a) . M is said to be Y-L-saturated if for every a∈M[Y] and every Y-set Φ ,if Φ is finitely satisfiable in (M, a) , then Φ is satisfiable in (M, a) .

Let κ be an infinite cardinal. We say that M is κ, L-saturated if it is Y-L-saturated for every context Y with cardinality smaller than κ .

For saturated models for ordinary first order logic, see [CK]. In [MR2], one can find a detailed introduction to saturated and special models for multisorted logic; the basic facts and their proofs in the multisorted context do not essentially differ from the original one-sorted versions.

κ, L-saturation is κ-saturation with respect to L-formulas. Since L-formulas form a part of the multisorted formulas over QLR , it is clear that if M ,an L-structure, is κ-saturated as a structure for the similarity type QLR , then M is κ, L-saturated. More generally, suppose that we have "interpreted" L in a theory S in ordinary multisorted first-order logic; that is, we have a C-valued L-structure I:LA@C ,for C the Lindenbaum-Tarski category [S] of S (see [MR]; [S] is a Boolean category). Then if M is a model of S , or equivalently, M:CA@Set is a coherent functor, and M is κ-saturated in the ordinary sense, then the L-structure ML=MI:LA@Set is κ, L-saturated.

By the cardinality of the structure M , #M , we mean the cardinality of its underlying set QMR .

(4) Suppose the L-structures M , N are κ, L-saturated, and both are of cardinality ≤κ . Then the converses of (2)(a) and (2)(b) hold:

≡   ; M LLN M N

and more generally, if X is a context of size < κ , a∈M[X] , b∈N[X] , then

64 , ≡ ,  ,  , . (M a) LL(N b) (M a) (N b)

Proof.

For a given infinite cardinal κ , and a given context X of cardinality less than κ ,let U=U[κ, X] be a context such that #U = κ , X⊂U , and for every sort X with Var(X)⊂U , the cardinality of the set of variables x∈U with x:X is equal to κ .Itiseasytoseethat such an U exists; we define contexts U by recursion on ≤ for the height of ;let i i k k K U ∅ ;if U has been defined, pick, for every sort whose kind is of level and for 0= i X i which ⊂ U ,aset of variables such that κ , and let U be the Var(X) iXV v:X #V X= i+1 union of U and all the for all such ;if ,let U abcU ;let U U . V X k=ω ω= = iX i<ω ik

Next, enumerate U as a sequence 〈 〉 in such a way that for each β κ , 〈 〉 uαα<κ < uαα<β is a context; equivalently, such that for each , . Note first of all β<κ Dep(uβ)⊂{uα:α<β} that for any finite context Y , there is an enumeration Y such that 〈 〉 is ={yiii:i

For every sort such that U ,let be an enumeration in increasing X Var(X)⊂ 〈 uα 〉 ν κ X, ν < order of all of sort for which X . Finally, for any < ,let be the ordinal uααX u ∉ α κ ν[α] ν for which α α where is the sort of . X, ν = X uα

Assume X is a context of size κ , , ≤ κ , 〈 〉 ∈ X , < #M #N a= axx∈X M[ ] 〈 〉 ∈ X ,and , ≡ , . For any -sort 〈 〉 , b= bxx∈X N[ ] (M a) L (N b) M MK( cpp∈KjK)=MK(c) let us fix an enumeration of the set ; here, 〈 eξξ〉 λ = 〈 e , , ξξ〉 λ MK(c) λ , < K c < K, c K c ≤ κ .

Consider U=U[κ, X] constructed above.

65 We define a context Z , a subset of U , by deciding, recursively on < ,whether α κ uα belongs to Z or not; furthermore, we also define, for each Z , elements Q R and uαα∈ c ∈ M Q R .Let Z denote the set of all with for which Z ,and be the dαα∈ N uβββ<α u ∈ c[α] sequence 〈 c 〉 X Z ∈M[X∪Z ] for which c =a ( x∈X )andc =c ( u ∈Z ). zz∈ ∪ α α xx uβ ββα Similarly, we have X Z . The induction hypothesis of the construction is that d[α] ∈ ν[ ∪ α]

, α ≡ , α .(5) (M c[ +1]) L (M d[ +1])

Suppose ,and Z , , have been defined so that, for all , α < κ α c[α] d[α] β<α , β ≡ , β . Since in the definition of " ≡ ", formulas with finitely (M c[ +1]) LL(M d[ +1]) many free variables are involved, we can conclude that

, α ≡ , α .(6) (M c[ ]) L (M d[ ])

Look at the variable u and its sort X .If u ∈X ,welet u ∈Z , c =a , d =b .(5) ααααuααα u is now an automatic consequence of (6).

If not all the variables in (which are sfor )areinZ , then Z , and we are X uβ’ β<α uα∉ finished with the stage α .

Assume that X and all the variables in are in Z . Look at the ordinal ; uα∉ X ν = ν[α] write ν in the form ν=2 ⋅ μ or ν=2 ⋅ μ+1 as the case may be. Let first ν=2 ⋅ μ . With , consider the -sort and its X = K( 〈 uβ 〉 ∈ j ) M MK( 〈 cβ 〉 ∈ j )=MK(c) ppp K K p K K previously fixed enumeration ( ). If ,thenagain 〈 eξξ〉 λ = 〈 e , , ξξ〉 λ μ≥λ < K c < K, c ∉Z . If, however, μ λ , then ∈Z . Moreover, . uααα< u c def= eμ

Let be the X Z -set of all formulas with X Z ⋅ for which Φ ∪ αααϕ Var(ϕ)⊂ ∪ ∪{u } , . I claim that is finitely satisfiable in , .Let be a M ϕ[c[α] eμ/uα] Φ (N d[α]) Ψ finite subset of Φ .For ϕ ,.0Ψ ,wehave ϕ α , , hence, = M [c[ ] eμ/u] (note that is well-formed, since for every , , M (∃uααϕ)[c[α]] ∃u ϕ z∈Var(ϕ) z≠u α we have X Z , hence X Z ,and ). As a consequence, by (6), z∈ ∪ αααDep(z)⊂ ∪ u ∉Dep(z)

66 N(∃uϕ)[d[α]] . This means that Ψ is satisfiable in (N, d[α]) as desired.

Since X Z ,and is , -saturated, is satisfiable in , ,by #( ∪ α)<κ N κ L Φ (N d[α]) , say. The choice of ensures that (5) holds. dα∈NK( 〈 dβ 〉 ∈ j ) Φ p p K K

In case ν=2 ⋅ μ+1 , we proceed similarly, with the roles of M and N interchanged.

With the construction completed, we put Z abcZ .Welet be the functor = α W α<κ FZ:KA@Set associated with the context Z (see §4). m:WA@MK , n:WA@NK are defined by , ( Z ) . The definition ensures that X Z and m(uαα)=c n(u ααα)=d u ∈ ⊂ m(x)=a , n(x)=b ( x∈X ). xx

Let us see that is very surjective. Let ∈ . is the set of all tuples 〈 〉 m K K W[K] zpp∈KjK for which each ∈Z ,and 〈 〉 is a (well-formed) sort; 〈 〉 zpppX=K( z ∈KjK) WK( zpp∈KjK) is the set of all z∈Z such that z:X . So, assume that is a sort, and X=K( 〈 z 〉 ∈ j )=K( 〈 uβ 〉 ∈ j ) ppK K p p K K

= . a∈MK( 〈 mz 〉 ∈ j )=MK( 〈 cβ 〉 ∈ j ) MK(c) ppK K p p K K

Then for some μ λ , and for α α , the construction at stage α a=eK, c, μ < K, cX= , 2 ⋅ μ puts into Z ;thatis, ∈ 〈 〉 , with as desired. uαα:X u WK( zpp∈KjK) a=cαα=mu

The fact that n is very surjective is seen analogously.

We have that , ,  , since (1") is a consequence of (5) being true for all (W m n):M L N α<κ ; one has to apply (5) to atomic formulas.

This completes the proof of (4).

Let C be a small Boolean category. By a model of C we mean a functor M:CA@Set preserving the Boolean structure (that is, M is a coherent functor). We write MC to say that M is a model of C .

67 There is a theory Σ in multisorted first-order logic, with the underlying T=(L,CCC) L C graph of , such that the models of are the same as the models of (note that both the C C TC models of and the models of are particular diagrams A@ ). Moreover, for any C TCCL Set subobject ϕ∈ , ∈ , there is a (simply defined) -formula ϕ with a single S(CCA) A C L (x) free variable x:A such that for every MC and a∈M(A) , Mϕ[a] ( Mϕ[a/x] )iff a∈M(ϕ) ( ⊂M(A) ). See [MR].

For σ∈ , a subobject of the terminal object in , we write σ for σ in S(1C ) C M M( )=1 . We will call a subobject of a sentence in . Set 1C C

Let I:LA@C a C-valued L-structure (in particular, I:LA@C is a functor from L as a category). When is the Lindenbaum-Tarski category of a theory , Σ in C [S] S=(LSS) ordinary multisorted logic (see [MR] or [M?]), then such an I is what we should consider an interpretation of the DS vocabulary L in the theory S .Anexampleisobtainedbytaking S=(QLR, Σ[L]) (for Σ[L] , see §1), and for I:LA@[S] the [S]-structure defined by I(A)=[a:t] for A∈L where a:A , and for f:AA@B , I(f)= 〈 a@b:fa=b 〉 :[a:t]A@[b:t] . I:LA@[S] is the canonical interpretation of logic with dependent types in multisorted logic. In this case, for any formula ϕ of FOLDS

over L , with Var(ϕ)⊂X ,wehave I[X:ϕ]=m**[X:ϕ ] ; here, m:I[X:ϕ]x @{X}= & K is the canonical monomorphism, m* denotes pulling back defx∈X x along m ; ϕ* was defined in §1.

For a general I:LA@C , and for an L-sentence θ , let us write I(θ) for the sentence I[∅:θ] of C .Incase C=[S] , I(θ) also stands for any one of the S-equivalent -sentences which are the representatives of the -subobject θ . LS C I( )

When MC , the composite MI:LA@Set is an L-structure. We also write ML for MI ; ML is the L-reduct of M (via I ).

Let C and D be small Boolean categories, I:LA@C and J:LA@D . Notational conventions introduced above for I:LA@C are valid for J:LA@D , mutatis mutandis.

(7)(a) Assume that σ is a sentence of C , τ asentenceof D ,andforall MC , ND ,

68 σ    τ M & M L L N L N .

Then there is an L-sentence θ in logic with dependent sorts without equality such that for all MC , ND ,wehave

M  σ  ML  θ and NL  θ  N  τ .

For a more general formulation, consider a finite L-context X , and the object I[X]∈C . X is defined as a finite limit in ; see the end of §1; let π X A@ be the I[ ] C [x]:I[ ] I(Kx ) limit projections ( x∈X ). Given any MC , we have similar projections ρ X A@ in , and a canonical isomorphism [x]:(M L)[ ] MI(Kx ) Set ≅ μ:(ML)[X]A@M(I[X]) making each diagram

μ (ML)[X]GA@ M(I[X]) ≅ { t ρ π (7') [x] hWM( [x]) MI(Kx )

commute. If 〈 〉 ∈ X , we write 〈 〉 for μ ∈ X . Once again, a= axx∈X (M L)[ ] a (a) M(I[ ]) similar conventions apply in the context of J:LA@D .

(7)(b) Assume that X is a finite -context, σ∈ X , τ∈ X , L S(CDI[ ]) S(J[ ]) and for all MC , ND , a∈(ML)[X] , b∈(NL)[X] ,

 〈 〉 ∈ σ ,  ,  〈 〉 ∈ τ .(8) a M( )&(M L a) L (N L b) b N( )

Then there is an L-formula θ in logic with dependent sorts without equality with Var(ϕ)⊂X such that

σ ≤ X θ , X θ ≤ τ . (8') I[X] I[ : ] J[ : ] J[X]

Note that (8') may be written equivalently as

69 for all MC , ND , a∈(ML)[X] and b∈(NL)[X] , 〈 a 〉 ∈M(σ)  MIθ[a] and NJθ[b]  〈 b 〉 ∈N(τ) .

Proof. Let us extend the vocabulary to by adding a single new individual LCCL(c) constant of sort X . For any ϕ∈ ,let ϕ denote ϕ ,the c A def= I[ ] S(C A) (c) (c/x) result of substituting c for x in ϕ(x) .Foran L-formula θ with Var(θ)⊂X ,let θ(c) stand for X θ . Similarly, we introduce X ;for ψ∈ , ψ (I[ : ])(c) d:Bdef= J[ ] S(D B) (d) and for θ as before, θ(d) .

Let Θ be the set of all -formulas θ with θ ⊂X such that σ ≤ X θ . Consider L Var( ) A I[ : ] the set Σ Σ ∪ θ θ∈Θ of -sentences. I claim that def= DD{ (d): } L(d)

, Σ  τ .(9) (LD (d) ) (d)

Once the claim is proved, by compactness there are finitely many θ ∈Θ ( ) such that i i

Assume that there is an infinite cardinal λ≥ such that λ+ λ (see below for the #LC =2 + legitimacy of this assumption). Let κ=λ . According to the existence theorem for saturated models (see [CK], [MR2]), any -structure is elementarily equivalent to a κ-saturated L(D d) structure of cardinality ≤ κ . Therefore, to show (9), take (N, b/d) ,a κ-saturated model of cardinality ≤κ of , Σ ,toshow ,  τ . (LD (d) ) (N b/d) (d)

Let Φ be the set of L-formulas ϕ with Var(ϕ)⊂X such that b∈N(I[X:ϕ]) ⊂ NB ;for every L-formula ϕ with Var(ϕ)⊂X , exactly one of ϕ , ¬ϕ belongs to Φ .Since , is a model of , Σ , with Σ defined as it is, we have Θ ⊂ Φ . I make the (N b/d) (LD (d) ) subclaim that the theory

, Σ ∪ σ ∪ ϕ ϕ∈Φ (10) (LCC (c) { (c)} { (c): }) is consistent. Consider a finite subset ϕ of Φ .If { i:i

70 , Σ ∪ σ ∪ ϕ were not consistent, then we would have, for (LCC (c) { (c)} { i(c):i

Now, let (M, a/c) be a κ-saturated model of (10) of cardinality ≤ κ .Let a∈(ML)[X]  such that a= 〈 a 〉 (see (7') ) and b∈(NL)[X] such that b= 〈 b 〉 . Then, for any L-formula θ with Var(θ)⊂X such that MLθ[a] ,wehave ¬θ∉Φ , hence θ∈Φ ,hence    θ . This says that , ≡ , .By(4), ,  , ,and N L [b] (M L a) LL(N L b) (M L a) (N L b)  by the (8), the assumption of the proposition, 〈 b 〉 ∈N(τ) ,thatis, Nτ[ 〈 b 〉 /x] ,thatis, (N, b/d)  τ(d) as promised.

The set-theoretic assumption used in the proof is redundant, by a general absoluteness theorem ( statements are absolute with respect to the constructible universe, in which the Generalized Continuum Hypothesis (GCH) holds; see [J]). On the other hand, one may use "special" models in place of saturated ones, and avoid the use of GCH; see [CK], [MR2].

(11)(a) Assume that S is a theory in multisorted logic, and I:LA@[S] is an interpretation of the DSV L in S . Suppose that the class Mod(S) of models of S is invariant under -equivalence in the sense that for any -structures and , ∈ and L LS M N M Mod(S)  imply that ∈ . Then is -axiomatizable; that is, for a set Θ of M L L N L N Mod(S) S L L-sentences, Con ({I(θ):θ∈Θ}) = Con (Σ ) ; here, Con (Φ) is the set of LLSSSL L-sentences that are consequences of the theory (L, Φ) .

Note that the conclusion can also be expressed by saying that for any -structure , Σ LSSM M iff MLΘ .

(11)(b) More generally, assume, in addition to S and I:LA@[S] ,atheory T in a language extending that of ( ⊂ ) such that S LSTL

for any , ∈ , ∈ and  imply that M N Mod(T) M LS Mod(S) M L L N L

71 ∈ . N LS Mod(S)

Then, there is a set Θ of -sentences such that, for any  , Σ iff Θ . L M T M S M L

(11)(a) is the special case when , ∅ . T=(LS )

Proof of (11)(b). For any τ∈Σ ,  and  ,wehave S M T N T

Σ   τ . M S & M L LN L N

By appropriately coding the condition  in first order logic with suitable additional M L LN L primitives, and by applying compactness, we can find σ[τ] , a finite conjunction of elements of Σ , such that for any  and  , S M T N T

σ τ   τ . M [ ]&M L LN L N

Then by (7)(a), applied to C=D=[T] ,and I=J:LA@I [S]A@incl [T] , we can find θ[τ] ,an L-sentence, such that Tσ[τ]I(θ[τ]) , TI(θ[τ])τ . Clearly, Θ θ τ τ∈Σ is then appropriate for the assertion. ={ [ ]: S}

We leave it to the reader to formulate a version of (11) with formulas in a given context X instead of sentences.

The following, which is a special case of (7)(b), says that a first-order property invariant under L-equivalence is expressible in logic with dependent types over L .

(12) Let I:LA@C be as before. Assume that X is a finite L-context, σ∈S(I[X]) ,and  for all M, NC and a∈(ML)[X] , b∈(NL)[X] ,

 〈 〉 ∈ σ ,  ,  〈 〉 ∈ σ a M( )&(M L a) L (N L b) b N( ).

Then there is an L-formula θ in logic with dependent sorts without equality with θ ⊂X such that σ X θ . Var( ) =I[X] I[ : ]

72 The notion of L-equivalence as defined is relevant to FOLDS without equality. However, frequently we deal with FOLDS with restricted equality. As explained in §1, when M is an -structure, it can be considered as an eq-structure, with the additional relations L L EK interpreted as true equality; let us write M for the resulting "standard" Leq-structure as well. What does it mean to have an equivalence (W, m, n):MN for L-structures M , N ? Leq  Clearly, this is to say that , ,  and, for any maximal kind ,and ∈ , (W m n):M L N K c W[K]  , ∈ ,wehavethat iff . Let us write , , ≈ c12c WK(mc) mc 12=mc nc 12=nc (W m n):M L N for (W, m, n):MN , and let us call such (W, m, n) an L, ≈-equivalence; also, write Leq M ≈ N for M  N ; note that throughout, M and N are L-structures. L Leq

Let us define M ≡ N as we did M ≡ N above, except that we refer to logic with equality. L= L

Then, using the translation ϕ@ϕ mentioned in §1, we obviously have M≡ N  L= M≡ N .Thus,by(2)(a)wehave Leq

(13) For L-structures M and N , M ≈ N  M ≡ N . L L=

L,≈-equivalences can be "normalized" in a certain way, which will be useful for us later.

Let U, V∈SetK . A very surjective morphism f:UA@V is normal if for any maximal kind  K , and any a∈U[K] ,"f is 1-1 in the fiber over a ", that is, if b, c∈UK(a) , then f(b)=f(c) implies b=c . Together with the very surjective condition, this says that f  ≅  induces a bijection UK(a)A@VK(fa) .

Let , be -structures. A normal ,≈-equivalence , , ≈ is an M N L L (W m n):M L N L,≈-equivalence in which both m and n are normal. We have the fact

(14) For any -structures , ,if ≈ , then there is a normal ,≈-equivalence L M N M LN L

73 , , ≈ . (W m n):M L N

The argument is as follows. Start with any ,≈-equivalence , , ≈ .Define L (W m n):M L N W’∈SetK by setting W’K=WK for all K∈K except the maximal ones; for a maximal K ,  ,where  is the equivalence relation on for which  iff and W’Kdef= WK/ WK b c b c  are over the same a∈W[K] ,and m(b)=m(c) . When in this definition, we replace m by n , the result is the same; this is because (W, m, n) being an L,≈-equivalence, m(b)=m(c) iff for , over the same element in . For an arrow A@ , n(b)=n(c) b c W[K] p:K Kp when is not maximal (in which case is not maximal either); and for W’(p)=W(p) K Kp K maximal, (W’p)(b/)=(Wp)(b) ; the latter is well-defined, since by the definition of  , if bc , then (Wp)(b)=(Wp)(c) . Clearly, W’:KA@Set is well-defined, and we have obvious maps p:WA@W’ , m’:W’A@MK , n’:W’A@NK such that

W  m  n +  k MKi { p { )NK    m’    n’ PI W’

I claim that , , ≈ ; the normality condition is clearly satisfied. Consider a (W’ m’ n’):M L N relation R in L . In the

(mM* )RA @q (m’*M)RA @ MR yyy PPP W[R]A @W’[R]A @M[R] pm[R][’ R] the outside rectangle and the right-hand square are pullbacks. It follows that the left-hand square is a pullback too. Obviously, is surjective. It follows that is surjective. This p[R] q determines the subobject (m’**M)Rx @W’[R] as the image of (mM)Rx @W[R] under . Switching to from , **x @ is the image of x @ p[R] N M (n’ N)R W’[R] (nN)R W[R]

74 under .Since **, it follows that p[R] (mM)R =(W[R] nN)R **as desired. The additional condition concerning equality is (m’ M)R =(W’[R] n’ N)R clearly satisfied.

Notice that the above proof works for an essentially arbitrary C in place of Set .

Note that if m:WA@MK is normal, then mM*eqformed from M as a standard L -structure is a standard Leq-structure too. Put in another way, the standard fiberwise equality relations on the maximal kinds in mM* are formed by the same pullback operation from the corresponding relation on M as any primitive L-relation.

We have the following variant of (12).

(15) Let C be a small Boolean category, I:LA@C . Assume that X is a finite L-context, σ∈S(I[X]) ,andforall M, NC and a∈(ML)[X] , b∈(NL)[X] ,

 〈 〉 ∈ σ , ≈ ,  〈 〉 ∈ σ a M( )&(M L a) L (N L b) b N( ).

Then there is an L-formula θ in logic with dependent sorts with equality with Var(θ)⊂X such that σ X θ . =I[X] I[ : ]

Proof. By definition, for each maximal , × . Let us form K I[EKI ]=I(K) [K]I(K) eq eqA@ extending A@ by specifying that, eq , with I :L C I:L C I (EKK ) = I[E ] Ieq(e )=I eq(e )=1 . We apply (12) to I eq:L eqA@C .For MC , K0 K1 I[EK ] MLeq=MvI eqis, clearly, the same as ML as a standard L eq-structure. Thus,

  (MLeq, a)  (NLeq, b)  (ML, a) ≈ (NL, b) . Leq L

75 Thus, from the hypothesis of (15), that of (12) follows. By (12), we have some θ in FOLDS without equality over eqsuch that σ eq X θ ; but clearly, for θ in FOLDS L =I[X] I [ : ] ’

with equality over such that θ θ ,wehave X θ eq X θ ; thus σ L ’= I[ : ’] = I [ : ] =I[X] I[X:θ’] as required.

76 §6. Equivalence of categories, and of diagrams of categories

The simplest application of the results of the last section is to invariance under equivalence of categories of first order properties of diagrams of objects and arrows in a category. In what follows, until further notice, stands for , the DSV for categories introduced in §1; a L Lcat category A may be regarded an L-structure. A context of variables for L is essentially a functor A@ , that is, a graph; we are mainly interested in finite contexts, K=Lgraph Set although for the notions to be introduced next, there is no need to confine attention to finite contexts.

For a context X ,anaugmented category of type X is a pair (A, a) , with A a category, and a∈A[X] (that is, a a diagram of type the graph X ). Until further notice, notations  such as (A, a) , (B, b) denote augmented categories. Mere categories are considered special cases of augmented categories of type ∅ ; A , B etc. denote categories.

 For augmented categories (A, a) , (B, b) ofthesametype,wewrite

 (A, a)(B, b)

J if there is an equivalence functor F:AA@B ( F is full and faithful, and essentially  surjective on objects) that maps a to b ; we may also write (B, b)(A, a) for the  same. Note that the relation  is reflexive and transitive but not symmetric (an J equivalence functor AA@B may take two different objects A≠A’ in A to the same B in  B ; then (A, 〈 A, A’ 〉 )(B, 〈 B, B 〉 ) but not vice versa). The special case when the type  X is ∅ , is, however, symmetric; AB implies AB since every equivalence functor  has a quasi-inverse (by the Axiom of Choice); AB is the same as equivalence of categories, A J B .

 The equivalence relation generated by the relation  is only "one step away" from  ;  it is  defined as

77    ,  ,  there is , such that ,  ,  , .(1- ) (A a) (B b) def (C c) (A a) (C c) (B b)

  To see the transitivity of the relation  , assume (A, a)(D, d)(B, b) and   (B, b)(E, e)(C, c) , and consider the diagram

F σ τ +k JDE  ϕ ψ +k+k ABC

where the quadrangle has F the "isomorphism-comma" category, with objects ≅ (D, E, ϕDA @ψE) , and arrows the usual commutative squares, with σ:FA@D , τ:FA@E the forgetful functors. Since ϕ , ψ are equivalence functors, so are σ , τ .Let  〈 〉 ∈ X be defined as follows. For ∈X , ,let f= fxx∈X F[ ] x x:O , ϕ A @≅ ψ ; note that ϕ ψ by assumption. For ∈X , fxxx=(d e ,id: d xe x) d xx= e x , ,let A@ , A@ : A@ ; note that ϕ ψ by x:A(y z) fxxyzxyzyz=(d :d d e :e e ) f f d xx= e     assumption. We have that (F, f)(D, d) , (F, f)(E, e) . Using the composites  FA@A , FA@C , we obtain (A, a)(B, b) as desired.

Recall the relation ≈ of the last section; ≈ is, in particular, a relation between augmented LL  categories. We have that ≈ is the same as  . L

  (1) (a) ,  ,  , ≈ , ; (A a) (B b) (A a) L(B b) (b) J  ≈ . A B A L B

 Proof. Assume , ≈ , . By §5, there is a normal ,≈-equivalence (A a) L(B b) L  , , , ≈ , . Then, **is a category, since, by 5.(1), as (W u v):(A a) L (B b) C = u (A)=v (B) a standard L-structure, C satisfies all the axioms of category which are formulated in FOLDS

78 (see 5.(2)(a)). Furthermore, clearly, θ A@ , θ A@ are surjective equivalence uv:C A :C B functors. This shows the right-to-left direction in (a). For the proof of the other direction, we prove the implication

  ,  ,  ,  , ; (A a) (B b) (A a) L(B b) to this end, we "saturate" the given equivalence appropriately; we will do this proof in a more general situation below.

 Knowing the transitivity of the relation  , the transitivity of  also follows from (1)(a). L

(b) is a special case of (a).

Recall the translation ϕ@ϕ* in §1; this is just to say that any formula ϕ of FOLDS over L may be regarded a formula ( ϕ* ) over QLR in ordinary multisorted logic.

Let Q R Σ the theory of categories in ordinary multisorted logic ( Σ can T=(catL , cat) cat be taken to be Σ ∪ θ* θ∈Θ ; Σ for any DSV was defined in §1 ; Θ is [Lcat] { : } [L] L the set of axioms in FOLDS for categories as given in §1.). When T is a theory extending ( Q R⊂ Σ ⊂Σ ), and , we write Q R for  , the underlying Tcat L L,T cat T M T M M L category of M .

(2)(a) Let be a theory extending .Let X be a finite context over , σ an T TcatL cat -formula such that σ ⊂X .If LT Var( )  for any M, N T and diagrams a∈QMR[X] , b∈QNR[X] , Mσ[a] and   (QMR, a)(QNR, b) imply Nσ[b] , then there is θ in FOLDS with restricted equality over with θ ⊂X such that Lcat Var( ) for all MT and diagrams a∈QMR[X] ,wehave Mσ[a] iff Mθ*[a] . (b) In particular, if σ is a sentence over , and for any , , σ and LT M N T M Q R J Q R imply σ , then there is a sentence θ of FOLDS over such that for M N N Lcat

79 any MT , Mσ iff Mθ* .

Proof. We apply 5.(15) to , with A@ the composite of A@ C=[T] I:L C I:L [Tcat ] defined in §5 before (7)(a) and the inclusion A@ ; moreover, we take σ in [Tcat ] [T] 5.(15) to be m*([X:σ])x@I[X] ( m:I[X]x@{X} ; see §5 before (7)(a)). By (1)(a), the assumption implies that

 σ & Q R, ≈ Q R,  σ . M [a] ( M a) L( N b) N [b]

The conclusion of 5.(15) is what we want. (b) is a special case of (a).

We say that a theory extending is normal if for any and any category ,if T Tcat M T A A J QMR , then there is a model NT such that A=QNR . In other words, normality of T says that the property of being the -reduct of a model of is invariant under Lcat T equivalence of categories. Most theories of categories (possibly) with additional structure are normal. E.g., so is the theory of monoidal categories, or the theory of categories with specified finite limits. Of course, itself is normal. Tcat

Let X be a finite context, and σ be a formula over with σ ⊂X . Let us say that LT Var( ) σ is preserved along equivalence functors between models of T if the following holds:   whenever M, NT , a∈M[X] , b∈N[X] , then Mσ[a] and (QMR, a)(QNR, b)   imply Nσ[b] . When in this definition, (QMR, a)(QNR, b) is replaced by  (QMR, a)(QNR, b) , we obtain the notion of being reflected along equivalence functors. Now, notice that for T a normal theory, the hypothesis of (2)(a) holds iff σ is preserved and reflected along equivalence functors of models of T (the point is that, in case T is normal, - in (1 ), when A (and B ) are reducts of models of T , C can also be expanded to a model of T ). Thus, we obtain the following variant of (2)(a):

(3) Let T be a normal theory of categories (possibly) with additional structure. Let X be a finite context over . Suppose that the first-order formula σ over with free Lcat LT

80 variables all in X is preserved and reflected along equivalence functors of models of T . Then there is a formula ϕ in FOLDS with restricted equality over with Var(ϕ)⊂X Lcat such that σ is equivalent to ϕ* in models of T .

Freyd's and Blanc's characterization (see [F], [FS], [B]) of first order properties of finite diagrams invariant under equivalence is (3) for . In fact, the general result (3) can T=Tcat also be obtained by their methods, which is very different from the methods of this paper (we will comment on this in Appendix C). It seems however that the more general result (2), in particular, (2)(b), cannot be obtained by the Freyd's and Blanc's methods (although I should concede that the added generality in (2)(b) consisting in a reference to not-necessarily normal theories does not seem very important).

The results of §5 that are more general than 5.(15) (e.g., the "interpolation-style" result (7)(b)) will also have consequences for equivalences of categories; we leave their formulation to the reader.

Extending the Freyd-Blanc result to more complex categorical structures will involve a new element. For instance, in the case of structures consisting of two categories and a functor between them (an example of which is a fibration), the first-order properties invariant under equivalence (in the appropriate standard sense; see also below) are not those expressible in FOLDS directly, but rather, those that are expressible in FOLDS in the language of the so-called saturated anafunctor associated with the given functor. Anafunctors are treated in [M2]; explanations will be given presently.

We now proceed to giving the framework for dealing with structures consisting of several (possibly infinitely many) categories, functors between them, and natural transformations between the latter. We will return to the simplest special case of two categories and a functor between them afterwards.

Let be a small 2-graph; A@ . We associate the graph with I I:L2-graphSet L[ diag I] ; serves as a similarity type for diagrams A@ of (small) categories, I L[diag I] I Cat functors and natural transformations. The objects of are as follows: L[diag I]

81 ∈ O,A,I,TIIII (IOb(I)) ∈ O,Aii (iArr(I)) O(α α∈2-Cell(I))

The arrows of are shown in the following three diagrams: L[diag I]

TIII t t t i I0 33I1 3I2 # I (3) AI d c IPPI OI displaying the arrows associated with an object I ;

aa MNi0 A@i1 AIiA A J d cdcdc IPPIi PPiJ PPJ O MN O A@ O I oi0 i oi1 J which displays the arrows associated with an arrow i:IA@J in I ;and

o A@ι 2 O ι A o J o J ι 0 ι 1  +kdJ G c Oi t Oj  J    oi0 oj1 # o 3 ## W j0oi1 h OOIJ

A@i which displays the ones associated with the 2-cell ι :iA@j ( IA@P ι J ). j

Given a I-diagram

82 A@ 〈 〉 , 〈 A@ 〉 , 〈 A@ 〉 (4) D:I Cat:( CII∈I FiI:C C Ji:IA@J h ι :FijF A@i ) IA@P ι J j of categories, functors and natural transformations, we construe D as an -structure as follows. (3) is interpreted as the category . When A@ , L[diag I] CI i:I J o is the set of pairs , with ∈ , with , @i0 , OiiIi(X FX) X Ob(C ) (X FX) X o Ff , @i1 . is the set of pairs , A@fi, A@ , with (X FXiii) FX A (f Ff i)=(X Y FX iiFY) dca , @iii, , , @ , , , @0 , (f Ffiiiii) (X FX) (f Ff) (Y FY) (f Ff) f a A@ih , @i1 .For P is the set of pairs , A@ι X .The (f Ff) Ff IA@ι J ,Oι (X FX FX) ii j ij effect of the remaining arrows, as well as the corresponding commutativities, are shown by the following picture:

hhι ι (X, FXA@X FX) @ FXA@X FX ij o ι ij oo2 ι 0 ι 1  #3d   J c , G D, G  J (X FXi )  (X FXj )         oi0   oj1 P #   o + g W j0oi1 h XFXFXij

Let be the DSV defined as follows. The underlying simple category of Lanadiag[I] is generated by the graph , subject to the following equalities Lanadiag[I] L[ diag I] between arrows:

the ones ensuring that (3) generates a copy of (see §1); Lcat , , , , od=dai0 iIi0 od=dai1 iJi1 oc=cai0 iIi0 oc=cai1 iJi1

, , (5) ooi0 ι 0 =ooj0 ι 1 doJ ι 2 =oi1 0ι 0 coJ ι 2 =oj1 0ι 1 .

The relations of are exactly its top-level objects; that is, , , , ,for , L TIIiI A O ι I i and ι ranging over the 0-cells, 1-cells and 2-cells of I , respectively.

83 The equalities on arrows are suggested by what is true for I-diagrams as structures. In fact, every -diagram is a functor A@ , that is, the equalities listed are I D:Lanadiag[I] Set true in it (as identities). Also, the relations of are interpreted in Lanadiag[I] D relationally (the corresponding family of functions is monomorphic). In summary, every -diagram is an -structure. I Lanadiag[I]

is the similarity type of what we call the "anadiagrams" of type .An Lanadiag[I] I anadiagram A@a is an -structure satisfying the following axioms M:I Cat Lanadiag[I] A@i (A0) to (A6) in FOLDS with equality ( IA@P ι J range over objects, arrows and 2-cells in I j as shown; the unique existential quantifiers in (A2) and (A5) are abbreviations in the usual way, and they refer to equality on the sorts ⋅ , ⋅ ). A(J )

(A0): axioms expressing that for each I∈Ob(I) , the part of M referring to I is a category .

(A1) ∀ ∃ ∃ , . X:OIJi . A:O . s:O (X A). t

(A2) ∀ , ∀ , ∀ , ∀ , ∀ , . X Y:OIJiiI . A B:O s:O (X A). t:O (Y B). f:A (X Y) ∃ , . . !g:AJi (A B) A(s ,t , f , g ) dcaiii0 ai1

(A3) ∀ ∀ ∀ , ∀α , ∀α , X:OIJiIJ . A:O . s:O (X A). :A (X X). :A (A A)

, , α, α  , α  , α . [AiIJ (s s ) (I ( X ) I(A ))] diII i I

(A4) ∀ , , ∀ , , ∀ , ∀ , ∀ , X Y Z:OIJiii . A B C:O . s:O (X A). t:O (Y B). u:O (Z C) ∀ , ∀ , ∀ , f:AIII (X Y). g:A (Y Z). h:A (X Z)   ∀ , ∀ , ∀ , f:AIII (A B). g:A (B C). h:A (A C)   , , , U , , , U , , ,  [((Aiii (s t f f) A(t u g g) A(s u h h))   , ,  , , . (TIJ (f g h) T(f g h))]

(A5) ∀ ∀ ∀ ∀ , ∀ , X:OIJJi . A:O . B:O . s:O (X A). t:O j (X B)

84 ∃ , , , . !f:AJ (A B).Oι ( s t f ) oooι 0 ι 1 ι 2

(A6) ∀ , ∀ , , , X Y:OIJ . A B C G:O ∀ , ∀ , ∀ , ∀ , s:Oiijj (X A) t:O (Y B). u:O (X C). v:O (Y G) ∀ , ∀ , ∀ f:AIJJ (X Y). g:A (A B). k:A (C.G) ∀ # , ∀ , :AJJ (A C). m:A (B G) , , , U , , , U , , # U , ,  [(Oij (s t f g) O(u v f k) O(ιιs u ) O(t v m)) ∃ , , , U # , , . n:AJJ (B C).(T (g m n) T( Jk n))]

For a less formal explanation of the notion of anadiagram, I refer to [M2]. In that paper, I introduce the notion of anafunctor between categories, a generalization of the notion of functor. An anafunctor defines its values on objects only up to isomorphism. Formally, the definition of anafunctor is obtained by specializing the definition of "anadiagram" to the case 〈 , 〉 when I is the (2-)graph 0A@0 1 1 (without 2-cells). Anadiagrams have anafunctors instead of functors as 1-cells, and natural transformations of anafunctors as 2-cells.

Note that any I-diagram D:IA@Cat is an anadiagram; all the axioms for "anadiagram" are satisfied in (as an -structure). In fact, the diagrams are essentially the same D Lanadiag[I] as those anadiagrams in which the sorts ( ∈ ) are interpreted relationally, M Oi i Arr(I) that is, the family 〈 Mp 〉 A@ is jointly monomorphic. p:OipK

On the other hand, any anadiagram gives rise to a diagram, obtained by making some

non-canonical choices. Let M be an anadiagram M:IA@a Cat ; we construct D:IA@Cat ; we use the notation (4) for the ingredients of .For ∈ , the category is given D I Ob(I) CI directly by the data in M corresponding to I (see (A0)). By (A1), for any i:IA@J in I and ∈ ,wemakeachoiceof ii∈ and ∈ , ;we X Ob(CII)=MO A XXJ=A MO s xXi=s MO(X A) put . Starting with A@ , and using (A2) with , , , FXiX=A f:X Y A=A XYXB=A s=s ,welet whose unique existence (A2) states. (A3) and (A4) assure that so t=sYiFf=g F i defined is a functor A@ . Using (A5) with ijij, , , , we put FiIJ:C C A=A XXXXB=A s=s t=s for the whose existence (5) asserts. (A6) ensures that is a natural h ι X=f f h ι transformation A@ . Let us refer as the diagram obtained from by cleavage h ι :FijF D M (in to the terminology used with fibration); of course, it is not uniquely determined.

85 Next, we describe the saturation D# of a diagram D:IA@Cat , an anadiagram canonically associated with D . (As a matter of fact, the components corresponding to the 1-cells A@ will be the "saturated anafunctors" # associated with the given functors ,in i:I J FiiF the sense of [M2].)

In # , the interpretation of each part of as in (3) is the same as in . D Lanadiag[I] D

For A@ , a 1-cell in , # is the set of triples μ= , , A@≅ with i:I J I D Oii(X A FXμ A) oo ∈ , ∈ and μ an isomorphism as shown; μ@i0 , μ@i1#. is the set X CIJA C X A DA i of all entities

≅ μ XFXA@A (Pf , iPFf{ Pg) A@i YFYi ν B ≅ with the displayed entity mapped to , , μ by ,to , , ν by ,to by (X A ) dii(Y B ) c f A@i ,andto by .For P , # consists of all a g a IA@ι J D O ι i0 i1 j

A@μ FXi ≅ A  (X, h  { g) , ι XPP A@≅ FXj ρ B

and the displayed item is mapped to , , μ by ,to , , ρ by ,andto (X A ) o ι 0 (X B ) o ι 1 g by . o ι 2

We leave it to the reader to verify that D# so defined is an anadiagram.

D# satisfies a property that distinguishes it from diagrams; it is saturated,bywhichwemean that it satisfies, for each i:IA@J in I , the FOLDS sentence

86 (A7) ∀ ∀ , ∀ , ∀ , X:OIJi . A B:O . s:O (X A). f:A J (A B) ∃ , ∃ , U , , , ; (Iso(f) !t:OiIIi (X B). g:A (X X).(I (g) A(s t g f)) here, Iso(f) abbreviates

∃ , ∃ , ∃ # , U # U , , U , , # h:AJJJJJJJ (B A) k:A (A A) :A (B B).(I (k) I() T(f h k) T(h f )) .

In fact, it can be proved (although we will not need this result) that, up to isomorphism as -structures, the saturated -anadiagrams are precisely the ones of the form Lanadiag[I] I D# , for some diagram D .

Given D as in (5), and another I-type diagram

A@ 〈 〉 , 〈 A@ 〉 , 〈 A@ 〉 ,(6) D:I Cat:( CII∈I FiI:C C Ji:IA@J h ι :FijF A@i ) IA@P ι J j

we say that D and D are equivalent, and write D J D , if there exist a family J 〈 A@ 〉 of equivalence functors, and a family 〈 〉 of natural EII:C C II∈I eii:IA@J isomorphisms as in

E A@I CIIC   ≅   v A@≅ v , FiPWPFei iiI:F E E JiF e C A@i C JEJ J satisfying the additional naturality condition:

e v MNi v EJiF F iIE v  {  v EJ h ι h ι EI PP E vF MNF vE Jjej jI

87 A@i for every P in . The data , form an IA@ι J I E=( 〈 E 〉 ∈ 〈 e 〉 ∈ ) j III iiArr(I)

equivalence of D and D , in notation,

J 〈 〉 , 〈 〉 A@ .(7) E =( EII∈I eii∈Arr(I)):D D

This notion of equivalence is a "bicategorical" notion; it is the equivalence in the internal sense of the bicategory (actually, 2-category) Hom( 〈 I 〉 ,Cat) of homomorphisms of bicategories, pseudo-natural transformations and modifications, with 〈 I 〉 the 2-category generated by the 2-graph I . (The main part of the fact that the "one-way" formulation of equivalence given above as the definition, and the "internal" concept just mentioned coincide, is the symmetry of the relation J ; an outline of the proof of the symmetry of J is given below.) It is the "good" notion of equivalence, the one that comes up in practice. For instance, in Chapter 4 of [MP], diagrams of sketches, and diagrams of accessible categories are dealt with, and the present notion of equivalence is the one which is operative. Specifically, the Uniform Sketchability Theorem, one of the main results of [MP] (4.4.1 in [MP]) says that a small diagram of accessible categories is equivalent to one obtained from a diagram of sketches by taking the categories of models of the sketches involved.

Although the fact is well-known, I outline the proof that the relation D J D is symmetric. Since it is easily seen to be transitive and reflexive, J is an equivalence relation.

J Assume data as in (7); see also (4) and (6). We define E:DA@D . With I∈Ob(I),

∈ , choose II∈ and ε ε A@≅ ∈ .Put A Ob(CI) X AA=X Ob(C I) AAIA= :EX A Arr(C I) EA I=

.For A@ ∈ , is the arrow that makes the square XAIIf:A B Arr(C ) Ef

ε A@A EXIA ≅ A Ef { f I PP A@≅ EX ε B IB B

commute. so defined is a functor A@ ; it is an equivalence functor; it is a EIIIIE :C C

88 ≅ quasi-inverse of E :wehave ε :EEA@1 with components the εI ,and IIIICI A A@≅ I -1 η :1 EE with components η , for which E (η , )=(ε ) .For I CIIII IXIIXEX

A@ in ,wedefine A@≅ as the composite i:I J I eiiJ:FE EF Ji

η FE Ee-1 E EFε A@JiJ A@Ji I A@JiI FEiJ ≅ EEFEJJiJ ≅ EFEEJiIJ ≅ EFJi.

J 〈 〉 will be compatible with the , and give A@ as desired. eii∈Arr(I) h ι E:D D

Let be the full subcategory of consisting of the objects and K0L anadiag[I] OIIA for all ∈ .Arestricted context is a context over .Wehave # , I Ob(I) K000D K = D K and hence, for a restricted context X , D[X]=D#[X] .

With X a restricted context, an augmented I-diagram of type X is a pair (D, a) where  D:IA@Cat ,and a∈D[X] ; notations such as (D, a) , (D, b) denote augmented J  J I-diagrams. We write E:(D, a)A@(D, b) for the following: E:DA@D with E as in (7)  such that in the obvious sense that . The relation  between E(a)=b EIx(a )=b x augmented diagrams is defined thus:

  J  (D, a)(D, b)  there exists E:(D, a)A@(D, b) .

   We write (D, a)(D, b) for: there exists (D, c) such that     (D, a)MN(D, c)A@(D, b) . The relation  is the equivalence relation generated by   ; this can be seen directly, but it also follows from (8) below. In particular, when X=∅ ,  the relation  coincides with J for I-diagrams (since J is an equivalence relation).

 (8) For augmented I-diagrams (D, a) , (D, b) ofthesametype,wehave

89    ,  ,  #, ≈ #, ; (D a) (D b) (D a) L (D b) here, . L = Lanadiag[I]

As a special case, for (mere) I-diagrams D and D ,

J  # ≈ # D D D L D .

 Proof. (A)(:) Let (R, r , r ):(D#, a)(D#, b) be a normal L, ≈-equivalence 01 L  (see 5.(2")). Let ∈R X ( X the type of #, , #, ) for which , c [ ] (D a) (D b) r0(c)=a  . r1(c)=b

Let *# *##, a standard -structure. Since is an anadiagram, and the M=r01(D )=r (D ) L D concept of "anadiagram" is elementary in FOLDS over L , by 5.(1)(a), M is an anadiagram. J Let D be obtained from M by cleavage. We show that there is an equivalence E:DA @D which extends

 θ A@ # m K0= m K000:M K =D K D K 00=D K

(that is, θ for all ∈ ; here, we used the notation (7) for ), and similarly, EImI=( ) I Ob(I) E J  there is A @ extending . In particular, it will follow that , E:D D n K0 E(c)=a E(c)=b    and (D, a)(D, c)(D, b) as desired.

 We use a notation for that is analogous to (6). The functor A @ is defined by D EII:C C I the effect m and m ;since θ :MA@D preserves the relations I and T , E is a OAII mIII functor. By the normality of , induces on hom-sets, and by the surjectivity r0 EI of on , is a surjective equivalence. r0 OIIE

 Let A@ . Looking back at how the cleavage was defined, we see that , i:I J D FXiX= A

90  with ∈ , . Then ∈ ##, , .Bythe sXiMO(X A X) m(s X) D O( imX mA X)=D O( iIJiEXEFX)  definition of # , this means that A@≅ . We put .Toseethat D msXiI:FEX EFX Jie iXX=ms  is a natural transformation A@≅ ,let A@ . e = 〈 e 〉 ∈ e :FE EF f:X Y ∈ C iiXXOb(CI) iiI Ji I  We see that is defined by the property that , , , should hold. But FfiiXYiM(A )(s s f Ff)  θ preserves ; hence, # , , , , which, by the definition of mA iD (A i)(e iXiYIJie EfEFf) D# , means

e A@iX  FEXiIEFX Ji  FEf { EFf iIJi PP FEYA@EFY , iI eiY Ji which is the naturality of . ei

A@i Let IA@P ι J be given. The naturality condition on (e , e ) with respect to ι :iA@j is j ij  seen as follows. Let ∈ . The definition of the component A@ is X Ob(CI) h ι Xi:FX FX j  defined (in the process of cleavage) by the condition ij, , . The map MO(ι sXXs h ι X)  θ A@ ##preserves the relation . It follows that ij, , holds; that m:M D O ιιD O(msXXms mh ι X)  is, # , , holds. Considering the definition of # , this says that D O(ι eiXe jXEh J ι X) D O ι

e  MNiX EFXJiFEX iI  { Ehι h ι J XPPEXI  EFXMNFEX Jj ejX jI

which is what we wanted.

 (B)("only if") We show that ,  , implies , ≈ , .Since ≈ is (D a) (D b) (D a) LL(D b) an equivalence relation, the desired assertion will follow.

91 J  Suppose that E:(D, a)A@(D, b) ; E is taken in the notation in (7) ; we construct  R, , #, M@≈ #, The kinds of are as in ( r01r ):(D a) L (D b). L

AAIJ   d cdc IPPIJ PPJ O MN O A@ O I oi0 i oi1 J with i:IA@J in I ;wehavetodefine R on these kinds.

≅ r We put RO={(X, X, σ): X∈DO , X∈DO , σ:EXA@X} , with (X, X, σ)@0 X , IIII r , , σ @1 . The "very surjective" condition on , at holds by the essential (X X ) X r01r OI surjectivity of . EI

XX   R , , σ , , , τ , ,  AI def = {((X X ) (Y Y ) fPPf ):

Y Y σ EXA@X I  , , σ , , , τ ∈R ,  { Pf , (X X ) (Y Y ) OIIEfP } A@ EYI τ Y

with the displayed item being mapped to , , σ by R ,to , , τ by R ,to (X X ) dII(Y Y ) c f

by ,andto by . The mapping r01f r

f@f : D#A(X, Y)A@D#A(X, Y)

so defined, with fixed , , σ , , , τ ∈R , is a bijection; this holds since is an (X X ) (Y Y ) OIIE equivalence of categories. This shows the "very surjective" condition for , at ,as r01r AI well as the preservation of E . AI

R , , σ , , , α , μ , , σ ∈R , , , α ∈R , μ A@≅ , Oi def = {((X X ) (A A ) ): (X X ) OIJi(A A ) O :FX A}

92 with the displayed item being mapped to , , σ by R ,to , , α by R ,to (X X ) oi0 (A A ) oi1

, , μ ∈ by ,andto , , μ ∈ by where μ is determined by the (X A ) DOi r0 (X A ) DOi r1 following commutativity:

A@σ FEXiI ≅ FXi e ≅ iXP { μ (9) EFXJi E μ≅ J PP

A@≅ . EAJ α A

Note that since all given arrows are isomorphisms, μ is uniquely determined, and it is an isomorphism. Moreover, since is an equivalence of categories, the mapping EJ

μ@μ # , A@ # , : D O(iiX A) D O(X A) so defined (with the rest of the data fixed) is a bijection, which shows the "very surjective" condition at O , and the preservation of E . i Oi

This completes the data for R, , ; it remains to verify the necessary properties. ( r01r )

Let us consider the preservation of the relation by R, , .Whatwehavetodois Ai ( r01r ) this. We take four items

x ∈RO , x ∈RO , x ∈RA , x ∈RA diii c i a i0 I ai1 J such that (x , x , x , x )∈R[A ] ,thatis, dcaiii0 ai1 i

(10) Ro(x )=Rd(x ) , Ro(x )=Rd(x ) , i0diiI a 0 i1diiJ a 1 Ro(x )=Rc(x ) , Ro(x )=Rc(x ) ; i0ciiI a 0 i1ciiJ a 1

93 we consider their and -projections; and we have to show that r01r (rx , rx 〉 , rx , rx ) ∈ D#A (11) 0dii 0c 0a i0 0ai1 i if and only if

(rx , rx , rx , rx ) ∈ D#A . (12) 1diii 1c 1a0 1ai1 i

Let x =((X, X, σ), (A, A, α), μ) di

with σ A@≅ , α A@≅ , μ A@≅ ; :EXIJiX :EA A :FX A

x =((Y, Y, τ), (B, B, β), ν) ci

with τ A@≅ , β A@≅ , ν A@≅ ; :EYIJiY :EB B :FY B oooo note that x @i0 σ , x @i1 α , x @i0 τ , x @i1 β . ddcciiii

The first and third of the above conditions (10) force the first two components of x to be ai0

(X, X, σ) and (Y, Y, τ) , respectively. Let

x =((X, X, σ), (Y, Y, τ), f:XA@Y, f:XA@Y) ; ai0 we have

σ EXA@X I   { Pf . (13) EfI P A@ EYI τ Y

Similarly,

x =((A, A, α), (B, B, β), g:AA@B, g:AA@B) ai1 with

94 α EAA@A J { Pg . (14) EgJ P A@ EBJ β B

(11) means

μ FXA@A iPFf{ Pg , (15) A@i FYi ν B whereas (12) means

μ FX A@A iPFf{ Pg (16) i FYA@ B i ν

where μ and ν are defined as μ is in (9); we want to see that (15) iff (16). Consider the following diagram:

A@μ FXi i )A F σ 1 α Ii eEμ A@iXA@ J 2 FEXiIEFX JiEA J 345 Ff FEf EFf Egg i iIP JiP J P A@ A@ FEYiI eEFY Ji Eν EBJ P iY J P + τ β k Fi 6 FYA@ B . i ν

The cells 1 and 6 commute, by the definitions of μ and ν (see (9)). 2 commutes by (13), by the naturality of ,and by (14). Note that all arrows except the vertical 3 ei 5 ones are isomorphisms. If (15) commutes, then so does 4 ; the resulting commutativity of the outside square is (16) as desired. Conversely, if (16) commutes, then so does 4 (using the isomorphisms in the diagram), and since is faithful, so does (15). EJ

95 A@i Let us look at the similar verification of preservation of ; P .Wetake O ι IA@ι J j , , R ,thatis, (x x x )∈ [Oι ] oooι 0 ι 1 ι 2

x =((X, X, σ), (A, A, α), μ) ∈ RO o ι 0 i

with σ A@≅ , α A@≅ , μ A@≅ ; :EXIJiX :EA A :FX A

x =((X, X, σ), (B, B, β), ρ) ∈ RO o ι 1 j

with the same σ as above, and β A@≅ , ρ A@≅ :EBJiB :FX B

(since we must have Ro(x )=Ro(x ) (see the first equation in (4)), the first i0oι 0 j0oι 1 components of x and x have to agree); ooι 0 ι 1

x =((A, A, α), (B, B, β), g:AA@B, g:AA@B) o ι 2

with (9) holding (see the other two equations in (4)). Looking at the definition of # , D O ι

# , what we have to see is that D O ι

A@μ A@μ FXi ≅ AFXi ≅ A h { g iff h { g . (17) ι XPP ι X PP A@≅ FX ρ B A@≅ j FXj ρ B

Consider

96

A@μ FXi i )A F σ 1 α Ii eEμ A@iXA@ J 2 FEXiIEFX JiEA J 45 h h ι EX 3 EhJ ι X Egg ι X I PPJ P A@ A@ FEXjI eEFX Jj Eρ EBJ  P jX J  P + τ β k Fj 6 FXA@ B . j ρ

The cells 1 and 6 commute for reasons as before. 2 commutes because of the naturality of

, because of the naturality of , with respect to ι A@ , because of h ι 3 (eije ) :i j 5 (14). is the antecedent of (17) with applied to it, the outer square is the succedent of 4 EJ (17). The assertion in (17) follows.

The remaining properties are the preservation of the , , and of the equalities on the TIII . These are immediately seen. A,OIi

 We need that R, , "relates to ". For X the restricted context involved, ( r01r ) a b   〈 〉 , 〈 〉 ;wewant 〈 〉 ∈ X such that , a= axx∈X b= bxx∈X c= cxx∈X D[ ] r0(c)=a  ≅ r (c)=b . For x∈X ,K =O ,define c =1 :EaA@b ∈ RO ;wehave 1 xI xEaIxIx X I , .For ∈X , , ,define , , , ∈R ; rc0 xx=a rc1 xx=b x x:A I (y z) c x=(c yzxxc a b ) A I ∈R indeed holds since this means cxIA

c A@y EIy(a ) b y {  EIx(a )PPbx E (a )A@b Izcz z and this holds since ;also, , . EIx(a )=b x r0(cxx)=a r1(cxx)=b

This completes the proof of (8).

97 Let Σ be the theory of -diagrams of categories, T[diagI]=(L diag [I], diag[I]) I functors, and natural transformations. is a theory in ordinary multisorted logic T[diag I] with equality. The models of are those -structures that are T[diagI] L[ diag I] isomorphic to some A@ as an -structure (see above). Indeed, we can D:I Cat L[diag I] easily write down a set of axioms Σ over whose models are, up to diag[I] L[ diag I] isomorphism, precisely the D’s. Now, the construction D@D# is related to an interpretation

Φ A@ (19) :Lanadiag[I] [T diag [I]]

 of the DSV in the theory ; namely, # ≅ vΦ ; here, Lanadiag[I] T[ diag I] D D  A@ is the coherent functor induced by A@ . D:[Tdiag [I]] Set D:L diag [I] Set

To describe Φ , I first introduce certain specific formulas over the language .We L[diag I] A@i refer to the (arbitrary) objects, arrows and 2-cell IA@P ι J in I . j

 κ ∃ ∈ κ ( κ ) I(I )=def x I.i(IIx)= :A I  , κ κ U κ ( , κ ) I(I X )=I(def II) d()=X X:O II:A  , , ∃ ∈ U U ( , , ) T(I f g h)=def x T.t(II0 x)=f t(I1 x)=g t(I0 x)=h f g h:AI

, , , , , T(I X Y Z f g h)=def  U U U U U U , , d(IIIIIIf)=X c(f)=Y d(g)=Y c(g)=Z d(h)=X c(h)=Z T( If g h) ( , , ; , , ) X Y Z:OIIf g h:A   μ ∃ν κ λ∈ κ U λ U μ ν κ U ν μ λ IsoI ( )=def , , A.I(IIII) I() T(, , ) T( I, , ) ( μ ) :AI

, , μ μ U U∃ ∈ U μ . O(i X A )def = IsoJJ ( ) c(x)=A x O.o( ii0 x)=X d(Ji)=o1 (x) ( , , μ ) X:OIJJA:O :A  μ, , , ν ∃ ∈ μ, , U , ν, CommJ ( g h )=def k A.T(JJg k) T( Jh k) ( μ, , , ν ) g h :AJ

, , , , μ, ν, , A(i X Y A B f g)=def

, , μ U , , ν U∃ ∈ U μ, , , ν . O(iiX A ) O(Y B ) x A.a( ii0 x)=f CommJi ( g a(1 x) ) ( , , , , , μ, ν, ) X Y:OIJIJA B:O f:A g:A

98

, , , μ, ν, O(ι X A B h)=def

, , μ U , , ν U∃ ∈ U μ, , , ν O(ijX A ) O(X B ) x O.oo(ι i0 ι 0 x)=X CommJ ( h o(ι 2 x) ). ( , , , μ, ν, ) X:OIJA B:O h:A J

This is the description of the effect of Φ on objects:

Φ ∈ (O)=[IIX O:t] Φ ∈ (A)=[IIX A:t]

Φ ∈ , κ∈ , κ (I)=[IIIIX O A:I(X )]

Φ(T)=[X, Y, Z∈O ;f, g, h∈A:T(X, Y, Z,f, g, h)] IIII

Φ ∈ , ∈ , μ∈ , , μ (O)=[iX O IJJiA O A:O(X A )]

Φ , ∈ ; , ∈ ; ∈ ; μ, ν, ∈ , , , , μ, ν, , (A)=[iIJIJiX Y O A B O f A g A:A(X Y A B f g)]

Φ ∈ ; , ∈ ; μ, ν, ∈ , , , μ, ν, (O)=[ι X OIJA B O h A:O( Jι X A B h)]

To complete the definition of Φ as in (19), we should also specify the effect of Φ on arrows; this is done in the way straightforwardly suggested by our intentions with Φ .

 The fact mentioned above that D# ≅ DvΦ holds will be seen directly. In fact, if we define D in the standard way (among the possibilities that differ by isomorphisms only), we obtain an  equality D# = DvΦ .

Next, we explain a translation of formulas to formulas induced by Φ . Temporarily, let us call a FOLDS variable μ special if μ , for (unique) suitable A@ ∈ and :Oi (X A) i:I J Arr(I) , . Let us fix a 1-1 mapping μ@μ**of special variables μ to variables μ in X:OIJA:O ordinary multisorted logic over such that, when μ is as above, μ* .The L[diag I] :AJ non-special variables over are considered variables over ;if Lanadiag[I] L[ diag I] , in the sense of multisorted logic, and if , , then in the x:OIIx:O x:A I (y z) x:A I sense of multisorted logic.

For a special variable μ as above, we have the formula ϕ , , μ* , with the [μ] def=O(i X A )

99 latter formula introduced above. For a finite context X ,welet X*=X-{μ∈X: μ special}∪{μ**∈X: μ special} (exchange every special variable μ for μ ), and consider the formula ϕ ,.0 ϕ μ∈X special} ; ϕ X* . For a finite set Y of [X] def= { [μ][: Var( X])= variables over L[I] , we write {Y} for the -object [Y:t]= & [y∈K:t] in diag y∈Y y ,where . [Tdiag [I]] y :Ky

Recall that, with Φ as in (19), for any finite context X , we have the object Φ[X] defined as a certain pullback. Inspection shows that Φ X can be taken to be Q X* ϕ R ,the [ ] [ : [X]] domain of the subobject X**ϕ of X ; we have a canonical monomorphism [ : [X]] { } m:Φ[X]x@{X*} . Thus, for any θ in FOLDS with restricted equality, with Var(θ)⊂X ,

Φ[X:θ]x@Φ[X] may be regarded a subobject Φ[X:θ]x@Φ[X]x@m {X**} of {X } . We can produce a formula θ***such that Var(θ )=Var(θ) and

Φ[X:θ]= [X**:θ ] {X*}

(equality of subobjects of {X*} ) as follows. We have, for atomic formulas

, κ * ≡ , κ (III (X )) I(X ) ( κ ) X:OII , :A

, , , , , * ≡ , , , , , (TII (X Y Z f g h)) T(X Y Z f g h) ( , , ; , ; , ; , ) X Y Z:OIIIIf:A (X Y) g:A (Y Z) h:A (X Z)

, , , , μ, ν, , * ≡ , , , , μ**, ν , , (Aii (X Y A B f g)) A(X Y A B f g) ( , ; , ; μ , , ν , , , , , ) X Y:OIJiiIJA B:O :O (X A) :O (Y B) f:A (X Y) g:A (A B)

, , , , , * , , , **, , (Oιι (X A B μ ν h)) ≡ O(X A B μ ν h) ( , , ; μ , , ν , , , ) X:OIJiiJA B:O :O (X A) :O (Y B) h:A (A B) * U U (f= , g) ≡ d(f)=d (g)=X c(f)=c (g)=Y f= g A(IIX Y) II II A ( , ; , , , ) X Y:OIIf:A (X Y) g:A I (X Y) * U U ** (μ= , ν) ≡ O(X, A, μ) O(X, A, ν) μ = ν O(iJX A) ii A ( ; ; μ, ν , ); X:OIJA:O :O i (X A)

100 for connectives

t* ≡ t f* ≡ f (θUρ)***≡ θ Uρ (θVρ)***≡ θ Vρ θρ ***≡ ϕ U θ ρ X θρ ( ) [X] ( )(= Var( ))

and for quantifiers

∀ θ **≡ ∀ ∈ θ ( ) ( x ) x O.IIx:O (∀xθ)**≡ ∀x∈A .((d (x)=yUc(x)=z)θ ) ( x:A (y, z) ) II I I

∀ θ **≡ ∀ ∈ , , **θ ( A@ , , ); ( x ) x AJi .(O (y z x ) ) i:I J x:O i (y z) the existential quantifier is dealt with correspondingly.

Notice that if Var(θ) is a restricted context, then Var(θ*)=Var(θ) .

The upshot of all this as follows. For an I-diagram D:IA@Cat , and its saturation D# ,if X is a finite restricted context over , θ is a FOLDS formula with Lanadiag[I]  Var(θ)⊂X ,and a∈D[X] , then

  D# θ[a]  D θ*[a].

For a structure over a language extending , Q R denotes its reduct to M L[diag I] M ; Q R is the underlying -diagram of . L[diag I] M I M

(20)(a) Let be a theory extending .Let X be a finite restricted context over T T[diag I] , σ an -formula such that σ ⊂X . The following two conditions (i), Lanadiag[I] LT Var( ) (ii) are equivalent.

101 (i) For any M, N T and tuples a∈QMR[X] , b∈QNR[X] , Mσ[a] and  (QMR, a)(QNR, b) imply Nσ[b] .

(ii) There is θ in FOLDS over with θ ⊂X such that for all Lanadiag[I] Var( ) MT and tuples a∈QMR[X] ,wehave Mσ[a] iff Mθ*[a] .

(b) In particular, if σ is a sentence over , and for any , , σ and LT M N T M Q R J Q R imply σ , then there is a sentence θ of FOLDS over such M N N Lanadiag[I] that for any MT , Mσ iff Mθ* .

Proof. ((ii)(i)) Given θ as (ii), we have

Mσ[a]  Mθ*[a]  QMRθ*[a]  QMR#θ[a]

and similarly,

Nσ[b]  QNR#θ[b].

 Assume the hypotheses of (i), in particular, (QMR, a)(QNR, b) .By(8),for # # , Q R , ≈ Q R , , hence, by 5.(2)(b), L=Lanadiag[I] ( M a) L( N b) QMR#θ[a]QNR#θ[b] . By what we saw above, this means Mσ[a]  Nσ[b] as desired.

((i)(ii)) Assume (i). We apply 5.(15) with σ=m*([X:σ] ∈ S(Φ[X]) in place of σ ;  m:Φ[X]x @{X} as above. The condition Mσ[a] translates into 〈 a 〉 ∈M[σ] ; now,   〈 a 〉 =a . Recall that ML=MvΦ = QMR# . Thus, also using (8), we have

  for all M, NT , a∈(ML)[X] , b∈(NL)[X] ,   〈 a 〉 ∈M[σ] , (ML, a) ≈ (NL, b)  〈 b 〉 ∈N[σ] .

102  Since every PC is isomorphic to one of the form M , with MT , we have the hypothesis of

5.(12). The conclusion gives θ in FOLDS over such that σ Φ X θ ,which L =Φ[X] [ : ] suffices.

The result of (20) can be paraphrased by saying that a first-order property of a diagram of categories, functors and natural transformations is invariant under equivalence iff the property is expressible in FOLDS with restricted equality as a property of the saturated anadiagram canonically associated with the diagram.

It is left to the reader to formulate stronger versions of (20), based on results of §5.

A normal theory for -diagramsisatheory extending such that if and I T T[diag I] M T DJQMR ,thenthereis NT such that QNR=D . For a restricted context X , and formula σ of with σ ⊂X , we define the concepts " σ is preserved/reflected along L[diag I] Var( ) equivalences of models of T " in the obvious way, in analogy to the case of a single category (see above). We have the following analog of (3).

(20') Let T be a normal theory of I-diagrams of categories, functors and natural transformations. Let X be a finite restricted context over . Suppose that the Lanadiag[I] first-order formula σ over with free variables all in X is preserved and L[diag I] reflected along equivalences of models of T . Then there is a formula ϕ in FOLDS over such that σ is equivalent to ϕ* (defined above) in models of . Lanadiag[I] T

〈 〉 Let us discuss the special case of I =(0A@0,1 1) consisting of two objects and an arrow between them; there are no 2-cells. The intended structures for A@〈 0,1 〉 are functors; more precisely, structures consisting of two Lfun =L diag [(0 1)] categories connected by a functor. Fibrations are such structures. There are many first-order conditions on fibrations and on objects and morphisms in fibrations that are of interest. On the other hand, in [MR2], several elementary (first-order definable) classes of structures L-fun were introduced as categorical formulations of ; these "modal categories" are not in general fibrations.

103 Let me restate the basic concepts for is the following graph: L.Lfun fun

TI00 TI 11 t t t itt t i 0033 01 3 02 # 0 10 33 11 3 12 # 1 aa MN01A@ A01A A d cdcdc 0PP0 PP1 PP1 O MN O A@ O . 0o01 o 1

A@〈 0,1 〉 is generated by , subject to appropriate Lanafun= L anadiag[(0 1)] L fun equalities of composite arrows. A functor F:XA@A is regarded an L -structure in such a fun way that the interpretation of the relations O and A are the graphs of the object-function and of the arrow-function of F , respectively.

Given functors F:XA@A and G:YA@B ,anequivalence between them is a triple , , as in (E01E e)

XA@F A A@≅ E0P e DPE11: e:EF GE 0 A@W Y G B

in which and are equivalence functors. This notion of equivalence of functors can be E01E motivated by saying that it is the combination of two simpler notions: one is the isomorphism of two parallel functors

A@F XA@≅Pe A , G

E and the other is the relation between XA@F A and the composites YA@0 XA@F A , E A@F A@1 where , are equivalence functors. Since the second notion only X A B E01E involves changing a category to an equivalent one, the change affected on the functor should be an "inessential" one; the resulting composites should be "equivalent" to F ; they are,

104 according to our definition. It is clear that the equivalence relation generated by the two special cases of "equivalence" is the full notion of "equivalence".

For A@ as an -structure, # , the saturation of ,an -structure, has, F:X A LfunF F L anafun among others,

≅ F#O={(X, A, μ): X∈X, A∈A, μ:FXA@A} ,

and

F#A={(X, A, μ, Y, B, ν, f, g): A@μ ≅≅ FX A (XA@fgY)∈X, (AA@B)∈A, μ:FXA@A, ν:FYA@B such that FfP { Pg }. A@ FY ν B

In the spirit of [M2] , within the notation for ##, the object is also written as , F A A Fμ(X) and # . g = Fμ, ν(f)

The various kinds of modal categories of [MR2] are each defined by a finite set of first-order axioms, and each kind of modal category is invariant under equivalence: if F:XA@A belongs to the given kind, and G:YA@B is equivalent to F:XA@A , then so does G:YA@B .It follows by our invariance theorem (15) that the axioms can be formulated in FOLDS, although not as statements about the functor itself, but as statements about its saturation. However, it is not necessary to use the invariance theorem (which is anyway proved in a non-constructive way) to obtain the individual FOLDS-statements; in each case, one can find them directly, rather easily. I will give an example of an axiom thus reformulated in FOLDS.

Suppose the functor F:XA@A preserves monomorphisms, and consider the following condition on F :

(21) For any ∈ , the induced map A@ of posets has a right X X FX:SXA (X) S(FX) adjoint (denoted Y@WY , the necessity operator).

I want to show that the (21) can be equivalently written as a statement about F# . The simple

105 ≅ observation is that if (21) holds, and μ:FXA@A , then the map v ϕ ϕ μ A@ defined by ϕ x@r x@μ Fr also has a right = [ ]:SXA (X) S(A) ([Z X])=[FZ A] adjoint ( [Zx@r X] is the subobject of X given by r ); it is this latter, more general, statement that we can (almost) directly formulate in FOLDS about F# .

For variables , , ,let , , , abbreviated as ,and U V:O00 , u:A (U V) M( 0U V u) M( 0u) intended to say that is a monomorphism, be the -formula u Lanafun

U  ∀W:O .∀v, w:A (W, U)(∃z∈A(W, V).T (v, u, z) T(w, u, z). v= , w) . 00 00 0 A(0 W U)

Changing all subscripts to , we get the formula . Here is the sentence θ for 0 1 M(1 u) which F#θ is equivalent to (21):

∀ ∀ ∀μ , ∀ ∀ ,  X:O01A:O :O(X A) B:O 11m:A (B A){M 1 (m) ∃ ∃ , U∀ ∀ ∀ν , ∀ , ∀ , Y:O00n:A (Y X)[M 0 (n) Z:O 01C:O :O(Z C) r:A 0 (Z X) s:A 1 (C A) U U ν, μ, ,  (M00 (r) M(s) A( r s ) dca01 a ∃ , , , , , ,  ∃ , , , , , , t:A00 (Z Y).T (Z Y X t n r) u:A 11 (C B).T (C B A u m s))]} .

To help reading the sentence interpreted in F# , here is a display of the data involved:

XA

x@nmx@ A@μ Yi)XB i)A=FXμ FX ≅ A { { OO {  t ru s=Fνμ(r) Frs A@≅ ZC=FZνν FZ C A@≅ FX μμA v [FZx@FrA]= [Cx@ s A] . A@≅ A FZ ν C

Let us discuss fibrations. The first thing to say is that the concept of fibration is not invariant under equivalence of functors. An equivalence functor is, clearly, not necessarily a fibration; an identity functor is one, however; it follows that the concept of fibration is not invariant

106 under equivalences of the form , , . (E0 Id id)

On the other hand, once we know that F:XA@A and G:YA@B are fibrations, then the usually considered additional properties of F , and of diagrams in the fibration F , are JJ inherited along arbitrary equivalences FA@G . The reason is that any equivalence FA@G gives rise to a "strong" equivalence from F to G ; and the usually considered properties are invariant under the strong equivalences. In fact, the notion of strong equivalence is related to looking at a fibration as a structure for a new DS vocabulary . Let me explain. Lfib

Consider the following DSV : Lfib

TI00 t t t i 0033 01 3 02 # 0 TI11    A t10t 11t 12i 1 0 _   j 3 3 3 # aA\ d c0  p 0PP0a11A O \ 0   d c o  1 P P 1  o ; O1

here, besides the two obvious copies of , we have the equalities Lcat

oda00 =da 11 ,oca=ca 00 11 .

(The simpler version that has an arrow A@ in place of MN A@ is not suitable; A01A A 0A A 1 we need equality on to express fully the properties of the arrows of the base category; A1 with the version indicated, would not be a top kind, therefore would not be eligible for A1 carrying an equality predicate in the language.)

Among the -structures, we find the functors; given A@ , it is understood as an Lfib F:X A -structure in the natural way in which the -copy of is ,the -copy , Lfib0 L cat X 1 A o is the object-function of F , and the relation A is the graph of the arrow-function of F . Note that whereas is a simplification of , its height is 4 , and that of is 3 . LfibL funL fun Here is an axiom in FOLDS over that formulates the existence of (strongly) Cartesian Lfib arrows:

107

∀ ∀ ∀ , ∀ ∃ , , , , U A:O111B:O f:A (A B) Y:O 0 (B) u:A 0 (A B X Y){A(u f)

∀ ∀ , ∃ , , , U∀ ∀ , , , ,  C:O11g:A (C A) h:A 1 (C B)[T 1 (g f h) Z:O 00v:A (C A Z Y)(A(v h)

∃ , , , , U , , !w:A00 (C A Z X)(A(w g) T(w u v)))]} .

Here is a diagram to accompany the sentence:

Z\     v w   k  o XA @u Y AA @f B ) - g   *  h C

We have employed the usual abbreviations in writing the atomic formulas; the unique existential quantifier ∃! may be expanded in the expected way. Adding further axioms that are easily obtained, we get a sentence in FOLDS over that axiomatizes the notion of Lfib fibration. This would not be possible to do over . Lanafun

Letuscallfunctors A@ and A@ strongly equivalent, J ,ifthereisan F:X A G:Y B F sG equivalence , , J (in the previous sense), with an identity in the third (E01E id):F G component;

XA @F A   {  (22) E0PPE1 A @ Y G B

(23) For functors F and G , FJ G iff F ≈ G . As a consequence, a first order s Lfib property of objects and arrows in a prefibration (functor), in particular, in a fibration, is invariant under strong equivalence iff the property is expressible in FOLDS over . Lfib

I only outline the proof. Of course, the second statement is obtained

108 as a consequence of the first by §5. Given (R, r, s):FG , for any Lfib  ∈ , let us pick ∈R by the Axiom of Choice such that , and put A FO11 =Ob(A) A O r(A)=A  .For ∈ ,let ; thus, ∈ . By the very surjectivity of E10(A)=s(A) X Ob(X) A=F(X) X FO(A)    ,thereis ∈R such that ;welet .Wehavedefinedthe r X O(00A) r(X)=X E (X)=s(X) object-functions of equivalence functors A@ , A@ , and note (the main point) E10:A B E :X Y that, at least as far as the effect on objects is concerned, the diagram (22) commutes (and not just up to an isomorphism). The rest of the verification is left to the reader.

Note that the treatment of fibrations did not require a passage to an "anafunctor". The usually considered properties of fibrations are invariant under strong equivalence. On the other hand, there is a simple, and well-known, "transfer property" for morphisms of fibrations which ensures that for fibrations and , J iff J ; in fact if , , J , F G F G F s01G (E E e):F G there is A@ such that ≅ and , , J E00001’:X Y E’ E (E’ E id):F G .

109 §7. Equivalence of bicategories

For 2-categories and bicategories, see [M L], [Be], [S].

In this section, I discuss invariance of properties of bicategories, and of diagrams in bicategories, under biequivalence (however, I will call "biequivalence" "equivalence of bicategories"). To mention just two examples, the property of a bicategory having finite weighted (indexed) limits (see [S]) is a first-order property invariant under (bi)equivalence; but the property of a 2-category having finite 2-limits is not so invariant. The main result of this section (see the Corollary at the end) implies that the first-mentioned property can be expressed in FOLDS, although not quite in the language of the bicategory itself, but in a modification of it. In fact, the formulation of the said property in FOLDS can be done directly, quite easily.

One possible choice of a similarity type for 2-categories is the following graph : L2-cat

h MN0 THMN 1 h 1 t10t11th12 2h3h4 c PP P c PP P t20 MN10 MN 20 MN CCMN MN CtT 0 cc1 2212MN 11 O 21 O t i1 i222 II12

The following explains the meaning of these symbols in the case of a 2-category:

: (the set of all) objects (0-cells), C0 : arrows (1-cells), C1 : 2-cells; C2 : domain, c,c10 20 : codomain, c,c11 21 : commutative triangles T1

110 G t τ B t τ τ = 10 g11 LA @ τ t12

of 1-cells, : commutative (for vertical composition) triangles T2

A @ Pt θ θ A 20 t θ @ = t θ 22 A @P 21 P

of 2-cells, H : commutative (for horizontal composition) triangles

% thη  cthη thη 10 0 11 10 0 G 11 0 A @B M N  h η  h η 2  thη thη g3 h LL  10 1 11 1 η th12 1 A @O η = cthη h η cthη 10 10 0 A @ 4 11100 η th12 0

of 2-cells; : identity 1-cells, I1 : identity 2-cells. I2

A 2-category is the same as a structure for satisfying certain axioms Σ in L2-cat 2-cat multisorted first order logic with equality(ies) over . L2-cat

For the concept of bicategory we need, in addition, the sorts A, L and R , accommodating associativity isomorphisms, and left and right identity isomorphisms, respectively. More precisely, we introduce, besides these three new objects, the arrows

111 a0 MN a4a T1AMN A@ C, 1 a 2 MN2 a3

CC22 OO # r # 2 # r 2 r MN01A@ MN 01A@ ; T1111L I,T R I

with these additions to , we obtain . L2-catL bicat

In a bicategory, the symbols of are interpreted as expected (as in a 2-category). L2-cat A stands for the set of 5-tuples α α, α, α, α, α where the α =(a01234a a a a ) ai ( , , , ) are commutative triangles of 1-cells (elements of ), and α is a 2-cell, i=0 1 2 3 T14a fitting together as in

A@ ) g=01=20 a α = O) a α = HP A@ 0 1 A@ O  % A@  α  α Ok f=00=30  02=10 h=11=21a 2 = kP a3 = A@   22=31 g P LA@32 Oa α A@ 4 12

with standing for α ,and α is the associativity isomorphism ij t(a1ji) a4 α A@≅ . is the set of triples λ # λ # λ # λ as in f, g, h:h(gf) (hg)f L =( 012, , )

# λ ct10 10 0 G

# # # # λ t λ A@λ f=t λ f=t10 0 12 0 2 10 0 P g h # A@ # , B=c λ # λ # λ B=c λ 10 1 1B =i11=t 110 10 1

and # λ is the identity isomorphism λ v A@≅ . is similar, mutatis mutandis. 2 fB:1 f f R

112 Bicategories are -structures satisfying a set Σ of axioms, in multisorted Lbicat bicat first-order logic with equality over . Of course, 2-categories are those bicategories Lbicat for which each α , λ , ρ are identity 2-cells. We write for the theory f, g, hff Tbicat Σ . (Lbicat , bicat)

Now, we introduce the DSV . The underlying simple category is generated by Lanabicat the graph , subject to the following equalities: Lbicat

cc10 20 =cc 10 21 ,cc=cc 11 20 11 21 , ct11 10 =ct 10 11 ,ct=ct 10 10 10 12 ,ct=ct 11 11 11 12 , ci=ci,10 1 11 1 ct21 20 =ct 20 21 ,ct=ct 20 20 20 22 ,ct=ct 21 21 21 22 , ci=ci,20 2 21 2 th=ch,th=ch,th=ch,th=ch,10 0 20 2 10 1 21 2 11 0 20 3 11 1 21 3 . th=ch,th=ch12 0 20 4 12 1 21 4

ta=ta,ta=ta,ta=ta,ta=ta,10 0 10 3 11 0 10 2 12 2 11 3 12 0 10 1 ta=ta,11 1 11 2 ca=ta,ca=ta,20 4 12 1 21 4 12 3 # # # # # # i11=t 110,c 202=t 120,c 212=t 100, i11 r =t 100 r ,c 202 r =t 120 r ,c 212 r =t 110 r .

The relations of are exactly its maximal objects, that is, its level-3 objects, Lanabicat

and . I22 ,T ,H,A,L R

The equalities between composites arise naturally; they hold in a bicategory (as a -structure); also, the relations of are interpreted in a bicategory LbicatL anabicat "relationally"; in brief, every bicategory is an -structure. Lanabicat

In [M2], the concepts of anabicategory,andsaturated anabicategory were introduced. Although these concepts implicitly underlie all that follows, they will not be relied on explicitly.

An anabicategory is an -structure satisfying certain axioms Σ in Lanabicat anabicat FOLDS (with restricted equality) over ; a saturated anabicategory is one that Lanabicat

113 satisfies a larger set Σ of axioms in FOLDS over (these facts will sanabicatL anabicat be seen upon inspecting the definitions in [M2] ). An anabicategory is like a bicategory, with the composition functors replaced by composition anafunctors.

For the reader who has a copy of [M2], I now point out some details, which, however, are not needed later.

Let A be an anabicategory as in [M2]. In explaining in what way A is an -structure, we will write for A , etc. For a diagram LanabicatT 1T 1

G f %B g L g (1) AA @C , h

, , (short for , , , , , ) is the set Qv R , , , the set T(11f g h) T(A B C f g h) A, B, C ((f g) h) of specifications for being the composite of and , v (see 3.1.(iv) in s h f g h = g sf [M2]). For A@ ∈ , is Q R , , the set of specifications for f:A A C,I(11A f) 1A (* f) i f being the identity 1-cell on , (see 3.1.(iii) in [M2]). For A f =1A, i

g BA @G%C O   f  i h (2)  k P L g# A A @D A @Oα j

in A ,and

∈ , , , ∈ , , , ∈ , , , ∈ , , # ,(3) a T(1111f g i) b T(i h j) c T(g h k) d T(f j ) and α:jA@ # ,we have

, , , ; α  α α A(a b c d ) = a, b, c, d

(see 3.1.(vi) in [M2]). (According to our conventions in logic with dependent sorts, A(a, b, c, d; α) is short for A(A, B, C, D; f, g, h, i, j, k, # ; a, b, c, d; α) ).

114 Every bicategory (as an -structure) is an anabicategory, although not necessarily Lanabicat saturated.

Whereas the interpretation of in a bicategory, the notion of "commutative triangle of T1 1-cells", is a relation on triangles of 1-cells (where a triangle of 1-cells is three objects and three arrows (1-cells) appropriately related via the domain/codomain functions), in an anabicategory, we have a sort of entity that may be called "specification for a commutative triangle of 1-cells". Such a specification does specify a unique triangle (via the maps ); t1i however, the property "commutative" does not figure separately. You may say that a triangle is commutative if there is a specification for it to be commutative, but in the concept of anabicategory, we do not work with this notion, we only work with the specifications. In an anabicategory, the expression "commutative triangle (of 1-cells)" should always be interpreted as "specification for a commutative triangle".

Next, we define a translation of the language into the theory ;thatis, LanabicatT bicat a -bicat structure A@ . Via this translation, every [Tbicat ] I:L anabicat[T bicat ] bicategory A gives rise to A##= Av ,an -structure. A is in fact a saturated I Lanabicat anabicategory; however, for the main result, we will not need this fact; we will use the actual construction of A##as an -structure only. (In [M2], A was defined for the Lanabicat special case of a (one-object bicategory) A only.) We define the passage A@A# ; this will describe the said interpretation as well.

In A# , the interpretation of the part

cct 20 M10 MN 20 MN CCCtT 0M 1MN 2212MN cc11 21 O t  22 I2 of is the same as in A . Lanabicat

Under (1) (0-cells and 1-cells in A as well as in A# ),

115 A A# , , , T(1f g h) def = Iso (gf h)

≅ = the set of all isomorphism 2-cells gfA@h .

BG  B G f  B h A@  MN  β δ   g i g LL  g If A@k Oε A A@ C j and ∈A##, , , ∈A , , , then s T(11f h j) t T(g i k)

hfA@s j #  A H(s, t; β, δ, ε)  δ ⋅ β  { ε . def PP A@ ig t k

Under (2) and (3) in A# ,

α , , h(gf)A@f g h (hg)f  PPha cf

A#A(a, b, c, d; α)  hi { kf ;(4) def  PPbd α j A@ # here a reference is made to the associativity isomorphism α given with A . f, g, h

For a 1-cell A@ , A# ; , . f:A A I(1 A f) = Iso(1A f)

For

116 AG h fP g A@ , B g B

∈A# , , ; , , , ∈ ; , λ , , a T(112A B B f g h) i I(B g) :C (h f)

1 fA@if gf B A#L(a, i, λ)  λ  { a , def f PP MN f λ h

where a reference is made to the identity isomorphism λ given with A . The definition of f

A#R is a straightforward variant.

In a bicategory A , a 1-cell f:BA@A is an equivalence if there is f’:AA@B such that v ≅ , v ≅ ; this is equivalent to saying that for any ∈A , the induced functor f f’ 1ABf’ f 1 C f*:A(C, B)A@A(C, A) is an equivalence of categories.

We have the notion of functor of bicategories; this is just a different expression for "homomorphism of bicategories" (see [Be], [S]). A functor F:XA@A of bicategories is an J equivalence (of bicategories) [instead of "biequivalence"], in notation F:XA@A ,if

J (i) for every A∈A ,thereis X∈X and an equivalence f:FXA@A ;

and

(ii) for X, Y∈X , F induces an equivalence of categories X(X, Y)A@A(FX, FY) .

See [S].

We say that the bicategories X , A are equivalent [instead of "biequivalent"] if there is an J equivalence XA@A . Equivalence of bicategories is an equivalence relation (this requires the Axiom of Choice; the fact is well-known, but it also follows from (5) below).

117 Let = . L Lanabicat

(5) For any bicategories X , A , X J A iff X ≈ A . L

J Proof. (A) ("if") Let R, , X#M@≈ A# . We construct XA@A . ( r01r ): L F:

We write 〈 ε 〉 for ε ,and ε for ε . We will write R for *#X *#A r01( ) [ ] r ( ) r 01=r too.

  Given any ∈X , we pick (by Choice) ∈R such that 〈 〉 . We put . X C0X C 0X =X FX def=[X]   For any A@ in X , pick (by Choice) ∈R , such that 〈 〉 , and for f:X Y f C(1 X Y) f =f A@f    XA@Pβ Y , β∈C(f, g) with 〈 β 〉 =β ( β is uniquely determined); define Ff =[f] , g 2  Fβ =[β] .

 For A@fgA@ in X , ∈X# , , ;let ∈R , , such that X Y Z adef=1gf T(11f g gf) a T(f g gf)

〈 〉 ; then ∈A , , ,thatis, v A@≅ . Therefore, a =a [a] T(1 Ff Fg F(gf)) [a]:Fg Ff F(gf) we may define . Ff, g def=[a]

The coherence condition that the have to satisfy (the sense in which preserves the Ff, g F associativity isomorphisms) reads as follows: given

XA@fghYA@ZA@W , we have

118 α , , Fh(FgFf)A@Ff Fg Fh (FhFg)Ff FhFf, gFFfg, h PP FhF(gf) {? F(hg)Ff Fgf, hFf, hg PP A@ F(h(gf)) α F((hg)f). F( f, g, h)

Writing , , , , this amounts to the same as a=1gfb=1 h(gf) c=1hg d=1(hg)f

  α , ,   [h]([g][f])A@[f] [g] [h] ([h][g])[f]     [h][a][c][f] PP   [h][gf] {?[hg][f]   [b][d] PP    [h(gf)] A@ [hg][f]. α [ f, g, h]

But by (4), the last commutativity is equivalent to saying that  A# , , , ; α holds. The latter is a consequence of A([a] [b] [c] [d] [ f, g, h])  R , , , ; α , which in turn follows from X# , , , ; α , which, A(a b c d f, g, hf) A(a b c d , g, h) finally, holds by (4) since a, b, c and d are identities.

The preservation by F of identity isomorphisms, and that of horizontal composition (see [MP], §4.1, (2)(v) and (2)(iv)) are similar, and use L,R and H , respectively.

The facts that F preserves identity 2-cells and vertical composition of 2-cells are immediate.

We claim that for any ∈A ,thereis ∈X such that J .Given ,pick ∈R A C00X C FX A A X C 0

with [X]=A , and let X= 〈 X 〉 . (Picture:

119  4 X     X 2  #+ k k XAFX.) 315

  Consider ∈X , , and let ∈R , , ∈R , such that 1X C(111X X) i C(X X) j C(X X) 〈 〉 〈 〉 .Wehave i = j =1X

[i]:FXA @A , [j]:AA @FX

 in A .Let v ∈X , ,and ∈R , , ∈R , such that f=1XX1 C(111X X) f C(X X) f C(X X)  〈 〉 〈 〉 . Consider ∈X v , ; then ∈X# , , ; , , .Let f = f =f 1f C(12 XX1 f) 1 f T(1 X X X 1XX1 f)    ι ∈ , , ; , , ι ∈ , , ; , , such that 〈 ι 〉 〈 ι 〉 . Then T(11X X X i j f), ' T(X X X j i f) = ’ =1f  ι ∈A# , , ; , , , and thus [ ] T(1 FX A FX [i] [j] [f])

≅  [ ι ]:[j]v[i]A @[f] ;(6) similarly,

≅ [ ι ’]:[i]v[j]A @[f] .

≅  But, ϕ = λ :fA @1 ,thatis, ϕ∈X#I(X, f) . Thus, there is ϕ∈RI(X, f) (such def 1X X 11   that 〈 ϕ 〉 ϕ ). Then, ϕ ∈A# , , i.e., ϕ A @≅ . Combined with (6), = [ ] I(1 FX [f]) [ ]:1FX [f] we get v ≅ . Similarly, v ≅ . The data , provide an [j] [i] 1FX[i] [j] 1 A [i] [j] equivalence of FX and A as claimed.

Let us see that X , A @A , is an equivalence of categories. That it is a FX, Y: (X Y) (FX FY) bijection on hom-sets is a consequence of the fact that R, , respects the equalities ( r01r ) on -sorts. To see essential surjectivity on objects, let A@ ,thatis, C2 g:FX FY   ∈A# , .Thereis ∈R , such that ;let 〈 〉 . We now g C([11X] [Y]) f C(X Y) [f]=g f= f

120    have , both in R , , and both "over" . There are ∈R , , f f C(12X Y) f i C(f f)    ∈R , , # ∈R , , # ∈R , such that 〈 〉 〈 〉 〈 # 〉 〈 # 〉 .We j C(22f f) C(f f) C(2 f f) i = j = = =1f   have X# ; , hence, R ; # and A# ; # ;thatis, # . I(2 f 1)f I(22f ) I(Ff [ ]) [ ]=1Ff   Similarly, # .Since X# , , ; , , ,wehave R , , ; , , # [ ]=1g T(2 f f f 1fff1 1) T(2 f f f i j )  and R , , ; , , # , and as a consequence, A# , , ; , , T(22f f f j i ) T(Ff g Ff [i] [j] 1)Ff and A# , , ; , , ;thatis, , . This shows T(2 g Ff g [j] [i] 1)gFfg[j][i]=1 [i][j]=1 that g ≅ Ff as desired.

J (B) ("only if") Let XA@A , we construct R , , X##M@A . We will again F: ( r01r ): L write 〈 ε 〉 for r (ε) , [ε] for r (ε) . 01

J We put R , , ∈X ∈A is an equivalence A@ }; C={(0 defX A x): X C, 0A C, 0 x x:FX A 〈 , , 〉 , , , . (X A x) def= X [(X A x)] def = A

Let us introduce a helpful notation. For any object of ,any ∈X and D Lanabicatd 1 D ∈A , R , stands for ∈R 〈 〉 , , "the fiber of R over d212D D[d d ] {d D: d =d 12[d]=d } D , ". We extend this definition to any sort R , , in R ,inplaceof R ; (d12d ) D(e e’ ...) D

R , , , ∈R , , 〈 〉 , ; D(e e’ ...)[d12d ]={d D(e e’ ...): d =d 1[d]=d 2}

here, it is assumed that ∈X##〈 〉 , 〈 〉 , , ∈A , , . d12D( e e’ ...) d D([e] [e’] ...)

The definition of R together with effect of , on it, can be put, more succinctly, C012r r as

J R , , A@ . C[0 X A] = Equiv(FX A)={x: x:FX A}

 Continuing, we define, for A@ , A@ , , , , , , ∈R , f:X Y f:A B x=(X A x) y=(Y B y) C0

 R , , v , v , C(1 x y)[f f] = Iso(y Ff f x) the set of all 2-cell-isomorphisms ϕ as in

121 FXA@x A ≅  FfPL B Pf . A@ϕ FY y B

R is relational, meaning that its fibers are either ,or ∅ . Instead of C2 {*} " ∈ R , ; ϕ, γ μ, ν ", we just write " R , ; ϕ, γ μ, ν ". * C(22x y )[ ] C(x y )[ ]

 A@ff A@ For X Pμ Y in X , A Pν B in A , x, y and ϕ as before, and A@ A@ g g

γ∈R , , , C(1 x y)[g g]

FX A@x A  @ν  μ  { fg RC(x, y; ϕ, γ)[μ, ν]  Ff A@F Fg " "  2  ϕBB  def P P  γ PP A@LL FY y B v μ yvFfA@y F yvFg   ϕ{ γ . def PP  v A@ v f x νvx g x

Using that x , y are equivalences, and that F is an equivalence of bicategories, we see that, for fixed , , ϕ, γ , the relation R , ; ϕ, γ μ, ν of the variables μ, ν is a x y C(2 x y )[ ] bijection

 μ@ν X , A@≅ A , . : C(22f g) C(f g)

This implies that (R , r , r ) preserves the equality relation E . Also, with reference to 01 C2  f A@f AP  @ A Pν @  Ag μ ξ@ , g σ ζ ,and η∈R , , we easily see that X Pρ PPPY A B C[1 h h] A @ A@ h h

R , ; ϕ, γ μ, ν R , ; γ, η ρ, σ , ρμ ξ , σν ζ  C(22x y )[ ], C(y z )[ ] = =

122 R , ; γ, η ξ, ζ , C(2 x z )[ ]

from which it follows (by the above bijection μ@ν ) that

R , ; ϕ, γ μ, ν , R , ; γ, η ρ, σ , R , ; γ, η ξ, ζ  C(222x y )[ ] C(y z )[ ] C(x z )[ ] ρμ = ξ  σν = ζ .

This means that -1X # -1A # ;thatis, R , , preserves . r0212( T)=r ( T) ( r 01r ) T 2

Given

J  A@ ∈R , , A@ in X , A@ in A , ϕ∈R , , , (x:FX A) C[01X A] f:X X f:A A C(x x)[f f] that is,

FXA@x A  ≅  FfPL B Pf , A@ϕ FX x A

 and A@≅ , A@≅ ,wehave a:1XAf a:1 f

A@ϕ  xFf ≅ fx OO xFa≅≅ax

R , ϕ ,  { . I(1 x )[a a] xF(1XA ) 1 x c i def  10 1 xF ≅≅λ XPPx A@≅ x1 ρ x FX x

Given

JJ (*) A@ ∈R , , A@ ∈R , , (x:FX A) C[00X A] (y:FY B) C[Y B] J A@ ∈R , , (z:FZ C) C[0 Z C]

123 G  G fBY gfBB g LL g  g XA @Z in X , AA @ C in A , i i     A @≅ ∈X# , , , A @≅ ∈A# , , , (a:gf i) T(11f g i) (a:gf i) T(f g i)  ϕ∈R , , , γ∈R , , , ι ∈R , , , C(111x y)[f f] C(y z)[g g] C(x z)[i i] we have

RT(ϕ, γ, ι )[a, a]  1 def

(front) zFaF M N≅ A @f, g (zFg)Ff α z(FgFf) zFi  (right) γFf ι (bottom) P{ P M N≅  (gy)Ff α g(yFf) )ix  (left) gϕ kax (back)  A @≅  g(fx) α (gf)x

(we have referred to the following diagram of 1-cells, and its "faces":

B B "  y    L f g FY  "   3 FgAA @ i C Ff B %     x  z LL 3  A @ ). FX Fi FZ

The facts that E,E are preserved are shown through the facts that the definitions of IT11  R R give bijections @ . I,11T a a

124

The proof that R , , so defined preserves and is put into Appendix D . ( r01r ) A H

We have an "augmented" version of (5), similarly to §6. I will state this without proof; for the proof the details of the notion of anafunctor would be needed, together with a concept of cleavage; the proof is, in outline, quite similar to the proof of 5.(8).

Let be the full subcategory of consisting of the objects , and K0L=L anabicatC 0C 1 .Arestricted context is a context of . For a bicategory A and its saturation A# , C20K A A## ; A X A X whenever X is restricted. K00= K [ ]= [ ]

Let X be a restricted context. An augmented bicategory of type X is a pair (A, a) of a bicategory A and a tuple a∈A[X] ; symbols such as (A, a) , (X, x) stand for augmented J J bicategories. The notation E:(X, x)(A, a) signifies that E:XA and E(x)=a .  The relations  and  are now defined in the same way as for I-diagrams in §6. For  bicategories, that is type-∅ augmented bicategories, the relations  ,  coincide with equivalence J . Generalizing (5), we have

(7) For augmented bicategories X, , A, , X#, ≈ A#, iff ( x) ( a) ( x) L( a)  (X, x) rrr!(A, a) .

We can, analogously to §6, define a recursive translation θ@θ* from FOLDS formulas θ over to formulas θ* in ordinary multisorted logic over such that, if L Lbicat X=Var(θ) is a restricted context, then Var(θ*)=X , and for any bicategory A , a∈A[X] , A#θ[a] iff Aθ*[a] . We obtain the following analogs of 5.(20) and 5.(20').

(8)(a) Let be a theory extending .Let X be a finite restricted context over T Tbicat , σ an -formula such that σ ⊂X . The following two conditions (i), (ii) Lanabicat LT Var( )

125 are equivalent.

(i) For any M, N T and tuples a∈QMR[X] , b∈QNR[X] , Mσ[a] and  (QMR, a)(QNR, b) imply Nσ[b] .

(ii) There is θ in FOLDS over with θ ⊂X such that for all Lanabicat Var( ) MT and tuples a∈QMR[X] ,wehave Mσ[a] iff Mθ*[a] .

(b) In particular, if σ is a sentence over , and for any , , σ and LT M N T M Q R J Q R imply σ , then there is a sentence θ of FOLDS over such that M N N Lanabicat for any MT , Mσ iff Mθ* .

(9) Let T be a normal theory of bicategories. Let X be a finite restricted context over . Suppose that the first-order formula σ over with free variables all LanabicatL bicat in X is preserved and reflected along equivalences of models of T . Then there is a formula ϕ in FOLDS over such that σ is equivalent to ϕ* in models of . Lanabicat T

(8)(b) follows from (5) (proved in detail above) and §5. As was mentioned, the proofs of (8)(a) and (9) require a more detailed look at anabicategories, similarly to what we did in §5 on anadiagrams in the proof of (20)(a); this work is omitted here.

A paraphrase of (8) can be stated as follows. A first-order property of a bicategory, or of a diagram of 0-cells, 1-cells and 2-cells in a bicategory, is invariant under (bi)equivalence of bicategories if and only if it can be expressed in FOLDS as a statement about the saturation of the bicategory.

126 Appendix A: An alternative introduction of logic with dependent sorts.

The way we defined the basic concepts of FOLDS in §1 may look somewhat ad hoc because of the a priori role of the one-way (simple) categories as vocabularies. There is a more direct definition of FOLDS which does not start with assuming simple categories as vocabularies. The notion of "vocabulary" that arises naturally in the direct approach does, nevertheless, turn out to be equivalent to the one we started with in §1. More fully, the direct approach and the original approach turn out to be equivalent in all essential respects. This Appendix describes this state of affairs.

We first define the classes of entities called kinds, sorts, variables, contexts and specializations, and certain relation between these entities. Each kind, sort, variable, context and specialization has a certain level, which is a natural number; the definition of the said entities is by a simultaneous induction, proceeding by the level.

For the present purpose, we use the set-theoretic notion of function as a set of ordered pairs with the usual condition; the point is that we do not make the "categorical" specification of the codomain as part of the data for a function. Given functions s and t , tvs is always defined and is a function; dom(tvs)={x∈dom(s): s(x)∈dom(t)} , and for x∈dom(tvs) , (tvs)(x)=t(s(x)) .

The kinds of level 0 are the entities of the form 〈 0, ∅, a 〉 , with a any set. We say that v the kind K = 〈 0, ∅, a 〉 is of arity ∅ , and we write Kv∅ .Thesorts of level 0 are the entities 〈 1, K, ∅ 〉 , with K a kind of level 0 ; we put Var(K)=∅ .Avariable of level 0 is any entity of the form 〈 2, X, a 〉 with X a sort of level 0 , a any set; we say that the variable x = 〈 2, X, a 〉 is of sort X , and we write x:X . (The definition ensures that every variable of level 0 has a unique sort of level 0 .) A context of level 0 is a finite set of variables of level 0 .Aspecialization of level 0 is a function s whose domain is a context of level 0 , and for each x∈dom(s) , s(x) is a variable of the same sort as x .

Suppose n is a natural number, n>0 , and we have defined what the kinds, sorts, variables, contexts and specializations of level k are, for each k < n , such that each context of level < n is a finite set of variables of level < n , and each specialization of level < n is a function whose domain and range are sets of variables of level < n . Suppose moreover that

127 we have defined the concept of a variable x being of sort X , for variables x and sorts X of level

A kind of level n is an entity 〈 0, Y, a 〉 ,where Y is a context of level n-1 ,and a is an v arbitrary set; we say that Y is the arity of K= 〈 0, Y, a 〉 , and we write KvY .

[Kinds are to form sorts (see below); kinds are incomplete sorts, with places for variables to fill; when these places are filled in a correct manner, then we have a sort. In our formulation, we did not introduce "places" as distinct from variables, although we could have done so; we used variables to denote "places"; this is the same as the "nameforms" in [K]. Our procedure may be compared to the one when, in ordinary first-order logic with several sorts, a relation symbol R is introduced in the form R(x , x , ...x ) , with distinct specific variables 01 n-1 of definite sorts; the arity of then may be identified with the set xi R X , , ; the atomic formula , , ( of the same sort ={x01x ...xn-1} R(y 0y 1 ...yn-1) yi as )using can then be identified with the pair , ( " ") where is the xi R (R s) = R(s) s function with domain X for which .] s(xii)=y

A sort of level n is any X= 〈 1, K, s 〉 , written more simply as K(s) ,where K is a kind v of level n , s is a specialization of level n-1 ,and Kvdom(s) ; . Var(X)def = range(s)

For a sort X ,avariable of sort X is any x = 〈 2, X, a 〉 ; we write x:X .

A context of level n is any set of the form Y∪X where Y is a context of level n-1 , X is a (non-empty, for having level exactly =n ) finite set, and each x∈X is a variable of level n such that if x:X , then Var(X) ⊂ Y .

If X=K(s)(= 〈 1, K, s 〉 ) , then Xjt denotes K(tvs)(= 〈 1, K, tvs 〉 ) .[Xjt is the sort obtained "by substituting t(x) simultaneously for each x∈Var(X) in X ".] t is a specialization (of level n )if t is a function whose domain is a context, and for every x∈dom(t) ,if x:X , then Xjt is a sort (of level ≤n ), and t(x) is a variable (of level ≤n )ofsort Xjt (and there is at least one x∈dom(t) of level n ).

The above may be put in a more compact manner, without talking about levels, as follows. We

128 define classes

KIND , CONTEXT , SORT , SPEC , VARIABLE

such that

X∈CONTEXT  X is a finite subset of VARIABLE , s∈SPEC  s is a function, dom(s) and range(s) ⊂ CONTEXT ; predicates

vv vv⊂ KIND × CONTEXT (read K Y as " K is a kind of arity Y ") : ⊂ VARIABLE × SORT (read x:X as " x is a variable of sort X ") and the function

A@P , Var : SORT fin(VARIABLE) by the closure conditions:

v 1 X∈CONTEXT  〈 0,X,a 〉 ∈ KIND and 〈 0, X, a 〉 vX ; 2 ∅ ∈ CONTEXT ; 3 X∈CONTEXT , X∈SORT , x:X , Var(X) ⊂ X  X∪{x} ∈ CONTEXT ; v 4 s∈SPEC , K∈KIND , Kvdom(s)  〈 1, K, s 〉 ∈ SORT and Var( 〈 1, K, s 〉 ) = range(s) ; 5 ∅ ∈ SPEC ; 6 X∈CONTEXT , s∈SPEC , X∈SORT , Xjs∈SORT , x:X , x∉dom(s) , Var(X)⊂X , y:Xjs  s∪{(x,y)} ∈ SPEC ; ( 〈 , , 〉 j 〈 , , v 〉 ) 1 K s t def= 1 K t s 7 X∈SORT  〈 2, X, a 〉 ∈ VARIABLE and 〈 2, X, a 〉 :X .

By definition, the intended system (KIND,...) is the minimal one satisfying the given closure conditions.

129 Let us give some examples. Let , , , , be arbitrary entities, ≠ , O,A,A1 UV u v U V u≠v . Here are specific kinds, variables, sorts and contexts, introduced by the above rules; at the start of the line, the number of the clause used is shown:

2 ∅∈CONTEXT , v 1 〈 ∅ ∅ 〉 ∈ ∅ O=def , ,O KIND , Ov . 5 ∅ ∅A@∅ ∈ s0 def=(: ) SPEC  4 〈 〉 ∈ , ∅ O=def1,O,s 0 SORT Var(O) = 7 〈 , 〉 ∈ , U def= 2,O U VARIABLE U:O 〈 〉 ∈ , V def= 2,O,V VARIABLE V:O 3twice {U, V} ∈ CONTEXT v 1 〈 , , 〉 ∈ , , A=def 0,{U V} A KIND A{v U V} 6twice , A@ , ∈ s1 def=id {U, V} :{U V} {U V} SPEC 4 , 〈 〉 ∈ A(U V)=def1,A,s 1 SORT 7 〈 , , 〉 ∈ , , u def= 2,A(U V) u VARIABLE u:A(U V) 〈 , , 〉 ∈ , , v def= 2,A(U V) v VARIABLE v:A(U V) 3... {U, V, u, v} ∈ CONTEXT 1 〈 , , , , 〉 ∈ A=1 def 0,{U V u v} A1 KIND

For a variable , we have a unique sort for which ; for a uniquely x Xxx:X xX=K(s) xxx determined kind and specialization . For a kind , X is the context for which KxxKs K v X . Kv K

A pre-vocabulary is a set of kinds such that ∈ , ∈X imply that ∈ .(Iam K K K x KxK K talking about pre-vocabularies because relations are not yet contemplated.)

We compare the present approach to the one in §1. Let K be a pre-vocabulary. We make K into a category with objects the elements of K . Arrows of K are the identity arrows, and the K A@ , one for each pair ∈ , ∈X . Composition is defined thus. Given p:xxK K K K x K

K ppKx KA@xyK A@K ( x∈X , y∈X ), xy KKx

130 X =K(s), with s:X A$Var(X ).z =s(y)∈Var(X )⊂X ;also, xxx xKx x def xxK pKK ; therefore, A@zxKK.Wedefine v . K=KzyK K yp yxzp=p

This composition is associative as is seen by using the equality , s(sys (u))=s(y) (u) which in turn is part of the definition of s being a specialization.

The category K so defined is clearly a simple category; the levels of kinds as given in the definition above are the same as their levels in K .

Let us use K as a category of kinds in the way done in §1. I claim that the resulting notions of variable , sort , and context are essentially the same as those of variable , sort and 11 1 KK context in the sense of the present Appendix, with the only kinds allowed the ones in . K K More precisely, we define, by a simultaneous recursion, functions

 @ A@ (1) X X : SortK Sort1

@ A@ ;(2) x x : VariableK Variable1

   by putting 〈 , , 〉 〈 , , 〉 ,and 〈 , , 〉 〈 , , 〈 〉〉,where 2 X a = 2 X a 1 K s = 1 K xpp∈KjK  for the unique for which K . I leave it to the reader to check that (1) and xpy=s(y) y p=p  (2) are bijections, and x:X  x:X . Moreover, we have that the bijection (2) induces a bijection between and . Context1 ContextK

Let us return to the development started in this Appendix. A relation-symbol is an entity of the form 〈 3, X, a 〉 where X is a context; X is the arity of the relation-symbol R= 〈 3, X, a 〉 ; v RvX .Avocabulary is a set L of kinds and relation-symbols such that the set K of kinds in v is a pre-vocabulary, and if is a relation-symbol in , X , ∈X , then ∈ . L R L Rv x Kx K

Our comparison above of pre-vocabularies and simple categories of §1 clearly extends to an essential bijection between vocabularies as defined here, and DSV's of §1.

An atomic formula (in logic without equality) is any 〈 4, R, s 〉 where R is a

131 v relation-symbol, s is a specialization, and Rvdom(s) .

I leave the rest of the development of FOLDS in the style of this Appendix, and its comparison to the main body of the paper, to the reader.

132 Appendix B: A fibrational theory of L–equivalence

EECD Consider fibrations CP , DP , and the category Fib[C,D] of all maps BBCD M2 ECDA@E , CA@D CP { PD (1) M=(M12M ): :: BCA@BD M1 of fibrations; Fib[C,D] is a full subcategory of [C,D] ; see [M3]. Fib[C,D] is the total category of a fibration denoted Fib 〈 C,D 〉 ; its base-category is the functor-category [BCD,B ] , and the fiber over U:B CA@B Dhas objects all the M as in (1) with the fixed , and arrows as in 〈 C,D 〉 defined in [M3]; the fiber of 〈 C D 〉 over is a full U=M1 Fib , U subcategory of the fiber of 〈 C,D 〉 over U .Given (f:UA@V)∈[BCD, B ] ,and N:CA@D h=θ over V , the Cartesian arrow M=f*(N)A@f N is obtained by the stipulation that for all h ∈ , ∈CAX, A@ is a Cartesian arrow over A@ ; the definition A BC X M(X) X fA:U(A) V(A) of M on arrows is the obvious one; see also below. The fact that M so defined is a map of fibrations is shown by the diagram:

Mθ MXGA@q MYG h h Y X g Nθ h NX A@q NY GA@ G UA Uq UB f f B A gA@ h VA Vq VB .

Here, θ A@ is a Cartesian arrow over A@ ; the issue is to show that θ is qq:X Y q:A B M Cartesian (over ). The definition of on arrows makes θ an arrow over making Uq M M q Uq the upper quadrangle commute (unique such θ exists by being Cartesian). As a M qYh composite of Cartesian arrows, θ v is Cartesian; as a left factor of the last, θ is (N qX) h M q Cartesian.

In what follows, the base categories BCD, B will have finite limits. Fiblex 〈 C,D 〉 is the

133 subfibration of Fib 〈 C,D 〉 with base-category Lex(BCD,B ) , a full subcategory of [BCD,B ] , with fibers unchanged from Fib 〈 C,D 〉 .

Next, assume that C and D are U∃-fibrations. We have the prefibration U∃- 〈 C, D 〉 , with base category Lex(BCD,B ) , and total category U∃(C,D) . The fiber over U∈Lex(B CD,B ) is the full subcategory of the fiber of Fiblex 〈 C,D 〉 over U with objects the maps of U∃-fibrations M:CA@D . U∃- 〈 C, D 〉 is not a fibration; however, for certain maps f:UA@V , f*(N) calculated in Fiblex 〈 C,D 〉 does belong to U∃- 〈 C,D 〉 , as we proceed to point out (from which it will of course follow that over such f , Cartesian arrows do exist in U∃- 〈 C,D 〉 ).

Assume that D is a U∃-fibration, with QDD= Arr(B ) . Let us call q∈Arr(B D) surjective if ∃ .If is surjective, then for any ∈DB , ∃ **∃ U qAt = t Bq Y qqY= q(t AqY) ∃ U (where the second equality is Frobenius reciprocity). It is clear that a pullback = qAt Y = Y of a surjective arrow is surjective, and the composite of two surjective arrows is surjective. It is also clear that if qr is surjective, then so is q .

Let us call a commutative square in BD

AA@g B OO ab (1') A@ A’ g’ B’ a quasi-pullback if the canonical arrow A@ × is surjective. p:A’ A BB’=P

Using the stated properties of surjective maps, we easily see that if in the quasi-pullback (1'), g is surjective, then so is g’ .

Consider two adjoining squares and their composite:

AA@BA@CAA@C OOOOO 1 2 3 (1") A’A@B’A@C’ A’A@C’

134 (2) The "composite" of two quasi-pullbacks is again a quasi-pullback: if both 1 and 2 are quasi-pullbacks, then so is 3 .

The verification uses both the pullback and composition properties of surjective arrows noted above.

(3) In (1"), if 3 is a quasi-pullback, 2 is a pullback, and 1 commmutes, then 1 is a quasi-pullback.

(3') If in the commutative diagram

A A@ B O _   O _    l  l A A@B A’A@ B’ OO _   _     l  l A’A@B’

  the two quadrangles AA’AA’ and BB’BB’ are pullbacks, and the square AA’BB’ is a   quasi-pullback, then AA’BB’ is a quasi-pullback too.

This follows from (2) and (3).

(3") If in (1"), 3 is a quasi-pullback, and AB is surjective, then 2 is a quasi-pullback.

To see this, let × for ,and × for . We have the commutative diagram P=B CCC’ 2 R=A C’ 3

135 AA@BA@C OOO W W RA@PA@C’ OO)  A’A@B’

with two pullbacks as indicated. Since AB is surjective, so is RP . The assumption gives that A’R is surjective. Now, the composite A’P is surjective, and so is its left factor B’P , which is what we want.

(4) The Beck-Chevalley condition for ∃ holds (not just with pullback squares, but also) with quasi-pullback squares.

Indeed, consider the diagram

g AG@s B O r O F a PG b p B s L h A@ , A’ g’ B’ and calculate: ∃ ******∃∃ ∃∃ ∃ ∃ ; the third equality g’aX= spaX= spqrX= srX= b gX is the "quasi-pullback" property, the last ordinary B-C .

Let us continue to assume that D is a "full" U∃-fibration ( QD contains all arrows), let C be an arbitrary U∃-fibration, (q:AA@B)∈BCCD. We call a map (f:UA@V)∈Lex(B ,B ) very surjective with respect to q if the square

GA@ G UA Uq UB f f B A gA@ h VA Vq VB is a quasi-pullback. (The concept of "very surjective" is relative to the fibration D , although it does not depend on the fibration C except for its base-category.)

136 (5) If f is very surjective with respect to an arrow q ,thensoitiswithrespectto any pullback of q ;if f is very surjective with respect to a pair composable arrows, then so it is with respect to their composite.

This follows by (3) and (2).

We say that f is very surjective if it is very surjective with respect to every q∈QC ;by(5),it is enough to require the condition for a "generating set" of q's .

(6) The composite of very surjective arrows (in Lex(BCD,B ) ) is very surjective; the pullback of a very surjective arrow is very surjective.

This follows by using (2) and (3).

op Let K be a simple category, B = Con(K) ; Lex(B,BD) can be identified with Fun(K,BD) ; this is the kind of base-category for the fibrations we are interested in. In §4, we made two different choices for the class Q of quantifiable arrows in B . The choice for the purposes of the main body of §5 is Q≠ ; this, in the version that is closed under = composition, is simply the class of epimorphisms of B . When we make the choice of Q for Q , we get as the very surjective maps in the sense of this section the ones we called normal ones in §5; we leave it to the reader to verify this.

≠ (6') Let (f:UA@V)∈Fun(K,BD) be very surjective (with respect to Q ). For every finite context X over , X A@ X is surjective. For any ∈ , K f[X]:U[ ] V[ ] K K A@ is surjective. fK:U(K) V(K)

The first assertion is shown by induction on the cardinality of X .If X is of positive size, we ⋅ can write X as Y∪{x} such that Y is a context too. By the paragraph after (4) in §4, for , we have a pushout diagram K=Kx

137 X A@X* KK PP YA@X in ,which,with V X , U X* , gives rise to Con(K) = KK=

U[V]A@V[V] _  _  O   O   1  j  j U[Y]A@V[Y] U[U]A@ V[U] _   _   O 2 O   j   j U[X]A@V[X] to which (3') is applicable. The square 1 is a quasi-pullback (by f being very surjective), hence, so is 2 . Since by the induction hypothesis, U[Y]A@V[Y] is surjective, so is U[X]A@V[X] .

The second assertion follows immediately from the first by the quasi-pullback

πU U(K)A@K U[K] f f KPP[K] V(K)A@V[K] ; πU K

note that X , etc. U[K]=U[ K]

Assume now that C and D are UV∃-fibrations, D a "full" one.

(7) If f:UA@V is very surjective, and N∈UV∃(C, D) ,the M=f*(N) calculated in Fib(C,D) is in fact in UV∃(C, D) .

138 * First of all, using that for each g∈Arr(BD) , g is a morphism of lattices, we immediately see that M preserves the fiberwise operations.

Consider

MXG M∃ X θ q θ fA fB g g NX N∃ X GA@ G q UA Uq UB f f B A gA@ h VA Vq VB

∃ **∃ ∃ ∃ *∃ ; M qBqBNqMqAMqX = fN X = f NX = fNX= MX

here, the first equality is the definition of M ; the second the quality of N being a morphism of ∃-fibrations; the third f being very surjective; and the last again the definition of M .

Now, assume in addition that both C and D are UV∃∀-fibrations, again with QDD= Arr(B ) . I claim that

(8) If f:UA@V is very surjective, then N ∈ UV∃∀(C, D) implies that * UV C D M =f (N) ∈ ∃∀( , ) .

The additional fiber-wise operation, Heyting implication, is dealt with as before. Let

A@ ∈Q , ∈CAUB;wewanttoshowthat ∀ ∀ ;thatis,forany Φ∈D , (q:A B) C X M qMqX = MX Φ ≤ ∀  *Φ ≤ . The left-to-right implication is automatic. Assume UBM qX (Uq) UA MX

*Φ ≤ ,(9) (Uq) UA MX and consider

139 **Φ≤ Φ (Uq) MX=fUXA ? (Vq)(* ∃ Φ)≤NX ∃ Φ ffBB GA@ G UA Uq UB f f B A gA@ h VA Vq VB .

As indicated, we consider the object ∃ Φ over VB , and claim that the inequality marked ? fB is true.

** (Vq)(∃ Φ)=∃ (Uq) Φ (10) ffBA by the (generalized) B-C property for ∃ with quasi-pullbacks. (9) implies that

∃ (Uq)**Φ ≤∃MX = ∃ fNX≤ NX . (11) fUAffAAAA

(10) and (11) imply what we wanted. Now, from this, ∃ Φ ≤ ∀ NX = N(∀ X) ,and fVqqB Φ ≤ f**∃ Φ ≤ fN(∀ X)=M(∀ X) as desired. BfB B q q

M, N ∈ UV∃∀(C, D) are said to be equivalent, MN , if there is a diagram

G m DP n Wh  MN such that , are Cartesian in C, D ,and A@ , A@ are m n Fiblex( ) m111111:P M n :P N very surjective. Equivalence is clearly reflexive and symmetric; it is transitive too; given

G G m tQ nn’ tR p W gW g   MNP

140 with the relevant properties, one forms the pullback

G q S1 r1 1 h GW Q1 nn’ tR1 g11 W  N1 in , and defines as * ,for ;let A@ Lex(BCD,B ) S (n1") (N 1) n 11111"=nq=n’r n":S N be the Cartesian arrow over . Then being Cartesian implies that there is a (unique) n1" n q over such that ; similarly for over .Since is Cartesian, so are q11nq=n" r r n" q and .Since , are pullbacks of very surjective arrows, they are very surjective. We r q11r conclude that mq and pr are Cartesian arrows over very surjective ones, which proves what we want.

Let us take T=(L, ∅) , the "empty theory" over the DSV L , and let C=[T] ,a UV∃∀-fibration with base-category B = (Con[K])op and class of quantifiable arrows Q=Q≠ . Recall the canonical A@ induced by Yoneda. ,andwe i:K B ModCC (T) = Str (L) have the fibration E A@ K as explained in §5. We also have the fibration :ModC (T) C

D = Fiblex 〈 C,P(C) 〉 : Fiblex[C,P(C)]A@Lex(B,C) .

We have a "forgetful" morphism --DA@E ; is the equivalence () : ()1

J U @ Uvi : Lex(B,C)A@CK ; and --is defined as @ was defined in §4 (see (5)) for the special case when ()2 P P ∈ C ⊂ C P .Itiseasytoverifythat - is a morphism of P ModP(C) ( ) Fiblex[ , (C)] () fibrations.

We have the quasi-inverse

J U @[U]:CKA@Lex(B,C) (12)

141 specified so that X X ; we have the canonical isomorphism - ≅ [U]([ ]) = U[ ] jU:[U] U natural in U . ()- :DA@E restricts to an equivalence

- isoC A@ iso , (13) () : ModP(C) ( ) ModC (T) whose quasi-inverse is

@ isoA@ iso C ⊂ C P M [M] : ModC (T) ModP(C) ( ) Fiblex[ , (C)] constructed in §4 , with the canonical isomorphism - ≅ natural in . These are jM:[M] M M connected to (12) by , . [M]=[1 M K] (jM)=1 jMK

Let us deduce (1)(b) of §5 from (8); let's use the notation and hypotheses of 5.(1)(b). Consider the following diagram in the fibration E :

θ f  ]MA@ -N jM    ≅≅  * * j [M]--A@[N] N [θ ]- f f  ]UA@ -V jU    ≅≅  * * j [U]--A@[V] V [f]-.

The two quadrangles commute, by the naturality of j . It follows that θ --A@ -is Cartesian over --A@ -Consider the Cartesian [ f]:[M] [N] [f]:[U] [V]. arrow θ *-A@ over A@ in D .Since is a morphism [f]:[f][N] [N] [f]:[U] [V] () of fibrations,

θ -*--A@ ( [f]) :([f][N]) [N] is Cartesian over the same [f]:[--U] A@[V] -. It follows that there is an isomorphism

142 *-A@≅ over . But then, since (13) is full and faithful, it follows that ([f][N]) M 1-[U] [f][* N]=M . Hence,

** * M[X:ϕ]=([f][N])[X:ϕ]=fXX([N][X:ϕ]) = f (N[X:ϕ]) ,

where the second equality is the description of Cartesian arrows in D , the last is the definition of [N] ; and this is what was to be proved.

Continuing in this manner, we see that, for , ∈ ,  in the sense of §4 iff M N ModCL (T) M N [M][N] in the sense of this Appendix.

143 Appendix C: More on L–equivalence and equality.

Ordinary multisorted first-order logic without equality and without operation symbols (only relations are allowed) is a special case of FOLDS as follows. Let L be a multisorted, purely relational vocabulary. We associate a DSV L with L . The kinds of L are the sorts of L ; the relations of L are the relation symbols of L .For R is sorted " R ⊂ & X " , we have i

L just constructed is a very simple DSV; its category of kinds has height 1 .

Now, a natural notion of "isomorphism" for L-structures "without equality" is the ordinary notion of isomorphism modified by dropping single-valuedness and 1-1-ness. Let M , N be  -structures. By definition,  means a family of relations A@ L h:M LXN h :MX NX ( X∈Sort(L) ) such that dom(h )=MX , range(h )=NX , and for any " R⊂ & X "in XXi

The last-mentioned notion of "relational isomorphism" coincides with the relational version of L-equivalence, for L the DSV constructed for L as above, defined as follows. For a general DSV , we call the -equivalence , ,  relational if and are jointly L L (W m n):M L N m n monomorphic; we indicate the said quality by the letter in , , r . This r (W m n):M L N means that for every kind in , the pair , of functions is jointly monomorphic, K L (mKKn ) mn that is, the MKMNKKWKA@NK is a relation.

144 For simplicity, we deal with Set-valued structures in what follows. Suppose , , r . For each kind , define the relation ρ ⊂ × by (W m n):M L N K K MK NK  ρ  ∃ ∈ U .ForX a finite context, 〈 〉 ∈ X , a KKKb c WK.mc=a nc=b a= a xx∈X M[ ]     〈 〉 ∈ X , we write ρ  ∃ ∈ U . It turns out however b= bxx∈XXN[ ] a b c W[K].mc=a nc=b   that aρXb  ∀x∈X.a ρ b . Indeed, the left-to-right direction is obvious. Conversely, xKx x  let such that U . I claim that .For c ∈WK mc=a nc=b c= 〈 c 〉 ∈X∈W[K] xx KxxxxK xx xx this, we need that if ∈X , ∈ j , then y p Ky K

c =(Wp)(c ) .(1) xy, p y

But m(Wp)(c )= (Mp)(mc )=(Mp)(a )=a , and similarly n(Wp)(c )=b ; yyyxy, pyy x , p since c=c ∈WK is uniquely determined by the property m(c)=a & xxy, py, py x, p n(c)=b , (1) follows. xy, p

As a consequence, a relational equivalence can be described in terms of the relations ρ as K follows. A relational equivalence ρ r is a family ρ 〈 ρ 〉 of relations :M L N = KK∈K ρ ⊂ × such that, with K MK NK

  aρXb  ∀x∈X.a ρ b ,(2) def x Kx x

the following hold:

(3) For any A@ , ∈ , ∈ p:K Kp a MK b NK aρ b  (Mp)(a)ρ (Np)(b) . K Kp

  (4) For any ∈ , ∈ X , ∈ X , K K a M[K]=M[ KK] b N[K]=N[ ]       aρ b & a∈MK(a)  ∃b∈NK(b). aaρ bb . X X* K K     aρ b & b∈NK(b)  ∃a∈MK(a). aaρ bb . X X* K K

145 (5) For any relation in ,and ∈ X , ∈ X , R L a M[R]=M[ RR] b N[R]=N[ ] aρX b  ( a∈MR  b∈NR ). R

(the notations X , X* , X are from §4; aa denotes 〈 d 〉 ∈M[X*] for which KKR x∈X* K x K d =a when x∈X ,and d =a ). xx K xK

By what we said above, every , , rrgives rise to a ρ  ((3) is (W m n):M LLN :M N naturality, (4) is the very surjective condition, (5) is the preservation of relations). Conversely,

given ρ r , putting 〈 , , 〉 ρ , 〈 , , 〉 , :M L N WK={ K a b : a KKb} m ( K a b )=a 〈 , , 〉 gives , , r . nK( K a b )=b (W m n):M L N

We can make some steps towards Infinitary First Order Logic with Dependent Types. (We refer to [Ba] as a basic reference on infinitary logic and back-and-forth systems.) Let us fix the DSV as before. The syntax of the logic of FOLDS over with arbitrary (set) size L L∞, ω L conjunction and disjunction, and finite quantification should be obvious; as usual, we only allow formulas that have finitely many free variables. To fix ideas, we consider logic without equality. M ≡ N means that M and N satisfy the same L , -sentences without L∞, ω ∞ ω equality. We have the following "back-and-forth" characterization of the relation ≡ .A L∞, ω r weak relational L-equivalence ρ:MN is a system ρ= 〈 ρXX〉 of relations L∞, ω ρX⊂M[X]×N[X] , indexed by all finite contexts, satisfying the following conditions (6)-(9):

(6) for any specialization s:XA@Y , a∈M[Y] , b∈N[Y] , aρYXb  (avs)ρ (bvs) ;

here, if 〈 〉 , then v 〈 〉 . a= ayy∈Y a s= as(x) x∈X

(7) holds. ∅ρ∅∅

⋅ (8) For any finite contexts X , X∪{x} , a∈M[X] , b∈N[X] ,

146 ρ ∈  ∃ ∈ ρ ⋅ , a XXb & a MK(a) b NK(b).aa ∪{x}bb ρ ∈  ∃ ∈ ρ ⋅ a XXb & b NK(b) a MK(a).aa ∪{x}bb .

(9) = (5)

 r We say that M and N are weakly L-equivalent, M , N ,ifthereis ρ:M N . L w L∞, ω

Given ρ:MrrN , then, with making the definitions as in (2), we also have ρ:MN . LL∞, ω The reader will see that in the case of ordinary multisorted logic, the definition of weak relational L-equivalence reduces to the well-known concept of "back-and-forth system" that figures in the characterization of ∞,ω-equivalence. Thus, the following generalizes that characterization.

 (10)(a) For L-structures M and N , M ≡ N iff M , N . LL∞, ω w (b) For countable L-structures M and N , M ≡ N iff M  N . LL∞, ω (c) For any countable L , and countable L-structure M , there is a ("Scott"-)sentence of such that iff . σ Lω , ω N ≡ M N σ M 1 L∞, ω M

The proofs are routine variants of those of the classical cases.

There is a simple categorical restatement of the notion of weak L-equivalence. Consider K op as before. An -pseudo-structure is a functor A@ , together with a B=(Set )fin L P B Set subset P(R)⊂P([X]) for each relation R of L . A morphism of L-pseudo-structures is a natural transformation of functors BA@Set preserving each R in the obvious sense. Each L-structure M can be regarded as a pseudo-structure, since any functor KA@Set has a canonical extension BA@Set which is in fact finite-limit preserving. Let PStr(L) be the category of pseudo-structures. We have a forgetful functor E’:PStr(L)A@SetB ; E’ can be seen to be a fibration. Now, a (not-necessarily-relational) weak L-equivalence , ,  is, by definition, a functor ∈ B , together with arrows (W m n):M L, w N W Set m:WA@E’M , n:WA@E’N such that m , n are very surjective with respect to all epimorphisms in B (according to the definition before B.(5), with Lex(BCD,B ) replaced

147 by B ), and there is a pseudo-structure , with Cartesian arrows θ A@ , θ A@ Set P mn:P M :P N over and , respectively. We write  for: there exists , ,  . m n M L, w N (W m n):M L, w N

It is not hard to show that  iff there is a weak relational -equivalence M L, w N L ρ:Mr N ; the proof is similar to the proof below concerning non-weak relational L∞, ω equivalences.

We return to ordinary (non-weak) equivalences. When M and N are Set-valued -structures, with any , ,  , there is a relational , , r ;in L (W m n):M LLN (W’ m’ n’):M N fact, W’ can be chosen as a of W , with m’ and n’ being restrictions of m and n , respectively. To define W’K⊂WK ,weuserecursiononthelevelof K .Fix K .The induction hypothesis gives us the inclusion W’[K]x@W[K] . Consider the pullback × as in P=WK W[K]W’[K]

m Px@iKWKA@MK  W  PPP W’[K]x@W[K]A@M[K] , with an inclusion; look at 〈 , 〉 A@ × , and, using the Axiom of i g= miKKni:P MK NK Choice, split h:PA$Im(g) by an inclusion k:W’Kx@P as in

PGMNW’K  g {  D  W ≅ g { DIm(g) P W MK×NK ;

we have defined W’K . Inspection shows that W’ is appropriate.

For not necessarily -valued -structures , , let us write  for: there exists Set L M N M L, r N , , r . (W m n):M L N

What we saw says that the concept  remains unchanged, at least for -valued M LN Set models, if we ignore all but the relational L-equivalences:

148    . (11) M LLN M , r N

 However, the more general notion ,  , goes wrong under the same alteration. (M a) L(N b) For one thing, the need for not-necessarily-relational L-equivalences is natural if we look at  the proof of 5.(4). Given X and the tuples a∈M[X] , b∈N[X] as there, the desired  -equivalence , , ,  , is constructed so as to continue the mappings L (W m n):(M a) L (N b) @ , @ ; if the latter two mappings are not jointly monomorphic, the resulting x axxx b L-equivalence will not be relational. On the other hand, the entry of non-relational L-equivalences is not just a of the proof of 5.(4); it is in fact unavoidable.

Consider the following example of a DSV, called L :

e A@10 EK1 A@ 1 e11  ppe=pe e P 10 11 A@00 EK0 A@ 0. e01

A standard structure for is one for which, for , ∈ ,thatis, M L b01b M[K 1] ,wehave  , and also, is ordinary equality (Mp)b01=(Mp)b b 01101(ME )b b =b ME 0 on . Consider the following example for an -equivalence , ,  ,for MK0 L (W m n):M L N certain M and N :

  j zz01j  yy 01 jj  jj    bb01dd 01  jj      xx01     ac    .

Here, , , , , , , , , MK01010101001={a} MK ={b b } NK ={c} MK ={d d } WK ={x x }

149 , , , , , @Wp, ,  Wp@ ,and WK1={y 0101y z z } y 00z x 0y 11z x 1

@mmmm, @ , @ , @ , y00110110b y b z b z b

@nnnn, @ , @ , @ ; y00100111d y d z d z d

and are interpreted in and as equality. E01E M N

This shows that, for the context X , ; ; , and for ={x010010x :K y :K (x ) y 111:K (x )}  〈 , , , 〉 , 〈 , , , 〉 ,wehave a= a/x0a/x 10011b /y b /y c= c/x 0c/x 10001d /y d /y  ,  , . On the other hand, there is no relational equivalence (M a) L(N c)  , , ,  , .Inanysuch, is a singleton ; @m’ , (W’ m’ n’):(M a) L (N c) W’K0 {x} x a n@’ ;wehavesome , ∈ such that m@’ , @m’ ; and the x c u01u W’K 1(x) u 0b 0u 1b 1 preservation of implies ≠ , contradiction. E101n’(u ) n’(u )

This example also dispels the possible belief that an -equivalence , ,  can L (W m n):M L N always be reduced to a relational one by taking the image of (W, m, n) .Let U=MK , V=NK , and consider

W   m r n +Pk   MN A@ (12) Ui ϕ Φ ψ )V    π Pi  π’ U×V

where r and i form the surjective/injective factorization of 〈 m, n 〉 :WA@U×V .Inother words, when i:ΦA@U×V is an inclusion, for any K∈K , the relation ΦK⊂MK×NK is given by a(ΦK)b  ∃c∈WK.mc=a&nc=b . When applied in our example, (Φ, ϕ, ψ) so defined does not preserve . E1

I now turn to some remarks on equality.

Let L be an arbitrary DSV. Let us augment L to LG , another DSV, by adding a relation

150

to for every ∈ , with proper arrows A@ , A@ , GKKL K Kind(L) g 0:GKKK g 1:GK K

together with all composites A@ , ∈  , .Wedonot identify pgKi:G KK pp K L (i=0 1) pg K0 with .Foran G-structure , pgK1 L M

     , , , , ∈ , ∈ , ∈ M[G]={(K a a b b): a b M[K] a MK(a) b MK(b)} .

The letter G is used because we are dealing with global equality as opposed to fiberwise   equality (see below). A standard LG-structure M is one in which, for a, b∈M[K],     ∈ , ∈ , , , , ∈ iff ; more briefly, as a subset a MK(a) b MK(b) (a a b b) M(GKK ) a=b M(G ) of MK×MK is {(a, a):M(K)} .Any L-structure can be made into a standard LG-structure in exactly one way. When an L-structure is used as an LG-structure, we mean the corresponding standard LG-structure.

The effect of adding global equalities is that all L-equivalences can be canonically replaced by relational ones, by taking the image of the given one. If (W, m, n):MN ,thenfor LG (Φ, ϕ, ψ) defined above, we have (Φ, ϕ, ψ):Mr N . G L

To see this, first we show that the arrow r in (12) is very surjective; that is, for any K∈K , the diagram

r W(K)A@K Φ(K)   (13) PP W[K]A@Φ(K) r[K]

    is a quasi-pullback. Assume a∈M[K] , b∈N[K] , a∈MK(a) , b∈NK(b) such that      (a, b)∈Φ[K] , (a, b)∈ΦK(a, b) ,and c∈W[K] with mc=a , nc=b (that is,   , ); we want ∈ such that and . By the definition of r[K](c)=(a b) c WK(c) mc=a nc=b  Φ ,thereis d∈WK with md=a , nd=b . By the very surjectivity of n ,thereis c∈WK(c)

151 such that . But by the presence of the relation , iff ; nc=b GKKmd(MG)mc nd(NG) Knc that is, md=mc iff nd=nc ; which says that mc=a as desired.

By B.(6'), the induced map X A@Φ X is surjective. r[X]:W[ ] [ ]

Now, looking at

r ϕ m W[K]A@[K][Φ[K]A@K][M[K] W[K]A@K] M[K] OOOO O A@ A@ A@ W(K) Φ(K) ϕ M(K) W(K) M(K) rKKm K we see that B.(3") is applicable to yield that ϕ is very surjective.

  Given a relation ∈ G ,if , ∈Φ ,thenby A@Φ being R Rel(L ) (a b) [R] r[R]:W[R] [R]    surjective, there is ∈ with , ,thatis, , , and thus c W[R] r[R](c)=(a b) mc=a nc=b   a∈MR iff b∈NR . This completes showing that (Φ, ϕ, ψ):Mr N . LG

We have shown something more general (and more technical), which is independent of equality. This is that

(14) If , ,  and we have (W m n):M L N

W   m r n +Pk { {  MN A@ U ϕ Φ ψ V

such that is very surjective, then Φ, ϕ, ψ  ; r ( ):M L N

the relational quality of (ϕ, ψ) is not relevant to this.

Clearly, a relational equivalence preserving global equalities on all kinds is nothing but an

152 isomorphism. We have shown that M N implies that M≅N ,and (M, a) (N, b) LLGG implies (M, a)≅(N, b) . But, all formulas in multisorted logic over QLR are preserved by isomorphism. By the invariance theorem 5.(12), we conclude the following.

(15) For any context X over L ,andanyformula σ of multisorted logic over QLR with σ ⊂X [remember, a variable of FOLDS counts as a variable of sort in Var( ) x:X Kx multisorted logic], there is a FOLDS formula θ over LG with Var(θ)⊂X such that σ and θ* are logically equivalent (over X ):

∀X(σθ**) ;orinotherwords, M[X:σ]=M[X:θ ] for any L-structure M .(We apply 5.(12) to I:LGA@[(QLR,Σ[L])] ;for Σ[L] ,see§1.I is essentially the identity except that all the 's are interpreted as equality. In X θ* , is understood as a GK M[ : ] M standard LG-structure.)

Notice the small point that in the statement of (15), we are not allowed to start with a QLR-formula σ with arbitrary free variables; the free variables have to form a context. E.g., in the case of the language of categories, a formula with a single arrow-variable cannot (of course) have an equivalent in FOLDS with the same free variables;wehavetoaddthe "domain and the codomain of the arrow-variable" as free variables.

Let us hasten to add that it is possible to show (15) directly, by a rather simple structural induction on the formula σ .

We have an instance of what we may call expressive completeness of FOLDS: full first-order

logic over QLR can be expressed in LG . This is accompanied by a mode of deductive completeness. We will give a deductive system for entailments over LG , extending the standard system for LG for logic without equality by specific rules related to the G-predicates, which is complete for semantics restricted to standard LG-structures, that is, semantics of true equality.

153 The set j , the arity of the relation , is the set GKKL G

∈ j ∪ ∪ ∈ j ∪ {pg:K0 p K L} {gK0 } {pg:K1 p K L} {gK1 }

Accordingly, we will write atomic formulas , indexed by j ,intheform G(KKz) z G L , , , ; here, , , , . G(x x y y) x= 〈 x 〉 ∈ j x:K(x) y= 〈 y 〉 ∈ j y:K(y) KpgK0 p K L pgK0 p K L

Here are some other pieces of notation. For any object A of L (kind or relation), and tuples 〈 〉 , 〈 〉 for which , (types or atomic formulas) are x= xpp∈AjL y= ypp∈AjL A(x) A(y) well-formed, denotes the formula xG[A]y

,.0 , , , . G(〈 x 〉 ∈ j x 〈 y 〉 ∈ j y ) p∈AjL Kppqp q K L pqpqK pL p

When , p . x= 〈 x 〉 ∈ j x = 〈 x 〉 ∈ j ppK L def qp q Kp L

V. Global-equality axioms.

(G )  1 t  G(x, x, x, x) X K

(G )  2 G(x, x, y, y)  G(y, y, x, x) KKX

(G )  3 G(x, x, y, y) U G(y, y, z, z)  G(x, x, z, z) KKX K

(G )  ( p∈KjL ) 4 G(x, x, y, y)  G(yp, y , xp, x ) KX Kpp

(G )  ( x:K(x) ) 5 xG y  ∃y:K(y).G (x, x, y, y) [K] X K

154 (G )    6 xG y  R(x)R(y) [R] X

The proof of the said completeness is done in the traditional manner; we use completeness for logic without equality over LG for the theory whose axioms are the (conclusion-)entailments in the equality rules. Given any structure M for LG satisfying the equality axioms, we construct a standard LGG-structure M/ which is L -elementary equivalent to M . For a kind ,let  be the relation on the set defined by   , , , K KKKMK a b MG([a] a [b] b) holds; here 〈 〉 , and similarly for .By and , [a]= (Mp)(a) p∈KjL [b] (G12 ), (G ) (G 3 ) each  is an equivalence relation; let us write  for the equivalence class containing K a/ . implies that if A@ , ∈ , ∈ , then   a (G4 ) f:K K’ aiiMK a’=(Mf)(a i) MK’ a1 Ka2  .Let .Wedefine  A@ by   a1’ K’2a’ U=M K U/ :K Set (U/ )(K)=(UK)/ (  ∈ ),and    , which is well-defined. def={a/ : a UK} ((U/ )(f))(a/ )=((Uf)(a))/

 For 〈 〉 ∈ , we put  〈  〉 ∈  . a= app∈RjK M[R] a/ = app/ ∈RjK (M/ )R

We define M/ by (M/)K=U/ ,and

    ; (M/ )R(a/ ) def MR(a)

 by (G6 ), this is well-defined; we have completed the definition of M/ .

 For any finite context X ,wehave  X X  (  ∈ X ). (M/ )[ ]=(M[ ])/ def={a/ : a M[ ]  Moreover, when ∈ , then    (  ∈ . a M[K] (M/ )K(a/ )=MK(a)/ def={a/ : a MK(a)} This is not automatic; it requires . Finally, we show, by structural induction, that for any (G5 )  θ over LG with Var(θ)⊂X ,and a∈M[X] ,

 M/ θ[a/]  M θ[a].

Having the construction M @ M/ with the properties shown, the proof of the standard completeness for LG can be completed in the expected manner.

155 In place of global equality, it seems natural to consider fiberwise equality for FOLDS. Let, for any DSV , E denote the DSV obtained by adding to a new relation for every L L L EK e A@K0 kind , with and ∈ j as for maximal kinds in eq .A K EKA@K pe=K0 pe(K1 p K K) L eK1 standard E-structure is one in which each is interpreted as equality; to give a standard L EK LE-structure is the same as to give an L-structure. In what follows, M and N are L-structures; when they figure as LE-structures, they mean the corresponding standard ones.

Suppose ρ:Mr N . I claim that each ρ ⊂MK×NK is the graph of a bijection MKA@NK . LE K By (6'), ρ ρ . Thus, it remains to show that dom( KK)=MK , codom( )=NK

∈ , ∈ , ρ ,   (16) aiMK b iNK a iKib (i=1 2) a12=a b 12=b

We show this by induction on the level of K . Assume the hypotheses of (16). Let     ∈ i , ∈ i . Then, if ii〈 〉 , ii〈 〉 , then aiiMK(a ) b NK(b ) a = a pp∈KjK b = bpp∈KjK aiiρ b (by (3)). pKp p

   Assume (e.g.) . Then 1 2 ,thatis, 12for all ∈ j .Bythe a1=a 2a =a def=a app=a p K K    induction hypothesis, (16) applied to ,wehave 12,thatis, 1 2 .We Kpppb =b b =b def=b     have a , a ∈MK(a) , b , b ∈NK(b) ,and aa ρ bb . Therefore, by (6), 12 12 i X* i K   , ,  , , ;thatis,  as desired. ME(K a a12a ) NE(K b b12b ) a 12=a b 12=b

Given that each ρ is a bijection, clearly, ρ is an isomorphism ρ A@≅ (of K :M N L-structures). We conclude

M  N  M ≅ N (17) LE,r

(the above argument did not depend essentially on the fact that we dealt with Set-valued structures)

156 Applying 5.(12), we obtain

(18) For every sentence σ in multisorted logic (with equality) over QLR there is a sentence

σ of FOLDS over LE such that for every L-structure M , Mσ  Mσ (here, in the first instance, M figures as an QLR-structure; in the second instance as a standard LE-structure).

Proof. Consider the interpretation EA@ ,where Q R, Σ , extending the I:L [T] T=( L L) "identity" interpretation A@ , and interpreting each as equality. We apply 5.(12) to L [T] EK I , X=∅ and σ . Suppose M, NT are Set-valued models (!),

MLEE NL (19) LE and Mσ . M and N are L-structures, and MLEE, NL are the corresponding standard LE-structures. By (19) and (11), it follows that M≅N . Since "everything" is invariant under isomorphism, Nσ . Thus, the hypothesis of 5.(12) holds. The conclusion is exactly what we want.

Note that the result of (18) cannot be generalized to formulas with free variables in place of

sentences. That is, the statement of (15), with LEGreplacing L is not true. This is shown by the example that we gave above; in that example, E for consisting of , and L=L00L K 01K (and no relations). With X , , , as in the example, if for the formula p ={x0101x y y } σ≡ (whose free variables are in X ) there were θ in FOLDS over with y01=y L θ ⊂X such that, for every -structure (also counted as a standard -structure) and Var( ) L0 M L

 〈 , ∈ ; ∈ ; ∈ 〉 , a= a01a MK 00b MK 10(a ) b 1MK 11(a )

  σ  ? θ M (a) b01=b M (a)

 then for every equivalence , , ,  , ,where (W m n):(M a) L (N c)

157 〈 , ∈ ; ∈ ; ∈ 〉 , c= c01c NK 00d NK 10(c ) d 1NK 11(c ) since it would preserve θ ,wewouldhave

 ; b01=b d 01=d

but the example shows that this conclusion is false.

(18) can be used to give another proof of 6.(3), the Freyd-Blanc characterization result, at least for X=∅ ; this proof is a variant of what is contained in [FS].

Let T be a normal theory of categories with additional structure. Assume σ is an -sentence such that for , , Q RJQ R implies that σ iff σ .Inparticular, LT M N T M N M N

for M, NT , QMR≅QNR implies that Mσ iff Nσ .

By ordinary (a version of Beth definability), it follows that there is a sentence τ in multisorted logic over Q R such that for models of , σ and τ are equivalent. By Lcat T (18), there is a sentence ψ in FOLDS over E which is equivalent to σ in all Lcat -structures (also counted as standard E -structures). There are two -predicates in LcatL cat E ψ , and . Replace each occurrence , of by the formula EOAE E( OX Y) E O

"X≅Y" ≡∃f∈A(X, Y).∃g∈A(Y, X).∃h∈A(X, X).∃i∈A(Y, Y) (I(h)UI(i)UT(f, g, h)UT(g, f, i)) ; call the result θ . Notice that θ is a FOLDS formula of eq (it has only the allowable Lcat equality predicates in eq ). I claim that for all  , Lcat M T

Mσ  Mθ .

Let  Q R is a category; let Q R be its skeleton. Since Q RJQ R ,bythe M T . M M ssM M normality of ,thereis  such that Q R Q R .Now T N T N = M s

158 Mσ  Nσ since QMRJQNR ,and M, NT  Nτ since NT  QNRτ  QNRψ  QNRθ since QNR is skeletal (that is, for objects X, Y, X=Y iff X≅Y )  QMRθ since QMRJQNR ,and θ is a FOLDS formula with equality over Lcat  Mθ .

This method of proof is also applicable to the "higher" cases. Let us consider the case of bicategories; let us show that if a sentence σ in multisorted logic over Q R is invariant under equivalence of bicategories, then σ is equivalent L=bicatL anabicat in bicategories to θ**for a FOLDS sentence θ over ; θ is the translate of Lanabicat θ such that Aθ*#A θ .

A bicategory A is skeletal if any two equivalent objects are equal, and any two isomorphic parallel 1-cells are equal. For any bicategory A , there is a skeletal one, A ,whichis s (bi)equivalent to A .

The first step is to use Beth definability to the interpretation Φ A@ . :Lanabicat[T bicat ] Since A##≅B implies that AJB , it follows that there is a sentence τ in multisorted logic over Q R such that for every bicategory A Aσ  A#τ .By(18),wecan Lanabicat , find a sentence ψ in FOLDS over E##such that, in particular, A τ  A ψ . Lanabicat Now, transform ψ in the following way. Each occurrence E(X, Y) of E is replaced CC00 by the formula

" XJY " ≡ ...

A@f and each occurrence E(XYA@ ) of E is replaced by the formula C1 g C1

" f≅g " ≡ ...

159 The resulting sentence θ is in eq . I claim that for any bicategory A , Lanabicat Aσ  Aθ* . Indeed,

Aσ  A σ  A ####*τ  A ψ  A θ  A θ  Aθ ; ssss( ) ( ) ( ) the next-to-last last biconditional holds because A JA ,ofwhich (A )## A sseqL is a consequence, and because θ is a FOLDS sentence over eq . ( L = Lanabicat ) L

This proof replaces the general invariance theorem 5.(12) by Beth definability, and a special case of that invariance theorem, (18). It falls somewhat short of the results of §7, partly because we have confined the situation to an empty context X . Also, this approach is not available in constructive category theory; the existence of the skeleton (already in the classical case of mere categories) depends on the Axiom of Choice. As we will see in Appendix E, the main theory of equivalence of §5 has a constructive version involving intuitionistic logic. Modifying the notions of equivalence to notions of "anaequivalence" (using, and building on, [M2]), we obtain versions of the results of sections 6 and 7 for constructive category theory.

160 Appendix D: Calculations for §7.

D1. Define the generalized DS vocabulary as the full subcategory of L2-catL anabicat

on the objects of , with relations ;itisgeneralized since a L2-catI 1 ,I 2 ,T 1 ,H,T 2 non-maximal object, , is also made into a relation. Accordingly, an -structure is a T1L 2-cat functor from in which the listed relations (including ) are interpreted L2-catT 1 relationally. This is the picture for : L2-cat

h MN0 THMN 1 h   1   t10t11th12 2h3h4     c PP P c PP P t20 MN10 MN 20 MN CC CtT 0 MN 1 MN 2212MN cc11 O 21 O t 22

II12

A 2-category-sketch (2-cat-sketch) is, by definition, a structure of type ;mapsof L2-cat 2-cat-sketches are natural transformations of functors. For a 2-cat-sketch S , QSR is its underlying 2-graph, its reduct to

cc MN10 MN 20 CC0 MN 1 MN C.2 cc11 21

Any bicategory has an underlying 2-cat-sketch. We will look at maps SA@A , S∈2-catSk , A a bicategory.

A@M Let SA@A .Atransformation τ:MA@N is given by N

(i) τ A@ for each ∈ ; X:MX NX X S(C0 )

(ii) for each A@ ∈ , τ vτ A@≅ τ v as in (f:X Y) S(C1 ) fXY:Nf Mf

161 τ MXA@X NX τ Mf Wft Nf P ≅ P A@ MY τ NY Y such that

A@f (a) for any XA@ϕP Y in S , g τ vτ A@f τ v Nf XYMf Nϕvτ { τ vMϕ ; XPPY v A@ v Ng τ τ τ Mg X g Y

(b) A@  ;and (f:X Y)∈S(I ) τ =1τ 1 f X

f %BE g Lh  (c) for every A@ ∈ (note that , ), A h C S(T1 ) MgMf=Mh NgNf=Nh

MAA@MfMBA@ MgMC MAA@ Mh MC τ τ τ f  τ g  τ = τ ττ APPPPWP W B W C A h  C A@NfA@ Ng A@ , NA NB NC NA Nh NC that is,

τ Mf τ A@g τ MNα τ ( CBBMg)Mf (Ng )Mf Ng( Mf) O α { τ Ng P f A@ MN τ (MgMf) τ (NgNf)τ α Ng(Nfτ ). C h A A

A@MM A@Φ Given P X and A@ ,wehave P X for which SA@τ Φ:T S T A@τΦ (τΦ)=τΦ NNΦ f f for ∈ . f T(C1 )

162 D2. Going back to the definition of R in part (B) of the proof of 7.5, T1 and using the notation there, that definition can be put as follows. Consider the 2-cat-sketch : S0

BA@g C O % B f gf  ( S01 (T )={(f,g,gf)} , LL  i A S (C )={a,a-1 ,1 ,1 } ) ≅ 02 igf a: gfA@i ,

A@Φ and the two diagrams S A@A defined as 0 Ψ

FYA@FgFZ BA@ g C O % B O  % B Φ = Ff FgFf  Ψ = f gf   LL  Fi  LL  i FX ; A .   Φ A@≅ Ψ A@≅ a=FaFf, g:FgFf Fi a=a:gf i

Then R ϕ, γ, η , iff , , , ϕ, γ, ι are the components of a map ΦA@Ψ . T(1 )[a a] x y z

D3. In what follows, we will consider the following 2-cat-sketch S and various of its parts (subsketches):

A@ B \ g C O\   -    c@  kgf           r  f hg     i h          @    ` P S = * *a `  # @ Od O O kf@ A cf (hg)f@ D Oβ @α Pha h(gf)  P hi@ b j@

163 has six elements, , , , , , , , , , , , , S(T1 ) (f g gf) (gf h h(gf)) (i h hi) (g h hg) (f, hg, h(gf)), (f, k, kf) ; the notations showing composition are purely symbolic. The horizontal compositions and signify the presence of elements " " and " "of cf ha 1fh1 , and two corresponding elements of . ∅ . There are further 2-cells and S(I21 ) S(H) S(I )= elements of and to the effect that , , , , α and β are isomorphisms, S(I22 ) S(T ) a b c d and α is the composite d(cf)β(ha)-1b -1 .

In case of a general 2-cat-sketch S , for a sketch-map M:SA@X and a functor F:XA@A of bicategories, the composite FM cannot be defined (think of a sketch in which a 1-cell is a composite in two different ways); in the case of our S however, since S is sufficiently "free", a useful sense can be ascribed to . First of all, for from D2, for A@X , FM S00M:S F:XA@A , FM is defined as Φ was above: for

YA@g Z O % B f gf  LL  i X ≅ a:gfA@i as M , we put FM to be

FYA@Fg FZ O % B FM = Ff FgFf  LL  Fi FX .

A@≅ Fa=FaFf, g:FgFf Fi

Now, there are four mappings of the form A@ , corresponding to the four items S0 S ≅≅≅≅ a:gfA@i, b:hiA@j, c:hgA@k, d:kfA@ # . We define, for any M:SA@X and F:XA@A , FM:SA@A as follows. First, we make sure that for any of the four maps σ A@ , σ σ . This requirement determines as far as its restriction to :S0 S (FM) = F(M ) FM the subsketch

164 A@ B \ g C O\   -  c@  kgf         r f hg     i h       @    ` P * *a ` .  # @ Od @ ADkf P hi@ b j@ is concerned. But then the effect of FM is uniquely determined on the items h(gf), (hg)f, cf, ha . Next, we define (FM)(β) so that the following diagram commutes; we wrote f, g, h for Mf , Mg , Mh :

FFf, F, (FhFg)FfA@h gfF(hg)FfA@hg F((hg)f) OO (FM)(β) { F(Mβ) Fh(FgFf)A@FhF(gf)A@F(h(gf)) . FhFf, ggf F , h

Finally, the effect of FM on α in S is now uniquely determined. It is worth noting that if β α , then β α ( , etc.); the reason is that M = f, g, hFf(FM)( )= , Fg, Fh f=Mf F "preserves" α (see above).

I claim that, for FM:SA@A so defined, (FM)(α)=F(M(α)) . This is demonstrated by the following commutative diagram:

A (FM)(α) F 4 P A@f, k A@ # B FkFf F(kf) Fd F (FM)(c) O O O L 2 FcFf 6 F(cf) FFf A@h, g A@ (FhFg)Ff F(hg)Ff F F((hg)f) OOf, hg (FM)(β)1 F(Mβ)8F(M(α)) Fh(FgFf)A@FhF(gf)A@F(h(gf)) FhFf, ggf F , h

165 G 3 PFhFa 7 F(ha) P (FM)(a) h FhFiA@F(hi)A@Fj FFb, O i h 5 (FM)(b)

Here, the cell 1 commutes by the definition of (FM)(β) ; 2, 3, 4, 5 commute by the definition of on the 2-cells , , , ; and by the naturality of ;and FM a b c d 6 7 F-, - 8 by the fact that Mα is the appropriate composite. The assertion is the commutativity of the outside perimeter of the diagram.

D4. Let be the following subsketch of : S1 S

BG@g C O % f gf hgh L gP AA@D A@(hg)f h(gf)

( ∅ for all ∈ , except for ) , and let be the sketch S1(t)= t L 2-catt=C 0 ,C 1 ,T 1S 2 (subsketch of ) obtained by adding the 2-cell α A@ to . Suppose we S :h(gf) (hg)f S1 have , A@A such that α α and α α (associativity M N:S2 M = Mf, Mg, Mh N = Nf, Ng, Nh isomorphisms), and, also writing for ,wehave M M S1

A@M S A@Pτ A (1) 1 N

Then τ is a map with respect to ,thatis, S2

A@M S A@Pτ A . 2 N

This fact expresses the naturality of the associativity isomorphism in a sense that is considerably stronger than the one required in the definition of bicategory. The proof of the assertion is contained in the diagram

166 @  A@   MN  (h(gf))τ ((hg)f)τ τ   OOAA (hg)f           h((gf)τ )A@h(g(fτ ))A@(hg)(fτ ) IV    AAOO A   O h(gτ )(hg)τ    ff   τ f   h(g(τ f))A@(hg)(τ f)A@((hg)τ )fMhg   I POBBB        h((gτ )f)A@(h(gτ ))f  OOBB h(τ f)(hτ )f   gg     τ A@ τ  h(( CCg)f) (h( g))f  OOII        Ah(τ (gf))A@(hτ )(gf)A@h(τ (gf))   h(τ ) CCCOO   gf τ (gf)(τ g)f   hh  (τ h)(gf)A@((τ h)g)fMN(τ (hg))f  τ DDD  h(gf) III OO   τ MNτ A DD(h(gf)) ((hg)f)

 in which t is written for Mt , t for Nt , for all relevant values of t , and all unmarked arrows are instances of associativity isomorphisms, possibly horizontally composed with a 1-cell. The issue is the commutativity of the outside quadrangle. The four cells marked I , II , III and IV commute by the definition of τ beingamapasin(1).The commutativity of the pentagons are the associativity coherence axioms for bicategory; the commutativity of the small quadrangles are instances of the (ordinary) naturality of the associativity isomorphism. Since all cells commute, the outside commutes as a consequence, andthisiswhatwewant.

D5. Now, start with the part (subsketch) S3

BG@g C O % f i k h L # gP AA@D j

of ( ∅ for all ∈ , except for ), and a map S S3(t)= t L 2-catt=C 0 ,C 1

167 A@M S A@Pσ A .(2) 3 N

A@P It is clear that if we have any TA@Pθ A ,and T’ is the sketch obtained by adding a Q new element " "to ,where and are already in , but is new, then gf=h T(T1 ) f g T h A@P P , Q and θ uniquely extend to T’A@Pθ A .Now,letS be the part of S which Q 4 is without the 2-cells ( for and ∅ otherwise). S S4(t)=S(t) t=C 011 ,C ,T S 4(t)= Applying the above remark four times, we have, a unique extension

A@M S A@Pσ A 4 N

of (2).

D6. Suppose T is a sketch, T’ is a subsketch of T missing only some 2-cells and -elements of ,andthat is generated by in the sense that is the least subsketch T2 T T T’ T of such that contains and every time when ρ, σ θ ∈ , T" T T" T’ ( . ) T(T2 ) ρ, σ∈ , then θ∈ , and every time when ρ, σ θ ∈ , T"(C22 ) T"(C ) ( . ) T(H) A@M ρ, σ∈T"(C ) , then θ∈T"(C ) . Then every transformation T’A@Pτ A is also one 22 N A@M as in TA@Pτ A . This is immediate. N

D7. Let us turn to the proof that R preserves A . What we need to show is this. Assume that we have

YG@ggZBG@C O  %O    % f i  k hf i  k h L # gP in X , L # gP in A , XA@WAA@D A@ A@ j j

168 the items listed under (*) in §7, the further items

J A@ ∈R , , (w:FW D) C[0 W D]    A@≅ ∈X# , , , A@≅ ∈A# , , , (b:hi j) T(11i h j) (b:hi j) T(i h j)    A@≅ ∈X# , , , A@≅ ∈X# , , , (c:hg k) T(11g h k) (c:hg k) T(g h k)    A@≅ # ∈X# , , # , A@≅ # ∈X# , , # , (d:kf ) T(11f k ) (d:kf ) T(f k )  η∈R , , , ψ∈R , , , κ∈R , , , C(111z w)[h h] C(x w)[j j] C(y w)[k k]  λ∈R , #, # ; C(1 x w)[ ] and assume that

R ϕ, γ, ι , , R ι , η, ψ , , T(11)[a a] T( )[b b]

R γ, η, κ , , R ϕ, ψ, λ , T(11)[c c] T( )[d d]

hold. Under these conditions, we want that if R , ; ψ, λ α, α , then C(2 x w )[ ]

  X##A(a, b, c, d; α)  A A(a, b, c, d; α).

I claim that it suffices to show that

  X##, , , ; α and A , , , ; α imply R , ; ψ, λ α, α . A(a b c d ) A(a b c d ) C(2 x w )[ ]

We use that for the given a, b, c, d , there is a unique α such that X#A(a, b, c, d; α)   (see (4) in §7), and similarly for a, b, c, d ; and we use that for the given x, w; ψ, λ ,the

relation R , ; ψ, λ α, α of the variables α,α establishes a bijection C(2 x w )[ ]  α@α X , # A@≅ A , # . The claim now is easily seen. : C(22j ) C(j )

  Thus, we assume X##A(a, b, c, d; α) and A A(a, b, c, d; α) .

Recall the sketch . The data give us diagrams A@X , A@A ; the effect of S M0:S N:S

169 , are given by the notation, except that β α (associativity iso in X )and M00N M = f, g, i β α (associativity iso in A ). Composing with ,weget A@A N = f, g, i M00F M=FM :S (see D3). Consider the restrictions A@A , A@A . The data M:S33N:S x, y, z, w, ϕ,γ, ι ,η,ψ,κ,λ supply the components of a map

A@M S A@Pτ A . 3 N

By D5, we have a unique extension of τ , also denoted by τ ,asin

A@M S A@Pτ A . 4 N

Let be the subsketch of that consists of , and the 2-cells , , , .The S54S S a b c d assumptions and D2 (applied to the four maps A@ )tellusthatwehave S0 S

A@M S A@Pτ A . 5 N

Now, add also β back to , getting . Since by D3, S56S

β β α α , M =(FM0)( )= Ff, Fg, Fh= Mf, Mg, Mh

D4 says that we have

A@M S A@Pτ A , 6 N

and finally D6 says that

A@M SA@Pτ A . N

The fact that τ is natural with respect to α is the desired fact R , ; ψ, λ α, α , C(2 x w )[ ] since, by D3, α α . M = F(M0 )

170 D8. The proof that R , , preserves is similar, and simpler. Now, the situation is ( r01r ) H this. We have

BG  Y G f  B h A@  MN  β δ   g i g LL  g A@k Oε X A@ Z j in X ,and

BG   B G  f   B h A@  MN   β g  δ g LL   i g k A@O A ε C A@ j in A ;wehave

JJJ A@ ∈R , , A@ ∈R , , A@ ∈R , , (x:FX A) C[000X A] (y:FY B) C[Y B] (z:FZ C) C[Z C]  ϕ∈R , , , η∈R , , , ψ∈R , , , C(111x y)[f f] C(y z)[h h] C(x z)[j j]  γ∈R , , , ι ∈R , , , κ∈R , , , C(111x y)[g g] C(y z)[i i] C(x z)[k k]    ∈X##, , , ∈X , , , ∈A# , , , ∈A# , , s T(1111f h j) t T(g i k) s T(f h j) t T(g i k) such that

 R , ; ϕ, γ β, β , R , ; η, ι δ, δ ,(3) C(22x y )[ ] C(y z )[ ]

R ϕ, η, ψ , and R γ, ι , κ , .(4) T(11)[s s] T( )[t t]

Under these conditions, we want that

171   R , ; ψ, κ ε, ε  X##, ; β, δ, ε  A , ; β, δ, ε . C(2 x z )[ ] ( H(s t ) H(s t ))

Again, it suffices to show that

 X##H(s, t; β, δ, ε) and A H(s, t; β, δ, ε) (5)

 imply R , ; ψ, κ ε, ε .(6) C(2 x z )[ ]

Assume (5). Consider the 2-cat-sketch

BG  Y G f  B h A @  M N  β δ   g i g LL  g T =kA @ Oε O X A  @jZ Os t A  @hf δβ A @P  ig

hfA @s j We have (f, h, hf), (g, i, ig)∈T(T),(β,δ,δβ)∈T(H) ,and δβ P { Pε (the 1 A @ ig t k latter by an (unmarked) 2-cell σ ,and , ε, σ , δβ, , σ ∈ ). (s ) ( t ) T(T2 )

The conditions in (5) ensure that the data we have give rise to morphisms A@X , M0:T A@A . As in the case of the sketch , we can form the composite A@A ;we N:T S M=FM0:T have v , v ; the commutativity of the diagram M(s)=Fs Ff, hgM(t)=Ft F , i

δ β FhFfA @F F FiFg F F f, hPP {  g, i δβ F(hf)A @F( ) F(ig)  FsPP { Ft A @ F(j) Fε F(k)

172 ensures that M is indeed M:TA@A . Consider the following subsketches of T :

BG  Y G f  B h A @  M N  β δ   g i g LL  g T1 =kA @ X A @j Z

BG  Y G f  B h A @  M N  β δ   g i g LL  g T =k 2 A @O X j Z A O @ s t hf A @ A @ ig

The data x, y, z, ϕ, γ, η, ι , ψ, κ give, via the relation (3), a map

A @M T A @Pτ A , 1 N which, by (4) and D2, uniquely extends to

A @M T A @Pτ A . 2 N

By D6, this extends to

A @M TA @Pτ A . N

The naturality of τ with respect to ε is the desired relation (6).

173 Appendix E: More on equivalence and interpolation

In this section, S and T are small Heyting categories, L is a DSV , K its category of kinds, and F:LA@S , G:LA@T are S-,resp. T-valued L-structures. Mod(S) denotes the category of coherent functors SA@Set , a full subcategory of SetS ; similarly for Mod(T) .

Primarily, we have in mind (also, ) obtained as the Lindenbaum-Tarski category T S [T0] of a theory in intuitionistic logic. We will be looking at Kripke-models of ;thatis, T0 T C Heyting functors Φ:TA@Set , with various exponent categories C ; we write ΦT for " Φ is a Kripke model of T ". " σ is a sentence of T ", " Φσ " and other unexplained notation have the meanings analogous to the ones used in §5.

We have the following intuitionistic version of the interpolation theorem 5.(7)(a).

(1) Assume that σ,τ are sentences of T , and for all Kripke models Φ, ΨT ,

Φ σ Φ  Ψ  Ψ τ & L L L .

Then there is an L-sentence θ in logic with dependent sorts without equality such that for all ΦT ,

Φ σ  ΦL θ and ΦL θ  Φ τ .

In (5) below, we will reformulate (and strengthen) the theorem in a purely syntactical fashion, by removing references to Kripke semantics.

We will imitate [M4] in the proof of (1).

When I:TA@Q is a Heyting functor , and F:LA@T , we have an obvious composite IF:LA@Q .

174 A@H Recall that for LA@Q , α:HI (called an L-equivalence)is α=(A, α , α ) , with I L 01 A@ and α A@ , α A@ with suitable properties. Given also A@ , A:K Q 01:A H K :A I K J:Q R we have the composite α , α , α  ; the requisite properties are J def=(JA J 0J 1):JH L JI easily checked.

Consider data as in

SA@H Q OO α ≅ (2) FI :HF L IG A@ L G T

with H , I Heyting functors. Fixing the items L, S, T, F, G , and for Q a Heyting category, let be the whose objects are triples , , α as in (2), and whose arrows CQ (H I ) , , α A@≅ , , α (where α , α , α , α , α , α ) are triples (H I ) (H’ I’ ’) =(A 01) ’=(A’ 01’ ’) ≅≅≅ (ϕ:HA@H’, ψ:IA@I’, γ:AA@A’) of natural isomorphisms such that

ϕ HFA@F H’K OO α  { α’ 0 γ 0 A A@ A’ (2') α α’ 1PP {  1 A@ IG ψG I’G

Composition in is defined in the obvious way. We may write ; , , α for CQ (Q H I ) (H, I, α) to emphasize Q .

Given an object Γ ; , , α of ,and A@ , a Heyting functor, we have the =(Q H I ) CQ L:Q R composite object Γ ; , , α (with α described above) of . Moreover, we L =(R LH LI L ) L CR have the functor

Γ**Γ , A@ RR= : Hom(Q R) C where Hom(Q, R) is the category (groupoid) of Heyting functors QA@R with isomorphisms as arrows; the object-function of γ* is L@Lγ as described, the arrow-function being

175 similarly defined by composition.

There are , a Heyting category, and Γ∈ , given by the data Q=S+LT CQ

I SA@0 S+ T OOL α ≅ (3) FI10:IF L IG1 A@ , L G T

such that ; Γ enjoys the universal property that for any Heyting category , Γ* is a (Q ) R R surjective (on objects) equivalence of categories (groupoids).

The description of is as follows. is the Lindenbaum-Tarski category of Q = S+LT Q [Q0] a theory Q in intuitionistic logic. L consists of L $L , the disjoint union of the 0 QST0 underlying graphs of S and T , together with new objects AK , one for each K∈K , arrows A@ , one for each ∈ and ∈ j , and arrows α A@ , Ap:AK AKp K K p K K 0K:AK FK α :AKA@GK . The axioms of Σ arethoseof S and T (formulated for the symbols that 1KQ0 are the images of the original symbols of and in $ ), together with axioms S T LSTL amounting to the assertion that , α , α , α , α is an -equivalence (A 01)=(AK 0K 1KK) ∈K L between the -model and the -model involved. The object Γ∈ is the evident one. S T CQ Kripke-models of are essentially the same as triples , , α  ; this S+LLT (M S N T :M N) fact is essentially the universal property of , γ with respect to apresheaf (S+LT ) R category SetC .

We call (3) the L-pushout of (F:LA@S, G:LA@T) .

Next, we introduce some auxiliary concepts.

Suppose that in

SA@H Q OO FI A@ L G T

176 Q is a coherent category, H and I are coherent functors (however, S and T are still the same Heyting categories as before). Let A@ , α A@ , α A@ .We A:K Q 01:A HF K :A IG K write α , α , α  if the following holds: =(A 01):H *I

(3') for every finite K-context X , and any L-formula θ of FOLDS, α **X θ ≤ α X θ ( 0[)(X] F[ : ]) A[X]1[( )(X] G[ : ]) .

(α )(X α ) X This refers to the arrows HF[X]MN0[]1[A[X]A@] IG[X] induced by α and α . We write , α , α  if both , α , α  and 01(A 01*):H I (A 01*):H I , α , α  ; of course, this just means an equality in place of ≤ in (3') . (A 10):I *H A[X] Finally, we write , α , α  if α , α , α  and α and α are (A 01):H #I =(A 01):H *I 0 1 very surjective.

Notice that if , α , α  , then α , α , α  ; the latter involves (A 01):H #I =(A 01):H L I preserving atomic L-formulas only.

Let us explain the meaning of the last-mentioned concepts when Q=Set ,and H=M∈Mod(S) , I=N∈Mod(T) .

 With X and ϕ as above, let 〈 〉 ∈ X . We write  ϕ for a= axx∈X (M K)[ ] M w [a]  〈 a 〉 ∈M(F[X:ϕ]) ( ⊂M(F[X]) ) ; here, the notation 〈 a 〉 is used in the sense given to it in the line after 5.(7'). The subscript w is to serve as a warning that this is a "non-standard" meaning for truth (  ); the coherent functor M:SA@Set is not supposed to respect the full logical structure of S , hence it does not necessarily "recognize" the full meaning of ϕ ; M is a "weak model for L-formulas". We have that for U:KA@Set ,and MMNmnUA@N , , , A iff for all X and ϕ as above, and for any 〈 〉 ∈ X , (U m n):M * N cxx∈X U[ ]

 ϕ 〈 〉   ϕ 〈 〉 M w [ mcxx∈X] N w [ ncxx∈X].

Note that when ∅ , ∅, ∅, ∅ A means that ∅ ϕ  ∅ ϕ . U= ( ):M * N M(F[ : ])=1 N(G[ : ])=1

Let

177  I A@0 S S+#T OO   α , α , α  (4) FI1=(A 01):IF 0#1IG A@ L G T

be the entity that is "initial" among all

SA@H Q OO α , α , α  , (4') FI =(A 01):HF #IG A@ L G T

in the following natural sense, amounting to a modification of the definition of .The S+LT category # ,for a coherent category, has objects (4'), and arrows CQ Q

(ϕ:HA@H’, ψ:IA@I’, γ:AA@A’):(H, I, α)A@(H’, I’, α’)

( α , α , α , α , α , α ) such that (2') holds; it is important that here ϕ , ψ =(A 01) ’=(A’ 01’ ’) and γ are not restricted to be isomorphisms. For any coherent category ,and Γ∈ # ,we R CQ have

Γ*#, A@ : Coh(Q R) CR

where Coh(Q, R) is the category of coherent functors QA@R , a full subcategory of RQ . The universal property of is that, for Γ given by (4), for any coherent , Γ* is a S+#T R surjective equivalence of categories.

The construction of is similar to that of . is the Lindenbaum-Tarski S+#T S+LT S+#T category of a coherent theory ##; the language of is the same as that for given Q00Q Q 0 above for . We include (coherent) axioms to ensure S+LT

α * X θ  α * X θ ( 0[)(X] F[ : ]) =A[X]1[( )(X] G[ : ])

for each X , θ as above. Note that the (ordinary, -valued) models of are Set S+#T

178 essentially the same as triples , , , with ∈ , ∈ and  . (M N u) M Mod(S) N Mod(T) u:M # N

(4) may be referred to as the #-pushout of (F:LA@S, G:LA@T) .

 Notice that there is a coherent comparison functor A@ for which , J:S+#T S+LT JI00=I  and α α . The reason is the universal property of , and the fact that, for JI11=I J = S+ #T Heyting functors Φ A@ , Ψ A@ , α ΦΨ implies α ΦΨ . :S R :T R : L : #

Any diagram

A@H S Q αα OO 01 FIHFMNAA@IG A@ L G T involving (at least) coherent categories and coherent functors, is said to have the interpolation property if the following holds: whenever X is a finite context for , σ∈ X , L S(S F[ ]) τ∈ X and α **σ ≤ α τ ,thenthereisan -formula θ S(T G[ ]) ( 0[)(X] H ) A[X]1[( )(X] I ) L (of FOLDS) such that σ ≤ X θ and X θ ≤ τ . F[X] F[ : ] G[ : ] G[X]

Using the (Kripke) completeness theorem for intuitionistic logic (for any small Heyting category S , there is a conservative Heyting functor SA@SetC ), it is easy to see that (1) is a weakened form of saying that the L-pushout diagrams have the interpolation property. Thus, (1) will follow from

(5) Both the #-pushout and the L-pushout of a pair (F:LA@S, G:LA@T) , with S and T small Heyting categories, have the interpolation property. Moreover, the comparison map A@ is conservative; thus, the assertion for the -pushout is a consequence of J:S+#T S+LT L that for the #-L-pushout.

For the proof of (5), we will employ the method described in [M4] (and adapted there from [G]).

179 Let ∈ . v ,and v v , for the inclusion A@ .For M Mod(S) M L def= M F M K def= M F j j:K L W∈SetK ,anarrow m:WA@M means an arrow m:WA@MK .

We write for the underlying graph of the category , and regard it as a vocabulary for LS S intuitionistic first-order logic. (Now, S is a general small Heyting category; in particular, what follows will also be applied to .) For a finite sequence 〈 〉 of distinct T x= xii

We will use the coherent theory coh, Σ coh , the internal theory of as a coherent TSSS =(L ) S category introduced in [MR1]. is identical to coh , the category of models Mod(S) Mod(TS ) of the theory coh with ordinary homomorphisms as arrows. For a coherent formula ϕ TS with free variables in x , M([x:ϕ]) , a subset of M([x]) , is identical to the ordinary interpretation of ϕ , {a:Mϕ[a/x]} , modulo the canonical isomorphism j: & X A@M([x]) ( x= 〈 x 〉 , x :X ) ; that is, M([x:ϕ]) = i

coh T  ϕ ψ (that is, for all M∈Mod(S) , M ∀x(ϕψ) )iff S x ϕ ≤ ψ ; [x: ] [x][x: ]

in other words, a coherent entailment is an ordinary semantic consequence of coh iff it is TS internally true in S ; this is but a form of the (Gödel) completeness theorem for coherent logic.

Now, we refer to A@ as well. Let @ a 1-1 mapping of variables of FOLDS over F:L S x -x L into variables over so that .Let,foranyfinitecontext X of -variables, LS x:F(Kx ) L E(X) denote the formula

180 ,.0 X j {(Fp)(x)=x:, x∈ , p∈K K} . - FKp x px

This formula describes that the for ∈X fit together via the maps , ∈ j ,as x- x Fp p Kx K dictated by the structure of the context X .

Recall X defined as a certain pullback; we have a monomorphism X x@ X for F[ ] m:F[ ] [-] which π vm = π ( x∈X ); here, we refer to the evident projections. In fact, m represents -xx the subobject X X of X .If Φ QΦRx@ X is any subobject of X , [:E(--)] [ ] =[n: F[ ]] F[ ] then Φ QΦQx@ X is a subobject of X .Wehaveaformula Φ X with  def=[mn: []] [-] ( ) free variables in Xsuch that [X :Φ(X)] = Φ ;

Φ(X)=∃z∈QΦR,.0(π vn)(z)=x def x∈X x -

( π X A@ ). When ϕ is an -formula in FOLDS, with ϕ ⊂X , and we take xx:F[ ] FK L Var( ) Φ X ϕ ∈ X ,weget ϕ X X ϕ X . =F[ : ] S(F[ ]) (-)= def F[ : ](-)

Note that if ∈ ,thenfor 〈 〉 ∈ X , M Mod(S) axx∈X F[ ]

ϕ 〈 〉  ϕ X . (5') M w [ axx∈X] M (-)[ax/x]x∈X

If Var(ϕ)⊂X⊂X’ , then

[X’:E(X’)Uϕ(X)]=[X’: ϕ(X’)] (6)

as is easily seen.

Let X⊂Y be finite contexts over L ; assume Var(ϕ)⊂Y . Let us write ∀(Y-X)ϕ for the formula ∀ ∀ ∀ ϕ ,where 〈 〉 n is a repetition-free enumeration of the set z12z ... zniiz =1 Y-X such that for all ≤ , X∪ ≤ is a context (an enumeration in a non-decreasing j n {xi:i j} order of the level of will ensure this; the formula ∀ ∀ ∀ ϕ is well-formed as a Kz z12z ... zn consequence. ∀(Y-X)ϕ is not quite uniquely determined, but it is, up to logical equivalence). We have the equality:

[X:( ∀(Y-X)ϕ)( X)]=[ X:E( X)U∀( Y- X)(E( Y) ϕ( Y))] ;(7)

181 here, ∀(Y-X) stands for ∀z ∀z ...∀z for Y-X ={z , ...z } as above. This is  12  n 1 n easy to show by induction on the cardinality of Y-X .

Other easily seen equalities we will use are

Y ,.0ϕ Y Y Y U,.0ϕ Y ,(8) [ : i()]=[:E( ) i()] i

Y 246ψ Y Y Y U246ψ Y ,(9) [ : j()]=[:E( ) j()] j

[Y:( ϕψ)( Y)]=[ Y:E(Y )U( ϕ( Y) ψ(Y ))] , (10) under the natural conditions on the parameters involved.

The following is the analog of Lemma 3 of [M4].

(11) Suppose ∈ , ∈ and , ,  .Thenwehave M Mod(S) N Mod(T) (U m n):M * N ∈ , A@ ∈ , A@ and , ,  such that is P Mod(S) (f:M P) Mod(S) g:U V (V r q):P * N q very surjective, and

P_  r Ol  \ (12) f V  q  { gO{   MN A@o M mnU N

Proof. We first construct

V\  q gO{   A@o  U n N K in SetK such that q:VA$NK is very surjective and g is a monomorphism. We put

182 n A@0 A@n , and by recursion on , the height of , assuming U0 N K = U N K i

We may assume that is an inclusion (that is, each of its components is an inclusion of g gK sets).

Consider the (infinite) contexts Y ⊂Y associated with and as in §4. For UV U V ∈Y Y ,let denote a variable for ordinary multisorted logic over ,ofthesort x VU- x LS ; the mapping @ is 1-1. For any ∈ , ∈ ,let , , abbreviated as F(Kx ) x x- A S a M(A) (A a) ,beavariableofsort ; assume that the are different from the . With ---a A a x

∈Y Y ∪⋅ ∈ , ∈ , C def={x:x VU- } {a:A S a M(A)} by a -formula we mean one over whose free variables all belong to . C LS C

For ∈Y , is an element of , thus belongs to the second term in x U m(a(x)) M m(a(x)) . When ∈Y ,let stand for . (Recall the correspondence between the C x U x- m(a(x)) elements of Y and those of ; for any fixed ∈ , @ V is a bijection VKV K K d y , d

183 A@≅ ∈Y , with inverse @ ). Now, ∈ is defined for all ∈Y , V(K) {x Vx:K =K} x a(x) x C x V and we have . x:FKx

We now write down a set Σ of formulas over the language with free variables in the set LS C . Σ is the union of the following five sets of formulas in classical first order logic:

Σcoh (13.1) S

A@ ∈ , ∈ , ∈ , (13.2) {o(a)=Bb :(o:A B) S a MA b MB (Mo)(a)=b}

Y j {(Fp)(x)=x:, x∈ , p∈K K} (13.3) - FKp x pVx

ϕ X ϕ ⊂X⊂Y ϕ 〈 〉 (13.4) {( ) : Var( ) Vw, N [ qx x∈X]}

¬ ψ X ψ ⊂X⊂Y ψ 〈 〉 (13.5) { (( )) : Var( ) Vw, N [ qx x∈X]}

(note that ψ 〈 〉 is not the same as  ¬ψ 〈 〉 !). N w [ nx x∈X] N w( )[ nx x∈X]

Let us understand the free variables in Σ as individual constants. Assume that Σ is consistent (satisfiable); let , be a model of Σ . Then, by (13.1), ∈ .By (P c)c∈C P Mod(S)

(13.2), 〈 〉 for which ∈ , ∈ is a natural transformation f = fAA∈SAf (a)=-a (A S a MA)

f:MA@P . By (13.3), r= 〈 r 〉 for which r (d)=(yV ) whenever K∈K , d∈VK KK∈K KK, d is a natural transformation r:VA@PK .Sincefor c∈U , y=VVm(a(y )) = m(c) , K, cK , c  we have the left-hand commutativity in (12). Finally, by (13.4) and (13.5), , ,  (see (5')). We have verified that the consistency of Σ establishes (11). (V r q):P * N

Let us prove that Σ is satisfiable. Assume that a finite subset Φ of Σ is not satisfiable. Φ Y U A involves a finite number of C-variables. There is a finite context ⊂ V and a finite set of elements a=(A∈S, a∈MA) of M such that all formulas in Φ have free variables from Y∪A ; Y ∈Y , A ∈A .Let Θ denote the set Φ∩(13.2) ; for all formulas -  -={y:y } -={a:a } θ∈Θ , Var(θ)⊂A .Byincreasing Φ , we may assume that it is a subset of

184 Σcoh ∪ Θ ∪ E’(Y) ∪ {ϕ (U ):i

where E’(Y) is the set whose union is E(Y) , each ϕ (U ) belongs to (13.4) , each ii  ¬(ψ (V )) belongs to (13.5) , and U ⊂Y , V ⊂Y .Let θ = ,.0Θ . jj  i j

The inconsistency of (14) is the same as saying that

coh θ U Y U ,.0ϕ U  246ψ V . TS E() ii( ) jj( ) i

By our remarks above (completeness), this is the same as

[A∪Y: θUE(X )U,.0ϕ (U )] ≤ [A∪Y: 246ψ (V )] . i

By (6) , this may be rewritten as

[A∪Y: θUE(Y )U,.0ϕ (Y)] ≤ [A∪Y: 246ψ (Y)] . i

With ϕ=,.0ϕ , ψ=246ψ , we see that ϕ(Y)∈(13.4) , ¬(ψ (Y))∈(13.5) . i

Also using (8), (9), we have

[A∪Y: θUE(Y )Uϕ (Y)] ≤ [A ∪Y: ψ (Y)]

In other words,

[A∪Y: θUE(Y)] U [A∪Y: ϕ(Y)] ≤ [A∪Y: ψ(Y)] , and as a consequence, using the Heyting implication in S([A∪Y]) ,

[A∪Y: θUE( Y)] ≤ [ A∪Y: ϕ(Y)][ A∪Y: ψ(Y)]=[ A∪Y: ϕ(Y) ψ(Y)] .

By (10), it follows that

185 [A∪ Y: θUE( Y)] ≤ [ A∪ Y:( ϕψ)( Y)] and

[A∪ Y: θ] ≤ [ A∪ Y:E( Y)( ϕψ)( Y)] . (15)

Let X Y∩Y .Wehavethat X A∩Y ⊂ A ,and A∪Y A ∪⋅ Y X .Let π A∪Y A@ A = U =  = ( - ) :[ ] [ ] be the projection, let τ =E(Y)( ϕψ)( Y) . As was mentioned above, Var(θ)⊂ A . Using *! , π ∀π

* A A Y  A A Y π [:θ] ≤ [ ∪ :τ] [ :θ] ≤ ∀π[∪ :τ].

By (15), it follows that A A Y . Now, A Y A Y X .We [:θ] ≤ ∀π[∪ :τ] ∀π[∪ :τ]=[ :∀( - )τ] conclude

[A: θUE( X)] ≤ [ A:E( X)U∀( Y- X).E( Y)( ϕψ)( Y).] andby(7),

[A: θUE( X)] ≤ [A :(∀ (Y-X)(ϕψ)(X )] . (16)

By the definition of X X .But,for ∈X , for E(),M E( )(m(a(x))/ x)x∈X x x=a ; thus, X .By Θ⊂(13.4) , θ .By(16),we a=m(a(x)) M E()[a/a]a∈A M [a/a]a∈A conclude that ∀ Y X ϕψ X ,thatis, M (( - )( )( )[a/ a]a∈A

∀ Y X ϕψ X . M (( - )( )( )(m(a(x))/ x)x∈X

By , ,  , we conclude (U m n):M * N

∀ Y X ϕψ X N (( - )( )( )[q(a(x))/ x]x∈X

( q extends n ). By the choice of ϕ and ψ ,

ϕ , N [q(a(y))/y]y∈X

186 ψ N [q(a(y))/y].y∈X

Also,

 Y . N E()[[q(a(y))/y]y∈X

However,

[Y:( ∀(Y-X)(ϕψ)( X) U ϕ U E( Y)] ≤ [ Y: ψ] .

The last five displays contain a direct contradiction.

This completes the proof of (11).

The following is essentially simpler than (11); it is the analog in our context of Lemma 4 of [M4].

(17) Suppose ∈ , ∈ and , ,  .Thenwehave M Mod(S) N Mod(T) (U m n):M * N ∈ , A@ ∈ , A@ and , ,  such that is Q Mod(T) (h:N Q) Mod(T) g:U V (V r q):M * Q r very surjective, h is pure, and

 q  ] Q * O ~  (12) r  V h ^ { gO {  MN A@ . M mnU N

( h:NA@Q being pure means that the naturality squares

NAx@Nm NB h h APPB x@ QA N’m QB corresponding to monomorphisms m∈T are pullbacks.)

187 Combining (11) and (17) in an "alternating chain" argument (see the proof of Lemma 2 in [M4]), we obtain

(18) Suppose ∈ , ∈ and , ,  . Then there are M Mod(S) N Mod(T) (U m n):M * N M’∈Mod(S) , N’∈Mod(T) , g:UA@U’ , f:MA@M’ , h:NA@N’ and , ,  (in particular, and are very surjective) such that is (U’ m’ n’):M’ # N’ m’ n’ h pure, and

M’MNm’ U’A@n’ N’ OOO fg h (18')  {  {  MN A@ . M mnU N

(Observe the asymmetry; , ,  , and not the other way around; , but not , (U m n):M * N h f is required to be pure.)

Let us prove the assertion, contained in (5), that (4) has the interpolation property. Let σ and τ be as in the interpolation property, assume the hypotheses, and also that the conclusion fails. That is,

  (19) α * σ ≤ α * τ ; ( 0[)(X]0I ) A[X]1[( )(X]1I ) however,

(20) there is no -formula θ (of FOLDS) such that σ ≤ X θ and L F[X] F[ : ] X θ ≤ τ . G[ : ] G[X]

I claim that (20) implies that

 (21) there are ∈ , ∈ and , ,  such that M Mod(S) N Mod(T) (FX a b):M * N    σ and  τ . M ww[a] N [b]

188 Let @ be a 1-1 map of variables ∈X into variables over , .Let θ range x x x LT x:GKx over L-formulas with Var(θ)⊂X . E’[X],θ(X) and τ(X) were defined before. Consider the set

Σcoh ∪ X ∪ θ X σ≤ X θ ∪ ¬ τ X . (22) T E’[] { ( ): F[X]F[ : ]} { (( ))}

If this were inconsistent, we would easily conclude that there is θ with X θ ≤ τ , G[ : ] G[X]

contrary to (20). Let ; be a model for (19). Next, let @ bea1-1mapof (N x/x)x∈X x x variables ∈X into variables over , , and consider x LS x:FKx

Σcoh ∪ X ∪ ¬ θ X ; θ X ∪ σ X . (23) S E’[] { (()): (N x/x)x∈X w( )} { ()}

This is easily seen to be consistent by the fact that ; is a model of (22). Now, if (N x/x)x∈X    ; is a model of (23), then with 〈 〉 , 〈 〉 we have (21). (M x/x)x∈X a= x x∈X b= x x∈X

 Now, apply (18) to , ,  as , ,  ; we obtain that (FX a b):M * N (U m n):M * N

(24) there are ∈ , ∈ and , ,  such that M’ Mod(S) N’ Mod(T) (V m n):M # N    σ and τ . M ww[a] N [b]

 (Indeed, being pure ensures that τ .) On the other hand, by (24) and the universal h N w [b]  property of (4), there is A@ such that , and P:S+#01T Set PI =M PI =N  , α , α , , . Applying these to (19), we get **σ ≤ τ , P(A 01)=(V m n) m [X](M ) V[X][n X](N )   which contradicts the conjunction of  σ and τ . M ww[a] N [b]

It remains to prove the other assertion of (4), namely that the comparison J is conservative.

For any small coherent category R , we have the evaluation functor e:RA@SetMod(R) ,a conservative coherent functor, and if R is Heyting, e is Heyting (Kripke-Joyal theorem; see [M4]).

189 We show, in analogy to Proposition 7 of [M4], that

 I (25) For , the composites A@1 A@e Mod(R) , R=S+#T T R Set  I SA@0 RA@e SetMod(R) are Heyting.

The argument is similar to that in loc.cit. We deal with the first composite; the second is symmetric. Upon an analysis similar to that in loc.cit., we see that what we need is this:

given k:AA@B in T , X∈S(A) , M∈Mod(S) , N∈Mod(T) , , ,  , ∈ such that ∉ ∀ , u=(U m n):M # N y NB y N( kX)

there are ∈ , ∈ , , ,  and M’ Mod(S) N’ Mod(T) u’=(U’ m’ n):M’ # N’ A@ , A@ , A@ , , A@ , , ,anarrowin # ,and (f:M M’ h:N N’ g:U U’):(M N u) (M’ N’ u’) CSet ∈ such that . x N’(A)-N’(X) hB(y)=(N’k)(x)

As in loc.cit.,wehave N******∈Mod(T) , h :NA@N , x ∈N (A)-N (X) such that ***. We build a commutative diagram hB(y)=(Nk)(x )

M’MNm’ U’A@n’ N’ OO O f g h’ MMNUA@N* m (h*K)vn OO O* 1M 1Uh MN A@ M mnU N .

The lower half is already constructed. The important remark is that , ,  (U m n):M * N implies that , , * v  . Then, by (18) , we have the rest such that, in (U m (h K) n):M * N addition, , ,  and is pure. Taking the vertical composites, in (U’ m’ n):M’ # N’ h’ particular v **,and , noting the purity of *,wehavewhatwe h=h’ h x=(h’)A (x ) h

190 want.

Having (25), the proof of the conservativeness of J is as in loc.cit.

This completes the proof of (5) and (1).

The results proved may be applied to characterizations of formulas invariant under equivalence of categories, of diagrams of categories, and of bicategories, in category theory done in intuitionistic set-theory. However, the condition of being invariant under equivalence cannot, in most cases, be stated by using the traditional concept of equivalence. Note that in the proofs of 6.(5), 6.(23), 7.(5), one direction (passing from an L-equivalence to a categorical equivalence) uses the Axiom of Choice, not available in intuitionistic set-theory. [M2] introduces "ana"-versions of certain concepts, among others functors of categories and functors of bicategories, that can be used in this context. The condition of invariance under categorical equivalence has to be strengthened, in general, to invariance under categorical anaequivalence, to have the characterizations analogous to the ones we proved for classical logic.

Let us note that statement (5), being in essence of a syntactical (arithmetical) nature, can be proved constructively, in intuitionistic , by a general transfer result of H. Friedman [Fr]; thus, (5) is available when doing category theory intuitionistically. However, to be able to apply (5), the assumption of invariance under equivalence has to be available in the "provable" sense.

In the case of equivalence of categories, essentially because now there is no need to pass to a notion of "anacategory", we do have the direct analog of 6.(3) for intuitionistic logic. In particular:

(25') Let ϕ(X) be a first-order formula on a finite diagram X of objects and arrows in the language of categories. Suppose that it is provable in intuitionistic set-theory that the property of ϕ(X) being true is preserved and reflected along equivalence functors. Then there is a formula θ X in FOLDS over such that ∀X ϕθ* is provable in intuitionistic ( ) Lcat ( ) predicate from the axioms of category

191 (here, θ* is the usual translate of θ into ordinary multisorted logic, given in §1).

In the rest of this Appendix, we discuss (simple) Craig interpolation and Beth definability for FOLDS.

For specificity, we consider FOLDS in the sense of classical FOLDS with (restricted) equality; theories etc. below are to be understood accordingly.

First, let us put ourselves in the context of Appendix A. Suppose is a vocabulary. A L1 subvocabulary of is a subset of which itself is a vocabulary. Note that the L11L L set-theoretical intersection and union of any number of vocabularies are always again vocabularies.

In terms of the terminology of §1, instead of the above notions, we would use the following. Let , DSV's, A@ a functor. I call an inclusion of DSV's if it is (a) 1-1 on L L11i:L L i objects, (b) for any object of the category , ∈ iff ∈ , and (c) for R L R Rel(L) iR Rel(L1) every ∈ , induces a bijection j A@ j . Obviously, preserves levels. A A L i A L iA L1 i sub-DSV of is given by an inclusion A@ of DSV's for which acts as the L L11i:L L i identity ( is a "real" inclusion). If we have inclusions A@ , A@ ,wemay i i1122:L L i :L L consider the pushout ; as a category, it is a pushout in the ordinary sense; the L1+LL2 relations of are defined to be the images of those of and ; clearly, the L1+LL212L L coprojections A@ , A@ are inclusions too. L11L +LL221L L +LL2

Let us use the terminology of Appendix A. Suppose that is a theory in FOLDS over T1 ,and ⊂ . Then denotes the theory ,where is the L111L L T L (L,CnL (T1)) CnL (T1) set of -consequences (in classical FOLDS) of . (A small point to make here is that an L T1 -formula is not necessarily an -formula, despite the fact that ⊂ . The reason is that a L L11L L kind in may be maximal in , but not maximal in , in which case equality on K L L L1 K is allowed in FOLDS over , but not in FOLDS over . The definition of is L L1 CnL (T1) that it is the set of all -sentences which are also -sentences, and which are consequences L L1 of .) If is a theory over (i=1,2), then ∪ is the theory over ∪ for T1 TiiL T12T L 12L which .Whentwotheories and are over the same language Σ ∪ =Σ ∪Σ S S T1212TTT 12 , then ∪ is also over . L S12S L

192 In the §1 terminology, when is a theory over (i=1,2), we can define the "pushout" TiiL theory in the obvious way. T1+LT2

We will revert to the Appendix-A terminology.

Craig Interpolation for classical FOLDS. Suppose , are vocabularies (for FOLDS), L12L ∩ , is a theory over , . Then ∪ is consistent if and only if L = L12L TiiL (i=1 2) T12T ∪ is consistent. (T12L) (T L)

Of course, only the "if" part requires proof.

Let us illustrate the meaning of the above statement of the Craig interpolation theorem for FOLDS.

Suppose σ is a sentence over , ,and σ σ . Consider over iiL (i=1 2) 12T 1L 1 whose single axiom is σ ,and over whose single axiom is ¬σ . Then, ∪ 122T L 2T 12T is inconsistent; hence, so is  ∪  . This means that there are sentences θ , θ (T12L) (T L) 12 over such that σ θ , ¬σ θ and θ , θ is inconsistent; but then σ θ and L 11 22{ 12} 11 θ σ ; we have the usual form of interpolation. 12

There is a generalization of the above statement of interpolation, obtained by allowing individual constants in the theories. A vocabulary L with individual constants is a set of the form ∪C ,where is a vocabulary, and C is a (not necessarily finite) context of L=L00L variables (individual constants) such that for ∈C , ∈ . Intersection and union of c Kc L0 vocabularies with individual constants is again such. An -sentence is an -formula with all L L0 free variables in C .Astructure for is one, say ,for , together with an M L M00L interpretation of the C-symbols: some 〈 〉 ∈ C .Foran -sentence ϕ , ϕ  acc∈C M0[ ] L M def ϕ 〈 〉 .Atheory over is given by any set of -sentences; a model of the M0 [ acc∈C] L L theory is an L-structure satisfying all the axioms. Now, all the terms in the above statement of the Craig interpolation theorem have natural meanings when , are vocabularies with L12L individual constants; the theorem remains correct in the generalized form.

In the well-known manner, the Beth definability theorem can be deduced from Craig interpolation, by using individual constants. We obtain

193 Beth definability theorem for FOLDS. Suppose is a theory in FOLDS, ⊂ , X is a T L LT finite context for ,and ϕ is an -formula with ϕ ⊂X . Suppose that for any two L LT Var( ) models , of ,if , then X ϕ X ϕ .Thenthereisan M12M T M 1L = M 2L M 1[ : ]=M 2[ : ] L-formula θ with Var(θ)⊂X such that M[X:ϕ]=M[X:θ] for all models M of T .

For the proof, make two copies , of the vocabulary ,byrenamingallkindsand L12L LT relations ∈ in two distinct ways as and , and by putting A LT-L A12A ∪ ∈ ; ∩ . For any ∪ X -sentence ψ ,wehavethe LiiT=L {A :A L -L} L12L =L L { } ∪ X -sentence ψ , with the same free variables (in X ), obtained by the appropriate Lii{ } renaming. Applied to all members of Σ ,thisgives Σ ,asetof sentences. Consider TiiL - the theories ∪X, Σ ∪ ϕ , ∪X, Σ ∪ ¬ϕ over vocabularies T11=(L 11{ }) T 22=(L 2{ 2}) ∪X , ∪X with individual constants. Craig interpolation applied for and gives L12L T 1T 2 the desired conclusion.

We make some preparations for the proof of the Craig interpolation theorem.

Recall our definition of saturation in §5. We make some modifications on it.

Let us fix the DSV L ; K is its category of kinds. First of all, in contrast to §5, we now want to deal with logic with equality; formulas now may have equality. The definitions up to " Y-L-saturated " remain the same, except for the change in what counts as a formula. Consider a context Y , and a Y-set Φ of formulas; all formulas in Φ have variables in the context Y∪⋅ . Let us say that Φ is low if is low, that is, it is not a maximal element {x} Kx of . This is the same as to say that no equality predicate is allowed on . K Kx

The L-structure M is said to be strictly Y-L-saturated if for every a∈M[Y] and every Y-set Φ ,if Φ is finitely satisfiable in (M, a) ,then(1) Φ is satisfiable in (M, a) , and (2) if Φ is a low set, then Φ is satisfiable by an element for which ≠ for all ∈Y ; a a ay y here, 〈 〉 . We say that is strictly κ- -saturated if it is strictly Y-saturated for a= ayy∈Y M L all Y of cardinality < κ .

There are two issues: existence and uniqueness; let's deal with existence first. To that end, we give a simple general construction.

194 Let , be -structures. We write  if is a subfunctor of (note that both M N L M LN M N M and N are functors LA@Set ), and for any X , a∈M[X] ( ⊂N[X] ),Mϕ[a] iff N ϕ[a] .

(26) Let M be any L-structure, K a low kind, a∈M[K] ,and MK(a)≠∅ .Wecan construct another structure such that  and ⊂ . N M LN MK(a)≠NK(a)

For simplicity, we assume that M is separated (the MK are pairwise disjoint). Let b ∈MK(a) .

Let U=MK . Construct V:KA@Set as follows. Say of x∈QUR that it is above b if there is f:K’A@K (possibly the identity) such that (Uf)x=b . Note that

(27) if A@ , ∈ and ,thenif is above ,sois g:K1211K x UK x 2=(Ug)(x 1) x 2 b . x1

Introduce a new element x for every x above b , distinct from each other and from the ⋅ elements of U .Put VK’=UK’∪{x: x∈UK’ above b} . The effect of V on arrows is defined so that U is a subfunctor of V , and by the following determinations. For

A@ , ∈ above ,let ; ∈ Vg@ if is g:K1211K x UK b x 2=(Ug)(x 1) x 11def2VK x x 2 above , ∈ @Vg otherwise. It is easy to see, using (27), that is a functor, b x1VK 1 defx 2 V we have the inclusion i:UA@V , and we have the retraction r:VA@U for which x@r x ;  . I claim that is very surjective. If 〈 〉 ∈ , @r , ∈ , ri=1Uppr y= y ∈KjK V[K] y x x UK(x)  then if is not above ,thenno is above and ∈ , and of course @r ; x b yp b x VK(y) x x  but if x is above b , then x∈VK(y) , and of course xr@x .

Returning to M , using the very surjective r:VA@U ,define N=rM* (see §5). When we regard M and N as structures for Leq , with standard equality for the equality predicates,  then still N=rM* . This amounts to the following: if K’ is a maximal kind , y∈V[K’] ,  , ∈ , @r , @rr, @ , then implies .If y12y VK’(y) y x y 1x 1y 2x 2x 12=x y 12=y

195 , the only way ≠ could be the case is that is above , and x12=x y 12y x 1b y 11=x

(or the other way around). However, if so, then since ≠ ( is low), we have y21=x K’ K K  A@ proper such that , hence, , and, since ≠ , , p:K’ K (Up)x11=b (Up)x =b b b y 11=x  cannot both be in for the same , contradiction. y21=x VK’(y) y

We have, by 5.(1), that θ is elementary (with respect to logic over eq without equality; r L i.e., with respect to logic over with equality). Combining this with ,we L ri=1U immediately obtain that θ A@ is elementary, that is,  as desired. This proves (26). i:M N M LN

The usual proof of the existence of saturated models (see [CK]), using unions of elementary chains, is now easily supplemented by uses of (26) to provide

(28) For any infinite cardinal κ≥#L ( L any vocabulary with individual constants), any κ consistent theory T over L has a strictly κ+, L-saturated model of cardinality ≤ 2 .

(29) If , are strictly κ, saturated -structures, ≡ , both of cardinality ≤ κ , M N L- L M LN then they are isomorphic.

Proof. Inspecting the proof of 5.(4), we see that we can make both maps m and n bijective. This suffices.

Proof of Craig. Suppose ∪ is consistent. Let be a model of it; is an (T12L) (T L) M M L-structure. Let Σ be the set of all sentences in FOLDS over L that are true in M ; , Σ . Both ∪ and ∪ are consistent; if not, we would have (say) τ∈Σ such T=(L ) T12T T T that T ¬τ ; but then, by definition, ¬τ∈Σ  , hence M¬τ ; contradiction to τ∈Σ . 1 T1 L Choose λ ≥ , ≥ such that κ λ+ λ .By(28),let ∪ , strictly #L12#L = =2 MiiT T (i=1 2) κ, -saturated, of cardinality ≤κ . Then  is also strictly κ, saturated, of LiiiM L L - cardinality ≤κ . By (29), there is an isomorphism  A@≅  .Thereis and an f:M12L M L M 2’

196 isomorphism A@≅ such that (and ). But then the g:M22’ M M 2’ L = M 1L g L=f ∪ -structure for which , , is a model of ∪ . L12L N N L 11=M N L 22=M’ T 12T

Finally, let us note that Craig interpolation and Beth definability hold for intuitionistic FOLDS. Looking at the above formulation for classical FOLDS, we are led to the following formulation:

S’A@S’+ T’ ) R OO{  F  H  SA@S+ T F , G conservative  H conservative R OO{ A@ A@ R T G T’

This is to be understood in a suitable doctrine. Above we proved, in essence, this in the doctrine of UV¬∃-fibrations (see §3) restricted to fibrations obtained from simple base-categories as described in §4 , with arrows restricted to inclusions as defined above. The claim is that the same holds when we switch to UV∃∀-fibrations. The proof is along the lines we presented in the first part of this Appendix.

197 References

[BD] J. C. Baez and J. Dolan, Higher dimensional algebra and topological quantum field theory. Preprint (University of California, Riverside).

[Ba] J. Barwise, Back and forth through infinitary logic. In: Studies in Model Theory, ed. M. Morley, MAA Studies in Mathematics, vol. 8, The Mathematical Association of America, 1973; pp. 5-34.

[Be] J. Benabou, Introduction to bicategories. In: Lecture Notes in Math., no. 47, Springer Verlag, 1967; pp. 1-77.

[Ben] P. Benaceraff, What numbers could not be. Philosophical Review, 74 (1965), 47-73.

[B] G. Blanc, Equivalence naturelle et formules logiques en theorie des categories. Archiv math. Logik 19 (1978), 131-137.

[C] J. Cartmell, Generalised algebraic theories and contextual categories. Annals of Pure and Applied Logic 32 (1986), 209-243.

[CK] C. C. Chang and H. J. Keisler, Model Theory. Third edition, North-Holland, 1990.

[Co] M. Coste, Localisation, spectra and representation. In: Applications of sheaves, Lecture Notes in Math., no. 753, Springer Verlag, 1979; pp. 212-238.

[F] P. Freyd, Properties invariant within equivalence types of categories. In: Algebra, and Category Theories, ed. A. Heller and M. Tierney, Academic Press, New York, 1976; pp. 55-61.

[Fr] H. Friedman, Classically and intuitionistically provable recursive functions. In: Higher Set Theory, Lecture Notes in Math., no. 669, Springer Verlag, 1978; pp. 21-28.

[FS] P. J. Freyd and A. Scedrov, Categories, Allegories. North-Holland, 1990.

[G] D. M. Gabbay, Semantic proof of Craig's interpolation theorem for intuitionistic logic and

198 extensions, Part I. In: Logic Colloquium ’69 (R.O.GandyandC.M.E.Yates,eds.), North-Holland; pp. 391-402.

[GPS] R. Gordon, A. J. Power and R. Street, Coherence for tricategories. Preprint (Temple University); to appear in Memoirs Amer. Math. Soc.

[J] T. Jech, Set Theory. Academic Press, New York, 1978.

[Kel] G. M. Kelly, Complete functors in I. Chain maps and endomorphisms. Proc. Cambridge Phil. Soc. 60 (1964), 721-735.

[K] S. C. Kleene, Introduction to . Ninth reprint, North-Holland, 1988.

[L] F. W. Lawvere, More on graphic toposes. Cah. de Top. et Geom. Diff. 32 (1991), 5-10.

[L2] F. W. Lawvere, Equality in hyperdoctrines and the comprehension schema an adjoint functor. In: Proceedings of the New York Symposium on Applications of Categorical Logic (ed. A. Heller), Amer. Math. Soc., Providence, 1970.

[M L] S. Mac Lane, Categories for the Working Mathematician. Springer-Verlag, 1971.

[M1] M. Makkai, Generalized sketches as a framework for completeness theorems. To appear in J. Pure and Applied Algebra.

[M2] M. Makkai, Avoiding the axiom of choice in general category theory. To appear in J. Pure and Applied Algebra.

[M3] M. Makkai, The fibrational formulation of intuitionistic predicate logic I: Completeness according to Godel, Kripke and Lauchli. Notre Dame Journal of Formal Logic 34 (1993), 334-377 (Part 1) and 471-498 (Part 2).

[M4] M. Makkai, On Gabbay's proof of the Craig interpolation theorem for intuitionistic predicate logic. To appear in Notre Dame Journal of Formal Logic.

[M5] M. Makkai, Ultraproducts and categorical logic. In: Methods in , ed. C. A. DiPrisco, Lecture Notes in Math., no. 1130, Springer-Verlag, 1985; pp. 222-309.

199 [MR1] M. Makkai and G. E. Reyes, First Order Categorical Logic. Lecture Notes in Mathematics, no. 611, Springer-Verlag, 1977.

[MR2] M. Makkai and G. E. Reyes, Completeness theorems for intuitionistic and modal logic in a categorical setting. Annals of Pure and Applied Logic 72 (1995), 25-101.

[MP] M. Makkai and Robert Pare, Accessible Categories. Contemporary Mathematics, v. 104. American Mathematical Society, 1989.

[M-L] P. Martin-Löf, An Intutionistic Theory of Types. In: Proc. Bristol Logic Colloquium, North-Holland, 1973.

[P] A. Preller, A language for category theory in which natural equivalence implies elementary equivalence of models. Zeitschrift f. math. Logik und Grundlagen d. Math. 31 (1985), 227-234.

[S] R. Street, Fibrations in bicategories. Cah. de Top. et Geom. Diff. 21 (1980), 111-160.

200