跳转到内容
主菜单
主菜单
移至侧栏
隐藏
导航
首页
最近更改
随机页面
MediaWiki帮助
GSXAB的知识库
搜索
搜索
外观
登录
个人工具
登录
Advertising:
查看“︁逻辑或”︁的源代码
页面
讨论
简体中文
阅读
查看源代码
查看历史
工具
工具
移至侧栏
隐藏
操作
阅读
查看源代码
查看历史
刷新
常规
链入页面
相关更改
特殊页面
页面信息
外观
移至侧栏
隐藏
←
逻辑或
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[分类:二值变量运算]] {{InfoBox |name=逻辑或 |eng_name=logical OR |aliases=逻辑加法,logical addition }} '''逻辑或'''('''logical OR''')指[[二值变量]]的一种[[运算]],相当于[[命题]][[真值]]间的[[析取]]联结词。与[[模 n 剩余类环|模 2 剩余类环]]上的加法类似(实际为取大),故也称为'''逻辑加法'''。 对[[三值逻辑变量]],也存在对应逻辑或的同名运算。 == 定义 == {{Operation |name=逻辑或 |operand=二值变量 |result=二值变量 |prototype=布尔代数 |domain=<math>\mathbb{B} \times \mathbb{B}</math> |codomain=<math>\mathbb{B}</math> }} 对二值变量 <math>x, y \in \mathbb{B} = \{0,1\}</math> ,将二元运算 <math>(1,1)\mapsto 1; (0,1)\mapsto 1;(1,0)\mapsto 1;(0,0)\mapsto 0</math> 称为'''逻辑或'''('''logical OR''')运算,也称为'''逻辑加法'''运算,记作 <math>x + y</math> 。也有人记作 <math>x | y</math> 、 <math>x || y</math> 或 <math>x\lor y</math> 。 === 乘法表 === {| class='wikitable' |- ! <math>+</math> ! T ! F |- ! T | style='background-color: rgba(0,255,0,0.1)' | T | style='background-color: rgba(0,255,0,0.1)' | T |- ! F | style='background-color: rgba(0,255,0,0.1)' | T | style='background-color: rgba(255,0,0,0.1)' | F |} == 性质 == 运算性质: * [[结合律]] * [[交换律]] * 对[[逻辑与]]满足[[分配律]] * 和逻辑与满足互相的[[吸收律]] * 与逻辑与、[[逻辑非]]满足德·摩根律 == 多元逻辑与 == 由于是一种符合结合律的运算,可以定义多元逻辑或运算。 == 变体 == === 短路逻辑或 === 在编程语言中,逻辑或通常被处理成一种短路的运算,也就是说两个操作数间存在一个[[顺序点]],当左侧可以确认为 <code>true</code> 时,不再计算右侧操作数的值。 === 三值逻辑与 === 对[[三值逻辑变量]],也存在对应逻辑或的同名运算。 {| class='wikitable' |- ! <math>+</math> ! T ! U ! F |- ! T | style='background-color: rgba(0,255,0,0.1)' | T | style='background-color: rgba(0,255,0,0.1)' | T | style='background-color: rgba(0,255,0,0.1)' | T |- ! U | style='background-color: rgba(0,255,0,0.1)' | T | U | U |- ! F | style='background-color: rgba(0,255,0,0.1)' | T | U | style='background-color: rgba(255,0,0,0.1)' | F |}
返回
逻辑或
。
Advertising: