查看“︁逻辑或”︁的源代码
←
逻辑或
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[File:Venn0111.svg|thumb|[[文氏图]] <math>A \lor B</math>]] '''逻辑或'''(logical or)又称'''逻辑析取'''(logical disjunction)、'''邏輯選言''',是[[逻辑]]和[[数学]]概念中的一个二元[[逻辑运算符]]。其运算方法是:如果其两个变量中有一个真值为“真”,其结果为“真”,两个变量同时为假,其结果为“假”。 == 定义 == 逻辑或是两个逻辑变量的一种运算,经常是两个命题的运算。它满足:当且仅当其两个变量的真值都为假时,其结果为假。 {{逻辑联结词侧面模板}} == 真值表 == '''A或B'''的[[真值表]],也写作'''A'''<math>\lor</math>'''B'''(逻辑学),'''A | B'''(计算机科学,([[C语言]]为<code>A || B</code>)),或'''A + B'''(电子学)。 {| | {| border="1" cellpadding="1" cellspacing="0" style="text-align:center;" |+ ! style="width:35px;background:#aaaaaa;" | A ! style="width:35px;background:#aaaaaa;" | B ! style="width:35px" | ∨ |- | 真 || 真 || 真 |- | 真 || 假 || 真 |- | 假 || 真 || 真 |- | 假 || 假 || 假 |} | | {{乘法表 | table class = class="wikitable" style="text-align:center;" | first number list = F,T | calculate title = {{unicode|∨}} | expr = {{{left}}} ∨ {{{right}}} | number css = css | number class = boolean }} |} == 性质 == 逻辑或满足以下性质: * [[结合律]]: <math>A \lor (B \lor C) \equiv (A \lor B) \lor C </math> * [[交换律]]: <math>A \lor B \equiv B \lor A </math> * [[分配律]]: <math>(A \lor (B \land C)) \equiv ((A \lor B) \land (A \lor C))</math> :::<math>(A \land (B \lor C)) \equiv ((A \land B) \lor (A \land C))</math> :::<math>(A \lor (B \equiv C)) \equiv ((A \lor B) \equiv (A \lor C))</math> * [[幂等律]]: <math>A \lor A \equiv A </math> * [[单调性]]: <math>(A \rightarrow B) \rightarrow ((C \lor A) \rightarrow (C \lor B))</math> :::<math>(A \rightarrow B) \rightarrow ((A \lor C) \rightarrow (B \lor C))</math> * '''保真性''': 所有变量的真值皆为“真”的命题在'''逻辑或'''运算后的结果为真。 * '''保假性''': 所有变量的真值皆为“假”的命题在'''逻辑或'''运算后的结果为假。 == 计算机科学中的运用 == === 位运算 === '''逻辑或'''常在[[位运算]]中使用,比如: * 0 or 0 = 0 * 0 or 1 = 1 * 1 or 0 = 1 * 1 or 1 = 1 * 1100 or 1010 = 1110 <code>or</code>运算符可以用来将[[比特域]]中的位设定为1,方法是把此域和一个各位均为1的常量域取逻辑或运算。 === 编程中的使用 === ===逻辑运算=== <!-- Many languages distinguish between bitwise and logical disjunction by providing two distinct operators; in languages following C, bitwise disjunction is performed with the single pipe (<code>|</code>) and logical disjunction with the double pipe (<code>||</code>) operators. Logical disjunction is usually [[Short-circuit evaluation|short-circuited]]; that is, if the first (left) operand evaluates to <code>true</code> then the second (right) operand is not evaluated. The logical disjunction operator thus usually constitutes a [[sequence point]]. Although in most languages the type of a logical disjunction expression is boolean and thus can only have the value <code>true</code> or <code>false</code>, in some (such as [[Python programming language|Python]] and [[JavaScript]]) the logical disjunction operator returns one of its operands; the first operand if it evaluates to a true value, and the second operand otherwise. --> === 并集运算 === ''x'' ∈ ''A'' ∪ ''B''⇔( 当且仅当) (''x'' ∈ ''A'') ∨ (''x'' ∈ ''B''). ==自然語言== 就如其他在數理邏輯中形式化的概念一般,自然語言中的「或」和邏輯的「或」高度相關,但有差異。像例如在「你給我打電話,或者寄信給我」這例子中,其真實的意思往往是「你要不就給我打電話,要不就給我寄信,但不要同時寄信和打電話。」,也就是會排除掉兩者皆成立的狀況;在另一方面,在「小橘子姐姐開賽車的駕駛技術神乎其技,因此她很努力,或者她很有天分」這例子中,兩者皆成立的狀況通常並未排除。也就是說,在自然語言中,「或」可以指「邏輯或」,或者是「[[邏輯異或]]」。 == 注释 == <!-- * [[Boole]], closely following analogy with ordinary mathematics, premised, as a necessary condition to the definition of "x + y", that x and y were mutually exclusive. [[Jevons]], and practically all mathematical logicians after him, advocated, on various grounds, the definition of "logical addition" in a form which does not necessitate mutual exclusiveness. --> == 参见 == {{col-begin}} {{col-break}} * [[逻辑异或]] * [[选言肯定]] * [[位运算|位或]] * [[逻辑代数]] * [[布尔代数主题列表]] * [[布尔域]] {{col-break}} * [[布尔函数]] * [[布尔值函数]] * [[选言三段论]] * [[析取消去]] * [[析取引入]] * [[一阶逻辑]] {{col-break}} * [[逻辑图]] * [[逻辑值]] * [[运算]] * [[运算符]] * [[或门]] * [[命题逻辑]] {{col-end}} == 相关网页 == * [http://mathworld.wolfram.com/Disjunction.html Wolfram Mathematics Disjunction] {{Wayback|url=http://mathworld.wolfram.com/Disjunction.html |date=20210109000438 }} * [http://www.allmathwords.org/en/d/disjunction.html All Math Words Encyclopedia Disjunction] {{Wayback|url=http://www.allmathwords.org/en/d/disjunction.html |date=20190610141450 }} {{逻辑联结词}} [[Category:邏輯聯結詞]] [[Category:布尔代数|L]] [[Category:二元運算|L]]
该页面使用的模板:
Template:Col-begin
(
查看源代码
)
Template:Col-break
(
查看源代码
)
Template:Col-end
(
查看源代码
)
Template:Wayback
(
查看源代码
)
Template:乘法表
(
查看源代码
)
Template:逻辑联结词
(
查看源代码
)
Template:逻辑联结词侧面模板
(
查看源代码
)
返回
逻辑或
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息