In theoretical computer science, more precisely in the theory of formal languages, the star height is a measure for the structural complexity of regular expressions and regular languages. The star height of a regular expression equals the maximum nesting depth of stars appearing in that expression. The star height of a regular language is the least star height of any regular expression for that language.The concept of star height was first defined and studied by Eggan (1963).
More formally, the star height of a regular expressionE over a finite alphabet A is inductively defined as follows:
styleh\left(\emptyset\right)=0
styleh\left(\varepsilon\right)=0
styleh\left(a\right)=0
styleh\left(EF\right)=h\left(E\midF\right)=max\left(h(E),h(F)\right)
styleh\left(E*\right)=h(E)+1.
Here,
\scriptstyle\emptyset
The star height h(L) of a regular language L is defined as the minimum star height among all regular expressions representing L.The intuition is here that if the language L has large star height, then it is in some sense inherently complex, since it cannot be described by means of an "easy" regular expression, of low star height.
While computing the star height of a regular expression is easy, determining the star height of a language can be sometimes tricky.For illustration, the regular expression
style\left(b\midaa*b\right)*aa*
style(a\midb)*a
The star height of a group language is computable: for example, the star height of the language over in which the number of occurrences of a and b are congruent modulo 2n is n.[1]
In his seminal study of the star height of regular languages, established a relation between the theories of regular expressions, finite automata, and of directed graphs. In subsequent years, this relation became known as Eggan's theorem, cf. . We recall a few concepts from graph theory and automata theory. In graph theory, the cycle rank r(G) of a directed graph (digraph) is inductively defined as follows:
r(G)=1+minv\inr(G-v),
In automata theory, a nondeterministic finite automaton with ε-transitions (ε-NFA) is defined as a 5-tuple, (Q, Σ, δ, q0, F), consisting of
A word w ∈ Σ* is accepted by the ε-NFA if there exists a directed path from the initial state q0 to some final state in F using edges from δ, such that the concatenation of all labels visited along the path yields the word w. The set of all words over Σ* accepted by the automaton is the language accepted by the automaton A.
When speaking of digraph properties of a nondeterministic finite automaton A with state set Q, we naturally address the digraph with vertex set Q induced by its transition relation. Now the theorem is stated as follows.
Eggan's Theorem: The star height of a regular language L equals the minimum cycle rank among all nondeterministic finite automata with ε-transitions accepting L.
Proofs of this theorem are given by, and more recently by .
The above definition assumes that regular expressions are built from the elements of the alphabet Ausing only the standard operators set union, concatenation, and Kleene star. Generalized regular expressions are defined just as regular expressions, but here also the set complement operator is allowed (the complement is always taken with respect to the set of all words over A). If we alter the definition such that taking complements does not increase the star height, that is,
styleh\left(Ec\right)=h(E)
we can define the generalized star height of a regular language L as the minimum star height among all generalized regular expressions representing L. It is an open problem whether some languages can only be expressed with a generalized star height greater than one: this is the generalized star-height problem.
Note that, whereas it is immediate that a language of (ordinary) star height 0 can contain only finitely many words, there exist infinite languages having generalized star height 0. For instance, the regular expression
style(a\midb)*a,
style\emptysetca
Languages of generalized star height zero are also called star-free languages. It can be shown that a language L is star-free if and only if its syntactic monoid is aperiodic .