Allow clean workspace bits, as in standard reversible computation. Boolean algebra expresses any Boolean function as XORs of ANDs and constants. A Toffoli gate maps to , so an initially zero target computes an AND without erasing the inputs. A CNOT gate accumulates XORs, and a NOT gate supplies complemented bits or constants. Intermediate products can be computed into workspace, XORed into an output, and then uncomputed by reversing the workspace computation. This realizes the reversible embedding for any Boolean function and, with reversible clean-up, universal reversible classical computation.
The Fredkin transformation has control and targets . A network of three gates, shown in i, is
where the sequence is executed left to right. After the first gate ; after the second ; and the last gives . If , ; if , . Thus the circuit is exactly a Fredkin gate.
The workspace qualification matters for the unrestricted universality claim. On four or more wires, every embedded NOT, CNOT and Toffoli gate is an even permutation of all computational states. Without ancillary wires they cannot implement, for example, a permutation swapping just and while fixing the other four-bit strings. Clean ancillas remove this obstruction on the designated input subspace.
A two-query network begins in , calls , flips the input with , calls again, and measures the answer wire in Z. The successive states are
The measured answer is zero for constant functions and one for balanced functions. The circuit is drawn in i.
Explicit oracle circuits follow from the form :
Thus the four circuits, respectively for the truth tables in i, are the identity on both wires; a NOT on the answer wire; a CNOT from input to answer; and a CNOT together with an answer NOT. The latter commute, so their order is immaterial. These circuits leave the input wire unchanged and XOR precisely into the answer.
Let be as in i. Insert the explicit oracle from ii between the two pairs of Hadamard gates. The network identities
turn the entire network into
This is the last simplified circuit in i. On the designated input , its reversed control is certainly one, so
The global phase is unobservable. Measuring the first wire therefore determines the function class with certainty after one oracle query, while the second wire returns to . These circuit identities are the network form of quantum phase kickback: the answer state between the Hadamards is the eigenstate , on which an XOR acts as a phase.