342 Logical Gate Bases

Thesis. On \(n\) inputs, the Boolean functions are combinations of the \(2^n\) point indicators. These are orthogonal idempotents summing to \(1\), so every function is a sum of cuts, its disjunctive normal form.

Bases. A gate set \(G\) generates a clone \(\langle G\rangle \), the functions obtained by composing gates and projections. NAND, NOR, \(\{\neg ,\wedge \}\) and many other sets generate everything. Which complete basis is used is a choice of presentation, made in practice by circuit cost.

Post’s criterion. A set is complete exactly when it is contained in none of five maximal clones. These are the functions that preserve one of the floor structures:

Completeness is the ability to break each of them.

342.1 Functions as sums of cuts

Point indicators. For \(a\in \{0,1\}^n\) let \(\Pi _a(x)=\prod _ix_i^{a_i}\), with \(x^1=x\) and \(x^0=\neg x\). Then

\begin{equation} \Pi _a^2=\Pi _a, \qquad \Pi _a\Pi _b=\delta _{ab}\Pi _a, \qquad \sum _a\Pi _a=1 . \tag{21261}\end{equation}

Disjunctive normal form. Every \(f\) is the sum of the cuts on which it is \(1\):

\begin{equation} f=\sum _{a:\,f(a)=1}\Pi _a=\bigvee _{a:\,f(a)=1}\ \bigwedge _ix_i^{a_i}, \tag{21262}\end{equation}
where the sum is a disjunction because the \(\Pi _a\) are orthogonal. Hence \(\{\neg ,\wedge ,\vee \}\) generates all \(2^{2^n}\) functions, and so does \(\{\neg ,\wedge \}\), by De Morgan \(x\vee y=\neg (\neg x\wedge \neg y)\), which is the involution conjugating \(\wedge \) to \(\vee \).

Algebraic normal form. Over \(\mathbb F_2\) the same function has a unique expansion in monomials,

\begin{equation} f=\bigoplus _{S\subseteq \{1,\ldots ,n\}}c_S\prod _{i\in S}x_i , \tag{21263}\end{equation}
obtained from the values of \(f\) by the Möbius transform on the subset lattice. It shows that \(\{\oplus ,\wedge ,1\}\) is complete.

342.2 Universal gates

NAND.

\begin{align} \neg A&=A\uparrow A, \tag{21264}\\ A\wedge B&=(A\uparrow B)\uparrow (A\uparrow B), \tag{21265}\\ A\vee B&=(A\uparrow A)\uparrow (B\uparrow B). \tag{21266}\end{align}

NOR.

\begin{align} \neg A&=A\downarrow A, \tag{21267}\\ A\vee B&=(A\downarrow B)\downarrow (A\downarrow B), \tag{21268}\\ A\wedge B&=(A\downarrow A)\downarrow (B\downarrow B). \tag{21269}\end{align}

Each yields \(\{\neg ,\wedge \}\), hence everything. NAND and NOR are exchanged by the involution: \(\neg (x\uparrow y)=\neg x\downarrow \neg y\).

342.3 The five maximal clones

Clone Condition on \(f\) Preserves Primitive
\(P_0\) \(f(0,\ldots ,0)=0\) the value \(0\) sharp value
\(P_1\) \(f(1,\ldots ,1)=1\) the value \(1\) sharp value
\(M\) \(x\le y\Rightarrow f(x)\le f(y)\) the order cone
\(L\) \(f=c_0\oplus \bigoplus _ic_ix_i\) \((\mathbb F_2,\oplus )\) additive structure
\(D\) \(f(\neg x)=\neg f(x)\) the involution \(\neg \)

Each is closed under composition: preserving a structure is preserved by composing. Self-duality says that \(f\) commutes with the involution; \(\neg \) itself is self-dual, since \(\neg (\neg x)=\neg (\neg x)\).

Incomplete sets.

Gate set Clone
\(\{\wedge \}\) conjunctions of variables, \(\subseteq P_0\cap P_1\cap M\)
\(\{\vee \}\) disjunctions of variables, \(\subseteq P_0\cap P_1\cap M\)
\(\{\oplus \}\) \(\bigoplus _ic_ix_i\) with no constant term, \(=L\cap P_0\)
\(\{\neg \}\) \(x_i\) and \(\neg x_i\), \(\subseteq L\cap D\)
\(\{\wedge ,\vee ,0,1\}\) monotone functions, \(=M\)

