Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Toffoli gate
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{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<ref name="Toffoli1980"/> 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|reversible circuit]] can be constructed from Toffoli gates. There is also a [[Quantum computing|quantum-computing]] version where the bits are replaced by [[Qubit|qubits]]. ==Description== The [[truth table]] and [[permutation matrix]] are as follows (the permutation can be written (7,8) in [[Cyclic permutation|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 |- | 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 |} | <math> \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} </math> |} == 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 gate|NOT]], which can be described from its truth table below: {| class="wikitable" style="text-align:center" ! Input !! Output !Condition (1) !Condition (2) |- | 0 || 1 |''x'' = 0 ''y'' = 1 |''y'' = 1 ''x'' = 0 |- | 1 || 0 |''x'' = 1 ''y'' = 0 |''y'' = 0 ''x'' = 1 |} The common [[AND gate|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) |- | 00 || 0 |''x'' not unique for ''y'' = 0 |- | 01 || 0 |''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).<ref>{{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}}</ref> More recent motivation comes from [[quantum computing]]. In [[quantum mechanics]] the quantum state can evolve in two ways: by the [[Schrödinger equation]] ([[unitary transformation]]s), or by their [[Wave-function collapse|collapse]]. Logic operations for quantum computers, of which the Toffoli gate is an example, are unitary transformations and therefore evolve reversibly.<ref name="Williams">{{cite book|author=Colin P. Williams |year=2011 |title=Explorations in Quantum Computing |publisher=[[Springer Science+Business Media|Springer]]|isbn=978-1-84628-887-6|pages=25–29,61}}</ref> == Hardware description == The classical Toffoli gate implemented in the hardware description language [[Verilog]]: <syntaxhighlight lang="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 </syntaxhighlight> == 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 computing|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 [[XOR gate|XOR]]s 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 |- | 0 || 0 || 0 || 0 |- | 0 || 1 || 0 || 1 |- | 1 || 0 || 1 || 1 |- | 1 || 1 || 1 || 0 |} | <math> \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{bmatrix} </math> |} 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 [[functional completeness|universal]]. To compute an arbitrary function using reversible gates, the Toffoli gate, proposed in 1980 by Toffoli, can indeed achieve the goal.<ref name="Toffoli1980">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 [[Jan van Leeuwen|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 }}</ref> 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'', ''c'' ⨁ ''ab''}.<ref>{{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}}</ref> The Toffoli gate is universal; this means that for any [[Boolean function]] ''f''(''x''<sub>1</sub>, ''x''<sub>2</sub>, ..., ''x''<sub>''m''</sub>), there is a circuit consisting of Toffoli gates that takes ''x''<sub>1</sub>, ''x''<sub>2</sub>, ..., ''x''<sub>''m''</sub> and some extra bits set to 0 or 1 to outputs ''x''<sub>1</sub>, ''x''<sub>2</sub>, ..., ''x''<sub>''m''</sub>, ''f''(''x''<sub>1</sub>, ''x''<sub>2</sub>, ..., ''x''<sub>''m''</sub>), 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|thumb|126x126px|The Fredkin gate]] [[Image:Qcircuit ToffolifromCNOT.svg|thumb|405x405px|The Toffoli gate can be constructed from single qubit [[Quantum logic gate#Phase shift gates|T]]- and [[Hadamard transform#Quantum computing applications|Hadamard]]-gates, and a minimum of six [[Controlled NOT gate|CNOT]]s.]] * 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 ''x''<sub>1</sub>, ''x''<sub>2</sub>, ..., ''x''<sub>''n''</sub> as inputs and outputs ''n'' bits. The first ''n'' − 1 output bits are just ''x''<sub>1</sub>, ..., ''x''<sub>''n''−1</sub>. The last output bit is (''x''<sub>1</sub> AND ... AND ''x''<sub>''n''−1</sub>) XOR ''x''<sub>''n''</sub>. * The Toffoli gate can be realized by five two-[[qubit]] [[quantum gate]]s,<ref> {{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 }}</ref> but it can be shown that it is not possible using fewer than five.<ref>{{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}}</ref> * Another universal gate, the [[Quantum logic gates#Deutsch gate|Deutsch gate]], can be realized by five optical pulses with neutral atoms.<ref> {{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 }}</ref> The Deutsch gate is a universal gate for quantum computing.<ref>{{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}}</ref> * 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.<ref>{{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 }}</ref> * The iToffoli gate was implemented in superconducting qubits with pair-wise coupling by simultaneously applying noncommuting operations. <ref>{{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}}</ref> == 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.<ref>{{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}}</ref> A Toffoli gate based on [[quantum mechanics]] was successfully realized in January 2009 at the University of Innsbruck, Austria.<ref>{{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}}</ref> While the implementation of an ''n''-qubit Toffoli with circuit model requires <math>2n</math> CNOT gates,<ref>{{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}}</ref> the best known upper bound stands at <math>6n-12</math> CNOT gates.<ref name=":0">{{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}}</ref> It has been suggested that trapped Ion Quantum computers may be able to implement an ''n''-qubit Toffoli gate directly.<ref>{{Cite journal|last1=Katz|first1=Or|last2=Cetina|first2=Marko|last3=Monroe|first3=Christopher|date=2022-02-08|title=<math>N</math> -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 }}</ref> The application of many-body interaction could be used for direct operation of the gate in trapped ions, [[Rydberg atom]]s, and superconducting circuit implementations.<ref>{{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}}</ref><ref name="Molmer1">{{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}}</ref><ref>{{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}}</ref><ref>{{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}}</ref><ref>{{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}} </ref><ref name="Nguyen Goss Siva Kim 2023 q896">{{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 }}</ref> Following the dark-state manifold, Khazali-Mølmer C<sub>n</sub>-NOT gate<ref name="Molmer1"/> 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. <ref>{{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}}</ref> == See also == * [[Controlled NOT gate]] * [[Fredkin gate]] * [[Reversible computing]] * [[Bijection]] * [[Quantum computing]] * [[Quantum logic gate]] * [[Quantum programming]] * [[Adiabatic logic]] == References == {{reflist|30em}} ==External links== * [http://demonstrations.wolfram.com/CNOTAndToffoliGatesInMultiQubitSetting/ CNOT and Toffoli Gates in Multi-Qubit Setting] at the Wolfram Demonstrations Project. {{DEFAULTSORT:Toffoli Gate}} [[Category:Logic gates]] [[Category:Quantum gates]] [[Category:Reversible computing]] [[Category:Italian inventions]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite arXiv
(
edit
)
Template:Cite book
(
edit
)
Template:Cite conference
(
edit
)
Template:Cite journal
(
edit
)
Template:Clarify
(
edit
)
Template:Cn
(
edit
)
Template:More
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use American English
(
edit
)