# 克莱尼星号

**克莱尼星号**是形式语言上的一种运算：对于语言 L，其克莱尼星号 L* 是由 L 中取出的零个或多个串经串接所能形成的所有串的集合。零个的情形贡献空串，因此 L* 总是包含 ε（空串），该运算也称为克莱尼闭包。<sup>[1](https://portal.cs.umbc.edu/help/theory/lang_def.shtml)</sup> 它以斯蒂芬·科尔·克莱尼（Stephen Cole Kleene）命名，其 1956 年发表于《自动机研究》（*Automata Studies*）的论文《神经网与有限自动机中事件的表示》（"Representation of Events in Nerve Nets and Finite Automata"）奠定了正则表达式理论的基础。<sup>[2](https://hjemmesider.diku.dk/~henglein/bib/publications/kleene56.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | L* 是 L 中零个、一个或任意有限个串的串接；它总是包含空串 ε<sup>[1](https://portal.cs.umbc.edu/help/theory/lang_def.shtml)</sup><sup> • </sup><sup>[13](https://mathworld.wolfram.com/KleeneStar.html)</sup> |
| 最小刻画 | R* 是 R 所描述集合的最小超集，它包含 ε 且对串接封闭<sup>[3](https://www.vssut.ac.in/lecture_notes/lecture1423726104.pdf)</sup> |
| 递归形式 | ε ∈ L*，且若 x ∈ L*，则对每个 y ∈ L 有 xy ∈ L*<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup> |
| 示例 | {ab}* = {ε, ab, abab, ababab, abababab, ...}<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup> |
| 闭包性 | 正则语言对克莱尼星号封闭，上下文无关语言亦然<sup>[5](https://people.engr.tamu.edu/hlee42/csce314/grammar.pdf)</sup><sup> • </sup><sup>[6](https://ccoew-org.github.io/ToC/unit3/cfl-properties/)</sup> |
| 优先级 | 在正则表达式语法中，星号结合最紧，高于串接<sup>[7](https://users.utu.fi/jkari/wp-content/uploads/sites/1251/2024/08/fullnotes.pdf)</sup> |
| 代数律 | 星号是幂等的：α* ∼ (α*)*<sup>[8](https://web.fc.up.pt/dcc/Pubs/TReports/TR07/dcc-2007-07.pdf)</sup> |

## 定义

人们常常关注由给定语言中的串反复串接而成的串。例如，由成对字符组成的串如 aabbbbaacc 是由语言 {aa, bb, cc} 中元素的重复副本构成的。从给定语言进行重复串接的运算就是该语言的克莱尼星号。<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup> 非形式地说，L* 由所有形如 x₁x₂...xₙ 的串组成，其中每个 xᵢ 属于 L，n 允许为零。<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup>

标准教科书定义指出，R* 表示 R 所描述集合的最小超集，它包含 ε 且对串接封闭。<sup>[3](https://www.vssut.ac.in/lecture_notes/lecture1423726104.pdf)</sup> 等价地，马里兰大学巴尔的摩郡分校的形式语言参考将克莱尼闭包描述为其所作用串的零个、一个、两个或任意可数个的串接。<sup>[1](https://portal.cs.umbc.edu/help/theory/lang_def.shtml)</sup>

一种常见的等价表述是递归定义，即一组生成 L* 全部元素的规则：<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup>

1. ε ∈ L*。
2. 若 x ∈ L*，则对每个 y ∈ L 有 xy ∈ L*。

这种形式特别便于归纳证明。<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup> 一个实例：{ab}* = {ε, ab, abab, ababab, abababab, ...}，即由块 ab 构成的所有偶数长度串的集合。<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup>

## 在正则表达式中的作用

克莱尼星号是正则表达式的三种基本构造运算之一，另外两种是串接和并。正则语言的构件是符号、符号串接成串、串的集合并以及用上标星号表示的克莱尼闭包。<sup>[1](https://portal.cs.umbc.edu/help/theory/lang_def.shtml)</sup> 在字母表 {0, 1} 上，表达式 (00+11)* 表示 00 与 11 之并的克莱尼闭包，即由重复块 00 或 11 构成的所有串。<sup>[1](https://portal.cs.umbc.edu/help/theory/lang_def.shtml)</sup>

在解析正则表达式语法时，星号优先级最高，串接次之，并最低。<sup>[7](https://users.utu.fi/jkari/wp-content/uploads/sites/1251/2024/08/fullnotes.pdf)</sup> 这就是为什么诸如 ab* 的表达式读作 a 后跟一个带星号的 b，而非对 ab 整体加星号。

## 闭包性质

正则语言类对串接、克莱尼闭包和并封闭：对正则语言施加星号总是得到另一个正则语言。<sup>[5](https://people.engr.tamu.edu/hlee42/csce314/grammar.pdf)</sup> 这一闭包性是正则表达式与有限自动机等价的基础，因为可以从接受 L 的自动机构造出接受 L* 的自动机。<sup>[4](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)</sup>

上下文无关语言对同一运算封闭。给定 L 的上下文无关文法 G，起始符为 S，通过添加新起始符及规则 S_new → S_new S | ε 可获得 L* 的文法。<sup>[6](https://ccoew-org.github.io/ToC/unit3/cfl-properties/)</sup> 连同并和串接，这一闭包性是形式语言理论中证明的标准性质之一，并已在证明助手中作为上下文无关语言理论形式化的一部分被形式化。<sup>[9](https://arxiv.org/abs/1510.09092)</sup>

对星号的闭包是语言族不同程度保持的基本代数性质之一；对结构化上下文无关语言族（如可见下推语言和算符优先语言）的研究明确追踪布尔闭包、反转闭包、串接闭包和克莱尼星号闭包。<sup>[10](https://arxiv.org/abs/0907.2130)</sup>

## 代数结构

以串接、并和星号为运算的正则表达式，连同标准的一组公理和推理规则，构成一个克莱尼代数。<sup>[8](https://web.fc.up.pt/dcc/Pubs/TReports/TR07/dcc-2007-07.pdf)</sup> 克莱尼代数的定律之一便是星号的幂等性，α* ∼ (α*)*，这成立是因为对已迭代的表达式再迭代不会添加新串。<sup>[8](https://web.fc.up.pt/dcc/Pubs/TReports/TR07/dcc-2007-07.pdf)</sup>

两个相关概念扩展了基本运算。克莱尼加号以上标加号书写，表示一次或多次重复，即不含零次重复情形的星号；形式化处理将两者并列定义。<sup>[11](https://ak1089.github.io/maths-notes/automata-and-formal-langs/automata-and-formal-langs.pdf)</sup> 在代数发展中，星号既可由不动点理论刻画，也可由公理化刻画；用于程序精化推理的并发克莱尼代数保留了正则代数的签名和定律（包括星号），并添加了并发复合及若干简单定律。<sup>[12](https://www.sciencedirect.com/science/article/pii/S2352220815000942)</sup>

## 实际应用

在实际的模式匹配中，星号是表达重复的标准方式。

## References

1. [Formal Language Definitions, University of Maryland Baltimore County](https://portal.cs.umbc.edu/help/theory/lang_def.shtml)
2. [S. C. Kleene, Representation of Events in Nerve Nets and Finite Automata, Automata Studies (1956), bibliography entry](https://hjemmesider.diku.dk/~henglein/bib/publications/kleene56.html)
3. [Automata Theory lecture notes, VSSUT](https://www.vssut.ac.in/lecture_notes/lecture1423726104.pdf)
4. [SI340: Algorithms on Nondeterministic Finite Automata, United States Naval Academy](https://www.usna.edu/Users/cs/wcbrown/courses/F18SI340/lec/l12/lec.html)
5. [Grammar lecture notes, Texas A&M University](https://people.engr.tamu.edu/hlee42/csce314/grammar.pdf)
6. [Properties of CFLs, Theory of Computation course notes](https://ccoew-org.github.io/ToC/unit3/cfl-properties/)
7. [Automata and formal languages lecture notes, University of Turku](https://users.utu.fi/jkari/wp-content/uploads/sites/1251/2024/08/fullnotes.pdf)
8. [Testing the equivalence of regular expressions, DCC Technical Report 2007-07](https://web.fc.up.pt/dcc/Pubs/TReports/TR07/dcc-2007-07.pdf)
9. [Formalization of context-free language theory, arXiv:1510.09092](https://arxiv.org/abs/1510.09092)
10. [Crespi Reghizzi and Mandrioli, Algebraic properties of structured context-free languages, arXiv:0907.2130](https://arxiv.org/abs/0907.2130)
11. [Automata and Formal Languages notes, University of Cambridge](https://ak1089.github.io/maths-notes/automata-and-formal-langs/automata-and-formal-langs.pdf)
12. [Developments in concurrent Kleene algebra, ScienceDirect](https://www.sciencedirect.com/science/article/pii/S2352220815000942)
13. [Kleene Star -- from Wolfram MathWorld](https://mathworld.wolfram.com/KleeneStar.html)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Formal languages and automata theory › Formal language fundamentals

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/kleene-star

English original: https://www.edgepedia.org/kleene-star
