Lectures onType Theory
Chapter 38
Chapter 38Optional

Ordered and Noncommutative Types and the Lambek Calculus

Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.

Linear use does not determine order. In the linear calculus of chapter 18, exchange is built into equality of contexts. Thus a resource may be used once and nevertheless pass another resource on its way to the consumer. For a word, a protocol message, or a stack action, that crossing can be the error we need the type system to reject.

Take distinct atoms p and q. Product introduction ought to derive p,qpq. It must not derive q,ppq: both assumptions occur exactly once, but in the wrong order. We therefore replace contexts-as-maps by context words. Product combines adjacent resources; its two residuals solve for a missing factor on the left or right. The same order discipline models a tiny stack protocol: if p means “a value has just been pushed” and p\q is an action that must consume that value on its left before producing state q, then p,p\qq is derivable while the reversed schedule is not. Protocol messages have the same shape when a response must follow its request.

The notation is the ordered version of the resource connectives in chapter 18: product AB plays the role of a noncommutative tensor; A\B and B/A are the left and right ordered implications. If exchange were restored, the two residuals would become interderivable and recover the one-sided behavior of linear implication AB, as proved in proposition 38.17. Here the side on which the argument arrives remains part of the formula.

The calculus Lord is the unit-free, intuitionistic Lambek sequent calculus with possibly empty antecedents. It has atoms, product, and both residuals. Concatenation of contexts is associative at the metalevel; product remains a binary formula former. Unlike Lambek’s original calculus, Lord admits the empty antecedent [Lam58].

Contexts are words

Let ϵ be the empty word. An ordered context is a finite word of formulas. If Γ and Δ are ordered contexts, then Γ,Δ is their concatenation. There is no equation Γ,A,B,Δ=Γ,B,A,Δ. Thus contexts form the free monoid on formulas: ϵ is the identity, concatenation is associative, and no commutativity equation is imposed. One may picture a context as a row of matrices whose multiplication order cannot be reversed; the analogy concerns order only, not matrix semantics.

Definition 38.1 — Formulas, contexts, and sequents

Fix a set of atoms At. Formulas and contexts are generated by A,B::=pABA\BB/A,Γ::=ϵA,Γ,pAt. A sequent ΓA has one ordered input word and one output. The arrow is punctuation separating antecedent from succedent; it is not a formula connective. Greek capitals Γ,Δ,Θ denote context words, while Roman capitals A,B,C,X,Y denote single formulas. Each of them is a word, never the finite-map linear context of chapter 18. The complete ordered rule sheet is collected in subappendix A.52. The connective A\B waits for an A on its left; B/A waits for an A on its right. Here \ is always a formula connective, unrelated to the row-lacks predicate of chapter 4. For invertible square matrices the positional mnemonic is literal: A\B  A1B,B/A  BA1. Lambek residuals are order-theoretic adjoints, not matrix inverses, but the two formulas differ for exactly the same reason that multiplication order matters.

The rules must expose every context split. In the two left-residual rules, the premise deriving A is inserted on the side from which the residual expects A.

Definition 38.2 — The cut-free calculus L_ ord

Derivations are generated by the following seven rules. Every metavariable written with a Greek capital letter denotes an ordered context, possibly empty; A,B,C,X,Y denote formulas.

AA
Id
ΓAΔB
Γ,ΔAB
Prod-R
Δ,A,B,ΘC
Δ,AB,ΘC
Prod-L
A,ΓB
ΓA\B
Bslash-R
ΓAΔ,B,ΘC
Δ,Γ,A\B,ΘC
Bslash-L
Γ,AB
ΓB/A
Slash-R
ΓAΔ,B,ΘC
Δ,B/A,Γ,ΘC
Slash-L

Identity and the product rules give the expansion XAAIdXBBIdA,BABProdRABABProdL. Rule Bslash-L places the argument immediately to the left of its residual: XAAIdXBBIdA,A\BBBslashL. Rule Slash-L places the argument immediately to the right: XAAIdXBBIdB/A,ABSlashL. Rule Slash-R abstracts the rightmost argument: AABBA,A\BBBslashLAB/(A\B)SlashR. Rule Bslash-R abstracts the leftmost argument: AABBB/A,ABSlashLA(B/A)\BBslashR. Every application tree preserves the left-to-right order of its premises; no exchange step occurs.

