# 原始递归函数

原始递归函数是自然数上的函数，可以从少量平凡的初始函数出发，通过有限次应用两种运算——复合与原始递归——构造出来。这一函数类由库尔特·哥德尔（Kurt Gödel）于1931年分离出来，作为他证明第一不完备定理的一部分；它包含人们在通常实践中遇到的几乎全部数论函数，包括加法、乘法、幂运算，以及每一个可由所有循环都有事先固定界线的程序计算的函数。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup><sup> • </sup><sup>[2](https://people.cs.umass.edu/~immerman/pub/computabilityAndComplexity.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 初始函数 | 零函数 \( \zeta() = 0 \)、恒等函数 \( \eta(n) = n \)、后继函数 \( \sigma(n) = n + 1 \)，以及投影函数 \( \pi_i^k \)，其中一元恒等函数只是一元投影函数<sup>[1](https://plato.stanford.edu/entries/computability/)</sup><sup> • </sup><sup>[13](https://plato.stanford.edu/entries/recursive-functions/)</sup> |
| 闭包运算 | 复合，以及原始递归：\( h(0,\bar{x}) = f(\bar{x}) \) 和 \( h(n+1,\bar{x}) = g(h(n,\bar{x}), n, \bar{x}) \)<sup>[1](https://plato.stanford.edu/entries/computability/)</sup> |
| 全域性 | 每个原始递归函数都是全的（在所有输入上有定义）且可计算的<sup>[3](https://www.cl.cam.ac.uk/teaching/1112/CompTheory/comt-notes.pdf)</sup> |
| 机器刻画 | 恰好是用有界迭代可计算的函数，即霍夫施塔特（Hofstadter）的 BLOOP 语言（迈耶和里奇（Meyer and Ritchie）1967）<sup>[1](https://plato.stanford.edu/entries/computability/)</sup> |
| 复杂性刻画 | 一个图灵可计算函数是原始递归的，当且仅当其运行时间被其参数的一个原始递归函数所界定<sup>[4](https://arxiv.org/abs/2510.18283)</sup> |
| 真扩张 | 阿克曼函数是全的且可计算的，但不是原始递归的<sup>[5](https://mathworld.wolfram.com/PrimitiveRecursiveFunction.html)</sup> |
| 在逻辑中的作用 | 哥德尔在1931年用原始递归函数在他的不完备性证明中把公式和证明编码为数<sup>[2](https://people.cs.umass.edu/~immerman/pub/computabilityAndComplexity.html)</sup> |

## 定义

该类是归纳定义的。它是包含初始函数且在复合与原始递归下封闭的最小函数类。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup> 复合以通常的方式组合函数：如果 \( f \) 的元数为 \( a \)，且 \( g_1, \ldots, g_a \) 具有合适的元数，那么 \( h(\bar{x}) = f(g_1(\bar{x}), \ldots, g_a(\bar{x})) \) 是原始递归的。原始递归由两个等式从元数为 \( k \) 的函数 \( f \) 和元数为 \( k+2 \) 的函数 \( g \) 定义一个新的元数为 \( k+1 \) 的函数 \( h \)<sup>[1](https://plato.stanford.edu/entries/computability/)</sup>

\[\begin{align} h(0, x_1, \ldots, x_k) &= f(x_1, \ldots, x_k), \\ h(n+1, x_1, \ldots, x_k) &= g(h(n, x_1, \ldots, x_k), n, x_1, \ldots, x_k). \end{align}\]

因此 \( n+1 \) 处的值由 \( n \) 处的值确定，其他参数保持不变。这是一种受限的递归形式：递归变量每一步恰好减一，且不查询 \( h \) 的其他先前值。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup>

因为初始函数都是全的，且两种运算都保持全域性，所以每个原始递归函数都是全的；又因为每个定义都是一个有限配方，所以每个原始递归函数都是可计算的。<sup>[3](https://www.cl.cam.ac.uk/teaching/1112/CompTheory/comt-notes.pdf)</sup> 定义是外延的：不同的构造可能产生同一个函数。<sup>[6](https://alphabetamath.cc/item/def-primitive-recursive-function)</sup>

## 例子

加法通过对其第一个参数进行原始递归来定义，\( P(0,y) = y \) 且 \( P(n+1,y) = \sigma(P(n,y)) \)；该方案所需的步进函数 \( g(x_1,x_2,x_3) = \eta(\sigma(x_1)) \) 本身由初始函数通过复合构造。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup> 乘法随后通过迭代加法定义，\( T(0,y) = 0 \) 且 \( T(n+1,y) = P(T(n,y),y) \)，而幂运算通过迭代乘法定义。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup>

每一次对已定义的快速增长函数进一步应用原始递归，都会产生一个更快的函数。超指数函数 \( H(n,m) \)，即一个由 \( n \) 个二构成、以 \( m \) 为顶端的幂塔，可通过 \( H(0,y) = y \) 和 \( H(n+1,y) = E(2,H(n,y)) \) 定义，因此是原始递归的，其中 \( E \) 是幂运算。它的值很快超过物理计数：\( H(3,3) = 2^{256} \)，超过 \( 10^{77} \)。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup>

一个关系称为原始递归的，当其特征函数（在关系上取值1，否则取值0）是原始递归的。原始递归谓词在逻辑联结词下以及在形式为 \( \forall z < y \) 或 \( \exists z < y \) 的有界量化下封闭。<sup>[7](https://www.michaelbeeson.com/teaching/StanfordLogic/Lecture4Slides.pdf)</sup> 递归调用参数严格递减的递归，例如斐波那契函数，也仍属于该类。<sup>[7](https://www.michaelbeeson.com/teaching/StanfordLogic/Lecture4Slides.pdf)</sup>

## 该类刻画了什么

该类有两个有用的机器层面刻画。第一，它恰好是使用有界迭代可计算的函数集合，其中每个循环在进入循环之前都有一个固定的迭代上限；迈耶和里奇（Meyer and Ritchie）在1967年证明了这一点，相应的语言是霍夫施塔特（Hofstadter）1979年书中的 BLOOP。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup> 第二，一个图灵可计算函数是原始递归的，恰好当其图灵机的运行时间被其参数的一个原始递归函数所界定；在这种情况下，克林（Kleene）范式中的无界搜索可以用有界搜索代替。<sup>[4](https://arxiv.org/abs/2510.18283)</sup> 由于 \( H(n,n) \) 本身是原始递归的，该类包含 TIME[\( H(n,n) \)] 的全部，即一个巨大的计算范围。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup>

尽管如此，该类是可计算函数类的一个真子类。把所有一元原始递归函数编码为 \( p_1, p_2, \ldots \)，对角函数 \( D(n) = p_n(n) + 1 \) 可由图灵机计算，但在 \( n \) 处与每个 \( p_n \) 不同，因此它不是原始递归的。<sup>[1](https://plato.stanford.edu/entries/computability/)</sup> 标准的具体例子是阿克曼（Ackermann）函数，下文将描述。

## 阿克曼函数与该类的边界

阿克曼函数是最简单的著名例子，说明一个全可计算函数不是原始递归的，它是对二十世纪初“每个可计算函数都将是原始递归的”这一期望的反例。<sup>[5](https://mathworld.wolfram.com/PrimitiveRecursiveFunction.html)</sup> 它的历史比教科书通常暗示的更为间接。希尔伯特（Hilbert）在其1926年的演讲《论无限》中引入了一个版本，背景是试图证明连续统假设，以表明通过更高类型的递归可得到的类型1函数并不被普通递归可定义的函数穷尽。威廉·阿克曼（Wilhelm Ackermann）在其1928年的论文《论希尔伯特对实数的构造》中给出了精确陈述和证明，表明 \( \varphi(x,x,x) \) 比任何由普通递归定义的函数增长得更快：对于任何这样的 \( \psi \)，存在一个 \( n_0 \)，使得对所有 \( n > n_0 \) 都有 \( \varphi(n,n,n) > \psi(n) \)。<sup>[8](https://plato.stanford.edu/Entries/recursive-functions/ackermann-peter.html)</sup>

后来作者们认定为阿克曼函数的定义是<sup>[8](https://plato.stanford.edu/Entries/recursive-functions/ackermann-peter.html)</sup>

\[\begin{align} \varphi(x, y, 0) &= x + y, \\ \varphi(x, 0, n + 1) &= \alpha(x,n), \\ \varphi(x, y + 1, n + 1) &= \varphi(x, \varphi(x,y,n+1), n). \end{align}\]

这不符合原始递归方案，因为 \( y+1 \) 处的值依赖于 \( y \) 和 \( n \) 两处的先前值；阿克曼称之为同时递归的一个实例。<sup>[8](https://plato.stanford.edu/Entries/recursive-functions/ackermann-peter.html)</sup> 罗莎·彼得（Rózsa Péter）后来关于二重及更高阶递归的工作表明，每一种新的递归都定义更多的函数，而对角化总是保证进一步的逃逸。<sup>[7](https://www.michaelbeeson.com/teaching/StanfordLogic/Lecture4Slides.pdf)</sup>

## 在哥德尔不完备定理和证明论中的作用

哥德尔在其1931年的论文中引入了该类，并用它来算术化语法：他归纳地证明每个原始递归函数在一阶数论中可表示，然后用这样的函数把公式和公式序列编码为数，并计算诸如一个公式是否良构以及一个公式序列是否是一个证明之类的性质。<sup>[2](https://people.cs.umass.edu/~immerman/pub/computabilityAndComplexity.html)</sup> 在哥德尔1934年的普林斯顿讲座中，标题为“递归函数与关系”的一节用“递归”来指现在所谓的原始递归，正如哥德尔后来在脚注中指出的。<sup>[9](https://www.sciencedirect.com/topics/mathematics/primitive-recursion)</sup>

该类也标志着证明论中的一个边界。希尔伯特和伯奈斯（Bernays）把归纳和原始递归视为有穷主义算术的一部分，这是他们用于一致性证明的框架。<sup>[10](https://plato.stanford.edu/entries/proof-theory/)</sup> 理论 PRA（原始递归算术）证明算术推理的无量词片段，而根岑（Gentzen）对皮亚诺（Peano）算术的一致性证明仅在原始递归谓词上使用直到序数 \( \varepsilon_0 \) 的超限归纳，其余论证用有穷主义手段完成。<sup>[10](https://plato.stanford.edu/entries/proof-theory/)</sup>

## 与一般递归函数的关系

把无界极小化算子 \( \mu \)（它搜索使函数取指定值的最小自变量值，且可能不终止）加入闭包运算，得到部分递归函数；其中全的函数是一般递归函数，这是一个真包含原始递归函数的类。<sup>[3](https://www.cl.cam.ac.uk/teaching/1112/CompTheory/comt-notes.pdf)</sup> 哥德尔1934年对一般递归性的定义包含了原始递归方案、阿克曼-彼得函数以及希尔伯特考虑过的若干方案，而在皮亚诺算术这样的系统中可表示的函数对应于一般递归函数而非原始递归函数。<sup>[11](https://plato.stanford.edu/archives/spr2026/entries/recursive-functions/)</sup> 在现代证明助手如 Lean 中，被结构递归检查器接受的定义编译为原始递归器，这以同样的精神保证终止。<sup>[12](https://lean-lang.org/doc/reference/latest/The-Type-System/Inductive-Types/)</sup>

## References

1. [Computability and Complexity, Stanford Encyclopedia of Philosophy](https://plato.stanford.edu/entries/computability/)
2. [Computability and Complexity, Neil Immerman, University of Massachusetts Amherst](https://people.cs.umass.edu/~immerman/pub/computabilityAndComplexity.html)
3. [Computation Theory course notes, University of Cambridge](https://www.cl.cam.ac.uk/teaching/1112/CompTheory/comt-notes.pdf)
4. [A Characterization of Turing Machines that Compute Primitive Recursive Functions, arXiv:2510.18283](https://arxiv.org/abs/2510.18283)
5. [Primitive Recursive Function, Wolfram MathWorld](https://mathworld.wolfram.com/PrimitiveRecursiveFunction.html)
6. [Primitive recursive functions, Alphabeta Math](https://alphabetamath.cc/item/def-primitive-recursive-function)
7. [Lecture 4: The Primitive Recursive Functions, Michael Beeson, Stanford Logic course](https://www.michaelbeeson.com/teaching/StanfordLogic/Lecture4Slides.pdf)
8. [History of the Ackermann and Péter functions, supplement to Recursive Functions, Stanford Encyclopedia of Philosophy](https://plato.stanford.edu/Entries/recursive-functions/ackermann-peter.html)
9. [Primitive Recursion, ScienceDirect Topics](https://www.sciencedirect.com/topics/mathematics/primitive-recursion)
10. [Proof Theory, Stanford Encyclopedia of Philosophy](https://plato.stanford.edu/entries/proof-theory/)
11. [Recursive Functions, Stanford Encyclopedia of Philosophy, Spring 2026 Edition](https://plato.stanford.edu/archives/spr2026/entries/recursive-functions/)
12. [Inductive Types, Lean Reference Manual](https://lean-lang.org/doc/reference/latest/The-Type-System/Inductive-Types/)
13. [Recursive Functions (Stanford Encyclopedia of Philosophy)](https://plato.stanford.edu/entries/recursive-functions/)

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

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Computability theory › Models of computation and computability formalisms

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/primitive-recursive-function

English original: https://www.edgepedia.org/primitive-recursive-function
