Quantum Lego and XP Stabilizer Codes

Ruohan Shen1,2, Yixu Wang3, and ChunJun Cao2,4

1Department of Physics, Tsinghua University, Beijing 100084, China
2Institute for Quantum Information and Matter California Institute of Technology, 1200 E California Blvd, Pasadena, CA 91125, USA.
3Institute for Advanced Study, Tsinghua University, Beijing 100084, China
4Department of Physics, Virginia Tech, Blacksburg, VA, 24061, USA

Find this paper interesting or want to discuss? Scite or leave a comment on SciRate.

Abstract

We apply the recent graphical framework of "Quantum Lego" to XP stabilizer codes where the stabilizer group is generally non-Abelian. We show that the idea of operator matching continues to hold for such codes and is sufficient for generating all their XP symmetries provided the resulting code is XP. We provide an efficient classical algorithm for tracking these symmetries under tensor contraction or conjoining. This constitutes a partial extension of the algorithm implied by the Gottesman-Knill theorem beyond Pauli stabilizer states and Clifford operations. Because conjoining transformations generate quantum operations that are universal, the XP symmetries obtained from these algorithms do not uniquely identify the resulting tensors in general. Using this extended framework, we provide examples of novel XP stabilizer codes with a higher distance than existing non-trivial XP regular codes and a $[[8,1,2]]$ Pauli stabilizer code with a fault-tolerant $T$ gate. For XP regular codes, we also construct a tensor-network-based maximum likelihood decoder for any independently and identically distributed single qubit error channel using weight enumerators.

A new way to generate quantum codes with non-Abelian symmetries called XP stabilizer codes has been identified in this work where small lego blocks of codes are glued together to build up bigger codes. We identify new instances of XP codes using this technique and develop efficient optimal decoders for XP codes built from the smaller "quantum lego blocks".

► BibTeX data

► References

[1] Daniel Gottesman. Stabilizer codes and quantum error correction, 1997.

[2] A. Yu. Kitaev. Fault tolerant quantum computation by anyons. Annals Phys., 303: 2–30, 2003. 10.1016/​S0003-4916(02)00018-0.
https:/​/​doi.org/​10.1016/​S0003-4916(02)00018-0

[3] James R. Wootton, Jan Burri, Sofyan Iblisdir, and Daniel Loss. Error correction for non-abelian topological quantum computation. Phys. Rev. X, 4: 011051, Mar 2014. 10.1103/​PhysRevX.4.011051. URL https:/​/​doi.org/​10.1103/​PhysRevX.4.011051.
https:/​/​doi.org/​10.1103/​PhysRevX.4.011051

[4] Michael A. Levin and Xiao-Gang Wen. String-net condensation: A physical mechanism for topological phases. Phys.Rev. B, 71 (4): 045110, January 2005. 10.1103/​PhysRevB.71.045110.
https:/​/​doi.org/​10.1103/​PhysRevB.71.045110

[5] Benjamin J. Brown, Daniel Loss, Jiannis K. Pachos, Chris N. Self, and James R. Wootton. Quantum memories at finite temperature. Reviews of Modern Physics, 88 (4): 045005, October 2016. 10.1103/​RevModPhys.88.045005.
https:/​/​doi.org/​10.1103/​RevModPhys.88.045005

[6] Xiaotong Ni, Oliver Buerschaper, and Maarten Van den Nest. A non-commuting stabilizer formalism. Journal of Mathematical Physics, 56 (5): 052201, 2015. 10.1063/​1.4920923.
https:/​/​doi.org/​10.1063/​1.4920923

[7] Mark A. Webster, Benjamin J. Brown, and Stephen D. Bartlett. The XP Stabiliser Formalism: a Generalisation of the Pauli Stabiliser Formalism with Arbitrary Phases. Quantum, 6: 815, September 2022. ISSN 2521-327X. 10.22331/​q-2022-09-22-815. URL https:/​/​doi.org/​10.22331/​q-2022-09-22-815.
https:/​/​doi.org/​10.22331/​q-2022-09-22-815

