For faster navigation, this Iframe is preloading the Wikiwand page for 逻辑运算符.

逻辑运算符

此条目没有列出任何参考或来源。 (2018年12月5日)维基百科所有的内容都应该可供查证。请协助补充可靠来源改善这篇条目。无法查证的内容可能会因为异议提出而被移除。

形式逻辑中,逻辑运算符逻辑联结词把语句连接成更复杂的复杂语句。例如,假设有两个逻辑命题,分别是“正在下雨”和“我在屋里”,我们可以将它们组成复杂命题“正在下雨,并且我在屋里”或“没有正在下雨”或“如果正在下雨,那么我在屋里”。一个将两个语句组成的新的语句或命题叫做复合语句复合命题。又称逻辑操作符(Logical Operators)。

基本运算符

基本的操作符有:“”(¬)、“”(∧)、“”(∨)、“条件”(→)以及“双条件”(↔)。“非”是一个一元操作符,它只操作一项(¬ P)。剩下的是二元操作符,操作两项来组成复杂语句(P ∧ Q, P ∨ Q, P → Q, P ↔ Q)。

注意,符号“与”(∧)和交集(∩),“或”(∨)和并集(∪)的相似性。这不是巧合:交集的定义使用“与”,并集的定义是用“或”。

这些连接符的真值表:

P Q ¬P PQ PQ PQ PQ
T T F T T T T
T F F F T F F
F T T F T T F
F F T F F T T

为了减少需要的括号的数量,有以下的优先规则:¬高于∧,∧高于∨,∨高于→。例如,P ∨ Q ∧ ¬ R → S是 (P ∨ (Q ∧ (¬ R)) → S的简便写法。

二元逻辑联结词表

下面是在输入P和Q上的16个二元布尔函数

永假
符号 等价公式 真值表 文氏图
P ¬P
  Q
0 1
P 0    0   0 
1    0   0 




永真
符号 等价公式 真值表 文氏图
P ¬P
  Q
0 1
P 0    1   1 
1    1   1 




合取
符号 等价公式 真值表 文氏图
P Q
P & Q
P · Q
P AND Q
P ¬Q
¬P Q
¬P ¬Q
  Q
0 1
P 0    0   0 
1    0   1 




与非
符号 等价公式 真值表 文氏图
PQ
P | Q
P NAND Q
P → ¬Q
¬PQ
¬P ∨ ¬Q
  Q
0 1
P 0    1   1 
1    1   0 




非蕴涵
符号 等价公式 真值表 文氏图
P Q
P Q
P & ¬Q
¬PQ
¬P ¬Q
  Q
0 1
P 0    0   0 
1    1   0 




蕴涵
符号 等价公式 真值表 文氏图
PQ
P Q
P ↑ ¬Q
¬PQ
¬P ← ¬Q
  Q
0 1
P 0    1   1 
1    0   1 




命题P
符号 等价公式 真值表 文氏图
P
  Q
0 1
P 0    0   0 
1    1   1 




非P
符号 等价公式 真值表 文氏图
¬P
~P
  Q
0 1
P 0    1   1 
1    0   0 




反非蕴涵
符号 等价公式 真值表 文氏图
P Q
P Q
P ↓ ¬Q
¬P & Q
¬P ¬Q
  Q
0 1
P 0    0   1 
1    0   0 




反蕴涵
符号 等价公式 真值表 文氏图
P Q
P Q
P ∨ ¬Q
¬PQ
¬P → ¬Q
  Q
0 1
P 0    1   0 
1    1   1 




命题Q
符号 等价公式 真值表 文氏图
Q
  Q
0 1
P 0    0   1 
1    0   1 




非Q
符号 等价公式 真值表 文氏图
¬Q
~Q
  Q
0 1
P 0    1   0 
1    1   0 




异或
符号 等价公式 真值表 文氏图
P Q
P Q
P Q
P XOR Q
P ↔ ¬Q
¬PQ
¬P ¬Q
  Q
0 1
P 0    0   1 
1    1   0 




双条件
符号 等价公式 真值表 文氏图
PQ
PQ
P XNOR Q
P IFF Q
P ¬Q
¬P Q
¬P ↔ ¬Q
  Q
0 1
P 0    1   0 
1    0   1 




析取
符号 等价公式 真值表 文氏图
PQ
P  Q
P OR Q
P ¬Q
¬PQ
¬P ↑ ¬Q
  Q
0 1
P 0    0   1 
1    1   1 




或非
符号 等价公式 真值表 文氏图
PQ
P NOR Q
P ¬Q
¬P Q
¬P ∧ ¬Q
  Q
0 1
P 0    1   0 
1    0   0 




图示

真值表 哈斯图
input Ainput Boutput f(A,B)X and ¬XA and B¬A and BBA and ¬BAA xor BA or B¬A and ¬BA xnor B¬A¬A or B¬BA or ¬B¬A or ¬BX or ¬X
X or ¬X¬A or ¬BA or ¬B¬A or BA or B¬B¬AA xor BA xnor BAB¬A and ¬BA and ¬B¬A and BA and BX and ¬X
{{bottomLinkPreText}} {{bottomLinkText}}
逻辑运算符
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?