4.2 Classical Boolean gates

A single-bit gate acts on one bit at a time. In classical computing, there are two universal single-bit gates, the NOT gate and the Reset gate which, either acting alone or in a sequence, can generate all possible transformations of a single bit.

The NOT gate (Figure 5) simply flips the value of the bit to the alternative value, so a 0 becomes a 1, and a 1 becomes a 0.

Figure 5 The symbol for a NOT gate

A truth table is a convenient way of summarising the action of a gate. The truth table for a NOT gate is given in Table 1.

Table 1 Classical NOT gate truth table

Input Output
0 1
1 0

The Reset gate sets a bit to value 0, regardless of the input state.

Single-bit gates are not sufficient to perform computing: it is also necessary have conditional gates in which an operation on a target bit depends on the state of one or more control bits. It will be helpful to write the two input bits as an ordered pair of values, CT (for example, 01 has C = 0 and T = 1), where C represents the control bit and T the target bit.

An important two-bit gate is the CNOT gate (controlled NOT gate), which performs a NOT operation on the target bit conditional on the state of the control bit being 1; if the control bit is 0, then no operation is applied. The state of the control bit is unchanged by the CNOT operation. Table 2 is the truth table for the CNOT gate.

Table 2 Classical CNOT gate truth table

Input Output
0 0 0 0
0 1 0 1
1 0 1 1
1 1 1 0

To perform classical computing, the bits are set to some initial values and the gates are applied to the bits in an ordered sequence to make an algorithm.

Quantum computing has different sets of universal gates, which include quantum versions of the NOT and CNOT gates.