[8] Mark A. Webster, Armanda O. Quintavalle, and Stephen D. Bartlett. Transversal Diagonal Logical Operators for Stabiliser Codes. arXiv e-prints, art. arXiv:2303.15615, March 2023. 10.48550/​arXiv.2303.15615.
https:/​/​doi.org/​10.48550/​arXiv.2303.15615
arXiv:2303.15615

[9] ChunJun Cao and Brad Lackey. Quantum lego: Building quantum error correction codes from tensor networks. PRX Quantum, 3: 020332, May 2022. 10.1103/​PRXQuantum.3.020332. URL https:/​/​doi.org/​10.1103/​PRXQuantum.3.020332.
https:/​/​doi.org/​10.1103/​PRXQuantum.3.020332

[10] Andrew Cross, Graeme Smith, John A. Smolin, and Bei Zeng. Codeword stabilized quantum codes. IEEE Transactions on Information Theory, 55 (1): 433–438, January 2009. ISSN 0018-9448. 10.1109/​tit.2008.2008136. URL http:/​/​dx.doi.org/​10.1109/​TIT.2008.2008136.
https:/​/​doi.org/​10.1109/​tit.2008.2008136

[11] ChunJun Cao and Brad Lackey. Quantum Weight Enumerators and Tensor Networks. IEEE Trans. Info. Theor., 70 (5): 3512–3528, 2024. 10.1109/​TIT.2023.3340503.
https:/​/​doi.org/​10.1109/​TIT.2023.3340503

[12] ChunJun Cao, Michael J. Gullans, Brad Lackey, and Zitao Wang. Quantum Lego Expansion Pack: Enumerators from Tensor Networks. PRX Quantum, 5 (3): 030313, 2024. 10.1103/​PRXQuantum.5.030313.
https:/​/​doi.org/​10.1103/​PRXQuantum.5.030313

[13] Michael A. Levin and Xiao-Gang Wen. String-net condensation: A physical mechanism for topological phases. Phys. Rev. B, 71: 045110, Jan 2005. 10.1103/​PhysRevB.71.045110. URL https:/​/​doi.org/​10.1103/​PhysRevB.71.045110.
https:/​/​doi.org/​10.1103/​PhysRevB.71.045110

[14] Vlad Gheorghiu. Standard form of qudit stabilizer groups. Physics Letters A, 378 (5): 505–509, 2014. ISSN 0375-9601. https:/​/​doi.org/​10.1016/​j.physleta.2013.12.009. URL https:/​/​www.sciencedirect.com/​science/​article/​pii/​S0375960113011080.
https:/​/​doi.org/​10.1016/​j.physleta.2013.12.009
https:/​/​www.sciencedirect.com/​science/​article/​pii/​S0375960113011080

[15] Terry Farrelly, Robert J. Harris, Nathan A. McMahon, and Thomas M. Stace. Tensor-Network Codes. Phys. Rev. Lett., 127 (4): 040507, July 2021. 10.1103/​PhysRevLett.127.040507.
https:/​/​doi.org/​10.1103/​PhysRevLett.127.040507

[16] Terry Farrelly, David K. Tuckett, and Thomas M. Stace. Local tensor-network codes. New Journal of Physics, 24 (4): 043015, April 2022. 10.1088/​1367-2630/​ac5e87.
https:/​/​doi.org/​10.1088/​1367-2630/​ac5e87

[17] Bob Coecke and Ross Duncan. Interacting quantum observables: categorical algebra and diagrammatics. New Journal of Physics, 13 (4): 043016, April 2011. 10.1088/​1367-2630/​13/​4/​043016.
https:/​/​doi.org/​10.1088/​1367-2630/​13/​4/​043016

[18] Nicholas Chancellor, Aleks Kissinger, Stefan Zohren, Joschka Roffe, and Dominic Horsman. Graphical structures for design and verification of quantum error correction. Quantum Science and Technology, 8 (4): 045028, September 2023. ISSN 2058-9565. 10.1088/​2058-9565/​acf157. URL http:/​/​dx.doi.org/​10.1088/​2058-9565/​acf157.
https:/​/​doi.org/​10.1088/​2058-9565/​acf157

