逻辑与
| 逻辑与 | |
|---|---|
| 术语名称 | 逻辑与 |
| 英语名称 | logical AND |
| 别名 | 逻辑乘法, logical multiplication |
逻辑与(logical AND)指二值变量的一种运算,相当于命题真值间的合取联结词。与模 2 剩余类环上的乘法同构,故也称为逻辑乘法。
定义
| 逻辑与 | |
|---|---|
| 运算名称 | 逻辑与 |
| 运算符号 | |
| Latex | |
| 运算对象 | 二值变量 |
| 运算元数 | 2 |
| 运算结果 | 二值变量 |
| 结构 | 布尔代数 |
| 定义域 | [math]\displaystyle{ \mathbb{B} \times \mathbb{B} }[/math] |
| 陪域 | [math]\displaystyle{ \mathbb{B} }[/math] |
对二值变量 [math]\displaystyle{ x, y \in \mathbb{B} = \{0,1\} }[/math] ,将二元运算 [math]\displaystyle{ (1,1)\mapsto 1; (0,1)\mapsto 0;(1,0)\mapsto 0;(0,0)\mapsto 0 }[/math] 称为逻辑与(logical AND)运算,也称为逻辑乘法运算,记作 [math]\displaystyle{ xy }[/math] 或 [math]\displaystyle{ x\cdot y }[/math] 。也有人记作 [math]\displaystyle{ x \& y }[/math] 、 [math]\displaystyle{ x \&\& y }[/math] 或 [math]\displaystyle{ x\land y }[/math] 。
也可以建模为 [math]\displaystyle{ \mathbf{F}_2 }[/math] 上的乘法。
乘法表
| [math]\displaystyle{ \cdot }[/math] | T | F |
|---|---|---|
| T | T | F |
| F | F | F |
性质
运算性质:
多元逻辑与
由于是一种符合结合律的运算,可以定义多元逻辑与运算。
变体
短路逻辑与
在编程语言中,逻辑与通常被处理成一种短路的运算,也就是说两个操作数间存在一个顺序点,当左侧可以确认为 false 时,不再计算右侧操作数的值。
三值逻辑与
对三值逻辑变量,也存在对应逻辑与的同名运算。
| [math]\displaystyle{ \cdot }[/math] | T | U | F |
|---|---|---|---|
| T | T | U | F |
| U | U | U | F |
| F | F | F | F |
| 逻辑运算 | |||
|---|---|---|---|
| 逻辑非 | 逻辑与 | 逻辑或 | 逻辑异或 |