# 不动点组合子

不动点组合子是一种高阶函数 \( Y \)，将它作用于任意函数 \( f \)，会返回 \( f \) 的一个不动点，即一个满足 \( f(x) = x \) 的值 \( x \)。用符号表示就是 \( Y f = f(Y f) \)。不动点组合子是无类型λ演算与组合子逻辑的核心概念，它们为没有命名定义的语言提供了递归能力，也正是有了它们，这些系统中的每个递归方程才得以求解。<sup>[1](https://plato.stanford.edu/entries/logic-combinatory/)</sup><sup> • </sup><sup>[2](https://www.funcp.org/wiki/y-combinator)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义性质 | 对每个 \( f \) 都有 \( Y f = f(Y f) \)；该等式在β-相等意义下成立，即两边归约到同一个项<sup>[2](https://www.funcp.org/wiki/y-combinator)</sup> |
| 柯里Y组合子 | \( Y = \lambda f.(\lambda x.f(x\,x))(\lambda x.f(x\,x)) \)；\( YF \) 与 \( F(YF) \) 是β-等价的，但二者并不相互归约<sup>[3](https://arxiv.org/abs/2504.19379)</sup> |
| 图灵Θ组合子 | \( \Theta = (\lambda xy.\,y(x\,x\,y))(\lambda xy.\,y(x\,x\,y)) \)，具有更强的性质 \( \Theta F \rightarrow_{\beta}^{+} F(\Theta F) \)<sup>[4](https://www.cis.upenn.edu/~cis5110/notes/tcbook-comp.pdf)</sup> |
| 发表史 | 图灵的Θ是第一个被发表的不动点组合子（1937年，《λ-K-转换中的p函数》，《符号逻辑杂志》第2卷）；Y组合子则由罗森布鲁姆于1950年首次发表<sup>[5](https://theory.stanford.edu/~blynn/lambda/quine.html)</sup> |
| 类型化环境 | 在简单类型λ演算中无法定义任何不动点组合子，因为它会允许出现不终止的项，与规范化性质相矛盾<sup>[6](https://academicweb.nd.edu/~dchiang/teaching/pl/2025/stlc.html)</sup> |
| Haskell的fix | `fix f` 是 `f` 的最小不动点，即满足 `f x = x` 且定义程度最低的 `x`，定义为 `fix f = let x = f x in x`<sup>[7](https://hackage-content.haskell.org/package/base-4.11.1.0/docs/Control-Monad-Fix.html)</sup> |
| 可枚举性 | 不动点组合子的集合是递归可枚举的，而它是非标准不动点组合子集合的子集，后者不是递归可枚举的<sup>[8](https://tidsskrift.dk/brics/article/view/21867)</sup> |

## 定义与不动点定理

在组合子逻辑中，\( \textsf{Y} \) 出现在标准组合子之列，带有一条单步归约公理 \( \textsf{Y}x \triangleright_1 x(\textsf{Y}x) \)，它直接表明 \( \textsf{Y}x \) 是 \( x \) 的一个不动点。<sup>[1](https://plato.stanford.edu/entries/logic-combinatory/)</sup> 无类型λ演算与组合子逻辑的不动点定理指出：对任意函数 \( M \)，都存在一个项 \( N \) 使得 \( MN = N \)；证明是直接的，因为 \( \textsf{Y}M \) 可以充当 \( N \) 的角色。<sup>[1](https://plato.stanford.edu/entries/logic-combinatory/)</sup> 这个组合子的重要性在于，它保证所有函数都有不动点，所有递归方程都可求解。<sup>[1](https://plato.stanford.edu/entries/logic-combinatory/)</sup>

标准定义内部的自应用 \( x\,x \) 正是它们得以奏效的关键，因为它让一个函数能够把自身作为参数接收。<sup>[2](https://www.funcp.org/wiki/y-combinator)</sup> 许多类型化λ演算的变体，以及更广义的类型论，都无法构造不动点组合子，因为不存在这样的类型：其项可以自应用。<sup>[9](https://ncatlab.org/nlab/show/fixed-point%2Bcombinator)</sup>

## Y组合子

最著名的不动点组合子是Y组合子，通常归功于哈斯凯尔·柯里（Haskell Curry）：<sup>[5](https://theory.stanford.edu/~blynn/lambda/quine.html)</sup>

\[ Y = \lambda f.(\lambda x.f(x\,x))(\lambda x.f(x\,x)) \]

两步β-归约即可表明 \( Y g \) 是 \( g \) 的不动点：\( Y g \rightarrow_{\beta} (\lambda x.g(x\,x))(\lambda x.g(x\,x)) \rightarrow_{\beta} g((\lambda x.g(x\,x))(\lambda x.g(x\,x))) =_{\beta} g(Y g) \)。<sup>[2](https://www.funcp.org/wiki/y-combinator)</sup> 该等式在β-相等意义下成立，而不是通过 \( Y g \) 实际归约到 \( g(Y g) \) 得到的；两边都归约到同一个项，且 \( F(YF) \rightarrow_{\beta}^{+} YF \) 与 \( YF \rightarrow_{\beta}^{+} F(YF) \) 均不成立。<sup>[2](https://www.funcp.org/wiki/y-combinator)</sup><sup> • </sup><sup>[4](https://www.cis.upenn.edu/~cis5110/notes/tcbook-comp.pdf)</sup>

**归属问题。** 实际的功劳归属比通常的说法要复杂得多。卡尔多内与欣德利合著的λ演算史记载，图灵的Θ是第一个被发表的不动点组合子，发表于1937年；而Y组合子则由罗森布鲁姆于1950年首次发表，形式为 \( Y = \lambda x.W(Bx)(W(Bx)) \)，其中 \( Wxy = xyy \)。<sup>[5](https://theory.stanford.edu/~blynn/lambda/quine.html)</sup> 然而，在1929年写给希尔伯特（Hilbert）的一封信中，柯里写下了项 \( (\lambda y.N(yy))(\lambda y.N(yy)) \)，其中 \( N \) 表示否定，柯里对该项的使用可追溯至那封信；在柯里与费斯（Curry and Feys，1958年）之前，他并未在出版物中给出明确的不动点组合子。<sup>[5](https://theory.stanford.edu/~blynn/lambda/quine.html)</sup><sup> • </sup><sup>[10](https://www.sciencedirect.com/topics/computer-science/lambda-calculus)</sup> 柯里1942年的论文《某些形式逻辑的不一致性》（*The Inconsistency of Certain Formal Logics*）引入了如今被称为柯里悖论的东西，其基础正是同样的自应用机制。<sup>[5](https://theory.stanford.edu/~blynn/lambda/quine.html)</sup>

## 图灵的Θ与求值顺序

图灵想出了另一个不动点组合子，它没有Y组合子那种归约上的缺陷。<sup>[4](https://www.cis.upenn.edu/~cis5110/notes/tcbook-comp.pdf)</sup> 令 \( A = \lambda xy.\,y(x\,x\,y) \)，\( \Theta = AA \)，则对任意项 \( F \) 都有 \( \Theta F \rightarrow_{\beta}^{+} F(\Theta F) \)，因此Θ是真正归约到不动点，而不仅仅是与它等价。<sup>[4](https://www.cis.upenn.edu/~cis5110/notes/tcbook-comp.pdf)</sup> 图灵于1937年在《符号逻辑杂志》上发表了一页纸的短文《λ-K-转换中的p函数》（*The p-function in λ-K-conversion*），文中给出了公式 \( \Theta \rightarrow \{\lambda vu.\,u(v(v\,u))\}\{\lambda vu.\,u(v(v\,u))\} \)，并指出若 \( M \rightarrow \Theta(V) \)，则 \( M \) 与 \( V(M) \) 可转换。<sup>[11](https://www.pls-lab.org/Theta_combinator)</sup><sup> • </sup><sup>[12](https://ndl.ethernet.edu.et/bitstream/123456789/33594/1/80.pdf.pdf)</sup>

这一区别对求值策略很重要。Y组合子在正规序归约下可以工作，但在应用序求值下，自应用 \( (\lambda x.F(xx))(\lambda x.F(xx)) \) 会在 \( F \) 被调用之前就永远归约下去。<sup>[13](https://student.cs.uwaterloo.ca/~cs442/W25/notes/webnotes/Module-2/)</sup><sup> • </sup><sup>[2](https://www.funcp.org/wiki/y-combinator)</sup> 补救办法是把重复的部分包裹在一个抽象之中，使求值器无法将其选为下一个可归约表达式；由此得到的严格语言变体被称为Z组合子，它把自应用放在λ抽象内部以延迟求值，从而能在按值调用语言中工作。<sup>[13](https://student.cs.uwaterloo.ca/~cs442/W25/notes/webnotes/Module-2/)</sup><sup> • </sup><sup>[2](https://www.funcp.org/wiki/y-combinator)</sup>

## 无需命名定义的递归

纯λ演算没有用于定义的名字，只有匿名函数，因此像阶乘这样的递归定义必须换一种方式表达：把递归调用抽象为一个参数，得到 \( F = \lambda s.\lambda n.\,\text{if}\ n = 0\ \text{then}\ 1\ \text{else}\ n \times s(n-1) \)，于是阶乘就是一个函数 \( fact \)，满足 \( fact = F\,fact \)，即 \( F \) 的一个不动点。不动点组合子对任意 \( F \) 都能产生这样一个不动点，所以 \( fact = YF \)。<sup>[2](https://www.funcp.org/wiki/y-combinator)</sup>

在自然数上的递归其实并不严格需要不动点组合子：克林（Kleene）1936年对递归函数的λ表示中就没有用到。<sup>[10](https://www.sciencedirect.com/topics/computer-science/lambda-calculus)</sup> 在组合子逻辑中，不动点组合子也可以在没有消去子的基底上定义，定义 \( \textsf{Y}_1 = \textsf{BM}(\textsf{BWB}) \) 与 \( \textsf{Y}_2 = \textsf{W}(\textsf{B}(\textsf{BW}(\textsf{BT})))(\textsf{W}(\textsf{B}(\textsf{BW}(\textsf{BT})))) \) 即为例证；\( \textsf{Y}_1 M = M(\textsf{Y}_1 M) \) 成立，而对 \( \textsf{Y}_2 \) 则有更强的归约 \( \textsf{Y}_2 M \triangleright M(\textsf{Y}_2 M) \)，二者分别对应柯里与图灵的组合子。<sup>[1](https://plato.stanford.edu/entries/logic-combinatory/)</sup>

## 类型化环境与实践环境中的不动点

由于不动点组合子会让人写出不终止的项，它在简单类型λ演算中无法定义，因为后者的强规范化性质保证每个项都终止。<sup>[6](https://academicweb.nd.edu/~dchiang/teaching/pl/2025/stlc.html)</sup> 因此类型化语言改为把递归作为原语提供，例如在语言中加入不动点算子 `fix t`，其求值方式是把与递归相关联的函数替换为对该同一函数的 `fix`。<sup>[2](https://www.funcp.org/wiki/y-combinator)</sup><sup> • </sup><sup>[14](https://ku-sldg.github.io/plih/types/3-Typed-Recursion.html)</sup> 即便加入了不动点组合子，简单类型演算仍然达不到图灵完备：有了 `fix` 之后并非每个项都终止，但给定项是否终止仍然是可判定的，而对图灵机来说这一点不成立。<sup>[6](https://academicweb.nd.edu/~dchiang/teaching/pl/2025/stlc.html)</sup>

在Haskell中，语言是惰性的并允许递归绑定，不动点算子是一个库函数：<sup>[7](https://hackage-content.haskell.org/package/base-4.11.1.0/docs/Control-Monad-Fix.html)</sup>

```haskell
fix :: (a -> a) -> a
fix f = let x = f x in x
```

`fix f` 是 `f` 的最小不动点，即满足 `f x = x` 且定义程度最低的 `x`。由于Haskell的惰性，`fix f` 不会立即展开成无限的函数应用序列，只要 `f` 指明何时停止，就可以用它写出终止的递归函数。<sup>[7](https://hackage-content.haskell.org/package/base-4.11.1.0/docs/Control-Monad-Fix.html)</sup><sup> • </sup><sup>[15](https://repository.tudelft.nl/file/File_e5e764ca-7470-4399-a070-c9fd53b1122c)</sup> 于是阶乘可以不用直接递归来写：辅助函数 `factorial f n` 只调用它的参数 `f`，而 `fact = fix factorial` 使其成为递归。<sup>[15](https://repository.tudelft.nl/file/File_e5e764ca-7470-4399-a070-c9fd53b1122c)</sup>

**最小不动点。** 递归函数论通过按定义域对偏函数排序，与最小不动点联系起来。约瑟夫·赫尔弗（Joseph Helfer）在2025年的一篇arXiv札记中证明：当把λ项视为归约后λ项集合上、按自然偏序构成的偏函数时，柯里的Y产生的是最小不动点；这回答了一个似乎未见于文献的问题；同一证明也适用于图灵的Θ。<sup>[3](https://arxiv.org/abs/2504.19379)</sup>

**组合子的数量。** Y是无穷多个不动点组合子之一。<sup>[2](https://www.funcp.org/wiki/y-combinator)</sup> 本-古里安大学（Ben-Gurion University）的迈耶·戈德堡（Mayer Goldberg）于2005年证明，不动点组合子的集合构成一个递归可枚举子集，而它所属的更大集合中的项被他称为非标准不动点组合子；这些项在任何可计算语境中都与不动点组合子观测等价，但它们构成的集合不是递归可枚举的。<sup>[8](https://tidsskrift.dk/brics/article/view/21867)</sup> 不动点组合子还与自复制相关：Y与Θ的定义都是把一个组合子作用于自身，而不动点组合子可以看作自应用项 \( M = \lambda x.xx \) 的参数化版本，其自应用 \( MM \) 像奎因（quine）一样归约到自身。<sup>[5](https://theory.stanford.edu/~blynn/lambda/quine.html)</sup>

## References

1. [Combinatory Logic, Stanford Encyclopedia of Philosophy](https://plato.stanford.edu/entries/logic-combinatory/)
2. [Y combinator, The Functional Programmer wiki](https://www.funcp.org/wiki/y-combinator)
3. [Joseph Helfer (2025). Y is a least fixed point combinator. arXiv:2504.19379](https://arxiv.org/abs/2504.19379)
4. [Introduction to the Theory of Computation, fixed-point combinators chapter, University of Pennsylvania](https://www.cis.upenn.edu/~cis5110/notes/tcbook-comp.pdf)
5. [Lambda calculus – Quines, Ben Lynn, Stanford University](https://theory.stanford.edu/~blynn/lambda/quine.html)
6. [CSE 40431: Theory of Programming Languages, simply-typed lambda calculus, University of Notre Dame](https://academicweb.nd.edu/~dchiang/teaching/pl/2025/stlc.html)
7. [Control.Monad.Fix, Haskell base library documentation](https://hackage-content.haskell.org/package/base-4.11.1.0/docs/Control-Monad-Fix.html)
8. [Mayer Goldberg (2005). On the Recursive Enumerability of Fixed-Point Combinators. BRICS Report Series 12(1)](https://tidsskrift.dk/brics/article/view/21867)
9. [Fixed-point combinator, nLab](https://ncatlab.org/nlab/show/fixed-point%2Bcombinator)
10. [Lambda Calculus – an overview, ScienceDirect Topics](https://www.sciencedirect.com/topics/computer-science/lambda-calculus)
11. [Theta combinator, PLS Lab](https://www.pls-lab.org/Theta_combinator)
12. [A. M. Turing (1937). The p-function in λ-K-conversion, in Alan Turing: His Work and Impact](https://ndl.ethernet.edu.et/bitstream/123456789/33594/1/80.pdf.pdf)
13. [CS442 Module 2: Untyped λ-calculus, University of Waterloo](https://student.cs.uwaterloo.ca/~cs442/W25/notes/webnotes/Module-2/)
14. [Programming Languages in Haskell: Typed Recursion, Perry Alexander, University of Kansas](https://ku-sldg.github.io/plih/types/3-Typed-Recursion.html)
15. [Fixed-Point (Value) Recursion with Algebraic Effects, TU Delft repository](https://repository.tudelft.nl/file/File_e5e764ca-7470-4399-a070-c9fd53b1122c)

---
*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: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › Formal logic and foundations › Logical calculi and logical syntax › Lambda calculus and type theory › Combinatory logic

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/fixed-point-combinator

English original: https://www.edgepedia.org/fixed-point-combinator