Exercise 38.1

★★☆ Construct cut-free derivations of (AB)CA(BC)andA(BC)(AB)C. Mark every split used by Prod-R. Do not appeal to a formula equation between the two products.

The crossing that is not a rule

The sequent from the opening is not merely absent from our examples. It is underivable.

Lemma 38.3 — Atomic last rule

If every formula of Γ and the succedent p is atomic, then Γp is derivable exactly when Γ is the one-letter word p.

Proof of Lemma 38.3 — Atomic last rule

Proof. The reverse implication is Id. For the forward implication, inspect the last rule. No left rule applies because the antecedent has no compound formula. No right rule applies because the succedent is atomic. The last rule is therefore Id, whose conclusion is exactly pp. ◻

Proposition 38.4 — Illegal exchange

For distinct atoms p,q, the sequent q,ppq has no cut-free derivation. If the exchange rule Δ,A,B,ΘCΔ,B,A,ΘCEx is added, it becomes derivable.

Proof of Proposition 38.4 — Illegal exchange

Proof. With atomic antecedents and a product succedent, the last rule can only be Prod-R. A split of the two-letter word q,p must make one premise derive p and the other derive q. The three splits are ϵq,p,qp,q,pϵ. The outer splits require an atomic conclusion from an empty context. The middle split requires qp and pq. Every case contradicts lemma 38.3. With exchange, first derive p,qpq by two identities and Prod-R, then apply Ex. ◻

Exercise 38.2

★★☆ Let p,q,r be distinct atoms. For each of the six permutations π of p,q,r, decide whether π(p,q,r)p(qr) is derivable. For every negative answer, give the failed final split and invoke lemma 38.3.

Ordered cut and substitution of derivations

A derivation that produces A may replace one distinguished occurrence of A, but it must occupy exactly that occurrence’s position.

Definition 38.5 — Cut, height, and formula size

The proposed ordered cut replaces one marked formula occurrence by the ordered context that derives it: ΓAΔ,A,ΘCΔ,Γ,ΘCCut. The height h(D) is the number of rule occurrences on a longest branch. Define |p|=1,|XY|=|X|+|Y|+1({,\,/}). The rank of one cut is the lexicographically ordered pair (|A|,h(D)+h(E)). The antecedent occurrence cut from E is regarded as marked; this distinguishes it from other occurrences of the same formula.

If Cut were admitted during backward search, even an atomic goal would have one candidate for every formula A: ΓAΔ,A,ΘpΔ,Γ,ΘpCut(A=p,pp,p\p,). A naive search node therefore has unbounded branching. Cut admissibility removes that choice and recovers the subformula-bounded search below.

Theorem 38.6 — Ordered single-cut admissibility

If cut-free derivations establish ΓA and Δ,A,ΘC, then there is a cut-free derivation of Δ,Γ,ΘC.

Proof of Theorem 38.6 — Ordered single-cut admissibility

Proof. Induct on the rank in definition 38.5. Commute a nonprincipal cut upward, erase identity cuts, and replace a principal cut by cuts on proper subformulas. Each transformation decreases the lexicographic rank.

Nonprincipal in the right derivation. Suppose the marked A is not principal in the last rule R of E. It occurs in exactly one premise. Cut D into that premise and reapply R. The possibilities are exhaustive:

last rule of E premise containing the marked occurrence
Prod-R left premise or right premise
Prod-L its unique premise
Bslash-R, Slash-R their unique premise
Bslash-L, Slash-L argument premise or continuation premise

