From fa4240742052847e80dc624ba464945874f8346a Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 07:49:33 -0400 Subject: [PATCH 01/12] add quantum Tanner code page --- docs/src/assets/cayley_complex.svg | 449 +++++++++ docs/src/assets/local_codes.svg | 967 ++++++++++++++++++++ docs/src/assets/q_neighborhood.svg | 1354 ++++++++++++++++++++++++++++ docs/src/assets/tensor_code.svg | 342 +++++++ docs/src/qtc.md | 100 ++ 5 files changed, 3212 insertions(+) create mode 100644 docs/src/assets/cayley_complex.svg create mode 100644 docs/src/assets/local_codes.svg create mode 100644 docs/src/assets/q_neighborhood.svg create mode 100644 docs/src/assets/tensor_code.svg create mode 100644 docs/src/qtc.md diff --git a/docs/src/assets/cayley_complex.svg b/docs/src/assets/cayley_complex.svg new file mode 100644 index 0000000..c578315 --- /dev/null +++ b/docs/src/assets/cayley_complex.svg @@ -0,0 +1,449 @@ + + + + + + + + 2026-07-15T11:41:55.024456 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/assets/local_codes.svg b/docs/src/assets/local_codes.svg new file mode 100644 index 0000000..4ee3d58 --- /dev/null +++ b/docs/src/assets/local_codes.svg @@ -0,0 +1,967 @@ + + + + + + + + 2026-07-15T11:41:55.698497 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/assets/q_neighborhood.svg b/docs/src/assets/q_neighborhood.svg new file mode 100644 index 0000000..17008b0 --- /dev/null +++ b/docs/src/assets/q_neighborhood.svg @@ -0,0 +1,1354 @@ + + + + + + + + 2026-07-15T11:41:55.281874 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/assets/tensor_code.svg b/docs/src/assets/tensor_code.svg new file mode 100644 index 0000000..4b36b5a --- /dev/null +++ b/docs/src/assets/tensor_code.svg @@ -0,0 +1,342 @@ + + + + + + + + 2026-07-15T11:41:55.493477 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/src/qtc.md b/docs/src/qtc.md new file mode 100644 index 0000000..c45d07d --- /dev/null +++ b/docs/src/qtc.md @@ -0,0 +1,100 @@ +# [Quantum Tanner Codes](@id quantum-tanner-codes) + +The first asymptotically **good** quantum LDPC codes which CSS codes with constant rate, constant relative distance, and constant-weight stabilizers were obtained by Panteleev and Kalachev ([*Asymptotically good quantum and locally testable classical LDPC codes*](https://arxiv.org/abs/2111.03654)) via notions of products of chain complexes. **Quantum Tanner codes**, introduced by Leverrier and Zémor ([*Quantum Tanner codes*](https://arxiv.org/abs/2202.13641), [*Decoding quantum Tanner codes*](https://arxiv.org/abs/2208.05537)), achieve the same asymptotically code construction through an explicitly two-dimensional geometric picture without use of chain complexes which provides a much simpler perspective on building such codes. They are built on the *left-right Cayley complex* introduced in the locally testable code construction of [dinur2022locally](@cite). + +## The left-right Cayley complex + +Start with a finite group ``G`` and two (not necessarily) symmetric generating sets +``A = A^{-1}`` and ``B = B^{-1}`` with ``|A| = |B| = \Delta``. The left-right Cayley complex is a quadripartite graph on the vertex set + +```math +V = V_{00} \sqcup V_{10} \sqcup V_{01} \sqcup V_{11}, +\qquad V_{ij} = G \times \{ij\}, +``` + +where each ``a \in A`` acts by *left* multiplication (``A``-edges) and each ``b \in B`` acts by *right* multiplication (``B``-edges): a vertex ``(g, 00)`` is joined to ``(ag, 10)`` for every ``a \in A`` and to ``(gb, 01)`` for every ``b \in B``, and similarly on the other side. + +![The left-right Cayley complex](assets/cayley_complex.svg) + +The four induced bipartite subgraphs are each double covers of ordinary Cayley graphs: the ``A``-edge subgraphs are copies of the double cover of ``\mathrm{Cay}_L(G, A)``, and the ``B``-edge subgraphs are copies of the double cover of ``\mathrm{Cay}_R(G, B)``. + +The central objects are the **squares** + +```math +\{(g, 00),\ (ag, 10),\ (gb, 01),\ (agb, 11)\}, +\qquad a \in A,\ b \in B,\ g \in G, +``` + +and we write ``Q`` for the set of all of them. Each square has four vertices and each of the ``4|G|`` vertices lies on ``\Delta^2`` squares, giving ``|Q| = |G|\Delta^2``. The **``Q``-neighborhood** ``Q(v)`` of a vertex ``v`` is the set of squares containing ``v``. Since a square through ``v`` is determined by a choice of ``a \in A`` and ``b \in B``, we have ``Q(v) \cong A \times B``: the ``\Delta^2`` squares around a vertex arrange naturally into an ``|A| \times |B|`` grid. The key combinatorial fact is that neighboring vertices have grids that overlap in a controlled way: + +![Q-neighborhoods of A-edge neighbors share a row](assets/q_neighborhood.svg) + +Vertices joined by an ``A``-edge labelled ``a`` share exactly the ``a``-th row of their grids, and vertices joined by a ``B``-edge labelled ``b`` share exactly the +``b``-th column. + +## The two Tanner codes + +Fix two classical linear codes ``C_A`` and ``C_B`` of length ``\Delta`` (one bit per element of ``A`` and ``B`` respectively). Qubits live on the squares ``Q``. Following the classical Tanner code recipe, each vertex imposes a *local code* on the ``\Delta^2`` bits of its ``Q``-neighborhood — and since that neighborhood is an ``|A| \times |B|`` grid, the natural local codes are the tensor code ``C_A \otimes C_B`` (matrices whose columns lie in ``C_A`` and rows lie in ``C_B``) and its dual, the *dual tensor code* + +```math +(C_A \otimes C_B)^{\perp} + = C_A^{\perp} \otimes \mathbb{F}_2^{B} + \mathbb{F}_2^{A} \otimes C_B^{\perp}, +``` + +whose elements are sums ``c + r`` of a matrix ``c`` with columns in ``C_A^{\perp}`` and a matrix ``r`` with rows in ``C_B^{\perp}``. + +![Local views of the X and Z codes](assets/local_codes.svg) + +The CSS code is defined by two classical Tanner codes living on the two "diagonal" graphs of the complex. Let ``\mathcal{G}_0^{\square}`` be the graph on ``V_{00} \sqcup V_{11}`` with an edge for every square (joining its two even-parity corners), and ``\mathcal{G}_1^{\square}`` the analogous graph on ``V_{01} \sqcup V_{10}``. Then + +```math +C_0 = \mathrm{Tan}\bigl(\mathcal{G}_0^{\square},\ +C_A^{\perp} \otimes \mathbb{F}_2^{B} + \mathbb{F}_2^{A} \otimes C_B^{\perp}\bigr), +\qquad +C_1 = \mathrm{Tan}\bigl(\mathcal{G}_1^{\square},\ +C_A \otimes \mathbb{F}_2^{B} + \mathbb{F}_2^{A} \otimes C_B\bigr), +``` + +with the ``X``-checks of ``C_0`` drawn from ``C_A \otimes C_B`` at even-parity vertices and the ``Z``-checks of ``C_1`` drawn from ``C_A^{\perp} \otimes C_B^{\perp}`` at odd-parity vertices. Commutation of the stabilizers reduces to a local statement: whenever an ``X``-check and a ``Z``-check overlap, they overlap on a single shared row or column of their grids, where one restricts to a codeword of ``C_A`` (or ``C_B``) and the other to a codeword of ``C_A^{\perp}`` (or ``C_B^{\perp}``) — so their inner product vanishes, and the pair ``(C_0, C_1)`` forms a valid CSS code. + +## Parameters + +With ``n = |Q| = |G|\Delta^2`` qubits and the standard choice ``C_A = [\Delta, \rho\Delta]``, ``C_B = [\Delta, (1-\rho)\Delta]`` for a constant ``\rho \in (0, 1)``, counting parity checks gives + +```math +k \geq n - 4|G|\rho(1-\rho)\Delta^2 = (1 - 2\rho)^2\, n, +``` + +so the code has **constant rate** whenever ``\rho \neq 1/2``. Every check acts on at most ``\Delta^2`` qubits and every qubit is acted on by at most ``\Delta^2`` checks, so for constant ``\Delta`` the code is **LDPC**. + +Distance is where the expander graphs enter. Two ingredients are needed: + +1. **Spectral expansion.** The Cayley graphs ``\mathrm{Cay}_L(G, A)`` and ``\mathrm{Cay}_R(G, B)`` must be Ramanujan, i.e. ``\lambda \leq 2\sqrt{\Delta}``. Edges of ``\mathcal{G}_i^{\square}`` correspond to a simultaneous choice of an ``A``-edge and a ``B``-edge, the two adjacency operators commute, and their eigenvalues multiply — so ``\lambda(\mathcal{G}_i^{\square}) \leq 4\Delta = 4\sqrt{\Delta^2}``, making the Tanner graphs *almost Ramanujan* at degree ``\Delta^2``. This is precisely the role played by the [Morgenstern](@ref morgenstern-graphs) and [LPS](@ref lps-graphs) Ramanujan graphs in this package. +2. **Product expansion.** Because local views decompose as ``x_v = c_v + r_v``, the analysis needs codes where ``|x_v|`` cannot collapse through cancellation between ``c_v`` and ``r_v`` — quantitatively, ``\kappa``-*product expansion*: every local codeword admits a decomposition with ``|x| \geq \kappa\Delta(\lVert c \rVert + \lVert r \rVert)``. Random choices of ``C_A, C_B`` are product expanding with high probability ([Panteleev–Kalachev](https://arxiv.org/abs/2111.03654)), which motivates the random constructions below. +Together these yield constant relative distance, completing the good-qLDPC +parameter trifecta. + +## Constructing quantum Tanner codes with this package + + +## Further reading + +- Leverrier & Zémor, [*Quantum Tanner codes*](https://arxiv.org/abs/2202.13641) + and [*Decoding quantum Tanner codes*](https://arxiv.org/abs/2208.05537) — the + original construction and its decoder; the presentation above follows the + simplified version from the second paper. +- [dinur2022locally](@cite) — the left-right Cayley complex and locally testable + codes with constant rate, distance, and locality. +- Panteleev & Kalachev, + [*Asymptotically good quantum and locally testable classical LDPC codes*](https://arxiv.org/abs/2111.03654) + — the first good qLDPC codes and the product-expansion theorem for random codes. +- John Wright's UC Berkeley CS294 *Quantum Coding Theory* lecture notes + (Spring 2024), Lectures 19–20 — an excellent, accessible exposition of the + construction, the CSS property, and the parameter analysis, which this page's + organization gratefully follows at a high level. +## References + +```@bibliography +Pages = ["quantum_tanner.md"] +Canonical = false +``` \ No newline at end of file From 4bafc436707bf215ed693cf5af9d58e8ce972868 Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 07:52:50 -0400 Subject: [PATCH 02/12] polish --- docs/src/qtc.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/docs/src/qtc.md b/docs/src/qtc.md index c45d07d..d0a148a 100644 --- a/docs/src/qtc.md +++ b/docs/src/qtc.md @@ -79,19 +79,14 @@ parameter trifecta. ## Further reading -- Leverrier & Zémor, [*Quantum Tanner codes*](https://arxiv.org/abs/2202.13641) - and [*Decoding quantum Tanner codes*](https://arxiv.org/abs/2208.05537) — the - original construction and its decoder; the presentation above follows the - simplified version from the second paper. +- Leverrier & Zémor, [*Quantum Tanner codes*](https://arxiv.org/abs/2202.13641) and [*Decoding quantum Tanner codes*](https://arxiv.org/abs/2208.05537) - [dinur2022locally](@cite) — the left-right Cayley complex and locally testable codes with constant rate, distance, and locality. -- Panteleev & Kalachev, - [*Asymptotically good quantum and locally testable classical LDPC codes*](https://arxiv.org/abs/2111.03654) - — the first good qLDPC codes and the product-expansion theorem for random codes. +- Panteleev & Kalachev, [*Asymptotically good quantum and locally testable classical LDPC codes*](https://arxiv.org/abs/2111.03654) - John Wright's UC Berkeley CS294 *Quantum Coding Theory* lecture notes - (Spring 2024), Lectures 19–20 — an excellent, accessible exposition of the - construction, the CSS property, and the parameter analysis, which this page's - organization gratefully follows at a high level. + (Spring 2024), Lectures 19–20 provides an excellent, accessible exposition of the + quantum Tanner construction which this page gratefully follows at a high level. + ## References ```@bibliography From 488ba26fe1e1a729d5c8bffd3dbdbbb5f4ce7ceb Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 07:54:33 -0400 Subject: [PATCH 03/12] polish --- docs/src/qtc.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/src/qtc.md b/docs/src/qtc.md index d0a148a..ecdab5c 100644 --- a/docs/src/qtc.md +++ b/docs/src/qtc.md @@ -80,12 +80,9 @@ parameter trifecta. ## Further reading - Leverrier & Zémor, [*Quantum Tanner codes*](https://arxiv.org/abs/2202.13641) and [*Decoding quantum Tanner codes*](https://arxiv.org/abs/2208.05537) -- [dinur2022locally](@cite) — the left-right Cayley complex and locally testable - codes with constant rate, distance, and locality. +- [dinur2022locally](@cite) — the left-right Cayley complex and locally testable codes with constant rate, distance, and locality. - Panteleev & Kalachev, [*Asymptotically good quantum and locally testable classical LDPC codes*](https://arxiv.org/abs/2111.03654) -- John Wright's UC Berkeley CS294 *Quantum Coding Theory* lecture notes - (Spring 2024), Lectures 19–20 provides an excellent, accessible exposition of the - quantum Tanner construction which this page gratefully follows at a high level. +- John Wright's UC Berkeley CS294 *Quantum Coding Theory* lecture notes (Spring 2024), Lectures 19–20 provides an excellent, accessible exposition of the quantum Tanner construction which this page gratefully follows at a high level. ## References From 46cbfd0efb3d600910bda4ab7b3e98087df86c70 Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 08:02:33 -0400 Subject: [PATCH 04/12] update make.jl --- docs/make.jl | 3 +- docs/src/index.md | 54 +++++++++++++------------- docs/src/{qtc.md => quantum_tanner.md} | 0 3 files changed, 30 insertions(+), 27 deletions(-) rename docs/src/{qtc.md => quantum_tanner.md} (100%) diff --git a/docs/make.jl b/docs/make.jl index 546bc82..083ad89 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -29,8 +29,9 @@ format = Documenter.HTML(), authors = "Feroz Ahmed Mian, Stefan Krastanov, Vaishnavi Addala, QuantumSavory community members", pages = [ "QuantumExpanders.jl" => "index.md", - "Morgenstern Ramanujan Graphs" => "morgenstern.md", + "Quantum Tanner Codes" => "quantum_tanner.md", "Lubotzky–Phillips–Sarnak Ramanujan Graphs" => "lps.md", + "Morgenstern Ramanujan Graphs" => "morgenstern.md", "API" => "API.md", ], linkcheck = true diff --git a/docs/src/index.md b/docs/src/index.md index cc1b5a1..7f79793 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,54 +1,54 @@ # QuantumExpanders.jl - + A Julia library for constructing quantum Tanner codes and related expander-based quantum LDPC codes, built on top of [Oscar](https://www.oscar-system.org/), [QECCore](https://github.com/QuantumSavory/QECCore.jl), and [QuantumClifford](https://github.com/QuantumSavory/QuantumClifford.jl). - -The library provides the following methods to construct explicit instances of *quantum Tanner codes*. - + +The library provides the following methods to construct explicit instances of *quantum Tanner codes* — see the [Quantum Tanner Codes](@ref quantum-tanner-codes) page for background on the construction and its parameters. + ```mermaid graph TD QuantumTannerCodes["Quantum Tanner Codes"] --> RandomMethods["Random Methods"] QuantumTannerCodes --> DeterministicMethods["Deterministic Methods"] - + subgraph "Random construction" RandomMethods --> RandomQuantumTannerCode["`random_quantum_Tanner_code`"] end - + subgraph "Deterministic construction" DeterministicMethods --> QuantumTannerCode["`QuantumTannerCode`"] DeterministicMethods --> GeneralizedQuantumTannerCode["`GeneralizedQuantumTannerCode`"] end ``` - + ## Quick Example - -Constructing a random quantum Tanner code from Morgenstern generators of ``SL_2(\mathbb{F}_4)``: - + +Constructing a random quantum Tanner code from [Morgenstern generators](@ref morgenstern-graphs) of ``SL_2(\mathbb{F}_4)``: + ```julia julia> using QuantumExpanders, Oscar, QuantumClifford, QuantumClifford.ECC, QECCore - + julia> using Random: MersenneTwister - + julia> l = 1; i = 2; - + julia> q = 2^l 2 - + julia> Δ = q + 1 3 - + julia> SL₂, B = morgenstern_generators(l, i) [ Info: |SL₂(𝔽(4))| = 60 (SL(2,4), Oscar.MatrixGroupElem{Nemo.FqFieldElem, Nemo.FqMatrix}[[o+1 o+1; 1 o+1], [o+1 1; o+1 o+1], [o+1 o; o o+1]]) - + julia> A = alternative_morgenstern_generators(B, FirstOnly()) 4-element Vector{Oscar.MatrixGroupElem{Nemo.FqFieldElem, Nemo.FqMatrix}}: [0 1; 1 o+1] [o+1 1; 1 0] [o+1 o+1; o 0] [0 o+1; o o+1] - + julia> rng = MersenneTwister(892529278); - + julia> hx, hz = random_quantum_Tanner_code(0.75, SL₂, A, B, rng=rng); (length(group), length(A), length(B)) = (60, 4, 3) length(group) * length(A) * length(B) = 720 @@ -64,27 +64,29 @@ size(Cᶻ) = (2, 12) r1 = rank(𝒞ˣ) = 179 r2 = rank(𝒞ᶻ) = 120 ``` - + The resulting parity check matrices define a CSS code whose parameters can be computed with `QECCore` and `QuantumClifford.ECC`: - + ```julia julia> c = CSS(hx, hz); - + julia> import JuMP; import HiGHS; - + julia> code_n(c), code_k(c) (360, 61) - + julia> distance(c, DistanceMIPAlgorithm(solver = HiGHS.Optimizer, logical_operator_type = :Z, time_limit = 900)), distance(c, DistanceMIPAlgorithm(solver = HiGHS.Optimizer, logical_operator_type = :X, time_limit = 900)) (3, 10) ``` - + The library also provides two **explicit constructions** of [Ramanujan graphs](https://en.wikipedia.org/wiki/Ramanujan_graph), which can be used independently of the quantum code constructions: - + ```mermaid flowchart TB A["Ramanujan Graphs"] - A --> B["Lubotzky–Phillips–Sarnak
(1986)
(prime p ≡ 1 mod 4)"] + A --> B["Lubotzky–Phillips–Sarnak
(1988)
(prime p ≡ 1 mod 4)"] A --> C["Morgenstern (1994)
(even prime power q)"] ``` + +See the [Lubotzky–Phillips–Sarnak](@ref lps-graphs) and [Morgenstern](@ref morgenstern-graphs) pages for the constructions, their spectral, girth, diameter, chromatic, and independence properties, and worked examples verifying each property. \ No newline at end of file diff --git a/docs/src/qtc.md b/docs/src/quantum_tanner.md similarity index 100% rename from docs/src/qtc.md rename to docs/src/quantum_tanner.md From aa4281a5c58461d52184f319fda24beff0b92cda Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 08:04:25 -0400 Subject: [PATCH 05/12] polish --- docs/src/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 7f79793..f93d2b6 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -85,7 +85,7 @@ The library also provides two **explicit constructions** of [Ramanujan graphs](h ```mermaid flowchart TB A["Ramanujan Graphs"] - A --> B["Lubotzky–Phillips–Sarnak
(1988)
(prime p ≡ 1 mod 4)"] + A --> B["Lubotzky–Phillips–Sarnak
(1986)
"] A --> C["Morgenstern (1994)
(even prime power q)"] ``` From a3051f12a7856873b95c985d247d9484129f994b Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 08:08:45 -0400 Subject: [PATCH 06/12] polish --- docs/src/index.md | 48 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index f93d2b6..e9520a8 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,54 +1,52 @@ # QuantumExpanders.jl - + A Julia library for constructing quantum Tanner codes and related expander-based quantum LDPC codes, built on top of [Oscar](https://www.oscar-system.org/), [QECCore](https://github.com/QuantumSavory/QECCore.jl), and [QuantumClifford](https://github.com/QuantumSavory/QuantumClifford.jl). - + The library provides the following methods to construct explicit instances of *quantum Tanner codes* — see the [Quantum Tanner Codes](@ref quantum-tanner-codes) page for background on the construction and its parameters. - + ```mermaid graph TD QuantumTannerCodes["Quantum Tanner Codes"] --> RandomMethods["Random Methods"] QuantumTannerCodes --> DeterministicMethods["Deterministic Methods"] - subgraph "Random construction" RandomMethods --> RandomQuantumTannerCode["`random_quantum_Tanner_code`"] end - subgraph "Deterministic construction" DeterministicMethods --> QuantumTannerCode["`QuantumTannerCode`"] DeterministicMethods --> GeneralizedQuantumTannerCode["`GeneralizedQuantumTannerCode`"] end ``` - + ## Quick Example - + Constructing a random quantum Tanner code from [Morgenstern generators](@ref morgenstern-graphs) of ``SL_2(\mathbb{F}_4)``: - + ```julia julia> using QuantumExpanders, Oscar, QuantumClifford, QuantumClifford.ECC, QECCore - + julia> using Random: MersenneTwister - + julia> l = 1; i = 2; - + julia> q = 2^l 2 - + julia> Δ = q + 1 3 - + julia> SL₂, B = morgenstern_generators(l, i) [ Info: |SL₂(𝔽(4))| = 60 (SL(2,4), Oscar.MatrixGroupElem{Nemo.FqFieldElem, Nemo.FqMatrix}[[o+1 o+1; 1 o+1], [o+1 1; o+1 o+1], [o+1 o; o o+1]]) - + julia> A = alternative_morgenstern_generators(B, FirstOnly()) 4-element Vector{Oscar.MatrixGroupElem{Nemo.FqFieldElem, Nemo.FqMatrix}}: [0 1; 1 o+1] [o+1 1; 1 0] [o+1 o+1; o 0] [0 o+1; o o+1] - + julia> rng = MersenneTwister(892529278); - + julia> hx, hz = random_quantum_Tanner_code(0.75, SL₂, A, B, rng=rng); (length(group), length(A), length(B)) = (60, 4, 3) length(group) * length(A) * length(B) = 720 @@ -64,29 +62,29 @@ size(Cᶻ) = (2, 12) r1 = rank(𝒞ˣ) = 179 r2 = rank(𝒞ᶻ) = 120 ``` - + The resulting parity check matrices define a CSS code whose parameters can be computed with `QECCore` and `QuantumClifford.ECC`: - + ```julia julia> c = CSS(hx, hz); - + julia> import JuMP; import HiGHS; - + julia> code_n(c), code_k(c) (360, 61) - + julia> distance(c, DistanceMIPAlgorithm(solver = HiGHS.Optimizer, logical_operator_type = :Z, time_limit = 900)), distance(c, DistanceMIPAlgorithm(solver = HiGHS.Optimizer, logical_operator_type = :X, time_limit = 900)) (3, 10) ``` - + The library also provides two **explicit constructions** of [Ramanujan graphs](https://en.wikipedia.org/wiki/Ramanujan_graph), which can be used independently of the quantum code constructions: - + ```mermaid flowchart TB A["Ramanujan Graphs"] A --> B["Lubotzky–Phillips–Sarnak
(1986)
"] A --> C["Morgenstern (1994)
(even prime power q)"] ``` - -See the [Lubotzky–Phillips–Sarnak](@ref lps-graphs) and [Morgenstern](@ref morgenstern-graphs) pages for the constructions, their spectral, girth, diameter, chromatic, and independence properties, and worked examples verifying each property. \ No newline at end of file + +See the [Lubotzky–Phillips–Sarnak](@ref lps-graphs) and [Morgenstern](@ref morgenstern-graphs) pages for the constructions, their spectral, [girth](https://en.wikipedia.org/wiki/Girth_(graph_theory)), [diameter](https://en.wikipedia.org/wiki/Diameter_(graph_theory)), [chromatic](https://en.wikipedia.org/wiki/Graph_coloring), and [independence properties](https://en.wikipedia.org/wiki/Independent_set_(graph_theory)), and worked examples verifying each property. \ No newline at end of file From 418a01a9701381be1d9eefc3f365f7371fbbf59a Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 08:16:43 -0400 Subject: [PATCH 07/12] add tensor code figure --- docs/src/quantum_tanner.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/src/quantum_tanner.md b/docs/src/quantum_tanner.md index ecdab5c..0cedfca 100644 --- a/docs/src/quantum_tanner.md +++ b/docs/src/quantum_tanner.md @@ -34,7 +34,11 @@ Vertices joined by an ``A``-edge labelled ``a`` share exactly the ``a``-th row o ## The two Tanner codes -Fix two classical linear codes ``C_A`` and ``C_B`` of length ``\Delta`` (one bit per element of ``A`` and ``B`` respectively). Qubits live on the squares ``Q``. Following the classical Tanner code recipe, each vertex imposes a *local code* on the ``\Delta^2`` bits of its ``Q``-neighborhood — and since that neighborhood is an ``|A| \times |B|`` grid, the natural local codes are the tensor code ``C_A \otimes C_B`` (matrices whose columns lie in ``C_A`` and rows lie in ``C_B``) and its dual, the *dual tensor code* +Fix two classical linear codes ``C_A`` and ``C_B`` of length ``\Delta`` (one bit per element of ``A`` and ``B`` respectively). Qubits live on the squares ``Q``. Following the classical Tanner code recipe, each vertex imposes a *local code* on the ``\Delta^2`` bits of its ``Q``-neighborhood — and since that neighborhood is an ``|A| \times |B|`` grid, the natural local codes are the tensor code ``C_A \otimes C_B`` (matrices whose columns lie in ``C_A`` and rows lie in ``C_B``): + +![The tensor code](assets/tensor_code.svg) + +and its dual, the *dual tensor code* ```math (C_A \otimes C_B)^{\perp} From fa4806f03d4b970273dda44921a4d478998214df Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 11:12:28 -0400 Subject: [PATCH 08/12] improve LRCC description. --- docs/src/quantum_tanner.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/src/quantum_tanner.md b/docs/src/quantum_tanner.md index 0cedfca..204f75d 100644 --- a/docs/src/quantum_tanner.md +++ b/docs/src/quantum_tanner.md @@ -4,9 +4,10 @@ The first asymptotically **good** quantum LDPC codes which CSS codes with consta ## The left-right Cayley complex -Start with a finite group ``G`` and two (not necessarily) symmetric generating sets -``A = A^{-1}`` and ``B = B^{-1}`` with ``|A| = |B| = \Delta``. The left-right Cayley complex is a quadripartite graph on the vertex set - +Let ``G`` be a finite group. Let ``A`` and ``B`` be symmetric generating sets of ``G``, satisfying ``A = A^{-1}`` and ``B = B^{-1}``, so that each set is closed under taking inverses. We assume that both ``A`` and ``B`` generate the entire group ``G`` and have the same cardinality, ``|A| = |B| = \Delta``. The two generating sets may also be chosen to be identical (i.e., ``A = B``). + +The **left-right Cayley complex** is defined as a quadripartite graph with vertex set + ```math V = V_{00} \sqcup V_{10} \sqcup V_{01} \sqcup V_{11}, \qquad V_{ij} = G \times \{ij\}, From 31f509accb5f0ddc5891e845fa13683e76bac1ab Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 11:28:14 -0400 Subject: [PATCH 09/12] improve LRCC docs. --- docs/src/quantum_tanner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/quantum_tanner.md b/docs/src/quantum_tanner.md index 204f75d..9340846 100644 --- a/docs/src/quantum_tanner.md +++ b/docs/src/quantum_tanner.md @@ -4,7 +4,7 @@ The first asymptotically **good** quantum LDPC codes which CSS codes with consta ## The left-right Cayley complex -Let ``G`` be a finite group. Let ``A`` and ``B`` be symmetric generating sets of ``G``, satisfying ``A = A^{-1}`` and ``B = B^{-1}``, so that each set is closed under taking inverses. We assume that both ``A`` and ``B`` generate the entire group ``G`` and have the same cardinality, ``|A| = |B| = \Delta``. The two generating sets may also be chosen to be identical (i.e., ``A = B``). +Let ``G`` be a finite group. Let ``A`` and ``B`` be symmetric generating sets of ``G``, satisfying ``A = A^{-1}`` and ``B = B^{-1}``. In other words, for every ``a \in A``, we have ``a^{-1} \in A``, and for every ``b \in B``, we have ``b^{-1} \in B``. This property ensures that the corresponding Cayley graphs are *undirected*. We assume that both ``A`` and ``B`` generate the entire group ``G`` and have the same cardinality, ``|A| = |B| = \Delta``. The two generating sets may be chosen to be identical (i.e., ``A = B``). The **left-right Cayley complex** is defined as a quadripartite graph with vertex set From 466a429f6ee5f52018ebdc11d5a3870e63dd236b Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 11:30:58 -0400 Subject: [PATCH 10/12] polish --- docs/src/quantum_tanner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/quantum_tanner.md b/docs/src/quantum_tanner.md index 9340846..dfee9fd 100644 --- a/docs/src/quantum_tanner.md +++ b/docs/src/quantum_tanner.md @@ -1,6 +1,6 @@ # [Quantum Tanner Codes](@id quantum-tanner-codes) -The first asymptotically **good** quantum LDPC codes which CSS codes with constant rate, constant relative distance, and constant-weight stabilizers were obtained by Panteleev and Kalachev ([*Asymptotically good quantum and locally testable classical LDPC codes*](https://arxiv.org/abs/2111.03654)) via notions of products of chain complexes. **Quantum Tanner codes**, introduced by Leverrier and Zémor ([*Quantum Tanner codes*](https://arxiv.org/abs/2202.13641), [*Decoding quantum Tanner codes*](https://arxiv.org/abs/2208.05537)), achieve the same asymptotically code construction through an explicitly two-dimensional geometric picture without use of chain complexes which provides a much simpler perspective on building such codes. They are built on the *left-right Cayley complex* introduced in the locally testable code construction of [dinur2022locally](@cite). +The first asymptotically **good** quantum LDPC codes which CSS codes with constant rate, constant relative distance, and constant-weight stabilizers were obtained by Panteleev and Kalachev ([*Asymptotically good quantum and locally testable classical LDPC codes*](https://arxiv.org/abs/2111.03654)) via notions of products of chain complexes. **Quantum Tanner codes**, introduced by Leverrier and Zémor ([*Quantum Tanner codes*](https://arxiv.org/abs/2202.13641), [*Decoding quantum Tanner codes*](https://arxiv.org/abs/2208.05537)), achieve the same asymptotically good codes through an explicitly two-dimensional geometric picture without use of chain complexes which provides a much simpler perspective on building such codes. They are built on the *left-right Cayley complex* introduced in the locally testable code construction of [dinur2022locally](@cite). ## The left-right Cayley complex From 35361fc0dbdc9559dfcc7eb0b89790f276054cdc Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 11:34:05 -0400 Subject: [PATCH 11/12] improve docs --- docs/src/quantum_tanner.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/quantum_tanner.md b/docs/src/quantum_tanner.md index dfee9fd..fd04b0f 100644 --- a/docs/src/quantum_tanner.md +++ b/docs/src/quantum_tanner.md @@ -17,7 +17,7 @@ where each ``a \in A`` acts by *left* multiplication (``A``-edges) and each ``b ![The left-right Cayley complex](assets/cayley_complex.svg) -The four induced bipartite subgraphs are each double covers of ordinary Cayley graphs: the ``A``-edge subgraphs are copies of the double cover of ``\mathrm{Cay}_L(G, A)``, and the ``B``-edge subgraphs are copies of the double cover of ``\mathrm{Cay}_R(G, B)``. +The four induced bipartite subgraphs are each [double covers](https://en.wikipedia.org/wiki/Bipartite_double_cover) of ordinary Cayley graphs: the ``A``-edge subgraphs are copies of the double cover of ``\mathrm{Cay}_L(G, A)``, and the ``B``-edge subgraphs are copies of the double cover of ``\mathrm{Cay}_R(G, B)``. The central objects are the **squares** @@ -26,7 +26,7 @@ The central objects are the **squares** \qquad a \in A,\ b \in B,\ g \in G, ``` -and we write ``Q`` for the set of all of them. Each square has four vertices and each of the ``4|G|`` vertices lies on ``\Delta^2`` squares, giving ``|Q| = |G|\Delta^2``. The **``Q``-neighborhood** ``Q(v)`` of a vertex ``v`` is the set of squares containing ``v``. Since a square through ``v`` is determined by a choice of ``a \in A`` and ``b \in B``, we have ``Q(v) \cong A \times B``: the ``\Delta^2`` squares around a vertex arrange naturally into an ``|A| \times |B|`` grid. The key combinatorial fact is that neighboring vertices have grids that overlap in a controlled way: +and we write ``Q`` for the set of all of them. Each square has four distinct vertices and each of the ``4|G|`` vertices lies on ``\Delta^2`` squares, giving ``|Q| = |G|\Delta^2``. The **``Q``-neighborhood** ``Q(v)`` of a vertex ``v`` is the set of squares containing ``v``. Since a square through ``v`` is determined by a choice of ``a \in A`` and ``b \in B``, we have ``Q(v) \cong A \times B``: the ``\Delta^2`` squares around a vertex arrange naturally into an ``|A| \times |B|`` grid. The important fact is that neighboring vertices have grids that overlap in a way that is useful. ![Q-neighborhoods of A-edge neighbors share a row](assets/q_neighborhood.svg) From 3659201301d138f756d27526f7dcd77256c5757d Mon Sep 17 00:00:00 2001 From: Fe-r-oz Date: Wed, 15 Jul 2026 11:44:48 -0400 Subject: [PATCH 12/12] polish docs --- docs/src/quantum_tanner.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/quantum_tanner.md b/docs/src/quantum_tanner.md index fd04b0f..3fd55be 100644 --- a/docs/src/quantum_tanner.md +++ b/docs/src/quantum_tanner.md @@ -72,7 +72,7 @@ k \geq n - 4|G|\rho(1-\rho)\Delta^2 = (1 - 2\rho)^2\, n, so the code has **constant rate** whenever ``\rho \neq 1/2``. Every check acts on at most ``\Delta^2`` qubits and every qubit is acted on by at most ``\Delta^2`` checks, so for constant ``\Delta`` the code is **LDPC**. -Distance is where the expander graphs enter. Two ingredients are needed: +Proving that the lower and upper bounds on the code distance are linear in the number of physical qubits requires strong expansion properties of the Cayley graphs. This is where expander graphs, and specifically their expansion properties, play a crucial role. Two ingredients are needed: 1. **Spectral expansion.** The Cayley graphs ``\mathrm{Cay}_L(G, A)`` and ``\mathrm{Cay}_R(G, B)`` must be Ramanujan, i.e. ``\lambda \leq 2\sqrt{\Delta}``. Edges of ``\mathcal{G}_i^{\square}`` correspond to a simultaneous choice of an ``A``-edge and a ``B``-edge, the two adjacency operators commute, and their eigenvalues multiply — so ``\lambda(\mathcal{G}_i^{\square}) \leq 4\Delta = 4\sqrt{\Delta^2}``, making the Tanner graphs *almost Ramanujan* at degree ``\Delta^2``. This is precisely the role played by the [Morgenstern](@ref morgenstern-graphs) and [LPS](@ref lps-graphs) Ramanujan graphs in this package. 2. **Product expansion.** Because local views decompose as ``x_v = c_v + r_v``, the analysis needs codes where ``|x_v|`` cannot collapse through cancellation between ``c_v`` and ``r_v`` — quantitatively, ``\kappa``-*product expansion*: every local codeword admits a decomposition with ``|x| \geq \kappa\Delta(\lVert c \rVert + \lVert r \rVert)``. Random choices of ``C_A, C_B`` are product expanding with high probability ([Panteleev–Kalachev](https://arxiv.org/abs/2111.03654)), which motivates the random constructions below.