互斥析取
互斥析取 | |
---|---|
术语名称 | 互斥析取 |
英语名称 | exclusive disjunction |
别名 | 逻辑异或, logical XOR, 排斥或, 不可兼或, exclusive or |
互斥析取(exclusive disjunction)是对两个命题,由其中有且仅有一个为真所对应的命题。 对应通常意义上的或的一部分用法。 但不是五个常用逻辑联结词之一。
通常意义上的“或”可能指“相容或”(析取)或“排斥或”(互斥析取)。
定义
互斥析取 | |
---|---|
运算名称 | 互斥析取 |
运算符号 | [math]\displaystyle{ \nleftrightarrow }[/math],[math]\displaystyle{ \oplus }[/math],[math]\displaystyle{ \veebar }[/math] |
Latex | \nleftrightarrow , \oplus , \veebar
|
运算对象 | 命题公式 |
运算元数 | 2 |
运算结果 | 命题公式 |
结构 | 布尔代数
|
对命题 [math]\displaystyle{ P }[/math] 、 [math]\displaystyle{ Q }[/math] ,记命题 [math]\displaystyle{ R }[/math] 满足:
- 当 [math]\displaystyle{ P }[/math] 为真,同时 [math]\displaystyle{ Q }[/math] 为假时,命题 [math]\displaystyle{ R }[/math] 为真;
- 当 [math]\displaystyle{ P }[/math] 为假,同时 [math]\displaystyle{ Q }[/math] 为真时,命题 [math]\displaystyle{ R }[/math] 为真;
- 当 [math]\displaystyle{ P }[/math] 为真,同时 [math]\displaystyle{ Q }[/math] 也为真时,命题 [math]\displaystyle{ R }[/math] 为假;
- 当 [math]\displaystyle{ P }[/math] 为假,同时 [math]\displaystyle{ Q }[/math] 也为假时,命题 [math]\displaystyle{ R }[/math] 为假。
称这样的命题 [math]\displaystyle{ R }[/math] 为命题 [math]\displaystyle{ P }[/math] 与命题 [math]\displaystyle{ Q }[/math] 的互斥析取(exclusive disjunction),记作 [math]\displaystyle{ P \nleftrightarrow Q }[/math] 、 [math]\displaystyle{ P \oplus Q }[/math] 、 [math]\displaystyle{ P \veebar Q }[/math],读作[math]\displaystyle{ P }[/math] 异或 [math]\displaystyle{ Q }[/math]([math]\displaystyle{ P }[/math] xor [math]\displaystyle{ Q }[/math]) 或 [math]\displaystyle{ P }[/math] 互斥析取 [math]\displaystyle{ Q }[/math]。
↮ | |
---|---|
字符 | ↮ |
Unicode码位 | U+21AE Left Right Arrow with Stroke
|
Latex命令序列 | \nleftrightarrow
|
⊕ | |
---|---|
字符 | ⊕ |
Unicode码位 | U+2295 Circled Plus
|
Latex命令序列 | \oplus
|
⊻ | |
---|---|
字符 | ⊻ |
Unicode码位 | U+22BB XOR
|
Latex命令序列 | \veebar
|
异或本身没有常见的五个逻辑联结词常用。在少数出现中,这三个符号都有出现情况。中文语境中,一般使用 [math]\displaystyle{ \oplus }[/math] 的形式。
此外还会有更加少见的,使用 + (因为可以看作模 2 剩余类群上的加法)或 [math]\displaystyle{ \dot\vee }[/math]。
另外,正如符号所暗示的,异或本身相当于等价和否定运算的复合。
真值表
[math]\displaystyle{ p }[/math] | [math]\displaystyle{ q }[/math] | [math]\displaystyle{ p \oplus q }[/math] |
---|---|---|
T | T | F |
T | F | T |
F | T | T |
F | F | T |
性质
布尔代数的运算。
- 运算性质:
- 结合律:对于任意命题 [math]\displaystyle{ P }[/math] 、 [math]\displaystyle{ Q }[/math] 和 [math]\displaystyle{ R }[/math],有 [math]\displaystyle{ (P \oplus Q) \oplus R = P \oplus (Q \oplus R) }[/math]。
- 交换律:对于任意命题 [math]\displaystyle{ P }[/math] 和 [math]\displaystyle{ Q }[/math],有 [math]\displaystyle{ P \oplus Q = Q \oplus P }[/math]。
- 对于任意命题 [math]\displaystyle{ P }[/math] 和 [math]\displaystyle{ Q }[/math],有 [math]\displaystyle{ (P \oplus Q) \oplus Q = P }[/math]。
- 特殊值:
- [math]\displaystyle{ P \oplus P = P }[/math]
- [math]\displaystyle{ P \oplus \mathrm{F} = P }[/math]
- [math]\displaystyle{ P \oplus \mathrm{T} = \lnot P }[/math]
多元异或
对命题 [math]\displaystyle{ P_1, P_2, \dots , P_n }[/math] ,由这些命题中奇数个为真所对应的命题,记作 [math]\displaystyle{ P_1 \oplus P_2 \oplus \dots \oplus P_n }[/math]。也记作 [math]\displaystyle{ \bigoplus_{i=1}^n P_i = P_1 \oplus P_2 \oplus \dots \oplus P_n }[/math]。
这是由于结合律成立产生的直接定义。
另外,当然也存在多元的排斥或,定义为多个中仅有一个为真,但是很不常见,甚至没有专门且通用的名称。
逻辑联结词 | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
零元 | ||||||||||||||||||
真值表 | [math]\displaystyle{ \bot }[/math] | [math]\displaystyle{ \top }[/math] | ||||||||||||||||
T | F | |||||||||||||||||
名称 | 真[math]\displaystyle{ \top }[/math] | 假[math]\displaystyle{ \bot }[/math] | ||||||||||||||||
二进制 | 0 | 1 | ||||||||||||||||
一元 | ||||||||||||||||||
真值表 | [math]\displaystyle{ p }[/math] | [math]\displaystyle{ \bot }[/math] | [math]\displaystyle{ \lnot p }[/math] | [math]\displaystyle{ p }[/math] | [math]\displaystyle{ \top }[/math] | |||||||||||||
T | F | T | ||||||||||||||||
F | F | T | F | T | ||||||||||||||
名称 | 假[math]\displaystyle{ \bot }[/math] | 否定(非)[math]\displaystyle{ \lnot }[/math] | (恒等映射[math]\displaystyle{ \mathrm{id} }[/math]) | 真[math]\displaystyle{ \top }[/math] | ||||||||||||||
缩写 | - | NOT | - | - | ||||||||||||||
二进制 | 0 | 1 | 2 | 3 | ||||||||||||||
二元 | ||||||||||||||||||
真值表 | [math]\displaystyle{ p }[/math] | [math]\displaystyle{ q }[/math] | [math]\displaystyle{ \bot }[/math] | [math]\displaystyle{ p \bar{\vee} q }[/math] [math]\displaystyle{ p \downarrow q }[/math] |
[math]\displaystyle{ p \nleftarrow q }[/math] | [math]\displaystyle{ \lnot p }[/math] | [math]\displaystyle{ p \nrightarrow q }[/math] | [math]\displaystyle{ \lnot q }[/math] | [math]\displaystyle{ p \oplus q }[/math] [math]\displaystyle{ p \nleftrightarrow q }[/math] |
[math]\displaystyle{ p \barwedge q }[/math] [math]\displaystyle{ p \uparrow q }[/math] |
[math]\displaystyle{ p \land q }[/math] | [math]\displaystyle{ p \leftrightarrow q }[/math] | [math]\displaystyle{ q }[/math] | [math]\displaystyle{ p \rightarrow q }[/math] | [math]\displaystyle{ p }[/math] | [math]\displaystyle{ p \leftarrow q }[/math] | [math]\displaystyle{ p \lor q }[/math] | [math]\displaystyle{ \top }[/math] |
T | T | F | T | |||||||||||||||
F | F | T | F | T | ||||||||||||||
F | T | F | T | F | T | F | T | F | T | |||||||||
F | F | T | F | T | F | T | F | T | F | T | F | T | F | T | F | T | ||
名称 | 假 [math]\displaystyle{ \bot }[/math] |
或非 [math]\displaystyle{ \downarrow }[/math]/[math]\displaystyle{ \bar{\vee} }[/math] |
- | 否定 非 [math]\displaystyle{ \lnot }[/math] |
- | 否定 非 [math]\displaystyle{ \lnot }[/math] |
互斥析取 异或 [math]\displaystyle{ \oplus }[/math]/[math]\displaystyle{ \nleftrightarrow }[/math]/[math]\displaystyle{ \veebar }[/math] |
与非 [math]\displaystyle{ \uparrow }[/math]/[math]\displaystyle{ \barwedge }[/math] |
合取 且/与 [math]\displaystyle{ \land }[/math] |
等价 当且仅当 [math]\displaystyle{ \leftrightarrow }[/math] |
投影映射 [math]\displaystyle{ \mathrm{proj}_2 }[/math] |
蕴含 推出 [math]\displaystyle{ \rightarrow }[/math] |
投影映射 [math]\displaystyle{ \mathrm{proj}_1 }[/math] |
- | 析取 或 [math]\displaystyle{ \lor }[/math] |
真 [math]\displaystyle{ \top }[/math] | ||
缩写 | - | NOR | - | NOT | NIMPLY | NOT | XOR | NAND | AND | XNOR EQV |
- | IMPLY | - | - | OR | - | ||
二进制 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
琐事
名称
“异或”的名字来自于,它首先是一种“或”。“或”有两种,一种是至少一个,另一种是其中相异的。因此其中相异的被称为“异或”。[1]
“XOR”就是 exclusive or 的缩写,读 [̩ɛksˈɔː] 或 [ksɔː] 。也有 EOR 和 EXOR 的写法,但现在很少见。[2]