Toffoli gate

{{Use American English|date=January 2019}}

{{Short description|Universal reversible logic gate, applied in quantum computing}}

In logic circuits, the Toffoli gate, also known as the CCNOT gate (“controlled-controlled-not”), invented by Tommaso Toffoli in 1980 is a CNOT gate with two control bits and one target bit. That is, the target bit (third bit) will be inverted if the first and second bits are both 1. It is a universal reversible logic gate, which means that any classical reversible circuit can be constructed from Toffoli gates. There is also a quantum-computing version where the bits are replaced by qubits.

Description

The truth table and permutation matrix are as follows (the permutation can be written (7,8) in cycle notation):

style="text-align:center"

! Truth table !! Permutation matrix

style="vertical-align:top"

|

{| class="wikitable" style="margin:0; text-align:center"

! colspan="3" | Input

! colspan="3" | Output

000000
001001
010010
011011
100100
101101
110111
111110

|

\begin{bmatrix}

1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\

0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\

0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\

0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\

0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\

0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\

0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\

0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\

\end{bmatrix}

|}

Background

An input-consuming logic gate L is reversible if it meets the following conditions: (1) L(x) = y is a gate where for any output y, there is a unique input x; (2) The gate L is reversible if there is a gate L´(y) = x which maps y to x, for all y.

An example of a reversible logic gate is a NOT, which can be described from its truth table below:

class="wikitable" style="text-align:center"

! Input !! Output

!Condition (1)

!Condition (2)

01

|x = 0 y = 1

|y = 1 x = 0

10

|x = 1 y = 0

|y = 0 x = 1

The common AND gate is not reversible, because the inputs 00, 01 and 10 are all mapped to the output 0.

class="wikitable" style="text-align:center"

! Input !! Output

!Condition (1)

000

|x not unique for y = 0

010

|x not unique for y = 0

10

|0

|x not unique for y = 0

11

|1

|x = 11 y = 1

Reversible gates have been studied since the 1960s. The original motivation was that reversible gates dissipate less heat (or, in principle, no heat).{{cite journal|last=Landauer|first=R.|date=July 1961|title=Irreversibility and Heat Generation in the Computing Process|journal=IBM Journal of Research and Development|volume=5|issue=3|pages=183–191|doi=10.1147/rd.53.0183|issn=0018-8646}}

More recent motivation comes from quantum computing. In quantum mechanics the quantum state can evolve in two ways: by the Schrödinger equation (unitary transformations), or by their collapse. Logic operations for quantum computers, of which the Toffoli gate is an example, are unitary transformations and therefore evolve reversibly.{{cite book|author=Colin P. Williams |year=2011 |title=Explorations in Quantum Computing |publisher=Springer|isbn=978-1-84628-887-6|pages=25–29,61}}

Hardware description

The classical Toffoli gate implemented in the hardware description language Verilog:

module toffoli_gate (

input u1, input u2, input in,

output v1, output v2, output out);

always @(*) begin

v1 = u1;

v2 = u2;

out = in ^ (u1 && u2);

end

endmodule

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 (up to symmetry) is the controlled NOT gate (CNOT), which XORs the first bit to the second bit and leaves the first bit unchanged.

style="text-align:center"

! Truth table !! Permutation matrix form

style="vertical-align:top"

|

{| class="wikitable" style="margin:0; text-align:center"

! colspan="2" | Input

! colspan="2" | Output

0000
0101
1011
1110

|

\begin{bmatrix}

1 & 0 & 0 & 0 \\

0 & 1 & 0 & 0 \\

0 & 0 & 0 & 1 \\

0 & 0 & 1 & 0 \\

\end{bmatrix}

|}

Unfortunately, there are reversible functions that cannot be computed using just those gates. For example, AND cannot be achieved by those gates. In other words, the set consisting of NOT and XOR gates is not universal. To compute an arbitrary function using reversible gates, the Toffoli gate, proposed in 1980 by Toffoli, can indeed achieve the goal.Technical Report MIT/LCS/TM-151 (1980) and an adapted and condensed version:

