75
Graph-based Logic and Sketches I: The General Framework Atish Bagchi ¤ and Charles Wells Revised April 22, 1997 1 Introduction Sketches as a method of speci¯cation of mathematical structures are an alternative to the string-based speci¯cation employed in mathematical logic. They have been proposed as suitable for the speci¯cation of data types and programs [Gray, 1987], [Gray, 1989], [Wells and Barr, 1988], [Duval and en¶ echaud, 1994], and some work on implementation has been carried out [Gray, 1990], [Duval and Reynaud, 1994a], [Duval and Reynaud, 1994b]. The second author [Wells, 1990] proposed a generalization of sketches called \forms" with an eye toward using them to specify programming languages. Forms were generalized to 2-categories by Power and Wells [1992] (where the word \sketch" was used instead of \form"). Other generalizations of sketches are given in [Lair, 1987], [Makkai, 1993a] and [Kinoshita et al., 1997]. Sketch theory has been criticized as being lacunary when contrasted with logic because it apparently has nothing corresponding to proof theory. This article provides an explicit proof-theoretic structure for sketches and forms. It is written in an innovative style using some of the ideas for presenting mathematics outlined in [Bagchi and Wells, 1996]. ¤ The ¯rst author is grateful to the Mathematical Sciences Research Institute for pro- viding the opportunity to work on this paper there. Research at MSRI is supported in part by NSF grant #DMS-9022140. 1

Graph-based Logic and Sketches I: The General Framework

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Graph-based Logic and Sketches I: The General Framework

Graph-based Logicand Sketches I:

The General Framework

Atish Bagchi¤ and Charles Wells

Revised April 22, 1997

1 Introduction

Sketches as a method of speci¯cation of mathematical structures are analternative to the string-based speci¯cation employed in mathematical logic.They have been proposed as suitable for the speci¯cation of data types andprograms [Gray, 1987], [Gray, 1989], [Wells and Barr, 1988], [Duval andS¶en¶echaud, 1994], and some work on implementation has been carried out[Gray, 1990], [Duval and Reynaud, 1994a], [Duval and Reynaud, 1994b].The second author [Wells, 1990] proposed a generalization of sketches called\forms" with an eye toward using them to specify programming languages.Forms were generalized to 2-categories by Power and Wells [1992] (wherethe word \sketch" was used instead of \form"). Other generalizations ofsketches are given in [Lair, 1987], [Makkai, 1993a] and [Kinoshita et al.,1997].

Sketch theory has been criticized as being lacunary when contrasted withlogic because it apparently has nothing corresponding to proof theory. Thisarticle provides an explicit proof-theoretic structure for sketches and forms.It is written in an innovative style using some of the ideas for presentingmathematics outlined in [Bagchi and Wells, 1996].¤The ¯rst author is grateful to the Mathematical Sciences Research Institute for pro-

viding the opportunity to work on this paper there. Research at MSRI is supported inpart by NSF grant #DMS-9022140.

1

Page 2: Graph-based Logic and Sketches I: The General Framework

1.1 PrerequisitesThis article requires familiarity with the basic notions of mathematical logicas in Chapters 2 through 5 of [Ebbinghaus et al., 1984], and with categorytheory and sketches as in Chapters 1 through 10 of [Barr and Wells, 1995].We speci¯cally presuppose that ¯nite-limit sketches are known. Some nota-tion for these ideas is established in Section 4.

1.2 String-based logicTraditional treatments of formal logic provide:

1. A syntax for formulas. The formulas are typically de¯ned recursivelyby a production system (grammar).

2. Inference relations between sets of formulas. This may be given bystructural induction on the construction of the formulas.

3. Rules for assigning meaning to formulas (semantics) that are soundwith respect to the inference relation. The semantics may also begiven by structural induction on the construction of the formulas.

First order logic, the logic and semantics of programming languages, andthe languages that have been formulated for various kinds of categories areall commonly described in this way. The formulas in those logics are stringsof symbols that are ultimately modeled on the sentences mathematiciansspeak and write when proving theorems.

1.3 Graph-based logicMathematicians with a category-theoretic point of view frequently state andprove theorems using graphs and diagrams. The graphs, diagrams, conesand other data of a sketch or form are formal objects that correspond to thegraphs and diagrams used by such mathematicians in much the same way asthe formulas of traditional logic correspond to the sentences mathematiciansuse in proofs.

The functorial semantics of sketches and forms corresponds to item 3in the list in Section 1.2. This semantics is sound in the informal sensethat it preserves by de¯nition the structures given in the sketch or form.The analogy to the semantics of traditional model theory is close enoughthat sketches and forms and their models ¯t the de¯nition of \institution"([Goguen and Burstall, 1986]), which is an abstract notion of a logical system

2

Page 3: Graph-based Logic and Sketches I: The General Framework

having syntactic and semantic components. This is described in detail forthe case of sketches in [Barr and Wells, 1995], Section 10.3. Note that thesoundness of functorial semantics appears trivial when contrasted with theinductive proofs of soundness that occur in string-based logic because thesemantics functor is not de¯ned recursively.

1.4 OverviewThis paper exhibits a structure in the theory of sketches and forms thatcorresponds to items 1 and 2 in the description of logic in Section 1.2. Thedata making up the structure we give do not correspond in any simple wayto the data involved in items 1 and 2 of traditional logic; we discuss therelationship in Section 9.1.

The data in our structure are parametrized by the type of categorialtheory being considered. Let E denote a ¯nite-limit sketch that presents atype of category as essentially algebraic over the theory of categories. LetE denote the ¯nite-limit theory generated by E . E-categories are then themodels of E in the category of sets. (This is described in Section 5.) Thekinds of categories that can be described in this way include categories withspeci¯ed ¯nite products, categories with speci¯ed limits or colimits over anyparticular set of diagrams, cartesian closed categories, regular categories,toposes, and many others (always with speci¯ed structure rather than struc-ture determined only up to isomorphism | see Section 11). Finite limitsketches for several speci¯c instances of E are given in Appendix C.

An E-form F is a graph-based structure that allows the speci¯cation ofany kind of construction that can be made in any E-category. A model ofF in an E-category is, informally, an instance of that construction in(see the remarks in 4.3). Forms are de¯ned precisely in Section 6. Ordinarysketches can also be realized as forms.

As an example, let CCC be a ¯nite-limit theory for Cartesian closedcategories (one is outlined in Appendix C.6). It is possible to require that acertain object in a CCC-form F be the \formal function space" AB of twoother objects A and B of the form. This means that in any model M of theform in , the value of M(AB) is in fact the function space M(A)M(B) in

. The object AB is not itself a function space; it is an object of a form(that is, a generalized sketch), not of a Cartesian closed category. That iswhy it is called a formal function space.

Forms have much more expressive power than sketches as originallyde¯ned by Ehresmann, in which only limits and colimits can be speci¯ed.

3

Page 4: Graph-based Logic and Sketches I: The General Framework

An E-form F is determined by a freely adjoined global element Name[F ]of the limit vertex of a diagram in E, obtaining a category SynCat[E;F ].More details are in Section 6.1. An assertion in this setting is a potentialfactorization (PF) of an arrow of the SynCat[E;F ] through an arrow into itscodomain (de¯ned precisely in Section 7.1). The assertion is valid if the PFdoes indeed factorize in every model of SynCat[E;F ].

Instead of the set of rules of deduction of a traditional theory, we havea set of rules of construction. More precisely, we give in Appendix B asystem of construction rules that produce all the objects and arrows of thecategorial theory of a ¯nite-limits sketch. These rules apply in particular toSynCat[E;F ], which is constructed in 6.1.4 as such a categorial theory.

We say that the potential factorization is deducible if there is an actualfactorization in SynCat[E;F ]. Such an arrow must be constructible by therules in Appendix B. Thus the usual system of inference is replaced by asystem of construction of arrows in the ¯nite-limit category SynCat[E;F ] (nomatter what type of category is sketched by E). This system is sound andcomplete with respect to models (Section 7.2).

The fact that we have assumed ¯nite-limit sketches as given prior to thegeneral de¯nition of E-form is basic to the strategy of the paper, which is tomake ¯nite-limit logic the basic logic for all forms (Section 9). The variationin what can be proved, for example for ¯nite-product forms (E-forms whereE = FinProd as in Appendix C.3) as contrasted with cartesian closed forms(E is CCC as in Appendix C.6) is entirely expressed by the choice of E andhas no e®ect on the rules of construction.

Our approach, which uses diagrams and mappings between diagramsinstead of strings of symbols, perhaps seems unusual from the point of viewof symbolic logic. It contrasts with the classical string-based formalism intwo ways. On the one hand, our formalism exhibits explicitly much moredetail about the relationships between di®erent parts of the structure. Onthe other, our formalism is very close to the way it would be representedin a modern computer language as compared to string-based formulas. Adiagram, for example, exhibits in its nodes and arrows all the data necessaryfor a direct translation into an object in an object-oriented programminglanguage. Thus the arrow lam of CCC{ 3 (in Appendix C.6) can be directlyrepresented in a program object as the method that yields the exponentialadjoint of an arrow in a Cartesian closed category. In contrast, a formula in¯rst order logic requires a rather sophisticated parser to translate it into adata structure on which a program can operate. Parsing is well-understood,but it results in a computer representation (for example as a tree or as

4

Page 5: Graph-based Logic and Sketches I: The General Framework

reordered tokens on a stack) that is very di®erent from the formula before itis parsed. Thus the approach via diagrams has some of the advantages (forexample, transparent translation into a programming object) and some ofthe disadvantages (for example, more of the structure is explicit) of assemblylanguage versus high level languages. (See Remarks 2.3.9 and 8.3.4 for morealong these lines.)

Our approach thus provides a ¯rst step toward a theory that is directlyimplementable for the purposes of computation, and will, we hope, form thebasis for a sound methodology for implementing categorial approaches tocomputation.

1.5 GlossaryThis article introduces a large number of structures with confusingly similarroles. We list the most important here with a reference to the section inwhich they are de¯ned.

² LinTh[L], 4.1.

² FLTh[S] , 4.2.5.

² E (= FLTh[E ]), 5.1.

² SynCat[E;F ], 6.1.

² CatTh[E; F ], 6.2.3.

1.6 AcknowledgmentsThis article is better because of conversations we have had with Robin Cock-ett and Colin McLarty. We are grateful to Frank Piessens and the refereesfor careful readings of an earlier version of the manuscript that uncoverederrors, and to Max Kelly, Anders Kock and Steve Lack for supplying refer-ences. The names \string-based logic" and \graph-based logic" were sug-gested by Peter Freyd. The diagrams were prepared using K. Rose's xypic.

2 Notation

The notation established in this section is used throughout the article.

5

Page 6: Graph-based Logic and Sketches I: The General Framework

2.1 ListsGiven a set A, List[A] denotes the set of lists of elements of A, includingthe empty list. The kth entry in a list w of elements of A is denoted by wkand the length of w is denoted by Length[w]. If f : A ! B is a function,List[f ] : List[A]! List[B] is by de¯nition f \mapped over" List[A]: If w is alist of elements of A, then the kth entry of List[f ](w) is by de¯nition f(wk).This makes List a functor from the category of sets to itself.

2.2 GraphsFor a graph G, the set of nodes of G is denoted by Nodes[G] and the setof arrows is Arrows[G]. The underlying graph of a category is denotedby UndGr[ ]. A subgraph H of a graph G is said to be full if every arrowf : h1 ! h2 of G between nodes of H is an arrow of H.

2.3 Diagrams2.3.1 De¯nition If ± :I ! G and ±0 :I 0 ! G are graph homomorphisms,then ± is equivalent to ±0 if and only if there is a graph isomorphism Á:I ! I 0

such that

I I 0

G

Á

± ±0(1)

commutes.

This relation is easily seen to be an equivalence relation on the set ofgraph homomorphisms into a graph G.

2.3.2 De¯nition A diagram in G is by de¯nition an equivalence classof graph homomorphisms ± : I ! G.

As is the practice when an object is de¯ned to be an equivalence class,we will refer to a diagram by any member of the equivalence class.

2.3.3 De¯nition If ± :I ! G is a diagram, I is said to be a shape graphof the diagram, denoted by ShpGr[±], andG is said to be the ambient spaceof the diagram, denoted by AmbSp[±].

Observe that the ambient space of the diagram is determined absolutely,but the shape graph is determined only up to an isomorphism that makesDiagram (1) commute.

6

Page 7: Graph-based Logic and Sketches I: The General Framework

2.3.4 De¯nition Let I be a graph and a category. To say that ±is a diagram in means that ± : I ! UndGr[ ] is a diagram. We write± : I ! to denote this situation.

Note that is part of the de¯nition: there could be another categorywith the same underlying graph.

2.3.5 De¯nition A diagram ± : I ! in a category commutes ifwhenever (f1; : : : ; fn) and (g1; : : : ; gm) are two paths in I with the samesource and target, then

±(gm)±±(gm¡1)± ¢ ¢ ¢ ±±(g1) = ±(fn)±±(fn¡1)± ¢ ¢ ¢ ±±(f1)

in .

Observe that commuting is de¯ned only for diagrams in a category. Moredetails about this may be found in [Barr and Wells, 1995], Section 4.1.5.

2.3.6 Convention on drawing diagrams It is customary to draw adiagram without naming its shape graph. We adopt the following conven-tion: If a diagram is represented by a drawing, the shape graph of thediagram is the graph that has one node for each object shown in the draw-ing and one arrow for each arrow shown, with source and target as shown.Two objects at di®erent locations in the drawing correspond to two di®erentnodes of the shape graph, even if the objects have the same label, and ananalogous remark applies to arrows.

2.3.7 Example The diagram (2)

A A

B B

g

f

g

Id[B]

(2)

called ±, has shape graph

h i

j k

u

t

v

x

(3)

7

Page 8: Graph-based Logic and Sketches I: The General Framework

so that ±(h) = A, ±(i) = A, ±(v) = g, ±(x) = Id[B] and so on. Diagram (4)below also has shape graph (3) (or one isomorphic to it, of course):

A B

C D

g

f

h

k

(4)

On the other hand, Diagram (5) below

A A

Bg

f

g(5)

is not the same diagram as (2). It has shape graph

i j

kv

u

w (6)

2.3.8 Remark The reader should observe that we use \diagram" and\commutative diagram" both in the object language and the metalanguage.For example, in Section 2.3 we refer to Diagram (1), which must commutein the category of graphs. Note that we did not mention its shape graph,but according to the principles just enunciated that shape graph must be(isomorphic to)

i j

k

u

v w (7)

2.3.9 Remark Diagrams are customarily drawn as planar or nearly pla-nar graphs or as perspective representations of three-dimensional graphs. Awell-drawn graph provides a lot of information quite e±ciently to humanbeings and at the same time shows more of the structure than the formulasof traditional logic commonly do. Nevertheless, the details of the representa-tion (nearness to planarity, symmetry when possible, and so on) that aid inhuman understanding are not part of the abstract structure of the diagramat all.

8

Page 9: Graph-based Logic and Sketches I: The General Framework

2.4 ConesFor any graph G and diagram ± : I ! G, a cone £ : v (± : I ! G) (alsowritten £ : v ± if the context makes this clear) has vertex v denotedby Vertex[£] and base diagram ± denoted by BsDiag[£]. For each nodei of ShpGr[±], the formal projection of the cone £ from Vertex[£] to ±(i) isdenoted by Proj[£; i] :v ! ±(i). For a category , a cone £:v (± :I ! )is commutative if, for every arrow f : i! j in I , the diagram

Vertex[£]

±(i) ±(j)

Proj[£; i] Proj[£; j]

±(f)

(8)

commutes.In the following, we are concerned with categories with speci¯ed ¯nite

limits. In such categories, the speci¯ed limit cone of a diagram ± will bedenoted by LimCone[±] : Lim[±] ±. This speci¯cally applies to Rule 9LIMof B.1.

2.5 FontsIn general, variable objects are given in slant or script notation and speci¯cobjects (given by proper names) are given in upright notation. In moredetail, we have the following systematic notation.

1. Speci¯c data constructors, such as List, and speci¯c ¯eldnames forcomplex objects, such as Nodes[G], are given in sans serif and arecapitalized as shown.

2. Speci¯c objects and arrows of sketches or forms are also given in sansserif.

3. Speci¯c constructor spaces, such as FinLim and CCC, are given in boldsans serif. We use E to denote a variable constructor space becauseof the unavailability of bold slanted sans serif.

4. Speci¯c categories other than constructor spaces, such as Set, aregiven in boldface.

5. Diagrams (speci¯c and variable) are named by lowercase Greek letters.

6. Cones (speci¯c and variable) are named by uppercase Greek letters.

9

Page 10: Graph-based Logic and Sketches I: The General Framework

7. Models (speci¯c and variable) are given in uppercase fraktur, for exam-ple M, C.

8. Variable sketches and forms are given in slanted sans serif.

9. Variable categories other than constructor spaces are given in script,for example , , .

10. Other variable objects are given in math italics, such as a, b, c or(especially arrows) in lowercase Greek letters.

3 On diagrams

In this section, we develop some techniques for dealing with limits of dia-grams that are used extensively in the examples.

3.1 Morphisms of Diagrams3.1.1 De¯nition A morphism of diagrams (Ã;®) : (± : I ! G) !(±0 : I 0 ! G) is a graph morphism à : I ! I 0 together with a naturaltransformation ® : ±0 ±Ã ! ±.

3.1.2 Remark It is easy to see that this de¯nition of morphism of dia-grams is compatible with the equivalence relation that de¯nes diagrams.It was ¯rst given by Eilenberg and Mac Lane [1945] and studied furtherin [Kock, 1967, Guitart, 1974, Guitart and Van den Bril, 1977]. It is notthe same notion of morphism of diagrams as that of [Barr, 1971], page 52,studied in [Tholen and Tozzi, 1989].

3.1.3 De¯nition A strict morphism of diagrams à : (± : I ! G)!(±0 : I 0 ! G) is a graph morphism à : I ! I 0 for which the diagram

I I 0

G

Ã

± ±0(9)

commutes.

3.1.4 Remark A strict morphism of diagrams is a special case of mor-phism of diagrams (set ® to be the inclusion). All applications in this articleuse strict morphisms only.

10

Page 11: Graph-based Logic and Sketches I: The General Framework

3.1.5 Proposition Let (Ã;®):(± :I ! )! (±0 :I 0 ! ) be a morphismof diagrams in a category . Given a commutative cone

£0 : Vertex[£0] (±0 : I 0 ! )

there is a commutative cone

£ : Vertex[£] (± : I ! )

with the following properties:

a) Vertex[£] = Vertex[£0]

