# 汉明界

汉明界，又称球填充界，是对给定长度和最小距离的纠错码最多能包含多少个码字的上限。它由理查德·W·汉明（Richard W. Hamming）在1950年发表于《贝尔系统技术期刊》的论文《检错与纠错码》中提出<sup>[1](https://onlinelibrary.wiley.com/doi/abs/10.1002/j.1538-7305.1950.tb00463.x)</sup>，至今仍是编码理论中最基本的必要条件之一。

| 关键事实 | 详情 |
|---|---|
| 陈述 | 长度为 n、最小汉明距离为 d 的 q 元码满足 \( |C| \le q^{n} / \sum_{i=0}^{\lfloor (d-1)/2 \rfloor} \binom{n}{i}(q-1)^{i} \)<sup>[2](https://pages.mtu.edu/~tonchev/Coding-Theory-Tohoku-June-09)</sup> |
| 证明思路 | 以码字为中心、半径为 \( t = \lfloor (d-1)/2 \rfloor \) 的汉明球两两不相交，因此它们的总体积不能超过所在空间的 \( q^{n} \) 个词<sup>[2](https://pages.mtu.edu/~tonchev/Coding-Theory-Tohoku-June-09)</sup> |
| 出处 | 理查德·W·汉明，《检错与纠错码》，《贝尔系统技术期刊》29(2): 147–160，1950年4月<sup>[1](https://onlinelibrary.wiley.com/doi/abs/10.1002/j.1538-7305.1950.tb00463.x)</sup> |
| 等号成立的情形 | 恰好取等号的码称为完全码；其汉明球无重叠、无空隙地铺满整个空间<sup>[3](https://ucb-lean-course-sp26.github.io/lectures/lec-06.html)</sup> |
| 已知的完全码 | 整个空间（d = 1）、奇数长度的二元重复码、q 元汉明码，以及二元 [23, 12, 7] 与三元 [12, 6, 5] 戈莱码<sup>[4](https://www.sciencedirect.com/topics/mathematics/hamming-bound)</sup> |
| 在各界限中的地位 | 与辛格尔顿界一起给出码存在时 n、M、d、q 必须满足的必要条件；吉尔伯特–瓦尔沙莫夫界则是相应的存在性结果<sup>[5](https://www.cambridge.org/core/books/introduction-to-coding-theory/bounds-on-the-parameters-of-codes/39E9DAA5040D4D4DFCC6F84685C59AB4)</sup> |
| 量子类比 | 量子汉明界是精确量子纠错的球填充计数；2026年的工作证明，简并码在任何局部维度下都不能违反它<sup>[6](https://arxiv.org/abs/2606.22538)</sup> |

## 陈述与证明

码 C 是 q 个符号的字母表上长度为 n 的词的集合，其最小汉明距离 d 是任意两个不同码字相异位置数的最小值。最小距离为 d 的码能纠正不超过 \( t = \lfloor (d-1)/2 \rfloor \) 个错误，因为任何接收词都不可能同时落在两个不同码字的距离 t 之内。<sup>[2](https://pages.mtu.edu/~tonchev/Coding-Theory-Tohoku-June-09)</sup>

该界由计数得出。以每个码字为中心放置半径为 t 的汉明球，即与它距离不超过 t 的所有词构成的集合。这些球两两不相交：若某个词同时属于其中两个球，则这两个码字之间的距离不超过 2t，与 d ≥ 2t + 1 矛盾。q 元半径为 r 的球的体积为 \( V_{q}(n, r) = \sum_{i=0}^{r} \binom{n}{i}(q-1)^{i} \)，因为与中心距离为 i 的词，可由选出 i 个相异位置、并在每个位置取 q − 1 个替代符号之一得到。<sup>[7](https://www.math.uci.edu/~nckaplan/teaching_files/kaplancodingnotes.pdf)</sup> 所有球都落在所在空间的 \( q^{n} \) 个词之内，故 \( |C| \cdot V_{q}(n, t) \le q^{n} \)，此即该界。<sup>[3](https://ucb-lean-course-sp26.github.io/lectures/lec-06.html)</sup>

用 \( A_{q}(n, d) \)（长度为 n、最小距离为 d 的码的最大规模）来表示，该界写作 \( A_{q}(n, d) \le q^{n} / V_{q}(n, \lfloor (d-1)/2 \rfloor) \)。J. H. 范林特（J. H. van Lint）是一本广泛使用的编码理论教材的作者，他把确定 \( A(n, d) \) 的界称为“组合编码理论中最重要的一个问题”。<sup>[7](https://www.math.uci.edu/~nckaplan/teaching_files/kaplancodingnotes.pdf)</sup>

## 完全码

恰好满足汉明界等号的码称为完全码。其以码字为中心、半径为 t 的球构成空间的一个精确剖分：每个词恰好属于一个球，既无重叠也无空隙。<sup>[3](https://ucb-lean-course-sp26.github.io/lectures/lec-06.html)</sup> 等价地说，球的体积必须整除 \( q^{n} \)。<sup>[8](https://gmcninch.math.tufts.edu/2024-Sp-Math190/course-contents/2024-02-26--block%2Blinear.html)</sup>

已知的非平凡族并不多。它们是纠正一个错误的 q 元汉明码 \( [n = (q^{m}-1)/(q-1),\ n-m,\ 3] \)，二元 [23, 12, 7] 与三元 [12, 6, 5] 戈莱码，以及奇数长度的二元重复码（其两个码字分别是全零向量和全一向量）。<sup>[4](https://www.sciencedirect.com/topics/mathematics/hamming-bound)</sup> 平凡地，整个空间 \( \mathbb{F}_{q}^{n} \) 是 d = 1 的完全码。<sup>[2](https://pages.mtu.edu/~tonchev/Coding-Theory-Tohoku-June-09)</sup> 完全 e 纠错 q 元码的最早例子由汉明和戈莱于20世纪40年代给出；1973年，蒂泰韦宁（Tietäväinen），以及独立地季诺维也夫（Zinoviev）和列昂季耶夫（Leontiev），证明了当 q 为素数幂时不存在未知的多重纠错完全 q 元码。单纠错的情形则不同：所有完全 1 纠错码的分类仍是一个未解决的问题。<sup>[9](https://doi.org/10.3934%2Famc.2008.2.223)</sup>

纠正单个错误的二元汉明 [7, 4, 3] 码被用于内存纠错，而二元戈莱 [23, 12, 7] 码——唯一非平凡的多重纠错完全二元码——曾随旅行者号探测器飞上太空。<sup>[10](https://bnaskrecki.faculty.wmi.amu.edu.pl/crypto/book/part15_code_based_frontiers/ch43_code_based_crypto.html)</sup>

## 起源

汉明是被大规模计算机器引向这个问题的：在这些机器上，必须执行大量运算而最终结果中不能出现一个错误。在为阿伯丁试验场建造的贝尔电话实验室5型继电器计算机中，观察表明两台计算机的8,900个继电器每天约有两次或三次继电器故障，大约每两到三百万次继电器操作出现一次故障。自检能捕获这些故障，但计算仍然会中断，于是汉明研究了检错之后的下一步，即纠错。<sup>[11](https://zoo.cs.yale.edu/classes/cs323/doc/Hamming.pdf)</sup> 1950年的论文给出了单检错、单纠错以及单纠错加双检错的显式构造，并在其一般理论中证明，在其假设下这些码是最优的。<sup>[11](https://zoo.cs.yale.edu/classes/cs323/doc/Hamming.pdf)</sup>

## 与其他界的关系

汉明界是关于 \( A_{q}(n, d) \) 的若干经典不等式之一，与辛格尔顿界、普洛特金界、约翰逊界、格里斯默界和埃利亚斯–巴萨利戈界并列。<sup>[12](https://link.springer.com/article/10.1007/s12220-026-02520-y)</sup> 辛格尔顿界和球填充界是必要条件：参数违反其中任何一个的码都不可能存在。吉尔伯特–瓦尔沙莫夫界是互补的存在性结果，只要其不等式成立，就保证 GF(q) 上存在线性 [n, k, d] 码。<sup>[5](https://www.cambridge.org/core/books/introduction-to-coding-theory/bounds-on-the-parameters-of-codes/39E9DAA5040D4D4DFCC6F84685C59AB4)</sup> 存在更强的上界：球填充界和约翰逊界是由关联方案经线性规划得到的界之特例，<sup>[13](https://www.aimsciences.org/article/doi/10.3934/amc.2007.1.173)</sup> 而埃利亚斯界只在较长的长度上优于汉明界、普洛特金界和约翰逊界；它首次同时胜过这三者的长度是 n = 39，且仅当 d = 15。<sup>[14](https://www.researchgate.net/publication/228548036_A_computational_primer_on_BLOCK_ERROR-CORRECTING_CODES)</sup>

该界也可以是紧的。阿尔斯韦德（Ahlswede）、巴萨利戈（Bassalygo）和平斯克（Pinsker）于1999年证明，对于非二元定域错误纠错码，汉明界在码率的某个范围内是渐近紧的。<sup>[15](https://www.mathnet.ru/php/archive.phtml?jrnid=ppi&option_lang=eng&paperid=440&wshow=paper)</sup>

## 量子类比

对于精确量子纠错，量子汉明界给出了有限长度下的球填充不等式：当码的维数乘以可纠正局部错误模式的数目时，乘积不得大于周围希尔伯特空间的维数。对非简并码，这由不相交的错误球推出；但简并情形——不同物理错误在码子空间上作用相同——破坏了不相交论证，而这种重复计数是否会使该界失效，近三十年来一直悬而未决。<sup>[6](https://arxiv.org/abs/2606.22538)</sup> 2026年，张宇轩（Yu-Xuan Zhang）和陈景灵（Jing-Ling Chen）证明，每个 K > 1 的精确二元量子子空间码都服从该界，无需假设非简并性或可加性，<sup>[16](https://arxiv.org/abs/2606.15558)</sup> 并将结果推广到每个局部维度 q ≥ 3，从而对任意局部维度建立了量子汉明界。<sup>[6](https://arxiv.org/abs/2606.22538)</sup>

## References

1. [Hamming, R. W. (1950). Error Detecting and Error Correcting Codes. Bell System Technical Journal 29(2): 147–160.](https://onlinelibrary.wiley.com/doi/abs/10.1002/j.1538-7305.1950.tb00463.x)
2. [Tonchev, V. An Introduction to Coding Theory, lecture notes, Tohoku University.](https://pages.mtu.edu/~tonchev/Coding-Theory-Tohoku-June-09)
3. [Lecture 6: Introduction to Coding Theory in Lean, UC Berkeley CS 294-268 (Spring 2026).](https://ucb-lean-course-sp26.github.io/lectures/lec-06.html)
4. [Hamming Bound – an overview, ScienceDirect Topics.](https://www.sciencedirect.com/topics/mathematics/hamming-bound)
5. [Roth, R. Introduction to Coding Theory, Chapter 4: Bounds on the Parameters of Codes, Cambridge University Press.](https://www.cambridge.org/core/books/introduction-to-coding-theory/bounds-on-the-parameters-of-codes/39E9DAA5040D4D4DFCC6F84685C59AB4)
6. [Zhang, Yu-Xuan, Chen, Jing-Ling (2026). The Quantum Hamming Bound in Arbitrary Local Dimension. arXiv:2606.22538.](https://arxiv.org/abs/2606.22538)
7. [Kaplan, N. Coding Theory Lecture Notes, University of California, Irvine.](https://www.math.uci.edu/~nckaplan/teaching_files/kaplancodingnotes.pdf)
8. [McNinch, G. Math 190, Tufts University: Block codes.](https://gmcninch.math.tufts.edu/2024-Sp-Math190/course-contents/2024-02-26--block%2Blinear.html)
9. [Heden, O. (2008). A survey of perfect codes. Advances in Mathematics of Communications 2(2): 223.](https://doi.org/10.3934%2Famc.2008.2.223)
10. [Chapter 43 — Code-Based Cryptography: McEliece and Goppa Codes, Elements of Cryptanalysis.](https://bnaskrecki.faculty.wmi.amu.edu.pl/crypto/book/part15_code_based_frontiers/ch43_code_based_crypto.html)
11. [Hamming, R. W. (1950). Error Detecting and Error Correcting Codes, full text PDF.](https://zoo.cs.yale.edu/classes/cs323/doc/Hamming.pdf)
12. [Z-p Torus Actions on Positively Curved Manifolds, Journal of Geometric Analysis (2026), background on classical bounds.](https://link.springer.com/article/10.1007/s12220-026-02520-y)
13. [Mounits, B., Etzion, T., Litsyn, S. (2007). New upper bounds on codes via association schemes and linear programming.](https://www.aimsciences.org/article/doi/10.3934/amc.2007.1.173)
14. [A computational primer on block error-correcting codes, ResearchGate.](https://www.researchgate.net/publication/228548036_A_computational_primer_on_BLOCK_ERROR-CORRECTING_CODES)
15. [Ahlswede, R., Bassalygo, L. A., Pinsker, M. S. (1999). On the Hamming Bound for Nonbinary Localized-Error-Correcting Codes. Problems of Information Transmission 35(2).](https://www.mathnet.ru/php/archive.phtml?jrnid=ppi&option_lang=eng&paperid=440&wshow=paper)
16. [Zhang, Yu-Xuan, Chen, Jing-Ling (2026). Degeneracy Cannot Violate the Quantum Hamming Bound. arXiv:2606.15558.](https://arxiv.org/abs/2606.15558)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Computational and symbolic algebra › Algebraic combinatorics and graph theory › Algebraic coding theory

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/hamming-bound

English original: https://www.edgepedia.org/hamming-bound
