Proceedings of the Ninth International Workshop on Parsing Technologies (IWPT), pages 18–29,
Vancouver, October 2005. c©2005 Association for Computational Linguistics
Switch Graphs for Parsing Type Logical Grammars∗
Bob Carpenter
Alias-i
181 North 11th Street, #401
Brooklyn, NY, 11211
carp@colloquial.com
Glyn Morrill
Universitat Polit`ecnica de Catalunya
Departament de Llenguatges i Sistemes Inform`atics
E-08034 Barcelona
morrill@lsi.upc.edu
Abstract
Parsing in type logical grammars amounts
to theorem proving in a substructural
logic. This paper takes the proof net
presentation of Lambek’s associative cal-
culus as a case study. It introduces
switch graphs for online maintenance
of the Danos-Regnier acyclicity condi-
tion on proof nets. Early detection of
Danos-Regnier acyclicity violations sup-
ports early failure in shift-reduce parsers.
Normalized switch graphs represent the
combinatorial potential of a set of anal-
yses derived from lexical and structural
ambiguities. Packing these subanalyses
and memoizing the results leads directly
to a dynamic programming algorithm for
Lambek grammars.
1 Introduction
Following Montague (1970), we take the goal
of a theory of grammar to be that of assign-
ing semantic terms to linguistic expressions.
Type logical grammar is a paradigm for devel-
oping grammatical theories based on a strong
notion of typing for natural language expres-
sions. Specifically, each linguistic expression is
assigned a syntactic type and a semantic term.
For instance, the expression “John read the book”
of English might be assigned a syntactic type
S and the semantic term read(the(book))(j),
∗Supported by CICYT project TIC2002–04019–C03–01.
the expression “book that John read” the term
that(λx.read(x)(j))(book) and type CN, and
“person that read the book” the type CN and term
that(λy.read(the(book))(y))(person).
2 Lambek’s Associative Calculus
Lambek’s associative calculus L (Lambek 1958)
contains three connectives: concatenation, left divi-
sion, and right division. Logically, concatenation is
conjunction and the divisions are directed implica-
tions. Algebraically, concatenation is a free semi-
group product and the divisions its left and right
residuals. Viewed as a purely syntactic formalism,
L assigns syntactic types to linguistic expressions
modeled as sequences of tokens. From a stipulated
lexical assignment of expressions to syntactic types,
further assignments of expressions to types are de-
rived through purely logical inference, with the logic
representing a sound and complete axiomatization
and inference system over the algebraic structure
(Pentus 1995).
L appears near the bottom of a hierarchy of
substructural logics obtained by dropping structural
rules: Lambek proofs are valid as multiplicative
intuitionistic linear proofs (restoring permutation)
which are valid as conjuntive and implicative rele-
vance proofs (restoring contraction) which are valid
as conjuntive and implicative intuitionistic proofs
(restoring weakening). In type logical grammars,
lexical entries are associated with syntactic types
and intuitionistic (in fact probably relevant) proofs
as semantic representations, notated as terms of the
simply typed λ-calculus with product, under the
Curry-Howard correspondence. The semantics of a
18
derived expression is the result of substituting the
lexical semantics into the reading of the derivation
as an intuitionistic proof.
2.1 Syntactic and Semantic Types
The set of syntactic types is defined recursively on
the basis of a set SynAtom of atomic syntactic types.
The full set SynTyp of syntactic types is the least
set containing the atomic syntactic types SynAtom
and closed under the formation of products (SynTyp·
SynTyp), left divisions (SynTyp\SynTyp), and right
divisions (SynTyp/SynTyp). The two division, or
“slash”, types, A/B, read A over B, and B\A, read B
under A, refine the semantic function types by pro-
viding a directionality of the argument with respect
to the function. A linguistic expression assigned to
type A/B combines with an expression of type B on
its right side to produce an expression of type A. An
expression of type B\A combines with an expression
of syntactic type B on its left to produce an expres-
sion of type A. The product syntactic type A·B is as-
signed to the concatenation of an expression of type
A to an expression of type B. The distinguishing
feature of Lambek calculus with respect to the ear-
lier categorial grammar of Bar-Hillel is that as well
as the familar cancelation (modus ponens) rules, it
admits also a form of the deduction theorem: if the
result of concatenating an expression e to each B re-
sults in an expression of type A, then it follows that
e is assigned to syntactic type A/B.
Semantic representations in Lambek type logical
grammar are simply typedλ-terms with product. We
assume a set SemAtom of atomic semantic types,
which generate the usual function types σ → τ and
product types σ×τ. Terms are grounded on an in-
finite set of distinct variables Varσ, along with a set
of distinct contants Conσ for each type σ. We as-
sume the usual λ-terms consisting of variables, con-
stants, function applications α(β), function abstrac-
tions λx.α, pairs 〈α,β〉 and projections from pairs
pi1δ and pi2δ onto the first and second element of the
pair respectively. We say that a term α is closed if
and only if it contains no free variables.
A type map consists of a mapping typ :
SynAtom → SemTyp. That is, each atomic syn-
tactic type A ∈ AtomCat is assigned to a (not neces-
sarily atomic) semantic type typ(A) ∈ SemTyp. Se-
mantic types are assigned to complex syntactic types
as follows:
typ(A · B) = typ(A) × typ(B) [Product]
typ(A/B) = typ(B) → typ(A) [Right Division]
typ(B\A) = typ(B) → typ(A) [Left Division]
We will often writeα : A whereαis aλ-term of type
typ(A).
2.2 Linguistic Expressions and the Lexicon
In the Lambek calculus, linguistic expressions are
modeled by sequences of atomic symbols. These
atomic symbols are drawn from a finite set Tok of
tokens. The full set of linguistic expressions Tok∗
is the set of sequences of tokens. For the sake of
this short version of the paper we admit the empty
sequence; we will address its exclusion (as in the
original definition of L) in a longer version.
The compositional assignment of semantic terms
to linguistic expressions is grounded by a finite set
of assignments of terms and types to expressions.
A lexicon is a finite relation Lex ⊆ Tok∗ × Term ×
SynTyp, where all 〈w,α,A〉 ∈ Lex are such that the
semantic term α is of the appropriate type for the
syntactic type A. We assume that the only terms
used in the lexicon are relevant, in the sense of rele-
vance logic, in not containing vacuous abstractions.
Note that the set of atomic semantic types, atomic
syntactic types and the semantic type mapping are
assumed as part of the definition of a lexicon. Type
logical grammar is an example of a fully lexicalized
grammar formalism in that the lexicon is the only
locus of language-specific information.
2.3 Proof Nets
A sequent Γ ⇒ α : A is formed from an antecedent
Γ consisting of a (possibly empty) sequence of λ-
term and syntactic type pairs, and a consequent pair
α : A, where the terms are of the appropritate type
for the types. Following Roorda (1991), we define
theoremhood with Girard-style proof nets (Girard
1987), a geometric alternative to Lambek’s Gentzen-
style calculus (Lambek 1958).
Proof nets form a graph over nodes labeled by
polar types, where a polar type is the combination
of a syntactic type and one of two polarities, input
(negative) and output (positive). We write A• for the
input polar type, which corresponds to antecedent
types and is thus logicaly negative. We write A◦ for
19
the output polar type, which is logically positive and
corresponds to a consequent type. A literal is a po-
lar type with an atomic syntactic type. Where A is
an atomic syntactic type, the literals A• and A◦ are
said to be complementary.
Each polar type defines an ordered binary tree
rooted at that polar type, known as a polar tree. For a
literal, the polar tree is a single node labeled by that
literal. For polar types with complex syntactic types,
the polar tree is rooted at the polar type and unfolded
upwards based on connective and polarity according
to the solid lines in Figure 1, which includes also
other annotation. Examples for some linguistically
motivated types are shown in Figure 2.
The solid edges of the graphs are the edges of
the logical links. Each unfolding is labeled with a
multiplicative linear logic connective, either multi-
plicative conjunction (⊗) or multiplicative disjunc-
tion (℘). This derives from the logical interpretation
of the polar type trees as formula trees in multiplica-
tive linear logic. Unfolding the Lambek connectives
to their linear counterparts, (A/B)• and (B\A)• un-
fold to A•℘B◦; (A/B)◦ and (B\A)◦ unfold to A◦⊗B•;
(A · B)• unfolds to A• ⊗ B•; and (A · B)◦ unfolds to
A◦℘B◦. The type unfoldings correspond to the clas-
sical equivalences between (φ → ψ) and (¬φ ∨ ψ),
between ¬(φ → ψ) and (φ ∧ ¬ψ), and between
¬(φ∧ψ) and (¬φ∨ ¬φ). For atomic syntactic types
A, A• becomes simply A, whereas A◦ becomes its
linear negation A⊥; this is the sense in which po-
lar atomic types correspond to logical literals. The
non-commutatitive nature of the Lambek calculus is
reflected in the ordering of the subtrees in the un-
foldings; for commutative logics, the proof trees are
not ordered.
The proof frame for a syntactic sequent
C1,...,Cn ⇒ C0 is the ordered sequence of
polar trees rooted at C◦0,C•1,...,C•n. We convert
sequents to frames in this order, with the output
polar tree first. In general, what follows applies to
any cyclic reordering of these polar trees. Note that
the antecedent types C1,...Cn have input (negative)
polarity inputs and the consequent type C0 has
output (positive) polarity. All of our proof frames
are intuitionistic in that they have a single output
conclusion, i.e. a unique polar tree rooted at an
output type.
A partial proof structure consists of a proof frame
with a set of axiom links linking pairs of comple-
mentary literals with at most one link per literal. Ax-
iom links in both directions are shown in Figure 3.
A proof structure is a proof structure in which all
literals are connected to complementary literals by
axiom links.
Proof nets are proof structures meeting certain
conditions. A proof structure is planar if and only if
its axiom links can be drawn in the half-plane with-
out crossing lines; this condition enforces the lack
of commutativity of the Lambek calculus. The fi-
nal condition on proof structures involves switch-
ing. A switching of a proof structure is a subgraph
that arises from the proof structure by removing ex-
actly one edge from each disjunctive (℘) link. A
proof structure is said to be Danos-Regnier (DR-)
acyclic if and only if each of its switchings is acyclic
(Danos and Regnier 1989).1A proof net is a planar
DR-acyclic proof structure. A theorem is any se-
quent forming the proof frame of a proof net.
Consider the three proof nets in Figure 4. The first
example has no logical links, and corresponds to the
simplest sequent derivation S ⇒ S . The second ex-
ample represents a determiner, noun and intransitive
verb sequence. Both of these examples are acyclic,
as must be every proof net with no logical ℘-links.
The third example corresponds to the type-raising
sequent N ⇒ S/(N\S ). Unlike the other examples,
this proof net involves a ℘-link and is cyclic. But
both of its switchings are acyclic, so it satisfies the
Danos-Regnier acyclicity condition.
2.4 Essential Nets and Semantic Trips
A term is said to be pure if and only if it contains
no constants. The linear terms are closed, pure λ-
terms that bind each variable exactly once. Each
proof net in the Lambek calculus corresponds to a
linear (i.e. binding each variable exactly once) λ-
term via the Curry-Howard correspondence. This
term abstracts over variables standing in for the se-
mantics of the inputs in the antecedent of the sequent
and has a body that is determined by the consequent
of the sequent. For instance, the λ-term λx.λP.P(x)
corresponds to the syntactic sequent x : N, P :
1The full Danos-Regnier condition is that every switching
be acyclic and connected. Fadda and Morrill (2005) show that
for the intuitionistic case (i.e. single output conclusion, as for
L), DR-acyclicity entails the connectedness of every switching.
20
d15d15d31
d31
α(β) : A•
{ }
d66d66d66
d66d66d66
d66d66d66
d66d66
d42d42
d38
d45
d53 d66
d77 d85
d47d47d95d95d95d95d95d95d95 β : B◦
{ }
d0d0d0
d0d0d0
d0d0d0
d0d0
d79d79d31d31
⊗
α : A/B•
d15d15d31
d31
d15d15d31
d31
xi : B•
{Li}
d67d67d67
d67d67d67
d67d67d67
d67d67d67
α : A◦
{Ri}
d123d123d123
d123d123d123
d123d123d123
d123d123d123
d79d79d31d31
℘
λxi.α : A/B◦
d76d76
d113 d123
d8 d17
d23
d79d79d31d31
d15d15d31
d31
β : B◦
{ }
d62d62d62
d62d62d62
d62d62d62
d62d62
d79d79d31d31
α(β) : A•
{ }
d124d124d124
d124d124d124
d124d124d124
d124d124
d116d116
d24
d18d9
d124d113d105
d111d111d95 d95 d95 d95 d95 d95 d95
⊗
α : B\A•
d15d15d31
d31
d15d15d31
d31
α : A◦
{Li}
d67d67d67
d67d67d67
d67d67d67
d67d67d67
d79d79d31d31
xi : B•
{Ri}
d123d123d123
d123d123d123
d123d123d123
d123d123d123
℘
λxi.α : B\A◦
d82d82
d77d67
d54
d45
d39
d79d79d31d31
d15d15d31
d31
d15d15d31
d31
pi1γ : A•
{Li}
d65d65d65
d65d65d65
d65d65d65
d65d65
d42d42
d38
d44
d53 d65
d77
pi2γ : B•
{Ri}
d125d125d125
d125d125d125
d125d125d125
d125d125
d116d116
d24
d18d10
d125d114
℘
γ : A · B•
d15d15d31
d31
β : B◦
{ }
d67d67d67
d67d67d67
d67d67d67
d67d67d67
d79d79d31d31
α : A◦
{ }
d122d122d122
d122d122d122
d122d122d122
d122d122d122
d79d79d31d31
⊗
〈α,β〉 : A · B◦
d82d82
d78d67
d55
d46
d40 d76d76
d112 d122
d7 d16
d22
d79d79d31d31
Figure 1: Logical Links with Switch Paths (solid) and Semantic Trip (dashed)
x : S ◦ x : N◦ y(x) : S •
⊗
y : N\S •
d63d63d63d63 d127d127
d127d127
u : CN◦ z(λx.y)(u) : CN• x : N• y : S ◦
⊗ ℘
z(λx.y)CN\CN•
d68d68d68d68 d122d122
d122d122
λx.y : S/N◦
d68d68d68d68 d122d122
d122d122
⊗
z : (CN\CN)/(S/N)•
d82d82d82d82d82d82
d82 d108d108d108d108d108d108d108
t : S ◦ v : N• r:N◦ x(λyw.u)(λv.t)(r):S • u:S ◦ w : N• z : N◦ y(z) : S •
℘ ⊗ ℘ ⊗
λv.t : N\S ◦
d62d62d62d62 d0d0
d0d0
x(λyw.u)(λv.t) : N\S •
d78d78d78d78d78
d78 d0d0d0d0
λw.u : N\S ◦
d62d62d62d62 d0d0
d0d0
y : N\S •
d62d62d62d62 d0d0
d0d0
⊗ ℘
x(λy.λw.u) : (N\S )\(N\S )•
d78d78d78d78d78
d78 d112d112d112d112d112d112
λy.λw.u : (N\S )\(N\S )◦
d78d78d78d78d78
d78 d112d112d112d112d112d112
⊗
x : ((N\S )\(N\S ))/((N\S )\(N\S ))•
d87d87d87d87d87d87d87d87
d87d87 d103d103d103d103d103d103d103d103d103d103
Figure 2: Examples of Polar Type Trees
21
α : A•
d15d15d31
d31 α : A◦
d117d117 d86d91d95d99d104
{ }
d79d79d31d31 α : A◦
d41d41d104 d99 d95 d91 d86
α : A•
{ }
d15d15d31
d31d79d79
Figure 3: Axiom Links with Switch Paths and Semantic Trip
S ◦ S •
N• CN◦ N◦ S •
⊗ ⊗
S ◦ N/CN•
d63d63 d127d127
CN• N\S •
d63d63 d127d127
N◦ S •
⊗
N\S •
d63d63 d127d127
S ◦℘
S/(N\S )◦
d63d63 d127d127
N•Figure 4: Three Example Proof Nets
N\S ⇒ P(x) : S and λx.λP.P(x) corresponds to
the sequent x : N ⇒ λP.P(x) : S/(N\S ). The λ-
term induced by the Curry-Howard correspondence
can be determined by a unification problem over a
proof net (Roorda 1991). Different proof nets for the
same theorem correspond to different interpretations
through the Curry-Howard correspondence. The es-
sential net of a proof structure is the directed graph
rooted at the root node of the output polar type tree
whose edges are shown as dashed lines in Figures 1
and 3 (LaMarche 1994). Each output division type
introduces a fresh variable on its input subtype (its
argument), as indicated by the labels xi in Figure 1.
The essential nets for the examples in Figure 4 are
shown in Figure 5.
Terms are computed for the polar type trees by
assigning terms to the roots of the polar inputs. The
tree is then unfolded unifying in substitutions as it
goes, as illustrated in the example polar type trees in
Figure 2. The direction of axiom links in the essen-
tial net provide the substitutions necessary to solve
the unification problem of λ-terms in the proof net
established by equating the two halves of each ax-
iom linked complementary pair of literals. A traver-
sal of an essential net carrying out the substitutions
specified by axiom links constitutes a semantic trip
the end result of which is the Curry-Howard λ-term
for the Lambek calculus theorem derived by the
proof net. All λ-terms derived from a semantic trip
with variables or constants assigned to input root po-
lar types will be in β-η long form. The essential net
directly corresponds to the tree of the semantic term
derived by the Curry-Howard correspondence.
The well-formedness of a set of axiom linkings
over a polar tree may be expressed in terms of the
essential net. Among the conditions are that an es-
sential net must be acyclic and planar. In addition,
essential nets must be connected in two ways. First,
there must be a path from the root of the single out-
put polar tree to the root of each of the input polar
trees. Second, there must be a path from each output
daughter of an output division to the input daugh-
ter. That is, when A/B◦ is unfolded to B•A◦, there
must be a path from A◦ to B•. These conditions ex-
press the definition of linear semantic terms dictated
through the logic by the Curry-Howard correspon-
dence. The first condition requires each variable (or
term) corresponding to the root of an input polar tree
to occur in the output term, whereas the second con-
dition requires that variables only occur within their
proper scopes so that they are bound. The essen-
tial nets presented in Figure 5 adhere to these con-
ditions and produce well-typed linear λ-terms. The
example presented in Figure 6 shows a set of axiom
links that does not form a proof net; it violates the
condition on variable binding, as is seen from the
lack of path from the N◦ daughter to the N• daugh-
ter of the N/N◦ node. The major drawback to us-
ing these conditions directly in parsing is that they
are existential in the sense of requring the existence
of a certain kind of path, and thus difficult to refute
online during parsing. In comparison, the Danos-
22
t(k) : N•
d15d15
d31d31d63d63
d63d63
d47d47 CN◦
d15d15
N◦ r(t(k)) : S •
d127d127 d127d127d127
d111d111
S ◦
d15d15
t : N/CN• k : CN• r : N\S •
N◦
d15d15
x(j) : S •
d15d15
d111d111
d126d126d124d124d124d124
x : N\S • S ◦
λx.x(j) : S/(N\S )◦
d62d62d124d124
d124d124
j : N•Figure 5: Semantic Trips
α(λx.β)(γ(x)) : N• d47d47
d32d32d66d66
d66d66 N
◦
d15d15
x : N•
d15d15
N◦
d15d15
α(λx.β) : N/N• d47d47
d40d40d80d80d80d80
d80d80 λx.β : N/N
◦
d62d62d124d124
d124d124
N◦ γ(x) : N•d111d111
d126d126d124d124d124d124
N◦
d15d15
α : (N/N)/(N/N)• β : N• γ : N\N•
Figure 6: Unbound Variable in Illegal Semantic Trip
N• N◦
d31d31
d31d31
d31
d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95
d31
d31
d31
d31
d31
d31
d31
d31
N•
d31
d31
d31
d95d95d95d95d95d95d95d95d95d95d95d95d95d95
d31
d31
d31
d31
d31
d31
N◦
⊗ ℘
N/N•
d66d66d66
d66 d124d124
N/N◦
d66
d66
N◦ N•
⊗ ⊗
N◦ (N/N)/(N/N)•
d80 d80 d80
d80
d110d110d110
d110
N• N\N•
d66
d66 d124d124
Figure 7: Switching with Path Violating Danos-Regnier Acyclicity
23
Regnier acyclicity condition is violated by the at-
tempt to close off the binding of the variable. The
path vilolating DR acyclicity is shown in Figure 7,
with the path given in dashed lines and the switch-
ing taking the right daughter of N/N◦ as the arc to
remove.
3 Parsing with Switch Graphs
The planar connection of all literals into a proof
structure is straightforward to implement. Axiom
links are simply added in such a way that planarity
is maintained until a complete linkage is found. In
our shift-reduce-style parser, planarity is maintained
by a stack in the usual way (Morrill 2000). For dy-
namic programming, we combine switch graphs in
the cells in a Cocke-Kasami-Younger (CKY) parser
(Morrill 1996). The main challenge is enforcing
DR-acyclicity, and this is the main focus of the rest
of the paper. We introduce switch graphs, which not
only maintain DR-acyclicity, but also lead the way
to a normal form for well-formed subsequence frag-
ments of a partial proof structure. This normal form
underlies the packing of ambiguities in subderiva-
tions in exactly the same way as usual in dynamic
programming parsing.
3.1 Switch Graphs
Switch graphs are based on the observation that a
proof structure is DR-acyclic if and only if every cy-
cle contains both edges of a ℘-link. If a cycle con-
tains both edges of a ℘-link, then any switching re-
moves the cycle. Thus if every cycle in a proof struc-
ture contains both edges of a℘-link, every switching
is acyclic.
The (initial) switch graph of a partial proof struc-
ture is defined as the undirected graph underlying
the partial proof structure with edges labeled with
sets of ℘-edge identifiers as indicated in Figures 1
and 3. Each edge in a logical ℘-link is labeled with
the singleton set containing an identifier of the link
itself, either Li for the left link of ℘-link i or Ri for
the right link of ℘-link i. Edges of axiom links and
logical ⊗-links are labeled with the empty set.
The closure of a switch graph is computed by it-
erating the following operation: if there is an edge
n1 − n2 labeled with set X1 and an edge edge n2 − n3
labeled with set X2 such that X1∪X2 does not contain
both edges of a ℘-link, add an edge n1 − n3 labeled
with X1∪X2. An edge n−m labeled by X is subsumed
by an edge between the same nodes n−m labeled by
Y if Y ⊆ X. The normal switch graph of a partial
proof structure is derived by closing its the initial
switch graph, removing edges that are subsumed by
other edges, and restricting to the literal nodes not
connected by an axiom link. These normal switch
graphs define a unique representation of the combi-
natorial possibilities of a span of polar trees and their
associated links in a partial proof structure. That is,
any partial proof structure substructure that leads to
the same normal switch graph may be substituted in
any proof net while maintaining well-formedness.
The fundamental insight explored in this paper is
that two literals may be connected by an axiom link
in a partial proof structure without violating DR-
acyclicity if and only if they are not connected in
the normal switch graph for the partial proof struc-
ture. The normal switch graph arising from the ad-
dition of an axiom link is easily computed. It is just
the closure generated by adding the new axiom link,
with the two literals being linked removed.
3.2 Shift-Reduce Parsing
In this section, we present the search space for a
shift-reduce-style parsing algorithm based on switch
graphs. The states in the search consist of a global
stack of literals, a lexical stack of literals, the re-
maining tokens to be processed, and the set of links
among nodes on the stacks in the switch graph. The
shift-reduce search space is characterized by an ini-
tial state and state transitions. These are shown in
schematic form in Figure 8. The initial state con-
tains the output type’s literals and switch graph. A
lexical transition is from a state with an empty lexi-
cal stack to one containing the lexical literals of the
next token; the lexical entry’s switch graph merges
with the current one. A shift transition pops a literal
from the lexical stack and pushes it onto the global
stack. A reduce transition adds an axiom link be-
tween the top of the global stack and lexical stack
if they are complementary and are not connected in
the switch graph; the resulting switch graph results
from adding the axiom link and normalizing. The
stack discipline insures that all partial proof struc-
tures considered are planar.
Figure 10 displays as rows the shift-reduce search
24
Stack Lex Sw-Gr Op
A◦ gr(A◦) start(A)
S G
S A• G ⊕ gr(A•) lex(w,A)
Stack Lex Sw-Gr Op
AiS A jL G
S L (G ⊕ i=j) − {i, j} reduce(i, j)
AS BL G
BAS L G shift(B)
Figure 8: Shift-Reduce Parsing Schematic
N•1 N◦2 N◦4 N•5
N◦0 N1/N•2
d57d57d57d57 d5d5
d5d5
N•3 N4\N•5
d57d57d57d57 d5d5
d5d5
N•1 N◦2 N◦4 N•5
N◦0 N1/N•2
d57d57d57d57 d5d5
d5d5
N•3 N4\N•5
d57d57d57d57 d5d5
d5d5
Figure 9: Modifier Attachment Ambiguity Proof Nets
Stack Lex Tok Sw-Gr Ax Op
N◦0 start
N◦0 N•1 N◦2 w1 1-2{} lex
− N◦2 0=1 reduce
N◦2 shift
N◦2 N•3 w2 lex
N•3 N◦2 shift
N•3 N◦2 N◦4 N•5 w3 4-5{} lex
N◦2 N•5 3=4 reduce
2=5 reduce
Stack Lex Tok Sw-Gr Ax Op
N◦0 start
N◦0 N•1 N◦2 w1 1-2{} lex
N•1 N◦0 N◦2 1-2{} shift
N◦2 N•1 N◦0 1-2{} shift
N◦2 N•1 N◦0 N•3 w2 1-2{} lex
N•1 N◦0 2=3 reduce
N•1 N◦0 N◦4 N•5 w3 4-5{} lex
N◦0 N•5 1=4 reduce
0=5 reduce
Figure 10: Modifier Attachment Ambiguity Shift-Reduce Search States
25
states corresponding to the two valid proof nets
shown in Figure 9. The subscripts on syntactic types
in the diagram is only so that they can be indexed
in the rows of the table describing the search states.
The initial state in both searches is created from the
output type’s literal. The third column of the dia-
grams indicate the token consumed at each lexical
entry. The switch graphs are shown for the rows
for which they’re active. Because there are no ℘-
links, all sets of edges are empty. The fifth column
shows the axiom linking made at each reduce step.
The history of these decisions and lexical insertion
choices determines the final proof net. Finally, the
sixth column shows the operation used to derive the
result. Note that reduction is from the top of the lex-
ical stack to the top of the global stack and is only
allowed if the nodes to be linked are not connected in
the switch graph. This is why N•1 cannot reduce with
N◦2 in the second diagram in Figure 10; the second
shift is mandatory at this point. Note that as active
nodes are removed, as in the first diagram reduction
step linking 0=2, the switch graph contracts to just
the unlinked nodes. After the reduction, only N•2 is
unlinked, so there can be no switch graph links. The
link between node 4 and 5 is similarly removed al-
most as soon as it’s introduced in the second reduc-
tion step. In the second diagram, the switch graph
links persist as lexical literals are pushed onto the
stack.
Shift-reduce parses stand in one-to-one corre-
spondence with proof nets. The shift and reduce op-
erations may be read directly from a proof net by
working left to right through the literals. Between
literals, the horizontal axiom links represent literals
on the stack. Literals in the current lexical syntac-
tic type represent the lexical stack. Literals that are
shifted to the global stack eventually reduce by ax-
iom linking with a literal to the right; literals that are
reduced from the lexical stack axiom link to their
left with a literal on the global stack.
3.3 Memoized Parsing
Using switch graphs, we reduce associative Lam-
bek calculus parsing to an infinite binary phrase-
structure grammar, where the non-terminals are
normalized switch graphs. The phrase structure
schemes are shown in Steedman notation in Fig-
ure 11. Lexical entries for syntactic type A are de-
rived from the input polar tree rooted at A•. This
polar tree yields a switch graph, which is always a
valid lexical entry in the phrase structure grammar.
Any result of axiom linking adjacent complemen-
tary pairs of literals in the polar tree that maintains
switch-graph acyclicity is also permitted. For in-
stance, allowing empty left-hand sides of sequents,
the input type A/(B/B)• would produce the literals
A•1B•2B◦3 with links 1-2 : {L3},1-3 : {R3}. This could
be reduced by taking the axiom link 2=3, to pro-
duce the single node switch graph A•1. In contrast,
(B/B)/A• produces the switch graph B•1B◦2A◦3 with
links 1-2, 1-3, and 2-3. Thus the complementary B
literals may not be linked.
Given a pair of normal switch graphs, the binary
rule scheme provides a finite set of derived switch
graphs. One or more complementary literals may be
axiom linked in a nested fashion at the borders of
both switch graphs. These sequences are marked as
∆ and ∆ and their positions are given relative to the
other literals in the switch graph in Figure 11. Un-
linked combinations are not necessary because the
graph must eventually be connected. This scheme
is non-deterministic in choice of ∆. For instance, an
adverb input (N1\S 2)/(N4\S 3)• produces the literals
N◦1S •2S ◦3N•4 and connections 1-2, 1-3:{L4}, 1-4:{R4},
2-3:{L4}, and 2-4:{R4}. When it combines with a
verb phrase input N5\S •6 with literals N◦5S •6 and con-
nections 5-6, then either the nominals may be linked
(4=5), or the nominals and sentential literals may be
linked (4=5, 3=6). The result of the single linking is
N◦1S •2S ◦3S •6 with connections 1-2, 1-3:{L4}, 1-6:{R4},
2-3:{L4}, and 2-6:{R4}. The result of the double link-
ing is simply N◦1S •6 with connection 1-6, or in other
words, a verb phrase.
The dynamic programming equality condition is
that two analyses are considered equal if they lead
to the same normalized switch graphs. This equality
is only considered up to the renaming of nodes and
edges. Backpointers to derivations allow semantic
readings to be packed in the form of lexical choices
and axiom linkings. For instance, consider the two
parses in Figure 12.
With a finite set of lexical entries, bottom-up
memoized parsing schemes will terminate. We illus-
trate two derivations of a simple subject-verb-object
construction in Figure 13. This is a so-called spuri-
ous ambiguity because the two derivations produce
26
w lex
∆
G