b) For every i 2 Nodes[I ], Proj[£; i] = ®i± Proj[£0; Ãi].

Proof That £ is commutative follows from the fact that Vertex[£] =Vertex[£0] and the fact that for every f : i ! j in I , the following diagramcommutes because £0 is commutative and ® is natural.

±0Ãi ±i

Vertex[£0]

±0Ãj ±j

®i

±0Ãf ±f

Proj[£0; Ãi]

Proj[£0; Ãj]®j

(10)

3.1.6 Corollary Let (Ã;®) : (± : I ! G)! (±0 : I 0 ! G) be a morphismof diagrams. Then there is a unique arrow Á : Lim[±0]! Lim[±] for which forall nodes i of I,

Lim[±0] Lim[±]

±0Ãi ±i

Á

Proj [Lim[±0]; Ãi] Proj [Lim[±]; i]

®i

(11)

Proof This follows from Proposition 3.1.5 by letting £0 := LimCone[±0]and then setting Á to be the ¯ll-in arrow from £ to Lim[±], where £ is thecone de¯ned in Proposition 3.1.5.

11

Page 12: Graph-based Logic and Sketches I: The General Framework

3.1.7 Remark When the target of the diagrams is a category with¯nite limits, the preceding constructions make Lim a contravariant functorfrom the category of diagrams to .

3.2 Restrictions of diagrams3.2.1 De¯nition Let ± : I ! be a diagram and Incl[J µ I] : J ! I aninclusion of graphs. The restriction of ± to J , denoted by ±jJ , is ±± Incl[J µI ] : J ! . ±jJ is called a subdiagram of ±.

3.2.2 Remark Incl[J µ I ] is a strict morphism of diagrams from ±jJ to±.

3.2.3 De¯nition Let ± : I ! be a diagram and Incl[J µ I] : J ! I aninclusion of graphs. Let £ : v ± be a cone. The base-restriction of £to J is de¯ned to be the cone £jJ : v (±± Incl[J µ I ]) with vertex v andprojections de¯ned by Proj[£jJ ; j] := Proj[£; j] : v ! ±(j) for all nodes j ofJ . In this case, we also say that £ is a base-extension of £jJ .

3.2.4 Remark If £ is commutative, then so is £jJ .

3.2.5 De¯nition Let ± : I ! be a diagram and J a subgraph of I .Then the subdiagram ±jJ is said to dominate ±, or to be dominant in ±,if every commutative cone £ : v (±jJ) in has a unique base extensionto a commutative cone £0 : v ± with the same vertex.

3.2.6 Remark Tholen and Tozzi [1989] give a condition (\con¯nality")on I and J such that any diagram based on I is dominated by its restrictionto J . One type of dominance that their condition does not cover is the casein which ± is obtained from ±jJ by adjoining a limit cone over a subdiagramof ±jJ (see Section 3.4.)

3.2.7 Remark Some of the de¯nitions and lemmas in Section 3.3 havevariants in which one has graph homomorphisms rather than inclusions. Weshall not, however, need these.

3.3 Limits of subdiagrams3.3.1 Lemma Let ± : I ! be a diagram and let J be a subgraph ofI with inclusion Incl[J µ I ]. Let ° = ±jJ . Then there is a unique arrow

12

Page 13: Graph-based Logic and Sketches I: The General Framework

Á : Lim[±]! Lim[°] such that for all nodes j of J ,

Lim[±] Lim[°]

±(j)

Á

Proj[LimCone[±]; j] Proj[LimCone[°]; j](12)

commutes. Moreover, if ° is a dominant subdiagram of ±, then Á is anisomorphism.

Proof The existence and uniqueness of Á is a special case of Corol-lary 3.1.6.

Now assume that ° dominates ±. Let ª : Lim[°] ± be the uniqueextension of LimCone[°] to ±. Using 9FIA of Appendix B, we de¯ne

à := Fillin[ª; ±] : Lim[°]! Lim[±]

It follows from !FIA of Appendix B that à is the only arrow from Lim[°] toLim[±] that makes all diagrams of the form

Lim[°] Lim[±]

°(j)

Ã

Proj[ª; j] Proj[LimCone[±]; j]](13)

commute for each node j of J . Since Á±Ã : Lim[°]! Lim[°] and Id[Lim[°]] :Lim[°] ! Lim[°] both commute with all the projections to nodes of J , itfollows from !FIA that Á±Ã = Id[Lim[°]], A similar argument shows thatñÁ = Id[Lim[±]], so that Á is an isomorphism.

3.4 Special cases of extending diagramsHere we de¯ne some special cases of dominance that are easy to recognize.

3.4.1 De¯nition Let graphs I and J be given such that J µ I and I andJ have the same nodes, and suppose that I has exactly one arrow a : j ! knot in J . Let ± : I ! be a diagram with the property that for all nodesj0 of J and all arrows f : j ! j0 and g : j0 ! k,

±(j) ±(k)

±(j0)

±(a)

±(f) ±(g)(14)

13

Page 14: Graph-based Logic and Sketches I: The General Framework

commutes in . Then we say ± extends ±jJ by adjoining a composite.

3.4.2 De¯nition Let I and J be graphs with the following properties:

ACC.1 J µ I .

ACC.2 I has exactly one node v not in J .

ACC.3 I has at least one arrow not in J .

ACC.4 Every arrow in I not in J has target v.

Suppose that ± : I ! is a diagram with the property that if a : i ! v,b : j ! v and f : i! j are arrows of I, then

±(i) ±(v)

±(j)

±(a)

±(f) ±(b)(15)

commutes. Then we say ± extends ±jJ by adjoining a commutativecocone.

3.4.3 De¯nition Let I , J and J 0 be graphs with J 0 µ J µ I, such thatJ 0 is full in J , I contains exactly one node v not in J , and for each node jof J 0, I contains exactly one arrow pj : v ! j and no other arrows not in J .Let ± : I ! be a diagram, and suppose further that ± extends ±jJ in sucha way that ±(v) and the arrows ±(pj) constitute a limit cone to ±jJ 0 . Thenwe say that ± extends ±jJ by adjoining a limit.

3.4.4 De¯nition Let I be a graph and let ± : I ! be a diagram. LetJ 0 be a nonempty subgraph of I and let £ : v ±jJ 0 and ª : w ±jJ 0 becommutative cones for which

a) £ is a limit cone.

b) Each projection Proj[£; i] and Proj[ª; i] is a composite of arrows in theimage of ± (it follows that v and w are in the image of ±.)

Let Á :w! v be the unique ¯ll-in arrow given by the de¯nition of limit, andsuppose f is an arrow of I for which ±(f) = Á. Let J be the subdiagramof I obtained by omitting f . Then ± extends ±jJ by adjoining a ¯ll-inarrow.

14

Page 15: Graph-based Logic and Sketches I: The General Framework

3.4.5 Lemma Suppose that ±0 : I ! extends ± :J ! by adjoining acomposite, a commutative cocone, a limit or a ¯ll-in arrow. Then

Fillin£LimCone[±0jJ ]; ±

¤: Lim[±0]! Lim[±]

is an isomorphism.

Proof We will show in each case that ±jJ dominates ±.In the case of adjoining a composite, it follows from the fact that all the

diagrams (14) must commute that a commutative cone over ±jJ is already acommutative cone over ±.

If ± extends ±jJ by adjoining a commutative cocone, then in the notationof De¯nition 3.4.2 any cone £:u ±jJ extends uniquely to a cone £0 :u ±by de¯ning Proj[£0; v] := ±(f )± Proj[£; i], where f : i ! v is an arrow of Inot in J .

If ± extends ±jJ by adjoining a limit, then in the notation of De¯-nition 3.4.3, £ : u ±jJ extends uniquely to £0 : u ± by de¯ningProj[£0; v] := Fillin [£0; ±jJ 0 ].

Finally, suppose ± extends ±jJ by adjoining a ¯ll-in arrow. By repeatedlyadjoining composites we can assume ± has the property that every projectionarrow Proj[£; i] and Proj[ª; i] (notation as in De¯nition 3.4.4) is in the imageof ±. (We are using the fact that dominance is transitive, which is easy toshow.) Now let © : x ±jJ be a commutative cone and let ±(m) = v,±(n) = w. It is necessary and su±cient to show that the diagram

w

x

v

±f

Proj[©; n]

Proj[©; m]

(16)

commutes.

15

Page 16: Graph-based Logic and Sketches I: The General Framework

For every arrow g : j ! j 0 of J 0, we have a diagram

w ±(j)

x

v ±(k)

±f

Proj[ª; j]

Proj[ª; k]

±(g)

Proj[©; n]

Proj[©;m] Proj[£; j]

Proj[£; k]

(17)

Let the cone ª0 : x ±jJ 0 be de¯ned by requiring that

Proj[ª0; j] = Proj[ª; j]± Proj[©; n]

for every node j of J 0. The upper right triangle of Diagram (17) commutesbecause ª is a commutative cone. It follows that ª0 is a commutativecone. We now prove that both Proj[©;m] and ±f ± Proj[©; n] satisfy therequirements of Fillin[ª0; ±jJ 0 ] in the notation of of Appendix B. It willfollow from rule !FIA in that Appendix that Diagram (16) commutes, asrequired.

a) We must show that for all nodes j of J 0,

Proj[ª; j]± Proj[©; n] = Proj[£; j]± Proj[©;m]

This follows from the fact that © is a commutative cone to J andJ 0 µ J .

b) We must show that for all nodes j of J 0,

Proj[£; j]±±f ± Proj[©; n] = Proj[ª; j]± Proj[©; n]

This follows from the fact that the upper left triangle inside the rect-angle in Diagram (17) commutes because ±f is a ¯ll-in arrow.

16

Page 17: Graph-based Logic and Sketches I: The General Framework

4 Linear and ¯nite-limit sketches

We use a general concept of form described in Section 5 that is based onthe concept of ¯nite limit sketch, a particular case of projective sketch dueto Ehresmann. In this section, we review brie°y some aspects of linear and¯nite-limit sketches that are relevant later.

4.1 Linear sketches4.1.1 De¯nition A linear sketch L is a pair (Graph[L];Diagrams[L])where Graph[L] is a graph and Diagrams[L] is a set of ¯nite diagrams inGraph[L].

4.1.2 De¯nition The linear theory generated by a linear sketch Lis the category obtained from the free category generated by Graph[L]by imposing the least congruence relation that makes the diagrams inDiagrams[L] commute. Here we call the linear theory LinTh[L].