{{cite conference

|url = http://pm1.bu.edu/~tt/publ/revcomp-rep.pdf

|title = Reversible computing

|first = Tommaso

|last = Toffoli

|authorlink = Tommaso Toffoli

|year = 1980

|conference = Automata, Languages and Programming, Seventh Colloquium

|editor = J. W. de Bakker and J. van Leeuwen

|publisher = Springer Verlag

|location = Noordwijkerhout, Netherlands

|pages = 632–644

|doi = 10.1007/3-540-10003-2_104

|isbn = 3-540-10003-2

|url-status = dead

|archiveurl = https://web.archive.org/web/20100415041123/http://pm1.bu.edu/~tt/publ/revcomp-rep.pdf

|archivedate = 2010-04-15

}} It can be also described as mapping bits {a, b, c} to {a, b, c XOR (a AND b)}. This can also be understood as a modulo operation on bit c: {a, b, c} → {a, b, (c + ab) mod 2}, often written as {a, b, c} → {a, b, cab}.{{Cite book |last1=Nielsen |first1=Michael L. |title=Quantum Computation and Quantum Information |last2=Chuang |first2=Isaac L. |publisher=Cambridge University Press |year=2010 |isbn=9781107002173 |edition=10th |pages=29}}

The Toffoli gate is universal; this means that for any Boolean function f(x1, x2, ..., xm), there is a circuit consisting of Toffoli gates that takes x1, x2, ..., xm and some extra bits set to 0 or 1 to outputs x1, x2, ..., xm, f(x1, x2, ..., xm), and some extra bits (called garbage). A NOT gate, for example, can be constructed from a Toffoli gate by setting the three input bits to {a, 1, 1}, making the third output bit (1 XOR (a AND 1)) = NOT a; (a AND b) is the third output bit from {a, b, 0}. 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

{{more|List of quantum logic gates}}

File:Qcircuit Fredkin.svg

Image:Qcircuit ToffolifromCNOT.svg- and Hadamard-gates, and a minimum of six CNOTs.]]

  • The Fredkin gate is a universal reversible 3-bit gate that swaps the last two bits if the first bit is 1; a controlled-swap operation.
  • The n-bit Toffoli gate is a generalization of the 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.
  • The Toffoli gate can be realized by five two-qubit quantum gates,

{{cite journal

| last1 = Barenco | first1 = Adriano

| last2 = Bennett | first2 = Charles H.

| last3 = Cleve | first3 = Richard

| last4 = DiVincenzo | first4 = David P.

| last5 = Margolus | first5 = Norman

| last6 = Shor | first6 = Peter | authorlink6 = Peter Shor

| last7 = Sleator| first7 = Tycho

| last8 = Smolin| first8 = John A.

| last9 = Weinfurter| first9 = Harald

| date = Nov 1995

| title = Elementary gates for quantum computation

| journal = Physical Review A

| volume = 52

| issue = 5

| pages = 3457–3467

| doi = 10.1103/PhysRevA.52.3457

| arxiv = quant-ph/9503016

| pmid=9912645|bibcode = 1995PhRvA..52.3457B| s2cid = 8764584

}} but it can be shown that it is not possible using fewer than five.{{Cite journal |last1=Yu |first1=Nengkun |last2=Duan |first2=Runyao |last3=Ying |first3=Mingsheng |date=2013-07-30 |title=Five two-qubit gates are necessary for implementing the Toffoli gate |journal=Physical Review A |volume=88 |issue=1 |pages=010304 |doi=10.1103/physreva.88.010304 |arxiv=1301.3372 |bibcode=2013PhRvA..88a0304Y |s2cid=55486826 |issn=1050-2947}}

  • Another universal gate, the Deutsch gate, can be realized by five optical pulses with neutral atoms.

