Salta al contenuto
Note per Studenti Boolean Algebra - Axioms, Theorems and Function Complement Report

Boolean Algebra - Axioms, Theorems and Function Complement

In questa pagina 7

A digital circuit implements a Boolean function; to pick the simplest circuit the expression is manipulated with the rules of Boolean algebra.

What a Boolean algebra is

A Boolean algebra is a set with two operations, logical sum (OR, ++) and logical product (AND, ⋅\cdot), plus complement (NOT), in which the distributive property, a minimum (00) and a maximum (11) and the complement exist. Boole proposed it for logic in the mid 19th century; Claude Shannon (master's thesis, MIT, 1938) showed that signals in a network of two-state switches (open/closed) obey its rules, which is the origin of digital circuit analysis and design.

Here variables take the values 00 and 11 (binary logic). A Boolean function is an expression of variables, constants 0,10,1 and AND, OR, NOT. An expression is simplified to use fewer gates (smaller, faster, lower power).

Fundamental identities

Identities come in dual pairs: the second follows from the first by swapping AND with OR and 00 with 11.

name OR form AND form (dual)
identity element X+0=XX+0=X X⋅1=XX\cdot1=X
min and max X+1=1X+1=1 X⋅0=0X\cdot0=0
idempotence X+X=XX+X=X X⋅X=XX\cdot X=X
complement X+X‾=1X+\overline X=1 X⋅X‾=0X\cdot\overline X=0
double negation X‾‾=X\overline{\overline X}=X
commutative X+Y=Y+XX+Y=Y+X XY=YXXY=YX
associative X+(Y+Z)=(X+Y)+ZX+(Y+Z)=(X+Y)+Z X(YZ)=(XY)ZX(YZ)=(XY)Z
distributive X(Y+Z)=XY+XZX(Y+Z)=XY+XZ X+YZ=(X+Y)(X+Z)X+YZ=(X+Y)(X+Z)

Example: (A+B)(A+B‾)=A+BB‾=A+0=A(A+B)(A+\overline B)=A+B\overline B=A+0=A. Duality law: if an identity holds, so does its dual. Beware: X+YZ=(X+Y)(X+Z)X+YZ=(X+Y)(X+Z), X+X=XX+X=X and X+1=1X+1=1 hold in Boolean algebra but not in ordinary arithmetic. These rules are the axioms; everything else is deduced from them or checked with a truth table.

De Morgan's theorem

X+Y‾=X‾⋅Y‾,X⋅Y‾=X‾+Y‾.\overline{X+Y}=\overline X\cdot\overline Y,\qquad\overline{X\cdot Y}=\overline X+\overline Y .

Example: A+B‾ C‾=A‾⋅(B+C‾)\overline{A+\overline B\,C}=\overline A\cdot(B+\overline C). It extends to more variables: X+Y+Z‾=X‾ Y‾ Z‾\overline{X+Y+Z}=\overline X\,\overline Y\,\overline Z (and not X‾ Y‾+Z‾\overline X\,\overline Y+\overline Z). General form: to complement an expression, swap AND and OR and negate all variables and constants.

Proof by perfect induction (all value combinations) of X+Y‾=X‾ Y‾\overline{X+Y}=\overline X\,\overline Y:

XX YY X+YX+Y X+Y‾\overline{X+Y} X‾\overline X Y‾\overline Y X‾ Y‾\overline X\,\overline Y
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0

De Morgan makes NAND and NOR universal (Logic Gates, Gate Delay and Universal GatesAND, OR, NOT implement the Boolean operations; NAND, NOR, XOR and XNOR derive from them. Every function is described by a truth table with 2^n rows. Multi-input XOR is the odd-parity function. An ideal gate has zero delay; a real gate has a propagation delay t_G (different for 0 to 1 and 1 to 0), so the output changes t_G after the input. NAND and NOR are each universal.Logic Gates, Gate Delay and Universal Gates →): X+Y=X‾ Y‾‾X+Y=\overline{\overline X\,\overline Y}.

Simplification theorems

name form proof
absorption X+XY=XX+XY=X X(1+Y)=XX(1+Y)=X
absorption (dual) X(X+Y)=XX(X+Y)=X dual
X+X‾Y=X+YX+\overline XY=X+Y (X+X‾)(X+Y)=X+Y(X+\overline X)(X+Y)=X+Y
adjacency XY+XY‾=XXY+X\overline Y=X X(Y+Y‾)=XX(Y+\overline Y)=X
consensus XY+X‾Z+YZ=XY+X‾ZXY+\overline XZ+YZ=XY+\overline XZ below

Consensus. The term YZYZ is always covered by one of the other two: if X=1X=1 and Y=Z=1Y=Z=1 it is covered by XYXY; if X=0X=0 by X‾Z\overline XZ. Algebraically, multiply YZYZ by (X+X‾)=1(X+\overline X)=1: XY+X‾Z+YZ=XY+X‾Z+XYZ+X‾YZ=XY(1+Z)+X‾Z(1+Y)=XY+X‾Z.XY+\overline XZ+YZ=XY+\overline XZ+XYZ+\overline XYZ=XY(1+Z)+\overline XZ(1+Y)=XY+\overline XZ . Dual form: (X+Y)(X‾+Z)(Y+Z)=(X+Y)(X‾+Z)(X+Y)(\overline X+Z)(Y+Z)=(X+Y)(\overline X+Z). Consensus turns three products into two: one AND and one OR input saved.

Example. F=A+A‾B+A‾ B‾C=A+A‾(B+B‾C)=A+A‾(B+C)=A+B+CF=A+\overline AB+\overline A\,\overline BC=A+\overline A(B+\overline BC)=A+\overline A(B+C)=A+B+C. Check: the only combination giving 00 is A=B=C=0A=B=C=0.

Complement of a function

The complement F‾\overline F has the truth table with 00 and 11 swapped. Two ways to get its expression:

(a) De Morgan. F1=A‾B+AB‾F_1=\overline AB+A\overline B (XOR): F1‾=(A+B‾)(A‾+B)=AB+A‾ B‾\overline{F_1}=(A+\overline B)(\overline A+B)=AB+\overline A\,\overline B (XNOR).

(b) Dual and literal negation. Write the dual (swap AND/OR and 0/10/1) and negate every literal. Same example: dual (A‾+B)(A+B‾)(\overline A+B)(A+\overline B), negated literals (A+B‾)(A‾+B)(A+\overline B)(\overline A+B), as in (a).

F=A+BC‾F=A+B\overline C gives F‾=A‾(B‾+C)\overline F=\overline A(\overline B+C). Richer: F2=A‾B+C(A‾+D)F_2=\overline AB+C(\overline A+D); dual (A‾+B)(C+A‾D)(\overline A+B)(C+\overline AD), negating literals F2‾=(A+B‾)(C‾+AD‾)=AC‾+AD‾+B‾ C‾+AB‾ D‾\overline{F_2}=(A+\overline B)(\overline C+A\overline D)=A\overline C+A\overline D+\overline B\,\overline C+A\overline B\,\overline D, and the last term is absorbed by AD‾A\overline D: F2‾=AC‾+AD‾+B‾ C‾\overline{F_2}=A\overline C+A\overline D+\overline B\,\overline C. A 16-row truth table confirms F2+F2‾=1F_2+\overline{F_2}=1 and F2⋅F2‾=0F_2\cdot\overline{F_2}=0.

Literals and cost

A literal is each occurrence of a variable, direct or negated: AB+A‾CAB+\overline AC has 2 terms and 4 literals. Two cost criteria for a two-level form:

  • number of literals;
  • gate input cost: sum of the inputs of all gates (proportional to transistors and connections, more accurate). For a sum of products: inputs of each AND (with at least 2 literals) plus inputs of the final OR.

F=AB+A‾CF=AB+\overline AC: two 2-input ANDs and a 2-input OR give 2+2+2=62+2+2=6 inputs (4 literals); inverters, if counted, add one input each. The minimum-cost form is not necessarily unique.

Common mistakes

  • Partial De Morgan: X+Y+Z‾≠X‾ Y‾+Z‾\overline{X+Y+Z}\ne\overline X\,\overline Y+\overline Z.
  • Absorption on terms not contained in each other (X+YZ≠XX+YZ\ne X); X+X‾Y≠XX+\overline XY\ne X (it is X+YX+Y).
  • Not checking a long algebraic result with a truth table.

Versione ripasso

  • Identities (dual pairs): X+0=XX+0=X, X⋅1=XX\cdot1=X; X+1=1X+1=1, X⋅0=0X\cdot0=0; X+X=XX+X=X, XX=XXX=X; X+X‾=1X+\overline X=1, XX‾=0X\overline X=0; X‾‾=X\overline{\overline X}=X; commutative, associative; distributive X(Y+Z)=XY+XZX(Y+Z)=XY+XZ and X+YZ=(X+Y)(X+Z)X+YZ=(X+Y)(X+Z).
  • Duality: swap AND/OR and 0/10/1. The second distributive law holds in Boolean algebra, not in ordinary arithmetic.
  • De Morgan: X+Y‾=X‾ Y‾\overline{X+Y}=\overline X\,\overline Y, XY‾=X‾+Y‾\overline{XY}=\overline X+\overline Y; extended: X+Y+Z‾=X‾ Y‾ Z‾\overline{X+Y+Z}=\overline X\,\overline Y\,\overline Z. Proved by perfect induction. Makes NAND and NOR universal (Logic Gates, Gate Delay and Universal GatesAND, OR, NOT implement the Boolean operations; NAND, NOR, XOR and XNOR derive from them. Every function is described by a truth table with 2^n rows. Multi-input XOR is the odd-parity function. An ideal gate has zero delay; a real gate has a propagation delay t_G (different for 0 to 1 and 1 to 0), so the output changes t_G after the input. NAND and NOR are each universal.Logic Gates, Gate Delay and Universal Gates →).
  • Simplification: absorption X+XY=XX+XY=X, X+X‾Y=X+YX+\overline XY=X+Y; adjacency XY+XY‾=XXY+X\overline Y=X; consensus XY+X‾Z+YZ=XY+X‾ZXY+\overline XZ+YZ=XY+\overline XZ (multiply YZYZ by X+X‾X+\overline X), dual (X+Y)(X‾+Z)(Y+Z)=(X+Y)(X‾+Z)(X+Y)(\overline X+Z)(Y+Z)=(X+Y)(\overline X+Z).
  • Example: A+A‾B+A‾ B‾C=A+B+CA+\overline AB+\overline A\,\overline BC=A+B+C.
  • Complement: (a) De Morgan, (b) dual then negate literals. A‾B+AB‾‾=AB+A‾ B‾\overline{\overline AB+A\overline B}=AB+\overline A\,\overline B; A+BC‾‾=A‾(B‾+C)\overline{A+B\overline C}=\overline A(\overline B+C); A‾B+C(A‾+D)‾=AC‾+AD‾+B‾ C‾\overline{\overline AB+C(\overline A+D)}=A\overline C+A\overline D+\overline B\,\overline C.
  • Cost: literals, or gate inputs (SOP: AND inputs plus OR inputs). AB+A‾CAB+\overline AC: 4 literals, 2+2+2=62+2+2=6 inputs.
  • Mistakes: partial De Morgan; absorption on non-contained terms; X+X‾Y≠XX+\overline XY\ne X; no truth-table check.

Teoria collegata