4.1.3 De¯nition The universal model of a linear sketch L, denotedby LinUnivMod[L] :L! LinTh[L], is the morphism of sketches whose under-lying morphism is the induced graph homomorphism (quotient map) fromGraph[L] to the graph UndGr

hLinTh[L]

i.

4.2 Finite-limit sketches and their theories4.2.1 De¯nition A ¯nite-limit sketch S is a triple

(Graph[S];Diagrams[S ];Cones[S])

where Graph[S ] is a graph, Diagrams[S ] is a set of ¯nite diagrams in Graph[S],and Cones[S] is a set of cones in Graph[S], each to a ¯nite diagram in Graph[S ](which need not be in Diagrams[S ]).

4.2.2 De¯nition For ¯nite-limit sketches S and S 0, a sketch mor-phism m : S ! S 0 is a graph homomorphism m : Graph[S] ! Graph[S 0]that takes the diagrams in Diagrams[S] to diagrams in Diagrams[S 0] and thecones in Cones[S ] to cones in Cones[S 0].

4.2.3 De¯nition A model M of a ¯nite-limit sketch S in a categoryis a graph homomorphism M : Graph[S ]! UndGr[ ] that takes the diagramsin Diagrams[S] to commutative diagrams in and the cones in Cones[S] tolimit cones in .

17

Page 18: Graph-based Logic and Sketches I: The General Framework

4.2.4 De¯nition The forgetful functor UndSk from the category ofsmall categories with ¯nite limits and ¯nite-limit preserving functors tothe category of ¯nite-limit sketches takes a category to (UndGr[ ];D; L)where D is the set of all ¯nite commutative diagrams in and L is the setof all limit cones in to ¯nite diagrams in .

4.2.5 Categorial theories of ¯nite-limit sketches

4.2.6 De¯nition Let S be a ¯nite-limit sketch. The ¯nite-limit the-ory generated by S , denoted by FLTh[S], is a category with ¯nite limitstogether with a model

FLUnivMod[S ] : S ! FLTh[S ]

called the universal model of the sketch. It has the following property:For each model M of S, there is a ¯nite-limit preserving functor FLTh(M) :FLTh[S] ! Set, determined uniquely up to natural isomorphism, with theproperty that

S UndSk [FLTh[S]]

UndSk[Set]

FLUnivMod[S]

MUndSk [FLTh[M]] (18)

commutes.

4.2.7 Remark It follows from the de¯ning properties that FLTh[S] isdetermined up to equivalence of categories and FLUnivMod[S] is determinedup to natural isomorphism.

4.2.8 A speci¯c choice of FLTh[S ] In this article, for a given ¯nite-limit sketch S, we assume given a particular instance of FLTh[S]: that con-structed in Appendix A. It has the following properties (which are notpreserved by equivalence of categories):

T.1 FLTh[S] is a category with speci¯ed ¯nite limits. (The constructionexplicitly produces the speci¯ed limits.)

T.2 Every arrow of FLTh[S ] is a composite of projections from speci¯edlimits, ¯ll-in arrows and arrows of the form FLUnivMod[S ](f ) for arrowsf of the graph of S.

18

Page 19: Graph-based Logic and Sketches I: The General Framework

The following proposition is signi¯cant for this paper when FLTh[S] istaken to be SynCat[E;F ] (de¯ned as a particular ¯nite-limit theory in 6.1.2below), where F is a form.

4.2.9 Proposition For a given sketch S , every object and every arrowof FLTh[S ] is constructible by repeated applications of the constructions ofAppendix B to the objects and arrows of the sketch S.

Proof This proof depends on the speci¯c choice of FLTh[S ] de¯ned in 4.2.8.It is clearly closed under all the constructions of Appendix B. The propertieslisted in 4.2.8 imply that FLTh[S] is minimal with respect to the construc-tions of that Appendix, so that in fact those constructions can be taken asan recursive de¯nition of FLTh[S].

4.2.10 Remark It is also true by Lemma A.3.5 that every object ofFLTh[S] is the limit (not necessarily speci¯ed) of a diagram of the formFLUnivMod[S ]±± where ± is a diagram in the graph of S . This latter property,of course, is preserved by equivalences of categories that commute with theuniversal model.

4.2.11 Notation It is clear that FLTh is a functor from the categoryof ¯nite-limit sketches and sketch morphisms to the category of ¯nite-limitcategories and ¯nite-limit preserving functors. For any ¯nite-limit sketch Sand morphism ´ :S ! T of sketches, the induced functor between categorialtheories will be denoted by

FLTh[´] : FLTh[S]! FLTh[T ]

4.3 Remark concerning modelsCategory theorists commonly use the name of a category to refer indif-ferently to any equivalent category. A related phenomenon occurs withrespect to models, as we discuss. This paper is concerned with syntax, andit is necessary for clarity if not for strict correctness to distinguish betweenmathematical constructions that would be regarded as the \same" by manycategory theorists.

Let Cat be the ¯nite-limit sketch for categories of Appendix C.2. Wemay consider the following three mathematical entities.

1. Some small category of one's choice.

19

Page 20: Graph-based Logic and Sketches I: The General Framework

2. A model C of the sketch Cat in the category of sets which \is" or \rep-resents" . This means that C is a morphism of ¯nite-limit sketchesfrom Cat to an underlying ¯nite-limit sketch of Set with the propertythat C(ob) is the set of objects of , C(ar) is the set of arrows of ,C(comp) is the composition function of (up to natural isomorphism),and so on. C is determined uniquely by if one assumes that Set hasspeci¯ed ¯nite limits. It is determined up to natural isomorphism inany case.

3. The model FLTh[C] of FLTh[Cat] induced by C according to Sec-tion 4.2.5. This is a ¯nite-limit-preserving functor from FLTh[Cat] toSet.

For many category theorists, and C denote the \same thing". Othermathematicians would disagree, saying is a category (presumably for them\category" has some meaning other than \model for the sketch for cate-gories") and C is a morphism of sketches, so how could they be the samething? This di®erence in point of view occurs in other situations involvingmodels; for instance, is (N;+) (the natural numbers with addition as oper-ation) a model of the axioms for a group, or is it correct to say that thereis a model for the group axioms that \corresponds" to (N;+)?

The distinction between C and FLTh[C] is slightly di®erent. The ¯rstmight be described as presentation data for the second. Since Lawvere,many category theorists take the view that an algebraic structure consistsof the entire clone of operations rather than some generating subset. Fromthat point of view, the category is the \same as" FLTh[C] rather than thesame as C. Similarly, from the Lawverean perspective the group discussedin the previous paragraph is determined by saying N is its underlying setand + is its operation, but the group is the entire clone. (This must bedistinguished from the relationship between a group and its presentationby generators and relations, although of course there is an analogy betweenthose two situations.)

Similar remarks apply to the analogous constructions obtained when Catis replaced by an arbitrary ¯nite limit sketch.

In any case the following three categories are equivalent:

1. The category of small categories and functors.

2. Mod[Cat;Set], the category of models of the sketch Cat in the cate-gory Set with natural transformations as morphisms.

20

Page 21: Graph-based Logic and Sketches I: The General Framework

3. The category of ¯nite-limit-preserving functors from FLTh[Cat] to Setwith natural transformations between them as morphisms.

In the sequel, we will distinguish between these constructions typograph-ically as an aid to reading the paper. We continue the discussion of thissection about similar constructions in Sections 5.2, 6.2 and 6.3.

5 Constructor spaces

We provide here a de¯nition of \form" (generalized sketch) based on [Wells,1990]. Some of the terminology has been changed. A form is a generalizationof the concept of sketch invented by Charles Ehresmann and described in[Bastiani and Ehresmann, 1972] or in [Barr and Wells, 1995]. The de¯nitionsbelow presuppose the concept of ¯nite-limit sketch (see Sections 1.1 and 4).

5.1 Constructor spaces5.1.1 Assumptions We will assume given a ¯xed ¯nite-limit sketch Catwhose category of models is the category of small categories and functors.A speci¯c such sketch is given explicitly in Appendix C.2. The presentationthat follows has Cat as an implicit parameter.

5.1.2 De¯nition A ¯nite-limit sketch E together with a morphism ´ :Cat ! E of sketches is called a constructor space sketch provided thatevery object in FLTh[E ] is the limit of a ¯nite diagram whose nodes are ofthe form FLTh[´](n), where n is a node of Cat. The morphism ´ is denotedby CatStruc[E ] : Cat! E .

5.1.3 Remark The notation \CatStruc" abbreviates \categorial struc-ture".

De¯nition 5.1.2 is more general than De¯nition 4.1.2 in [Wells, 1990] inthat CatStruc[E ] need not be an inclusion. However, in all the examples inthis article, FLTh[CatStruc[E ]] is injective on objects.

5.1.4 De¯nition A category of the form FLTh[E ] for some constructorspace sketch E is called a constructor space.

5.1.5 Notation We will normally denote the constructor space FLTh[E ]by E (note the di®erence in fonts). In particular, we have the constructorspace Cat corresponding to the constructor space sketch Cat given in C.2.For this example, CatStruc[Cat] : Cat! Cat is the identity functor. For the

21

Page 22: Graph-based Logic and Sketches I: The General Framework

constructor spaces FinProd, FinLim and CCC constructed in Appendix C,the structure map is in each case inclusion.

5.1.6 De¯nition A model in Set of a constructor space E is called anE-category, and a morphism of such models is called an E-functor (seeSection 5.2).

5.1.7 Remarks Recall that a model of E is a ¯nite-limit preserving func-tor from E to Set, and a morphism of models is a natural transformationfrom one such functor to another.

Observe that CatStruc induces an underlying functor from the categoryof E-categories to the category of categories.

De¯nitions 5.1.2, 5.1.4 and 5.1.6 are essentially the same as those in[Wells, 1990], and are a special case (where all two cells are identities) of thetwo-dimensional version given in [Power and Wells, 1992].

5.2 Further remarks concerning modelsWe continue the discussion about models begun in Section 4.3. Construc-tor spaces FinProd (for categories with speci¯ed ¯nite products), FinLim(for categories with speci¯ed ¯nite limits) and CCC (for Cartesian closedcategories with speci¯ed structure) are given in Appendix C. The remarksconcerning models of Cat in Section 4.3 apply equally well to models of theseand other constructor spaces. Each model of CCC (for example) is a func-tor, but it corresponds to a speci¯c Cartesian closed category with speci¯edstructure whose objects, arrows, sources and targets, composition, binaryproduct structure and closed structure are all determined by the values (inthe model under consideration) of certain nodes and arrows of the sketchCCC. We will identify Cartesian closed categories and models in Set of CCCin the sequel, and similarly for other constructor spaces E. In particular aFinProd category is a category with speci¯ed ¯nite products and a FinLimcategory is a category with speci¯ed ¯nite limits.

The value in a model M of an object v in a constructor space is theset of all examples of a particular construction that is possible in the E-category M. Extended examples of this are discussed in Section 5.3 andSection 8. Thus each object of E represents a type of construction possiblein an E-category; hence the name \constructor space".

22

Page 23: Graph-based Logic and Sketches I: The General Framework

5.3 Notation for diagrams in a constructor spaceThe object of FLTh[Cat] whose value in a model is the set of all not neces-sarily commutative diagrams of the form

A B

C D

f

h

kxg

(19)

is the limit of the diagram

ar ob ar

ob ar ob

ar ob ar

source

target source

targetsource

targetsource

target source

target

(20)

Observe that FLTh[Cat] is the constructor space for unrestricted categories,so that Diagram (20) (more precisely, its image under CatStruc[E]) occursin any constructor space E.

We now describe this diagram in more detail and introduce some notationthat makes the discussion of such diagrams easier to follow. We use thenotation D(n) to refer to the diagram shown herein with label (n), andI(n) for its shape graph. For example, the limit of the diagram above isLim[D(20)].