{{cite journal

| last1 = Shi | first1 = Xiao-Feng

| date = May 2018

| title = Deutsch, Toffoli, and CNOT Gates via Rydberg Blockade of Neutral Atoms

| journal = Physical Review Applied

| volume = 9

| issue = 5

| pages = 051001

| doi = 10.1103/PhysRevApplied.9.051001

| arxiv = 1710.01859 | bibcode= 2018PhRvP...9e1001S

| s2cid = 118909059

}} The Deutsch gate is a universal gate for quantum computing.{{Cite journal |last=Deutsch |first=D. |date=1989 |title=Quantum Computational Networks |journal=Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences |volume=425 |issue=1868 |pages=73–90 |doi=10.1098/rspa.1989.0099 |jstor=2398494 |bibcode=1989RSPSA.425...73D |s2cid=123073680 |issn=0080-4630}}

  • The Margolus gate (named after Norman Margolus), also called simplified Toffoli, is very similar to a Toffoli gate but with a −1 in the diagonal: RCCX = diag(1, 1, 1, 1, 1, −1, X). The Margolus gate is also universal for reversible circuits and acts very similar to a Toffoli gate, with the advantage that it can be constructed with about half of the CNOTs compared to the Toffoli gate.{{Cite journal |last=Maslov |first=Dmitri |date=2016-02-10 |title=Advantages of using relative-phase Toffoli gates with an application to multiple control Toffoli optimization |journal=Physical Review A |language=en |volume=93 |issue=2 |pages=022311 |doi=10.1103/PhysRevA.93.022311 |bibcode=2016PhRvA..93b2311M |issn=2469-9926 |doi-access=free |arxiv=1508.03273 }}
  • The iToffoli gate was implemented in superconducting qubits with pair-wise coupling by simultaneously applying noncommuting operations. {{cite journal |last1=Kim |first1=Y. |last2=Morvan |first2=A. |last3=Nguyen |first3=L.B. |last4=Naik |first4=R.K.|last5=Jünger |first5=C.|last6=Chen |first6=L.|last7=Kreikebaum |first7=J.M.|last8=Santiago |first8=D.I.|last9=Siddiqi |first9=I.|title=High-fidelity three-qubit iToffoli gate for fixed-frequency superconducting qubits |journal=Nature Physics |date=2 May 2022 |volume=18 |issue=5 |pages=783–788 |doi=10.1038/s41567-022-01590-3 |bibcode=2022NatPh..18..783K |doi-access=free |arxiv=2108.10288}}

Relation to quantum computing

Any reversible gate can be implemented on a quantum computer,{{Cn|date=February 2025}} and hence the Toffoli gate is also a quantum operator. However, the Toffoli gate cannot 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. Specifically any single-qubit gate with real coefficients{{Clarify|date=February 2025}} that can create a nontrivial quantum state{{Clarify|date=February 2025}} suffices.{{cite journal|last1 = Shi|first1 = Yaoyun|journal = Quantum Information & Computation|volume = 3|issue = 1|pages = 84–92|date = Jan 2003|arxiv = quant-ph/0205115|title = Both Toffoli and Controlled-NOT need little help to do universal quantum computation|doi = 10.26421/QIC3.1-7|bibcode = 2002quant.ph..5115S}}

