# Multivariate Multicycle Codes Paper Guidance

This folder is a standalone paper draft repository for "Multivariate Multicycle
Codes for Complete Single-Shot Decoding." The manuscript introduces
multivariate multicycle (MM) quantum error-correcting codes: CSS codes built
from Koszul complexes over multivariate quotient rings. The central point is
that this construction unifies several algebraic qLDPC families, including BB,
MB, GB, TT, abelian 2BGA, AMC, and toric-code examples, while extending them to
long enough complexes to provide both X and Z metachecks for complete
single-shot decoding. The empirical case is that numerical searches find
practical-size MM instances with high rate, high distance, and unusually strong
confinement profiles.

## Folder Layout

- `main.tex` is the whole RevTeX manuscript. Keep the paper single-file unless
  explicitly asked to restructure it; the preamble is intentionally messy and
  submission-oriented.
- `bibliography.bib` contains the references.
- Plot and figure assets live flat in this directory. Do not move them into a
  shared image folder unless asked.
- `subfamiliesofMM.pdf` is the only active external vector figure. The
  construction comparison figure is TikZ inside `main.tex`.
- The folder has its own `.git` repository. Check status inside this directory
  before touching generated or replacement assets.

For a build sanity check, prefer `latexmk -pdf main.tex` if available. A manual
fallback is the usual RevTeX/BibTeX cycle:

```bash
pdflatex main.tex
bibtex main
pdflatex main.tex
pdflatex main.tex
```

## Core Chain-Complex Message

A big conceptual message of the paper is that the X and Z parity checks, and
the X and Z metachecks, are not independent objects. They are adjacent boundary
maps in one length-5 chain complex. For the main `t = 4` MM construction, start
with the quotient ring

```tex
S = F_2[w,x,y,z] / <w^ell - 1, x^m - 1, y^p - 1, z^r - 1>
```

and four chosen quotient-ring polynomials `F, G, H, I in S`. The Koszul complex
is

```tex
0 <- K_0 <-partial_1- K_1 <-partial_2- K_2
  <-partial_3- K_3 <-partial_4- K_4 <- 0.
```

The semantic roles of the five vector spaces are:

- `K_4 ~= S`: Z metacheck labels, i.e. relations among Z parity checks.
- `K_3 ~= S^4`: Z parity-check labels.
- `K_2 ~= S^6`: physical data qubits.
- `K_1 ~= S^4`: X parity-check labels.
- `K_0 ~= S`: X metacheck labels, i.e. relations among X parity checks.

If `N = ell*m*p*r`, then after replacing each polynomial by its `N x N`
circulant binary matrix, the dimensions are `N, 4N, 6N, 4N, N`, so the CSS
code has blocklength `6N`.

In the paper's block-matrix convention, the boundary maps are:

```tex
partial_4 = [ F  G  H  I ]

partial_3 =
[ G  H  I  0  0  0
  F  0  0  H  I  0
  0  F  0  G  0  I
  0  0  F  0  G  H ]

partial_2 =
[ H  I  0  0
  G  0  I  0
  0  G  H  0
  F  0  0  I
  0  F  0  H
  0  0  F  G ]

partial_1 =
[ I
  H
  G
  F ]
```

The CSS and metacheck matrices are identified as

```tex
P_Z = partial_3
P_X = partial_2^T
M_Z = partial_4
M_X = partial_1^T
```

The chain-complex identities are the reason the code conditions hold:

```tex
partial_4 partial_3 = 0     <=>     M_Z P_Z = 0
partial_3 partial_2 = 0     <=>     P_Z P_X^T = 0
partial_2 partial_1 = 0     <=>     M_X P_X = 0
```

Keep this story consistent when editing the introduction, formalism section,
construction algorithms, examples, and captions: metachecks are the neighboring
boundary maps around the parity-check maps, and physical qubits live in the
middle space `K_2`.

## Section Map

- `Introduction`: states the motivation around qLDPC codes, single-shot and
  few-shot decoding, metachecks, and the Koszul unification of existing
  algebraic code families. Keep the abstract, intro claims, main numerical
  figures, and explicit-instance tables synchronized.
- `Preliminaries from homological algebra`: defines chain complexes, homology,
  CSS codes from complexes, tensor products, and single-shot error correction.
  This is the bridge from algebraic complexes to parity checks and metachecks.