Every node of D(20) is either the object ob (the object that becomes theset of objects in a model) or the object ar (the object that becomes the setof arrows in a model) of FLTh[Cat]. For a model C of FLTh[Cat] in Set, anelement of C(Lim[D(20)] is a diagram in C, not necessarily commutative, ofthe form of Diagram (19).

In order to make the relation between Diagrams (19) and (20) clear, we

23

Page 24: Graph-based Logic and Sketches I: The General Framework

give the shape graph of (20):

f C g

A x D

h B k

s

t s

ts

tst s

t

(21)

We have labeled the nodes of Diagram (21) by the objects and arrows thatoccur in Diagram (19) in such a way that the node named by an object orarrow of Diagram (19) will inhabit the value of that node in the model C. Forexample, the object A of C is at the upper left corner of Diagram (19) andthe projection arrow from C(Lim[D(20)]) to C(ob) determined by the nodelabeled A of the shape graph (21) is a function from the set of diagramsin C of the form of Diagram (19) to the set of objects of C that takes adiagram to the object in its upper left corner. The arrows of Diagram (21)are labeled in accordance to their values in Diagram (20). It is importantto understand that each distinct arrow in Diagram (21) is a di®erent arrowof the shape graph, whether they have di®erent labels or not.

We will combine diagrams such as Diagram (20) and their shape graphsinto one graph by labeling the nodes of the diagram by superscripts namingthe corresponding node of the shape graph. In the case of Diagram (20),doing this gives the following annotated diagram:

arf obC arg

obA arx obD

arh obB ark

source

target source

targetsource

targetsourcetarget source

target

(22)

Here, the superscript A on the leftmost node indicates that the correspond-ing node of the shape graph is labeled A. Formally, the expression obA isused as the label for the node ±(A) and its use signi¯es that ±(A) = ob.That device helps the reader to see that Diagram (19) is indeed an elementof C(Lim[D(20)]).

24

Page 25: Graph-based Logic and Sketches I: The General Framework

For example, the particular arrow h of Diagram (19) is an element of ar,and the label arh in Diagram (22) helps one see that it is that node thatprojects to h in the model C and that the source of h is A and that thetarget is B.

It is important to understand that an annotated diagram such as (22)denotes precisely the same diagram as (20). The fact that one node islabeled obA and another obB does not change the fact that both nodes areob. The superscript merely gives information about the relation betweenDiagram (20) and Diagram (19).

Diagram (22) could also be drawn as the base of a limit cone £ withlimit Lim[D(22)] (which of course is the same as Lim[D(20)]) as follows.

Lim[±(20)]

arg arf arx ark arh

obC obB

obD obA

Proj[£; g]

Proj[£; f ]Proj[£; x]

Proj[£; k]

Proj[£; h]

source

target

source

target

source target

source

target

source

target

(23)

Because of the typographical complexity of doing this for diagrams morecomplicated than Diagram (22), we will usually give diagrams whose limitswe discuss in the form of Diagram (22), without showing the cone, insteadof in the form of Diagram (23).

Showing the cone explicitly as in Diagram (23) nevertheless has anadvantage. It makes it clear that many of the projection arrows fromLim[D(22)] are induced by others; in the particular case of Diagram (23),all the arrows to nodes labeled ob are induced by composing arrows to somenode labeled ar with source or target. Diagram (22) does not make thisproperty as easy to discover as Diagram (23) does.

A systematic method of translating from graphical expressions such asDiagram (23) to a string-based expression could presumably be based onthis, following the notation introduced in [Barr and Wells, 1985], page 38.

25

Page 26: Graph-based Logic and Sketches I: The General Framework

In the case of Diagram (23), the string-based expression would be somethinglike this:

[hg; f; x; k; hi j source(g) = C; target(g) = D; source(f) = A;target(f) = C; source(x) = C; target(x) = B; source(k) = B;

target(k) = D; source(h) = A; target(h) = B]

or in more familiar terms,

[hg; f; x; k; hi j g : C ! D; f : A! C; x : C ! B; k :B ! D;h : A! B]

6 Forms

In this section, we outline the those facts about forms needed in this paper.More complete treatments are in [Wells, 1990] and [Power and Wells, 1992].

6.1 Syntactic categories and formsLet E be a constructor-space sketch, E (which is FLTh[E ]) the constructorspace it generates, and ± : I ! Graph[E ] a diagram. We may freely adjoina global element Á : 1! Lim[±] to obtain a ¯nite-limit category, denoted byE[Á] in the literature and called a polynomial category.

6.1.1 De¯nition In the notation of the preceding paragraph, the E-form F determined by ± is the value I(Á) of a freely adjoined globalelement Á : 1! Lim[±], where I is the initial model of E[Á] in Set.

6.1.2 Notation If F is an E-form determined by ± as in the de¯nition,we write Name[F ] for Á. The diagram ± is called the description of F . Wedenote E[Name[F ]] by SynCat[E;F ] and call it the syntactic category ofF .

6.1.3 Remark The \E" in the notation SynCat[E; F ] is redundant, buthelpful as a reminder of which constructor space we are using.

6.1.4 Constructing SynCat[E;F ] One way of constructing SynCat[E;F ]is as follows: First adjoin Name[F ] to Graph[E ] to obtain a graph G. Thende¯ne the ¯nite-limit sketch S := (G;Diagrams[E ];Cones[E ]), and ¯nally setSynCat[E ; F ] := FLTh[S ]. The inclusion of Graph[E ] into G is a sketch mapfrom E to S and so generates a ¯nite-limits preserving functor Constants[F ] :E ! SynCat[E;F ]. This construction can cause considerable collapsing, forexample if one adjoins a global element of an initial object.

26

Page 27: Graph-based Logic and Sketches I: The General Framework

6.1.5 Remarks A model of E in Set (a ¯nite-limit preserving functorfrom E to Set) is an E-category. A model F of SynCat[E; F ] is an E categorytogether with a chosen element of F (Lim[±]), where ± is the description of Fas in 6.1.2.

The functor Constants induces a forgetful functor (it forgets the cho-sen element of F (Lim[±])) from set-valued (or more general) models ofSynCat[E;F ] to models of E.

Each object of SynCat[E; F ] is the limit of a diagram in E [Name[F ]] byLemma A.3.5, and the diagram is in some sense a description of a possibleconstruction in any model of the form F .

6.1.6 Example As an example, consider the ¯nite-limit sketch S withgraph

A B Cv

uf

(24)

one diagramB A

B

Id[B]

u

v (25)

and one coneB

A C

u f(26)

This is in fact a ¯nite-product sketch, but any such sketch is also a ¯nite-limit sketch. Then one way to capture the information in the sketch is totake ± to be the following diagram in FinLim and de¯ne the FinLim form Fdetermined by a freely adjoined constant Name[F ] : 1! Lim[±].

obA £ obC

aru cone arf obC

obA ar2 ar obB

arv

prod

target source

lproj rproj target

source

comp

lfac

rfac

unit

source target

(27)

27

Page 28: Graph-based Logic and Sketches I: The General Framework

This is however not the only way of viewing S as a FinLim-form, asexplained in 6.3.

6.2 Models of formsFor completeness, we de¯ne models of forms and their morphisms, and the-ories of forms, using the notation of this paper, but only brie°y since theseideas are not used in this paper. More detail and examples may be foundin [Wells, 1990] or [Power and Wells, 1992].

6.2.1 Remark We are in this section identifying a model of E with anactual category with structure imposed by E, and similarly for models ofSynCat[E;F ]. This is an example of the phenomenon mentioned in Sec-tions 4.3 and 5.2. See also Section 6.3.

6.2.2 Theories of forms Let F be an E-form with description ± :1! E,so that it is named by Name[F ] : 1! Lim[±]. Then SynCat[E;F ] is a ¯nite-limit theory and so has an initial model.

6.2.3 De¯nition The initial model of SynCat[E;F ] is called the E-theory of F , denoted by CatTh[E;F ].

6.2.4 Remark The form F is an element of the value of Lim[±] inCatTh[E;F ].

6.2.5 Remark Once a ¯nite-limit sketch S is captured as a form F asdescribed in Example 6.1.6, it follows that FLTh[S ] is naturally equivalentas a category to CatTh[FinLim; F ].

6.2.6 De¯nition A model of F in an E-category is de¯ned to bea model of SynCat[E;F ] with underlying E-category .

This means that is the value of the functor from models of SynCat[E;F ]to models of E that forgets the element corresponding to F | see Sec-tion 6.1.5.

Let M be a model of F with underlying E-category . Since CatTh[E;F ]is the initial model of F , there is a unique E-functor Á:CatTh[E;F ]! thattakes CatTh[E;F ](Name[F ]) to M(Name[F ]). In the case of familiar sketches,say ¯nite-limit or ¯nite-product sketches (corresponding to E = FinLim andE = FinProd respectively), that functor Á is what would usually be called

28

Page 29: Graph-based Logic and Sketches I: The General Framework

the functor from the theory induced by a model of the sketch. To de¯ne forforms the entities that correspond in those cases to the actual sketch andits models involves complications and is carried out in two di®erent ways in[Wells, 1990] and [Power and Wells, 1992].

Finally, a morphism of models of a form F in a category is simplya natural transformation between the functors Á and Á0 corresponding asdescribed in the previous paragraph to models M and M0 in .

A paper which made extensive use of the entities constructed in thissection would no doubt have to introduce more elaborate terminology andnotation (for example for Á) than is used here. However, this is peripheralto our concerns and we hope that this discussion is su±ciently detailed toobviate confusion.

6.3 Relationship between forms and sketchesThis section continues the discussion begun in Sections 4.3 and 5.2. Oneconstructor space is FinLim, de¯ned in Appendix C.5. A ¯nite-limit sketchS in the traditional sense (a graph with diagrams and cones) corresponds toa FinLim-form in the construction using the methods of Example 6.1.6 andhas the same models. The traditional ¯nite-limit sketch S is an element ofthe value in the initial model of a certain node v of FinLim (not uniquelydetermined by S) which is the limit of a generally large and complicateddiagram ± (not uniquely determined either by S or by v) in FinLim thatspeci¯es the graph, diagrams and cones of S.

These remarks apply to other types of Ehresmann sketches by replacingFinLim by the suitable constructor space.

7 Assertions in graph-based logic

7.1 Potential factorizations7.1.1 De¯nition Let F be an E-form. A diagram of the kind

D0

D00 D

f 0

f 00

(28)

in SynCat[E;F ] is called a potential factorization or PF.

29

Page 30: Graph-based Logic and Sketches I: The General Framework

7.1.2 De¯nition Suppose there are morphisms of diagrams (see 3.1.1)

±0

±00 ±

Á0

Á00

(29)

for which

a) ±, ±0 and ±00 are all diagrams in SynCat[E;F ].

b) D = Lim[±], D0 = Lim[±0] and D00 = Lim[±00].

c) f 0 is the ¯ll-in arrow induced by Á0 and f 00 is the ¯ll-in arrow inducedby Á00.

Then Diagram (29) is a description of the potential factorization (28).

By Lemma A.3.5, the description of a potential factorization can betaken to lie in the graph of the constructor space sketch E that generates E.There are in general many descriptions of a PF. The description is not partof the structure. We do not know of an example of a diagram of the formof (28) that we can prove does not have a description.

7.1.3 Notation We will use suggestive notation for a potential factor-ization, as exhibited in the diagram below.

claim

hyp wksp

claimcon

hypcon

(30)

The names hypcon, claimcon and wksp respectively abbreviate \hypothesisconstruction", \claim construction" and \workspace". The reason for thenames of the arrows and nodes is discussed in 8.3. In many examples,including all those in this paper, claimcon is monic and corresponds to aformal selection of a subset of those objects formally denoted by wksp.

7.1.4 Actual factorizations If an actual factorization arrow verif : hyp !claim can be constructed using the rules of Appendix A in SynCat[E;F ] that

30

Page 31: Graph-based Logic and Sketches I: The General Framework

makesclaim

hyp wksp

claimconverif

hypcon

(31)

commute, then we say that the potential factorization (28) is deducible.We remind the reader that by 6.1.4, SynCat[E; F ] is FLTh [E ;Name[F ]], sothat the rules of Appendix A apply.

If for some model M of SynCat[E; F ] there is an arrow » of Set thatmakes

M(claim)

M(hyp) M(wksp)

M(claimcon)»

M(hypcon)

(32)

commute, then we say the model M satis¯es the potential factorization. Iffor every model M there is such an arrow » then we say that the potentialfactorization is valid.

We give examples of potential factorizations in Section 8, and then dis-cuss the general concept of potential factorization in Section 8.3.

7.2 Soundness and completeness7.2.1 Theorem In any syntactic category SynCat[E;F ], a potential fac-torization is deducible if and only if it is valid.

Proof That deducibility implies validity follows from the fact that functorspreserve factorizations.

For the converse, let

claim

hyp wksp

claimcon

hypcon

(33)

be a potential factorization in SynCat[E;F ]. Suppose it is valid. Becausethe functor Hom(hyp;¡) is a model, the hypothesis of the theorem implies

31

Page 32: Graph-based Logic and Sketches I: The General Framework

that we may choose an arrow » of Set such that the diagram

Hom(hyp; claim)

Hom(hyp; hyp) Hom(hyp;wksp)

Hom(hyp; claimcon)»

Hom(hyp; hypcon)

(34)

commutes. De¯ne verif := »(idhyp). Then claimcon ± verif = hypcon, so thatthe potential factorization is deducible.

7.2.2 Remark Any model M is a functor that preserves ¯nite limits,so that if claimcon is monic, so is M(claimcon). In that case, M(verif )necessarily equals ».

Section C.7.2 gives an example of how completeness can be used.

7.2.3 Remarks Traditional proofs of soundness contain an inductionwhich is missing in the preceding argument. In the present system, a theo-rem can be identi¯ed with an arrow of SynCat[E;F ]. Appendix A describesthe recursive construction of arrows in the ¯nite-limit theory of a sketch andso is the analog of the inductive part of traditional proofs of completeness.We repeat once more that SynCat[E;F ] is indeed the ¯nite-limit theory of asketch, namely FLTh[E [Name[F ]]] (see 6.1.4) and hence the constructions inAppendix A do apply in this case.

7.2.4 Proposition Let ± : I ! SynCat[E;F ] be a diagram. Suppose forevery model M of SynCat[E;F ], M ±± commutes. Then ± commutes.

Proof Suppose

A B

C

f

h g (35)

is a diagram in SynCat[E;F ]. Then, because Hom(A;¡) is a model,

Hom(A;A) Hom(A;B)

Hom(A;C)

Hom(A; f)

Hom(A; h)Hom(A; g)

32

Page 33: Graph-based Logic and Sketches I: The General Framework

commutes. By chasing Id[A] around the diagram both ways, we get g±f = h,so Diagram (35) commutes as well. The general result follows because everydiagram can be triangulated.

8 Examples of potential factorizations

We give two examples of potential factorizations in some detail. The exam-ple in 8.1 holds for any category and the example in 8.2 holds in any Carte-sian closed category. We construct actual factorizations for these PF's inSection 10.

8.1 A fact about diagrams in any categoryThe following proposition holds in any category.

8.1.1 Proposition In any category, given the following diagram

A B

C D

f

h

kxg

(36)

if the two triangles commute then so does the outside square.

Proof k±h = k±(x±f ) = (k±x)±f = g±f .

Let F be the Cat-form (Cat = FLTh[Cat]) with not necessarily commu-tative diagrams of the form (36) as models. Such a form can be realizedby specifying that Name[F ] be a constant whose type is the limit of Dia-gram (22).

We construct here the potential factorization in SynCat[Cat; F ] that cor-responds to Proposition 8.1.1. The construction takes place entirely inFLTh[Cat]; no reference to the constant Name[F ] is made, since we are work-ing directly with the description of the type (codomain) of Name[F ], whichis Diagram (22).

As we pointed out in Section 5.3, an element of the value in a modelof Lim[D(22)] is a diagram such as Diagram (36). However, Diagram (22)carries only the information as to the source and target of the arrows inDiagram (36).

The structure we must actually work with should include the informa-tion as to which pairs are composable. There are four composable pairs in

33

Page 34: Graph-based Logic and Sketches I: The General Framework

Diagram (36), and each one inhabits the value of ar2, the node of formalcomposable pairs in a category (see Appendix C.2).

The following diagram thus contains the basic information about sources,targets and composability that are required for stating Proposition 8.1.1, andso its limit is suitable for being the node wksp of the proof corresponding tothe Proposition.

arhg;fi2

arf obC arg

obA arhx;f i2 arx arhk;xi2 obD

arh obB ark

arhk;hi2

rfac lfac

source

target source

targetrfac

lfac

source

targetrfac

lfacsourcetarget source

target

rfac lfac

(37)

The statement that the two triangles in Diagram (36) commute is: x±f = hand k±x = g. Using the composition arrow comp : ar2 ! ar of SynCat[Cat],this statement amounts to saying that Diagram (36) is a member of

34

Page 35: Graph-based Logic and Sketches I: The General Framework

C(Lim[D(38)]) (below) so we take hyp = Lim[D(38)].

arhg;f i2

arf obC arg

obA arhx;fi2 arx arhk;xi2 obD

arh obB ark

arhk;hi2

rfac lfac

source

target source

targetrfac

lfac

comp

source

targetrfac

lfac

comp

sourcetarget source

target

