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 classical reversible circuit can be constructed from Toffoli gates. It is also known as the "controlled-controlled-not" gate, which describes its action. It has 3-bit inputs and outputs; if the first two bits are both set to 1, it inverts the third bit, otherwise all bits stay the same.
Background.
An input-consuming logic gate "L" is reversible if it meets the following conditions:
"L"("x") = "y" is a gate where for any output "y", there is a unique input "x".
The gate "L" is reversible if there is a gate "L"′("y") = "x" which maps "y" to "x".
From common logic gates, NOT is reversible, as can be seen from its truth table below.
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). 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. 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.
More recent motivation comes from quantum computing. Quantum mechanics requires the transformations to be reversible, because quantum mechanics is unitary theory and unitary transformations are invertible. Moreover, quantum mechanics allows more general states of the computation than classical computers (superpositions).
Universality and Toffoli gate.
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 non-trivial gate is the controlled NOT gate, which XORs the first bit to the second bit and leaves the first bit unchanged.
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.
This gate has 3-bit 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:
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.
Relation to quantum computing.
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 single-qubit gate with real coefficients that can create a nontrivial quantum state suffices.
A Toffoli gate based on quantum mechanics was successfully realized in January 2009 at the University of Innsbruck, Austria. The application of many-body interaction could be used for direct operation of the gate in Rydberg atoms and superconducting circuit implementations. While the implementation of an n-qubit Toffoli with circuit model requires 2n C-NOT gates, the best known upper bound stands at 6n-12 C-NOT gates.