- `Preliminaries from commutative algebra`: introduces group rings, polynomial
  rings, quotient rings, tensor algebra, and exterior algebra. This section
  supports the quotient-ring and circulant-matrix language used by the MM
  construction.
- `Previous Explicit Constructions`: surveys abelian 2BGA, BB/MB/GB, and TT
  codes. Its utility is to set up the claim that these known constructions are
  special cases of the later Koszul framework.
- `Challenges in creating higher-length complexes`: explains why TT gives only
  partial single-shot structure and why Koszul complexes are a simpler route to
  longer complexes than iterative MBC-style constructions.
- `Koszul Complex Formalism for Quantum Codes`: the mathematical core. It gives
  tensor-product and exterior-algebra definitions of Koszul complexes, then
  writes explicit boundary maps for BB (`t=2`), TT (`t=3`), and the new MM
  `t=4` case. Be careful with the conventions for `P_X`, `P_Z`, `M_X`, and
  `M_Z` here.
- `Multivariate Multicycle Codes`: the main construction section. It defines
  metacheck CSS codes, the general MM construction, the blocklength formula,
  the metacheck conditions, a worked `[[648,60,(9,9)]]` example, and the
  subfamily remarks tying MM to 4D toric, AMC, BB/TT, C2/CxR, La-Cross, Haah,
  GB, 2BGA, and MB codes.
- `Numerical Simulations`: contains the empirical story: code-capacity
  Tesseract results, phenomenological noise, circuit-level noise, overlapping
  window decoding, and confinement profiles. This is where most active plot
  files are used.
- `Discussion and Conclusions`: summarizes unification, complete single-shot
  capability for `t >= 4`, record confinement, and future directions such as
  weight reduction and cohomological gates.
- Appendix `Generating Algorithm and explicit instances of MM codes`: gives the
  construction algorithms, including quotient-ring Koszul construction,
  symbolic Koszul construction, and polynomial-to-circulant conversion.
- Appendix `More phenomenological noise experiments`: provides extra MM-vs-TT
  comparisons in X and Z memory experiments.
- Appendix `Circuit-Level Noise Modelling via Left-Right Circuits`: explains
  LRC scheduling and compares default LDPC coloration circuits against LRC
  circuits.
- Appendix `Appendix: Search Procedure for Multivariate Multicycle Codes`:
  records the random search procedure, factorization of target blocklengths,
  polynomial sampling, and distance computation workflow.
- Appendix `Recovering Subfamilies of MM codes`: gives Julia/QuantumClifford
  examples for recovering AMC, BB, TT, 4D toric, La-Cross, MB, GB, 2BGA, and
  cyclic hypergraph-product codes.
- Appendix `Explicit instances on higher dimensional codes`: holds the large
  explicit-instance tables for 4D low-weight and collapsed 5D-9D MM codes.

## Important Tables

- `tab:confinement`: the main benchmark table in `Numerical Simulations`. It
  compares many code families by parameters, rate, efficiency, check weights,
  and X/Z confinement profiles. This table supports the record-confinement and
  single-shot-decoding claims.
- `tab:table2`: explicit 4D MM instances supporting complete single-shot
  decoding. It lists `[[n,k,(d_X,d_Z)]]`, lattice sizes, efficiency, stabilizer
  weights, and the defining polynomials `F`, `G`, `H`, and `I`.
- `tab:mmcodetable3`: small MM instances with stabilizer weight 6. Use this for
  practical low-weight candidates and the LRC discussion.
- `tab:mmcodetable4`: small MM instances with stabilizer weight 9, including
  the `[[144,12,(12,12)]]` comparison point used in simulations.
- `tab:mmcodetable5`: blocklength `n = 144`, stabilizer weight 12 examples.
- `tab:mmcodetable6`: blocklength `n = 192`, stabilizer weight 12 examples.
- `tab:mmcodetable7`: collapsed 5D MM code instances.
- `tab:mmcodetable8`: collapsed 6D MM code instances.
- `tab:mmcodetable9`: collapsed 7D MM code instances.
- `tab:mmcodetable10`: collapsed 8D MM code instances.
- `tab:mmcodetable11`: collapsed 9D MM code instance.

When editing tables, cross-check any changed code parameters against the
abstract, introduction, simulation captions, and discussion. The manuscript uses
both HiGHS and Gurobi language in different table captions; preserve the
intended solver provenance for each table.