For example, if the marked occurrence is in the left premise of Prod-R, the reduction is D:ΓAE1:Δ,A,ΘXE2:ΣYΔ,A,Θ,ΣXYProdRΔ,Γ,Θ,ΣXYCut. It reduces to cut(D,E1):Δ,Γ,ΘXE2:ΣYΔ,Γ,Θ,ΣXYProdR. For the right-premise case, perform the same reduction with the second premise in place of the first; the entire context word of the untouched first premise stays to the left of the recursive premise. For a residual-right rule, its added formula stays at the same end of the recursive premise. For a residual-left rule, recursing in the argument premise replaces precisely the contiguous block on the expected side of the residual; recursing in the continuation leaves that argument block fixed. Thus each row in the table preserves the conclusion word. The formula size is unchanged and the height of E decreases. This closes all commutes through the right derivation.

Two further commuting shapes make those placements explicit. Across Slash-R, D:ΓAE0:Δ,A,Θ,XYΔ,A,ΘY/XSlashRΔ,Γ,ΘY/XCut. It commutes to cut(D,E0):Δ,Γ,Θ,XYΔ,Γ,ΘY/XSlashR. When the marked occurrence lies inside the argument premise of Bslash-L, D:ΓAE1:Σ,A,ΠXE2:Δ,Y,ΘCΔ,Σ,A,Π,X\Y,ΘCBslashLΔ,Σ,Γ,Π,X\Y,ΘCCut commutes to the same Bslash-L tree with first premise cut(D,E1):Σ,Γ,ΠX. Neither conversion crosses the residual.

It remains to handle a last rule of E whose principal formula is the marked A.

Nonprincipal in the left derivation. If the last rule of D is a left rule, the succedent A is carried by that rule’s continuation premise. Cut that smaller premise into E, then reapply the left rule. For Bslash-L the complete schema is D1:ΛXD2:Π,Y,ΩAΠ,Λ,X\Y,ΩABslashLE:Δ,A,ΘCΔ,Π,Λ,X\Y,Ω,ΘCCut. It reduces to D1:ΛXcut(D2,E):Δ,Π,Y,Ω,ΘCΔ,Π,Λ,X\Y,Ω,ΘCBslashL. The Slash-L schema places X/Y before its argument block; Prod-L has only its continuation premise. Thus Bslash-L, Slash-L, and Prod-L exhaust the possible nonprincipal last rules of D, and each decreases h(D). In every nonprincipal case, the recursive cut has the same cut formula, a strictly smaller input height, and the same left-to-right order of the context word.

Principal identity. If either derivation ends in the identity that is principal for the cut, erase the cut: cutting AA on the left returns E, and cutting into the identity AA returns D. Thus either principal identity eliminates the cut without a recursive call.

Principal product and residuals. The principal connective cases are product, backslash, and slash. For each, the following premises determine a derivation of the stated contractum.

For A=XY, a Prod-R/Prod-L pair reduces as D1:Γ1X,D2:Γ2Y,E0:Δ,X,Y,ΘC,cut(D1,cut(D2,E0)):Δ,Γ1,Γ2,ΘC. The inner cut replaces Y; the outer cut then replaces X. Their cut formulas are proper subformulas of A.

For A=X\Y, the final rules have premises D0:X,ΓY,E1:ΣX,E2:Δ,Y,ΘC. First cut E1 for the initial X in D0, obtaining Σ,ΓY. Cut that result for Y in E2. The conclusion is Δ,Σ,Γ,ΘC, exactly the word obtained by replacing the principal occurrence in Δ,Σ,X\Y,Θ. Both new cuts have smaller formula.

For A=Y/X, use the premises D0:Γ,XY,E1:ΣX,E2:Δ,Y,ΘC. Cut E1 for the final X of D0, giving Γ,ΣY, and then cut this for Y in E2. The result is Δ,Γ,Σ,ΘC, matching the order in the Slash-L conclusion. Again both formulas are smaller.

Every recursive call therefore decreases the lexicographic rank. The cases are principal identity; nonprincipal Prod-L, Bslash-L, or Slash-L; and principal product, backslash, or slash, so the induction is well founded and exhaustive. ◻

