0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

論理演算

Posted at

論理演算

・ a AND b
 aとbの両方が1(true)であれば1、そうでなければ0(false)
 例)数学と英語の両方が80点以上であれば合格

・ a OR b
 aとbの少なくとも片方が1であれば1、そうでなければ0
 例)数学もしくは英語が80点以上であれば合格

・a XOR b
 aとbのうち一方だけが1であれば1、そうでなければ0 ※aとbの両方が1は0
 例)数学もしくは英語のどちらかが80点以上であれば合格とするが、両方とも80点未満は補修、両方とも80点以上は追加試験

論理演算の演算記号

・AND(論理積演算)
 「・」
 「⋏」:かつ、アンド

・OR(論理和演算)
 「+」
 「⋁」:または、オア

・NOT(否定演算)
 「-」(変数の頭に付与)
「¬」:ひてい、ノット

・XOR(排他的論理和)
 「+[○]」※○の中に+がある。

演算則

・べき等則
 同じ操作を何度繰り返しても、同じ結果が得られる。
 例)A・A・A = A・A = A

・交換の法則
 足し算と掛け算同様に、右左を入れ替えても成り立つ。
 例)A・B = B・A

・結合の法則
 計算する順序が異なっても、同じ結果が得られる。
 例)(A + B) + C = A + (B + C)

・分配の法則
 以下の例を参照
 例)(A・B) + (A・C) = A・(B + C)
 BとCにかかっているAは、BとCを計算した結果とAを計算しても同じ結果を得られる。

・吸収の法則
 例)A + (A・B) = A

図:吸収の法則の説明
image.png

 2つの図で重なっている部分はAの範囲そのものであるため、A + (A・B) = Aとすることができる。

 
 例)A・(A + B) = A

図:吸収の法則の説明
image.png

 強引に聞こえるかもしれないが、A・(A + B) は、Aであれば範囲内に収まっているため、Bを見る必要がなく、A・(A + B) = Aとすることができる。

 
・ド・モルガンの法則
 例)¬(A・B) = ¬A + ¬B

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?