# 一元运算

一元运算是恰好接受一个输入并返回同一集合中某个值的函数：形式化地说，是集合 \( A \) 上的一个映射 \( \omega \colon A \to A \)，等价地，是从第一笛卡尔幂 \( A^1 \) 到 \( A \) 自身的映射。输入的数量——此处为 1——称为该运算的元数，在一般的 \( n \) 元运算理论中，一元运算与零元运算（元数为 0）、二元运算（元数为 2）和三元运算（元数为 3）并列。<sup>[1](https://encyclopediaofmath.org/wiki/Ternary_operation)</sup><sup> • </sup><sup>[2](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 一个映射 \( \omega \colon A^1 \to A \)；运算的元数是其所作用的操作数的个数<sup>[1](https://encyclopediaofmath.org/wiki/Ternary_operation)</sup><sup> • </sup><sup>[2](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)</sup> |
| 代数实例 | 整数上的取负 \( a \mapsto -a \)、平方根，以及群中的乘法逆元 \( x^{-1} \)<sup>[2](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)</sup><sup> • </sup><sup>[3](https://proofwiki.org/wiki/Definition%3AOperation/Arity/Unary)</sup><sup> • </sup><sup>[4](https://math.nmsu.edu/people/personal-pages/files/Monograph-with-subtitle.pdf)</sup> |
| 布尔代数 | 补运算是布尔代数的一元运算，与交、并这两个二元运算并列<sup>[5](https://ww2.coastal.edu/dweathers/edm/boolean-algebras.html)</sup> |
| {0, 1} 上的计数 | 二元素集上只有 4 个一元运算：常值 0、常值 1、恒等和取反<sup>[6](https://www.classes.cs.uchicago.edu/archive/1999/winter/CS222/Lectures/boolean/node1.html)</sup> |
| 编程运算符 | 一元负号、自增与自减、取地址、解引用、布尔取反以及类型转换<sup>[7](https://www.sciencedirect.com/topics/computer-science/unary-operator)</sup> |
| 一元代数 | 若一个代数的一切运算都是一元的，则称之为一元代数；若它只有一个一元运算，则称之为单一元代数<sup>[2](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)</sup><sup> • </sup><sup>[8](https://server.math.umanitoba.ca/~tkucera/RMabstracts/250317.html)</sup> |

## 定义及其在运算理论中的位置

集合 \( A \) 上的一个 \( n \) 元运算，是从 \( A \) 的第 \( n \) 个笛卡尔幂到 \( A \) 自身的一个映射 \( \omega \colon A^n \to A \)，数 \( n \) 即其元数。历史上，二元（\( n = 2 \)）与一元（\( n = 1 \)）的情形是最先被考虑的。元数为 0 的零元运算是 \( A \) 的固定元素，也称为指定元素或常量。20 世纪，这一概念被推广到无穷元运算，即对任意基数 \( \alpha \) 的映射 \( \omega \colon A^{\alpha} \to A \)；对这类运算的研究始于 20 世纪 50 年代末，肇端于约瑟夫·斯沃敏斯基（Józef Słomiński）1959 年关于带无穷元运算的抽象代数的工作。装备了一组代数运算的集合称为泛代数。<sup>[1](https://encyclopediaofmath.org/wiki/Ternary_operation)</sup>

在这一框架下，运算的元数是其所作用的操作数的个数：一元、二元和三元运算的元数分别为 1、2、3。<sup>[2](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)</sup> 同样的分类也延续到高级编程语言中，那里的运算符可以作用于一个操作数（一元）、两个操作数（二元）或三个操作数（三元）。<sup>[9](https://openstax.org/books/introduction-computer-science/pages/7-2-programming-language-constructs)</sup>

## 代数中的例子

常见的代数映射就是一元运算。整数上的取负 \( a \mapsto -a \)，在整数环的标准签名 \( \{+, \cdot, -, 0, 1 \} \) 中表现为元数为 1 的一元运算符号，其中 \( + \) 与 \( \cdot \) 是二元的，而常量是零元的。<sup>[2](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)</sup> 平方根符号常被引为来自代数的一元运算。<sup>[3](https://proofwiki.org/wiki/Definition%3AOperation/Arity/Unary)</sup>

一元运算也作为更大签名的组成部分出现。群是一个代数 \( (G, \circ, {}^{-1}, e) \)，其中 \( \circ \) 是二元运算，\( {}^{-1} \) 是一元运算，\( e \) 是零元运算。<sup>[4](https://math.nmsu.edu/people/personal-pages/files/Monograph-with-subtitle.pdf)</sup> 逆半群同样可以描述为类型 \( \langle 2, 1 \rangle \) 的代数，带有一个二元运算和一个一元运算，后者与这类半群上通常的求逆运算一致。<sup>[10](https://arxiv.org/abs/1003.4028)</sup>

**补运算。** 在布尔代数中，一个包含比特 \( \{0, 1\} \) 的对象集合带有两个二元运算——交与并——以及补这个一元运算。<sup>[5](https://ww2.coastal.edu/dweathers/edm/boolean-algebras.html)</sup> 当且仅当每个元素的补都是唯一的，补运算才构成一元运算；在有补分配格中这一唯一性总成立，而在一般的补格中则可能不成立。<sup>[11](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Applied_Discrete_Structures_%28Doerr_and_Levasseur%29/13%3A_Boolean_Algebra/13.03%3A_Boolean_Algebras)</sup> 在二元素集 \( \{0, 1\} \) 上，只可能有四个一元运算：常值 0、常值 1、恒等和取反（补运算）。<sup>[6](https://www.classes.cs.uchicago.edu/archive/1999/winter/CS222/Lectures/boolean/node1.html)</sup>

## 编程中的一元运算符

编程语言直接继承了这一术语：一元运算符接受一个操作数，而大多数运算符——例如 \( 2 + 3 \) 中的加法——接受两个。<sup>[12](https://scienceinsights.org/what-is-a-unary-operator-in-programming/)</sup> 除一元负号和绝对值之外，编程语言中出现的一元运算符还包括自增、自减、取地址、解引用、布尔取反以及类型转换。<sup>[7](https://www.sciencedirect.com/topics/computer-science/unary-operator)</sup> 自增运算符（++）和自减运算符（--）将变量中的值加一或减一，为绝大多数高级语言所使用。<sup>[9](https://openstax.org/books/introduction-computer-science/pages/7-2-programming-language-constructs)</sup>

在 C 语言中，一元算术运算符包括：一元加号，它强制对被括起的运算进行分组并返回其算术操作数的值；算术取负，它产生整数或浮点操作数的二进制补码负数；以及按位取补运算符 \( \sim \)，它产生整数操作数的按位补。例如，对值 987 施加取负得到 -987，对无符号值 0xAAAA 施加 \( \sim \) 得到 0x5555。<sup>[13](https://learn.microsoft.com/en-us/cpp/c-language/unary-arithmetic-operators?view=msvc-160)</sup>

将一元运算符加入编译器的表达式文法需要多加小心，因为经典的表达式文法只包含二元运算符。<sup>[7](https://www.sciencedirect.com/topics/computer-science/unary-operator)</sup>

## 一元代数

泛代数还研究完全由一元运算构成的结构。若一个代数的一切运算都是一元的，则称之为一元代数；若它只有一个运算，即单个一元映射 \( f \colon A \to A \)，则称之为单一元代数。<sup>[2](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)</sup><sup> • </sup><sup>[8](https://server.math.umanitoba.ca/~tkucera/RMabstracts/250317.html)</sup> 单一元代数可以等同于一个每个顶点出度均为 1 的有向图，因为每个元素 \( a \) 恰有一个像 \( u(a) \)；反之，每个这样的有向图都在其顶点集上定义了一个单一元代数。<sup>[14](https://link.springer.com/article/10.1007/s00012-019-0596-2)</sup> 每个单一元代数都可以唯一地分解为有限个或无限个连通单一元代数的无交并。<sup>[15](https://doi.org/10.1007/s00012-024-00862-8?urlappend=%3Futm_source%3Dresearchgate.net%26utm_medium%3Darticle)</sup>

## References

1. [Algebraic operation, Encyclopedia of Mathematics](https://encyclopediaofmath.org/wiki/Ternary_operation)
2. [Universal Algebra, lecture notes, University of Hawaii](https://math.hawaii.edu/~ralph/Classes/611/Math611-NotesRSF.pdf)
3. [Definition:Operation/Unary Operation, ProofWiki](https://proofwiki.org/wiki/Definition%3AOperation/Arity/Unary)
4. [Preliminaries, monograph chapter, New Mexico State University](https://math.nmsu.edu/people/personal-pages/files/Monograph-with-subtitle.pdf)
5. [Boolean algebras, Coastal Carolina University](https://ww2.coastal.edu/dweathers/edm/boolean-algebras.html)
6. [Boolean Arithmetic and Switching, University of Chicago CS222](https://www.classes.cs.uchicago.edu/archive/1999/winter/CS222/Lectures/boolean/node1.html)
7. [Unary Operator overview, ScienceDirect Topics](https://www.sciencedirect.com/topics/computer-science/unary-operator)
8. [Rings and Modules Seminar abstract: Mono-unary algebras, University of Manitoba](https://server.math.umanitoba.ca/~tkucera/RMabstracts/250317.html)
9. [7.2 Programming Language Constructs, OpenStax Introduction to Computer Science](https://openstax.org/books/introduction-computer-science/pages/7-2-programming-language-constructs)
10. [An elegant 3-basis for inverse semigroups, arXiv:1003.4028](https://arxiv.org/abs/1003.4028)
11. [13.3: Boolean Algebras, Applied Discrete Structures, LibreTexts](https://math.libretexts.org/Bookshelves/Combinatorics_and_Discrete_Mathematics/Applied_Discrete_Structures_%28Doerr_and_Levasseur%29/13%3A_Boolean_Algebra/13.03%3A_Boolean_Algebras)
12. [What Is a Unary Operator in Programming?, ScienceInsights](https://scienceinsights.org/what-is-a-unary-operator-in-programming/)
13. [Unary Arithmetic Operators, Microsoft Learn (C language)](https://learn.microsoft.com/en-us/cpp/c-language/unary-arithmetic-operators?view=msvc-160)
14. [The fine- and generative spectra of varieties of monounary algebras, Algebra universalis](https://link.springer.com/article/10.1007/s00012-019-0596-2)
15. [On the networks of large embeddings, Algebra universalis](https://doi.org/10.1007/s00012-024-00862-8?urlappend=%3Futm_source%3Dresearchgate.net%26utm_medium%3Darticle)

---
*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: 物质世界与数学 › 数学与统计学 › 数与代数 › Algebraic structures › Abstract algebra — overview

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/unary-operation

English original: https://www.edgepedia.org/unary-operation