\(\{\oplus \}\) cannot produce \(\wedge \): every function it generates is affine, while \(xy\) has degree \(2\) in the algebraic normal form. Here \(x\oplus x=0\) gives the constant \(0\) but never \(1\), so the clone is \(L\cap P_0\).

Checking NAND. \(x\uparrow y=1\oplus xy\), and:

NAND lies in none of the five clones, and the same check works for NOR.

342.4 Post’s criterion

Statement.

\begin{equation} \langle G\rangle =\text {all Boolean functions} \iff G\not \subseteq P_0,\ P_1,\ M,\ L,\ D . \tag{21270}\end{equation}

Necessity. Each of the five is a clone, and none contains all functions; so if \(G\) lies in one, so does \(\langle G\rangle \).

Sufficiency. Pick \(f_0\notin P_0\), \(f_1\notin P_1\), \(f_M\notin M\), \(f_L\notin L\) and \(f_D\notin D\) in \(G\). The construction reaches \(\{\neg ,\wedge \}\) in four steps.

1.
Negation or constants. \(g(x)=f_0(x,\ldots ,x)\) has \(g(0)=1\). If \(g(1)=0\), then \(g=\neg \). Otherwise \(g\equiv 1\), and \(h(x)=f_1(x,\ldots ,x)\) has \(h(1)=0\), so \(h=\neg \) or \(h\equiv 0\). Either \(\neg \) is available, or both constants are.
2.
Both constants. If \(\neg \) is available: since \(f_D\) is not self-dual, there is \(a\) with \(f_D(\neg a)=f_D(a)\). Substituting \(x\) for coordinates where \(a_i=1\) and \(\neg x\) where \(a_i=0\) gives a one-variable function with equal values at \(x=0,1\), a constant; with \(\neg \), both constants.
3.
Negation from constants. Since \(f_M\) is not monotone, there are \(a\le b\) with \(f_M(a)=1\) and \(f_M(b)=0\). Moving from \(a\) to \(b\) one coordinate at a time, some single step flips the value from \(1\) to \(0\). Fixing the other coordinates by constants gives \(x\mapsto \neg x\).
4.
Conjunction. Since \(f_L\) is not affine, its algebraic normal form has a monomial of degree \(\ge 2\). Fixing all but two of its variables by constants, chosen to keep a degree-\(2\) term, leaves \(xy\oplus \alpha x\oplus \beta y\oplus \gamma \). Composing with \(\neg \) on inputs and output turns this into \(x\wedge y\).

With \(\{\neg ,\wedge \}\), the disjunctive normal form gives every function. \(\square \)

Consequences. A single binary gate is complete iff it is NAND or NOR, since these are the only binary functions outside all five clones. The lattice of all clones (Post’s lattice) is countable.

342.5 Choice of basis

All complete bases agree. All complete bases generate the same set of functions; they differ in circuit size and depth by constant factors. NAND dominates CMOS design because a NAND gate needs four transistors and parallel pull-ups are fast, a property of the device, not of the logic.

Quantum analogue. For quantum circuits, a set such as \(\{H,T,\mathrm {CNOT}\}\) is universal in a weaker sense: it generates a dense subgroup of the unitaries, and any target is approximated to accuracy \(\varepsilon \) with \(O(\log ^c(1/\varepsilon ))\) gates (Solovay–Kitaev). Classical completeness is exact because the function space is finite.

342.6 Summary

Statement Form From
point indicators \(\Pi _a\Pi _b=\delta _{ab}\Pi _a\), \(\sum \Pi _a=1\) idempotents
DNF \(f=\sum _{f(a)=1}\Pi _a\) sum of cuts
\(\{\neg ,\wedge \}\) complete DNF, De Morgan involution
ANF \(\bigoplus c_S\prod _Sx_i\) Möbius transform
NAND, NOR each yields \(\neg ,\wedge \) composition
\(P_0\), \(P_1\) preserve \(0\), \(1\) sharp values
\(M\) preserves \(\le \) cone
\(L\) affine over \(\mathbb F_2\) additive structure
\(D\) commutes with \(\neg \) involution
\(\langle \oplus \rangle \) \(L\cap P_0\) no degree \(2\)
Post’s criterion complete iff in none of five four-step construction
single complete gates NAND, NOR only five checks
choice of basis cost, not logic devices