rfac lfac

(38)

The statement that the outside of Diagram (36) commutes is that the dia-gram is a member of C(Lim[±(39)]), so we take claim = Lim[D(39)]:

arhg;f i2

arf obC arg

obA arhx;f i2 arx arhk;xi2 obD ark±x±f

arh obB ark

arhk;hi2

rfac lfaccomp

sourcetarget source

targetrfaclfac

source

targetrfac

lfacsourcetarget source

target

rfaclfac

comp

(39)

Diagram (37) is a restriction of both Diagram (38) and Diagram (39). ByLemma 3.3.1, this inclusion induces arrows

claimcon : Lim[D(39)]! Lim[D(37)]

35

Page 36: Graph-based Logic and Sketches I: The General Framework

andhypcon : Lim[D(38)]! Lim[D(37)]

producing a potential factorization in FLTh[Cat] (hence in SynCat[Cat;F ],which contains FLTh[Cat] as a subcategory):

Lim[D(39)]

Lim[D(38)] Lim[D(37)]

claimcon

hypcon

(40)

This potential factorization expresses the content of Proposition 8.1.1 indiagrammatic form. It should be clear that the node Lim[D(37)] could havebeen replaced by Lim[D(22)].

8.2 A fact about Cartesian closed categoriesProposition 8.1.1 holds in any category. We now discuss a theorem of Carte-sian closed categories, to show how the system presented in this paper han-dles structure that cannot be expressed using Ehresmann sketches. Thelatter are equivalent in expressive power to ordinary ¯rst order logic. (Anexcellent presentation of the details of this fact may be found in [Ad¶amekand Rosi·cky, 1994].) Thus this example in a certain sense requires higher-order logic.

8.2.1 Proposition In any Cartesian closed category, if

A£B C

D

g

hf

commutes, then so does

A CB

DB

¸g

¸h fB

36

Page 37: Graph-based Logic and Sketches I: The General Framework

See Appendix C.6 for notation. The arrow fB is de¯ned by

fB := ¸(CB £B C D) : CB DBeval f (41)

The proof follows from the fact that ¸ is invertible and the calculation

eval ±¡(fB ±¸g)£ Id[B]

¢= eval ±

¡(fB £ Id[B])±(¸g £ Id[B])

¢

=¡eval ±(fB £ Id[B])

¢±(¸g £ Id[B])

= (f ± eval)±(¸g £ Id[B])

= f ±(eval ±(¸g £ Id[B]))

= f ±g = h = eval ±(¸h £ Id[B])

The ¯rst equality is based on an assertion true in all categories that can behandled in our system in a manner similar to (but more complicated than)that of module (78) in Appendix C.4. The second and fourth equalitiesare associativity of composition and are proven using Figure (68) of Appen-dix C.2. The sixth equality is a hypothesis. The other three equalities areall based on Diagram (98) in Appendix C.6.

We present here the potential factorization corresponding to the thirdequality, which is the most complicated of those based on Diagram (98). Inthis presentation, unlike that of 8.1, we will use the modules developed inAppendix C to simplify the ¯gures. The actual factorization correspondingto this potential factorization is given in 10.2.

The fact under discussion is that the diagram

A£B CB£B DB£B

C D

¸g£ Id[B] fB£ Id[B]

eval evalf

(42)

commutes.Thus wksp will be the limit of the following diagram, which describes

the objects and arrows in Diagram (42) but has no requirements on its

37

Page 38: Graph-based Logic and Sketches I: The General Framework

commutativity.

ar¸g£ Id[B] obCB£B arfB£ Id[B] obD

B£B

obA£B areval areval

obC arf obD

target

source

source target

source

target

source

target

source target

(43)

We de¯ne hyp to be the limit of the following diagram, in which Á =(f ± eval)±(¸g£ Id[B]).

obDB£B

arfB£ Id[B] arheval;fB£ Id[B]i2 areval

obCB£B ar¸g£ Id[B] obA£B arÁ

areval arf ± eval arhf ± eval;¸g£ Id[B]i2

obC arhf;evali2 obD

arf

target

source

lfacrfac

source

target

target source source

source

target

source

target

lfac

comprfac

rfaccomp

lfacsourcetarget

(44)Then Diagram (43) is a subdiagram of Diagram (44) (the big rectangle inDiagram (43) is the perimeter of Diagram (44)) and we de¯ne hypcon to bethe induced arrow from Lim[D(44)] to Lim[D(43)].

38

Page 39: Graph-based Logic and Sketches I: The General Framework

claim is the limit of a diagram we shall refer to as Diagram (440), obtainedfrom Diagram (44) by adjoining an arrow labeled comp from arheval;fB£Id[B]i

2to arf ± eval. Diagram (440) includes Diagram (44) and hence Diagram (43),and we take the arrow claimcon to be the arrow from Diagram (440) toDiagram (43) induced by this inclusion.

We now have a potential factorization

Lim[D(440)]

Lim[D(44)] Lim[D(43)]

claimcon

hypcon

(45)

The above potential factorization expresses the content of the third equal-ity in the calculation in the proof of Proposition 8.2.1. Diagram (45) is adiagram in CCC. Let the CCC-form F be determined by requiring thatName[F ] be a freely adjoined global element with target wksp. Then viathe embedding CatTh[FinLim;CCC] into SynCat[CCC;F ], Diagram (45)is also a diagram in SynCat[CCC;F ], and if it has an actual factoriza-tion in CatTh[FinLim;CCC] then it also has an actual factorization inSynCat[CCC;F ].

8.3 Discussion of the examples8.3.1 General discussion In a potential factorization

claim

hyp wksp

claimcon

hypcon

(46)

each of hyp, claim and wksp represents a type of entity that can be con-structed in an E-category, speci¯cally in an arbitrary category for Exam-ple 8.1 and in any Cartesian closed category for Example 8.2. In this sec-tion, we discuss a way of thinking about these nodes that exhibits how theycould represent a theorem about E-categories.