The product principal case can be read as the complete tree rewrite D1:Γ1XD2:Γ2YΓ1,Γ2XYProdRE0:Δ,X,Y,ΘCΔ,XY,ΘCProdLΔ,Γ1,Γ2,ΘCCut0cut(D1,cut(D2,E0)). Both recursive cuts have a proper subformula of XY as cut formula. The inner cut replaces Y first; that order is what leaves Γ1,Γ2 rather than its reversal.

A concrete instance uses two identities to introduce pq, then immediately eliminates that product: Put D=ppqqp,qpqProdR,E=p,qpqpqpqProdL. Then the complete principal reduction is DEp,qpqCut0D. This is the schematic principal rewrite above with real atoms and identity premises; no exchange or hidden proof term is involved.

The single cut is enough to substitute an entire ordered environment.

Corollary 38.7 — Ordered simultaneous substitution

Let Γ=A1,,An, let D:ΓC, and for each i let Ei:ΞiAi be cut free. Then there is a cut-free derivation Ξ1,,ΞnC.

Proof of Corollary 38.7 — Ordered simultaneous substitution

Proof. Starting with D, use ordered single-cut admissibility on the marked occurrences An,An1,,A1, in that order. After replacing Ai, the block Ξi occupies the same position and later cuts do not cross it. The final context is therefore the displayed concatenation. When n=0, no cut is performed and the original derivation is returned. For distinct atomic blocks, exchanging adjacent Ξi would specialize to the underivable sequent of proposition 38.4, so the printed order is essential. ◻

Theorem 38.8 — Cut elimination

Every derivation formed from the rules of definition 38.2 and finitely many uses of Cut can be transformed into a cut-free derivation of the same sequent.

Proof of Theorem 38.8 — Cut elimination

Proof. Induct on the derivation. If its last rule is a logical rule with premises Di, the induction hypotheses give cut-free derivations of the same premise sequents, and reapplying that rule gives the original conclusion. Identity is already cut free. If the last rule cuts ΓA against Δ,A,ΘC, the two induction hypotheses are cut free and theorem 38.6 derives Δ,Γ,ΘC without cut. ◻

The residual notation can now be justified by an exact equivalence, rather than by the suggestive application trees alone.

Theorem 38.9 — Residuation

For all contexts Γ and formulas A,B, Γ,ABΓB/A,A,ΓBΓA\B. The equivalences concern derivability, not equality of derivation trees.

Proof of Theorem 38.9 — Residuation

Proof. The forward implications are exactly Slash-R and Bslash-R. For the first reverse implication, combine identities with Slash-L to obtain B/A,AB. Cut a given ΓB/A into its first antecedent position, obtaining Γ,AB, and eliminate that cut by theorem 38.8. For the second, use the displayed application A,A\BB, cut a given ΓA\B into its second position, and eliminate the cut. The resulting word is A,Γ, not Γ,A. ◻

Exercise 38.3

★★☆ Let p,q be atoms and let Γ be any ordered context. Prove the derivability equivalence Γ,pqΓq/p. In the reverse direction, display the Slash-L derivation used as the right premise of cut, state the cut occurrence, and preserve the order Γ,p in the conclusion. Do not use an exchange rule.

Exercise 38.4

★★☆ Starting only from D:Γ,A,BC, construct derivations of Γ(C/B)/AandΓC/(AB). For the second derivation, first combine A,B into a product on the left. State why the superficially similar Γ(AB)\C does not follow unless A,B occur before Γ in the premise.

Cut elimination reduces derivability to a finite backward calculation. The finiteness proof must account for both the choice of a context split and the choice of a principal antecedent formula.

Definition 38.10 — Sequent weight

Using the formula size from definition 38.5, put w(A1,,AnB)=|B|+i=1n|Ai|.

For example, search on p,p\qq rejects identity and the succedent rules, then selects the second antecedent occurrence for Bslash-L. The first prefix split ϵp makes the argument block p, producing the two identity leaves pp,qq. Thus the first successful branch applies Bslash-L with Γ=p, A=p, B=q, and empty surrounding contexts; its two premises are exactly the displayed identity leaves and its conclusion is p,p\qq.

The residual-left clauses explain why merely selecting a principal formula is not enough: the argument may consume any contiguous block on its required side, and every such block must be tried.

