# 当且仅当

**当且仅当**（缩写为 **iff**）是形式逻辑与数学中的连接短语，用于连接两个陈述，断言二者互相蕴含；在命题逻辑中它被称为双条件句，用符号 \( \leftrightarrow \) 表示，如 \( p \leftrightarrow q \)。<sup>[1](https://openstax.org/books/contemporary-mathematics/pages/2-2-compound-statements)</sup> 当 \( p \) 的真值与 \( q \) 的真值一致时，陈述 \( p \leftrightarrow q \) 为真，否则为假。<sup>[2](https://openstax.org/books/contemporary-mathematics/pages/2-4-truth-tables-for-the-conditional-and-biconditional)</sup>

| 关键事实 | 详情 |
|---|---|
| 名称与符号 | 用“当且仅当”连接两个陈述构成双条件句，写作 \( p \leftrightarrow q \)；\( p \) 是假设（前件），\( q \) 是结论（后件）<sup>[1](https://openstax.org/books/contemporary-mathematics/pages/2-2-compound-statements)</sup> |
| 真值条件 | 当 \( p \) 与 \( q \) 的真值一致（同为真或同为假）时，\( p \leftrightarrow q \) 恰好为真<sup>[1](https://openstax.org/books/contemporary-mathematics/pages/2-2-compound-statements)</sup> |
| 分解 | \( p \leftrightarrow q \) 等价于 \( (p \to q) \wedge (q \to p) \)，即两个条件句的合取<sup>[2](https://openstax.org/books/contemporary-mathematics/pages/2-4-truth-tables-for-the-conditional-and-biconditional)</sup> |
| 条件读法 | “A 当且仅当 B”表示 A 是 B 的充分必要条件；等价符号包括 \( A \leftrightarrow B \)、\( A \Leftrightarrow B \) 和 \( A \equiv B \)<sup>[3](https://mathworld.wolfram.com/Iff.html)</sup><sup> • </sup><sup>[4](https://www.cs.utexas.edu/~dnp/frege/subsection-163.html)</sup> |
| 缩写 | “iff”首次见于印刷品是在约翰·L·凯利（John L. Kelley）的《一般拓扑学》（1955），书中将其发明归功于保罗·R·哈尔莫斯（Paul R. Halmos）<sup>[5](https://mathshistory.st-andrews.ac.uk/Miller/mathword/i/)</sup> |
| 数字电路中的对应运算 | 在布尔代数中，同一运算为同或，当两个输入一致时输出真<sup>[3](https://mathworld.wolfram.com/Iff.html)</sup> |
| 在证明助手中 | Lean 的 `Iff` 结构容纳两个蕴含；`Iff.intro h1 h2` 从 `h1 : p \to q` 和 `h2 : q \to p` 构造 \( p \leftrightarrow q \) 的证明<sup>[6](https://docs.lean-lang.org/theorem_proving_in_lean4/Propositions-and-Proofs/)</sup> |

## 真值条件

双条件句是一份双向契约。OpenStax 的《当代数学》将 \( p \leftrightarrow q \) 描述为等价于 \( (p \to q) \wedge (q \to p) \)，其真值表由此分解得出：该陈述在 T↔T 和 F↔F 两行中为真，在 T↔F 和 F↔T 两行中为假。<sup>[2](https://openstax.org/books/contemporary-mathematics/pages/2-4-truth-tables-for-the-conditional-and-biconditional)</sup> F↔F 这一行最常令初学者感到意外：“水管工没有修好漏水当且仅当房主没有付钱”在双方都未行动时算作真，因为两个成分陈述都为假，因而彼此一致。<sup>[2](https://openstax.org/books/contemporary-mathematics/pages/2-4-truth-tables-for-the-conditional-and-biconditional)</sup>

由于双条件句仅取决于真值的一致性，它的行为类似于集合 {真，假} 上的等号。Wolfram MathWorld 列出“A 等价于 B”和“A 同或 B”作为等价读法，并指出“just if”和“exactly when”有时也用来代替“if and only if”。<sup>[3](https://mathworld.wolfram.com/Iff.html)</sup>

## 充分必要条件

该短语在条件方面有一种精确读法。德克萨斯大学的一份课程讲义如此表述：若每当 \( P \) 为真时 \( Q \) 也必为真，则 \( P \) 是 \( Q \) 的充分条件，即 \( P \to Q \)；若 \( Q \) 为真时 \( P \) 不可能不为真，则 \( P \) 是 \( Q \) 的必要条件，即 \( Q \to P \)。因此写下“\( Q \) 当且仅当 \( P \)”就是断言 \( (P \to Q) \wedge (Q \to P) \)，也就是说 \( P \) 与 \( Q \) 必须具有相同的真值，\( P \equiv Q \)。<sup>[4](https://www.cs.utexas.edu/~dnp/frege/subsection-163.html)</sup> 这正是定义中通常需要的形式，被定义项与其定义条件应当可以互换。<sup>[4](https://www.cs.utexas.edu/~dnp/frege/subsection-163.html)</sup>

“iff”陈述的两个方向在难度和趣味上可能相差悬殊。EMS 杂志上一篇关于该短语在数学中作用的文章主张，以“当且仅当”形式陈述一个结果，往往迫使数学家找到正确的逆命题，并举例说明完整的双条件句形式是真正强于任一单方向的定理；文章称此类结果为“gc-定理”（good complete theorems，优良完备定理）。<sup>[7](https://euromathsoc.org/magazine/articles/183)</sup> 同一篇文章指出，许多重大结果在这种意义下互相等价，并列举选择公理、佐恩引理和吉洪诺夫定理作为彼此等价的陈述。<sup>[7](https://euromathsoc.org/magazine/articles/183)</sup>

## “iff”缩写的历史

这一缩写是二十世纪中叶的造物。《牛津高阶英语词典》将“iff”记录为数学用语，意为“if and only if”，词源标注为 1950 年代，是对“if”的任意延伸。<sup>[8](https://www.oxfordlearnersdictionaries.com/us/definition/english/iff)</sup> 《牛津英语词典》中最早的引例出自约翰·L·凯利（John L. Kelley）的《一般拓扑学》（1955）：“F 在 x 处等度连续当且仅当存在 x 的一个邻域，其在 F 的每个成员下的像都小。”凯利将此术语归功于数学家保罗·R·哈尔莫斯（Paul R. Halmos），并在同一本书的序言中写道：“在某些场合，数学内容需要‘if and only if’，而为了读来顺口又需要稍短一些的表达，我便使用哈尔莫斯的‘iff’。”<sup>[5](https://mathshistory.st-andrews.ac.uk/Miller/mathword/i/)</sup>

哈尔莫斯本人也声称创造了这个词，并带着他特有的保留。在他 1985 年自传《我想成为数学家》的最后一页，他写道：“我最接近不朽的贡献是一个缩写和一个排版符号。我发明了‘iff’，意为‘if and only if’——但我始终无法相信自己是它真正的第一个发明者。”哈尔莫斯补充说，他乐于接受这一缩写早于他存在，尽管他并无证据，而正是他的创造、或可说是再创造，使这个词传遍了整个数学界。<sup>[5](https://mathshistory.st-andrews.ac.uk/Miller/mathword/i/)</sup> 在 1997 年的一则帖子中，他说得更直白：“据我所知，我确实发明了这个小东西，但我不会在法庭上为此宣誓。”<sup>[3](https://mathworld.wolfram.com/Iff.html)</sup> 哈尔莫斯在同一段中提到的排版符号是墓碑符，即标记证明结束的小方块，有时被称为“哈尔莫斯符”。<sup>[5](https://mathshistory.st-andrews.ac.uk/Miller/mathword/i/)</sup>

## 在形式证明系统中

在基于类型论的证明助手中，双条件句不仅是记号，更是一种数据结构。在 Lean 定理证明器中，`Iff` 被定义为一个结构，接受两个命题并记录共同见证其等价的一对蕴含；给定 `h1 : p → q` 和 `h2 : q → p`，通过 `Iff.intro h1 h2` 即可获得 `p ↔ q` 的证明，而已经建立的双条件句的前向和后向方向则分别用 `Iff.mp` 和 `Iff.mpr` 取回。<sup>[6](https://docs.lean-lang.org/theorem_proving_in_lean4/Propositions-and-Proofs/)</sup> 该符号在 Lean 中用 `\iff` 或 `\lr` 输入。<sup>[9](https://leanprover-community.github.io/logic_and_proof/propositional_logic_in_lean.html)</sup> 这种封装方式镜像了逻辑分解：证明一个“当且仅当”陈述总是意味着证明两个条件句，而使用它则意味着应用其两个方向之一。<sup>[6](https://docs.lean-lang.org/theorem_proving_in_lean4/Propositions-and-Proofs/)</sup>

## 与条件句的关系

双条件句通过添加逆命题强化了普通条件句。\( p \to q \) 允许 \( p \) 与 \( q \) 在一个方向上不一致（\( p \) 假、\( q \) 真时条件句仍为真），而 \( p \leftrightarrow q \) 禁止任一方向上的不一致。<sup>[2](https://openstax.org/books/contemporary-mathematics/pages/2-4-truth-tables-for-the-conditional-and-biconditional)</sup> 在日常英语中，单独的“if”很少带有这种力量：说“如果下雪了，我们就去滑雪”只让说话者承诺一个方向，而“我们去滑雪当且仅当昨晚下雪了”则承诺了两个方向。<sup>[1](https://openstax.org/books/contemporary-mathematics/pages/2-2-compound-statements)</sup> 数学家有时反其道而行之，在定义中本意是“iff”的地方只写“if”，逻辑教学材料中注意到了这一惯例。<sup>[4](https://www.cs.utexas.edu/~dnp/frege/subsection-163.html)</sup>

## References

1. [Compound Statements, Contemporary Mathematics, OpenStax](https://openstax.org/books/contemporary-mathematics/pages/2-2-compound-statements)
2. [Truth Tables for the Conditional and Biconditional, Contemporary Mathematics, OpenStax](https://openstax.org/books/contemporary-mathematics/pages/2-4-truth-tables-for-the-conditional-and-biconditional)
3. [Iff, Wolfram MathWorld](https://mathworld.wolfram.com/Iff.html)
4. [Necessary and Sufficient Conditions, University of Texas at Austin](https://www.cs.utexas.edu/~dnp/frege/subsection-163.html)
5. [Earliest Known Uses of Some of the Words of Mathematics (I), MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Miller/mathword/i/)
6. [Propositions and Proofs, Theorem Proving in Lean 4](https://docs.lean-lang.org/theorem_proving_in_lean4/Propositions-and-Proofs/)
7. ["If, and only if" in mathematics, EMS Magazine](https://euromathsoc.org/magazine/articles/183)
8. [iff conjunction, Oxford Advanced Learner's Dictionary](https://www.oxfordlearnersdictionaries.com/us/definition/english/iff)
9. [Propositional Logic in Lean, Logic and Proof](https://leanprover-community.github.io/logic_and_proof/propositional_logic_in_lean.html)

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

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › Formal logic and foundations › Logical calculi and logical syntax › Propositional logic › Propositional formulas, syntax and semantics

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/if-and-only-if

English original: https://www.edgepedia.org/if-and-only-if
