- Featured in Physics
- Open Access
Contextuality of Quantum Error-Correcting Codes
PRX Quantum 7, 010319 – Published 28 January, 2026
DOI: https://doi.org/10.1103/7zb5-vs4x
Abstract
Fault-tolerant quantum computation requires quantum error correction (QEC), which relies on entanglement to protect information from local noise. Achieving universality, however, demands overcoming the Eastin-Knill theorem. This is often accomplished through strategies like magic state distillation, a process that prepares computational resources—namely, magic states—whose power is now understood to be rooted in quantum contextuality, a fundamental nonclassical feature generalizing Bell nonlocality. Yet, the broader role of contextuality in enabling universality, including its significance as an inherent feature of QEC codes and protocols themselves, has remained largely unexplored. In this work, we develop a rigorous framework for contextuality in QEC and prove three main results. Fundamentally, we show that subsystem stabilizer codes with two or more gauge qubits are strongly contextual in their partial closure, while others are noncontextual, establishing a clear criterion for identifying contextual codes. Mathematically, we unify Abramsky-Brandenburger’s sheaf-theoretic and Kirby-Love’s tree-based definitions of contextuality, resolving a conjecture of Kim and Abramsky. Practically, we prove that many widely studied code-switching protocols which admit universal transversal gate sets, such as the doubled color codes introduced by Bravyi and Cross, are necessarily strongly contextual in their partial closure. Collectively, our results establish quantum contextuality as an intrinsic characteristic of fault-tolerant quantum codes and protocols, complementing entanglement and magic as resources for scalable quantum computation. For quantum coding theorists, this provides a new invariant: contextuality classifies which subsystem stabilizer codes can participate in universal fault-tolerant protocols. These findings position contextuality not only as a foundational concept but also as a practical guide for the design and analysis of future QEC architectures.
Physics Subject Headings (PhySH)
Viewpoint
A New Ingredient for Quantum Error Correction
Entanglement and so-called magic states have long been viewed as the key resources for quantum error correction. Now contextuality, a hallmark of quantum theory, joins them as a complementary resource.
See more in Physics
Popular Summary
Quantum computers promise breakthroughs in solving complex problems, but their fundamental building blocks, called qubits, are incredibly fragile. To build a reliable quantum device, we need robust “spell-checkers,” known as quantum error-correcting codes. Our research connects this practical challenge with one of quantum mechanics’ strangest features: contextuality, where a measurement’s outcome depends on the other measurements performed alongside it. While known to be a source of quantum advantage, its role in error correction was a mystery. We establish the first direct link, proving that contextuality is a mandatory ingredient for achieving universal quantum computation through certain key protocols.
We developed a new framework to classify error-correcting codes as “contextual” or “noncontextual,” identifying a simple structural rule that governs the distinction. We then applied this rule to “code-switching,” an important strategy for assembling the universal toolkit of operations required for any quantum algorithm. Our analysis reveals that the very structure that enables these protocols to achieve universal computation is precisely what makes them strongly contextual. This discovery bridges the gap between abstract quantum principles and the design of fault-tolerant hardware.
This connection provides a powerful new “litmus test” for quantum engineers: if a proposed error-correcting scheme is not contextual, it cannot be used to achieve universality through these powerful methods. Our findings pave the way for new design principles that leverage every available quantum resource. A crucial next step is to investigate whether more contextuality can lead to even better error correction, propelling the field toward more reliable and scalable quantum technologies.
Article Text
References (111)
- P. W. Shor, Scheme for reducing decoherence in quantum computer memory, Phys. Rev. A 52, R2493 (1995).
- D. Gottesman, Stabilizer codes and quantum error correction, Ph.D. thesis, California Institute of Technology, 1997.
- E. Dennis, A. Kitaev, A. Landahl, and J. Preskill, Topological quantum memory, J. Math. Phys. 43, 4452 (2002).
- A. Y. Kitaev, Fault-tolerant quantum computation by anyons, Ann. Phys. 303, 2 (2003).
- Quantum Error Correction, edited by P. A. Lidar and T. A. Brun (Cambridge University, Cambridge, United Kingdom, 2013).
- B. M. Terhal, Quantum error correction for quantum memories, Rev. Mod. Phys. 87, 307 (2015).
- C. H. Bennett, D. P. DiVincenzo, J. A. Smolin, and W. K. Wootters, Mixed-state entanglement and quantum error correction, Phys. Rev. A 54, 3824 (1996).
- T. Brun, I. Devetak, and M.-H. Hsieh, Correcting quantum errors with entanglement, Science 314, 436 (2006).
- W. Dür and H. J. Briegel, Entanglement purification and quantum error correction, Rep. Prog. Phys. 70, 1381 (2007).
- S. Bravyi, D. Lee, Z. Li, and B. Yoshida, How much entanglement is needed for quantum error correction? Phys. Rev. Lett. 134, 210602 (2025).
- A. Anshu, N. P. Breuckmann, and C. Nirkhe, in Proceedings of the 55th Annual ACM Symposium on Theory of Computing, STOC ’23 (ACM, New York, NY, USA, 2023), pp. 1090–1096.
- S. Bravyi and A. Kitaev, Universal quantum computation with ideal Clifford gates and noisy ancillas, Phys. Rev. A 71, 022316 (2005).
- V. Veitch, S. A. Hamed Mousavian, D. Gottesman, and J. Emerson, The resource theory of stabilizer quantum computation, New J. Phys. 16, 013009 (2014).
- C. Gidney, N. Shutty, and C. Jones, Magic state cultivation: growing T states as cheap as CNOT gates), arXiv:2409.17595 [quant-ph].
- B. Eastin and E. Knill, Restrictions on transversal encoded quantum gate sets, Phys. Rev. Lett. 102, 110502 (2009).
- S. Kochen and E. P. Specker, The problem of hidden variables in quantum mechanics, J. Math. Mech. 17, 59 (1967).
- E. Specker, Die Logik nicht gleichzeitig entscheidbarer Aussagen, Dialectica 14, 239 (1960).
- C. Budroni, A. Cabello, O. Gühne, M. Kleinmann, and J.-Å. Larsson, Kochen-Specker contextuality, Rev. Mod. Phys. 94, 045007 (2022).
- A. A. Klyachko, M. A. Can, S. Binicioğlu, and A. S. Shumovsky Simple test for hidden variables in spin-1 systems, Phys. Rev. Lett. 101, 020403 (2008).
- R. Raussendorf, Contextuality in measurement-based quantum computation, Phys. Rev. A 88, 022322 (2013).
- R. Lapkiewicz, P. Li, C. Schaeff, N. K. Langford, S. Ramelow, M. Wieśniak, and A. Zeilinger, Experimental non-classicality of an indivisible quantum system, Nature 474, 490 (2011).
- M. Um, X. Zhang, J. Zhang, Y. Wang, S. Yangchao, D. L. Deng, L.-M. Duan, and K. Kim, Experimental certification of random numbers via quantum contextuality, Sci. Rep. 3, 1627 (2013).
- M. Jerger, Y. Reshitnyk, M. Oppliger, A. Potočnik, M. Mondal, A. Wallraff, K. Goodenough, S. Wehner, K. Juliusson, N. K. Langford, and A. Fedorov, Contextuality without nonlocality in a superconducting quantum system, Nat. Commun. 7, 12930 (2016).
- X. Zhan, P. Kurzyński, D. Kaszlikowski, K. Wang, Z. Bian, Y. Zhang, and P. Xue, Experimental detection of information deficit in a photonic contextuality scenario, Phys. Rev. Lett. 119, 220403 (2017).
- M. Malinowski, C. Zhang, F. M. Leupold, A. Cabello, J. Alonso, and J. P. Home, Probing the limits of correlations in an indivisible quantum system, Phys. Rev. A 98, 050102(R) (2018).
- F. M. Leupold, M. Malinowski, C. Zhang, V. Negnevitsky, J. Alonso, J. P. Home, and A. Cabello, Sustained state-independent quantum contextual correlations from a single ion, Phys. Rev. Lett. 120, 180401 (2018).
- A. Zhang, H. Xu, J. Xie, H. Zhang, B. J. Smith, M. S. Kim, and L. Zhang, Experimental test of contextuality in quantum and classical systems, Phys. Rev. Lett. 122, 080401 (2019).
- M. Um, Q. Zhao, J. Zhang, P. Wang, Y. Wang, M. Qiao, H. Zhou, X. Ma, and K. Kim, Randomness expansion secured by quantum contextuality, Phys. Rev. Appl. 13, 034077 (2020).
- P. Wang, J. Zhang, C.-Y. Luan, M. Um, Y. Wang, M. Qiao, T. Xie, J.-N. Zhang, A. Cabello, and K. Kim, Significant loophole-free test of Kochen-Specker contextuality using two species of atomic ions, Sci. Adv. 8, eabk1660 (2022).
- X.-M. Hu, X.-M. Hu, Y. Xie, A. S. Arora, M.-Z. Ai, K. Bharti, J. Zhang, W. Wu, P.-X. Chen, J.-M. Cui, B.-H. Liu, Y.-F. Huang, C.-F. Li, G.-C. Guo, J. Roland, A. Cabello, and L.-C. Kwek, Self-testing of a single quantum system from theory to experiment, npj Quantum Inf. 9, 103 (2023).
- Z.-H. Liu, H.-X. Meng, Z.-P. Xu, J. Zhou, J.-L. Chen, J.-S. Xu, C.-F. Li, G.-C. Guo, and A. Cabello, Experimental test of high-dimensional quantum contextuality based on contextuality concentration, Phys. Rev. Lett. 130, 240202 (2023).
- K. Bharti, M. Ray, A. Varvitsiotis, N. A. Warsi, A. Cabello, and L.-C. Kwek, Robust self-testing of quantum systems via noncontextuality inequalities, Phys. Rev. Lett. 122, 250403 (2019).
- K. Bharti, M. Ray, A. Varvitsiotis, A. Cabello, and L.-C. Kwek, Local certification of programmable quantum devices of arbitrary high dimensionality, arXiv:1911.09448 [quant-ph].
- Z.-P. Xu, D. Saha, K. Bharti, and A. Cabello, Certifying sets of quantum observables with any full-rank state, Phys. Rev. Lett. 132, 140201 (2024).
- D. Saha, R. Santos, and R. Augusiak, Sum-of-squares decompositions for a family of noncontextuality inequalities and self-testing of quantum devices, Quantum 4, 302 (2020).
- Z.-H. Liu, Exploring Quantum Contextuality with Photons (Springer Nature, Singapore, 2023).
- A. S. Arora, K. Bharti, A. Cojocaru, and A. Coladangelo, in 2024 IEEE 65th Annual Symposium on Foundations of Computer Science (FOCS) (IEEE, Chicago, IL, USA, 2024), pp. 1106–1125..
- J. Bowles, V. J. Wright, M. Farkas, N. Killoran, and M. Schuld, Contextuality and inductive bias in quantum machine learning, arXiv:2302.01365 [quant-ph].
- X. Gao, E. R. Anschuetz, S.-T. Wang, J. I. Cirac, and M. D. Lukin, Enhancing generative models via quantum correlations, Phys. Rev. X 12, 021037 (2022).
- A. Hameedi, A. Tavakoli, B. Marques, and M. Bourennane, Communication games reveal preparation contextuality, Phys. Rev. Lett. 119, 220402 (2017).
- D. Saha, P. Horodecki, and M. Pawłowski, State independent contextuality advances one-way communication, New J. Phys. 21, 093057 (2019).
- S. Gupta, D. Saha, Z.-P. Xu, A. Cabello, and A. S. Majumdar, Quantum contextuality provides communication complexity advantage, Phys. Rev. Lett. 130, 080802 (2023).
- N. D. Mermin, Extreme quantum entanglement in a superposition of macroscopically distinct states, Phys. Rev. Lett. 65, 1838 (1990).
- S. Abramsky and A. Brandenburger, The sheaf-theoretic structure of non-locality and contextuality, New J. Phys. 13, 113036 (2011).
- S. Abramsky, R. Soares Barbosa, K. Kishida, R. Lal, and S. Mansfield, in 24th EACSL Annual Conference on Computer Science Logic (CSL 2015) (Schloss Dagstuhl—Leibniz-Zentrum für Informatik, Dagstuhl, Germany, 2015).
- W. M. Kirby and P. J. Love, Contextuality test of the nonclassicality of variational quantum eigensolvers, Phys. Rev. Lett. 123, 200501 (2019).
- B. Kim and S. Abramsky, State-independent all-versus-nothing arguments, arXiv:2311.11218.
- F. Butt, S. Heußen, M. Rispler, and M. Müller, Fault-tolerant code-switching protocols for near-term quantum processors, PRX Quantum 5, 020345 (2024).
- S. Bravyi and A. Cross, Doubled color codes, arXiv:1509.03239 [quant-ph].
- E. Chitambar and G. Gour, Quantum resource theories, Rev. Mod. Phys. 91, 025001 (2019).
- J. S. Bell, On the Einstein Podolsky Rosen paradox, Phys. Phys. Fiz. 1, 195 (1964).
- D. M. Greenberger, M. A. Horne, and A. Zeilinger, in Bell’s Theorem, Quantum Theory and Conceptions of the Universe (Springer Netherlands, Dordrecht, Netherlands, 1989), pp. 69–72.
- D. M. Greenberger, M. A. Horne, A. Shimony, and A. Zeilinger, Bell’s theorem without inequalities, Am. J. Phys. 58, 1131 (1990).
- D. P. DiVincenzo and A. Peres, Quantum code words contradict local realism, Phys. Rev. A 55, 4089 (1997).
- A. Cabello, O. Gühne, and D. Rodríguez, Mermin inequalities for perfect correlations, Phys. Rev. A 77, 062106 (2008).
- S. Abramsky, R. S. Barbosa, G. Carù, and S. Perdrix, A complete characterization of all-versus-nothing arguments for stabilizer states, Phil. Trans. R. Soc. A 375, 20160385 (2017).
- M. Howard, J. Wallman, V. Veitch, and J. Emerson, Contextuality supplies the ‘magic’ for quantum computation, Nature 510, 351 (2014).
- A. Cabello, S. Severini, and A. Winter, (Non-)contextuality of physical theories as an axiom, arXiv:1010.2163 [quant-ph].
- A. Cabello, S. Severini, and A. Winter, Graph-theoretic approach to quantum correlations, Phys. Rev. Lett. 112, 040401 (2014).
- W. M. Kirby, A. Tranter, and P. J. Love, Contextual subspace variational quantum eigensolver, Quantum 5, 456 (2021).
- S. Abramsky, Ş.-I. Cercelescu, and C.-M. Constantin, in 9th International Conference on Formal Structures for Computation and Deduction (FSCD 2024), Leibniz International Proceedings in Informatics (LIPIcs) Vol. 299, edited by J. Rehof (Schloss Dagstuhl—Leibniz-Zentrum für Informatik, Dagstuhl, Germany, 2024), pp. 28:1–28:20.
- D. Gottesman, Surviving as a quantum computer in a classical world (2024), textbook manuscript preprint available at https://www.cs.umd.edu/class/spring2024/cmsc858G/QECCbook-2024-ch1-15.pdf.
- All instances of in this paper refer to the base- logarithm.
- D. Kribs, R. Laflamme, D. Poulin, and M. Lesosky, Operator quantum error correction, Quantum Inf. Comput. 6, 382 (2006).
- D. Kribs, R. Laflamme, and D. Poulin, Unified and generalized approach to quantum error correction, Phys. Rev. Lett. 94, 180501 (2005).
- D. Poulin, Stabilizer formalism for operator quantum error correction, Phys. Rev. Lett. 95, 230504 (2005).
- In this paper, the word “ring” (resp. “semiring”) always refers to a commutative ring (resp. semiring) with unit.
- In this paper, the word “graph” always refers to a simple, undirected graph.
- It makes sense for to take values in because .
- M. Suchara, S. Bravyi, and B. Terhal, Constructions and noise threshold of topological subsystem codes, J. Phys. A: Math. Theor. 44, 155301 (2011).
- O. Higgott and N. P. Breuckmann, Subsystem codes with high thresholds by gauge fixing and reduced qubit overhead, Phys. Rev. X 11, 031039 (2021).
- B. Shaw, M. M. Wilde, O. Oreshkov, I. Kremsky, and D. A. Lidar, Encoding one logical qubit into six physical qubits, Phys. Rev. A 78, 012337 (2008).
- The Error Correction Zoo, edited by V. V. Albert and P. Faist (2025).
- M. B. Hastings and J. Haah, Dynamically generated logical qubits, Quantum 5, 564 (2021).
- If , then .
- It is not hard to see that zerosumfree semifields are in fact exactly the semifields which are not fields.
- A. Chermak, Fusion systems and localities, Acta Math. 211, 47 (2013).
- J. T. Anderson, G. Duclos-Cianci, and D. Poulin, Fault-tolerant conversion between the Steane and Reed-Muller quantum codes, Phys. Rev. Lett. 113, 080501 (2014).
- H. Bombin and M. A. Martin-Delgado, Topological quantum distillation, Phys. Rev. Lett. 97, 180501 (2006).
- This is initially given as in Eq. (85) of Ref. [49], but it was later noted at the very end of Sec. 12 in the paper that this number can be reduced by .
- N. Rengaswamy, R. Calderbank, M. Newman, and H. D. Pfister, On optimality of CSS codes for transversal , IEEE J. Sel. Areas Inf. Theory 1, 499 (2020).
- B. Sudakov and P. Vieira, Two remarks on eventown and oddtown problems, SIAM J. Discrete Math. 32, 280 (2018).
- A collection of sets is a strong -wise eventown if for any with for all . So, is a strong -wise eventown since for all with , by the minimality of . However it is not a -wise eventown since , by the definition of .
- The inclusion map maps to . The quotient map maps to coset .
- This notion of transversality is often referred to as “weak transversality” where a logical gate on an -qubit code is given by where the physical unitaries for need not be the same (nor equal to ). This is a relaxation of transversality (which is sometimes referred to as “strict transversality”) where .
- S. Abramsky, R. Barbosa, and S. Mansfield, in 13th International Conference on Quantum Physics and Logic (QPL 2016) (Glasgow, United Kingdom, 2016). http://qpl2016.cis.strath.ac.uk/.
- S. Boyd and L. Vandenberghe, Convex Optimization (Cambridge University, Cambridge, United Kingdom, 2004).
- P. Panteleev and G. Kalachev, Maximally extendable sheaf codes, arXiv:2403.03651 [cs.IT].
- T.-C. Lin, Transversal non-Clifford gates for quantum LDPC codes on sheaves, arXiv:2410.14631 [quant-ph].
- I. Dinur, T.-C. Lin, and T. Vidick, Expansion of higher-dimensional cubical complexes with application to quantum locally testable codes, arXiv:2402.07476 [quant-ph].
- G. Kalachev and P. Panteleev, Maximally extendable product codes are good coboundary expanders, arXiv:2501.01411 [cs.IT].
- M. Davydova, N. Tantivasadakarn, and S. Balasubramanian, Floquet codes without parent subsystem codes, PRX Quantum 4, 020341 (2023).
- A. Fahimniya, H. Dehghani, K. Bharti, S. Mathew, A. J. Kollár, A. V. Gorshkov, and M. J. Gullans, Fault-tolerant hyperbolic Floquet quantum error correcting codes, Quantum 9, 1849 (2025).
- C. Gidney, M. Newman, A. Fowler, and M. Broughton, A fault-tolerant honeycomb memory, Quantum 5, 605 (2021).
- J. Haah and M. B. Hastings, Boundaries for the honeycomb code, Quantum 6, 693 (2022).
- C. Vuillot, Planar Floquet codes, arXiv:2110.05348 [quant-ph].
- A. Paetznick, C. Knapp, N. Delfosse, B. Bauer, J. Haah, M. B. Hastings, and M. P. da Silva, Performance of planar Floquet codes with Majorana-based qubits, PRX Quantum 4, 010310 (2023).
- C. Gidney, M. Newman, and M. McEwen, Benchmarking the planar honeycomb code, Quantum 6, 813 (2022).
- P. Hilaire, T. Dessertaine, B. Bourdoncle, A. Denys, G. de Gliniasty, G. Valentí-Rojas, and S. Mansfield, Enhanced fault-tolerance in photonic quantum computing: Floquet code outperforms surface code in tailored architecture, arXiv:2410.07065 [quant-ph].
- O. Higgott and N. P. Breuckmann, Constructions and performance of hyperbolic and semi-hyperbolic Floquet codes, PRX Quantum 5, 040327 (2024).
- D. Aasen, J. Haah, Z. Li, and R. S. K. Mong, Measurement quantum cellular automata and anomalies in Floquet codes, arXiv:2304.01277 [quant-ph].
- Z. Zhang, D. Aasen, and S. Vijay, -cube Floquet code: A dynamical quantum error correcting code with a subextensive number of logical qubits, Phys. Rev. B 108, 205116 (2023).
- A. Dua, N. Tantivasadakarn, J. Sullivan, and T. D. Ellison, Engineering 3D Floquet codes by rewinding, PRX Quantum 5, 020305 (2024).
- M. S. Alam and E. Rieffel, Dynamical logical qubits in the Bacon-Shor code, Phys. Rev. A 112, 022436 (2025).
- H. Bombin, D. Litinski, N. Nickerson, F. Pastawski, and S. Roberts, Unifying flavors of fault tolerance with the ZX calculus, Quantum 8, 1379 (2024).
- A. Tanggara, M. Gu, and K. Bharti, Strategic code: A unified spatio-temporal framework for quantum error-correction, arXiv:2405.17567 [quant-ph].
- A. Townsend-Teague, J. Magdalena de la Fuente, and M. Kesselring, Floquetifying the colour code, Electron. Proc. Theor. Comput. Sci. 384, 265 (2023).
- T. D. Ellison, J. Sullivan, and A. Dua, Floquet codes with a twist, arXiv:2306.08027 [quant-ph].
- J. Sullivan, R. Wen, and A. C. Potter, Floquet codes and phases in twist-defect networks, Phys. Rev. B 108, 195134 (2023).
- A. Tanggara, M. Gu, and K. Bharti, Simple construction of qudit Floquet codes on a family of lattices, arXiv:2410.02022 [quant-ph].
- We slightly abuse notation here for the sake of notation clarity: each ordered pair listed in fact refers to function that sends the relevant operators (in the order listed) to the ordered pair. For instance, by , we mean that consists of two functions: one sends both and to , and the other sends both and to .
