Head grammar (HG) is a grammar formalism introduced in Carl Pollard (1984)[1] as an extension of the context-free grammar class of grammars. Head grammar is therefore a type of phrase structure grammar, as opposed to a dependency grammar. The class of head grammars is a subset of the linear context-free rewriting systems.
One typical way of defining head grammars is to replace the terminal strings of CFGs with indexed terminal strings, where the index denotes the "head" word of the string. Thus, for example, a CF rule such as
A\toabc
A\to(abc,0)
A\to\widehat{a}bc
Two fundamental operations are then added to all rewrite rules: wrapping and concatenation.
Wrapping is an operation on two headed strings defined as follows:
Let
\alpha\widehat{x}\beta
\gamma\widehat{y}\delta
w(\alpha\widehat{x}\beta,\gamma\widehat{y}\delta)=\alphax\gamma\widehat{y}\delta\beta
Concatenation is a family of operations on n > 0 headed strings, defined for n = 1, 2, 3 as follows:
Let
\alpha\widehat{x}\beta
\gamma\widehat{y}\delta
\zeta\widehat{z}η
c1,0(\alpha\widehat{x}\beta)=\alpha\widehat{x}\beta
c2,0(\alpha\widehat{x}\beta,\gamma\widehat{y}\delta)=\alpha\widehat{x}\beta\gammay\delta
c2,1(\alpha\widehat{x}\beta,\gamma\widehat{y}\delta)=\alphax\beta\gamma\widehat{y}\delta
c3,0(\alpha\widehat{x}\beta,\gamma\widehat{y}\delta,\zeta\widehat{z}η)=\alpha\widehat{x}\beta\gammay\delta\zetazη
c3,1(\alpha\widehat{x}\beta,\gamma\widehat{y}\delta,\zeta\widehat{z}η)=\alphax\beta\gamma\widehat{y}\delta\zetazη
c3,2(\alpha\widehat{x}\beta,\gamma\widehat{y}\delta,\zeta\widehat{z}η)=\alphax\beta\gammay\delta\zeta\widehat{z}η
And so on for
cm,n:0\leqn<m
Head grammar rules are defined in terms of these two operations, with rules taking either of the forms
X\tow(\alpha,\beta)
X\tocm,n(\alpha,\beta,...)
where
\alpha
\beta
Head grammars are capable of generating the language
\{anbncndn:n\geq0\}
S\toc1,0(\widehat{\epsilon})
S\toc3,1(\widehat{a},T,\widehat{d})
T\tow(S,\widehat{b}c)
The derivation for "abcd" is thus:
S
c3,1(\widehat{a},T,\widehat{d})
c3,1(\widehat{a},w(S,\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(c1,0(\widehat{\epsilon}),\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(\widehat{\epsilon},\widehat{b}c),\widehat{d})
c3,1(\widehat{a},\widehat{b}c,\widehat{d})
a\widehat{b}cd
And for "":
S
c3,1(\widehat{a},T,\widehat{d})
c3,1(\widehat{a},w(S,\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(c3,1(\widehat{a},T,\widehat{d}),\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(c3,1(\widehat{a},w(S,\widehat{b}c),\widehat{d}),\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(c3,1(\widehat{a},w(c1,0(\widehat{\epsilon}),\widehat{b}c),\widehat{d}),\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(c3,1(\widehat{a},w(\widehat{\epsilon},\widehat{b}c),\widehat{d}),\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(c3,1(\widehat{a},\widehat{b}c,\widehat{d}),\widehat{b}c),\widehat{d})
c3,1(\widehat{a},w(a\widehat{b}cd,\widehat{b}c),\widehat{d})
c3,1(\widehat{a},ab\widehat{b}ccd,\widehat{d})
aab\widehat{b}ccdd
Vijay-Shanker and Weir (1994)[2] demonstrate that linear indexed grammars, combinatory categorial grammar, tree-adjoining grammars, and head grammars are weakly equivalent formalisms, in that they all define the same string languages.