Categorial grammar

Categorial grammar is a term used for a family of formalisms in natural languagesyntax motivated by the principle of compositionality and organized according to the view that syntactic constituents should generally combine as functions or according to a function-argument relationship. Most versions of categorial grammar analyze sentence structure in terms of constituencies (as opposed to dependencies) and are therefore phrase structure grammars (as opposed to dependency grammars).

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 A→B{\displaystyle A\rightarrow B}, a categorial grammar typically has two function types, one type which is applied on the left, and one on the right. For example, a simple categorial grammar might have two function types B/A{\displaystyle B/A\,\!} and A∖B{\displaystyle A\backslash B}. The first, B/A{\displaystyle B/A\,\!}, is the type of a phrase that results in a phrase of type B{\displaystyle B\,\!} when followed (on the right) by a phrase of type A{\displaystyle A\,\!}. The second, A∖B{\displaystyle A\backslash B\,\!}, is the type of a phrase that results in a phrase of type B{\displaystyle B\,\!} when preceded (on the left) by a phrase of type A{\displaystyle A\,\!}.

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 Prim{\displaystyle {\text{Prim}}\,\!}, let Tp(Prim){\displaystyle {\text{Tp}}({\text{Prim}})\,\!} be the set of types constructed from primitive types. In the basic case, this is the least set such that Prim⊆Tp(Prim){\displaystyle {\text{Prim}}\subseteq {\text{Tp}}({\text{Prim}})} and if X,Y∈Tp(Prim){\displaystyle X,Y\in {\text{Tp}}({\text{Prim}})} then (X/Y),(Y∖X)∈Tp(Prim){\displaystyle (X/Y),(Y\backslash X)\in {\text{Tp}}({\text{Prim}})}. 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 (Σ,Prim,S,◃){\displaystyle (\Sigma ,{\text{Prim}},S,\triangleleft )} where Σ{\displaystyle \Sigma \,\!} is a finite set of symbols, Prim{\displaystyle {\text{Prim}}\,\!} is a finite set of primitive types, and S∈Tp(Prim){\displaystyle S\in {\text{Tp}}({\text{Prim}})}.

The relation ◃{\displaystyle \triangleleft } is the lexicon, which relates types to symbols (◃)⊆Tp(Prim)×Σ{\displaystyle (\triangleleft )\subseteq {\text{Tp}}({\text{Prim}})\times \Sigma }. Since the lexicon is finite, it can be specified by listing a set of pairs like TYPE◃symbol{\displaystyle TYPE\triangleleft {\text{symbol}}}.

Such a grammar for English might have three basic types (N,NP, and S){\displaystyle (N,NP,{\text{ and }}S)\,\!}, assigning count nouns the type N{\displaystyle N\,\!}, complete noun phrases the type NP{\displaystyle NP\,\!}, and sentences the type S{\displaystyle S\,\!}. Then an adjective could have the type N/N{\displaystyle N/N\,\!}, because if it is followed by a noun then the whole phrase is a noun. Similarly, a determiner has the type NP/N{\displaystyle NP/N\,\!}, because it forms a complete noun phrase when followed by a noun. Intransitive verbs have the type NP∖S{\displaystyle NP\backslash S}, and transitive verbs the type (NP∖S)/NP{\displaystyle (NP\backslash S)/NP}. Then a string of words is a sentence if it has overall type S{\displaystyle S\,\!}.

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 {NP/N◃the{\displaystyle NP/N\triangleleft {\text{the}}}, NP/N◃that{\displaystyle NP/N\triangleleft {\text{that}}}, N◃boy{\displaystyle N\triangleleft {\text{boy}}}, N◃mess{\displaystyle N\triangleleft {\text{mess}}}, N/N◃bad{\displaystyle N/N\triangleleft {\text{bad}}}, (NP∖S)/NP◃made{\displaystyle (NP\backslash S)/NP\triangleleft {\text{made}}}}.

The fact that the result is S{\displaystyle S\,\!} means that the string is a sentence, while the sequence of reductions shows that it must 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 CFGs, 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.

A Lambek grammar is an elaboration of this idea that has a concatenation operator for types, and several other inference rules. Pentus has shown that these still have the generative capacity of context-free grammars.

For the Lambek calculus, there is a type concatenation operator ⋆{\displaystyle \star \,\!}, so that Prim⊆Tp(Prim){\displaystyle {\text{Prim}}\subseteq {\text{Tp}}({\text{Prim}})} and if X,Y∈Tp(Prim){\displaystyle X,Y\in {\text{Tp}}({\text{Prim}})} then (X/Y),(X∖Y),(X⋆Y)∈Tp(Prim){\displaystyle (X/Y),(X\backslash Y),(X\star Y)\in {\text{Tp}}({\text{Prim}})}.

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, upper case Greek letters stand for sequences of types. A sequent of the form X←Γ{\displaystyle X\leftarrow \Gamma } can be read: a string is of type X{\displaystyle X\,\!} if it consists of the concatenation of strings of each of the types in Γ{\displaystyle \Gamma \,\!}. If a type is interpreted as a set of strings, then the ←{\displaystyle \leftarrow } may be interpreted as ⊇{\displaystyle \supseteq \,\!}, 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.

The other rules come in pairs, one pair for each type construction operator, each pair consisting of one rule for the operator in the target, one in the source, of the arrow. The name of a rule consists of the operator and an arrow, with the operator on the side of the arrow on which it occurs in the conclusion.

1. V{\displaystyle V\,} is a finite set of non-terminals or variables.

2. Σ{\displaystyle \Sigma \,} is a finite set of terminal symbols.