## Important Figures and Plot Files

- `fig:MMcodesconstruction`: TikZ figure inside `main.tex`, not an external
  file. It compares AMC construction against the MM/Koszul construction and is
  the visual summary of the paper's construction claim.
- `subfamiliesofMM.pdf`: figure `fig:conceptual_diagram_of_subfamilies`. Shows
  MM codes as a unifying family containing AMC, TT, 2BGA, C2/CxR, BB, MB, GB,
  and Haah-code subfamilies.
- `tesseract_LER_vs_p.png`: code-capacity logical error rate plot for Tesseract
  decoder comparisons among small MM codes and topological baselines.
- `PhenomenologicalNoiseModelXBasis.png`: X-basis memory experiment under
  phenomenological noise.
- `PhenomenologicalNoiseModelZBasis.png`: Z-basis memory experiment under
  phenomenological noise.
- `CircuitLevelNoiseX.png`: X-basis memory experiment under circuit-level
  noise.
- `CircuitLevelNoiseZ.png`: Z-basis memory experiment under circuit-level
  noise.
- `plateau_xz_T15.png`: two-panel overlapping-window plateau experiment under
  phenomenological noise, `T=15`, `p=10^-2`, commit size `c=1`.
- `circ_plateau_xz_T10.png`: two-panel overlapping-window plateau experiment
  under circuit-level noise, `T=10`, `p=10^-3`, commit size `c=1`.
- `AppendixA.png`: appendix X-memory phenomenological comparison of MM and TT
  codes.
- `AppendixB.png`: appendix Z-memory phenomenological comparison of MM and TT
  codes.
- `LRCXBasisweight6circuitlevel.png`: LRC versus default circuit-level
  comparison for weight-6 MM codes in the X-basis memory experiment.
- `LRCZBasisweight6circuitlevel.png`: LRC versus default circuit-level
  comparison for weight-6 MM codes in the Z-basis memory experiment.
- `circuitlevelnoiselrcldpcXexp.png`: LRC versus default circuit-level
  comparison for BB, MM, AMC, and TT in the X-basis memory experiment.
- `circuitlevelnoiselrcldpcZexp.png`: LRC versus default circuit-level
  comparison for BB, MM, AMC, and TT in the Z-basis memory experiment.

Several plot assets are present but currently commented out or unused in
`main.tex`, including `PlateauXCircuit-LevelNoise.png`,
`PlateauZCircuit-LevelNoise.png`, `CircuitLevelXPlateauExperiments.png`,
`OWDPLOTBX.png`, `OWDPLOTBZ.png`, `weights.png`, `distanceplot.png`, and
`tesseractdecodervsbposddecoder.png`. Other likely legacy assets include
`OWDPLOTAXBASIS.png`, `OWDPLOTAZBASIS.png`, `appendixfigure2.png`,
`error_rate_X_tesseract-custom.png`, `error_rate_Z_tesseract-custom.png`,
`plateau_X_T10.png`, `plateau_Z_T10.png`, `plateau_two_panel_X_T10.png`,
`plateau_two_panel_Z_T10.png`, `plateau_xz_T10.png`, `plateau_xz_T10new.png`,
`threshold_X_w2_c1_T2_15.png`, and `threshold_Z_w2_c1_T2_15.png`. Check the
current `\includegraphics` references before deleting, replacing, or citing any
of these.

## Editing Caveats

- The active draft uses `\editcolor{...}` for blue bold edit markup. Keep it
  consistent unless the task is to clean the manuscript for submission.
- Captions and labels are embedded near the figures and tables rather than in
  separate files. If a plot file is replaced, update the caption and text
  discussion in the same pass.
- The two appendix figures `AppendixA.png` and `AppendixB.png` currently share
  the same label `fig:appendixfig1`. If editing references to these figures,
  fix the duplicate label deliberately.
- The key `t=4` convention is: qubits on `K_2`, `P_X = partial_2^T`,
  `P_Z = partial_3`, `M_X = partial_1^T`, and `M_Z = partial_4`. Keep this
  consistent across the formalism, algorithms, examples, and tables.
- The paper argues that high confinement, not merely the existence of
  metachecks, is the practical resource for single-shot decoding. Avoid
  weakening or overstating that distinction when revising simulation text.