Lemma 38.12 — Strict descent

In every backward rule instance, the weight of each premise is strictly less than the weight of the conclusion.

Proof of Lemma 38.12 — Strict descent

Proof. A right rule removes the outer connective of the succedent. Prod-L removes the product connective from one antecedent. In Prod-R, either premise omits the other result subformula, the connective joining them, and the context block assigned to the other premise. In a residual-left rule, the argument premise omits the continuation, the other residual subformula, and the residual connective; the continuation premise omits the argument block, the argument formula, and that connective. Since every formula has positive size, each omission decreases the weight. Identity has no premise. ◻

Theorem 38.13 — Decidability and exactness of search

For every sequent of Lord, backward search terminates. It succeeds exactly when the sequent is derivable, and every successful branch reconstructs a cut-free derivation.

Proof of Theorem 38.13 — Decidability and exactness of search

Proof. There are finitely many antecedent occurrences and finitely many splits of a finite word, so every node has finite branching. By lemma 38.12, every branch has length at most the initial weight. The search tree is therefore finite.

For soundness, induct on a successful search tree and reapply the rule named at each node. For completeness, take any derivation. Eliminate its cuts by theorem 38.8, then induct on the resulting cut-free derivation. Its last rule is one of the seven rules, and the procedure enumerates its principal occurrence and its exact context split. The induction hypotheses give successful searches for every premise of that branch. ◻

The illegal-exchange result now applies even to derivations initially written with cut: cut elimination would produce the cut-free derivation that proposition 38.4 rules out.

A sentence is an ordered derivation

Let np be the type of a noun phrase and s the type of a sentence. Assign Adanp,likes(np\s)/np,Bertnp. The verb first consumes its object on the right. The resulting phrase waits for its subject on the left. The complete parse is XnpnpIdXnpnpIdXssIdnp,np\ssBslashLnp,(np\s)/np,npsSlashL. Read the inner inference first: a subject followed by a predicate makes a sentence. The outer inference inserts the transitive verb before the object block, exactly as Slash-L requires. Reversing the two names in the input does not change grammaticality because their categories coincide; moving the verb past either name does change the category word, and search rejects it.

Proposition 38.14 — A visible word-order failure

The category word np,np,(np\s)/nps is underivable in Lord.

Proof of Proposition 38.14 — A visible word-order failure

Proof. By cut elimination, consider a cut-free derivation. The atomic succedent precludes a right rule. The only compound antecedent is the slash formula, so the last rule must be Slash-L. That rule requires its argument context to occur to the right of the slash formula. Here the right suffix is empty, and no empty context derives the atom np, by lemma 38.3. No last rule remains. ◻

Ordered, noncommutative, planar, braided, and symmetric

These words describe different data. Treating them as synonyms hides where a crossing entered the proof.

Definition 38.15 — The exact exchange extension

Let Lex be Lord plus the single structural rule Δ,A,B,ΘCΔ,B,A,ΘCEx. Thus Lord is ordered: antecedents are words and it has no rule or context equation that swaps adjacent formulas. Call a calculus noncommutative at product when some formulas A,B make ABBA underivable. This is a derivability property, not another kind of context. By contrast, Lex admits every adjacent swap.

Proposition 38.16 — The exact structural boundary

The calculus Lord is noncommutative at product. If A,B are distinct atoms, then ABBA is underivable there but derivable in Lex.

Proof of Proposition 38.16 — The exact structural boundary

Proof. By cut elimination, inspect a cut-free last rule. If it is Prod-R, a split of the one-formula antecedent leaves an empty context in the premise with atomic succedent A or B, which is impossible by lemma 38.3. The only remaining applicable last rule is Prod-L; its premise is A,BBA. Its last rule must be Prod-R, and all three splits fail by the same atomic lemma, as in proposition 38.4. In the exchange extension, derive B,ABA by two identities and Prod-R, apply Ex to obtain A,BBA, and finish with Prod-L. ◻

Proposition 38.17 — Exchange identifies the two residuals