[19] Vincent Paul Su, ChunJun Cao, Hong-Ye Hu, Yariv Yanay, Charles Tahan, and Brian Swingle. Discovery of optimal quantum codes via reinforcement learning. Phys. Rev. Applied, 23 (3): 034048, 2025. 10.1103/​PhysRevApplied.23.034048.
https:/​/​doi.org/​10.1103/​PhysRevApplied.23.034048

[20] Caroline Mauron, Terry Farrelly, and Thomas M. Stace. Optimization of tensor network codes with reinforcement learning. New J. Phys., 26 (2): 023024, 2024. 10.1088/​1367-2630/​ad23a6.
https:/​/​doi.org/​10.1088/​1367-2630/​ad23a6

[21] Man-Duen Choi. Completely positive linear maps on complex matrices. Linear Algebra and its Applications, 10 (3): 285–290, 1975. ISSN 0024-3795. https:/​/​doi.org/​10.1016/​0024-3795(75)90075-0. URL https:/​/​www.sciencedirect.com/​science/​article/​pii/​0024379575900750.
https:/​/​doi.org/​10.1016/​0024-3795(75)90075-0
https:/​/​www.sciencedirect.com/​science/​article/​pii/​0024379575900750

[22] A. Jamiołkowski. Linear transformations which preserve trace and positive semidefiniteness of operators. Reports on Mathematical Physics, 3 (4): 275–278, 1972. ISSN 0034-4877. https:/​/​doi.org/​10.1016/​0034-4877(72)90011-0. URL https:/​/​www.sciencedirect.com/​science/​article/​pii/​0034487772900110.
https:/​/​doi.org/​10.1016/​0034-4877(72)90011-0
https:/​/​www.sciencedirect.com/​science/​article/​pii/​0034487772900110

[23] Daniel Gottesman. The Heisenberg Representation of Quantum Computers. arXiv e-prints, art. quant-ph/​9807006, July 1998. 10.48550/​arXiv.quant-ph/​9807006.
https:/​/​doi.org/​10.48550/​arXiv.quant-ph/​9807006
arXiv:quant-ph/9807006

[24] Scott Aaronson and Daniel Gottesman. Improved simulation of stabilizer circuits. Phys.Rev. A, 70 (5): 052328, November 2004. 10.1103/​PhysRevA.70.052328.
https:/​/​doi.org/​10.1103/​PhysRevA.70.052328

[25] Arne Storjohann and Thom Mulders. Fast algorithms for linear algebra modulo n. In Gianfranco Bilardi, Giuseppe F. Italiano, Andrea Pietracaprina, and Geppino Pucci, editors, Algorithms — ESA' 98, pages 139–150, Berlin, Heidelberg, 1998. Springer Berlin Heidelberg. ISBN 978-3-540-68530-2. https:/​/​doi.org/​10.1007/​3-540-68530-8_12.
https:/​/​doi.org/​10.1007/​3-540-68530-8_12

[26] Juan Bermejo-Vega and Maarten Van den Nest. Classical simulations of abelian-group normalizer circuits with intermediate measurements, 2013.

[27] Norbert Schuch and Jens Siewert. Programmable Networks for Quantum Algorithms. PRL, 91 (2): 027902, July 2003. 10.1103/​PhysRevLett.91.027902.
https:/​/​doi.org/​10.1103/​PhysRevLett.91.027902

[28] Nathanan Tantivasadakarn, Ashvin Vishwanath, and Ruben Verresen. Hierarchy of topological order from finite-depth unitaries, measurement, and feedforward. PRX Quantum, 4: 020339, Jun 2023. 10.1103/​PRXQuantum.4.020339. URL https:/​/​doi.org/​10.1103/​PRXQuantum.4.020339.
https:/​/​doi.org/​10.1103/​PRXQuantum.4.020339