Lex(w,A),and
A• has switch graph
w. literals ∆,links G




Γ1 ∆
G1
∆ Γ2
G2 ∆ = ∆
Γ1 Γ2
(G1 ∪ G2) ⊕ (∆ = ∆)





∆ = Ai1,...,Ain
∆ = Ajn,...,Aj1
(∆ = ∆) = i1 = j1,...,in = jn





Figure 11: Phrase-Structure Schemes over Switch Graphs
a:N1/N2
a(x):N•1 x:N◦2
1-2
b:N3
b:N•3
c:N4\N5
y:N◦4 c(y):N•5
4-5 3=4
c(b):N•5
2=5
a(b(c)):N•1
a:N1/N2
a(x):N•1 x:N◦2
1-2
b:N3
b:N•3
2=3a(b):N•
1
c:N4\N5
y:N◦4 c(y):N•5
4-5 1=4
c(a(b)):N•5
Figure 12: Modifier Attachment Ambiguity Packing
the same semantic term. They are not spurious glob-
ally because the alternative linkings are required for
adverbial modification and object relativization re-
spectively. The ambiguity in the phrase structure
grammar results from the associativity of the combi-
nation of axiom linkings. The two derivations do not
propagate their ambiguity under the dynamic pror-
gramming scheme precisely because they produce
equivalent results. Nevertheless, a worthwhile opti-
mization is to restrict the structure of combinations
of linkings in the phrase-structure schemes to corre-
spond to an unambiguous left-most linking strategy;
this corresponds to the way in which other associa-
tive operators are parsed in programming language.
For instance, x+y+z will be assumed to be x+(y+z)
if + is defined to be right associative.
An unambiguous right-associative context-free
grammar for linkings M over literals A and their
complements A is:
M → A A | A M A | A A M | A M A M
An example of packing for subject/object scope am-
biguities is shown in Figure 14. The derivations
in Figure 14 produce different semantic interpreta-
tions; one of these is subject-wide scope and the
other object-wide scope. Unsurprisingly, the mem-
oizing parser does not solve P = NP in the affirmi-
tive (Pentus 2003). The size of the switch graphs on
the intermediate structures is not bounded, nor is the
number of alternative switch-paths between literals.
It remains an open question as to whether the switch
graph parser could be bounded for a fixed lexicon
(Pentus 1997).
3.4 Empty Antecedents and Subtending
Lambek’s calculus required the antecedent Γ in
a sequent Γ ⇒ α : A to be non-empty.
Proof nets derive theorems ( ⇒ CN/CN) and
((CN/CN)/(CN/CN) ⇒ CN/CN), as shown in Fig-
ure 15. These derivations both allow the construc-
tion of an output, namely the identity term λx.x and
modifier syntactic type CN/CN, out of no input.
A literal A is said to subtend a complementary
literal A if they are the leftmost and rightmost de-
scendants of a ℘-link. In both of the examples in
Figure 15, the output adjective CN/CN◦ unfolds to
the sequence of literals CN•CN◦ in which the input
CN• subtends the output CN◦. If literals that stand
in a subtending relation are never linked, the set of
theorems is restricted to those derivable in Lambek’s
original calculus.
Consider the proof net in Figure 16. An analysis
in which S ◦8 linked to S •11 and N•9 linked to N◦10 is
not ruled out by Danos-Regnier acyclicity. It is ruled
out by the subtending condition because S ◦8 subtends
S •11, being the leftmost and right most daughters of
the ℘-node (N10\S 11)\(N9\S 8)◦. Further note that
there are no cycles violating DR acyclicity; each of
the sixteen switchings is acyclic.
4 Conclusion
We have introduced switch graphs for shift-reduce
and CKY-style parsing of grammars in the asso-
ciative Lambek calculus. Switch graphs encode
27
N
N•1
(N\S )/N
N◦2 S •3 N◦4
2-3,2-4,3-4
1=2
S •3 N◦4
3-4
N
N•5
4=5S •
3
N
N•1
(N\S )/N
N◦2 S •3 N◦4
2-3,2-4,3-4
N
N•5
4=5
N◦2 S •3
2-3
1=2S •
3
N◦2 S •3
⊗
N2\S •3
d63d63 d127d127
N◦4
⊗
N•1 (N2\S 3)/N•4
d63d63 d127d127
N•5
Figure 13: Left vs. Right Attachment: Packing Locally Spurious Attachment Ambiguity
S ◦2 N•3 N◦4 S •5 N•7 S ◦8
℘ ⊗ ℘
S •1 N3\S ◦2
d47d47d47 d15d15
d15
N4\S •5
d47d47d47 d15d15
d15
N◦6 S 8/N◦7
d47d47d47 d15d15
d15
S •9
⊗ ⊗ ⊗
S 1/(N3\S 2)•
d47d47d47 d15d15
d15
(N4\S 5)/N•6
d47d47d47 d15d15
d15
(S 8/N7)\S •9
d47d47d47 d15d15
d15
S ◦2 N•3 N◦4 S •5 N•7 S ◦8
℘ ⊗ ℘
S •1 N3\S ◦2
d47d47d47 d15d15
d15
N4\S •5
d47d47d47 d15d15
d15
N◦6 S 8/N◦7
d47d47d47 d15d15
d15
S •9
⊗ ⊗ ⊗
S 1/(N3\S 2)•
d47d47d47 d15d15
d15
(N4\S 5)/N•6
d47d47d47 d15d15
d15
(S 8/N7)\S •9
d47d47d47 d15d15
d15
S •1S ◦2N•3
1-2:{L3},1-3:{R3}
N◦4 S •5N◦6
4-5,4-6,5-6
S •1N◦6
1-6
N•7 S ◦8S •9
7-9:{L7},8-9:{R7}
S •9
S •1S ◦2N•3
1-2:{L3},1-3:{R3}
N◦4 S •5N◦6
4-5,4-6,5-6
N•7 S ◦8S •9
7-9:{L7},8-9:{R7}
N◦4 S •9
4-9
S •1
Figure 14: Scope Ambiguity: Partial Proof Structure Fragments with Phrase Structure
x : CN• CN◦
℘
λx.x : CN/CN◦
d63d63d63d63 d127d127
d127d127 y(λx.x)(w) : CN• CN◦ x : CN• CN◦
⊗ ℘
w : CN• CN◦ y(λx.x) : CN/CN•
d63d63d63d63 d127d127
d127d127
λx.x : CN/CN◦
d63d63d63d63 d127d127
d127d127
℘ ⊗
λw.y(λx.x)(w) : CN/CN◦
d63d63d63d63 d127d127
d127d127
y : (CN/CN)/(CN/CN)•
d79d79d79d79d79
d79 d111d111d111d111d111d111
Figure 15: Subtending Examples
28
S ◦ N•5 N◦6 S •7 S ◦8 N•9 N◦10 S •11
℘ ⊗ ℘ ⊗
N5\S ◦4
d47d47d47
d47 d15d15d15d15
N6\S •7
d47d47d47
d47 d15d15d15d15
N9\S ◦8
d47d47d47
d47 d15d15d15d15
N10\S •11
d47d47d47
d47 d15d15d15d15
S ◦12 N•13 N◦14 S •15
⊗ ℘ ℘ ⊗
N◦2 S •3 (N5\S 4)\(N6\S 7)•
d63d63d63
d63d63 d127d127d127d127d127
(N10\S 11)\(N9\S 8)◦
d63d63d63
d63d63 d127d127d127d127d127
N13\S ◦12
d47d47d47
d47 d15d15d15d15
N14\S •15
d47d47d47
d47 d15d15d15d15
⊗ ⊗ ⊗
S ◦0
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d31
d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95d95
d31
d31
d31
d31
d31
d31
d31
N•1 N2\S •3
d47d47d47
d47 d15d15d15d15
((N5\S 4)\(N6\S 7))/((N10\S 11)\(N9\S 8))•
d79d79d79d79d79
d79d79 d111d111d111d111d111d111d111
(N13\S 12)\(N14\S 15)•
d63d63d63
d63d63 d127d127d127d127d127
Figure 16: Higher-Order Example: Adverbial Intensifier
the axiom-linking possibilities of a sequence of un-
linked literals deriving from underlying polar trees.
We introduced two parsers based on switch graphs.
The shift-reduce parsers are memory efficient and
parses correspond uniquely to (cut free) proof nets.
They can be made more efficient by bounding stack
size. The memoizing parsers are able to pack attach-
ment and scope distinctions that lead to different λ-
terms but have the same combinatory possibilities.