1. The node wksp (for \workspace") represents the data involved in boththe hypothesis and the conclusion. For a given theorem, the choice ofwhat is actually included in wksp may be somewhat arbitrary (see thediscussion of Example 8.2 below).

39

Page 40: Graph-based Logic and Sketches I: The General Framework

2. The node hyp represents possible additional properties that are partof the assumptions in the theorem being represented.

3. The node claim represents the properties that the theorem asserts musthold given the assumptions.

4. The arrow hypcon represents the selection or construction necessaryto see the hypothesis as part of the workspace. In both our examples,hypcon represents a simple forgetting of properties.

5. The arrow claimcon represents the selection or construction necessaryto see the claim as part of the workspace.

6. The arrow verif in an actual factorization represents a speci¯c way,uniform in any model, that any entity of type hyp can be transformedinto, or recognized as, an entity of type claim.

8.3.2 Discussion of Example 8.1 In Example 8.1,

1. wksp represent squares of the form

A B

C D

f

h

kxg

(47)

with no commutativity conditions.

2. hyp represents diagrams of the form of Diagram (47) in which the twotriangles commute;

3. claim represents diagram of the form of Diagram (47) in which theoutside square commutes.

4. hypcon represents forgetting that the two triangles commute. Becauseit represents forgetting a property in this case, hypcon is monic, butin general it need not be.

5. claimcon represents forgetting that the outside square commutes.

40

Page 41: Graph-based Logic and Sketches I: The General Framework

8.3.3 Discussion of Example 8.2 In Example 8.2,

1. wksp represent diagrams of the form of Diagram (42) with no com-mutativity conditions and no recognition that any sequence of arrowsis composable. The phrase \The form of Diagram (42)" refers to thesource and target commonalities of the arrows in the diagram. Obvi-ously, some sequences compose but we have not represented that inwksp, although we could have.

2. hyp represents diagrams of the form of Diagram (42), recognizing thecomposite f ± eval and the fact that f ± eval; ¸g£ Id[B] and eval; fB £Id[B] are composable pairs.

3. claim represents diagrams of the form of Diagram (42) that commute.

4. hypcon represents forgetting the information concerning compositionin hyp.

5. claimcon represents forgetting the information concerning compositionin claim.

We discuss the meaning of the actual factorization arrows verif in 10.3.

8.3.4 Remark The representation of facts such as those of Example 8.1and 8.2 as potential factorizations is variable free in the sense that in eachstatement, one does not refer to a particular diagram such as Diagram (36)or Diagram (42) which stands as a pattern for all such diagrams. Propo-sitions 8.1.1 and 8.2.1 state the fact in question using those diagrams aspatterns, and understanding their meaning calls on the reader's ability torecognize patterns. Our description of the fact in the examples as a poten-tial factorization is much more complicated because the diagrams involvedin the potential factorization are essentially explicit descriptions of the rela-tions between the nodes and arrows of Diagram (36) and Diagram (42)respectively, relations which a knowledgeable reader grasps from seeing thediagrams without having them indicated explicitly.

9 Construction and Deduction

9.1 The rules of graph-based logicIn ¯rst-order logic, rules are given for constructing terms and formulas,and further rules (rules of inference) are given for deriving formulas fromformulas. These rules are intended to preserve truth.

41

Page 42: Graph-based Logic and Sketches I: The General Framework

In Appendix B we give rules for constructing all the objects and arrowsof FLTh[S ] (hence in any syntactic category { see 6.1.4) for an arbitrary¯nite-limit sketch S, and for constructing a basis for all the commutativediagrams in FLTh[S]. These rules correspond to both the term and formulaconstruction rules and the rules of inference of string-based logic. The toolsof a typical string-based logic include constant symbols, variables, functionsymbols, logical operators and quanti¯ers. Here we have nodes, arrowsand commutative diagrams. What corresponds to a sentence is a potentialfactorization as in Diagram (46), and what corresponds to the satis¯abilityof the sentence in a model M is the existence of an arrow » for which

M(claim)

M(hyp) M(wksp)

M(claimcon)»

M(hypcon)

(48)

commutes. A demonstration of the deducibility of the sentence correspondsto the construction of an arrow verif : hyp ! claim in FLTh[S ] such that

claim

hyp wksp

claimconverif

hypcon

(49)

commutes. Thus the same rules su±ce for constructing the sentence (thepotential factorization) and for proving it (constructing the arrow thatmakes it an actual factorization). See Section 8.3 for further discussionof these points.

9.1.1 Remarks Each rule in Appendix B is actually a rule scheme,and each instance of the scheme is an assertion that, given certain arrowsand commutative diagrams (see Remark 9.1.2 below) in SynCat[E;S ], otherarrows or commutative diagrams exist in SynCat[E;S ]. For example, if ± isa diagram with shape graph

i

j k

u

v

(50)

42

Page 43: Graph-based Logic and Sketches I: The General Framework

then the following rule is an instance of 9LIM:

±(i)

±(j) ±(k)

±(u)

±(u)

Lim[±] ±(i)

±(j) ±(k)

Proj[Lim[±]; j] Proj[Lim[±]; k]

Proj[Lim[±]; i](51)

9.1.2 Remark Rules 9FIA, !FIA and CFIA assume the existence ofcommutative cones, but a commutative cone is a collection of interrelatedcommutative diagrams, so the statement above that each scheme assumesthe existence of certain arrows and commutative diagrams is correct. Thusgiven a cone £ : v (± : I ! ), an instance of 9FIA is this rule:

Vertex[£] ±(i)

±(j) ±(k)

Proj[£; j] Proj[£; k]

Proj[£; i]

Vertex[£] Lim[±]Fillin[£; ±]

(52)

The point of this remark is that 9FIA is a rule with a diagram as hypoth-esis and an arrow as conclusion. The hypothesis is the cone itself, not thestring \£ : v (± : I ! )" or any other description of it.

10 Examples of theorems

10.1 Proof of Proposition 8.1.1We continue Example 8.1 by constructing and thereby deducing the exis-tence of an arrow verif : Lim[D(38)] ! Lim[D(39)] making Diagram (40)commute.

43

Page 44: Graph-based Logic and Sketches I: The General Framework

We ¯rst construct Diagram (380) (not shown) by adjoining ar3 to Dia-gram (38), along with arrows

lfac : ar3 ! ark

mfac : ar3 ! arx

rfac : ar3 ! arf

We further construct Diagram (3800) by adjoining

hlfac;mfaci : ar3 ! arhk;xi2

hmfac; rfaci : ar3 ! arhx;f i2lass : ar3 ! arhg;fi

rass : ar3 ! arhk;hi2

to Diagram (380). These arrows are de¯ned in Appendix C.2.Diagram (37) is a base restriction of each of Diagram (380) and Dia-

gram (3800), so, we may, using Lemma 3.3.1, choose arrows

Á1 : Lim[D(380)]! Lim[D(37)]

andÁ2 : Lim[D(3800)]! Lim[D(37)]

Diagram (38) is a dominant subdiagram of Diagram (380) since the latter isobtained from the former by adjoining a limit of a subdiagram together withtheir projection arrows (lfac, mfac and rfac). Therefore, using Lemma 3.4.5,we may choose an isomorphism Ã1 making

Lim[D(38)] Lim[D(380)]

Lim[D(37)]

Ã1

hypcon Á1(53)

commute.Similarly, Diagram (380) is a dominant subdiagram of Diagram (3800)

since the latter is obtained from the former by adjoining four ¯ll-in arrows.Therefore by Lemma 3.4.5 we may choose an isomorphism Ã2 making

Lim[D(380)] Lim[D(3800)]

Lim[D(37)]

Ã2

Á1 Á2(54)

44

Page 45: Graph-based Logic and Sketches I: The General Framework

commute. We then construct Diagram (38000) by adjoining arrows

comp : arhg;fi2 ! ark±x±f

andcomp : arhk;hi2 ! ark±x±f

where ark±x±f is a new node.Because of associativity (the right diagram in Figure (68) of Appen-

dix C.2), Diagram (38000) extends Diagram (3800) by adjoining a commutativecocone, so we may choose an isomorphism Ã3 : Lim[D(3800)]! Lim[D(38000)]and an arrow Á3 : Lim[D(38000)]! Lim[D(37)] making

Lim[D(3800)] Lim[D(38000)]

Lim[D(37)]

Ã3

Á2 Á3(55)

commute.Finally, by Lemma 3.3.1, we may choose arrow Ã4 : Lim[D(38000)] !

Lim[D(39)] making

Lim[D(38000)] Lim[D(39)]

Lim[D(37)]

Ã4

Á3 claim(56)

commute.We next set

verif := Ã4±Ã3±Ã2±Ã1 (57)

whence the theorem follows.

10.2 Proof of Theorem 8.2.1In this section, we provide a factorization of the potential factorizationdescribed in Section 8.2.

Diagram (440) contains the following as a subdiagram, in which, usingDiagram (41),

µ = heval; fB £ Id[B]i = heval; ¸(f ± eval)£ Id[B]i

45

Page 46: Graph-based Logic and Sketches I: The General Framework

obCB£B arfB£Id[B] obD

B£B

arµ2

arf ± eval obD areval

source target

rfac

lfaccomp

target

source

target

source (58)

This diagram is an instance of Diagram (98), so it commutes. The arrowcomp satis¯es De¯nition 3.4.1, so Lemma 3.4.5 implies that there is an iso-morphism verif : hyp ! claim. Now the inclusion of Diagram (43) into Dia-gram (44) followed by the inclusion of Diagram (44) into Diagram (440) isprecisely the inclusion of Diagram (43) into Diagram (440). It follows thathypcon ± verif ¡1 = claimcon, so that claimcon ± verif = hypcon as required.

10.3 Discussion of the proofs.The factorization verif : Lim[D(38)] ! Lim[D(39)] of Diagram (40) given inEquation (57) constitutes the recognition that if the two triangles commute,then so does the outside square. The fact that verif makes Diagram (40)commute is a codi¯cation of the fact that if the two triangles commute thenso does the outside square of the same diagram. In general, the reasonwe require that actual factorizations be an arrow in the comma category(SynCat[E;F ] # wksp) instead of merely an arrow from one node to anotheris to allow us to assert hypotheses and conclusions that share data (in thiscase the data in Diagram (47)).

The factorization verif : hyp ! claim constructed in 10.2 constitutesrecognition that eval ±(fB£Id[B]) = f ± eval via the arrow comp:arheval;fB£Id[B]i

2 !arf ± eval in Diagram (440). Because of this, the node arhf ± eval;¸g£Id[B]i

2 couldalso be labeled heval ±fB £ Id[B]; ¸g £ Id[B]i. Thus the factorization alsoexhibits the fact that

eval ±(fB £ Id[B])±(¸g £ Id[B]) = f ± eval ±(¸g £ Id[B])

It is clear that there are many alternative formulations of Proposi-tion 8.2.1. For example, instead of ¯rst constructing arf ± eval

2 as in Dia-gram (44) (which is hyp in this case), we could have constructed a node

46

Page 47: Graph-based Logic and Sketches I: The General Framework

areval ±(fB£Id[B])2 and an arrow

comp : arheval;(fB£Id[B]i)2 ! areval ±(fB£Id[B])

2

Then the construction of an arrow

comp : arhf;evali2 ! areval ±(fB£Id[B])

would have proved the theorem.

11 Future work

A second part of this work [Bagchi and Wells, 1997] will discuss in detailthe relationship between the graph-based logic for ¯nite-product categoriesand the rules for equational deduction.

It is noteworthy that the rules of construction for constructor spacesgiven in Appendix B correspond to arrows of FinLim, although not in aone-to-one way (see Remark B.1.2). The rules are given here in a form thatrequires pattern recognition (recall the discussion in 8.3.4), but they clearlycould be given at another level of abstraction as arrows or families of arrowsof FinLim. We expect to make this explicit in a later work.

M. Makkai [1993a], [1993b] has produced an approach to explicating thelogic of sketches that is quite di®erent from that presented here. Both areattempts at codifying the process of diagram-manipulation used to proveresults valid in particular structured categories. In both cases, structuredcategories or doctrines form the semantic universes with a pre-existingnotion of validity. Both approaches are motivated by the desire to formu-late a syntactic notion of deducibility. After that is said, the two approachesare very di®erent and a detailed investigation of the relationship betweenthem is desirable.

The following points are however worth mention.

² Both approaches require a generalization of Ehresmann sketches:Forms as in De¯nition 6 here and sketch category over a category Gin [Makkai, 1993b].

² In Makkai's approach, the sketch axioms are di®erent for di®erent doc-trines and serve both as axioms and as rules of inference. In contrast,here the rules of construction are the same for all doctrines, what dis-tinguishes doctrines is their speci¯cation as CS-sketches. This featureis a departure from the usual practice in symbolic logic.

47

Page 48: Graph-based Logic and Sketches I: The General Framework

The rules of construction given herein take place in the doctrine of ¯nitelimits. Most of the syntax and rules of deduction of traditional logical the-ories are clearly expressible using context-sensitive grammars, which intu-itively at least can be modeled using ¯nite limits. (Context-free grammarscan be modeled using only ¯nite products [Wells and Barr, 1988].) However,one could imagine extensions of this doctrine:

(i) Use coproducts to allow the speci¯cation of conditional compilation orother syntactical alternatives.

(ii) Use doctrines involving epimorphic covering families to allow the inten-tional description of ambiguous statements.

(iii) Use some extension of ¯nite limit doctrines to allow the treatmentof categories whose structure is determined only up to isomorphism(the traditional approach in category theory) instead of being speci-¯ed. There are two approaches in the literature: the use of categoriesenriched over groupoids and universal sketches as described in [Barrand Wells, 1992]. It is not clear that such methods are necessary forapplications in computer science, but they may be for general appli-cations to mathematical reasoning.

A Appendix: Recursive construction of the the-ory of a ¯nite-limit sketch

A.1 Introductory commentsThis section provides a construction of the categorial theory FLTh[S ] ofa ¯nite-limit sketch S. It is essentially a special case of the constructionin [Ehresmann, 1968b]. A related, more general construction is given byDuval and Reynaud in [Duval and Reynaud, 1994a].

The categorial theory FLTh[S] is in fact the initial model of SynCat[FinLim;S],a ¯nite-limit sketch de¯ned in Section 6, for categories with ¯nite lim-its. From that point of view, the categorial theory is a term algebra forSynCat[FinLim;S ]. A recursive construction of term algebras for ¯nite-limitsketches is given in [Barr and Wells, 1995], section 9.2.

On the other hand, for any constructor space E and any E-form F ,SynCat[E;F ] is (equivalent as a category to) a particular example of a ¯nite-limit theory as described in 6.1.4. Thus these rules of construction may

48

Page 49: Graph-based Logic and Sketches I: The General Framework

be used to construct actual factorizations (when they exist) of potentialfactorizations for any E-sketch. It is in this sense that we have reducedreasoning about arbitrary forms to reasoning (in the sense of constructingactual factorizations) about ¯nite limits. The special character of E-formsfor a particular constructor space E is encoded in the constructor-spacesketch that generates E.

An approach to string-based logic that would be analogous to this setupwould be a system that captured many di®erent types of string-base logic(but not necessarily all of them) using uniform rules about manipulatingthe strings, with the special behavior for a particular type of logic L, forexample ¯rst order logic or linear logic, encoded in a formal description ofL that caused the uniform string manipulation rules to produce the correctbehavior for L. As far as we know no such system has been de¯ned. Theone general approach to logic that we know about, the theory of institutionsdescribed in [Goguen and Burstall, 1986], is much more abstract than thesort of system about which we are speculating here; it does not deal withstrings and rules of deduction in a computational way.

A.2 A constructionLet be a category with the property that for some set (possibly empty) ofdiagrams in , limit cones have been speci¯ed. In this section, we constructa graph G and a set of diagrams D in G by ¡.1 to ¡.5 below; G and D aredetermined by . This construction is the basis of the inductive constructiongiven in Appendix A.3. The de¯nition is deliberately made elementary (andtherefore much more discursive than it might be), since it forms the basisof our deduction rules in Section 9.

¡.1 If x is a node of UndGr[ ], then x is a node of G.

¡.2 If f : x! y is an arrow of UndGr[ ], then f : x! y is an arrow of G.

¡.3 If the composite g±f of two arrows f and g of is de¯ned, then thediagram

dom(f)

cod(f) cod(g)

fg±f

g

(59)

is in D.

49

Page 50: Graph-based Logic and Sketches I: The General Framework

¡.4 If ± :I ! is a diagram in that does not have a speci¯ed limit, thenG contains an object Lim[±] not in and a cone LimCone[±]:Lim[±] ±,and moreover for each arrow u : i! j of I , the diagram

Lim[±]

±(i) ±(j)

Proj[LimCone[±]; i] Proj[LimCone[±]; j]

±(u)

(60)

is in D.

¡.5 If ± : I ! is a diagram in that does not have a speci¯ed limit inand £ is a commutative cone to ±, then

1. G contains an arrow Fillin[£; ±] : Vertex[£]! Lim[±] not in .

2. For each node i of I , the diagram

Vertex[£] Lim[±]

±(i)Proj[£; i]

Fillin[£; ±]

Proj[LimCone[±]; i](61)

is in D.

3. If k : Vertex[£] ! Lim[±] is in and, for each node i of I, thediagram

Vertex[£] Lim[±]

±(i)Proj[£; i]

k

Proj[LimCone[±]; i](62)

is in D, then the diagram

Vertex[£] Lim[±]Fillin[£; ±]

k(63)

is in D.

50

Page 51: Graph-based Logic and Sketches I: The General Framework

A.3 The constructionIn this section, we ¯x an arbitrary ¯nite-limit sketch

S := (Graph[S];Diagrams[S ];Cones[S])

In De¯nitions A.3.1 through A.3.3 below, we construct an in¯nite sequence

0 1 2 3 : : :F0 F1 F3 (64)

of categories and functors generated by S .

A.3.1 De¯nition Let D0 be the set of diagrams consisting of all thediagrams in Diagrams[S ] and all the diagrams necessary to make each conein Cones[S] a formally commutative cone, namely those of the form

Vertex[£]

±(i) ±(j)

Proj[£; i] Proj[£; j]

±(u)

(65)

for each cone £ : v ± in Cones[S] and each arrow u : i ! j of the shapegraph of the base diagram ± of £. Then 0 is de¯ned to be the inducedcategory LinTh[G;D0] as in Section 4.1.

A.3.2 De¯nition Let S 0 := (Graph[S 0];Diagrams[S 0]) be the linearsketch generated by 0 as described in Section A.2. Let D00 be the setof diagrams in Graph[S 0] containing all the diagrams in Diagrams[S 0] and,for each cone £ : v ± in Cones[S ] and each arrow k : Vertex[£] ! Lim[±],the diagram

Vertex[£] Lim[±]Fillin[£; ±]

k(66)

Then 1 is de¯ned to be the induced category LinTh[Graph[S];D00] and theimage of each cone in Cones[S ] is de¯ned to be a speci¯ed limit (it is easyto see that it is indeed a limit cone).

A.3.3 De¯nition Assume k has been de¯ned for k ¸ 1. Then k+1is de¯ned to be LinTh[G;D0] where G and D are de¯ned from k as inSection A.2, and Fi : k ! k+1 is de¯ned to be the functor that takes eachobject and arrow of to its congruence class in k+1. The speci¯ed limitsin k+1 are the images of all those in k plus all those constructed by rule¡.4.

51

Page 52: Graph-based Logic and Sketches I: The General Framework

A.3.4 Theorem The colimit T of the sequence of De¯nitions A.3.1through A.3.3 is a category with ¯nite limits. The induced graph morphismfrom G to UndGr[T ] is a universal model of S.

It follows from the theorem that T is the ¯nite-limit theory of thesketch S . We denote it FLTh[S]. FLTh[S ] is equivalent as a category toCatTh[FinLim;S ] (Section 6).

Proof Routine using the de¯nition of colimit.

A.3.5 Lemma (Piessens) Every object of FLTh[S ] is a limit of a diagrambuilt from the objects and arrows of S .

(See the remarks in 6.1.5.)

Proof (Private communication from Frank Piessens.) Via the Yonedaembedding, FLTh[S]op is a full subcategory of the category Func( ;Set),where the free category generated by Graph[S ]. Every functor from toSet is a colimit of representables and, hence, in FLTh[S], every object is alimit of them. Thus every object of the theory is a limit of a diagram builtfrom the objects and arrows of S .

B Appendix: Rules of construction

These rules construct the objects, arrows and commutative diagrams of thecategory FLTh[S] for a given ¯nite-limit sketch S . The rules are given in twolists in B.1 and B.2 below.

B.1 Rules that construct objects and arrowsThis list gives all the rules that construct objects and arrows in the categoryFLTh[S]. The following de¯nition forces the distinguished cones of the sketchS to become limit cones in the theory.

B.1.1 De¯nition Let £ : v ± be a distinguished cone of the sketchS . We de¯ne LimCone[±] := £ and Lim[±] := v.

9OBc

for every object c of S .

52

Page 53: Graph-based Logic and Sketches I: The General Framework

9ARRa b

ffor every arrow f : a! b ofS .

9COMPa b cf g

a cg±f

for every object b and pairof arrows f : a ! b and g :b! c of FLTh[S ].

9ID

c

c

Id[c]for every object c ofFLTh[S].

9LIM± : I ! FLTh[S ]

LimCone[±] : Lim[±] ±

for every diagram ± : I !FLTh[S ] that is not the baseof a distinguished cone of S.

9FIA£ : v ±

Fillin[£; ±] : v ! Lim[±]

for every diagram ± andevery cone £ : v ± inFLTh[S].

B.1.2 Remark The ¯rst two rules are justi¯ed by the inclusion of thesketch S into FLTh[S ]. In rule 9LIM, LimCone[±] is the speci¯ed limit of ±.The exception in rule 9LIM will force the distinguished cones of S to becomelimit cones in FLTh[S]: because of De¯nition B.1.1, rule 9FIA applies tothose distinguished cones as well as to all cones constructed by 9LIM. Thisremark also applies to rules CFIA and !FIA in B.2.

The rules 9COMP corresponds to the arrow comp and 9ID to unit of thesketch for categories C.2. 9LIM and 9FIA correspond to arrows in FinLimbut not speci¯cally to arrows of the sketch C.5, because an arbitrary ¯nitelimit is constructed from a combination of products and equalizers.

B.1.3 Remark The rules just given construct speci¯c objects andarrows in FLTh[S]. Rule 9LIM, for example, constructs a speci¯c limitcone called LimCone[±], thus providing speci¯ed limits for FLTh[S]. It istrue that there are other limit cones in general for a given diagram ±, butLimCone[±] is a speci¯c one.

Of course, in many cases, the entity constructed is the unique entity sat-isfying some property. For example, the arrow g±f constructed by 9COMP

53

Page 54: Graph-based Logic and Sketches I: The General Framework

is (by de¯nition of commutative diagram) the only one making the bot-tom diagram in COMPDIAG commute in FLTh[S ]. The arrow constructedby 9ID is (by an easy theorem of category theory) the only one makingthe bottom diagrams in IDL and IDR commute. The arrow constructed by9FIA is (because of !FIA) the only one making the bottom diagram in CFIAcommute. In connection with the point that each rule constructs a speci¯carrow, these observations are red herrings: in fact, each rule constructs aspeci¯c arrow with the name given, independently of any uniqueness prop-erties arising from any other source. This point of view is contrary to thespirit of category theory. We follow it here because we are constructingsyntax with an eye toward implementation in a computer language. Thissituation is analogous to the way in which mathematicians give invariant(basis-free) proofs concerning linear spaces but use bases for calculation.

Implementing the speci¯c constructions de¯ned above would be rela-tively straightforward using a modern object-oriented language. Note thatwe are not asserting that it would be straightforward to ¯nd a con°uent andnormalizing form of these rules for automatic theorem proving, only thatthere are no obvious di±culties in implementing them so that they could beapplied in an ad-hoc manner.

B.2 Rules that constructformally commutative diagrams

The following rules produce the existence of diagrams that must commutein FLTh[S].

REF

a bf

a bf

f

for every arrow f : a! b ofFLTh[S]

TRANS

a b a bf

g

g

h

a bf

h

for all objects a and b andall arrows f; g; h : a ! b ofFLTh[S ]

54

Page 55: Graph-based Logic and Sketches I: The General Framework

9DIAGUnivMod[FinLim;S]±± : I ! FLTh[S]

for every diagram ± in the set DS of distinguished diagrams of S.

COMPDIAG

a b

c

f

g

a b

c

f

g±fg

for every pair of arrows f :a ! b and g : b ! c ofFLTh[S ].

IDL

c

Id[c]

g : b! c

b c

c

g

g Id[c]

for every object c and everyarrow g : b! c of FLTh[S ].

IDR

c

Id[c]

f : c! d

c c

d

Id[c]

f f

for every object c and everyarrow f : c! d of FLTh[S ].

ASSOC

a b c df g h

a b

c d

f

g±f h±gg

h

for all arrows f : a ! b,g : b ! c and h : c ! d ofFLTh[S ].

55

Page 56: Graph-based Logic and Sketches I: The General Framework

CFIA

i 2 Nodes[I ]£ : v ±

v Lim[±]

±(i)

Fillin[£; ±]

Proj[£; i] Proj[LimCone[±]; i]]

for every diagram ± : I ! FLTh[S ], every node i of I , and every cone £ withbase diagram ±.

!FIA

± : I ! FLTh[S ]£ : v ±

h : v ! Lim[±]k : v ! Lim[±]

and each of the following diagrams for each node i of I:

v Lim[±]

±(i)

h

Proj[£; i] Proj[LimCone[±]; i]]

v Lim[±]

±(i)

k

Proj[£; i] Proj[LimCone[±]; i]]

