A sequent calculus for the Tamari order Noam Zeilberger University of Birmingham [email protected] Abstract—We introduce a sequent calculus with a simple restrictionofLambek’sproductrulesthatpreciselycapturesthe classical Tamari order, i.e., the partial order on fully-bracketed words (equivalently, binary trees) induced by a semi-associative law(equivalently,treerotation).Weestablishafocusingproperty for this sequent calculus (a strengthening of cut-elimination), 7 which yields the following coherence theorem: every valid en- 1 tailmentintheTamariorderhasexactlyonefocusedderivation. 0 Onecombinatorialapplicationofthiscoherencetheoremisanew 2 proofoftheTutte–Chapotonformulaforthenumberofintervals n intheTamarilatticeYn.Wealsoapplythesequentcalculusand a the coherence theorem to build a surprising bijection between J intervals of the Tamari order and a certain fragment of lambda calculus, consisting of the β-normal planar lambda terms with 1 no closed proper subterms. 1 I. INTRODUCTION ] O A. The Tamari order, and Tamari lattices L Suppose you are given a pair of binary trees A and B and Fig.1. TheTamarilatticeY3. s. the following problem: transform A into B using only right c rotations. Recall that a right rotation is an operation acting [ locallyonapairofinternalnodesofabinarytree,rearranging trees with n internal nodes) which also count many other 1 them like so: isomorphic families of objects, the Tamari order has many v other equivalent formulations as well, such as on strings of 7 balanced parentheses [12], triangulations of a polygon [26], −→ 1 or Dyck paths [3] (see also [13, pp. 474–475]). 9 For any fixed natural number n, the C objects of that size 2 Solving this problem amounts to showing that A ≤ B in n 0 form a lattice under the Tamari order, which is called the the Tamari order. Originally introduced by Dov Tamari in . Tamari lattice Y . For example, Figure 1 shows the Hasse 1 the study of monoids with a partially-defined multiplication n diagram of Y , which has the shape of a pentagon, and 0 operation [10], [29], [30], the Tamari order is the partial 3 7 readers familiar with category theory may recognize this as orderingonwordsinducedbyaskingthatmultiplicationobeys 1 “Mac Lane’s pentagon” [20]. More generally, a fascinating a semi-associative law1 : property of the Tamari order is that each lattice Y generates v n i (A∗B)∗C ≤A∗(B∗C) via its Hasse diagram the underlying graph of an (n − 1)- X dimensional polytope called an “associahedron” [23], [28]. r and is monotonic in each argument: a A≤A(cid:48) B ≤B(cid:48) B. A Lambekian analysis of the Tamari order A∗B ≤A(cid:48)∗B A∗B ≤A∗B(cid:48) In this paper we will consider a surprisingly elementary For example, the word (p ∗ (q ∗ r)) ∗ s is below the word (but to the best of my knowledge previously unstudied) p∗(q ∗(r ∗s)) in the Tamari order. The variables p,q,... presentation of the Tamari order as a sequent calculus in the arejustplaceholdersandwhatreallymattersistheunderlying spirit of Lambek [16], [17]. This calculus consists of just one shape of such “fully-bracketed words”, which is what justifies left rule and one right rule: the above description of the Tamari order in terms of tree A,B,∆−→C Γ−→A ∆−→B rotations.Since,binarytreesareenumeratedbytheubiquitous ∗L ∗R Catalan numbers (there are C =(cid:0)2n(cid:1)/(n+1) distinct binary A∗B,∆−→C Γ,∆−→A∗B n n together with two structural rules: 1Clearly, one has to make an arbitrary choice in orienting associativity fromleft-to-rightorright-to-left,andTamari’soriginalpapersinfacttookthe Θ−→A Γ,A,∆−→B oppositeconvention.Theliteratureisinconsistentaboutthis,butsincethetwo id cut possibleordersdefinedarestrictlydualitdoesnotmakemuchdifference. A−→A Γ,Θ,∆−→B Here,Γ,∆,andΘrangeoverlistsofformulascalledcontexts, only the rules ∗L, ∗Rfoc, and idatm as focused derivations. and we write a comma to indicate concatenation of contexts (The above derivation of (p∗(q∗r))∗s≤p∗(q∗(r∗s)) is (which is a strictly associative operation). an example of a focused derivation.) A basic analysis of these In fact, all of these rules come straight from Lambek [16], three rules confirms that any sequent Γ −→ A has at most except for the ∗L rule which is a restriction of his left rule one focused derivation. By combining Claims I.1 and I.2, we for products. Lambek’s original rule looked like this: therefore have Γ,A,B,∆−→C Claim I.3. Every valid entailment in the Tamari order has ∗Lamb Γ,A∗B,∆−→C exactly one focused derivation. Thatis,Lambek’sleftruleallowedtheformulaA∗B toappear This coherence theorem is the main contribution of the paper, anywhere in the context, whereas our more restrictive rule and we will see that it has several interesting applications. ∗L requires the formula to appear at the leftmost end of the context. It turns out that this simple variation makes all the C. The surprising combinatorics of Tamari intervals, planar difference for capturing the Tamari order! maps, and planar lambda terms For example, here is a sequent derivation of the entailment The original impetus for this work came from wanting to (p∗(q∗r))∗s≤p∗(q∗(r∗s)) (we write L and R as short better understand an apparent link between the Tamari order for ∗L and ∗R, and don’t bother labelling instances of id): and lambda calculus, which was inferred indirectly via their q −→q r −→r mutual connection to the combinatorics of embedded graphs. R q,r −→q∗r s−→s Aboutadozenyearsago,Fre´dericChapoton[5]provedthe R q,r,s−→q∗(r∗s) following surprising formula for the number of intervals in L p−→p q∗r,s−→q∗(r∗s) the Tamari lattice Yn: R p,q∗r,s−→p∗(q∗(r∗s)) 2(4n+1)! L (1) p∗(q∗r),s−→p∗(q∗(r∗s)) (n+1)!(3n+2)! L (p∗(q∗r))∗s−→p∗(q∗(r∗s)) Here,byan“interval”ofapartiallyorderedsetwejustmeana If we had full access to Lambek’s original rule then we could validentailmentA≤B,whichcanalsobeidentifiedwiththe alsoderivetheconverseentailment(whichisfalseforTamari): correspondingsetofelements[A,B]={C |A≤C ≤B}(a poset with minimum and maximum elements). For example, q −→q r −→r R the Tamari lattice Y displayed in Figure 1 contains 13 p−→p q,r −→q∗r 3 R intervals. Chapoton used generating function techniques to p,q,r −→p∗(q∗r) s−→s R show that (1) gives the number of intervals in Yn, and we p,q,r,s−→(p∗(q∗r))∗s will explain how the above coherence theorem can be used Lamb p,q,r∗s−→(p∗(q∗r))∗s to give a new proof of this result. As Chapoton mentions, Lamb p,q∗(r∗s)−→(p∗(q∗r))∗s though, the formula itself did not come out of thin air, but L rather was found by querying the On-Line Encyclopedia of p∗(q∗(r∗s))−→(p∗(q∗r))∗s Integer Sequences (OEIS) [27]. Formula (1) is included in But with the more restrictive rule we can’t – the following OEIS entry A000260, and in fact it was derived over half soundness and completeness result will be established below. a century ago by the graph theorist Bill Tutte [31] for a Claim I.1. A−→B is derivable using the rules ∗L, ∗R, id, seeminglyunrelatedfamilyofobjects:itcountsthenumberof and cut if and only if A≤B holds in the Tamari order. (3-connected,rooted)triangulationsofthespherewith3(n+1) edges. The same formula is also known to count other natural As Lambek emphasized, the real power of a sequent calculus families of embedded graphs, and in particular it counts the comes when it is combined with Gentzen’s cut-elimination number of bridgeless rooted planar maps with n edges [32].2 procedure [11]. We will prove the following somewhat Sparked by Chapoton’s observation, Bernardi and Bonichon stronger form of cut-elimination: [3]foundanexplicitbijectionbetweenintervalsoftheTamari Claim I.2. If Γ −→ A is derivable using the rules ∗L, ∗R, order and 3-connected rooted planar triangulations, and quite id, and cut, then it has a derivation using only ∗L together recently, Fang [8] has proposed new bijections between these with the following restricted forms of ∗R and id: three different families of objects (i.e., between 3-connected rooted planar triangulations, bridgeless rooted planar maps, Γirr −→A ∆−→B Γirr,∆−→A∗B ∗Rfoc p−→p idatm and Tamari intervals). where Γirr ranges over contexts that don’t have a product 2Arootedplanarmapisaconnectedgraphembeddedinthe2-sphereorthe plane,withonehalf-edgechosenastheroot.A(rootedplanar)triangulation formula C∗D at their leftmost end. (dually,trivalentmap) isa(rootedplanar) mapinwhich everyface(dually, vertex) has degree three. A map is said to be bridgeless (respectively, 3- This is actually a focusing completeness result in the sense of connected) if it has no edge (respectively, pair of vertices) whose removal Andreoli[1],andwewillrefertoderivationsconstructedusing disconnectstheunderlyinggraph.(Cf.[18].) Meanwhile, in [35], Alain Giorgetti and I gave a bijection D. Outline between rooted planar maps and a simple fragment of linear The remainder of the paper is organized as follows. In Sec- lambda calculus consisting of the β-normal planar terms. tionIIweestablishalloftheproof-theoreticpropertiesclaimed (Here,“planarity”ofalambdatermessentiallymeansthatthe above, including soundness and completeness, focusing, and order in which variables are used is fixed following a stack coherenceofthesequentcalculusfortheTamariorder.InSec- discipline; we will discuss the precise definition of planarity tion III we concisely discuss how the coherence theorem can anditspotentialvariationslateron.)AswithChapoton’sresult, beappliedtogiveanewproofofformula(1)forthenumberof thisconnectionbetweenmapsandlambdacalculuswasfound intervalsinY ,simplifyingChapoton’soriginalproof.Finally, n using hints from the OEIS, since the sequence enumerating in Section IV we recall some basic lambda calculus notions, rooted planar maps was already known – and once again this then turn to the combinatorics of linear lambda terms, and sequence was first computed by Tutte, who derived another explainhowtoconstructtheaforementionedbijectionbetween simple closed formula for the number of rooted planar maps Tamari intervals and indecomposable β-normal planar terms. with n edges (2(2n)!3n). It is not difficult to check that the n!(n+2)! bijection described in [35] restricts to a bijection between II. ASEQUENTCALCULUSFORTHETAMARIORDER bridgelessrootedplanarmapsandβ-normalplanartermswith A. Definitions and terminology noclosedpropersubterms.Thisrestrictionona(notnecessar- ilyβ-normalorplanar)termwascalled“indecomposability”in For reference, we recall here the definition of the sequent [34],whereitwasusedtogiveacharacterizationofbridgeless calculus introduced in I-B, and clarify some notational con- rooted trivalent maps as indecomposable linear lambda terms ventions. The four rules of the sequent calculus are: (and, in turn, to reformulate the Four Color Theorem as a A,B,∆−→C Γ−→A ∆−→B statement about indecomposable planar terms). In any case, ∗L ∗R A∗B,∆−→C Γ,∆−→A∗B this property of the bijection in [35] means that formula (1) also enumerates indecomposable β-normal planar terms by Θ−→A Γ,A,∆−→B id cut size,andanaturalquestioniswhetherthereisadirectbijection A−→A Γ,Θ,∆−→B between such terms and intervals of the Tamari order. Aswewillexplain,inafairlynaturalway,everyclosed(not Uppercase Latin letters (A,B,...) range over formulas, necessarily β-normal) indecomposable planar term induces whichcanbeeithercompound(A∗B)oratomic(rangedover both an application tree (describing its underlying applica- by lowercase Latin letters p,q,...). Uppercase Greek letters tive structure) and a binding tree (describing its underlying Γ,∆,... rangeovercontexts,whichare(possiblyempty)lists binding structure, that is, the matching between abstractions of formulas, with concatenation of contexts indicated by a and variables). Well, it so happens that the binding tree is comma.(LetusemphasizethatasinLambek’ssystem[16]but always below the application tree in the Tamari order! Trying in contrast to Gentzen’s original sequent calculus [11], there to prove this fact by induction leads directly to consideration are no rules of “weakening”, “contraction”, or “exchange”, so ofsequentsΓ−→A,becausethebindingstructureofanopen the order and the number of occurrences of a formula within indecomposable planar term (with an arbitrary number of free a context matters.) A sequent is a pair of a context Γ and a variables) is naturally described as a list of trees. We can then formula A. easily build by induction a mapping Abstractly, a derivation is a tree (formally, a rooted planar treewithboundary,cf.[14])whoseinternalnodesarelabelled D bythenamesofrulesandwhoseedgesarelabelledbysequents M M (cid:55)→ ΓM −→AM satisfying the constraints indicated by the given rule. The conclusionofaderivationisthesequentlabellingitsoutgoing from indecomposable planar terms M to derivations DM root edge, while its premises are the sequents labelling any showing that the binding forest ΓM is below the application incoming leaf edges. A derivation with no premises is said to treeAM inthetheTamariorder.Composingwiththe“forget- be closed. ful” transformation from derivations to their conclusions, we We write “Γ −→ A” as a notation for sequents, but therefore obtain a mapping also sometimes as a shorthand to indicate that the given sequent is derivable using the above rules, in other words M (cid:55)→ (Γ ,A ) that there exists a closed derivation whose conclusion is that M M sequent (it will always be clear which of these two senses we from indecomposable planar terms to (generalized) intervals. mean). Sometimes we will need to give an explicit name to a Onecanshowthatthismappingissurjective,butnotinjective. derivation with a given conclusion, in which case we place it This is where the coherence theorem comes in: by inspection, over the sequent arrow. the derivation D is focused if and only if the term M As in I-B, when constructing derivations we sometimes M is β-normal, and therefore, the mapping M (cid:55)→ (Γ ,A ) write L and R as shorthand for ∗L and ∗R, and usually don’t M M is bijective from indecomposable β-normal planar terms to botherlabellingtheinstancesofidandcutsincetheyareclear Tamari intervals. from context. Finally, define the frontier fr(A) of a formula A to be the That is, the context provides information about the left- ordered list of atoms occurring in A (i.e., by fr(A ∗ B) = branchingspineofthetreewhichisbelowintheTamariorder. fr(A),fr(B) and fr(p) = p), and the frontier of a context Let φ[−] be the operation taking any non-empty context Γ Γ = A ,...,A as the concatenation of frontiers fr(Γ) = to a formula φ[Γ] by the above interpretation. The operation 1 n fr(A ),...,fr(A ). The following properties are immediate is defined by the following equations: 1 n by examination of the four sequent calculus rules. φ[A]=A Proposition II.1. Suppose that Γ−→A. Then φ[Γ,A]=φ[Γ]∗A 1) (Refinement:) fr(Γ)=fr(A). 2) (Relabelling:) σΓ −→ σA, where σ is any relabelling Critical to soundness of the sequent calculus is the following function on atoms. “colax” property of φ[−]: B. Completeness Proposition II.3. φ[Γ,∆] ≤ φ[Γ]∗φ[∆] for all non-empty We begin by establishing completeness relative to the contexts Γ and ∆. Tamari order, which is the easier direction. Proof. By induction on ∆. The case of a singleton context Theorem II.2 (Completeness). If A≤B then A−→B. ∆=A is immediate. Otherwise, if ∆=(∆(cid:48),A), we have Proof. We must show that the relation A −→ B is reflexive φ[Γ,∆(cid:48),A]=φ[Γ,∆(cid:48)]∗A and transitive, and that the multiplication operation satisfies a ≤(φ[Γ]∗φ[∆(cid:48)])∗A semi-associative law and is monotonic in each argument. All ≤φ[Γ]∗(φ[∆(cid:48)]∗A) of these properties are straightforward: =φ[Γ]∗φ[∆(cid:48),A] 1) Reflexivity: immediate by id. 2) Transitivity: immediate by cut. where the first inequality is by the inductive hypothesis and 3) Semi-associativity: monotonicity, while the second inequality is by the semi- associative law. B −→B C −→C R A−→A B,C −→B∗C R Theoperationφ[−]canalsobeequivalentlydescribedinterms A,B,C −→A∗(B∗C) of a right action A(cid:126)∆ of an arbitrary context on a formula, L A∗B,C −→A∗(B∗C) where this action is defined by the following equations: L (A∗B)∗C −→A∗(B∗C) A(cid:126)·=A 4) Monotonicity: A(cid:126)(∆,B)=(A(cid:126)∆)∗B A−→A(cid:48) B −→B R A−→A B −→B(cid:48) R We will make use of a few simple properties of −(cid:126)∆: A,B −→A(cid:48)∗B A,B −→A∗B(cid:48) A∗B −→A(cid:48)∗B L A∗B −→A∗B(cid:48) L Proposition II.4. φ[Γ,∆] = φ[Γ] (cid:126) ∆ for all non-empty contexts Γ and arbitrary contexts ∆. Proposition II.5 (Monotonicity). If A ≤ A(cid:48) then A(cid:126)∆ ≤ C. Soundness A(cid:48)(cid:126)∆. To prove soundness relative to the Tamari order, first we Proof. Both properties are immediate by induction on ∆, have to explain the interpretation of general sequents. The where in the case of Prop. II.5 we apply monotonicity of the basic idea is that we can interpret a non-empty context as a operations −∗B. left-associated product. Thus, a general sequent of the form We are now ready to prove soundness. A ,A ,...,A −→B 1 2 n Theorem II.6 (Soundness). If Γ−→A then φ[Γ]≤A. (where n≥1) is interpreted as an entailment of the form Proof. By induction on the (closed) derivation of Γ −→ A. (···(A ∗A )∗···)∗A ≤B 1 2 n There are four cases, corresponding to the four rules of the in the Tamari order. Visualizing everything in terms of binary sequent calculus: trees, the sequent can be interpreted like so: • (Case ∗L): The derivation ends in A1 A2 A,B,∆−→C .A.. A∗B,∆−→C ∗L B −→ An By induction we have φ[A,B,∆]≤C, but by Prop. II.4 we have φ[A∗B,∆]=φ[A∗B](cid:126)∆=(A∗B)(cid:126)∆= φ[A,B](cid:126)∆=φ[A,B,∆]. • (Case ∗R): The derivation ends in is by cutting together the two derivations Γ−→A ∆−→B SA ∗R p,q,r Γ,∆−→A∗B (p∗q)∗r −→p∗(q∗r) s−→s R (p∗q)∗r,s−→(p∗(q∗r))∗s By induction we have φ[Γ]≤A and φ[∆]≤B, hence L ((p∗q)∗r)∗s−→(p∗(q∗r))∗s φ[Γ,∆]≤φ[Γ]∗φ[∆]≤A∗B and where we apply Prop. II.3 for the first inequality, and SAp,q∗r,s monotonicity in both arguments for the second. (p∗(q∗r))∗s−→p∗((q∗r)∗s) • (Case id): Immediate by reflexivity. where SA is the derivation of the semi-associative law • (Case cut): The derivation ends in A,B,C (A∗B)∗C −→A∗(B∗C) from the proof of Theorem II.2. Θ−→A Γ,A,∆−→B Clearly this is not a focused derivation (besides the cut rule, cut Γ,Θ,∆−→B it also uses instances of ∗R and id with a left-inverting con- clusion). However, it is possible to give a focused derivation We can reason like so: of the same sequent: φ[Γ,Θ,∆]=φ[Γ,Θ](cid:126)∆ (II.4) q −→q r −→r ≤(φ[Γ]∗φ[Θ])(cid:126)∆ (II.3 + monotonicity) q,r −→q∗r R s−→s R ≤(φ[Γ]∗A)(cid:126)∆ (i.h. + monotonicity) p−→p q,r,s−→(q∗r)∗s R =φ[Γ,A,∆] (II.4) p,q,r,s−→p∗((q∗r)∗s) L ≤B (i.h.) p∗q,r,s−→p∗((q∗r)∗s) L (p∗q)∗r,s−→p∗((q∗r)∗s) L ((p∗q)∗r)∗s−→p∗((q∗r)∗s) D. Focusing completeness In the below, we write “Γ =⇒ A” as a shorthand notation Cut-elimination theorems are a staple of proof theory, and to indicate that Γ −→ A has a (closed) focused derivation, oftenprovidearichsourceofinformationaboutagivenlogic. and “D :A=⇒B” to indicate that D is a particular focused Inthissectionwewillproveafocusingcompletenesstheorem, derivation of A−→B. which is an even stronger form of cut-elimination originally Theorem II.11 (Foc. comp’ness). If Γ−→A then Γ=⇒A. formulated by Andreoli in the setting of linear logic [1]. To prove the focusing completeness theorem, it suffices to Definition II.7. A context Γ is said to be reducible if its show that the cut rule as well as the unrestricted forms of id leftmost formula is compound, and irreducible otherwise. A and∗Rarealladmissibleforfocusedderivations,intheproof- sequent Γ−→A is said to be: theoreticsensethatgivenfocusedderivationsoftheirpremises, • left-inverting if Γ is reducible; we can obtain a focused derivation of their conclusion. We • right-focusing if Γ is irreducible and A is compound; beginbyprovingafocuseddeductionlemma(cf.[25]),which • atomic if Γ is irreducible and A is atomic. entails the admissibility of id, then show cut and ∗R in turn. Proposition II.8. Any sequent is either left-inverting, right- Lemma II.12 (Deduction). If Γirr =⇒A implies Γirr,∆=⇒ focusing, or atomic. B for all Γirr, then A,∆=⇒B. In particular, A=⇒A. DefinitionII.9. AclosedderivationD issaidtobefocusedif Proof. By induction on the formula A: left-inverting sequents only appear as the conclusions of ∗L, right-focusing sequents only as the conclusions of ∗R, and • (Case A = p): Immediate by assumption, taking Γ = p and p−→p derived by the idatm rule. atomic sequents only as the conclusions of id. • (Case A=A1∗A2): By composing with the ∗L rule, We write “Γirr” to indicate that a context Γ is irreducible. A ,A ,∆−→B 1 1 ∗L Proposition II.10. A closed derivation is focused if and only A ∗A ,∆−→B 1 2 if it is constructed using only ∗L and the following restricted forms of ∗R and id (and no instances of cut): we reduce the problem to showing A1,A2,∆ =⇒ B, andbythei.h.onA itsufficestoshowthatΓirr =⇒A 1 1 1 ΓirΓrir−r→,∆A−→∆A−∗→BB ∗Rfoc p−→p idatm iΓmirprl=ie⇒s ΓAi1rr,.AW2e,∆ca=n⇒derBivefoΓrirarl,lAcon−te→xtsAΓi1∗rr.ALebtyD1 : 1 1 1 2 1 2 Example 1. One way to derive D1 D2 Γirr −→A A −→A 1 1 2 2 ∗R ((p∗q)∗r)∗s−→p∗((q∗r)∗s) D = Γirr,A −→A ∗A 1 2 1 2 where we apply the i.h. on A to obtain D . Finally, – (Case ∗Rfoc): ∃Θirr,Θ s.t. Θirr =Θirr,Θ and 2 2 1 2 1 2 applying the assumption to D (with Γirr = Γirr,A ) we obtain the desired derivation of A1,A2,∆−→1 B. 2 ΘirrD−→1 A Θ −D→2 A 1 1 2 2 ∗R D = Θirr,Θ −→A ∗A 1 2 1 2 We cut both D and D into E(cid:48) (the cuts are at Lemma II.13 (Cut). If Θ =⇒ A and Γ,A,∆ =⇒ B then 1 2 smaller formulas so the order doesn’t matter). Γ,Θ,∆=⇒B. Proof. Let D :Θ=⇒A and E :Γ,A,∆=⇒B. We proceed by a lexicographic induction, first on the cut formula A and Lemma II.14 (∗R admiss.). If Γ =⇒ A and ∆ =⇒ B then then on the pair of derivations (D,E) (i.e., at each inductive Γ,∆−→A∗B. step of the proof, either A gets smaller, or it stays the same as one of D or E gets smaller while the other stays the same). Proof. We can derive A,B =⇒ A∗B using two instances In the case that A = p we can apply the “frontier refine- of the deduction lemma together with the ∗R rule. Then we ment” property (Prop. II.1) to deduce that Θ = p, so the cut obtain Γ,∆=⇒A∗B using two instances of cut. is trivial and we just reuse the derivation E : Γ,p,∆ =⇒ B. Proof of Theorem II.11. Anarbitraryclosedderivationcanbe Otherwise we have A = A ∗A for some A ,A , and we 1 2 1 2 turnedintoafocusedonebystartingatthetopofthederivation proceed by case-analyzing the root rule of E: tree and using the above lemmas to interpret any instance of • (Case idatm): Impossible since A is non-atomic. the cut rule and of the unrestricted forms of id and ∗R. • (Case ∗Rfoc): This case splits in two possibilities: Finally, we mention two simple applications of the focusing 1) ∃∆ ,∆ such that ∆=∆ ,∆ and 1 2 1 2 completeness theorem. E1 E2 Γirr,A,∆ −→B ∆ −→B Proposition II.15 (Frontier invariance). Let σ be any rela- 1 1 2 2 ∗R belling function on atoms. Then Γ −→ A if and only if E = Γirr,A,∆ ,∆ −→B ∗B 1 2 1 2 fr(Γ)=fr(A) and σΓ−→σA. 2) ∃Γirr,Γ such that Γirr =Γirr,Γ and 1 2 1 2 Proof. The forward direction is Prop. II.1. For the backward E1 E2 direction we use induction on focused derivations, which is Γirr −→B Γ ,A,∆−→B justifiedbyTheoremII.11.Theonlyinterestingcaseis∗Rfoc, 1 1 2 2 ∗R where we can assume fr(Γ,∆) = fr(A∗B) and σΓ =⇒ σA E = Γirr,Γ ,A,∆−→B ∗B 1 2 1 2 (σΓ irreducible) and σ∆ =⇒ σB. By Prop. II.1 we have In the first case, we cut D with E to obtain fr(σΓ) = fr(σA) and fr(σ∆) = fr(σB), but then elementary 1 Γirr,Θ,∆ =⇒ B , then recombine that with E using propertiesoflistsimplythatfr(Γ)=fr(A)andfr(∆)=fr(A), 1 1 2 ∗Rfoc toobtainΓirr,Θ,∆ ,∆ =⇒B ∗B .Thesecond from which Γ=⇒A (Γ irreducible) and ∆=⇒B follow by 1 2 1 2 case is similar. the induction hypothesis, hence Γ,∆=⇒A∗B. • (Case ∗L): This case splits into two possibilities: If we let σ = (cid:55)→ p be any constant relabelling function, 1) ∃C1,C2,Γ(cid:48) such that Γ=C1∗C2,Γ(cid:48) and then speaking in terms of the Tamari order, Proposition II.15 E(cid:48) says that to check that two “fully-bracketed words” (a.k.a., C ,C ,Γ(cid:48),A,∆−→B formulas) are related, it suffices to check that their frontiers 1 2 ∗L E = C ∗C ,Γ(cid:48),A,∆−→B are equal and that the unlabelled binary trees describing 1 2 their underlying multiplicative structure are related. Although We cut D into E(cid:48) and reapply the ∗L rule. this fact is intuitively obvious, trying to prove it directly by 2) Γ=· and induction on general derivations fails, because in the case of the cut rule we cannot assume anything about the frontier of E(cid:48) A ,A ,∆−→B the cut formula A. 1 2 ∗L E = A1∗A2,∆−→B Definition II.16. We say that an irreducible context Γirr is a maximal decomposition of A if Γirr −→ A, and for any We further analyze the root rule of D: other Θirr, Θirr −→A implies Θirr −→φ[Γirr]. – (Case ∗L): ∃C ,C ,Θ(cid:48) s.t. Θ=C ∗C ,Θ(cid:48) and 1 2 1 2 Proposition II.17. If Γirr is a maximal decomposition of A, D(cid:48) then A,∆−→B if and only if Γirr,∆−→B. C ,C ,Θ(cid:48) −→A ∗A 1 2 1 2 ∗L D = C ∗C ,Θ(cid:48) −→A ∗A Proof. The forward direction is by cutting with Γirr −→ A, 1 2 1 2 thebackwardsdirectionisbythedeductionlemma(II.12)and We cut D(cid:48) into E and reapply the ∗L rule. the universal property of Γirr. – (Case idatm): Impossible. PropositionII.18. Letψ[A]betheirreduciblecontextdefined F. Notes inductively by: The coherence theorem says in a sense that focused deriva- tions provide a canonical representation for intervals of the ψ[p]=p ψ[A∗B]=ψ[A],B Tamari order. Although the representations are quite different, in this respect it seems roughly comparable to the “unicity of Then ψ[A] is a maximal decomposition of A. maximalchains”thatwasestablishedbyTamariandFriedman Proof. We construct ψ[A] −→ A by induction on A, and aspartoftheiroriginalproofofthelatticepropertyofY [10], n prove the universal property of ψ[A] by induction on focused [30]. A natural question is whether the sequent calculus can derivations of ∆−→A. be used to better understand and further simplify the proofs (cf. [12] [22, §4]) of this lattice property. Proposition II.19. φ[ψ[A]]=A and ψ[φ[Θirr]]=Θirr. An easy observation is that one obtains the dual Tamari or- der(cf.Footnote1)viaadualrestrictionofLambek’soriginal Themaximaldecompositionψ[A]ofAisessentiallythesame rule,inotherwordsbyrequiringtheproductformulatoappear thingaswhatChapoton[5]callsa“de´compositionmaximale” attherightmostendofthecontext.Thesetwoformsofproduct of a binary tree. The logical characterization expressed in might also be considered in combination with left and right Defn. II.16 is quite general, though, and is familiar from units, or in combination with Lambek’s left and right division studies of focusing in other settings (cf. [33]). operations. Interestingly, Lambek also introduced a fully non- associative version of his original “syntactic calculus” [17]. E. The coherence theorem The name “coherence theorem” for Theorem II.20 is We now come to our main result: inspired by the terminology from category theory and Mac Lane’s coherence theorem for monoidal categories [19]. Theorem II.20 (Coherence). Every derivable sequent has Laplaza [21] extended Mac Lane’s coherence theorem to the exactly one focused derivation. situation (very close to Tamari’s) where there is no monoidal unitandtheassociator α :(A⊗B)⊗C →A⊗(B⊗C) Coherence is a direct consequence of focusing completeness A,B,C is only a natural transformation rather than an isomorphism. and the following lemma: (In the presence of units, this gives rise to the notion of a Lemma II.21. For any context Γ and formula A, there is at skew monoidal category [15].) The precise relationship with most one focused derivation of Γ−→A. our coherence theorem remains to be clarified. Proof. We proceed by a well-founded induction on sequents, III. COUNTINGINTERVALSINTAMARILATTICES which can be reduced to multiset induction as follows. Define In this section we explain how the coherence theorem can the size |A| of a formula A by be used to give a new proof of Chapoton’s result (mentioned in the Introduction) that the number of intervals in Y is |A∗B|=1+|A|+|B| |p|=0 n givenbyTutte’sformula(1)forplanartriangulations.Wewill assume some basic familiarity with generating functions (say, (That is, |A| counts the number of multiplication operations as provided by a combinatorics textbook like [9]). occurringinA.)ThenanysequentA ,...,A −→B induces 1 n a multisets of size ((cid:85)n |A |)(cid:93)|B|, and at each step of our The problem of “counting intervals” is to compute the i=1 i cardinality of the set induction this multiset will decrease in the multiset ordering. There are three cases: I ={(A,B)∈Y ×Y |A≤B} n n n • (A left-inverting sequent A∗B,∆−→C): Any focused as a function of n. By the soundness and completeness theo- derivation must end in ∗L, so we apply the i.h. to rems as well as the frontier invariance property (Prop. II.15), A,B,∆−→C. eachY isisomorphicasapartialordertothesetofformulas n • (A right-focusing sequent Γirr −→A∗B): Any focused A of size n with any fixed frontier of length n+1 (remember derivation must end in ∗R, and decide some splitting of that a binary tree with n internal nodes has n + 1 leaves), the context into contiguous pieces Γirr and ∆ . How- 1 2 ordered by sequent derivability. By the coherence theorem, ever, Γirr and ∆ are uniquely determined by frontier 1 2 the problem of counting intervals can therefore be reduced to refinement (fr(Γirr) = fr(A) and fr(∆ ) = fr(B)) and 1 2 the problem of counting focused derivations. the equation Γirr = Γirr,∆ . So, we apply the i.h. to 1 2 This problem lends itself readily to being solved us- Γirr −→A and ∆ −→B. 1 2 ing generating functions. Consider the generating functions • (An atomic sequent Γirr −→p): The sequent has exactly L(z,x) and R(z,x) defined as formal power series L(z,x)= one focused derivation if and only if Γirr =p. (cid:80) (cid:96) xkzn and R(z,x) = (cid:80) r xkzn, where k,n∈N k,n k,n∈N k,n (cid:96) (respectively, r ) is the number of focused derivations k,n k,n of sequents whose left-hand side is a context (respectively, Proof of Theorem II.20. By Theorem II.11 and Lemma II.21. irreducible context) of length k and whose right-hand side is aformulaofsizen.(Withoutlossofgeneralityinthisanalysis, we assume that all formulas A of size n have a fixed frontier Theorem III.4 (Chapoton [5]). |I |= 2(4n+1)! . n (n+1)!(3n+2)! fr(A) = pn+1.) We write L (z) to denote the coefficient of 1 Proof. At this point, we can directly appeal to results of Cori x1 in L(z,x). andSchaeffer,becauseequations(3)and(4)areaspecialcase Proposition III.1. L (z) is the ordinary generating function of the functional equations given in [7] for the generating 1 counting Tamari intervals by size. functions of description trees of type (a,b), where a=b=1. Cori and Schaeffer explained how to solve these equations Proof. The coefficients (cid:96) give the number of focused 1,n abstractly for R(z,1) using Brown and Tutte’s “quadratic derivations of sequents of the form A=⇒B, where |B|=n method”, and then how to derive the explicit formula above (and hence |A|=n), so (cid:96) =|I | by Theorem II.20. 1,n n in the specific case that a = b = 1 via Lagrange inversion Proposition III.2. L and R satisfy the equations: (essentially as the formula was originally derived by Tutte for L(z,x)−xL (z) planar triangulations). L(z,x)= 1 +R(z,x) (2) x Let’s take a moment to discuss Chapoton’s original proof R(z,x)=zR(z,x)L(z,x)+x (3) of Theorem III.4, which it should be emphasized is actually Proof. The equations are derived directly from the inductive not all that different from the one given here. Chapoton structure of focused derivations: likewise defines a two-variable generating function Φ(z,x) enumerating intervals in the Tamari lattices Y , where the • The first summand in (2) corresponds to the contribution n from the ∗L rule, which transforms any A,B,Γ =⇒ C parameterz keepstrackofn,andtheparameterxkeepstrack intoA∗B,Γ=⇒C.Thecontextinthepremisemusthave of the number of segments along the left border of the tree length ≥2 which is why we subtract the xL (x) factor, at the lower end of the interval.3 By a combinatorial analysis, 1 Chapoton derives the following functional equation for Φ: and the context in the conclusion is one formula shorter which is why we divide by x. The second summand is (cid:18) Φ(z,x)−Φ(z,1)(cid:19) the contribution from irreducible contexts. Φ(z,x)=x2z(1+Φ(z,x)/x) 1+ (5) x−1 • The first summand in (3) corresponds to the contribution from the ∗Rfoc rule, which transforms Γirr =⇒ A and HemanipulatesthisequationandeventuallysolvesforΦ(z,1) ∆ =⇒ B into Γirr,∆ =⇒ A ∗ B: the length of the as the root of a certain polynomial, from which he derives context in the conclusion is the sum of the lengths of Tutte’s formula (1), again by appeal to another result in the Γirr and ∆, while the size of A∗B is one plus the sum paper by Cori and Schaeffer [7]. ofthesizesofAandB,whichiswhywemultiplyRand If we give a bit of thought to these definitions, it is easy L together and then by an extra factor of z. The second to see that the number of segments along the left border of summand is the contribution from idatm :p=⇒p. a tree (= formula) A is equal to the length of its maximal decomposition ψ[A] – meaning that the generating function Φ(z,x) apparently contains exactly the same information as Proposition III.3. L (z)=R(z,1). 1 R(z,x)! There is a small technicality, however, due to the Proof. Thisfollowsimmediatelyfrom(2),butwecaninterpret fact that Chapoton only considers the Yn for n ≥ 1. In fact, itconstructivelyaswell.Thecoefficientofzn inR(z,1)isthe the two generating functions are related by a small offset formalsum(cid:80) r ,givingthenumberoffocusedderivations (corresponding to the coefficient of z0 in R(z,x)): k k,n of sequents whose right-hand side is a formula of size n Φ(z,x)=R(z,x)−x (6) and whose left-hand side is an irreducible context of arbitrary length.ButbyProps.II.17–II.19,theoperationsφ[−]andψ[−] Indeed,itcanbereadilyverifiedthatequation(5)followsfrom realizea1-to-1correspondencebetweenderivablesequentsof (3) and (4), applying the substitution R(z,x)=x+Φ(z,x). the form Γirr −→B and ones of the form A−→B. IV. THEINTERPRETATIONOFINDECOMPOSABLEPLANAR After substituting L (z) = R(z,1) into (2) and applying a 1 LAMBDATERMSBYTAMARIINTERVALS bit of algebra, we obtain another formula for L in terms of a “discrete difference operator” acting on R: A. Preliminaries R(z,x)−R(z,1) We recall a few basic definitions from lambda calculus [2]. L(z,x)=x (4) x−1 A term (ranged over by uppercase Latin letters M,N,...) is either a variable (ranged over by lowercase Latin letters The recursive (or “functional”) equations (3) and (4) can be x,y,...) or an application M(N) (where M and N are easily unrolled (preferably using computer algebra software) terms) or an abstraction λx.M (where x is a variable and M to compute the first few dozen coefficients of R and L: is a term). By syntactic convention, abstractions take scope to R(z,x)=x+x2z+(x2+2x3)z2+(3x2+5x3+5x4)z3+(13x2+20x3+ the right as far as possible, so that for example “λx.x(λy.y)” 21x4+14x5)z4+(68x2+100x3+105x4+84x5+42x6)z5+... 3Or rather at the upper end, since Chapoton uses the dual convention for L1(z)=R(z,1)=1+z+3z2+13z3+68z4+399z5+2530z6+16965z7+... orientingtheTamariorder(cf.Footnote1). shouldbereadasanabstractionterm,whereas“(λx.x)(λy.y)” and variables. The quickest way of explaining this is with a is an application term. picture: We define the subterms of a term as follows: • M is a subterm of itself • any subterm of M or N is a subterm of M(N) • any subterm of M is a subterm of λx.M ThesubtermsofM aresaidto“occur”inM.Amongvariables occurring within a term, we distinguish free variables from bound variables: an abstraction term λx.M is said to bind any free occurrences of x in M, and otherwise all variables which are not bound by an abstraction are said to be free. A term with no free variables is said to be closed. Terms are On the left we have a diagram that faithfully represents usually considered up to α-conversion, or renaming of bound the linear term λx.λy.λz.λw.z(λu.w(u))(y(x)) up to α- variables (e.g., the terms λx.x and λy.y are α-equivalent). equivalence, with nodes representing applications colored in We will assume the Barendregt convention, which says that red and nodes representing abstractions colored in blue. (This all bound variables have distinct names and that no variable kind of diagrammatic representation is folklore in lambda is both free and bound (this condition is always possible to calculus; for a more thorough discussion, see [34].) On the achieve via α-conversion). right we’ve selectively gotten rid of some of the structure The basic computation rule of lambda calculus is the rule of the term to produce two simpler objects. The application of β-reduction, tree (depicted in the lower right) collapses abstraction nodes, keeping only the underlying binary tree of applications (with (λx.M)(N)→M[N/x] (β) variables labelling the leaves). Definition IV.2. The application tree of a term M is a (leaf- where M[N/x] denotes the (“capture-avoiding”) substitution labelled) binary tree α[M], defined by induction as follows: of N for any free occurrences of x in M. The β-reduction rule can be performed on any subterm, in other words there α[x]=x are also the following “congruence” rules: α[M(N)]=α[M]∗α[N] M →M(cid:48) N →N(cid:48) M →M(cid:48) α[λx.M]=α[M] M(N)→M(cid:48)(N) M(N)→M(N(cid:48)) λx.M →λx.M(cid:48) Ontheotherhand,thebindingdiagram(depictedintheupper This defines a rewriting system which is confluent (the right of the picture) collapses application nodes, recording Church-Rosser theorem), although there exist infinite reduc- only the order of successive lambda abstractions and variable tion sequences M →M →... (since pure lambda calculus occurrences (or “uses”). Reading the diagram from left to 1 2 is a universal model of computation). Two terms are said to right, rising arcs correspond to abstractions and falling arcs be β-equivalent M =β N if they both β-reduce to the same to uses. The fact that this is the binding diagram of a closed term M → P ← N in any number of steps. A term which linear term means that every rising arc is met by exactly one cannot be further reduced is said to be β-normal. falling arc, and we get the classical notion of rooted chord An abstraction λx.M is said to be linear if the variable x diagram (also sometimes referred to as an “arc diagram” [18] hasexactlyonefreeoccurrenceinM.Byextension,atermN or“matchingdiagram”[4]),whichhasmanyequivalentpurely is said tobe linear if every abstractionsubterm of N is linear, combinatorial representations such as by double-occurrence and all free variables of N occur exactly once as subterms. words (xyzwzuwuyx) or by fixed point-free involutions Forexample,thetermsλx.λy.y(x)andλx.x(λy.y)arelinear, ((1 10)(2 9)(3 5)(4 7)(6 8)). More generally, the binding but the terms λx.x(x) and λx.λy.y are not. diagram of a linear term with free variables corresponds to a rooted chord diagram where chords can have unattached ends A term is said to be indecomposable [34] if it has no (i.e.,toan“openmatching”inthesenseof[4]).Suchdiagrams closed proper subterms. For example, the term λx.λy.y(x) can be represented faithfully by “at-most-double-occurrence” is indecomposable, but the term λx.x(λy.y) is not. words (that is, sequences where every symbol occurs either Proposition IV.1. A closed indecomposable term is necessar- onceortwice),orequivalentlybyinvolutionswithfixedpoints. ily an abstraction term λx.M, where M is indecomposable. Definition IV.3. The binding diagram of a linear term M is a sequence γ[M], defined by induction as follows: B. Application trees and binding diagrams γ[x]=x Any linear lambda term is naturally associated with a pair of basic combinatorial objects: a binary tree describing γ[M(N)]=γ[M],γ[N] its underlying structure of applications, and a rooted chord γ[λx.M]=x,γ[M] diagramdescribingthematchingbetweenlambdaabstractions Proposition IV.4. If M is linear, then γ[M] is an at-most- α-equivalence)wayoffillinginthevariablenamestoproduce double-occurrence word (assuming the Barendregt conven- either an LR-planar term or an RL-planar term. tion). If moreover M is closed, then γ[M] is a double- Even though the difference is seemingly trivial, the asym- occurrence word. metry of the lambda calculus means that these two notions of planarity have very different properties. Notably, the set By the isomorphism between rooted chord diagrams and of LR-planar terms is not closed under β-reduction, which double-occurrence words, we will therefore view the binding diagrammatically(undertheseconventions)correspondstothe diagram of a linear term interchangeably either as an (at- following operation: most-)double-occurrence word or as a rooted chord diagram (potentially with unattached chords). We refer to chords with an unattached end (i.e., single-occurrence letters) as free −→ (β) chords, and to chords with both ends attached (i.e., double- occurrence letters) as full chords. (λx.M)(N) M[N/x] Let the size |M| of a linear term M be defined here as the On the other hand, LR-planar terms are closed under a number of internal nodes in its application tree α[M]. “colored”versionoftherightrotationoperation,whichrotates Proposition IV.5. If M is a closed linear term of size n, a lambda abstraction out from the left of an application: thenitsbindingdiagramγ[M]isarootedchorddiagramwith n+1 full chords (i.e., the corresponding double-occurrence −→ (ρ) wordhas2n+2letters).Moregenerally,ifM isalinearterm of size n with k free variables, then its binding diagram has (λx.M)(N) λx.M(N) n+1−k full chords and k free chords. Theρ-reductionruleiscertainlynotatypicallambdacalculus A rooted chord diagram (with no free chords) is said to rule – but the amusing coincidence is that the set of β- be indecomposable if it is not the juxtaposition of two rooted normal terms and the set of ρ-normal terms coincide. This chord diagrams – the corresponding condition on a double- is true even though the induced notions of equivalence are occurrence word is that it is not the concatenation of two very different: let us say that two terms are ρ-equivalent double-occurrence words (cf. [6], [24]). (M =ρ N) just in case they both reduce to a common term Proposition IV.6. Let M be a closed linear term. If M is via some sequence of ρ-reductions (applied to any subterms). indecomposable (i.e., has no closed proper subterms), then The following observation is key: it says that the pair of the γ[M] is an indecomposable double-occurrence word. application tree and binding diagram of a linear lambda term form a complete invariant for that term up to ρ-equivalence. (Note the converse is false: for example, λx.(λy.y)x is not indecomposable,buthasanindecomposablebindingdiagram.) Theorem IV.8. For all linear terms M and N, M =ρ N if and only if α[M]=α[N] and γ[M]=γ[N]. C. Planarity and the lambda rotation (ρ) rule Proof. For the forward direction, we check that ρ-reduction Arootedchorddiagramissaidtobeplanar ifithasnopair preserves application trees and binding diagrams, which is of crossing arcs. This translates to at-most-double-occurrence evident by inspection of the rule. For the backward direction, words as follows: γ is planar if for any x,δ,x occurring as a we first verify that every term has a ρ-normal form (obvious, subword, δ is a double-occurrence word. since any lambda abstraction can be rotated only finitely many times), then that any two ρ-normal forms with equal Definition IV.7. We say that a linear term M is planar just application trees and binding diagrams must be equal. Here in case its binding diagram γ[M] is planar. we can use the fact that ρ-normal forms (which, again, An important comment about this definition is that the class are identical with β-normal forms) have a simple inductive of terms which are considered planar clearly depends upon structure. In particular, we can read off the head normal the “layout convention” we use in drawing diagrams, which form λx ...λx .((xM )...M ) of a term by examining the 1 n 1 p is implicit in the definition of the binding diagram γ[M]. The leading arcs of its binding diagram (in this case, n rising precise notion of planarity we consider here was studied (in arcs x ,...,x followed by a falling arc x) together with the 1 n an equivalent formulation) in [35], where it was called “LR- left-branching spine of its application tree (in this case, with planarity” and contrasted with “RL-planarity” (see [35, §3.1], the leftmost leaf labelled x, and p subtrees along the right). and also [34, §4]): the latter can be defined by replacing the Linearity determines how the rest of the binding diagram is abstraction case of Defn. IV.3 by γ[λx.M] = γ[M],x. For partitioned among the subterms M ,...,M , and we proceed 1 p example, the term λx.λy.y(λz.z(x)) is LR-planar, while the by induction. term λx.λy.x(λz.y(z)) is RL-planar. A simple observation D. From indecomposable planar terms to Tamari intervals about planarity is that for any given underlying “skeleton” of abstractions and applications sans variable names (i.e., an In this section we at last present the bijection between (ρ- expression like “λ .λ . (λ . ( ))”), there is a unique (up to /β-)normalplanarindecomposabletermsandTamariintervals,