1. 程式人生 > 其它 >Introduction to Boolean Algebra

Introduction to Boolean Algebra

Since binary Values are at the core of how computers encode,store, and manipulate information,

a rich body of mathematical knowledge has evolved around the study of the Values 0 and 1.


The Boolean operation ~ corresponds to the logicaloperation Not, donated by the symbol ¬.

That is, we say that ¬p is true when p is not true, and vice versa.

Correspondingly, ~p equals 1 when p equals 0, ana vice versa.

Boolean operation & corresponds to the logical operation And, denoted by the symbol ∧.

We say that P ∧ Q holds when both p is true and q is true.

Correspondingly, p & q equals 1 only wehn p = 1 and q = 1.

Boolean operation | corresponds to the logical operation or, denoted by the symbol ∨.

We say that p ∨ q holds when either p is true or q is true.

Correspondingly, p | q equals 1 when either p = 1 or q = 1.

Boolean operation ^ corresponds to the logical operation Exclusive-or, denoted by the symbol ⨁.

We say that p⨁ q holds when either p is true or q is true, but not both.

Correspondingly, p ^ q equals 1 when either p = 1 and q = 0, or p = 0 and q = 1.


As example, consider the case where w=4, and when arguments a=[0110] and b=[1100].

Then the four operations a&b, a|b, a^b, and ~b yield.

a & b = 0100

a | b = 1110

a ^ b = 1010

~b = 0011

本文來自部落格園,作者:小白兔奶糖,轉載請大聲說:i love you !