v Lim[±]h

k

for every diagram ±:I ! FLTh[S], every cone £ in FLTh[S] with base diagram±, and every pair of arrows h; k : v ! Lim[±].

B.2.1 Remark Note that we do not need a rule of the form

SYM

a bf

g

a bg

f

since the two diagrams exhibited are actually the same diagram (see 2.3).

56

Page 57: Graph-based Logic and Sketches I: The General Framework

C Appendix: Sketches for constructor spaces

Here we present constructor space sketches for certain types of categories.In each case the models are categories of the sort described and the mor-phisms of models are functors that preserve the structure on the nose. Itis an old result that such categories can be sketched. See [Burroni, 1970a],[Burroni, 1970b], [McDonald and Stone, 1984], and [Coppey and Lair, 1988],for example.

The embedding CatStruc[E] of Section 5.1.2 will in each case be inclusion.

C.1 NotationWe denote the ith projection in a product diagram of the form

obA £ obB

obA obB

p1 p2

as pi, or pA£Bi if the source or target is not shown. We use a similar devicefor the product of three copies of ob.

C.2 The sketch Cat for categoriesThis version of the sketch for categories is based on [Barr and Wells, 1995].Another version is given in [Coppey and Lair, 1988], page 64. The ¯rstversions were done by Ehresmann [1966], [1968a] and [1968b].

C.2.1 The graph of Cat The graph of the sketch for categories containsnodes as follows.

1. 1, the formal terminal object.

2. ob, the formal set of objects.

3. ar, the formal set of arrows.

4. ar2, the formal set of composable pairs of arrows.

5. ar3, the formal set of composable triples of arrows.

The arrows for the sketch for categories are

1. unit : ob! ar that formally picks out the identity arrow of an object.

57

Page 58: Graph-based Logic and Sketches I: The General Framework

2. source; target : ar! ob that formally pick out the source and target ofan arrow.

3. comp : ar2 ! ar that picks out the composite of a composable pair.

4. lfac; rfac : ar2 ! ar that pick out the left and right factors in a compos-able pair.

5. lfac;mfac; rfac : ar3 ! ar that pick out the left, middle and right factorsin a composable triple of arrows.

6. lass; rass : ar3 ! ar2: lass formally takes hh; g; fi to hh±g; fi and rasstakes it to hh; g±fi.

7. lunit; runit : ar! ar2: lunit takes an arrow f : A! B to hId[B]; fi andrunit takes it to hf; Id[A]i.

8. Arrows id : x! x as needed.

Observe that id, lfac and rfac, like p1 and p2, are overloaded. We will observethe same care with these arrows as with p1 and p2 as mentioned in Sec-tion C.1.

C.2.2 Cones of Cat ar2 and ar3 are de¯ned by these cones:

ar2

ar ar

ob

lfac rfac

source target

ar3

ar ar ar

ob ob

lfac mfac rfac

source target source target

C.2.3 Diagrams of Cat

ar2 ar3

ar ar2 ar

comp

hlfac;mfaci

rfaclass

lfac rfac

ar3 ar2

ar ar2 ar

lfac rass

hmfac; rfaci

comp

lfac rfac(67)

58

Page 59: Graph-based Logic and Sketches I: The General Framework

ob ar

ar ar2 ar

unit

target

idlunit

lfac rfac

ar ob

ar ar2 ar

id runit

source

unit

lfac rfac

ar ar2 ar

ar

runit

idcomp

lunit

id

ar3 ar2

ar2 ar

lass

rass

comp

comp

(68)

C.3 The sketch for the constructor space FinProdTo get the sketch for categories with ¯nite products, we must add the fol-lowing nodes and arrows to the sketch for categories:

Nodes:

1. ta, the formal set of terminal arrows.

2. cone, the formal set of cones of the form

V

A B

p2p1 (69)

3. ¯d, the formal set of ¯ll-in diagrams (\sawhorses") of the form

V L

A B

h

(70)

where h commutes with the cone projections.

Arrows:

1. ter : 1! ob, that formally picks out a particular terminal object.

59

Page 60: Graph-based Logic and Sketches I: The General Framework

2. ! : ob ! ta, that picks out the arrow from an object to the terminalobject.

3. inc : ta! ar, the formal inclusion of the set of terminal arrows into theset of arrows.

4. prod : ob £ ob ! cone, that picks out the product cone over a pair ofobjects.

5. soco : ¯d! cone, that picks out the source cone of a ¯ll-in arrow.

6. taco : ¯d! cone, that picks out the target cone of a ¯ll-in arrow.

7. u¯d : cone ! ¯d, that takes a cone to the unique ¯ll-in diagram thathas the cone as source cone.

8. ¯a:¯d! ar that formally picks out the ¯ll-in arrow in a ¯ll-in diagram.

C.3.1 Cones for FinProd FinProd has four cones in addition to thoseof the sketch for categories. One is the cone with vertex 1 over the emptydiagram. The one below says that ta is the formal set of arrows to theterminal object:

ta

ar ob

1

inctarget

ter

(71)

Note that in giving this cone, we are not only saying that ta is the limit ofthe diagram

ar ob

1

target

ter(72)

but also that inc is one of the projection arrows. (Indeed, this is the onlyprojection arrow that matters, since the other two are induced.)

The following cone makes cone the formal object of cones to a discretediagrams consisting of a pair of objects.

cone

ar ob ar

lproj rproj

source source

(73)

60

Page 61: Graph-based Logic and Sketches I: The General Framework

Finally, there must be a cone with vertex ¯d over Diagram 74 below,which is annotated to refer to Diagram (70), in which ¡ is the cone withvertex V , ¤ is the cone with vertex L and is a limit cone, and h is the ¯ll-inarrow. In this case, the projection arrows of the cone are not shown.

ar2 obV

ar cone¡ ar

obA obA£obB obB ar2 arh

ar cone¤ ar

obL

comp

lfac

rfac

target

source

lproj rproj

target

source

p1 p2

prod

comp

lfac

rfac

source

target

target

source

lproj rproj

target

source

(74)

In addition, we require:

1) The projection to cone¡ must be soco.2) The projection to cone¤ must be taco.3) The projection to arh must be ¯a.

C.3.2 Diagrams for FinProd The following two diagrams make thearrow to the terminal object have the correct source and target.

ob ta ar

ob

!

id

inc

source

ta ar ob

ta

inc

id

source

! (75)

The diagram below makes the ¯ll-in arrow to a product unique.

cone ¯du¯d

soco(76)

61

Page 62: Graph-based Logic and Sketches I: The General Framework

The diagram below forces the product cone projections to have the correcttargets.

ob£ ob

ob ar cone ar ob

p1 p2prod

target lproj rproj target

(77)

C.4 ModulesAs we proceed to sketch more complicated constructions, we will need to usesome device to communicate the nature of the necessary diagrams, whichbecome too large to comprehend easily. Here we introduce the ¯rst of severalmodules: diagrams that occur frequently as subdiagrams because they areneeded to force the value of a node in a model to contain certain types ofconstructions.

C.4.1 The module for the product of objects Every occurrence ofob that is annotated M £N must be part of a subdiagram of the followingform:

obM arpM£N1

obM £ obN cone obM£N

obN arpM£N2

target

source

prod

p1

p2

lproj

rproj

target

source

(78)

Henceforth, an occurrence of ob annotated A £ B (for example) will betaken to imply the existence of a subdiagram of the form of Diagram (78)with M replaced with A and N replaced with B. The subdiagram will notnecessarily be shown. If this is part of a diagram ±, the diagram can bereconstructed by taking the union of the shape graph of the module (78)and the shape graph of the part of ± that is shown on the page, and de¯ningthe diagram based on the resulting graph as the pushout of the diagramshown and the module. This is illustrated in Diagrams (80) and (81) in thenext section.

62

Page 63: Graph-based Logic and Sketches I: The General Framework

C.4.2 The module for the product of arrows In the commutativediagram

K K £N

N

M M £N

u

p1

p2

p2p2

(79)

the unlabeled arrow is necessarily u £ Id[N ] : K £ N ! M £ N . Such adiagram must be an element in a model of the value of Diagram (80) below,which is therefore a module for the product of an arrow and an identityarrow. In this diagram, Á := hpM£N2 ; u £ Id[N ]i.

obK£obN

cone

obK arpK£N1 obK£N arp

K£N2

aru arhu;p1i2

ar arhu£ Id[N ];p2i2 aru£ Id[N ] arÁ2 obN

obM arpM£N1 obM£N arp

M£N2

cone

obM£obN

p1

prod

p2lproj

rproj

target source source

targetsource

target

lfac

rfac

comp comp rfac

lfac target

source

rfac

comp

lfac

target source source

target

lprojrproj

p1

prod

p2

(80)

63

Page 64: Graph-based Logic and Sketches I: The General Framework

More precisely, let x be an element of M(Lim[D(80)]), for some category Mwith ¯nite limits. Then if Proj[Lim[D(80)]; h](x) = h, then

Proj[Lim[D(80)]; h£ Id[A]](x) = h£ Id[A]

as suggested by the notation. This will be used in Section C.6 below.Diagram (80) contains two copies of Diagram (78), the module for the

product of two objects. The copy at the bottom is precisely Diagram (78),and the copy at the top is Diagram (78) with M replaced with K. In thesequel, a diagram such as Diagram (80) will be drawn without the modules,as shown below.

obK arpK£N1 obK£N arp

K£N2

aru arhu;pK£N1 i

2ar arhu£ Id[N ];p2i

2 aru£ Id[N ] arÁ2 obN

obM arpM£N1 obM£N arp

M£N2

target source source

targetsource

target

lfac

rfac

comp comp rfac

lfac target

source

rfac

comp

lfac

target source source

target

(81)Diagram (80) may be mechanically reconstructed from Diagram (81) andthe annotations that include the symbols M£N and K£N (three of each).The shape diagram of Diagram (80) is the pushout of the shape diagram ofDiagram (81) and the shape diagrams of the modules Diagram (78) and Dia-gram (78) with M Ã K. Each of the latter two have four annotated nodesand six annotated arrows in common with Diagram (81), and the values ofany two of the three smaller diagrams at a given common node or arrow isof course the same, so that Diagram (80) is the union of Diagram (81) andthe two modules.

C.5 The sketch for the constructor space FinLimWe sketch the constructor space FinLim by adding data to the sketch forFinProd that ensure that a FinLim-category has equalizers of pairs of arrows.The sketch has the following nodes:

64

Page 65: Graph-based Logic and Sketches I: The General Framework

1. ppair is the formal set of parallel pairs of the form

A Bf

g(82)

2. econe is the formal set of diagrams

E A Bu f

g(83)

in which f ±u = g±u. Of course, a cone to Diagram (82) also has aprojection to B, but that is forced and need not be included in thedata for the cone.

3. e¯d is the set of ¯ll-in diagrams

X

E A B

v ue f

g

(84)

in which f ±e = g±e and u = e±v.

The arrows of the sketch include:

1. equ :ppair! econe, that formally picks out the equalizer of the parallelpair.

2. top; bot : ppair! ar, that pick out f and g in Diagram (82).

3. etop; ebot : econe! ar, that pick out f and g in Diagram (83).

4. esoco; etaco : e¯d! econe that pick out the source and target cones ofthe ¯ll-in arrow.

5. eu¯d : econe! e¯d that takes a diagram of the form of Diagram (83)to the unique ¯ll-in diagram that has this diagram as source cone.

6. e¯a : e¯d! ar that picks out the ¯ll-in arrow in a ¯ll-in diagram.

65

Page 66: Graph-based Logic and Sketches I: The General Framework

C.5.1 Cones for FinLim ppair is the limit of the diagram

arf obB

obA arg

target

source

source

target (85)

The following projections from ppair have names: soob : ppair ! obA, top :ppair! arf , and bot : ppair! arg .

econe is the limit of

ar2 arf

ar are obA obB

ar2 arg

rfac

lfac

comp source target

target

comp

lfac

rfac source target

(86)

