Toffoli gate
In logic circuits, the Toffoli gate (also CCNOT gate), invented by Tommaso Toffoli, is a universal reversible logic gate, which means that any reversible circuit can be constructed from Toffoli gates. It is also known as the "controlledcontrollednot" gate, which describes its action. It has 3bit inputs and outputs; if the first two bits are both set to 1, it inverts the third bit, otherwise all bits stay the same.
Contents
Background[edit]
An inputconsuming logic gate L is reversible if, for any output y, there is a unique input x such that applying L(x) = y. If a gate L is reversible, there is an inverse gate L′, which maps y to x for which L′(y) = x. From common logic gates, NOT is reversible, as can be seen from its truth table below.
INPUT  OUTPUT 

0  1 
1  0 
The common AND gate is not reversible, however. The inputs 00, 01 and 10 are all mapped to the output 0.
Reversible gates have been studied since the 1960s. The original motivation was that reversible gates dissipate less heat (or, in principle, no heat).^{[1]} If we think of a logic gate as consuming its input, information is lost since less information is present in the output than was present at the input. This loss of information loses energy to the surrounding area as heat, because of thermodynamic entropy.^{[citation needed]} Another way to understand this is that charges on a circuit are grounded and thus flow away, taking a small quantity of energy with them when they change state. A reversible gate only moves the states around, and since no information is lost, energy is conserved.^{[citation needed]}
More recent motivation comes from quantum computing. Quantum mechanics requires the transformations to be reversible^{[citation needed]} and allows more general states of the computation than classical computers (superpositions).
Universality and Toffoli gate[edit]
Any reversible gate that consumes its inputs and allows all input computations must have no more input bits than output bits, by the pigeonhole principle. For one input bit, there are two possible reversible gates. One of them is NOT. The other is the identity gate, which maps its input to the output unchanged. For two input bits, the only nontrivial gate is the controlled NOT gate, which XORs the first bit to the second bit and leaves the first bit unchanged.
Truth table  Permutation matrix form  



Unfortunately, there are reversible functions that cannot be computed using just those gates. In other words, the set consisting of NOT and XOR gates is not universal. If we want to compute an arbitrary function using reversible gates, we need another gate. One possibility is the Toffoli gate, proposed in 1980 by Toffoli.^{[2]}
This gate has 3bit inputs and outputs. If the first two bits are set, it flips the third bit. The following is a table of the input and output bits:
Truth table  Permutation matrix form  



It can be also described as mapping bits {a, b, c} to {a, b, c XOR (a AND b)}.
The Toffoli gate is universal; this means that for any Boolean function f(x_{1}, x_{2}, ..., x_{m}), there is a circuit consisting of Toffoli gates that takes x_{1}, x_{2}, ..., x_{m} and some extra bits set to 0 or 1 to outputs x_{1}, x_{2}, ..., x_{m}, f(x_{1}, x_{2}, ..., x_{m}), and some extra bits (called garbage). Essentially, this means that one can use Toffoli gates to build systems that will perform any desired Boolean function computation in a reversible manner.
Related logic gates[edit]
 The Fredkin gate is a universal reversible 3bit gate that swaps the last two bits if the first bit is 1; a controlledswap operation.
 The nbit Toffoli gate is a generalization of Toffoli gate. It takes n bits x_{1}, x_{2}, ..., x_{n} as inputs and outputs n bits. The first n−1 output bits are just x_{1}, ..., x_{n−1}. The last output bit is (x_{1} AND ... AND x_{n−1}) XOR x_{n}.
 The Toffoli gate can be realized by five twoqubit quantum gates.^{[3]}
 A related quantum gate, the Deutsch gate, can be realized by five optical pulses with neutral atoms.^{[4]}
Relation to quantum computing[edit]
Any reversible gate can be implemented on a quantum computer, and hence the Toffoli gate is also a quantum operator. However, the Toffoli gate can not be used for universal quantum computation, though it does mean that a quantum computer can implement all possible classical computations. The Toffoli gate has to be implemented along with some inherently quantum gate(s) in order to be universal for quantum computation. In fact, any singlequbit gate with real coefficients that can create a nontrivial quantum state suffices.^{[5]} A quantum mechanicsbased Toffoli gate has been successfully realized in January 2009 at the University of Innsbruck, Austria.^{[6]}
See also[edit]
 Fredkin gate
 Reversible computing
 Bijection
 Quantum computing
 Quantum gate
 Quantum programming
 Adiabatic logic
References[edit]
 ^ Landauer, R. (July 1961). "Irreversibility and Heat Generation in the Computing Process". IBM Journal of Research and Development. 5 (3): 183–191. doi:10.1147/rd.53.0183. ISSN 00188646.
 ^ Technical Report MIT/LCS/TM151 (1980) and an adapted and condensed version: Toffoli, Tommaso (1980). J. W. de Bakker and J. van Leeuwen, ed. Reversible computing (PDF). Automata, Languages and Programming, Seventh Colloquium. Noordwijkerhout, Netherlands: Springer Verlag. pp. 632–644. doi:10.1007/3540100032_104. ISBN 3540100032. Archived from the original (PDF) on 20100415.
 ^ Barenco, Adriano; Bennett, Charles H.; Cleve, Richard; DiVincenzo, David P.; Margolus, Norman; Shor, Peter; Sleator, Tycho; Smolin, John A.; Weinfurter, Harald (Nov 1995). "Elementary gates for quantum computation". Physical Review A. American Physical Society. 52 (5): 3457–3467. arXiv:quantph/9503016. Bibcode:1995PhRvA..52.3457B. doi:10.1103/PhysRevA.52.3457. PMID 9912645.
 ^ Shi, XiaoFeng (May 2018). "Deutsch, Toffoli, and CNOT Gates via Rydberg Blockade of Neutral Atoms". Physical Review Applied. American Physical Society. 9 (5): 051001. arXiv:1710.01859. Bibcode:2018PhRvP...9e1001S. doi:10.1103/PhysRevApplied.9.051001.
 ^ Shi, Yaoyun (Jan 2003). "Both Toffoli and ControlledNOT need little help to do universal quantum computation". Quantum Information & Computation. 3 (1): 84–92. arXiv:quantph/0205115. Bibcode:2002quant.ph..5115S.
 ^ Monz, T.; Kim, K.; Hänsel, W.; Riebe, M.; Villar, A. S.; Schindler, P.; Chwalla, M.; Hennrich, M.; Blatt, R. (Jan 2009). "Realization of the Quantum Toffoli Gate with Trapped Ions". Physical Review Letters. American Physical Society. 102 (4): 040501. arXiv:0804.0082. Bibcode:2009PhRvL.102d0501M. doi:10.1103/PhysRevLett.102.040501. PMID 19257408.
External links[edit]
 CNOT and Toffoli Gates in MultiQubit Setting at the Wolfram Demonstrations Project.