# Functional completeness

In logic, a functionally complete set of logical connectives or Boolean operators is one which can be used to express all possible truth tables by combining members of the set into a Boolean expression.[1][2] A well-known complete set of connectives is { AND, NOT }, consisting of binary conjunction and negation. The singleton sets { NAND } and { NOR } are also functionally complete.

In a context of propositional logic, functionally complete sets of connectives are also called (expressively) adequate.[3]

From the point of view of digital electronics, functional completeness means that every possible logic gate can be realized as a network of gates of the types prescribed by the set. In particular, all logic gates can be assembled from either only binary NAND gates, or only binary NOR gates.

## Formal definition

Given the Boolean domain B = {0,1}, a set F of Boolean functions ƒiBni → B is functionally complete if the clone on B generated by the basic functions ƒi contains all functions ƒBn → B, for all strictly positive integers n ≥ 1. In other words, the set is functionally complete if every Boolean function that takes at least one variable can be expressed in terms of the functions ƒi. Since every Boolean function of at least one variable can be expressed in terms of binary Boolean functions, F is functionally complete if and only if every binary Boolean function can be expressed in terms of the functions in F.

A more natural condition would be that the clone generated by F consist of all functions ƒBn → B, for all integers n ≥ 0. However, the examples given above are not functionally complete in this stronger sense because it is not possible to write a nullary function, i.e. a constant expression, in terms of F if F itself does not contain at least one nullary function. With this stronger definition, the smallest functionally complete sets would have 2 elements.

Another natural condition would be that the clone generated by F together with the two nullary constant functions be functionally complete or, equivalently, functionally complete in the strong sense of the previous paragraph. The example of the Boolean function given by S(xyz) = z if x = y and S(xyz) = x otherwise shows that this condition is strictly weaker than functional completeness.[4][5][6]

## Informal definition

Modern texts on logic typically take as primitive some subset of the connectives: conjunction (${\displaystyle \land }$), or Kpq; disjunction (${\displaystyle \lor }$), or Apq; negation (${\displaystyle \neg }$), Np; or material conditional (${\displaystyle \to }$), or Cpq; and possibly the biconditional (${\displaystyle \leftrightarrow }$), or Epq. These connectives are functionally complete. However, they do not form a minimal functionally complete set, as the conditional and biconditional may be defined as:

{\displaystyle {\begin{aligned}A\to B&:=\neg A\lor B\\A\leftrightarrow B&:=(A\to B)\land (B\to A).\end{aligned}}}

So ${\displaystyle \{\neg ,\land ,\lor \}}$ is also functionally complete. But then, ${\displaystyle \lor }$ can be defined as

${\displaystyle A\lor B:=\neg (\neg A\land \neg B).}$

${\displaystyle \land }$ can also be defined in terms of ${\displaystyle \lor }$ in a similar manner.

It is also the case that ${\displaystyle \vee }$ can be defined in terms of ${\displaystyle \rightarrow }$ as follows:

${\displaystyle \ A\vee B:=(A\rightarrow B)\rightarrow B.}$

No further simplifications are possible. Hence ${\displaystyle \neg }$ and one of ${\displaystyle \{\land ,\lor ,\rightarrow \}}$ are each minimal functionally complete subsets of ${\displaystyle \{\neg ,\land ,\lor ,\to ,\leftrightarrow \}}$.

## Characterization of functional completeness

Template:Further2 Emil Post proved that a set of logical connectives is functionally complete if and only if it is not a subset of any of the following sets of connectives:

In fact, Post gave a complete description of the lattice of all clones (sets of operations closed under composition and containing all projections) on the two-element set {T, F}, nowadays called Post's lattice, which implies the above result as a simple corollary: the five mentioned sets of connectives are exactly the maximal clones.

## Minimal functionally complete operator sets

When a single logical connective or Boolean operator is functionally complete by itself, it is called a Sheffer function[7] or sometimes a sole sufficient operator. There are no unary operators with this property, and the only binary Sheffer functions — NAND and NOR are dual. These were discovered but not published by Charles Sanders Peirce around 1880, and rediscovered independently and published by Henry M. Sheffer in 1913.[8] In digital electronics terminology, the binary NAND gate and the binary NOR gate are the only binary universal logic gates.

The following are the minimal functionally complete sets of logical connectives with arity ≤ 2:[9]

