On the word problem for SP-categories, and the properties of two-way communication
The word problem for categories with free products and coproducts (sums), SP-categories, is directly related to the problem of determining the equivalence of certain processes. Indeed, the maps in these categories may be directly interpreted as proce…
Authors: Luigi Santocanale, Robin Cockett
On the w ord problem for Σ Π -categories, and the prop erties of t w o-w a y comm unication ⋆ ⋆⋆ Robin Co c kett 1 and Luigi San to canale 2 1 Department of Computer Science, Universit y of Calgary robin@ucal gary.ca 2 Lab oratoire d’Informatique F ondamentale de M arseille, Universit ´ e Aix-Marseille I, luigi.sant ocanale@lif. univ-mrs.fr Abstract. The word problem fo r categ ories w ith fre e products and co- prod ucts (sums), Σ Π -categories , is directly related to th e problem of determining the eq uiv alence of certain processes. Indeed, the m ap s in these categories ma y b e directly interpreted as pro cesses which commu- nicate by tw o-wa y channels. The maps of an Σ Π -catego ry may also b e viewed as a pro of theory for a simple logic with a game theoretic intepretation. The cut-elimination proced ure for this logic determines equality only up to certain p erm uting conv ersions. As the equality classes under these p erm u ting conv ersions are finite, it is easy to see that equality b et w een cut-free terms (even in the presence of t h e additive un its) is decidable. Unfortunately , this do es not yield a tractable decision algorithm as these equiv alence classes can conta in exp onen tially many t erms . How ever, the rather sp ecial p roperties of these free categories – an d , thus, of tw o-wa y communication – allo w one to d evise a t rac table algorithm for equ al ity . W e show that, restricted to cut- fre e terms s, t : X − → A , the decision pro cedure runs in time p olynomial on | X | · | A | , th e pro duct of the sizes of th e domain and co domain typ e. Keywords. Σ Π -categories, bicatersian categories, word problem, tw o- w ay communicatio n, game semantics. In tro duction W e present a decision pro cedure for eq ualit y of para lle l a rro ws in Σ Π -categ ories. These categor ies hav e (chosen) finite sums (copro ducts) a nd finite pro ducts, in- cluding, significantly , the units for these categ orical op erations. Thus, the c a te- gories we co nsider do hav e an initial ob ject, the unit for the sum, a nd a terminal ob ject, the unit for the pro duct. Recall tha t word problems fo r a lg ebraic theories amo un t to studying the free mo dels o f these theories. Here the situation is analogo us: the theory of Σ Π - categorie s – b eing an ess en tially a lgebraic theor y – has free mo dels; the decision ⋆ Extended abstract. ⋆⋆ Researc h partially supp orted by the A NR pro ject SOAPDC no. JC05-57373. 2 Cock ett and Santocanale pro cedure we describ e relie s crucially on a num ber of alg ebraic facts p eculiar to free Σ Π -ca tegories. While the categorical structure we are inv estigating is one of the simplest, the status of the word problem for these categor ies has la ng uished in an unsa t- isfactory state. It is decidable as standar d to ols from ca tegorical logic [ 1 , 2 ] allow free Σ Π -ca tegories to b e viewed as deductive systems for logics. In [ 3 ] these deductive s ystems were shown to c o rrespo nd precis ely to the usual categorical coherence requirements for pr oducts and sums and, furthermore, to s atisfy the cut-elimination prop ert y . The fo cus of the decisio n pr ocedure then devolves up on the cut-free terms whose equiv alence is completely determined by a finite num b er of “p erm uting conv ersions ” . The cut-free terms, whic h represent arr o ws b et ween t wo given types, are finite in num ber a nd this implies , immediately , that equality is decida ble. How ever, the implied complexity of this wa y of deciding equality is exp onent ial b ecause there can be an exp onential num b er of equiv a len t terms. The question, whic h still remained op en, was whether the matter could be decided in p olynomial time. This was of particular interest as thes e e xpressions are, in the pro cess world, the a na logue of Bo olean express ions. The main contribution of this pap er is to confirm that there is a p o lynomial algor ithm which settles this questio n. There hav e be e n, directly or indirectly , a n um b er o f co ntributions tow ar ds our go al in this pap er. Most o f them in volv e a r epresen tation theorem, that is the provision of a full and faithful functor fro m some v a rian t of the free Σ Π - category into a concr ete combinatoric categor y . F or exa mple [ 4 ] cons ider s Σ Π - categorie s, in which the initial and final o b ject coincide and r epresen ts these using a sub category o f the categor y of cohe r en t spaces, while [ 5 ] a nd [ 6 ] bo th gives a r epresen tation of Σ Π -categ ories without u nits into, resp ectiv ely , a c o m binato r ic category of pro of-nets and the categ o ry of sets and r elations. These related results, howev er , work only for the fragment without units – or , mor e pr ecisely , for the frag men t with a co mmon initial and final ob ject. As far we know, there is no re pr esen tation theorem fo r the full frag ment with distinct units. Units add to the decision problem – and to the represe n tation theo ry – a non-trivial c hallenge which is ea sy to under estimate. I n particular, in [ 3 ], one of the current authors w as g uilt y of ra ther inno cently pr oposing an altog ether to o simple decisio n pro cedure which, while working p erfectly in the absence of units, fails ma nifestly in the presence of units. The effect of the presence of units on the setting is quite dramatic. In par ticular, when there are no units (or there is a zer o ) al l copro duct injections ar e mo nic. How ever, rather co ntrarily , in the presence of distinct units this simply is no t longer the ca se. F ur thermore, this can b e demons trated q uite simply , consider the following diag ram: 0 × 0 π 1 / / π 0 / / 0 σ 0 / / 0 + 1 As 0 + 1 ≃ 1 is a ter mina l ob ject, ther e is at most one arr o w to it: this makes the a bov e diagra m a c oequalizer . Y et, the ar ro ws π 0 , π 1 are distinct in a free Σ Π -category , as for example they receive distinct in ter pr etations in the dual category of the catego ry of sets and functions. The word problem for Σ Π -categories 3 As log ic ia ns and categor y theorists, we were deeply frustrated by this failure to master the units. The solution we now present for this decision problem, how ever, was devis ed only after a m uch deepe r algebraic understanding of the structure of free Σ Π -ca teg ories had b een obtained. The technical observ a tions which underly this developmen t, we b eliev e, should b e of interest to log ician and category theor ists alike. Y et, our pr incipal motiv a tion for studying the theory of Σ Π -categories and free Σ Π -categor ies arose fro m the ro le they have as mo dels of computation. W e discuss in details this po in t next. The pro of theor y of (free) sums a nd pro ducts in a categ ory is remark able from a n umber of p oin ts of view. No t o nly do es it pro vide an eleg an t pro of theory with a r ic h underlying algebraic calculus, but als o it supp orts a v a riet y of quite surpr ising interpretations. The most immediate interpretation, but by no means one which is tr a nspar- ent ly obvious s ee [ 7 , 8 , 9 ], is as a game theory in which the types repres e n t finite games. The pro ducts have the role of opp onen t while the sums hav e the r ole of player and there is no r equiremen t that plays alternate. The maps ar e then int erpreted as b eing media tors b et ween g ames which use the information of one game to determine the play on the other. Their comp osition is g iv en by hiding the tr a nsfer of informa tion which happ ens throug h moves on a middle g ame. Pro of theoretica lly this comp osition c an b e viewed as a cut-eliminatio n pro - cess which, in turn, algebraically trans la tes into a n elegant reduction s ystem which is confluent mo dulo equatio ns (the details ar e to b e found in [ 3 ]). As shall bec ome clear this pa per is largely concer ned with the consequences of the e q ua- tions which rema in after the cut has b een eliminated. Howev er , b efore discuss ing this we must describ e a second impo rtan t and app ealing interpretation. Arrows in the fre e ca tegory with s ums a nd pr oducts can also b e interpreted as pro cesses which communicate along channels: the types a re the (finite) pro tocols which govern the interactions along these channels. These pr otocols tell a pr ocess which wishes to communicate a lo ng a c hannel whether it is the turn of the pro cess to send a mess a ge (and pr ecisely which messages can then b e sent) or whether it is the turn of the pro cess to listen (and precisely which messages can be received). This is mor e than an idle idea : the theor etical details o f this interpretation hav e bee n fles hed out in some detail (and, in fact, mor e g e ne r ally to allow multiple channels) in [ 10 , 11 ]. This last interpretation is q uite comp elling as the alg ebraic results des cribed in this pa per s uggest a num b er of not very obvious and e v en so mewhat surpris - ing pro perties of communication along a channel. F or example, a pr ocess which is req uired to send a v alue c o uld send v ario us differe nt v alues and yet, s eman ti- cally , rema in ex ac tly the same pr o c ess . This is the notion o f indefiniteness which is central in the busine s s of unrav eling the meaning o f comm unication. There are v a rious s ituations in which this appa ren tly unint uitive situation c a n aris e. F or example, it could b e that the recipient o f the communication has s imply stopp ed lis tening. It is o f cours e very a nnoying when this happe ns but, unde- niable, this is an o ccurrence w e ll within the scop e of the human exp erience o f communication. How ever, it ca n also b e, more dramatically , that the sender has 4 Cock ett and Santocanale stopp ed co mm unicating to the r eceiv e r – a nd this pro duces what we shall call a disc onne ct . Pro of theo r etically and algebra ic a lly this all has to do with the behavior of the (additive) unit, that is, the final ob ject and the initial ob ject. T he purp ose o f this pap er is to fo cus o n these units and their ramificatio ns in the whole business of communication. It is cer tainly true that without the units the situation is very m uch simpler. How ever, if one is tempted therefore simply to omit them, it is worth realizing that witho ut any units there is simply no satisfactor y no tion of a finite c ommunic ation ! Of cours e, without the units the theory is not only simpler but a go od deal less mathema tically interesting. It is this mathematics which we now turn to. The pap er is structured as follows. In Section 1 , we recall the e le mentary definition of Σ Π - category , a nd the results of [ 3 ]. In Section 2 , w e start our analysis of the main prop erty of Σ Π -categ ories, so ftness, in order to g iv e it a more co ncrete meaning, accessible to the general logicia n, in terms of a s o rt o f undirected r ewrite system. In Section 3 , we s hall pre s en t o ur firs t main r esult, stating that copro duct injections are weakly disjoint in free Σ Π -ca tegories, a nd list some consequences . This leads to a dis cussion of arrows which facto r through a unit – indefinite arr ows – which play a key role in the decisio n pro cedure. In Section 4 we pre sen t our seco nd ma in observ a tion: if tw o arrows in hom( X × Y , A ) and ho m( Y , A + B ) are definite but ar e made e qual when, r espectively , pro jecting and co pro jecting into hom( X × Y , A + B ), this fact is witnessed by a unique “b ouncer” in hom( Y , A ). In Section 5 , we collect o ur obse rv ations and sketch the decis ion pr ocedure. 1 The constr u ction of free Σ Π -categories 1.1 Σ Π - c ategories W e invite the rea der to co nsult [ 12 ] for the bas ic catego rical notions us ed in this pap er. Here, an Σ Π -c ate gory shall mean a categor y with finite pro ducts a nd finite co products. Recall that a category ha s binary pr o ducts if, given tw o ob jects A, B , there exists a third ob ject A × B , a nd natural tra nsformations hom( X, A ) × hom( X, B ) h , i − − − → hom( X , A × B ) , hom( X i , A ) π i − − → hom( X 0 × X 1 , A ) , i = 0 , 1 , that induce inverse bijections: π i ( h f 0 , f 1 i ) = f i , i = 0 , 1 , h π 0 ( f ) , π 1 ( f ) i = f . A terminal obje ct o r empty pr o duct in a category is an ob ject 1 such that, for each ob ject X , hom( X , 1) is a singleto n. It is par t of s tandard theory that a terminal ob ject is unique up to isomo rphism and that it is the unit for then pro duct, as X × 1 is cano nic a lly isomor phic to X . The word problem for Σ Π -categories 5 W e obtain the definition of binary sums (or copr oducts) a nd o f initial o b ject, by exchanging the r o les of left and right ob jects in the de finitio n o f pr oducts: a category has binary sum s if, g iven tw o ob jects X , Y , there ex ists a thir d ob ject X + Y a nd natural trans formations hom( X , A ) × hom( Y , A ) { , } − − − → hom( X + Y , A ) , hom( X , A j ) σ j − − → hom( X , A 0 + A 1 ) , j = 0 , 1 , that induce inverse bijections: σ j ( { f 0 , f 1 } ) = f j , j = 0 , 1 , { σ 0 ( f ) , σ 1 ( f ) } = f . An initial obje ct 0 is such that, for each ob ject A , hom(0 , A ) is a s ing leton. A F ! ! D D D D D D D D D D D D D D D D D D η / / Σ Π ( A ) ∃ ! ˜ F B A functor b et ween t wo Σ Π -ca tegories A , B is a Σ Π -functor if it sends (c hosen) pro ducts to pro ducts, and (chosen) copro ducts to copro ducts. The fr e e Σ Π -c ate gory over a c ate gory A , deno ted Σ Π ( A ), ha s the following prop ert y: there is a func- tor η : A − → Σ Π ( A ) suc h that, if F : A − → B is a functor that “interprets” A into a Σ Π - category B , then there exists a unique Σ Π - fun ctor ˜ F : Σ Π ( A ) − → B suc h that ˜ F ◦ η = F . This is the usual universal prop erty illustrated by the diagram o n the right. The free Σ Π -categor y on A , can b e “co nstructed” as follows. Its ob jects a re the types inductively defined by the g rammar T = η ( x ) | 1 | T × T | 0 | T + T , (1) where x is an ob ject o f A . Then pro of-terms are genera ted a c c ording to the deduction system of figur e 1 . Finally , pr oof-terms t : X − → A are quo tiented by means o f the least equiv alence rela tion that for ces the equiv alence classes to satisfy the axioms of a Σ Π -ca tegory . O f course , while this is a p erfectly go o d sp ecification, we ar e lo oking for an effective pres e n tation fo r Σ Π ( A ). A first s tep in this direction c o mes from the fact the identit y-r ule as well as the cut- r ule can be elimina ted from the system. Mor e precisely we hav e the following theor em: Prop osition 1 (See [ 3 ] Prop osition 2.9). The cut -elimi nation pr o c e dur e gives rise to a r ewrite system that is c onfluent mo dulo the set of e quations of figur e 2 . F rom this we obta in an effective des cription of the categ ory Σ Π ( A ): the ob jects are the types generated by the grammar ( 1 ), while the a r ro ws are eq uiv alence classes of (identit y | cut)-free pro of-terms under the least equiv alence g enerated by the equatio ns of figure 2 . Comp osition is given by the cut-elimination pro cedure, which by the ab o ve theore m is well defined o n equiv a lence cla sses. Thu s, our ma in goa l in the r e s t of the pap er is the following: given tw o proof- terms s, t : X − → A , are th ey equivalen t according to the least equivalence relati on generated by the equati ons of figure 2 ? The problem is easily s een to b e dec ida ble: 6 Cock ett and Santocanale identit y- rule X id X − − − → X X f − − → C C g − → A cut-rule X f ; g − − − → A x f − − → y Generators rule η ( x ) η ( f ) − − − → η ( y ) − R 1 X ! − → 1 X i f − − → A L i × X 0 × X 1 π i ( f ) − − − − → A X f − − → A X g − → B R × X h f,g i − − − − → A × B − L 0 0 ? − → A X f − − → A Y g − → A L + X + Y { f ,g } − − − − → A X f − − → A j R j + X σ j ( f ) − − − − → A 0 + A 1 Fig. 1. The deductive system for Σ Π ( A ) the con tribution of this pa per is to show that, furthermor e , ther e is a feasible algorithm. The main theore tical to ol we shall use in developing this alg orithm is the idea of softness which we now intro duce. In every Σ Π -ca tegory there exist canonical maps a j hom( X , A j ) − − → hom( X , a j A j ) , a i hom( X i , A ) − − → hom( Y i X i , A ) . (2) W e shall b e int erested in these maps when, in a free Σ Π -categor y Σ Π ( A ), X = η ( x ) a nd A = η ( a ) are g enerators. The word problem for Σ Π -categories 7 π i ( h f , g i ) = h π i ( f ) , π i ( g ) i σ j ( { f , g } ) = { σ j ( f ) , σ j ( g ) } π i ( σ j ( f )) = σ j ( π i ( f )) {h f 11 , f 12 i , h f 21 , f 22 i} = h { f 11 , f 21 } , { f 12 , f 22 }i π i (!) = ! σ j (?) = ? { ! , ! } = ! h ? , ? i = ? ! 0 =? 1 Fig. 2. The equations on (identit y | cut)-free pro of-terms In every Σ Π -ca tegory there a lso exis t canonical comm uting diag r ams o f the for m ` i,j hom( X i , A j ) ` j hom( Q i X i , A j ) / / hom( Q i X i , ` j A j ) ` i hom( X i , ` j A j ) / / (3) The fo llo wing key theo r em ho lds: Theorem 2 (See [ 3 ] Theorem 4. 8). The fol lowing pr op erties hold of Σ Π ( A ) : 1. The functor η : A − → Σ Π ( A ) is ful l and faithful. 2. Gener ators ar e atomic , that is, the c anonic al maps of ( 2 ) – with X = η ( x ) and A = η ( a ) – ar e isomorphi sms. 3. Σ Π ( A ) is soft , me aning that the c anonic al diagr ams of ( 3 ) ar e pushouts. Mor e over, if B is a Σ Π -c ate gory with a functor F : A − → B , so that the p air ( F, B ) satisfies 1,2,3, then the ext ension ˆ F : Σ Π ( A ) − → B is an e quivalenc e of c ate gories. Thu s, the structur e of the c a tegory Σ Π ( A ) is pr ecisely determined by the con- ditions 1,2,3. W e shall sp end the next section giving an explicit acco un t o f the prop ert y of softness. The theorem is a sp ecial instance of the more g eneral ob- serv ations due to J o yal o n free bico mplete categor ies [ 13 , 14 ]. 2 An accoun t of softness A decision pro cedure necessar ily fo cuses o n the homse t ho m( X 0 × X 1 , A 0 + A 1 ) which, by Theorem 2 , is a cer tain the pusho ut. Eq uiv alently , this homset is the 8 Cock ett and Santocanale colimit of what we shall r efer to as the “dia gram of cardina ls”: hom( X 0 × X 1 , A 0 ) hom( X 0 , A 0 ) π 0 o o σ 0 / / hom( X 0 , A 0 + A 1 ) hom( X 1 , A 0 ) π 1 O O σ 0 hom( X 0 , A 1 ) π 0 σ 1 O O hom( X 1 , A 0 + A 1 ) hom( X 1 , A 1 ) π 1 / / σ 1 o o hom( X 0 × X 1 , A 1 ) The explicit wa y of co ns tructing suc h a c o limit – see [ 12 , § V.2.2] – is to first consider the s um S of the cor ners: hom( X 0 , A 0 + A 1 ) + hom( X 1 , A 0 + A 1 ) + hom( X 0 × X 1 , A 0 ) + hom( X 0 × X 1 , A 1 ) and then quo tien t S b y the eq uiv alence relation generated by ele men tary pairs , i.e. pairs ( f , g ) such that, for s o me h , f = π i ( h ) and σ j ( h ) = g , as s k etched below: h ∈ hom( X i , A j ) π i u u j j j j j j j j j j j j j j j σ j ) ) T T T T T T T T T T T T T T T f ∈ hom( X 0 × X 1 , A j ) g ∈ hom( X i , A 0 + A 1 ) Thu s, for f , f ′ ∈ S we hav e that [ f ] = [ f ′ ] ∈ hom( X 0 × X 1 , A 0 + A 1 ) if and o nly if there is a path in the dia gram of cardinals from f to f ′ , that is a sequence f 0 f 1 f 2 . . . f n , where f = f 0 and f n = f ′ , such that, for i = 0 , . . . , n − 1, ( f i , f i +1 ) or ( f i +1 , f i ) is an elementary pair. 3 The geometry of softness: w eak disjoin teness Let us r ecall that a p oint in a Σ Π -category is an arr o w of the form p : 1 − → A . When a n ob ject has a p oint we shall s a y it is p ointe d . Similar ly , a c op oint is an arrow of the form c : X − → 0 and an ob ject with a cop oin t is c op ointe d . An ob ject of Σ Π ( ∅ ) can b e viewed a s a tw o-player g ame on a finite tre e , with no dr a w final p osition. Points then corresp ond then to winning strategies for the play er , while co points co rrespo nd to winning s trategies for the opp onen t. Thus, by determinacy , every ob ject of Σ Π ( ∅ ) either has a p oin t or a cop oint but not bo th. The firs t imp ortan t result for analyzing softness concerns copo in ts and co- pro duct injections: The word problem for Σ Π -categories 9 X A 1 g / / A 0 + A 1 σ 1 A 0 f σ 0 / / 0 ∃ c ? A 1 j j j j j j j 4 4 j j j j j j ? A 0 Theorem 3. Copr o duct s ar e, i n Σ Π ( A ) , we akly disjoint: if f ; σ 0 = g ; σ 1 : X − → A + B , then ther e exists a c op oint c : X − → 0 such that f = c ; ? and g = c ; ? . The pr operty is illustr a ted in the diagra m. The Theorem has an interesting in terpreta- tion from the per spective of pro cesses: a pr o- cess can send inco heren t messages – white noise – on a channel without changing the meaning of the comm unication when and only when the r ecipien t has stopp ed listening. The consequences o f misjudging when the recipient stops listening, of course, is well-understo od by scho ol children a nd adults alike! Pr o of. W e sketch here the pro of of the Theor em 3 , emphasizing its geo metr ical flav o r, as the diagram o f car dinals is a sort of a o ne dimensional sphere. W e s ay that a triple ( X | A 0 , A 1 ) is go od if for every f : X − → A 0 and g : X − → A 1 the statement of the Theorem holds. Similarly , we say that a triple ( X 0 , X 1 | A ) is go od if, for every f : X 0 − → A and g : X 1 − → A , the dual statement of the Theorem holds. W e prove that every tr iple is go o d, by induction on the structural complexity o f a triple. The non trivial induction s tep arise s when consider ing a triple of the for m ( X 0 × X 1 | A 0 , A 1 ) – or the dual case. Here, saying tha t the eq ua lit y f ; σ 0 = g ; σ 1 holds means that ther e exists a path φ of the for m f 0 f 1 . . . f n in the diagra m o f cardinals from f = f 0 ∈ ho m( X 0 × X 1 , A 0 ) to g = f n ∈ hom( X 0 × X 1 , A 1 ), i.e. from nor th west to so utheast. Mo reo ver, we may as s ume φ to b e simple. Such path necessa r ily cross e s one of so uth west or northea st corners, let us say the la tter. This means that, for some i = 1 , . . . , n − 1, f i ∈ hom( X 0 , A 0 + A 1 ), and f i − 1 , f i +1 are in opp osite co rners. W.l.o .g. we can assume f i − 1 ∈ hom( X 0 × X 1 , A 0 ) a nd f i +1 ∈ hom( X 0 × X 1 , A 1 ). T a king into account the definition of a n elementary pair, we see that for some h ∈ ho m( X 0 , A 0 ) and h ′ ∈ ho m( X 0 , A 1 ) we hav e h ; σ 0 = f i = h ′ σ 1 . Thus, by the inductive hypothesis o n ( X 0 | A 0 , A 1 ), we hav e h = c ; ? A 0 and h ′ = c ; ? A 1 ; in particula r the pro jection π 0 : X 0 × X 1 − → X 0 is epic, b ecause of the e xistence of a c opoint c : X 0 − → 0. Recalling that the path φ is simple, we deduce that i is the o nly time φ visits northeast, i.e. such that f i ∈ ho m( X 0 , A 0 + A 1 ). A similar analysis shows that if φ c rosses a corner , then it v is its that corner just once. Thus, we deduce tha t φ do es not cros s the northw est cor ner, as φ visits the no rth west cor ner a t time 0 a nd a co rner may b e crossed only a t time i ∈ { 1 , . . . , n − 1 } . Simila r ly , φ doe s no t cross the southea s t corner. Also , φ c annot visit the southw est corner , a s this would imply that at least one of northw est or southeast c orners has b een c r ossed. Putting these consider ations together , we deduce tha t φ visits the no rth west, northeast, and southeast corners exa ctly o nce. That is, φ ha s length 2 and i = 1. Recalling the definition of elementary pair, we have f = f 0 = π 0 ; h , h ; σ 0 = f 1 , f 1 = h ′ ; σ 1 , π 0 ; h ′ = f 2 = g . 10 Cock ett and Santocanale Considering that h = c ; ? A 0 and h ′ = c ; ? A 1 , we deduce that f = π 0 ; c ; ? A 0 and g = π 0 ; c ; ? A 1 . ⊓ ⊔ There are a num b er of consequences of this Theorem relev a n t to the decision pro cedure. T o this end we need to intro duce so me terminolog y a nd so me obser- v ations. W e say that a n arrow f is p ointe d if it fac tors through a po in t, i.e. if f =!; p for some p oint p . Similarly , an arr ow is c op ointe d if it factors throug h a cop oin t. Note that a n o b ject A is p oint ed iff ? : 0 − → A is p oin ted and, similar ly , X is cop ointed iff ! : X − → 1 is co pointed. A map which is neither p oin ted now cop oin ted is said to b e definite , otherw is e it is said to b e indefinite . The following tw o facts ar e consequences of the theo r em which ca n b e ob- tained by a careful structural analysis : Corollary 4 . 1. It is p ossible to de cide (and find witnesses) in line ar t i me in the size of a term whether it is p ointe d or c op ointe d. 2. A c opr o duct inje ct ion σ 0 : A − → A + B is monic iff either B is n ot p ointe d or A is p ointe d. In p articular ? : 0 − → B is monic iff B is not p ointe d. An a rro w is a disc onne ct if it is b oth p oin ted and cop oin ted: it is easy to see that there is at most one disco nnect b et ween any tw o ob jects. F urthermor e, if an arrow f : A − → B is co pointed, that is f = c ; ?, and its co domain, B , is p oint ed then f is this unique disc onnect. On the o ther hand, if the co domain B is not po in ted then ? : 0 − → B is mo nic and, th us, such an f cor responds precisely to the co point c . These observ ations allow the equality of indefinite maps, i.e. po in ted and cop oin ted, to b e decided in linear time. A further imp ortant fact which a lso follows from 4 , in a simila r vein to the ab o ve, conce r ns w hether a map in Σ Π ( A ) factors throug h a pro jection o r a copro jection. This can a lso be decided in linear time on the s ize o f the term. This is by a structura l a nalysis which we now sketc h. Suppo se that we wish to determine whether f = σ 0 ( f ′ ) : A − → B + C . If syntactically f is σ 1 ( f ′ ) then, as a consequence of T he o rem 3 , the only wa y it can factorize is if the map is cop oin ted. How ever, whether f is cop ointed can be deter mined in linea r time on the term by Coro llary 4 . The tw o remaining po ssibilities ar e tha t f is syn tactically { f 1 , f 2 } or π i ( f ′ ). In the for mer case, inductively , b oth f 1 and f 2 hav e to factorize through σ 0 . In the latter case, when the map is not co pointed, f ′ itself must facto rize through σ 0 . There is, at this p oint, a sligh t a lgorithmic subtelty: to determine w he ther f can b e factoriz ed throug h a pro jection it seems that we may hav e to rep eat- edly recalcula te w he ther the term is p oin ted o r cop oin ted a nd this r e c alculation would, it seems, push us b eyond linear time. How ever, it is not hard to see that this the recalculatio n can b e av o ided simply by pro cessing the term initially to include this information into the structure of the term (minimally tw o extra bits are needed at ea c h no de to indicate p oin tedness and cop oin tedness o f the map): subsequently this information would b e av ailable at constant cost. The cost of The word problem for Σ Π -categories 11 adding this information in to the structur e of the term is linear and, e ven b et- ter, the cost o f maintaining this informa tio n, as the term is manipulated, is a constant overhead. 4 Bouncing Given the prev ious discussion, eq ualit y for indefinite terms is understo od a nd so we ca n fo cus our attention o n definite terms. The main difficulty of the decisio n pro cedure concerns equality in the homset hom( X 0 × X 1 , A 0 + A 1 ). How ever, the pr o of of Theor em 3 has revealed an imp ortant fact: if two terms in this homset have a definite denotatio n, then any p ath in the diagr am of c ar dinals that witnesses the e quality b etwe en them c ann ot cr oss a c orner of the diagr am ; that is , such a path must b ounc e backward and forward on o ne side: hom( X 0 × X 1 , A j ) π i ← − − − − hom( X i , A j ) σ j − − − − → hom( X i , A 0 + A 1 ) . (4) In other words, in o r der to understa nd definite maps w e ne e d to study the pushouts of the a bov e spans. Notice that the pro of of Theor em 3 a lso r ev ea ls that some simple paths in the diagram of ca rdinals have bo unded length. Howev er, that pro of do es not provide a b ound for the leng th of paths that b ounce on one side. It is the purpos e of this section to arg ue that such a b ound does indeed exist and to explore the algor ithmic consequences. W e start our ana lysis by consider ing a genera l span B f ← − − A g − → C of s ets and b y re calling the co nstruction of its co limit, the pushout B + A C . This can be constr ucted by sub dividing B and C into the image of A and the complement of that image. Thus, if B = Im ( f ) + B ′ and C = Im ( g ) + C ′ then B + A C = A ′ + Im ( ρ ) + B ′ where ρ : A → B + A C . The image Im ( ρ ) is the quo tient of A with resp ect to the equiv alence r elation witnessed by “ bouncing data ” ; b ouncing data is a seq ue nc e of elemen ts of A , ( a 0 , a 1 , ..., a n ), with, for each 0 ≤ i < n either f ( a i ) = f ( a i +1 ) or g ( a i ) = g ( a i +1 ). Bouncing data , ( a 0 , a 1 , ..., a n ), is said to be irr e dundant if adjac e n t pairs in the se q uence are identified for different reaso ns. Thu s, in irredunda n t b ouncing data if f ( a i ) = f ( a i +1 ) then f ( a i +1 ) 6 = f ( a i +2 ) and similarly for g . Redundant b o uncing data ca n alwa ys b e improv ed to be irredundant by simply eliding intermediate redunda nt steps. F or b o uncing data of length 2, ( a 0 , a 1 , a 2 ), we sha ll wr ite a 1 : a 0 a 2 to indicate f ( a 0 ) = f ( a 1 ) and g ( a 1 ) = g ( a 2 ), and we shall call a 1 a b ounc er from a 0 to a 2 . The following is a general o bserv a tion concerning pushouts of sets: Prop osition 5. F or any pushout of B f ← − − A g − → C in set s the fol lowing ar e e quivalent: 1. If a 0 , a n ar e r elate d by some b ouncing data, then they ar e r elate d by b oun ci ng data of length at most 2. 2. The e qu ivalenc e r elations gener ate d by f and g c ommute. 3. The pushout diagr am is a we ak pul lb ack, i.e. the c omp arison m a p to the pul lb ack is su rje ctive. 12 Cock ett and Santocanale Mor e over, when one of these e quivalent c onditions holds, the pushout is a pul lb ack iff for every a 0 and a 2 r elate d by b ouncing data ther e is a unique element a 1 such that a 1 : a 0 a 2 . X i f / / ∃ ! h A j σ j # # H H H H H H H H H X 0 × X 1 π i : : v v v v v v v v v π i $ $ H H H H H H H H H A 0 + A 1 X i g / / A j σ j ; ; v v v v v v v v v Surprisingly , this a ltogether sp ecial situation holds in Σ Π ( A ). More precisely , we sa y that the homset hom( X i , A j ) b ounc es if, for each pair of ob jects X 1 − i , A 1 − j , the span ( 4 ) ha s a pushout which makes the hom- set hom( X i , A j ) the pullba c k. In- tuitiv ely , hom( X i , A j ) bo unces if, whenever the upper and low e r le gs of the dia gram on the right a re equal (and definite), this is b ecause of a unique b ouncer h : f g , w he r e h is shown do tt ed and the fact that it is a b ouncer means that the tw o smaller rectang les comm ute. Thu s we have: Theorem 6. In Σ Π ( A ) al l homsets b ounc e. The The o rem implies that if f and g are rela ted by a bouncing path in the diagram of cardinals, then there exists a path of length a t most 2 relating them. The pro of of the Theorem 6 relies o n a tricky structural induction on the pairs ( X i , A j ). Rather than presenting it her e, we shall illustra te the pro of fo r the sp ecial case o f Σ Π ( ∅ ), the initial Σ Π -ca tegory . Here the situation is muc h simpler, a s noted ab o ve, since each o b ject is either p ointed o r co pointed, but not bo th. W e observe first that when there is a map from X i to A j , if X i is p oin ted then A j m ust b e p oin ted as well and, dually , when A j is cop oin ted X i m ust b e cop oin ted. As X i and A j m ust b e either po in ted or cop oin ted it follows that X i is p oin ted (res pectively cop ointed) if a nd o nly if A j is. How ever, if A j is p oin ted then σ j is monic so the bouncer h is fo rced to b e f . Other wise, if A j is not po in ted, then A j is cop ointed and X i as well; then π i is epic and the b ouncer h is forced to b e g . When h ∈ { f , g } , say tha t the bouncer s h : f g is trivial. While Σ Π ( ∅ ) has only trivial b ouncers, the nex t example shows that this not in ge neral the case. Let k : x → a b e an a rbitrary map of A , let X 0 = (0 × 0) + η ( x ) and A 0 = (1 + 1 ) × η ( a ), le t z : 0 × 0 − → 1 × 1 b e the unique disconnect. Reca lling that an ar ro w from a copro duct to a pro duct might be repres en ted as a matr ix, define f = z π 0 ( {} ) σ 0 ( hi ) η ( k ) h = z π 1 ( {} ) σ 0 ( hi ) η ( k ) g = z π 1 ( {} ) σ 1 ( hi ) η ( k ) as ar ro ws of the homset hom( X 0 , A 0 ). Then h : f g is an example of a non- trivial b ouncer whenever X 1 is cop ointed and A 1 is p oin ted, since then f a nd h are co equalized by σ 0 and h and g are eq ualized by π 0 . Notice, how ever, that this example r elies cruc ia lly on having atomic ob jects. Also, this is a so rt of minimal example of a no n trivial b ouncer; it sug gested to us that the equiv alence relations generated by σ 0 and π 0 might commute, see Pro p osition 5 . The word problem for Σ Π -categories 13 l e t e q u i v a l e n t f g = l e t f ′ , g ′ b e s u c h t h a t f ≡ σ j ( f ′ ) a n d g ≡ π i ( g ′ ) i n i f f ′ , g ′ d o n o t e x i s t t h e n f a l s e e l s e i f X 1 − i i s c o p o i n t e d t h e n e q u a l σ j ( f ′ ) σ j ( g ′ ) e l s e ( * A 1 − j i s p o i n t e d * ) e q u a l π i ( f ′ ) π i ( g ′ ) W e conclude this Sec- tion b y sk etching an algo- rithm — named equi valent , which w e pr esen t on the right for Σ Π ( ∅ ) – that computes whether a ter m f of the homset hom( X 0 × X 1 , A j ) is equiv alent to a term g of the homset hom( X i , A 0 + A 1 ) within the pushout of the span ( 4 ). The alg orithm tries to lift f and g to f ′ , g ′ in the homset ho m ( X i , A j ) a nd, if s uccessful, it tests for the existence of a b o uncer h : f ′ g ′ . Notice that the algorithm is defined by m utual recursio n on the g e ne r al decisio n pro cedure equal . 5 The decision pro cedu re W e present in Figure 3 the de c ision pro cedure for Σ Π ( ∅ ). The gener al de c ision pro cedure for Σ Π ( A ) – which dep ends on having a decis io n pro cedure for A – is conside r ably complicated by having to construct non-tr iv ial b ouncers; we describ e it in the full pap er. The pro cedure. T he pro cedure star ts with tw o para llel terms in Σ Π ( ∅ ), f , g : X → A . If X is initial o r A is final then we are do ne – there are o f course no maps if X is final and A is initial. If either X is a co pr oduct or A is a pro duct we can decomp ose the maps and recurs iv ely check the equa lity of the comp onen ts. Thu s, if X = X 1 + X 2 then f = { σ 0 ; f , σ 1 ; f } and g = { σ 0 ; g , σ 1 ; g } , and then f = g if and only if σ i ; f = σ i ; g for i = 0 , 1. This r equires that o ne cut-eliminates the co mpositions with σ i – which can b e p erformed in time linear in the siz e of the ter m. This reduces the problem to the situation in which the do main of the maps is a pro duct and the co domain is a copro duct. Her e we hav e to consider t wo ca s es: Indefinite maps. In s ection 3 we mentioned that in time linear on the size of the maps (which is in turn b ounded by the pro duct of the t yp es) one c an determine whether the map is p oin ted (and pr oduce a p o in t) or cop oint ed (and pro duce a cop oin t). If b o th terms ar e p oint ed and cop ointed then they ar e the unique disconnect and we a r e done. If one ter m is just p oin ted the other must be just p ointed and the p oint s must agree (and dua lly fo r b eing just cop oint ed). Definite maps. When the maps ar e definite then a fir st g o al is to determine whether the term f fa c tors thr o ugh a pro jection or a co pr o jection o r, indeed, bo th (i.e. f = σ i ( f ′ ) or f = π j ( f ′ )). Thes e fa c toring pr operties, as was discusse d ab o ve, can b e determined in linear time. Using thes e prop erties – r emem b ering that a path in the diag ram of cardinals that rela tes tw o definite ter ms ca n only mov e a long a side – there are tw o ca ses, either they b ounces or they do no t. It they b ounce w e can reduce the proble m to the ca se when one term facto rs 14 Cock ett and Santocanale l e t e q u a l f g = m a t c h ( d o m f , c o d g ) w i t h ( 0 , _ ) | ( _ , 1 ) - > t r u e | ( 1 , A 0 + A 1 ) - > l e t i, f ′ , j, g ′ b b e s u c h t h a t f ≡ σ i ( f ′ ) a n d g ≡ σ j ( g ′ ) i n i f i = j t h e n e q u a l f ′ g ′ e l s e f a l s e | ( Y 0 × Y 1 , 0 ) - > . . . d u a l | ( _ , A 0 × A 1 ) - > l e t f 0 , f 1 , g 0 , g 1 b e s u c h t h a t f ≡ h f 0 , f 1 i a n d g ≡ h g 0 , g 1 i i n ( e q u a l f 0 g 0 ) & & ( e q u a l f 1 g 1 ) | ( Y 0 + Y 1 , _ ) - > . . . d u a l | ( X 0 × X 1 , A 0 + A 1 ) - > i f d e f i n i t e f g t h e n m a t c h ( f , g ) w i t h ( π i ( f ′ ) , σ j ( g ′ ) ) | ( σ j ( g ′ ) , π i ( f ′ ) ) - > e q u i v a l e n t f ′ g ′ | ( π i ( f ′ ) , π i ( g ′ ) ) - > l e t i, ˜ g b e s u c h t h a t π i ( g ′ ) ≡ σ j ( ˜ g ) i n i f s u c h i, ˜ g d o n o t e x i s t t h e n e q u a l f ′ g ′ e l s e e q u i v a l e n t f ′ ˜ g | ( σ i ( f ′ ) , σ i ( g ′ ) ) - > . . . d u a l | _ - > f a l s e e l s e e q u a l _ i n d e f i n i t e f g Fig. 3. The decisio n pro cedure for Σ Π ( ∅ ). through a pro jection and the other throug h a copro jection (using equiva lent ). If the terms do not b ounce then they b oth must fa ctor synt a ctic al ly in the sa me manner s o that f is σ 0 ( f ′ ) a nd g is σ 0 ( g ′ ), then f ′ m ust equal g ′ . Complexity . T o o btain the complexity o f this algorithm we s hall use an im- po rtan t obser v ation: in Σ Π ( ∅ ) t he size of any cut-eliminate d term r epr esenting an arr ow t : X − → A is b ounde d by the pr o duct of the sizes of the typ es and its height is b ounde d by the sum of the heights of the typ es. This is pr o ven by a simple structural induction. The decision pro cedure now uses one pr eprocess ing sweep to annotate the terms (a nd the types) with information conce rning what is po in ted and co- po in ted. Then the main equality algor ithm is applied which employs tw o sorts of alg orithm (on subterms), which manipulate the terms and re quire linear time on the maximal size of the input and output terms. The first o f these algorithm simply forms a tuple when the co domain is a pro duct and a cotuple when the do main is a sum. The seco nd a lgorithm de- termines whether a term can b e factor ed via a pr o jection o r copro jection and returns a facto red version. Getting this to run in linear time do es require that The word problem for Σ Π -categories 15 the p ointed and cop oin ted infor mation can b e r etriev ed in consta n t time (which is managed by prepro cessing the terms). The o ther ma jor step in the algorithm, which we hav e not discussed for the general ca se, inv olves finding a b ouncer. In the Σ Π ( ∅ ) c a se this inv o lv es de- termining which of the pr o jection or copro jection is resp ectiv ely epic or monic. This, in turn, is deter mined by the p oin tedness or cop ointedn ess of the co mpo- nent s of the type which can usefully b e ca lculated in the prepro cessing stag e – and so is constant time. Essentially this means tha t the algo rithm at each no de of the ter m requires pro cessing time b ounded by a time pr oportio nal to the (maxima l) size of the subterm. Such a pattern o f pr ocessing is b ounded by time pr oportio nal to the height of the term times the size . W e therefore have: Prop osition 7. T o de cide the e quality of t wo p ar al lel terms t 1 , t 2 : A − → B in Σ Π ( ∅ ) has c omplexity in O (( hgt ( A ) + hgt ( B )) · size ( A ) · size ( B )) . The analysis of the algo rithm for Σ Π ( A ) is mor e complex and is left to the fuller exp osition. References 1. Lam b ek, J.: Deductive systems and categories. I . Sy n t actic calculus and residuated categories. Math. S ystems Theory 2 (1968) 287–318 2. Do ˇ sen, K.: Cut elimination in categories . V olume 6 of T rends in Logic—Studia Logica Library . Kluw er A ca demic Publishers, D ordrec ht (1999) 3. Cock ett, J.R.B., Seely , R .A.G. : Finite sum-pro duct logic. Theory Appl. Categ. 8 (2001) 63–99 (electronic) 4. Hu, H., Joy al, A.: Coherence completions of categori es. Theoret. Comput. Sci. 227 (1-2) (1999) 153–184 Linear logic, I (T okyo, 1996). 5. Hughes, D .J.D., v an Glabb eek, R.J.: Pro of nets for u n it-free m ultiplicative-additiv e linear logic (extend ed abstract). In: LICS, IEEE Comput er So cie ty (2003) 1–10 6. Do ˇ sen, K., Petri ´ c, Z.: Bicartesian coherence revisited. In O gn janovic, Z., ed.: Logic in Computer Science, Zb ornik R ado v a. V olume 12. (2009) 7. Blass, A .: A game semantics for linear logic. A nn. Pure A ppl. Logic 56 (1-3) (1992) 183–220 8. Jo yal, A.: F ree lattices, comm un ica tion an d money games. In: Logic and scien- tific metho ds (Florence, 1995). V olume 259 of Sy n these Lib. Kluw er Acad. Pub l., Dordrech t (1997) 29–68 9. Santocanale, L.: F ree µ -lattices. J. Pure App l. A lge bra 168 (2-3) (2002) 227–264 Category theory 1999 (Coimbra). 10. Cock ett, J.R.B., Pastro, C.A.: A language for multiplicativ e-additive linear logic. Electr. Notes Theor. Comput. Sci. 122 (2005) 23–65 11. Cock ett, J.R.B., P astro, C.A.: The logic of message passing. CoRR abs/- math/0703713 (2007) 12. Mac Lan e, S.: Categories for the working mathematician. Second edn . V olume 5 of Graduate T ex ts in Mathematics. Springer-V erlag, New Y ork (1998) 13. Jo yal, A .: F ree bicomplete categories. C. R. Math. R ep. A cad. Sci. Canada 17 (5) (1995) 219–224 14. Jo yal, A.: F ree b ico mpletion of enriched categories. C. R. Math. Rep . Acad. Sci. Canada 17 (5) (1995) 213–218
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment