Toffoli gate

From Academic Kids

In computer science, the Toffoli gate is a universal reversible logic gate, which means that any reversible circuit can be constructed from Toffoli gates.

Contents

Background

A 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(x)=y. From common logic gates, NOT is reversible, as can be seen from its truthtable below.

INPUT OUTPUT
0 1
1 0

The common AND gate is not reversible however. The inputs 00 and 01 both get 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). In a normal gate, input states are 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 charge 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 but allows more general states of the computation (superpositions). Thus, the reversible gates form a subset of gates allowed by quantum mechanics and, if we can compute something reversibly, we can also compute it on a quantum computer.

Universality and Toffoli gate

Any reversible gate must have the same number of input and output bits. (See pigeonhole principle.) For one input bit, there are two possible reversible gates. One of them is NOT. The other is identity gate which maps its input to the output unchanged. For two input bits, the only non-trivial gate is the reversible XOR gate which XORs the first bit to the second bit and leaves the first bit unchanged.

INPUT OUTPUT
0 0 0 0
1 0 1 1
0 1 0 1
1 1 1 0

Unfortunately, there are reversible functions which cannot be computed using just those gates. In other terms, the set consisting of NOT and XOR gates is not universal. If we would like to compute an arbitrary function by reversible gates, we need another gate. One possibility is the Toffoli gate, proposed in 1980 by Toffoli.

This gate has a 3 bit input and output. If the first two bits are set, it flips the third bit. Following is a table over the input and output bits:

INPUT OUTPUT
0 0 0 0 0 0
0 0 1 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
1 0 0 1 0 0
1 0 1 1 0 1
1 1 0 1 1 1
1 1 1 1 1 0

It can be also described as mapping bits a, b and c to a, b and c XOR (a AND b).

Toffoli gate is universal. This means that for any Boolean function f(x1, x2, ..., xm), there is a circuit consisting of Toffoli gates which takes x1, x2, ..., xm and some extra bits to 0 and outputs x1, x2, ..., xm, f(x1, x2, ..., xm). Essentially, this means that Toffoli gate is sufficient for any computation.

Related logic gates

The Fredkin gate is the reversible 3-bit gate that swaps the last two bits if the first bit is 1. Its truthtable is

INPUT OUTPUT
0 0 0 0 0 0
0 0 1 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
1 0 0 1 0 0
1 0 1 1 1 0
1 1 0 1 0 1
1 1 1 1 1 1

It is almost universal and can be used in the same way as the Toffoli gate, except it can't change the total number of 0s or 1s.

The n-bit Toffoli gate is a generalization of Toffoli gate. It takes n bits x1, x2, ..., xn as inputs and outputs n bits. The first n-1 output bits are just x1, ..., xn-1. The last output bit is (x1 AND ... AND xn-1) XOR xn.

Relation to quantum computing

Any reversible gate can be implemented on a quantum computer. Therefore, Toffoli gate can be used for universal quantum computation. Universal quantum computation can be also done in other ways and it remains to be seen whether Toffoli gate will actually be used to build quantum computers. However, it has already played an important role in theoretical research on quantum computing, for example, in quantum error correction.

See also

References

  1. T. Toffoli, "Reversible Computing", MIT Technical Report MIT/LCS/TM-151 (1980).
  2. E. Fredkin and T. Toffoli. Conservative logic. International Journal of Theoretical Physics, 21:219–253, 1982.
Navigation

Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools