Boolean algebra

I’m learning this in an engineering class so this is might be an “engineer’s perspective” on boolean algebra.

Truth value

True or false.

True is represented by the number 1, and false by the number 0.

And

xyxy is true when xx is true and yy is also true.

This is like multiplication. 0 times anything is 0, so the only way to multiply two booleans and get 1 is if they are both one. This motivates why AND is written like multiplication: xyzxyz. The unit for AND is 11; anding anything with 1 will leave it unchanged.

This is also similar to the “min” function that returns the smallest number.

In logic gates diagrams, “and” is represented with a straight back.

Or

x+yx + y is true when xx is true or yy is true. (Or both.)

This is like saturating addition (where instead of overflowing 1+11 + 1 to 22, we just cap it to 1.) Under saturating addition, 1 plus anything is 1, so the only way to add two booleans and get 0 is if they are both 0 to begin with. This motivates why OR is written like addition: x+y+zx+y+z. The unit for OR is 00, ORing anything with 0 will leave it unchanged.

This is also similar to the “max” function that returns the largest number.

In logic gate diagrams, “or” is represented with a curved back.

Not

xx' denotes a value that is 0 when x is 1, and 1 when x is 0. It is the negation of xx.

The notation xx' is pronounced “x not”, but in my head I pronounce it “x tick”.

In logic gate diagrams, “not” is represented with a triangle pointing at a small circle.

Logical equivalences

Two functions are logically equivalent if they output the same truth values for all possible inputs.

Here are some handy equivalences which can be used to simplify expressions:

Units

The unit for “and” is 1. 1x=x1x = x. The unit for “or” is 0. x+0=xx + 0 = x.

Applying the wrong unit results in a constant function. 0x=00x = 0, and x+1=1x + 1 = 1.

Commutativity and associativity

Both addition and multiplication are commutative and associative.

Idempotency

X+X=XX + X = X and XX=XXX = X. Easy to see with the truth tables.

Distributivity

Addition and multiplication both distribute over each other.

The usual “FOIL” rules for multiplying polynomials also work.

Double-negation elimination (DNE)

X=XX'' = X. Don’t tell this to certain mathematicians.

Excluded middle (LEM)

X+X=1X + X' = 1. Everything is either true or false.

XX=0XX' = 0. Nothing is both true and false.

DeMorgan’s

As a consequence of DNE and LEM, (X+Y)=XY(X+Y)' = X'Y' and (XY)=X+Y(XY)' = X' + Y'. This helps you turn (negated) products into sums and (negated) sums into products.

Unity and absorption

Unity: XY+XY=XXY + XY' = X, and (X+Y)(X+Y)=X(X+Y)(X+Y') = X. The same expression ends up evaluated regardless of the value of Y.

Absorption: X+XY=XX + XY = X and X(X+Y)=XX(X + Y) = X. The value of Y gets flooded out by X.

Elimination

X+XY=X+YX + X'Y = X + Y. This works because if the XX term of X+XYX + X'Y is not needed to make the expression true, we can assume XX is false and therefore XX' is true.

Same for X(X+Y)=XYX(X'+Y) = XY.

Consensus

XY+XZ+YZ=XY+XZXY + X'Z + YZ = XY + X'Z.

This is a bit subtle:

Duality

The dual of an expression is that expression with all the sums and products exchanged. The dual of (AB)+C(AB)+C is (A+B)C(A+B)C.

Taking the dual does not, in general, preserve the truth value. However, if AA and BB are logically equivalent (and do not include literal 1 or 0), the dual of AA is logically equivalent to the dual of BB.

(That’s how my prof defines it. Other sources say the dual is swapping sums and products and also negating every term, which always flips the truth value. It’s like a generalized DeMorgan’s law.)

Literals

The term “literal” refers to “an input variable or its negation”. If we’re working in a context where AA, BB, and CC are inputs to our system, we have six literals at our disposal: AA, BB, CC, AA', BB', CC'.

This corresponds to digital circuitry: AA, BB, and CC are the input wires, and AA', BB', and CC' correspond to the negations of those wires – I don’t know jack about circuitry, but I think it’s easy to negate an input with some kind of resistor or transistor.

Minterm

A minterm is a product of literals. ABCABC, ABCAB'C, and ABCA'B'C' are examples of minterms.

Maxterm

A maxterm is a sum of literals. A+B+CA+B+C, A+B+CA+B'+C, and A+B+CA'+B'+C' are examples of maxterms.

Sum-of-products and product-of-sums

If an expression is a sum of minterms, it is in “sum of products” form. Looks like (ABC)+(ABC)+(ABC)(ABC)+(AB'C)+(A'B'C').

If you have a truth table, you can easily write the expression in “sum of products” form.

If an expression is a product of maxterms, it is in “product of sums” form. Looks like (A+B+C)(A+B+C)(ABC)(A'+B'+C')(A'+B+C')(ABC).

If you have a truth table, you can easily write the expression in “product of sums” form.

Expressions in zero or one literals are also in SOP/POS forms. 00, 11, AA, and AA' are in both sum-of-products and product-of-sums.

Minterm and maxterm expressions.

Dually for the maxterm expansion.

Minterm and maxterm numbers

ABCDA'BCD' -> 01100110 -> minterm 6. If you write the truth table in the standard way this corresponds to row 6 of the table (when rows are ZERO indexed)

Writing maxterms is the same but put a 0 for nonnegated literals and 1 for negated literals!

A+B+C+DA+B'+C'+D -> 01100110 -> maxterm 6.

For all numbers X:

aka, minterm X and maxterm X are duals of each other (where “dual” involves negating all literals)

Finding the negation of a minterm expansion

Dually for negating maxterm expansions.

You can also simply negate the minterm expansion and push the negation through DeMorgan’s laws, but then you’ll have a maxterm expansion instead :) (And dually.)

Converting minterm expansions to maxterm expansions

Dually for maxterm -> minterm expansions.

Minimal sum-of-products/product-of-sums

Just because an expression is in SOP/POS form doesn’t mean it’s as simple as possible. For example, it’s possible to simplify (ABC)+(ABC)(ABC)+(A'BC) to just BCBC because the value of A doesn’t matter (unity).

Sidenote: Why bother?