# 等价类

**等价类**是集合的一个子集，它把与给定元素由等价关系相联系的所有元素汇集在一起；等价关系是一种自反、对称且传递的关系。给定定义在集合 \( A \) 上的等价关系 \( \sim \)，任意 \( a \in A \) 的等价类 \( [a] \) 汇集了 \( A \) 中所有与 \( a \) 等价的元素。<sup>[1](https://uvicnotes.github.io/MATH-122/notes/2-4-equivalence-relations/)</sup> 用符号表示，\( [a] = \{ b \in A : b \sim a \} \)<sup>[2](https://terpconnect.umd.edu/~pbrosnan/notes/ugalg/sect0018.html)</sup>。等价类是数学把不同对象视为可互换的基本手段，而一个关系所有类的集合构成底层集合的一个划分<sup>[1](https://uvicnotes.github.io/MATH-122/notes/2-4-equivalence-relations/)</sup>。

| 关键事实 | 细节 |
|---|---|
| 定义 | 对于 \( A \) 上的等价关系 \( \sim \)，\( a \) 的类是 \( [a] = \{ b \in A : b \sim a \} \)<sup>[2](https://terpconnect.umd.edu/~pbrosnan/notes/ugalg/sect0018.html)</sup> |
| 类的相等 | \( a \sim b \) 当且仅当 \( [a] = [b] \)；否则 \( [a] \) 与 \( [b] \) 不相交<sup>[3](https://www.youtube.com/watch?v=et4YDMbRqiM)</sup> |
| 划分定理 | \( A \) 上任意等价关系的等价类构成 \( A \) 的一个划分<sup>[4](https://people.clas.ufl.edu/pilyugin/files/Book-of-Proof.pdf)</sup> |
| 逆命题 | \( X \) 的每个划分 \( \{A_n\} \) 都通过“\( x \sim y \) 当且仅当 \( x, y \) 位于同一部分”定义一个等价关系，其等价类恰好就是各个部分<sup>[5](https://webapps.math.uci.edu/~ndonalds/math13/notes.html)</sup> |
| 商集 | 所有等价类的集合 \( X/\sim = \{ \hat{x} : x \in X \} \) 是幂集 \( \mathcal{P}(X) \) 的一个子集<sup>[6](https://webpages.ciencias.ulisboa.pt/~cabarbarosie/topology/textbook/index.shtml)</sup> |
| 标准投影 | \( \pi : X \to X/\sim \)，\( \pi(x) = \hat{x} \)，是满射，且 \( x \sim y \) 当且仅当 \( \pi(x) = \pi(y) \)<sup>[6](https://webpages.ciencias.ulisboa.pt/~cabarbarosie/topology/textbook/index.shtml)</sup> |
| 标准构造 | 整数、有理数和实数各自被构造为序对或序列的等价类的集合<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup> |

## 基本性质

两条事实支配着类的行为。第一，每个元素都属于一个类：由于 \( \sim \) 是自反的，\( a \in [a] \)。第二，两个类要么重合，要么不相交。若 \( [a] \) 与 \( [b] \) 共享元素 \( c \)，则 \( c \sim a \) 且 \( c \sim b \)，故由对称性和传递性得 \( a \sim b \)，两个类相等。这给出了核心判据：两个元素等价当且仅当它们的等价类相等<sup>[3](https://www.youtube.com/watch?v=et4YDMbRqiM)</sup>。

这两条事实合起来证明了划分定理：\( A \) 上等价关系的等价类构成 \( A \) 的一个划分，即一族互不相交的非空子集，其并集为 \( A \)<sup>[4](https://people.clas.ufl.edu/pilyugin/files/Book-of-Proof.pdf)</sup><sup> • </sup><sup>[8](https://www.cse.iitb.ac.in/~nutan/courses/cs207-12/notes/lec7.pdf)</sup>。

## 等价关系与划分

这种对应是双向的，而且是精确的。若 \( \sim \) 是 \( X \) 上的等价关系，其等价类划分 \( X \)。反之，给定 \( X \) 的划分 \( \{A_n\} \)，由“\( x \sim y \) 当且仅当 \( x \) 与 \( y \) 位于同一部分 \( A_n \)”定义的关系是自反、对称且传递的，其等价类恰好就是各个不同的部分 \( A_n \)<sup>[5](https://webapps.math.uci.edu/~ndonalds/math13/notes.html)</sup>。一个小例子展示了机制：把 \( X = \{1, 2, 3, 4, 5\} \) 划分为 \( A_1 = \{1, 3\} \)、\( A_2 = \{2, 4\} \) 和 \( A_3 = \{5\} \)，得到 \( [1] = [3] = A_1 \)、\( [2] = [4] = A_2 \) 以及 \( [5] = A_3 \)<sup>[5](https://webapps.math.uci.edu/~ndonalds/math13/notes.html)</sup>。

简言之，等价关系与划分本质上是同一事物的两面：关系把元素分拣成类，而类结构决定哪些序对算作相关<sup>[5](https://webapps.math.uci.edu/~ndonalds/math13/notes.html)</sup>。

## 商集

\( X \) 上 \( \sim \) 的所有等价类的集合称为**商集**，记作 \( X/\sim \)，当关系命名为 \( R \) 时记作 \( X/R \)。从集合论上说，它是集合 \( \{ \hat{x} : x \in X \} \)，即幂集 \( \mathcal{P}(X) \) 的一个子集<sup>[6](https://webpages.ciencias.ulisboa.pt/~cabarbarosie/topology/textbook/index.shtml)</sup>。把每个元素送到其类的映射 \( \pi : X \to X/\sim \) 称为**标准投影**；它是满射，取 \( Y = X/\sim \) 和 \( f = \pi \) 便可由恒等式 \( x \sim y \Leftrightarrow f(x) = f(y) \) 恢复原来的关系。更一般地，对任意等价关系，总存在满射 \( f \) 满足 \( x \sim y \Leftrightarrow f(x) = f(y) \)<sup>[6](https://webpages.ciencias.ulisboa.pt/~cabarbarosie/topology/textbook/index.shtml)</sup>。

商集正是等价类体现价值之处：它是一个新对象，其元素就是各个类本身，因此关于它的陈述同时是关于整族等价元素的陈述。

## 在类上定义函数

从商集出发的函数必须是良定义的：它在某个类上的取值不能依赖于使用该类的哪个代表元。形式地说，底层集合上的函数 \( f' \) 只有满足“\( x \sim y \) 蕴含 \( f'(x) = f'(y) \)”时才能下降到商集上。这一要求内置于形式化证明系统中。在 Lean 定理证明器中，从商类型出发的函数必须附带一个证明，表明它们尊重该等价关系，这由操作 `Quotient.lift` 实现<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。

另一种做法是从每个类中选取一个标准代表元，转而与这些代表元打交道。当每个类都有这样的代表元时，所得类型满足同样的泛性质，而从它出发的函数无需良定义性证明。对于用自然数序对表示的整数，每个类都有一个标准代表元，其中两个数至少有一个为零<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。

## 作为等价类的数系

数系的标准构造都是等价类构造。整数被定义为编码 \( n - k \) 的自然数序对 \( (n, k) \)，当 \( n_1 + k_2 = n_2 + k_1 \) 时宣布 \( (n_1, k_1) \) 与 \( (n_2, k_2) \) 相等<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。有理数是满足 \( d \neq 0 \) 的整数序对 \( (n, d) \) 的类，其中 \( \frac{n_1}{d_1} = \frac{n_2}{d_2} \) 恰好当 \( n_1 d_2 = n_2 d_1 \) 时成立<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。写出来，以最简形式记作 \( p/q \) 的有理数就是类 \( \{(pk, qk) : k \in \mathbb{Z},\ k \neq 0\} \)；符号 \( \mathbb{Q} \) 是“quotient”（商）的缩写<sup>[9](https://pdvpmtasgaon.edu.in/uploads/dptmaths/HIstoryofmathematics.pdf)</sup>。实数可由柯西序列构造，其表示并不唯一；作商使得两个序列在它们的差收敛到零时相等<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。

其他熟悉的关系也以同样方式运作。在正实数上，宣布 \( x \sim y \) 当 \( x \) 与 \( y \) 有相同的小数部分，这是一个等价关系，类 \( [x] \) 由所有与 \( x \) 有相同小数部分的正实数组成<sup>[10](https://math.libretexts.org/Courses/Monroe_Community_College/MTH_220_Discrete_Math/6%3A_Relations/6.3%3A_Equivalence_Relations_and_Partitions)</sup>。在由整数序对 \( (a, b) \) 构造分数的过程中，\( (a, b) \) 的类不写作 \( [(a,b)] \)，而写作 \( a/b \)<sup>[11](https://math.dartmouth.edu/~trs/PreTeXtProjects/old/abstract-algebra-refresher-CLI/output/web/section-2.html)</sup>。

## 历史

诉诸等价类的一般技巧大约出现在理查德·戴德金（Richard Dedekind）的时代，当时集合论开始被引入作为数学的基础，而这种技巧经过一段时间才得以确立。更早的等价类式论证出现在有具体集合支撑的语境中，高斯在《算术研究》（*Disquisitiones Arithmeticae*）中的数论是一个突出例子<sup>[12](https://link.springer.com/article/10.1007/s11229-018-1674-2)</sup>。戴德金的遗稿中包含两个如今已熟悉的构造的明确勾勒：整数作为自然数序对的等价类，有理数作为整数序对的等价类<sup>[13](https://plato.stanford.edu/entries/dedekind-foundations/)</sup>。

## 形式化数学

在 Lean 及其库 Mathlib 中，商类型是类型系统的一个原语：给定类型上的等价关系，商类型把相关的项等同起来<sup>[14](https://leanprover-community.github.io/papers/mathlib-paper.pdf)</sup>。等价关系以 `Setoid` 的形式提供，即一个类型配上一个特定的等价关系<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。证明两个元素相关就足以证明它们在商中相等，不过定义相等不受影响：同一个类的成员未必定义相等<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。由于 `Quot.lift` 有一条内置于 Lean 定义相等中的计算规则，标准库利用商类型来建立函数外延性，否则这一性质将不得不作为公理假设<sup>[7](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)</sup>。

## References

1. [Equivalence Relations, MATH 122 notes, University of Victoria](https://uvicnotes.github.io/MATH-122/notes/2-4-equivalence-relations/)
2. [Partitions of sets and equivalence relations, UMD MATH 403 notes](https://terpconnect.umd.edu/~pbrosnan/notes/ugalg/sect0018.html)
3. [Equivalence Classes and Quotient Spaces, math-sup.fr video lecture](https://www.youtube.com/watch?v=et4YDMbRqiM)
4. [Equivalence Classes and Partitions, Book of Proof (University of Florida)](https://people.clas.ufl.edu/pilyugin/files/Book-of-Proof.pdf)
5. [Equivalence relations and equivalence classes, Math 13 notes, UC Irvine](https://webapps.math.uci.edu/~ndonalds/math13/notes.html)
6. [Topology textbook, Universidade de Lisboa](https://webpages.ciencias.ulisboa.pt/~cabarbarosie/topology/textbook/index.shtml)
7. [Quotients, The Lean Reference](https://lean-lang.org/doc/reference/latest/The-Type-System/Quotients/)
8. [CS 207 Discrete Mathematics lecture notes, IIT Bombay](https://www.cse.iitb.ac.in/~nutan/courses/cs207-12/notes/lec7.pdf)
9. [History of Mathematics (chapter on the rational numbers)](https://pdvpmtasgaon.edu.in/uploads/dptmaths/HIstoryofmathematics.pdf)
10. [Equivalence Relations and Partitions, Mathematics LibreTexts](https://math.libretexts.org/Courses/Monroe_Community_College/MTH_220_Discrete_Math/6%3A_Relations/6.3%3A_Equivalence_Relations_and_Partitions)
11. [Partitions and Equivalence Relations, Abstract Algebra Refresher, Dartmouth](https://math.dartmouth.edu/~trs/PreTeXtProjects/old/abstract-algebra-refresher-CLI/output/web/section-2.html)
12. [Equivalence: an attempt at a history of the idea, Synthese](https://link.springer.com/article/10.1007/s11229-018-1674-2)
13. [Dedekind's Contributions to the Foundations of Mathematics, Stanford Encyclopedia of Philosophy](https://plato.stanford.edu/entries/dedekind-foundations/)
14. [The Lean Mathematical Library](https://leanprover-community.github.io/papers/mathlib-paper.pdf)

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

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › Formal logic and foundations › Set theory › Elementary set theory

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/equivalence-class

English original: https://www.edgepedia.org/equivalence-class
