目录 ← 首页
CS61C

Boolean Algebra

Learning Outcomes

  • Identify the AND, OR, and NOT operations in Boolean Algebra.
  • Simplify Boolean Algebra expressions using laws of Boolean Algebra.

In the previous section we explained how to generate a truth-table from a given circuit (we simply need to evaluate it for input combinations). The big question is: How do we go the other way? How do we derive a circuit of logic gates from a truth-table?

Boolean Algebra Operations

We can also define operations for NAND, NOR, and XOR (though these are not considered basic operations).

Why use Boolean Algebra

The value of Boolean algebra for circuit design comes from the fact that Boolean expressions can be manipulated mathematically. In general, it is much easier to manipulate equations than it is to directly manipulate circuits.

  1. Simplify Circuits. A Boolean algebra expression can be simplified. This simplification will lead directly to a circuit simplification. Using fewer gates means using fewer transistors—cheaper and more energy-efficient!

  2. Verify circuits. Another use for Boolean algebra is in circuit verification. Given a circuit and a Boolean equation, we can ask the question, “Do the two different representations represent the same function?” The first step would be to derive a new Boolean expression based on the circuit. Then through algebraic manipulation we could manipulate the expressions until they match, thereby “proving” the eqivalence of the two.

Example

We can use Boolean algebra to verify the below simplification. The first circuit (y=ab+a+cy = ab + a + c), which uses three gates, is equivalent to the second circuit (y=a+cy = a + c), which uses just one OR gate. We describe this approach at the end of this section.

Cascade of an AND on b and a into an OR with a, and then an OR with c to output y, equivalent to y equals a OR c after simplification.

First circuit: y=ab+a+cy = ab + a + c.

Equivalent single two-input OR gate with inputs a and c and output y.

Second equivalent circuit: y=a+cy = a + c.

We will revisit this example.

Laws of Boolean Algebra

Along with Boolean algebra comes a collection of laws that apply to Boolean expressions. These are simple algebraic equalities that are known to be true. We can manipulate other Boolean expressions through successive application of these laws.

#tab-boolean-laws lists the most important of the common Boolean laws.

Some laws are similar to ordinary (non-Boolean) algebra, but many are specific to Boolean algebra and rely on variables taking on precisely two truth values: 1 (true) and 0(false).

Because of the symmetry of Boolean algebra all these laws come in two versions (the two columns above), one being called the dual version of the other. Practically speaking, this means you only need to remember one version of the law, and the other one can be naturally derived.

Proofs

Analyze the proofs below, which fall into two categories:

  • Exhaustive proof, i.e., making truth tables (where again, truth tables enumerate the input/output relationship for all possible input values) then identifying the columns that represent the left-hand and/or right-hand sides of the equation.
  • Algebraic manipulation by using other laws.

::::::{note} Law of 0’s, Law of 1’s :class: dropdown

xxx0x \cdot 0
00
10
xxx+1x + 1
01
11

::::::{note} Idempotence :class: dropdown

xxxxx \cdot x
00
11
xxx+xx + x
00
11

::::::{note} DeMorgan’s Laws :class: dropdown

At a high-level: “distribute” the inversion (e.g., dual) over x, y and operator.

xxyyxyxyxy\overline{xy}x\overline{x}y\overline{y}x+y\overline{x} + \overline{y}
0001111
0101101
1001011
1110000
xxyyx+yx + yx+y\overline{x + y}x\overline{x}y\overline{y}xy\overline{x} \cdot \overline{y}
0001111
0110100
1010010
1110000

Example, revisited

Let us return to the example described above and prove that the first circuit is equivalent to the second circuit.

y=ab+a+cEquation derived from original circuit=a(b+1)+cDistributivity=a(1)+cLaw of 1’s=a+cIdentity (AND)\begin{aligned} y &= ab + a + c && \text{Equation derived from original circuit} \\ &= a(b + 1) + c && \text{Distributivity} \\ &= a(1) + c && \text{Law of 1's} \\ &= a + c && \text{Identity (AND)} \end{aligned}

Footnotes

  1. ab=(a+b)ab=ab+aba \oplus b = (a + b)\overline{ab} = a\overline{b}+\overline{a}b