Kleene star
In formal language theory, the Kleene star refer to two related unary operations, that can be applied either to an alphabet of symbols or to a formal language, a set of strings.
The Kleene star operator on an alphabet generates the set of all finite-length strings over, that is, finite sequences whose elements belong to ; in mathematics, it is more commonly known as the free monoid construction. The Kleene star operator on a language generates another language, the set of all strings that can be obtained as a concatenation of zero or more members of. In both cases, repetitions are allowed.
The Kleene star operators are named after American mathematician Stephen Cole Kleene, who first introduced and widely used it to characterize automata for regular expressions.
Of an alphabet
Given an alphabet,define
and define recursively the set
where denotes the string obtained by appending the single character to the end of. Here, can be understood to be the set of all strings of length exactly, with characters from.
The definition of Kleene star on is
Of a language
Given a language, defineand define recursively the set
where denotes the string obtained by concatenating and. Here, can be understood to be the set of all strings that can be obtained by concatenating exactly strings from, allowing repetitions.
The definition of Kleene star on is
Kleene plus
In some formal language studies, a variation on the Kleene star operation called the Kleene plus is used. The Kleene plus omits the or term in the above unions. In other words, the Kleene plus on isor
Examples
Example of Kleene star applied to a set of strings:Example of Kleene star applied to a set of strings without the prefix property:
Example of Kleene and Kleene plus applied to a set of characters :
Properties
- If is any finite or countably infinite set of characters, then is a countably infinite set. As a result, each formal language over a finite or countably infinite alphabet is countable, since it is a subset of the countably infinite set.
- , which means that the Kleene star operator is an idempotent unary operator, as for every.
- , if is the empty set ∅. For the version of the Kleene star operator on languages, when is either the empty set ∅ or the singleton set.
Generalization
Strings form a monoid with concatenation as the binary operation and ε the identity element. In addition to strings, the Kleene star is defined for any monoid.More precisely, let be a monoid, and S ⊆ M. Then S* is the smallest submonoid of M containing S; that is, S* contains the neutral element of M, the set S, and is such that if x,''y ∈ S''*, then x⋅''y ∈ S''*.
Furthermore, the Kleene star is generalized by including the *-operation in the algebraic structure itself by the notion of complete star semiring.