Fix a finite set (serving as the alphabet) and denote its free monoid by . A language is regular whenever there is a formal grammar that generates it (i.e. ) such that all rules in are of the form for a terminal and non-terminal symbols .
Properties
Regular languages can be characterised by regular expressions. Regular expressions are inductively generated by the following rules:
For each terminal , is a regular expression;
There are basic expressions , ;
For each pair of regular expressions , there are expressions and ;
For each regular expression , the Kleene star is a regular expression.
These can be given a semantics in the poset of languages by universal constructions in -enriched category theory, where is regarded as cartesian closed, and as a discrete poset is regarded as a -enriched category.
and . These are nullary and binary joins.
. If we view languages as -enriched presheaves , then these are among the representable presheaves.
consists of only the empty string, . The right side is an application of a -enriched version of the Day convolution monoidal structure, with monoidal product
induced from the concatenation product that makes a discrete monoidal poset.