References
D. Bechet. 2003. Incremental parsing of lambek calculus
using proof-net interfaces. In Proc. of the 8th Interna-
tional Workshop on Parsing Technologies.
V. Danos and L. Regnier. 1989. The structure of multi-
plicatives. Arch. Math. Logic, 28:181–203.
P. de Groote and C. Retor´e. 1996. On the semantic read-
ings of proof nets. In Proc. of Formal Grammar, pages
57–70.
M. Faddo and G. Morrill. 2005. The Lambek calculus
with brackets. In P. Scott, C. Casadio, and R. Seely,
editors, Language and Grammar: Studies in Math.
Ling. and Nat. Lang. CSLI Press, Stanford.
J.-Y. Girard. 1987. Linear logic. Theoret. Comput. Sci.,
50:1–102.
F. Lamarche. 1994. Proof nets for intuitionistic linear
logic I: Essential nets. Technical report, Imperial Col-
lege, London.
J. Lambek. 1958. The mathematics of sentence structure.
Amer. Math. Mon., 65:154–170.
R. Montague. 1970. Universal grammar. Theoria,
36:373–398.
G. Morrill. 1996. Memoisation of categorial proof nets:
parallelism in categorial processing. Technical Re-
port LSI-96-24-R, Dept. de Llenguatges i Sistemes In-
form`atics, Universitat Polit`ecnica de Catalunya.
G. Morrill. 2000. Incremental processing and accept-
ability. Comput. Ling., 26(3):319–338.
M. Pentus. 1995. Models for the Lambek calculus. An-
nals of Pure and Applied Logic, 75(1–2):179–213.
M. Pentus. 1997. Product-free Lambek calculus and
context-free grammars. Journal of Symbolic Logic,
62(2):648–660.
M. Pentus. 2003. Lambek calculus is NP-complete.
Technical Report TR-203005, CUNY Graduate Cen-
ter.
D. Roorda. 1991. Resource logics: Proof-theoretical
investigations. Ph.D. thesis, Universiteit van Amster-
dam.