[29] Zheng-Cheng Gu, Michael Levin, and Xiao-Gang Wen. Tensor-entanglement renormalization group approach as a unified method for symmetry breaking and topological phase transitions. Phys. Rev. B, 78: 205116, Nov 2008. 10.1103/​PhysRevB.78.205116. URL https:/​/​doi.org/​10.1103/​PhysRevB.78.205116.
https:/​/​doi.org/​10.1103/​PhysRevB.78.205116

[30] Oliver Buerschaper, Miguel Aguado, and Guifré Vidal. Explicit tensor network representation for the ground states of string-net models. Phys. Rev. B, 79: 085119, Feb 2009. 10.1103/​PhysRevB.79.085119. URL https:/​/​doi.org/​10.1103/​PhysRevB.79.085119.
https:/​/​doi.org/​10.1103/​PhysRevB.79.085119

[31] Sergey Bravyi, Martin Suchara, and Alexander Vargo. Efficient algorithms for maximum likelihood decoding in the surface code. Phys.Rev. A, 90 (3): 032326, September 2014. 10.1103/​PhysRevA.90.032326.
https:/​/​doi.org/​10.1103/​PhysRevA.90.032326

[32] Christopher T. Chubb. General tensor network decoding of 2D Pauli codes. arXiv e-prints, art. arXiv:2101.04125, January 2021. 10.48550/​arXiv.2101.04125.
https:/​/​doi.org/​10.48550/​arXiv.2101.04125
arXiv:2101.04125

[33] Peter Shor and Raymond Laflamme. Quantum analog of the macwilliams identities for classical coding theory. Phys. Rev. Lett., 78: 1600–1602, Feb 1997. 10.1103/​PhysRevLett.78.1600. URL https:/​/​doi.org/​10.1103/​PhysRevLett.78.1600.
https:/​/​doi.org/​10.1103/​PhysRevLett.78.1600

[34] Alexei Ashikhmin, Alexander Barg, Emanuel Knill, and Simon Litsyn. Quantum error detection i: Statement of the problem, 1999. URL https:/​/​arxiv.org/​abs/​quant-ph/​9906126.
arXiv:quant-ph/9906126

[35] Robert J. Harris, Nathan A. McMahon, Gavin K. Brennen, and Thomas M. Stace. Calderbank-Shor-Steane holographic quantum error-correcting codes. Phys. Rev. A, 98 (5): 052301, 2018. 10.1103/​PhysRevA.98.052301.
https:/​/​doi.org/​10.1103/​PhysRevA.98.052301

[36] ChunJun Cao. Non-trivial area operators require non-local magic. JHEP, 11: 105, 2024. 10.1007/​JHEP11(2024)105.
https:/​/​doi.org/​10.1007/​JHEP11(2024)105

[37] Narayanan Rengaswamy, Robert Calderbank, Michael Newman, and Henry D. Pfister. On Optimality of CSS Codes for Transversal $T$. arXiv e-prints, art. arXiv:1910.09333, October 2019. 10.48550/​arXiv.1910.09333.
https:/​/​doi.org/​10.48550/​arXiv.1910.09333
arXiv:1910.09333

[38] Stergios Koutsioumpas, Darren Banfield, and Alastair Kay. The Smallest Code with Transversal T. arXiv e-prints, art. arXiv:2210.14066, October 2022. 10.48550/​arXiv.2210.14066.
https:/​/​doi.org/​10.48550/​arXiv.2210.14066
arXiv:2210.14066

[39] Sepehr Nezami and Jeongwan Haah. Classification of small triorthogonal codes. Phys. Rev. A, 106: 012437, Jul 2022. 10.1103/​PhysRevA.106.012437. URL https:/​/​doi.org/​10.1103/​PhysRevA.106.012437.
https:/​/​doi.org/​10.1103/​PhysRevA.106.012437

[40] Michael Vasmer and Aleksander Kubica. Morphing quantum codes. PRX Quantum, 3: 030319, Aug 2022. 10.1103/​PRXQuantum.3.030319. URL https:/​/​doi.org/​10.1103/​PRXQuantum.3.030319.
https:/​/​doi.org/​10.1103/​PRXQuantum.3.030319

