Kleene star

From Wikipedia, the free encyclopedia
(Redirected from Kleene plus)
Jump to navigation Jump to search

Template:Short description Template:Use dmy dates In formal language theory, the Kleene star (or Kleene operator or Kleene closure) 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 (finite sequences of symbols).

The Kleene star operator on an alphabet Template:Mvar generates the set Template:Mvar of all finite-length strings over Template:Mvar,[note 1] that is, finite sequences whose elements belong to Template:Mvar; in mathematics, it is more commonly known as the free monoid construction. The Kleene star operator on a language Template:Mvar generates another language Template:Mvar, the set of all strings that can be obtained as a concatenation of zero or more members of Template:Mvar. 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 V, define

V0={ε} (the set consists only of the empty string),
V1=V,

and define recursively the set

Vi+1={wv:wVi and vV} for each i>0,

where wv denotes the string obtained by appending the single character v to the end of w. Here, Vi can be understood to be the set of all strings of length exactly i, with characters from V.

The definition of Kleene star on V is[1]

V*=i0Vi=V0V1V2V3V4.

Of a language

Given a language L (any finite or infinite set of strings), define

L0={ε} (the language consisting only of the empty string),
L1=L,

and define recursively the set

Li+1={wv:wLi and vL} for each i>0,

where wv denotes the string obtained by concatenating w and v. Here, Li can be understood to be the set of all strings that can be obtained by concatenating exactly i strings from L, allowing repetitions.

The definition of Kleene star on L is[2]

L*=i0Li=L0L1L2L3L4.

Kleene plus

In some formal language studies, (e.g. AFL theory) a variation on the Kleene star operation called the Kleene plus is used. The Kleene plus omits the V0 or L0 term in the above unions. In other words, the Kleene plus on V is

V+=i1Vi=V1V2V3,

or

V+=V*V.[note 2]

Examples

Example of Kleene star applied to a set of strings:

{"ab","c"}* = { ε, "ab", "c", "abab", "abc", "cab", "cc", "ababab", "ababc", "abcab", "abcc", "cabab", "cabc", "ccab", "ccc", ...}.

Example of Kleene star applied to a set of strings without the prefix property:

{"a","ab","b"}* = { ε, "a", "ab", "b", "aa", "aab", "aba", "abab", "abb", "ba", "bab", "bb", ...};
In this example, the string "aab" can be obtained in two different ways. The Sardinas-Patterson algorithm can be used to check for a given V whether any member of V* can be obtained in more than one way.

Example of Kleene and Kleene plus applied to a set of characters (following the C programming language convention where a character is denoted by single quotes and a string is denoted by double quotes):

{'a', 'b', 'c'}* = { ε, "a", "b", "c", "aa", "ab", "ac", "ba", "bb", "bc", "ca", "cb", "cc", "aaa", "aab", ...}.
{'a', 'b', 'c'}+ = { "a", "b", "c", "aa", "ab", "ac", "ba", "bb", "bc", "ca", "cb", "cc", "aaa", "aab", ...}.

Properties

  • If V is any finite or countably infinite set of characters, then V* is a countably infinite set.[1] 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 Σ*.
  • (L*)*=L*, which means that the Kleene star operator is an idempotent unary operator, as (L*)i=L* for every i1.
  • V*={ε}, if V is the empty set ∅. For the version of the Kleene star operator on languages, L*={ε} when L 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 (M, ⋅) be a monoid, and SM. 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,yS*, then xyS*.

Furthermore, the Kleene star is generalized by including the *-operation (and the union) in the algebraic structure itself by the notion of complete star semiring.[3]

See also

Notes

<templatestyles src="Reflist/styles.css" />

  1. It is called "strings" for historical reasons, since Kleene invented it in the context of automata theory, but the idea has been generalized such that each symbol in a string is not necessarily a single character Template:Crossreference.
  2. This equation holds because every member of V+ can be generated by first picking a member from V*, and then picking a member from V for appending. This two-step process does not generate ε since the second step never pick an ε.

Script error: No such module "Check for unknown parameters".

References

<templatestyles src="Reflist/styles.css" />

  1. a b Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

Further reading

  • Script error: No such module "citation/CS1".