Categorial grammar is a family of formalisms in natural language syntax that share the central assumption that syntactic constituents combine as functions and arguments. Categorial grammar posits a close relationship between the syntax and semantic composition, since it typically treats syntactic categories as corresponding to semantic types. Categorial grammars were developed in the 1930s by Kazimierz Ajdukiewicz and in the 1950s by Yehoshua Bar-Hillel and Joachim Lambek. It saw a surge of interest in the 1970s following the work of Richard Montague, whose Montague grammar assumed a similar view of syntax. It continues to be a major paradigm, particularly within formal semantics.
Basics
A categorial grammar consists of two parts: a lexicon, which assigns a set of types (also called categories) to each basic symbol, and some type inference rules, which determine how the type of a string of symbols follows from the types of the constituent symbols. It has the advantage that the type inference rules can be fixed once and for all, so that the specification of a particular language grammar is entirely determined by the lexicon.
A categorial grammar shares some features with the simply typed lambda calculus.
Whereas the lambda calculus has only one function type <math>A \rightarrow B</math>,
a categorial grammar typically has two function types, one type that is applied on the left,
and one on the right. For example, a simple categorial grammar might have two function types <math>B/A\,\!</math> and <math>A\backslash B</math>.
The first, <math>B/A\,\!</math>, is the type of a phrase that results in a phrase of type
<math>B\,\!</math> when followed (on the right) by a phrase of type <math>A\,\!</math>.
The second, <math>A\backslash B\,\!</math>, is the type of a phrase that results
in a phrase of type <math>B\,\!</math> when preceded (on the left) by a phrase of type
<math>A\,\!</math>.
The notation is based upon algebra. A fraction when multiplied by (i.e. concatenated with) its denominator yields its numerator. As concatenation is not commutative, it makes a difference whether the denominator occurs to the left or right. The concatenation must be on the same side as the denominator for it to cancel out.
The first and simplest kind of categorial grammar is called a basic categorial grammar, or sometimes an AB-grammar (after Ajdukiewicz and Bar-Hillel).
Given a set of primitive types <math>\text{Prim}\,\!</math>, let
<math>\text{Tp}(\text{Prim})\,\!</math> be the set of types constructed from primitive types. In the basic case, this is the least set such that <math>\text{Prim}\subseteq \text{Tp}(\text{Prim})</math>
and if <math>X, Y\in \text{Tp}(\text{Prim})</math>
then <math>(X/Y), (Y\backslash X) \in \text{Tp}(\text{Prim})</math>.
Think of these as purely formal expressions freely generated from the primitive types; any semantics will be added later. Some authors assume a fixed infinite set of primitive types used by all grammars, but by making the primitive types part of the grammar, the whole construction is kept finite.
A basic categorial grammar is a tuple <math>(\Sigma, \text{Prim}, S, \triangleleft)</math>
where <math>\Sigma\,\!</math> is a finite set of symbols,
<math>\text{Prim}\,\!</math> is a finite set of primitive types, and <math>S \in \text{Tp}(\text{Prim})</math>.
The relation <math>\triangleleft</math> is the lexicon, which relates types to symbols <math>(\triangleleft) \subseteq \text{Tp}(\text{Prim}) \times \Sigma</math>.
Since the lexicon is finite, it can be specified by listing a set of pairs like <math>TYPE\triangleleft\text{symbol}</math>.
Such a grammar for English might have three basic types <math>(N,NP, \text{ and } S)\,\!</math>, assigning count nouns the type <math>N\,\!</math>, complete noun phrases the type
<math>NP\,\!</math>, and sentences the type <math>S\,\!</math>.
Then an adjective could have the type <math>N/N\,\!</math>, because if it is followed by a noun then the whole phrase is a noun.
Similarly, a determiner has the type <math>NP/N\,\!</math>,
because it forms a complete noun phrase when followed by a noun.
Intransitive verbs have the type <math>NP\backslash S</math>, and transitive verbs the type <math>(NP\backslash S)/NP</math>.
Then a string of words is a sentence if it has overall type <math>S\,\!</math>.
For example, take the string "the bad boy made that mess". Now "the" and "that" are determiners, "boy" and "mess" are nouns, "bad" is an adjective, and "made" is a transitive verb, so the lexicon is
{<math>NP/N\triangleleft\text{the}</math>,
<math>NP/N\triangleleft\text{that}</math>,
<math>N\triangleleft\text{boy}</math>,
<math>N\triangleleft\text{mess}</math>,
<math>N/N\triangleleft\text{bad}</math>,
<math>(NP\backslash S)/NP\triangleleft\text{made}</math>}.
and the sequence of types in the string is
<math>
{\text{the}\atop {NP/N,
{\text{bad}\atop {N/N,
{\text{boy}\atop {N,
{\text{made}\atop {(NP\backslash S)/NP,
{\text{that}\atop {NP/N,
{\text{mess}\atop {N
</math>
now find functions and appropriate arguments and reduce them according to the two inference rules
<math> X\leftarrow X/Y,\; Y</math> and
<math> X\leftarrow Y,\; Y\backslash X</math>:
<math>.\qquad NP/N,\; N/N,\; N,\; (NP\backslash S)/NP,\; \underbrace{NP/N,\; N}</math><br>
<math>.\qquad NP/N,\; N/N,\; N,\; \underbrace{(NP\backslash S)/NP, \quad NP}</math><br>
<math>.\qquad NP/N,\; \underbrace{N/N,\; N}, \qquad (NP\backslash S)</math><br>
<math>.\qquad \underbrace{NP/N,\; \quad N},\; \qquad (NP\backslash S)</math><br>
<math>.\qquad \qquad\underbrace{NP,\; \qquad (NP\backslash S)}</math><br>
<math>.\qquad \qquad\qquad\quad\;\;\; S</math>
The fact that the result is <math>S\,\!</math> means that the string is a sentence, while the sequence of reductions shows that it can be parsed as ((the (bad boy)) (made (that mess))).
Categorial grammars of this form (having only function application rules) are equivalent in generative capacity to context-free grammars and are thus often considered inadequate for theories of natural language syntax. Unlike context-free grammars, categorial grammars are lexicalized, meaning that only a small number of (mostly language-independent) rules are employed, and all other syntactic phenomena derive from the lexical entries of specific words.
Another appealing aspect of categorial grammars is that it is often easy to assign them a compositional semantics, by first assigning interpretation types to all the basic categories, and then associating all the derived categories with appropriate function types. The interpretation of any constituent is then simply the value of a function at an argument. With some modifications to handle intensionality and quantification, this approach can be used to cover a wide variety of semantic phenomena.
Lambek calculus
A Lambek grammar is an elaboration of this idea that has a
concatenation operator for types, and several other inference rules.
Mati Pentus has shown that these still have the generative capacity of
context-free grammars.
For the Lambek calculus, there is a type concatenation
operator <math>\star</math>, so
that <math>\text{Prim}\subseteq \text{Tp}(\text{Prim})</math>
and if <math>X, Y\in \text{Tp}(\text{Prim})</math>
then <math>(X/Y), (X\backslash Y), (X\star Y)\in \text{Tp}(\text{Prim})</math>.
The Lambek calculus consists of several deduction rules, which specify
how type inclusion assertions can be derived. In the following
rules, upper case roman letters stand for types, and upper case Greek
letters stand for finite sequences of types. Juxtaposition of sequences indicates concatenation. A sequent of the form
<math> X \leftarrow \Gamma </math>
can be read: a string is of type if it consists of the concatenation
of strings of each of the types in . If a type is
interpreted as a set of strings, then the
← may be interpreted as ⊇,
that is, "includes as a subset".
A horizontal line means that the inclusion above the line
implies the one below the line.
The process is begun by the Axiom rule, which has no antecedents and
just says that any type includes itself.
:<math>
\text{(Axiom)}\quad
