Shannon expansion splits a Boolean function around one of its variables. Pick a variable x. Then:
F = x' · F(x = 0) + x · F(x = 1)
The two pieces are called cofactors:
- F(x = 0) is F with 0 put in for x everywhere.
- F(x = 1) is F with 1 put in for x.
Neither cofactor contains x any more. Why the identity holds: when x = 0 the second term vanishes and you're left with F(x = 0), which is F. When x = 1 the first term vanishes. Either way you get F back.
Now compare with a 2:1 MUX: Y = . Put x on S, F(x = 0) on I0 and F(x = 1) on I1, and the MUX is the expansion. That's why a MUX can build any function.
Expand again on a second variable and you get four cofactors, one per data input of a 4:1 MUX. Keep going and you reach the full truth table. The "0, 1, x or x'" rule of multiplexer implementation is just the cofactors of a 3-variable function after expanding on two variables.
The idea is also the basis of binary decision diagrams, which design tools use to represent large functions.
| F | ||||
|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |