# Quantum Lego code[1]

## Description

Block quantum code constructed using a tensor-network-based graphical framework from quantum Lego blocks, which are smaller quantum codes over qubits or qudits. The class of codes constructed using the framework depends on the choice of atomic Lego blocks.

The individual Lego blocks and resulting quantum Lego codes can be stabilizer or non-stabilizer. However, both the logical and physical degrees of freedom must have the same local dimension.

For example, any stabilizer code can be built out of atomic blocks like the 2-site repetition code, single-site trivial stabilizer codes, and tensor products of the \(|0\rangle\) state. Specifically, the HaPPY holographic code is a quantum Lego code whose atomic Lego block is the five-qubit perfect qubit code.

Many known codes can be created using this code''s methods in order to further their understanding, including a 6 qubit implementaion of the generalized Bacon-Shor code, the Toric code, and the \([[7,1,3]]\) Steane code. For example, a simple \( [[4,2,2]] \) stabilizer code can be written as a rank 6 tensor. Attaching two of these via gluing together one logical leg from each can produce a \([[6,4,2]]\) stabilizer code. Code optimization in this framework can be done using reinforcement learning [2].

To construct a Lego code, the encoding map \(V\) for each code that is to be used in the construction is converted to a tensor by decomposing it using the formula \begin{align} V = \sum_{i_j} V_{i_1 \ldots i_{n+k}} | i_{k+1} \ldots i_{k+n} \rangle \langle i_1 \ldots i_k |~. \tag*{(1)}\end{align} We then look at the codes graphically, treating each \(i_j\) as an edge dangling out of the tensor vertex \(V_{i_1 \ldots i_{n+k}}\). These edges are either connected to another tensor vertex's edges or left dangling. If the block codes are stabilizer, then each local tensor has unitary product stabilizers (UPS). The goal is to push each UPS through the tensor network until each dangling edge has only trivial support. Otherwise, a matching value is pushed through the edge and the process is repeated on the next tensor. If a UPS can be pushed through the whole network, then a UPS for the larger network has been found. The dangling legs (edges) and UPS of the whole network can then be converted to physical/logical elements and stabilizers/logical operators for a new quantum code.

## Encoding

## Decoding

## Parent

## Child

- Modular-qudit stabilizer code — Modular-qudit stabilizer codes are quantum Lego codes built out of atomic blocks such as the 2-qudit repetition code, single-qudit trivial stabilizer codes, and tensor-products of the \(|0\rangle\) state.

## Cousins

- Holographic code — Quantum Lego codes codes whose encoders are tensor networks discretizing hyperbolic space can be thought of as holographic codes. More generally, tensor-network codes are types of LEGO codes made from stabilizer codes where logical and physical legs are pre-assigned and logical legs are not contracted. In other words, logical legs resulting from the conversion of codes to tensors must remain logical in the final tensor network, and the same for physical. Contracting logical legs is another word for gluing two logical legs together.
- Concatenated quantum code — Concatenations of block quantum codes can be expressed as quantum Lego codes.
- \([[6,4,2]]\) error-detecting code — The \([[6,4,2]]\) error-detecting code can be constructed out of two \([[4,2,2]]\) codes in the quantum Lego code framework.

## References

- [1]
- C. Cao and B. Lackey, “Quantum Lego: Building Quantum Error Correction Codes from Tensor Networks”, PRX Quantum 3, (2022) arXiv:2109.08158 DOI
- [2]
- V. P. Su et al., “Discovery of Optimal Quantum Error Correcting Codes via Reinforcement Learning”, (2023) arXiv:2305.06378
- [3]
- T. Farrelly et al., “Tensor-Network Codes”, Physical Review Letters 127, (2021) arXiv:2009.10329 DOI
- [4]
- A. J. Ferris and D. Poulin, “Tensor Networks and Quantum Error Correction”, Physical Review Letters 113, (2014) arXiv:1312.4578 DOI

## Page edit log

- Victor V. Albert (2022-05-25) — most recent
- Thomas Wrona (2022-05-18)

## Cite as:

“Quantum Lego code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2022. https://errorcorrectionzoo.org/c/quantum_lego