In Lex, both A\BB/AandB/AA\B are derivable.

Proof of Proposition 38.17 — Exchange identifies the two residuals

Proof. For the first sequent, derive the application A,A\BB by Bslash-L, exchange its two antecedents, and apply Slash-R. For the second, derive B/A,AB by Slash-L, exchange, and apply Bslash-R. Thus the ordered distinction is precisely what exchange removes; no formula equality is postulated. ◻

There are three further comparisons, but they are not extra rules of the calculus just defined. A planar drawing represents a derivation with its input leaves in antecedent order and no wire crossings. The seven rules admit such drawings because each rule joins or expands adjacent blocks. A braided presentation instead records explicit crossing generators σi, identifies the two three-wire composites σiσi+1σi and σi+1σiσi+1, and retains the history of a double crossing. A symmetric presentation further identifies σi2 with the identity. These are equations between proof representations. The rule Ex records only derivability after a swap, so it cannot by itself distinguish braided from symmetric proof identity. We make no normalization or coherence claim for either presentation. The hexagon equations for a braiding and the additional involutivity equation for a symmetry are displayed in Baez and Stay, §§2.4–2.5, printed pp. 20–23 [BS09].

The same three-wire interface makes the distinction visible: Mathematical diagramDiagram The braided panel records a crossing generator; the symmetric panel adds the equation σi2=id. A planar proof has no crossing to label.

Source note.

Veltri’s normalization-by-evaluation theorem covers ordered possibly empty contexts, product, both residuals, and multiplicative unit in natural deduction [Vel22]. The cut elimination proof in theorem 38.8 and the bounded search proof in theorem 38.13 concern the sequent calculus defined in this chapter and do not depend on that imported theorem.

Suggested first pass.

Begin with exercise 38.5, exercise 38.6, exercise 38.8; then use the remaining problems to test the exchange and braiding boundaries.

None of these problems is a prerequisite for a later chapter.

Exercise 38.6

★★☆ Normalize a principal Prod-R/Prod-L cut with left context Γ1,Γ2. Display both trees and both strict cut-rank inequalities.

Exercise 38.7

★★☆ Normalize a principal Bslash-R/Bslash-L cut. Name the two smaller cut formulas and check that its final context is Δ,Σ,Γ,Θ, not a permutation of those four blocks.

Exercise 38.8

★★☆ Give categories to the four-word string “Ada sends Bert mail” using atoms a,b,m,s, assigning the three names the distinct categories a,b,m. Make “sends” consume b, then m, on the right and a on the left. Derive the sentence; for each single adjacent swap, give the failed argument premise.

Exercise 38.9

★★☆ For distinct atoms A,B,C, refute A(BC)(AC)B in the ordered calculus by comparing the atomic frontiers of a cut-free derivation. Derive it in the exchange extension, mark the single crossing of B and C, and explain why proposition 38.16 alone does not supply this derivation.

Exercise 38.10

★☆☆ Let σ1 cross the first two of three adjacent wires and σ2 cross the last two. Read a composite fg from left to right: perform f, then g. Starting from the top order (1,2,3), list the intermediate order after every generator and verify that σ1σ2σ1 and σ2σ1σ2 have the same endpoint order. State what the braid equation identifies and why it does not imply σi2=id.

Exercise 38.11

★★★ Practical project.ordered-lambek-search Implement the deterministic cut-free search of definition 38.11 in Kappa. The oracle must accept product reassociation, a residuation pair, the ordered residual chain, and the distinct-category sentence, while rejecting atomic exchange and all three single adjacent sentence swaps. Mutate Prod-R so it reverses its two premise blocks; the mutant must type-check and audit cleanly but fail the association or exchange oracle. For a residual rule, the selected argument must be one contiguous antecedent block, and no step may permute the remaining word. The executable result is the six Boolean oracle lines and their all-pass summary. Administrative fuel may witness totality of the Kappa encoding; explain why that bounded run is not the mathematical descent proof of lemma 38.12. Appendix E records the four acceptance commands and appendix F gives the search stages.

Search the book

Type to search the local edition.