<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2804%3A248%3AF40B%3A4900%3AE5ED%3A5680%3AC4B0%3AE085</id>
	<title>Vero - Wikipedia - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2804%3A248%3AF40B%3A4900%3AE5ED%3A5680%3AC4B0%3AE085"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php/Special:Contributions/2804:248:F40B:4900:E5ED:5680:C4B0:E085"/>
	<updated>2026-08-14T20:32:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Kleene_star&amp;diff=10701</id>
		<title>Kleene star</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Kleene_star&amp;diff=10701"/>
		<updated>2025-09-16T21:02:45Z</updated>

		<summary type="html">&lt;p&gt;2804:248:F40B:4900:E5ED:5680:C4B0:E085: Fix spelling of &amp;quot;Kleene star of a language&amp;quot; explanation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Short description|Unary operation on string sets}}&lt;br /&gt;
{{Use dmy dates|date=September 2022}}&lt;br /&gt;
In [[formal language theory]], the &#039;&#039;&#039;Kleene star&#039;&#039;&#039; (or &#039;&#039;&#039;Kleene operator&#039;&#039;&#039; or &#039;&#039;&#039;Kleene closure&#039;&#039;&#039;) refer to two related [[unary operation]]s, that can be applied either to an [[Alphabet (formal languages)|alphabet]] of [[Symbol (formal)|symbols]] or to a [[formal language]], a set of strings (finite sequences of symbols).&lt;br /&gt;
&lt;br /&gt;
The Kleene star operator on an alphabet {{mvar|V}} generates the set {{mvar|V*}} of all finite-length strings over {{mvar|V}},&amp;lt;ref group=&amp;quot;note&amp;quot; name=&amp;quot;strings&amp;quot;/&amp;gt; that is, finite sequences whose elements belong to {{mvar|V}}; in mathematics, it is more commonly known as the [[free monoid]] construction. The Kleene star operator on a language {{mvar|L}} generates another language {{mvar|L*}}, the set of all strings that can be obtained as a [[concatenation]] of zero or more members of {{mvar|L}}. In both cases, repetitions are allowed.&lt;br /&gt;
&lt;br /&gt;
The Kleene star operators are named after American mathematician [[Stephen Cole Kleene]], who first introduced and widely used it to characterize [[Automata theory|automata]] for [[regular expression]]s.&lt;br /&gt;
&lt;br /&gt;
== Of an alphabet ==&lt;br /&gt;
Given an alphabet &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt;,&lt;br /&gt;
define&lt;br /&gt;
:&amp;lt;math&amp;gt;V^{0}=\{\varepsilon\}&amp;lt;/math&amp;gt; (the set consists only of the empty string),&lt;br /&gt;
:&amp;lt;math&amp;gt;V^{1}=V,&amp;lt;/math&amp;gt;&lt;br /&gt;
and define recursively the set&lt;br /&gt;
:&amp;lt;math&amp;gt;V^{i+1}=\{wv: w\in V^{i} \text{ and } v\in V \}&amp;lt;/math&amp;gt; for each &amp;lt;math&amp;gt;i&amp;gt;0,&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;wv&amp;lt;/math&amp;gt; denotes the string obtained by appending the single character &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt; to the end of &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt;. Here, &#039;&#039;&amp;lt;math&amp;gt;V^i&amp;lt;/math&amp;gt;&#039;&#039; can be understood to be the set of all strings of length exactly &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;, with characters from &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The definition of Kleene star on &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is&amp;lt;ref name=nayuki/&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; V^*=\bigcup_{i \ge 0 }V^i = V^0 \cup V^1 \cup V^2 \cup V^3 \cup V^4 \cup \cdots.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Of a language==&lt;br /&gt;
Given a language &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; (any finite or infinite set of strings), define&lt;br /&gt;
:&amp;lt;math&amp;gt;L^{0}=\{\varepsilon\}&amp;lt;/math&amp;gt; (the language consisting only of the empty string),&lt;br /&gt;
:&amp;lt;math&amp;gt;L^{1}=L,&amp;lt;/math&amp;gt;&lt;br /&gt;
and define recursively the set&lt;br /&gt;
:&amp;lt;math&amp;gt;L^{i+1}=\{wv: w\in L^{i} \text{ and } v\in L \}&amp;lt;/math&amp;gt; for each &amp;lt;math&amp;gt;i&amp;gt;0,&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;wv&amp;lt;/math&amp;gt; denotes the string obtained by concatenating &amp;lt;math&amp;gt;w&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;v&amp;lt;/math&amp;gt;. Here, &#039;&#039;&amp;lt;math&amp;gt;L^i&amp;lt;/math&amp;gt;&#039;&#039; can be understood to be the set of all strings that can be obtained by concatenating exactly &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; strings from &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt;, allowing repetitions.&lt;br /&gt;
&lt;br /&gt;
The definition of Kleene star on &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is&amp;lt;ref&amp;gt;{{cite book |last1=Fletcher |first1=Peter |last2=Hoyle |first2=Hughes |last3=Patty |first3=C. Wayne |date=1991 |title=Foundations of Discrete Mathematics  |publisher=Brooks/Cole |isbn=0534923739 |page=656 |quote=The &#039;&#039;&#039;Kleene closure&#039;&#039;&#039; &#039;&#039;L&#039;&#039;&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; of &#039;&#039;L&#039;&#039; is defined to be &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\bigcup_{i=0}^\infty L^i&amp;lt;/math&amp;gt;.}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
:&amp;lt;math&amp;gt; L^*=\bigcup_{i \ge 0 }L^i = L^0 \cup L^1 \cup L^2 \cup L^3 \cup L^4 \cup \cdots.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Kleene plus ==&lt;br /&gt;
In some [[formal language]] studies, (e.g. [[Abstract family of languages|AFL theory]]) a variation on the Kleene star operation called the &#039;&#039;Kleene plus&#039;&#039; is used. The Kleene plus omits the &amp;lt;math&amp;gt;V^{0}&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;L^0&amp;lt;/math&amp;gt; term in the above unions. In other words, the Kleene plus on &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;V^+=\bigcup_{i \geq 1} V^i = V^1 \cup V^2 \cup V^3 \cup \cdots,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;V^+ = V^*V.&amp;lt;/math&amp;gt;&amp;lt;ref group=&amp;quot;note&amp;quot; name=&amp;quot;kleene-plus&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Example of Kleene star applied to a set of strings:&lt;br /&gt;
: {&amp;quot;ab&amp;quot;,&amp;quot;c&amp;quot;}&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; = { ε, &amp;quot;ab&amp;quot;, &amp;quot;c&amp;quot;, &amp;quot;abab&amp;quot;, &amp;quot;abc&amp;quot;, &amp;quot;cab&amp;quot;, &amp;quot;cc&amp;quot;, &amp;quot;ababab&amp;quot;, &amp;quot;ababc&amp;quot;, &amp;quot;abcab&amp;quot;, &amp;quot;abcc&amp;quot;, &amp;quot;cabab&amp;quot;, &amp;quot;cabc&amp;quot;, &amp;quot;ccab&amp;quot;, &amp;quot;ccc&amp;quot;, ...}.&lt;br /&gt;
Example of Kleene star applied to a set of strings without the [[prefix property]]:&lt;br /&gt;
: {&amp;quot;a&amp;quot;,&amp;quot;ab&amp;quot;,&amp;quot;b&amp;quot;}&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; = { ε, &amp;quot;a&amp;quot;, &amp;quot;ab&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;aa&amp;quot;, &amp;quot;aab&amp;quot;, &amp;quot;aba&amp;quot;, &amp;quot;abab&amp;quot;, &amp;quot;abb&amp;quot;, &amp;quot;ba&amp;quot;, &amp;quot;bab&amp;quot;, &amp;quot;bb&amp;quot;, ...};&amp;lt;BR&amp;gt;In this example, the string &amp;quot;aab&amp;quot; can be obtained in two different ways. The [[Sardinas-Patterson algorithm]] can be used to check for a given &#039;&#039;V&#039;&#039; whether any member of &#039;&#039;V&#039;&#039;&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; can be obtained in more than one way.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
: {&#039;a&#039;, &#039;b&#039;, &#039;c&#039;}&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; = { ε, &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot;, &amp;quot;aa&amp;quot;, &amp;quot;ab&amp;quot;, &amp;quot;ac&amp;quot;, &amp;quot;ba&amp;quot;, &amp;quot;bb&amp;quot;, &amp;quot;bc&amp;quot;, &amp;quot;ca&amp;quot;, &amp;quot;cb&amp;quot;, &amp;quot;cc&amp;quot;, &amp;quot;aaa&amp;quot;, &amp;quot;aab&amp;quot;, ...}.&lt;br /&gt;
: {&#039;a&#039;, &#039;b&#039;, &#039;c&#039;}&amp;lt;sup&amp;gt;+&amp;lt;/sup&amp;gt; = { &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot;, &amp;quot;aa&amp;quot;, &amp;quot;ab&amp;quot;, &amp;quot;ac&amp;quot;, &amp;quot;ba&amp;quot;, &amp;quot;bb&amp;quot;, &amp;quot;bc&amp;quot;, &amp;quot;ca&amp;quot;, &amp;quot;cb&amp;quot;, &amp;quot;cc&amp;quot;, &amp;quot;aaa&amp;quot;, &amp;quot;aab&amp;quot;, ...}.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
* If &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is any [[finite set|finite]] or [[countably infinite set]] of characters, then &#039;&#039;&amp;lt;math&amp;gt;V^*&amp;lt;/math&amp;gt;&#039;&#039; is a countably infinite set.&amp;lt;ref name=nayuki&amp;gt;{{cite web |author=Nayuki Minase |date=10 May 2011 |title=Countable sets and Kleene star |work=Project Nayuki |url=http://www.nayuki.io/page/countable-sets-and-kleene-star |access-date=11 January 2012}}&amp;lt;/ref&amp;gt; As a result, each [[formal language]] over a finite or countably infinite alphabet &amp;lt;math&amp;gt;\Sigma&amp;lt;/math&amp;gt; is countable, since it is a subset of the countably infinite set &amp;lt;math&amp;gt;\Sigma^{*}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;(L^{*})^{*}=L^{*}&amp;lt;/math&amp;gt;, which means that the Kleene star operator is an [[idempotent]] [[unary operator]], as &amp;lt;math&amp;gt;(L^{*})^{i}=L^{*}&amp;lt;/math&amp;gt; for every &amp;lt;math&amp;gt;i\geq 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math&amp;gt;V^{*}=\{\varepsilon\}&amp;lt;/math&amp;gt;, if &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the [[empty set]] ∅. For the version of the Kleene star operator on languages, &amp;lt;math&amp;gt;L^{*}=\{\varepsilon\}&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is either the [[empty set]] ∅ or the singleton set &amp;lt;math&amp;gt;\{\varepsilon\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Generalization ==&lt;br /&gt;
&lt;br /&gt;
[[String (computer science)|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.&lt;br /&gt;
More precisely, let (&#039;&#039;M&#039;&#039;, ⋅) be a monoid, and &#039;&#039;S&#039;&#039; ⊆ &#039;&#039;M&#039;&#039;.  Then &#039;&#039;S&#039;&#039;&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; is the smallest submonoid of &#039;&#039;M&#039;&#039; containing &#039;&#039;S&#039;&#039;; that is, &#039;&#039;S&#039;&#039;&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; contains the neutral element of &#039;&#039;M&#039;&#039;, the set &#039;&#039;S&#039;&#039;, and is such that if &#039;&#039;x&#039;&#039;,&#039;&#039;y&#039;&#039; ∈ &#039;&#039;S&#039;&#039;&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;, then &#039;&#039;x&#039;&#039;⋅&#039;&#039;y&#039;&#039; ∈ &#039;&#039;S&#039;&#039;&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
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]].&amp;lt;ref name=&amp;quot;droste&amp;quot;&amp;gt;{{cite book |last1=Droste |first1=M. |last2=Kuich |first2=W. |date=2009 |title=Handbook of Weighted Automata |url=https://archive.org/details/handbookweighted00dros |url-access=limited |chapter=Chapter 1: Semirings and Formal Power Series |series=Monographs in Theoretical Computer Science |publisher=Springer |doi=10.1007/978-3-642-01492-5_1 |isbn=978-3-642-01491-8 |page=[https://archive.org/details/handbookweighted00dros/page/n23 9]}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Wildcard character]]&lt;br /&gt;
* [[Glob (programming)]]&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
{{reflist|group=note|refs=&lt;br /&gt;
&amp;lt;ref name=&amp;quot;strings&amp;quot;&amp;gt;It is called &amp;quot;strings&amp;quot; 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 (computing)|character]] {{Crossreference|selfref=no|(see {{Section link|#Generalization}})}}.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;kleene-plus&amp;quot;&amp;gt;This equation holds because every member of &#039;&#039;V&#039;&#039;&amp;lt;sup&amp;gt;+&amp;lt;/sup&amp;gt; can be generated by first picking a member from &#039;&#039;V*&#039;&#039;, and then picking a member from &#039;&#039;V&#039;&#039; for appending. This two-step process does not generate ε since the second step never pick an ε.&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
*{{cite book |last1=Hopcroft |first1=John E. |author-link1=John Hopcroft |last2=Ullman |first2=Jeffrey D. |author-link2=Jeffrey Ullman |date=1979 |title=Introduction to Automata Theory, Languages, and Computation |title-link=Introduction to Automata Theory, Languages, and Computation |edition=1st |publisher=[[Addison-Wesley]]}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Formal languages]]&lt;br /&gt;
[[Category:Grammar]]&lt;br /&gt;
[[Category:Natural language processing]]&lt;/div&gt;</summary>
		<author><name>2804:248:F40B:4900:E5ED:5680:C4B0:E085</name></author>
	</entry>
</feed>