Definition. Formal Grammar
For an alphabet , let be the free monoid of strings over . A formal grammar is a family of types indexed by strings:
This definition views formal grammars directly as indexed families of types over strings (which equivalently form presheaves on the discrete category of strings). This view forms the central notion of the Dependent Lambek Calculus. For a given string , the type represents the type of all valid parse trees for according to the grammar . If the grammar cannot parse , then is the empty type.