Two projections have names: etop : econe! arf and ebot : econe! arg.e¯d is the limit of the pushout of Diagram (86) and the following diagram.

Note that the common part of the two diagrams is

are obAt

We could have presented Diagram (74) as a pushout in much the same way(the common part would describe the arrow h:V ! L). We have deliberatelyvaried the way we present the data in this article because we are not sureourselves which approach communicates best.

arv obX aru

ar2

obE are obA

target

source source

target

rfac comp

lfacsource target

(87)

The named projections are esoco:e¯d! aru, etaco:e¯d! are and e¯a:e¯d!arv.

66

Page 67: Graph-based Logic and Sketches I: The General Framework

C.5.2 Diagrams for FinLim The following diagram makes the ¯ll-inarrow unique.

econe e¯deu¯d

esoco(88)

These two diagrams ensure that the equalizer cone be a cone to the correctdiagram.

ppair econe

ar

equ

top etop

ppair econe

ar

equ

bot ebot (89)

C.6 The sketch for the constructor space CCCC.6.1 De¯nition A Cartesian closed category is a category withthe following structure:

CCC.1 has binary products.

CCC.2 For each pair of objects A and B of , there is an object BA andan arrow eval :BA £A! B.

CCC.3 For each triple of objects A, B and C of , there is a map

¸ : Hom(B £A;C)! Hom(B; CA) (90)

such that for every arrow f :B £A! C,

B£A CA£A

C

¸f£ Id[A]

f eval (91)

commutes.

CCC.4 For any arrow g :B ! CA, ¸(eval ±(g£ Id[A])) = g.

Using this de¯nition, the sketch for the constructor space for Cartesianclosed categories may be built on the sketch for FinProd by adding thefollowing nodes and arrows.

The nodes are:

67

Page 68: Graph-based Logic and Sketches I: The General Framework

1. twovf , the formal set of \functions of two variables", that is, arrows ofthe form B £A! C.

2. curry, the formal set of \curried functions" B ! CA.

The sketch for CCC has arrows

1. fs : obB £ obA ! obBA

that picks out the function space BA of twoobjects B and A.

2. ev : obB £ obA ! ar that picks out the arrow eval :BA £A! B.

3. lam : ar! ar, the formal version of the mapping ¸ of Diagram (90).

4. tsource : twovf ! obB£A, that picks out the source of a function f :A£B ! C.

5. ttarget:twovf ! obC , that picks out the target of a function f :A£B !C.

6. arrow : twovf ! arf , that picks out the arrow f itself.

7. csource : curry ! obB , that picks out the source of a curried functiong :B ! CA.

8. ctarget : curry ! obCA

, that picks out the target of a curried functionf :B ! CA.

9. arrow : curry! arg, that picks out the arrow g itself.

C.6.2 Cones for CCC CCC must have two cones

twovf

obB£A arf obC

tsource arrow ttarget

source source

(92)

curry

obC£obA obcA arg obB

ctarget arrow csource

fs target source

(93)

68

Page 69: Graph-based Logic and Sketches I: The General Framework

C.7 The module for function spacesHenceforth, we will assume the module

obM obM£obN obMN

obN

p1 fs

p2 (94)

is attached whenever an occurrence of ob is annotated by MN . Note thatthis occurred in Diagram (93).

C.7.1 Diagrams for CCC Diagram (95) below forces eval to have thecorrect domain and codomain.

obBA£A areval obB

source target (95)

Expanding this diagram using the required modules is a two stage process,giving

obA obBA£obA obB

A

ar cone ar obB£obA obA

obBA£A areval obB

p2 p1

prodrproj

source

lproj rprojlproj

source

fs

p1

p2

source target

(96)

Diagram (97) below forces ¸f to have the correct domain and codomain.

obC obCA

obB£A twovff curry¸f

obB

tsource lam

ttarget csource

ctarget

(97)

69

Page 70: Graph-based Logic and Sketches I: The General Framework

Diagram (98) below forces Diagram (91) to commute.

obB£A ar¸f£ Id[A] obCA£A

ar2

arf obC areval

source target

rfac

comp lfac

target

source

target

source (98)

Diagram (99) below ensures that requirement CCC{4 holds.

obCA£A areval obC obB

arg£ Id[A] arheval;g£ Id[A]i2 arg obC

A

obB£A areval ±(g£ Id[A]) curry

twovf

source target

target

source

lfac

rfac

comp

sourcetarget

source

target

arrow

tsource

ttarget

arrow lam

(99)

C.7.2 Invertibility of ¸ It follows from CCC-4 that if is any Carte-sian closed category corresponding to a model C, then C(¸) is a bijection.The Completeness Theorems 7.2.1 and 7.2.4 then imply that there is anarrow ¸¡1 in CCC that, as its name suggests, is a formal inverse to ¸.

References

At the end of each entry, the pages on which that entry is cited are listed inparentheses.

[Ad¶amek and Rosi·cky, 1994] Ji·r¶i Ad¶amek and Ji·r¶i Rosi·cky. Locally Pre-sentable and Accessible Categories. Cambridge University Press,1994.

70

Page 71: Graph-based Logic and Sketches I: The General Framework

[Bagchi and Wells, 1996] Atish Bagchi and Charles Wells. Thevarieties of mathematical prose. Available by web browserfrom http://www.cwru.edu/CWRU/Dept/Artsci/math/wells/pub/papers.html, 1996.

[Bagchi and Wells, 1997] Atish Bagchi and Charles Wells. Graph-based logicand sketches II: Finite product categories and equational logic. Whenready, this will be available by web browser from http://www.cwru.edu/CWRU/Dept/Artsci/math/wells/pub/papers.html, 1997.

[Barr, 1971] Michael Barr. Exact categories. In Barr et al. [1971].

[Barr et al., 1971] Michael Barr, Pierre A. Grillet, and Donovan H. vanOsdol, editors. Exact categories and Categories of Sheaves, volume236 of Springer Lecture Notes in Mathematics. Springer Verlag, 1971.

[Barr and Wells, 1985] Michael Barr and Charles Wells. Toposes, Triplesand Theories, volume 278 of Grundlehren der mathematischen Wis-senschaften. Springer-Verlag, New York, 1985. A list of corrections andadditions is maintained in [Barr and Wells, 1993b].

[Barr and Wells, 1992] Michael Barr and Charles Wells. On the limitationsof sketches. Canadian Mathematical Bulletin, 35:287{294, 1992.

[Barr and Wells, 1993a] Michael Barr and Charles Wells. Category The-ory for Computing Science: Update. Available by web browserfrom http://www.cwru.edu/CWRU/Dept/Artsci/math/wells/pub/papers.html, 1993. Corrections and additions to the ¯rst edition of[Barr and Wells, 1995].

[Barr and Wells, 1993b] Michael Barr and Charles Wells. Correc-tions to Toposes, Triples and Theories. Available by web browserfrom http://www.cwru.edu/CWRU/Dept/Artsci/math/wells/pub/papers.html, 1993. Corrections and additions to [Barr and Wells, 1985].

[Barr and Wells, 1995] Michael Barr and Charles Wells. Category Theoryfor Computing Science, second edition. Prentice-Hall InternationalSeries in Computer Science. Prentice-Hall International, New York, 1995.

[Bastiani and Ehresmann, 1972] Andr¶ee Bastiani and Charles Ehresmann.Categories of sketched structures. Cahiers de Topologie et G¶eom¶etrie Dif-f¶erentielle, 13:104{213, 1972.

71

Page 72: Graph-based Logic and Sketches I: The General Framework

[Brookes and Mislove, 1997] Stephen Brookes and Michael W. Mislove, edi-tors. Mathematical Foundations of Programming Semantics,Thirteenth Annual Conference. Elsevier, 1997.

[Burroni, 1970a] Albert Burroni. Esquisses des cat¶egories µa limites et desquasi-topologies. Esquisses Math¶ematiques, 5, 1970.

[Burroni, 1970b] E. Burroni. Cat¶egories discretement structur¶ees. EsquissesMath¶ematiques, 5, 1970.

[Coppey and Lair, 1988] L. Coppey and C. Lair. Le»cons de th¶eorie desesquisses, partie II. Diagrammes, 19, 1988.

[Duval and Reynaud, 1994a] Dominique Duval and Jean-Claude Reynaud.Sketches and computation (1). Mathematical Structures in Computer Sci-ence, 1994.

[Duval and Reynaud, 1994b] Dominique Duval and Jean-Claude Reynaud.Sketches and computation (2). Mathematical Structures in Computer Sci-ence, 1994.

[Duval and S¶en¶echaud, 1994] Dominique Duval and Pascale S¶en¶echaud.Sketches and parametrization. Theoretical Computer Science, 1994.

[Ebbinghaus et al., 1984] H.-D. Ebbinghaus, J. Flum, and W. Thomas.Mathematical Logic. Springer-Verlag, 1984.

[Ehresmann, 1966] Charles Ehresmann. Introduction to the theory of struc-tured categories. Technical Report 10, University of Kansas, 1966.

[Ehresmann, 1968a] Charles Ehresmann. Cat¶egories structur¶ees g¶en¶eralis¶es.Cahiers de Topologie et G¶eom¶etrie Diff¶erentielle, X:139{168, 1968.

[Ehresmann, 1968b] Charles Ehresmann. Esquisses et types des structuresalg¶ebriques. Bul. Inst. Polit. Ia»si, XIV, 1968.

[Eilenberg and Mac Lane, 1945] Samuel Eilenberg and Saunders Mac Lane.General theory of natural equivalences. Trans. Amer. Math. Soc., 58:231{244, 1945.

[Fourman and Vickers, 1986] Michael Fourman and S. Vickers. Theoriesas categories. In Category Theory and Computer Programming,D. Pitt et al., editors, volume 240 of Lecture Notes in Computer Science,pages 434{448. Springer-Verlag, 1986.

72

Page 73: Graph-based Logic and Sketches I: The General Framework

[Goguen and Burstall, 1986] Joseph A. Goguen and R. M. Burstall. A studyin the foundations of programming methodology: Speci¯cations, institu-tions, charters and parchments. In Category Theory and ComputerProgramming, D. Pitt et al., editors, volume 240 of Lecture Notes inComputer Science, pages 313{333. Springer-Verlag, 1986.

[Gray, 1987] J. W. Gray. Categorical aspects of data type constructors. The-oretical Computer Science, 50:103{135, 1987.

[Gray, 1989] J. W. Gray. The category of sketches as a model for algebraicsemantics. In Categories in Computer Science and Logic, John W.Gray and Andre Scedrov, editors, volume 92 of Contemporary Mathemat-ics, pages 109{135. American Mathematical Society, 1989.

[Gray, 1990] John W. Gray. Executable speci¯cations for data-type construc-tors. Diagrammes, 24:7{31, 1990.

[Guitart, 1974] Ren¶e Guitart. Remarques sur les machines et les structures.Cahiers de Topologie et G¶eom¶etrie Diff¶erentielle Cat¶egorique, 15, 1974.

[Guitart and Lair, 1980] Ren¶e Guitart and Christian Lair. Calcul syntaxiquedes modµeles et calcul des formules internes. Diagrammes, 4, 1980.

[Guitart and Van den Bril, 1977] Ren¶e Guitart and Luc Van den Bril.Decompositions et lax-completions. Cahiers de Topologie et G¶eom¶etrieDiff¶erentielle Cat¶egorique, 18, 1977.

[Kinoshita et al., 1997] Yoshiki Kinoshita, John Power, and MakotoTakeyama. Sketches. In Brookes and Mislove [1997].

[Kock, 1967] Anders Kock. Limit monads in categories. Aarhus PreprintSeries, 1967.

[Lair, 1987] Christian Lair. Trames et semantiques cat¶egoriques dessystµemes de trames. Diagrammes, 18, 1987.

[Lambek and Scott, 1984] Joachim Lambek and P. Scott. Aspects of higherorder categorical logic. In Mathematical Applications of CategoryTheory, J.W. Gray, editor, volume 30 of Contemporary Mathematics,pages 145{174. American Mathematical Society, 1984.

[Lambek and Scott, 1986] Joachim Lambek and P. Scott. Introduction toHigher Order Categorical Logic, volume 7 of Cambridge Studies inAdvanced Mathematics. Cambridge University Press, 1986.

73

Page 74: Graph-based Logic and Sketches I: The General Framework

[Makkai, 1993a] Michael Makkai. Generalized sketches as a framework forcompleteness theorems, 1993. Journal of Pure and Applied Algebra, toappear.

[Makkai, 1993b] Michael Makkai. The syntax of categorical logic, 1993. Pre-print, McGill University.

[Makkai and Par¶e, 1990] Michael Makkai and R. Par¶e. Accessible Cate-gories: the Foundations of Categorical Model Theory, volume 104of Contemporary Mathematics. American Mathematical Society, 1990.

[Makkai and Reyes, 1977] Michael Makkai and Gonzalo Reyes. FirstOrder Categorical Logic, volume 611 of Lecture Notes in Mathematics.Springer-Verlag, 1977.

[McDonald and Stone, 1984] John L. McDonald and Arthur Stone. Topoiover graphs. Cahiers de Topologie et G¶eom¶etrie Diff¶erentielle, XXV,1984.

[Meseguer, 1989] Jos¶e Meseguer. General logics. Technical Report CSL-89-5, SRI International Computer Science Laboratory, 333 Ravenswood Ave.,Menlo Park, CA 94025, USA, 1989.

[Power and Wells, 1992] A.J. Power and Charles Wells. A formalism for thespeci¯cation of essentially algebraic structures in 2-categories. Mathemat-ical Structures in Computer Science, 2:1{28, 1992.

[Tholen and Tozzi, 1989] Walter Tholen and Anna Tozzi. Completions ofcategories and initial completions. Cahiers de Topologie et G¶eom¶etrie Dif-f¶erentielle Cat¶egorique, pages 127{156, 1989.

[Wells, 1990] Charles Wells. A generalization of the concept of sketch. The-oretical Computer Science, 70:159{178, 1990.

[Wells and Barr, 1988] Charles Wells and M. Barr. The formal descriptionof data types using sketches. In Mathematical Foundations of Pro-gramming Language Semantics, Michael Main et al., editors, volume298 of Lecture Notes in Computer Science. Springer-Verlag, 1988.

74

Page 75: Graph-based Logic and Sketches I: The General Framework

Atish BagchiDepartment of MathematicsCommunity College ofPhiladelphia1700 Spring Garden St.Philadelphia, PA [email protected]

Charles WellsDepartment of MathematicsCase Western Reserve UniversityUniversity CircleCleveland, OH 44106-7058, [email protected]

75