One element
{NAND}, {NOR}.
Two elements
{${\displaystyle \vee }$, ¬}, {${\displaystyle \wedge }$, ¬}, {→, ¬}, {←, ¬}, {→, ${\displaystyle \bot }$}, {←, ${\displaystyle \bot }$}, {→, ${\displaystyle \not \leftrightarrow }$}, {←, ${\displaystyle \not \leftrightarrow }$}, {→, ${\displaystyle \not \to }$}, {→, ${\displaystyle \not \leftarrow }$}, {←, ${\displaystyle \not \to }$}, {←, ${\displaystyle \not \leftarrow }$}, {${\displaystyle \not \to }$, ¬}, {${\displaystyle \not \leftarrow }$, ¬}, {${\displaystyle \not \to }$${\displaystyle \top }$}, {${\displaystyle \not \leftarrow }$${\displaystyle \top }$}, {${\displaystyle \not \to }$${\displaystyle \leftrightarrow }$}, {${\displaystyle \not \leftarrow }$${\displaystyle \leftrightarrow }$}.
Three elements
{${\displaystyle \lor }$, ${\displaystyle \leftrightarrow }$, ${\displaystyle \bot }$}, {${\displaystyle \lor }$, ${\displaystyle \leftrightarrow }$, ${\displaystyle \not \leftrightarrow }$}, {${\displaystyle \lor }$, ${\displaystyle \not \leftrightarrow }$, ${\displaystyle \top }$}, {${\displaystyle \land }$, ${\displaystyle \leftrightarrow }$, ${\displaystyle \bot }$}, {${\displaystyle \land }$, ${\displaystyle \leftrightarrow }$, ${\displaystyle \not \leftrightarrow }$}, {${\displaystyle \land }$, ${\displaystyle \not \leftrightarrow }$, ${\displaystyle \top }$}.

There are no minimal functionally complete sets of more than three at most binary logical connectives.[9] Constant unary or binary connectives and binary connectives that depend only on one of the arguments have been suppressed to keep the list readable. E.g. the set consisting of binary ${\displaystyle \vee }$ and the binary connective given by negation of the first argument (ignoring the second) is another minimal functionally complete set.

## Examples

• Examples of using the NAND completeness. As illustrated by,[10]
• ¬A = A NAND A
• A ∧ B = ¬(A NAND B) = (A NAND B) NAND (A NAND B)
• A ∨ B = (A NAND A) NAND (B NAND B)
• Examples of using the NOR completeness. As illustrated by,[11]
• ¬A = A NOR A
• A ∧ B = (A NOR A) NOR (B NOR B)
• A ∨ B = (A NOR B) NOR (A NOR B)

Note that, an electronic circuit or a software function is optimized by the reuse, that reduce the number of gates. For instance, the "A ∧ B" operation, when expressed by NAND gates, is implemented with the reuse of "A NAND B",

X = (A NAND B); A ∧ B = X NAND X

## In other domains

Apart from logical connectives (Boolean operators), functional completeness can be introduced in other domains. For example, a set of reversible gates is called functionally complete, if it can express every reversible operator.

The 3-input Fredkin gate is functionally complete reversible gate by itself – a sole sufficient operator. There are many other three-input universal logic gates, such as the Toffoli gate.

## Set theory

There is an isomorphism between the Algebra of sets and the Boolean algebra, that is, they have the same structure. Then, if we map boolean operators into set operators, the "translated" above text are valid also for sets: there are many "minimal complete set of set-theory operators" that can generate any other set relations. The more popular "Minimal complete operator sets" are {¬, ∩} and {¬, ∪}.

## References

1. {{#invoke:citation/CS1|citation |CitationClass=citation }}. ("Complete set of logical connectives").
2. {{#invoke:citation/CS1|citation |CitationClass=citation }}. ("[F]unctional completeness of [a] set of logical operators").
3. {{#invoke:citation/CS1|citation |CitationClass=citation }}. (Defines "expressively adequate", shortened to "adequate set of connectives" in a section heading.)
4. {{#invoke:citation/CS1|citation |CitationClass=citation }}
5. {{#invoke:citation/CS1|citation |CitationClass=citation }}
6. {{#invoke:citation/CS1|citation |CitationClass=citation }}
7. The term was originally restricted to binary operations, but since the end of the 20th century it is used more generally. {{#invoke:citation/CS1|citation |CitationClass=citation }}.
8. {{#invoke:citation/CS1|citation |CitationClass=citation }}.
9. Wernick, William (1942) "Complete Sets of Logical Functions," Transactions of the American Mathematical Society 51: 117–32. In his list on the last page of the article, Wernick does not distinguish between ← and →, or between ${\displaystyle \not \leftarrow }$ and ${\displaystyle \not \rightarrow }$.
10. "NAND Gate Operations" at http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/nand.html
11. "NOR Gate Operations" at http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/nor.html