{"id":1930,"date":"2018-04-06T09:49:04","date_gmt":"2018-04-06T08:49:04","guid":{"rendered":"https:\/\/www.quantum-bits.org\/?p=1930"},"modified":"2022-08-12T17:17:08","modified_gmt":"2022-08-12T16:17:08","slug":"quantum-error-correction","status":"publish","type":"post","link":"https:\/\/www.quantum-bits.org\/?p=1930","title":{"rendered":"Quantum error correction"},"content":{"rendered":"<p>Building a quantum device in the real world means having to deal with <strong>errors<\/strong>: any qubit stored unprotected or transmitted through a communications channel will <strong>inevitably<\/strong> come out changed.<\/p>\n<p>To be protected, quantum devices have to be kept at extremely cold temperatures (a few milikelvins) and shielded from electromagnetic radiation.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1937\" src=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/ibm-quantum-computer.png\" alt=\"\" width=\"350\" height=\"468\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/ibm-quantum-computer.png 860w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/ibm-quantum-computer-225x300.png 225w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/ibm-quantum-computer-768x1026.png 768w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/ibm-quantum-computer-766x1024.png 766w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/p>\n<p>Quantum error correction is used in quantum computing to protect quantum information from errors due to <a class=\"mw-redirect\" title=\"Decoherence\" href=\"https:\/\/en.wikipedia.org\/wiki\/Decoherence\" target=\"_blank\" rel=\"noopener\">decoherence<\/a> and <a title=\"Quantum noise\" href=\"https:\/\/en.wikipedia.org\/wiki\/Quantum_noise\" target=\"_blank\" rel=\"noopener\">quantum noise<\/a>.<\/p>\n<p>It is essential if one is to achieve <strong>fault-tolerant quantum computation<\/strong> that can deal not only with noise on stored quantum information, but also with faulty quantum gates, faulty quantum preparation, and faulty measurements.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-1612\" src=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/03\/quantum-physics-formulas-over-blackboard.jpg\" alt=\"\" width=\"768\" height=\"300\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/03\/quantum-physics-formulas-over-blackboard.jpg 768w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/03\/quantum-physics-formulas-over-blackboard-300x117.jpg 300w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/p>\n<p>In <strong>classical<\/strong> computing, if one wants to <strong>protect<\/strong> a bit against <strong>errors<\/strong>, it can often suffice is to store the information <strong>multiple times<\/strong>.<\/p>\n<p>Let <img src='https:\/\/s0.wp.com\/latex.php?latex=%5Coverline%7B0%7D%3D000&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\\overline{0}=000' title='\\overline{0}=000' class='latex' \/> be a &#8220;logical bit&#8221;, encoding the data bit 0 and let <img src='https:\/\/s0.wp.com\/latex.php?latex=%5Coverline%7B1%7D%3D111&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\\overline{1}=111' title='\\overline{1}=111' class='latex' \/> encode the data bit 1.<\/p>\n<p>We have here a simple repetition code that protects against any one bit flip error. That is, if any of the three bits are flipped, then we can recover the state of the logical bit by taking a <strong>majority vote<\/strong>.&nbsp;<\/p>\n<p>Classical error correcting codes use a <strong>syndrome measurement <\/strong>to diagnose which error corrupts an encoded state. We then reverse an error by <strong>applying a corrective operation<\/strong> based on the syndrome.<\/p>\n<p><strong>No-cloning theorem<\/strong><\/p>\n<p>In physics, the no-cloning theorem states that it is impossible to create an identical copy of an arbitrary unknown quantum state. It proves the <strong>impossibility<\/strong> of a simple perfect non-disturbing measurement scheme. Conversely, the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Quantum_no-deleting_theorem\" target=\"_blank\" rel=\"noopener\">no-deleting<\/a> theorem is the time-reversed dual to this theorem. It states that, given two copies of some arbitrary quantum state, it is impossible to delete one of the copies.<\/p>\n<p>The no-cloning theorem has profound implications in quantum computing. It implies that if we measure each individual qubit and take a majority vote by analogy to classical code above, then we have <strong>lost<\/strong> the precise information that we are trying to protect.<\/p>\n<p>At first sight, the no-cloning theorem seems to present an obstacle to formulating a theory of quantum error correction.<\/p>\n<p>It is nevertheless possible to <strong>spread the information of one qubit<\/strong> onto a highly <strong>entangled<\/strong> state of several qubits. <a title=\"Peter Shor\" href=\"https:\/\/en.wikipedia.org\/wiki\/Peter_Shor\" target=\"_blank\" rel=\"noopener\">Peter Shor<\/a> first discovered this method of formulating a quantum error correcting code by storing the information of one qubit onto a highly entangled state of nine qubits.<\/p>\n<p><strong>QEC (Quantum Error Correction)<\/strong><\/p>\n<p>Just like classical error correction, QEC also employs syndrome measurements. We perform a multi-qubit measurement that does not disturb the quantum information in the encoded state but retrieves information about the error.<\/p>\n<p>A <strong>syndrome measurement<\/strong> can determine whether a qubit has been corrupted, and if so, which one. What is more, the outcome of this operation (the syndrome) tells us not only which physical qubit was affected, but also, in which of several possible ways it was affected.<\/p>\n<p>The syndrome measurement tells us as much as possible about the error that has happened, but <strong>nothing <\/strong>at all about the <strong>value <\/strong>that is stored in the logical qubit\u2014as otherwise the measurement would destroy any quantum superposition of this logical qubit with other qubits in the quantum computer.<\/p>\n<p>In most codes, the effect is either a bit flip, or a sign (of the phase) flip, or both (corresponding to Pauli X, Z, and Y matrices):<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1941\" src=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuits.png\" alt=\"\" width=\"450\" height=\"277\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuits.png 1132w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuits-300x184.png 300w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuits-768x472.png 768w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuits-1024x630.png 1024w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/p>\n<p>Let&#8217;s get back to the idea of encoding repeated data bits and let&#8217;s define<\/p>\n<ul>\n<li><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C%5Coverline%7B0%7D%5Crangle+%3D+%7C+000+%5Crangle+%3D+%7C0%5Crangle+%5Cotimes+%7C0%5Crangle+%5Cotimes+%7C0%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\\overline{0}\\rangle = | 000 \\rangle = |0\\rangle \\otimes |0\\rangle \\otimes |0\\rangle' title='|\\overline{0}\\rangle = | 000 \\rangle = |0\\rangle \\otimes |0\\rangle \\otimes |0\\rangle' class='latex' \/><\/li>\n<li><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C%5Coverline%7B1%7D%5Crangle+%3D+%7C+111+%5Crangle+%3D+%7C1%5Crangle+%5Cotimes+%7C1%5Crangle+%5Cotimes+%7C1%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\\overline{1}\\rangle = | 111 \\rangle = |1\\rangle \\otimes |1\\rangle \\otimes |1\\rangle' title='|\\overline{1}\\rangle = | 111 \\rangle = |1\\rangle \\otimes |1\\rangle \\otimes |1\\rangle' class='latex' \/><\/li>\n<\/ul>\n<p>Now, let&#8217;s define the following bit-flip errors E and their actions :<\/p>\n<table width=\"450\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\">\n<tbody>\n<tr style=\"border-top: none !important;\">\n<td style=\"text-align: center; border-top: none !important;\">Errors (E)<\/td>\n<td style=\"text-align: left; border-top: none !important;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=E%28%7C%5Coverline%7B0%7D%5Crangle%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(|\\overline{0}\\rangle)' title='E(|\\overline{0}\\rangle)' class='latex' \/><\/td>\n<td style=\"text-align: left; border-top: none !important;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=E%28%7C%5Coverline%7B1%7D%5Crangle%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(|\\overline{1}\\rangle)' title='E(|\\overline{1}\\rangle)' class='latex' \/><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%5Ctextbf%7B1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\\textbf{1}' title='\\textbf{1}' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C000%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|000\\rangle' title='|000\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C111%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|111\\rangle' title='|111\\rangle' class='latex' \/><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=X_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X_0' title='X_0' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C100%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|100\\rangle' title='|100\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C011%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|011\\rangle' title='|011\\rangle' class='latex' \/><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=X_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X_1' title='X_1' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C010%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|010\\rangle' title='|010\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C101%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|101\\rangle' title='|101\\rangle' class='latex' \/><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=X_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X_2' title='X_2' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C001%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|001\\rangle' title='|001\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C110%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|110\\rangle' title='|110\\rangle' class='latex' \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let&#8217;s pause a moment to focus en Pauli measurement. The Pauli Z-matrix is defined as:<\/p>\n<p style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=Z+%3D+%5Cbegin%7Bbmatrix%7D+1+%26+0+%5C%5C+0+%26+-1+%5Cend%7Bbmatrix%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z = \\begin{bmatrix} 1 &amp; 0 \\\\ 0 &amp; -1 \\end{bmatrix}' title='Z = \\begin{bmatrix} 1 &amp; 0 \\\\ 0 &amp; -1 \\end{bmatrix}' class='latex' \/><\/p>\n<p>The Pauli-Z matrix clearly has two eigenvectors <img src='https:\/\/s0.wp.com\/latex.php?latex=%7C0%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|0\\rangle' title='|0\\rangle' class='latex' \/> and <img src='https:\/\/s0.wp.com\/latex.php?latex=%7C1%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|1\\rangle' title='|1\\rangle' class='latex' \/> with eigenvalues \u00b11.<\/p>\n<p>Thus if we measure the qubit and obtain <img src='https:\/\/s0.wp.com\/latex.php?latex=%7C0%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|0\\rangle' title='|0\\rangle' class='latex' \/> we are in the +1 eigenspace (the set of all vectors that are formed of sums of eigenvectors with only positive or only negative eigenvalues) of the operator. Conversely,&nbsp; if we measure <img src='https:\/\/s0.wp.com\/latex.php?latex=%7C1%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|1\\rangle' title='|1\\rangle' class='latex' \/> we are in the \u22121 eigenspace of Z.<\/p>\n<p>This process is referred to in the language of Pauli measurements as &#8220;measuring Pauli Z&#8221; and is equivalent to performing a computational basis measurement.<\/p>\n<p>In that spirit, we will define <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0' title='Z_0' class='latex' \/>, <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_1' title='Z_1' class='latex' \/> and&nbsp;<img src='https:\/\/s0.wp.com\/latex.php?latex=Z_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_2' title='Z_2' class='latex' \/> measurements respectively as &#8220;<img src='https:\/\/s0.wp.com\/latex.php?latex=Z+%5Cotimes+%5Ctextbf%7B1%7D+%5Cotimes+%5Ctextbf%7B1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z \\otimes \\textbf{1} \\otimes \\textbf{1}' title='Z \\otimes \\textbf{1} \\otimes \\textbf{1}' class='latex' \/>&#8220;, &#8220;<img src='https:\/\/s0.wp.com\/latex.php?latex=%5Ctextbf%7B1%7D+%5Cotimes+Z+%5Cotimes+%5Ctextbf%7B1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\\textbf{1} \\otimes Z \\otimes \\textbf{1}' title='\\textbf{1} \\otimes Z \\otimes \\textbf{1}' class='latex' \/>&#8221; and &#8220;<img src='https:\/\/s0.wp.com\/latex.php?latex=%5Ctextbf%7B1%7D+%5Cotimes+%5Ctextbf%7B1%7D+%5Cotimes+Z+&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\\textbf{1} \\otimes \\textbf{1} \\otimes Z ' title='\\textbf{1} \\otimes \\textbf{1} \\otimes Z ' class='latex' \/>&#8220;.<\/p>\n<p>For example, if we measure <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0' title='Z_0' class='latex' \/>, we get a different result for&nbsp;<img src='https:\/\/s0.wp.com\/latex.php?latex=%7C%5Coverline%7B0%7D%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\\overline{0}\\rangle' title='|\\overline{0}\\rangle' class='latex' \/> and&nbsp;<img src='https:\/\/s0.wp.com\/latex.php?latex=%7C%5Coverline%7B1%7D%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\\overline{1}\\rangle' title='|\\overline{1}\\rangle' class='latex' \/>&nbsp; in the no-error case, so that collapses the encoded state.<\/p>\n<p>On the other hand, consider measuring <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1' title='Z_0Z_1' class='latex' \/>, the parity of the first two bits in each computational basis state. Recall that each measurement of a Pauli operator checks which eigenvalue the state being measured corresponds to, so for each state <img src='https:\/\/s0.wp.com\/latex.php?latex=%7C%5Cpsi%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\\psi\\rangle' title='|\\psi\\rangle' class='latex' \/> in the table above, we can compute <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1%7C%5Cpsi%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1|\\psi\\rangle' title='Z_0Z_1|\\psi\\rangle' class='latex' \/> to see if we get \u00b1<img src='https:\/\/s0.wp.com\/latex.php?latex=%7C%5Cpsi%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|\\psi\\rangle' title='|\\psi\\rangle' class='latex' \/>.<\/p>\n<p>Note that <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1%7C000%5Crangle%3D%7C000%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1|000\\rangle=|000\\rangle' title='Z_0Z_1|000\\rangle=|000\\rangle' class='latex' \/> and that <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1%7C111%5Crangle%3D%7C111%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1|111\\rangle=|111\\rangle' title='Z_0Z_1|111\\rangle=|111\\rangle' class='latex' \/>. We conclude that this measurement does the same thing to both encoded states. On the other hand, <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1%7C100%5Crangle%3D-%7C100%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1|100\\rangle=-|100\\rangle' title='Z_0Z_1|100\\rangle=-|100\\rangle' class='latex' \/> and <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1%7C011%5Crangle%3D-%7C011%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1|011\\rangle=-|011\\rangle' title='Z_0Z_1|011\\rangle=-|011\\rangle' class='latex' \/>, so the result of measuring <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1' title='Z_0Z_1' class='latex' \/> reveals useful information about which error occured.<\/p>\n<p>For clarity sake, we now repeat the previous table, but we added the results of measuring <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1' title='Z_0Z_1' class='latex' \/> and <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_1Z_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_1Z_2' title='Z_1Z_2' class='latex' \/> on each row. We also added the results of each measurement, denoted by the sign of the eigenvalue that is observed (either + or \u2212):<\/p>\n<table width=\"450\" cellspacing=\"0\" cellpadding=\"0\" border=\"1\">\n<tbody>\n<tr style=\"border-top: none !important;\">\n<td style=\"text-align: center; border-top: none !important;\">Errors (E)<\/td>\n<td style=\"text-align: left; border-top: none !important;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=E%28%7C%5Coverline%7B0%7D%5Crangle%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(|\\overline{0}\\rangle)' title='E(|\\overline{0}\\rangle)' class='latex' \/><\/td>\n<td style=\"text-align: left; border-top: none !important;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=E%28%7C%5Coverline%7B1%7D%5Crangle%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E(|\\overline{1}\\rangle)' title='E(|\\overline{1}\\rangle)' class='latex' \/><\/td>\n<td style=\"text-align: left; border-top: none !important;\">Result of <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_0Z_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_0Z_1' title='Z_0Z_1' class='latex' \/><\/td>\n<td style=\"text-align: left; border-top: none !important;\">Result of <img src='https:\/\/s0.wp.com\/latex.php?latex=Z_1Z_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Z_1Z_2' title='Z_1Z_2' class='latex' \/><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%5Ctextbf%7B1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\\textbf{1}' title='\\textbf{1}' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C000%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|000\\rangle' title='|000\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C111%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|111\\rangle' title='|111\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\">+<\/td>\n<td style=\"text-align: left;\">+<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=X_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X_0' title='X_0' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C100%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|100\\rangle' title='|100\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C011%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|011\\rangle' title='|011\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\">&#8211;<\/td>\n<td style=\"text-align: left;\">+<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=X_1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X_1' title='X_1' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C010%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|010\\rangle' title='|010\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C101%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|101\\rangle' title='|101\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\">&#8211;<\/td>\n<td style=\"text-align: left;\">&#8211;<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=X_2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='X_2' title='X_2' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C001%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|001\\rangle' title='|001\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\"><img src='https:\/\/s0.wp.com\/latex.php?latex=%7C110%5Crangle&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='|110\\rangle' title='|110\\rangle' class='latex' \/><\/td>\n<td style=\"text-align: left;\">+<\/td>\n<td style=\"text-align: left;\">&#8211;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Thus, the results of the two measurements uniquely determines which bit-flip error occured, but without revealing any information about which state we encoded. These results are a <strong>syndrome<\/strong>, and refer to the <strong>process of mapping a syndrome back to the error that caused it as recovery<\/strong>.<\/p>\n<p>In particular, we emphasize that recovery is a classical inference procedure which takes as its input the syndrome which occured, and returns a prescription for how to fix any errors that may have occured.<\/p>\n<p>Bear in mind that the error channel may induce either a bit flip, a sign flip, or both.<\/p>\n<p>It is possible to correct for both types of errors using one code, and the Shor code does just that. In fact, the Shor code corrects arbitrary single-qubit errors.<\/p>\n<p>The <a class=\"mw-redirect\" title=\"Shor code\" href=\"https:\/\/en.wikipedia.org\/wiki\/Shor_code\" target=\"_blank\" rel=\"noopener\">Shor code<\/a>, encodes 1 logical qubit in 9 physical qubits and can correct for arbitrary errors in a single qubit:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-1971\" src=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuit-shor.png\" alt=\"\" width=\"554\" height=\"303\" srcset=\"https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuit-shor.png 1437w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuit-shor-300x164.png 300w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuit-shor-768x421.png 768w, https:\/\/www.quantum-bits.org\/wp-content\/uploads\/2018\/04\/qec-circuit-shor-1024x561.png 1024w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/p>\n<p>The insight that we can describe measurements in quantum error correction that act the same way on all code states, is the essence of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Stabilizer_code\" target=\"_blank\" rel=\"noopener\">stabilizer formalism<\/a>.<\/p>\n<p>To go beyond this introduction, you might be interested in reading Daniel Gottesman&#8217;s 2009 paper &#8220;<a class=\"\" href=\"https:\/\/arxiv.org\/abs\/0904.2557\" target=\"_blank\" rel=\"noopener\" data-linktype=\"external\">An Introduction to Quantum Error Correction and Fault-Tolerant Quantum Computation&#8221;<\/a>.<\/p>\n<p><strong>Quantum Error Correcting Codes in Q#<\/strong><\/p>\n<p>To conclude this introduction, we will list the user-defined type used to specify error correcting codes, as provided by the Q# canon (excerpt from Q# documentation):<\/p>\n<ul>\n<li><strong>LogicalRegister<\/strong> (= Qubit[]): Denotes that a register of qubits should be interpreted as the code block of an error-correcting code.<\/li>\n<li>Syndrome (= Result[]): Denotes that an array of measurement results should be interpreted as the syndrome measured on a code block.<\/li>\n<li><strong>RecoveryFn<\/strong> (= (Syndrome -&gt; Pauli[])): Denotes that a classical function should be used to interpret a syndrome and return a correction that should be applied.<\/li>\n<li><strong>EncodeOp<\/strong> (= ((Qubit[], Qubit[]) =&gt; LogicalRegister)): Denotes that an operation takes qubits representing data along with fresh ancilla qubits in order to produce a code block of an error-correcting code.<\/li>\n<li><strong>DecodeOp<\/strong> (= (LogicalRegister =&gt; (Qubit[], Qubit[]))): Denotes than an operation decomposes a code block of an error correcting code into the data qubits and the ancilla qubits used to represent syndrome information.<\/li>\n<li><strong>SyndromeMeasOp<\/strong> (= (LogicalRegister =&gt; Syndrome)): Denotes an operation that should be used to extract syndrome information from a code block, without disturbing the state protected by the code.<\/li>\n<\/ul>\n<p>Finally, the canon provides the QECC (Quantum Error Correcting Code) type to collect the other types required to define a quantum error-correcting code.<\/p>\n<p>Notice that the QECC type does not include a recovery function. This allows us to change the recovery function that is used in correcting errors without changing the definition of the code itself; this ability is in particular useful when incorporating feedback from characterization measurements into the model assumed by recovery.&nbsp;<\/p>\n<p>Once a code is defined in this way, we can use the Recover operation to recover from errors.<\/p>\n<p>Aside from the bit-flip code, the Q# canon is provided with implementations of the five-qubit perfect code, and the seven-qubit code, both of which can correct an arbitrary single-qubit error.<\/p>\n<p><span style=\"font-size: 8pt;\">Note: to speedup the writing of this post, a few paragraphs and illustrations are based on wikipedia&#8217;s entries on quantum error correction and MS Quantum Development Kit documentations.<br \/>\n<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Building a quantum device in the real world means having to deal with errors: any qubit stored unprotected or transmitted through a communications channel will inevitably come out changed. To &#8230;<\/p>\n","protected":false},"author":1,"featured_media":3846,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts\/1930"}],"collection":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1930"}],"version-history":[{"count":0,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/posts\/1930\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=\/wp\/v2\/media\/3846"}],"wp:attachment":[{"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quantum-bits.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}