A Toffoli gate based on quantum mechanics was successfully realized in January 2009 at the University of Innsbruck, Austria.{{cite journal| last1 = Monz| first1 = T.| last2 = Kim| first2 = K.| last3 = Hänsel| first3 = W.| last4 = Riebe| first4 = M.| last5 = Villar| first5 = A. S.| last6 = Schindler| first6 = P.| last7 = Chwalla| first7 = M.| last8 = Hennrich| first8 = M.| last9 = Blatt| first9 = R.|date=Jan 2009| title = Realization of the Quantum Toffoli Gate with Trapped Ions| journal = Physical Review Letters| volume = 102| issue = 4| pages = 040501| doi = 10.1103/PhysRevLett.102.040501| arxiv = 0804.0082| bibcode=2009PhRvL.102d0501M| pmid=19257408| s2cid = 2051775}} While the implementation of an n-qubit Toffoli with circuit model requires 2n CNOT gates,{{cite arXiv|eprint=0803.2316|class=quant-ph|first1=Vivek V.|last1=Shende|first2=Igor L.|last2=Markov|title=On the CNOT-cost of TOFFOLI gates|date=2008-03-15}} the best known upper bound stands at 6n-12 CNOT gates.{{cite journal|arxiv=1508.03273|first1=Dmitri|last1=Maslov|title=Advantages of using relative-phase Toffoli gates with an application to multiple control Toffoli optimization|journal=Physical Review A|year=2016|volume=93|issue=2|page=022311|doi=10.1103/PhysRevA.93.022311|bibcode=2016PhRvA..93b2311M|s2cid=5226873}} It has been suggested that trapped Ion Quantum computers may be able to implement an n-qubit Toffoli gate directly.{{Cite journal|last1=Katz|first1=Or|last2=Cetina|first2=Marko|last3=Monroe|first3=Christopher|date=2022-02-08|title=N -Body Interactions between Trapped Ion Qubits via Spin-Dependent Squeezing|journal=Physical Review Letters |volume=129 |issue=6 |page=063603 |doi=10.1103/PhysRevLett.129.063603 |pmid=36018637 |arxiv=2202.04230|bibcode=2022PhRvL.129f3603K |s2cid=246679905 }} The application of many-body interaction could be used for direct operation of the gate in trapped ions, Rydberg atoms, and superconducting circuit implementations.{{Cite journal| doi = 10.1103/PhysRevA.103.052437| volume = 103| issue = 5| pages = 052437| last1 = Arias Espinoza| first1 = Juan Diego| last2 = Groenland| first2 = Koen| last3 = Mazzanti| first3 = Matteo| last4 = Schoutens| first4 = Kareljan| last5 = Gerritsma| first5 = Rene| title = High-fidelity method for a single-step N-bit Toffoli gate in trapped ions| journal = Physical Review A| date = 2021-05-28 | arxiv = 2010.08490| bibcode = 2021PhRvA.103e2437E| s2cid = 223953418}}{{Cite journal|last1=Khazali|first1=Mohammadsadegh|last2=Mølmer|first2=Klaus|date=2020-06-11|title=Fast Multiqubit Gates by Adiabatic Evolution in Interacting Excited-State Manifolds of Rydberg Atoms and Superconducting Circuits|journal=Physical Review X|language=en|volume=10|issue=2|pages=021054|doi=10.1103/PhysRevX.10.021054|arxiv=2006.07035 |bibcode=2020PhRvX..10b1054K|issn=2160-3308|doi-access=free}}{{Cite journal|last1=Isenhower|first1=L.|last2=Saffman|first2=M.|last3=Mølmer|first3=K.|date=2011-09-04|title=Multibit CkNOT quantum gates via Rydberg blockade|journal=Quantum Information Processing|language=en|volume=10|issue=6|pages=755|doi=10.1007/s11128-011-0292-4|issn=1573-1332|arxiv=1104.3916|s2cid=28732092}}{{Cite journal|last1=Rasmussen|first1=S. E.|last2=Groenland|first2=K.|last3=Gerritsma|first3=R.|last4=Schoutens|first4=K.|last5=Zinner|first5=N. T.|date=2020-02-07|title=Single-step implementation of high-fidelity n -bit Toffoli gates|journal=Physical Review A|volume=101|issue=2|page=022308|doi=10.1103/physreva.101.022308|issn=2469-9926|arxiv=1910.07548|bibcode=2020PhRvA.101b2308R|s2cid=204744044}}{{cite journal |last1=Nguyen |first1=L.B. |last2=Kim |first2=Y. |last3=Hashim |first3=A. |last4=Goss |first4=N.|last5=Marinelli |first5=B.|last6=Bhandari |first6=B.|last7=Das |first7=D.|last8=Naik |first8=R.K.|last9=Kreikebaum |first9=J.M.|last10=Jordan |first10=A.|last11=Santiago |first11=D.I.|last12=Siddiqi |first12=I. |title=Programmable Heisenberg interactions between Floquet qubits

|journal=Nature Physics |date=16 January 2024 |volume=20 |issue=1 |pages=240–246 |doi=10.1038/s41567-023-02326-7 |bibcode=2024NatPh..20..240N |doi-access=free |arxiv=2211.10383}}

{{cite journal | last1=Nguyen | first1=Long B. | last2=Goss | first2=Noah | last3=Siva | first3=Karthik | last4=Kim | first4=Yosep | last5=Younis | first5=Ed | last6=Qing | first6=Bingcheng | last7=Hashim | first7=Akel | last8=Santiago | first8=David I. | last9=Siddiqi | first9=Irfan | title=Empowering a qudit-based quantum processor by traversing the dual bosonic ladder | journal=Nature Communications | date=2024 | volume=15 | issue=1 | page=7117 | doi=10.1038/s41467-024-51434-2 | pmid=39160166 | pmc=11333499 | arxiv=2312.17741 | bibcode=2024NatCo..15.7117N }} Following the dark-state manifold, Khazali-Mølmer Cn-NOT gate operates with only three pulses, departing from the circuit model paradigm. The iToffoli gate was implemented in a single step using three superconducting qubits with pair-wise coupling. {{cite journal |last1=Kim |first1=Y. |last2=Morvan |first2=A. |last3=Nguyen |first3=L.B. |last4=Naik |first4=R.K.|last5=Jünger |first5=C.|last6=Chen |first6=L.|last7=Kreikebaum |first7=J.M.|last8=Santiago |first8=D.I.|last9=Siddiqi |first9=I.|title=High-fidelity three-qubit iToffoli gate for fixed-frequency superconducting qubits |journal=Nature Physics |date=2 May 2022 |volume=18 |issue=5 |pages=783–788 |doi=10.1038/s41567-022-01590-3 |bibcode=2022NatPh..18..783K |doi-access=free |arxiv=2108.10288}}

See also

References

{{reflist|30em}}