3. ::={\displaystyle ::=\,} is a finite set of production rules, that is, a finite relation (::=)⊆V×(V∪Σ)∗{\displaystyle (::=)\subseteq V\times (V\cup \Sigma )^{*}}.

4. S{\displaystyle S\,} is the start variable.

From the point of view of categorial grammars, a context-free grammar can be seen as a calculus with a set of special purpose axioms for each language, but with no type construction operators and no inference rules except Cut.

Specifically, given a context-free grammar as above, define a categorial grammar (Prim,Σ,◃,S){\displaystyle ({\text{Prim}},\,\Sigma ,\,\triangleleft ,\,S)} where Prim=V∪Σ{\displaystyle {\text{Prim}}=V\cup \Sigma }, and Tp(Prim)=Prim{\displaystyle {\text{Tp}}({\text{Prim}})={\text{Prim}}\,\!}. Let there be an axiom x←x{\displaystyle {x\leftarrow x}} for every symbol x∈V∪Σ{\displaystyle x\in V\cup \Sigma }, an axiom X←Γ{\displaystyle {X\leftarrow \Gamma }} for every production rule X::=Γ{\displaystyle X::=\Gamma \,\!}, a lexicon entry s◃s{\displaystyle {s\triangleleft s}} for every terminal symbol s∈Σ{\displaystyle s\in \Sigma }, and Cut for the only rule. This categorial grammar generates the same language as the given CFG.

Of course, this is not a basic categorial grammar, since it has special axioms that depend upon the language; i.e. it is not lexicalized. Also, it makes no use at all of non-primitive types.

To show that any context-free language can be generated by a basic categorial grammar, recall that any context-free language can be generated by a context-free grammar in Greibach normal form.

The grammar is in Greibach normal form if every production rule is of the form A::=sA0…AN−1{\displaystyle A::=sA_{0}\ldots A_{N-1}}, where capital letters are variables, s∈Σ{\displaystyle s\in \Sigma }, and N≥0{\displaystyle N\geq 0}, that is, the right side of the production is a single terminal symbol followed by zero or more (non-terminal) variables.

Now given a CFG in Greibach normal form, define a basic categorial grammar with a primitive type for each non-terminal variable Prim=V{\displaystyle {\text{Prim}}=V\,\!}, and with an entry in the lexicon A/AN−1/…/A0◃s{\displaystyle A/A_{N-1}/\ldots /A_{0}\triangleleft s}, for each production rule A::=sA0…AN−1{\displaystyle A::=sA_{0}\ldots A_{N-1}}. It is fairly easy to see that this basic categorial grammar generates the same language as the original CFG. Note that the lexicon of this grammar will generally assign multiple types to each symbol.

The same construction works for Lambek grammars, since they are an extension of basic categorial grammars. It is necessary to verify that the extra inference rules do not change the generated language. This can be done and shows that every context-free language is generated by some Lambek grammar.

To show the converse, that every language generated by a Lambek grammar is context-free, is much more difficult. It was an open problem for nearly thirty years, from the early 1960s until about 1991 when it was proven by Pentus.

The basic idea is, given a Lambek grammar, (Prim,Σ,◃,S){\displaystyle ({\text{Prim}},\,\Sigma ,\,\triangleleft ,\,S)} construct a context-free grammar (V,Σ,::=,S){\displaystyle (V,\,\Sigma ,\,::=,\,S)} with the same set of terminal symbols, the same start symbol, with variables some (not all) types V⊂Tp(Prim){\displaystyle V\subset {\text{Tp}}({\text{Prim}})\,\!}, and with a production rule T::=s{\displaystyle T::={\text{s}}\,\!} for each entry T◃s{\displaystyle T\triangleleft {\text{s}}} in the lexicon, and production rules T::=Γ{\displaystyle T::=\Gamma \,\!} for certain sequents T←Γ{\displaystyle T\leftarrow \Gamma } that are derivable in the Lambek calculus.

Of course, there are infinitely many types and infinitely many derivable sequents, so in order to make a finite grammar it is necessary put a bound on the size of the types and sequents that are needed. The heart of Pentus's proof is to show that there is such a finite bound.

The notation in this field is not standardized. The notations used in formal language theory, logic, category theory, and linguistics, conflict with each other. In logic, arrows point to the more general from the more particular, that is, to the conclusion from the hypotheses. In this article, this convention is followed, i.e. the target of the arrow is the more general (inclusive) type.

In logic, arrows usually point left to right. In this article this convention is reversed for consistency with the notation of context-free grammars, where the single non-terminal symbol is always on the left. We use the symbol ::={\displaystyle ::=} in a production rule as in Backus-Naur form. Some authors use an arrow, which unfortunately may point in either direction, depending on whether the grammar is thought of as generating or recognizing the language.

Most systems of categorial grammar subdivide categories. The most common way to do this is by tagging them with features, such as person, gender, number, and tense. Sometimes only atomic categories are tagged in this way. In Montague grammar, it is traditional to subdivide function categories using a multiple slash convention, so A/B and A//B would be two distinct categories of left-applying functions, that took the same arguments but could be distinguished between by other functions taking them as arguments.

Rules of function composition are included in many categorial grammars. An example of such a rule would be one that allowed the concatenation of a constituent of type A/B with one of type B/C to produce a new constituent of type A/C. The semantics of such a rule would simply involve the composition of the functions involved. Function composition is important in categorial accounts of conjunction and extraction, especially as they relate to phenomena like right node raising. The introduction of function composition into a categorial grammar leads to many kinds of derivational ambiguity that are vacuous in the sense that they do not correspond to semantic ambiguities.

Many categorial grammars include a typical conjunction rule, of the general form X CONJ X → X, where X is a category. Conjunction can generally be applied to nonstandard constituents resulting from type raising or function composition..