[41] ChunJun Cao and Brad Lackey. Growing Sparse Quantum Codes from a Seed. arXiv e-prints, art. arXiv:2507.13496, July 2025. 10.48550/​arXiv.2507.13496.
https:/​/​doi.org/​10.48550/​arXiv.2507.13496
arXiv:2507.13496

[42] Jeongwan Haah and Matthew B. Hastings. Codes and Protocols for Distilling $T$, controlled-$S$, and Toffoli Gates. Quantum, 2: 71, June 2018. ISSN 2521-327X. 10.22331/​q-2018-06-07-71. URL https:/​/​doi.org/​10.22331/​q-2018-06-07-71.
https:/​/​doi.org/​10.22331/​q-2018-06-07-71

Cited by

[1] J. Fan, M. Steinberg, A. Jahn, C. Cao, and S. Feld, "Biased-noise thresholds of zero-rate holographic codes with tensor-network decoding", Physical Review A 114 1, 012447 (2026).

[2] Mohamed Sacha, "Copy-Time Geometry from Gauge-Coded Quantum Cellular Automata: Emergent Gravity and a Golden Relation for Singlet-Scalar Dark Matter", Quantum Reports 8 2, 33 (2026).

[3] Aleksandr Berezutskii, Minzhao Liu, Atithi Acharya, Roman Ellerbrock, Johnnie Gray, Reza Haghshenas, Zichang He, Abid Khan, Viacheslav Kuzmin, Dmitry Lyakh, Danylo Lykov, Salvatore Mandrà, Christopher Mansell, Alexey Melnikov, Artem Melnikov, Vladimir Mironov, Dmitry Morozov, Florian Neukart, Alberto Nocera, Michael A. Perlin, Michael Perelshtein, Matthew Steinberg, Ruslan Shaydulin, Benjamin Villalonga, Markus Pflitsch, Marco Pistoia, Valerii Vinokur, and Yuri Alexeev, "Tensor networks for quantum computing", Nature Reviews Physics 7 10, 581 (2025).

[4] Victor V. Albert and Philippe Faist, "Handbook of Error-Correcting Codes", arXiv:2606.11484, (2026).

[5] Zijian Liang, Bowen Yang, Joseph T. Iosue, and Yu-An Chen, "Operator algebra and algorithmic construction of boundaries and defects in (2+1)D topological Pauli stabilizer codes", arXiv:2410.11942, (2024).

[6] Zijian Liang, Yijia Xu, Joseph T. Iosue, and Yu-An Chen, "Extracting Topological Orders of Generalized Pauli Stabilizer Codes in Two Dimensions", PRX Quantum 5 3, 030328 (2024).

[7] ChunJun Cao, Michael J. Gullans, Brad Lackey, and Zitao Wang, "Quantum Lego Expansion Pack: Enumerators from Tensor Networks", PRX Quantum 5 3, 030313 (2024).

[8] ChunJun Cao, Gong Cheng, and Tianci Zhou, "An efficient algorithm to compute entanglement in states with low magic", arXiv:2510.06318, (2025).

[9] Junyu Fan, Matthew Steinberg, Alexander Jahn, Chunjun Cao, Aritra Sarkar, and Sebastian Feld, "LEGO_HQEC: Automating the Analysis, Construction, and Decoding of Holographic Quantum Codes", arXiv:2410.22861, (2024).

[10] Valentine Nyirahafashimana, Nurisya Mohd Shah, Umair Abdul Halim, and Mohamed Othman, "Generalized Code Distance through Rotated Logical States in Quantum Error Correction", arXiv:2506.17062, (2025).

[11] Yariv Yanay, "Learning Better Error Correction Codes with Hybrid Quantum-Assisted Machine Learning", arXiv:2601.08014, (2026).

[12] Istiak Mahmud and Ahmed Abdelhadi, "Quantum Codes: A Comprehensive Survey of Techniques, Challenges, and Future Directions", IEEE Access 13, 214352 (2025).

The above citations are from Crossref's cited-by service (last updated successfully 2026-08-10 23:32:45) and SAO/NASA ADS (last updated successfully 2026-08-10 23:32:47). The list may be incomplete as not all publishers provide suitable and complete citation data.