November 2026 · Preprint

Certified lower bounds on the optimal-decoding threshold of the surface code

Abstract

Under independent bit flips, rigorous lower bounds on the threshold of the surface code from earlier work stay below 0.04, while numerical estimates place the optimal threshold near 0.109. By counting labelled failure paths with exact transfer-matrix certificates, we prove without sampling that every minimum-weight decoder has threshold at least 0.0465 on the planar and rotated codes. We then give statistical certificates that, with confidence 1 − 10⁻⁹ each, the optimal threshold of the planar code is at least 0.103 under bit flips and at least 0.02 under phenomenological noise. Each statistical certificate bounds the failure probability of an auxiliary decoder that divides the code into blocks and corrects each block using a window around it; optimal decoding does at least as well, so the bound also holds for optimal decoding. A deterministic lemma shows that the auxiliary decoder fails only if bad blocks, in which the window corrections leave a defect or a long residual path, form a sparse hierarchy that joins the two rough boundaries. This gives an explicit bound once every block is bad with probability below a limit, about 4 × 10⁻⁴ under bit flips, and a pre-registered Monte Carlo experiment bounds these probabilities. The confidence rests on a binomial model of the counts of bad blocks and on two tested properties of each decoding program. All these results are proved in the proof assistant Lean 4, the statistical ones with the binomial model and the two properties as hypotheses.

In plain words

The surface code protects data on quantum chips if their error rate is below a threshold. When bit flips occur independently and the checks themselves are error-free, simulations put the best correction method's threshold near 10.9%. But proven thresholds in this setting, including one by Dennis, Kitaev, Landahl and Preskill, stayed below 4%. This paper proves, without sampling, a threshold of at least 4.65% for the standard correction method on the rotated and unrotated codes. For the best method on the unrotated code, a proof and a pre-registered computer experiment certify a threshold of at least 10.3%. Under stated conditions, the chance of certifying such a bound when it is false is at most one in a billion.

A grid of grey dots split by thin lines into blocks of four by four dots. A thick square outlines nine blocks centred on a shaded block labelled c. A dashed square outlines the window of c and lies one dot outside the thick square on every side. A red rectangular loop extends from inside c to four dots past the right side of c. Another shaded block, in the top right corner of the grid, holds two red dots joined by a short red edge.
Figure 2. The auxiliary decoder of Section 5.1 on a part of a code far from its sides, with block side L = 4 and window radius R = 5, given by the formula R = (3/2)L − 1 of the registered program of Section 5.4; dots are checks and thin lines bound the blocks. The window W_c of block c (dashed) consists of the checks within ℓ∞ distance R of c; it reaches beyond N₁(c) (thick), the nine blocks at block distance at most 1 from c. Stage 1 computes a correction for each block from the syndrome in its window and keeps the edges that the block owns; the kept edges form C₀. A block is bad if the residual syndrome has a check in it (flagged; filled dots) or if a path of F = E ⊕ C₀ (red edges) inside N₁(c) joins it to a check at ℓ∞ distance at least L (long; the loop through c reaches distance L from c and makes c long, but it stays within distance 3 < L of the block to the right of c, which is good). Bad blocks are shaded.

Formal statement and axioms

Each main result as stated in Lean, copied verbatim from the published package, with the axioms that the proof rests on. Lean v4.35.0-rc3, Mathlib c55e6e786f49. The package.

QEC.planar_A10_kernel

Theorem 2.1 for the planar code, P_MW: kernel-only

theorem planar_A10_kernel (nx ny : ℕ) (hnx : 10 ≤ nx) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailMW (boxEdges 2 ![nx, ny] 0) p ≤
      ny * (39891 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (nx - 10) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailMW (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ :=
  PrIID Eg p (fun E => ∃ C, IsMinCorr Eg (bd E) C ∧ FailsB E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsB (E C : Finset (Sym2 (Vx V))) : Prop := ¬ (Odd (vdeg C .b1) ↔ Odd (vdeg E .b1))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/PlanarK10.lean:19-22.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_PlanarK10.out:1-1.

'QEC.planar_A10_kernel' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.planar_A10_kernel_ML

Theorem 2.1 for the planar code, P_ML: kernel-only

theorem planar_A10_kernel_ML (nx ny : ℕ) (hnx : 10 ≤ nx) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailML (boxEdges 2 ![nx, ny] 0) p ≤
      ny * (39891 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (nx - 10) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailML (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ := ⨅ dec : Finset V → Bool, PfailDec Eg p dec
noncomputable def PfailDec (Eg : Finset (Sym2 (Vx V))) (p : ℝ) (dec : Finset V → Bool) : ℝ :=
  PrIID Eg p (fun E => dec (bd E) ≠ decide (Odd (vdeg E .b1)))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/PlanarK10.lean:33-36.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_PlanarK10.out:2-2.

'QEC.planar_A10_kernel_ML' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.planar_A

Theorem 2.1 for the planar code, P_MW: with compiled code

theorem planar_A (nx ny : ℕ) (hnx : 10 ≤ nx) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailMW (boxEdges 2 ![nx, ny] 0) p ≤
      ny * (39891 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (nx - 10) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailMW (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ :=
  PrIID Eg p (fun E => ∃ C, IsMinCorr Eg (bd E) C ∧ FailsB E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsB (E C : Finset (Sym2 (Vx V))) : Prop := ¬ (Odd (vdeg C .b1) ↔ Odd (vdeg E .b1))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Planar.lean:18-21.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 74 more, for example QECChecks.A10.dfs0._native.native_decide.ax_1_1, QECChecks.A10.dfs1._native.native_decide.ax_1_1 and QECChecks.A10.dfs2._native.native_decide.ax_1_1. Each of these 74 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Planar.out:1-77.

29 more formal statements

QEC.planar_A_ML

Theorem 2.1 for the planar code, P_ML: with compiled code

theorem planar_A_ML (nx ny : ℕ) (hnx : 10 ≤ nx) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailML (boxEdges 2 ![nx, ny] 0) p ≤
      ny * (39891 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (nx - 10) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailML (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ := ⨅ dec : Finset V → Bool, PfailDec Eg p dec
noncomputable def PfailDec (Eg : Finset (Sym2 (Vx V))) (p : ℝ) (dec : Finset V → Bool) : ℝ :=
  PrIID Eg p (fun E => dec (bd E) ≠ decide (Odd (vdeg E .b1)))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Planar.lean:32-35.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 74 more, for example QECChecks.A10.dfs0._native.native_decide.ax_1_1, QECChecks.A10.dfs1._native.native_decide.ax_1_1 and QECChecks.A10.dfs2._native.native_decide.ax_1_1. Each of these 74 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Planar.out:78-154.

QEC.rotated_B_kernel

Theorem 2.2 for the rotated code, P_MW: kernel-only

theorem rotated_B_kernel (d : ℕ) (hd : 11 ≤ d) (hodd : Odd d) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailRot d p ≤
      2 * d * (36618377198 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (d - 11) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailRot (p : ℝ) : ℝ :=
  PrIID (univ : Finset (Fin d × Fin d)) p (fun E => ∃ C, IsMinCorrRot d E C ∧ FailsRot d E C)
def IsMinCorrRot (E C : Finset (Fin d × Fin d)) : Prop :=
  rotSyn d C = rotSyn d E ∧ ∀ C' : Finset (Fin d × Fin d), rotSyn d C' = rotSyn d E → #C ≤ #C'
def FailsRot (E C : Finset (Fin d × Fin d)) : Prop := ¬ (rotCls d C ↔ rotCls d E)
def rotSyn (E : Finset (Fin d × Fin d)) : Finset (ℤ × ℤ) :=
  (rotXCh d).filter (fun c => Odd #(E.filter (fun q => inCheck d q c)))
def rotCls (E : Finset (Fin d × Fin d)) : Prop := Odd #(E.filter (fun q => (q.1 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/RotatedBK.lean:21-24.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_RotatedBK.rebuild.out:1-1.

'QEC.rotated_B_kernel' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.rotated_B_kernel_ML

Theorem 2.2 for the rotated code, P_ML: kernel-only

theorem rotated_B_kernel_ML (d : ℕ) (hd : 11 ≤ d) (hodd : Odd d) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailRotML d p ≤
      2 * d * (36618377198 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (d - 11) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailRotML (p : ℝ) : ℝ :=
  ⨅ dec : Finset (ℤ × ℤ) → Bool,
    PrIID (univ : Finset (Fin d × Fin d)) p (fun E => dec (rotSyn d E) ≠ decide (rotCls d E))
def rotSyn (E : Finset (Fin d × Fin d)) : Finset (ℤ × ℤ) :=
  (rotXCh d).filter (fun c => Odd #(E.filter (fun q => inCheck d q c)))
def rotCls (E : Finset (Fin d × Fin d)) : Prop := Odd #(E.filter (fun q => (q.1 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/RotatedBK.lean:37-40.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_RotatedBK.rebuild.out:2-2.

'QEC.rotated_B_kernel_ML' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.rotated_B

Theorem 2.2 for the rotated code, P_MW: with compiled code

theorem rotated_B (d : ℕ) (hd : 11 ≤ d) (hodd : Odd d) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailRot d p ≤
      2 * d * (36618377198 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (d - 11) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailRot (p : ℝ) : ℝ :=
  PrIID (univ : Finset (Fin d × Fin d)) p (fun E => ∃ C, IsMinCorrRot d E C ∧ FailsRot d E C)
def IsMinCorrRot (E C : Finset (Fin d × Fin d)) : Prop :=
  rotSyn d C = rotSyn d E ∧ ∀ C' : Finset (Fin d × Fin d), rotSyn d C' = rotSyn d E → #C ≤ #C'
def FailsRot (E C : Finset (Fin d × Fin d)) : Prop := ¬ (rotCls d C ↔ rotCls d E)
def rotSyn (E : Finset (Fin d × Fin d)) : Finset (ℤ × ℤ) :=
  (rotXCh d).filter (fun c => Odd #(E.filter (fun q => inCheck d q c)))
def rotCls (E : Finset (Fin d × Fin d)) : Prop := Odd #(E.filter (fun q => (q.1 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/RotatedB.lean:21-24.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 252 more, for example QECChecks.R10.b0._native.native_decide.ax_1_1, QECChecks.R10.b1._native.native_decide.ax_1_1 and QECChecks.R10.b2._native.native_decide.ax_1_1. Each of these 252 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_RotatedB.out:1-255.

QEC.rotated_B_ML

Theorem 2.2 for the rotated code, P_ML: with compiled code

theorem rotated_B_ML (d : ℕ) (hd : 11 ≤ d) (hodd : Odd d) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 93 / 2000) :
    PfailRotML d p ≤
      2 * d * (36618377198 / 100) * (499 / 500 * rhoOf (93 / 2000) p) ^ (d - 11) /
        (1 - 499 / 500 * rhoOf (93 / 2000) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailRotML (p : ℝ) : ℝ :=
  ⨅ dec : Finset (ℤ × ℤ) → Bool,
    PrIID (univ : Finset (Fin d × Fin d)) p (fun E => dec (rotSyn d E) ≠ decide (rotCls d E))
def rotSyn (E : Finset (Fin d × Fin d)) : Finset (ℤ × ℤ) :=
  (rotXCh d).filter (fun c => Odd #(E.filter (fun q => inCheck d q c)))
def rotCls (E : Finset (Fin d × Fin d)) : Prop := Odd #(E.filter (fun q => (q.1 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/RotatedB.lean:36-39.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 252 more, for example QECChecks.R10.b0._native.native_decide.ax_1_1, QECChecks.R10.b1._native.native_decide.ax_1_1 and QECChecks.R10.b2._native.native_decide.ax_1_1. Each of these 252 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_RotatedB.out:256-510.

QEC.toric_A'_10_kernel

Theorem 2.3 for the toric code at 0.046, P_MW: kernel-only

theorem toric_A'_10_kernel (L : ℕ) (hL : 1201 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 23 / 500) :
    PfailTor L p ≤ (L : ℝ) ^ 2 * (4285723916 / 10) * (997 / 1000 * rhoOf (23 / 500) p) ^ (L - 10) /
      (1 - 997 / 1000 * rhoOf (23 / 500) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTor (L : ℕ) (p : ℝ) : ℝ :=
  PrIID (torEdges L) p (fun E => ∃ C, IsMinCorr (torEdges L) (bd E) C ∧ FailsT E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsT {L : ℕ} (E C : Finset (Sym2 (Vx (TorV L)))) : Prop := ¬ TrivT (C ∆ E)
def TrivT {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : Prop := Even (crV Z) ∧ Even (crH Z)
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/ToricK10.lean:20-22.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_ToricK10.out:1-1.

'QEC.toric_A'_10_kernel' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.toric_A'_10_kernel_ML

Theorem 2.3 for the toric code at 0.046, P_ML: kernel-only

theorem toric_A'_10_kernel_ML (L : ℕ) (hL : 1201 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 23 / 500) :
    PfailTorML L p ≤ (L : ℝ) ^ 2 * (4285723916 / 10) * (997 / 1000 * rhoOf (23 / 500) p) ^ (L - 10) /
      (1 - 997 / 1000 * rhoOf (23 / 500) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTorML (L : ℕ) (p : ℝ) : ℝ :=
  ⨅ dec : Finset (TorV L) → Bool × Bool,
    PrIID (torEdges L) p (fun E => dec (bd E) ≠ (decide (Odd (crV E)), decide (Odd (crH E))))
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/ToricK10.lean:36-38.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_ToricK10.out:2-2.

'QEC.toric_A'_10_kernel_ML' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.toric_A'_10

Theorem 2.3 for the toric code at 0.046, P_MW: with compiled code

theorem toric_A'_10 (L : ℕ) (hL : 1201 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 23 / 500) :
    PfailTor L p ≤ (L : ℝ) ^ 2 * (4285723916 / 10) * (997 / 1000 * rhoOf (23 / 500) p) ^ (L - 10) /
      (1 - 997 / 1000 * rhoOf (23 / 500) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTor (L : ℕ) (p : ℝ) : ℝ :=
  PrIID (torEdges L) p (fun E => ∃ C, IsMinCorr (torEdges L) (bd E) C ∧ FailsT E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsT {L : ℕ} (E C : Finset (Sym2 (Vx (TorV L)))) : Prop := ¬ TrivT (C ∆ E)
def TrivT {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : Prop := Even (crV Z) ∧ Even (crH Z)
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Toric10.lean:20-22.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 418 more, for example QECChecks.T10.bulk0._native.native_decide.ax_1_1, QECChecks.T10.bulk1._native.native_decide.ax_1_1 and QECChecks.T10.bulk2._native.native_decide.ax_1_1. Each of these 418 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Toric10.out:1-421.

QEC.toric_A'_10_ML

Theorem 2.3 for the toric code at 0.046, P_ML: with compiled code

theorem toric_A'_10_ML (L : ℕ) (hL : 1201 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 23 / 500) :
    PfailTorML L p ≤ (L : ℝ) ^ 2 * (4285723916 / 10) * (997 / 1000 * rhoOf (23 / 500) p) ^ (L - 10) /
      (1 - 997 / 1000 * rhoOf (23 / 500) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTorML (L : ℕ) (p : ℝ) : ℝ :=
  ⨅ dec : Finset (TorV L) → Bool × Bool,
    PrIID (torEdges L) p (fun E => dec (bd E) ≠ (decide (Odd (crV E)), decide (Odd (crH E))))
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Toric10.lean:35-37.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 418 more, for example QECChecks.T10.bulk0._native.native_decide.ax_1_1, QECChecks.T10.bulk1._native.native_decide.ax_1_1 and QECChecks.T10.bulk2._native.native_decide.ax_1_1. Each of these 418 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Toric10.out:422-842.

QEC.toric_A'_kernel

Theorem 2.3 for the toric code at 0.045, P_MW: kernel-only

theorem toric_A'_kernel (L : ℕ) (hL : 769 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 9 / 200) :
    PfailTor L p ≤ (L : ℝ) ^ 2 * 383157811 * (249 / 250 * rhoOf (9 / 200) p) ^ (L - 8) /
      (1 - 249 / 250 * rhoOf (9 / 200) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTor (L : ℕ) (p : ℝ) : ℝ :=
  PrIID (torEdges L) p (fun E => ∃ C, IsMinCorr (torEdges L) (bd E) C ∧ FailsT E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsT {L : ℕ} (E C : Finset (Sym2 (Vx (TorV L)))) : Prop := ¬ TrivT (C ∆ E)
def TrivT {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : Prop := Even (crV Z) ∧ Even (crH Z)
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/ToricK.lean:20-22.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_ToricK.out:1-1.

'QEC.toric_A'_kernel' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.toric_A'_kernel_ML

Theorem 2.3 for the toric code at 0.045, P_ML: kernel-only

theorem toric_A'_kernel_ML (L : ℕ) (hL : 769 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 9 / 200) :
    PfailTorML L p ≤ (L : ℝ) ^ 2 * 383157811 * (249 / 250 * rhoOf (9 / 200) p) ^ (L - 8) /
      (1 - 249 / 250 * rhoOf (9 / 200) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTorML (L : ℕ) (p : ℝ) : ℝ :=
  ⨅ dec : Finset (TorV L) → Bool × Bool,
    PrIID (torEdges L) p (fun E => dec (bd E) ≠ (decide (Odd (crV E)), decide (Odd (crH E))))
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/ToricK.lean:35-37.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_ToricK.out:2-2.

'QEC.toric_A'_kernel_ML' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.toric_A'

Theorem 2.3 for the toric code at 0.045, P_MW: with compiled code

theorem toric_A' (L : ℕ) (hL : 769 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 9 / 200) :
    PfailTor L p ≤ (L : ℝ) ^ 2 * 383157811 * (249 / 250 * rhoOf (9 / 200) p) ^ (L - 8) /
      (1 - 249 / 250 * rhoOf (9 / 200) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTor (L : ℕ) (p : ℝ) : ℝ :=
  PrIID (torEdges L) p (fun E => ∃ C, IsMinCorr (torEdges L) (bd E) C ∧ FailsT E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsT {L : ℕ} (E C : Finset (Sym2 (Vx (TorV L)))) : Prop := ¬ TrivT (C ∆ E)
def TrivT {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : Prop := Even (crV Z) ∧ Even (crH Z)
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Toric.lean:21-23.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 107 more, for example QECChecks.T8.bulk0._native.native_decide.ax_1_1, QECChecks.T8.bulk1._native.native_decide.ax_1_1 and QECChecks.T8.bulk2._native.native_decide.ax_1_1. Each of these 107 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Toric.out:1-110.

QEC.toric_A'_ML

Theorem 2.3 for the toric code at 0.045, P_ML: with compiled code

theorem toric_A'_ML (L : ℕ) (hL : 769 ≤ L) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 9 / 200) :
    PfailTorML L p ≤ (L : ℝ) ^ 2 * 383157811 * (249 / 250 * rhoOf (9 / 200) p) ^ (L - 8) /
      (1 - 249 / 250 * rhoOf (9 / 200) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailTorML (L : ℕ) (p : ℝ) : ℝ :=
  ⨅ dec : Finset (TorV L) → Bool × Bool,
    PrIID (torEdges L) p (fun E => dec (bd E) ≠ (decide (Odd (crV E)), decide (Odd (crH E))))
noncomputable def crV {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamV u v))
noncomputable def crH {L : ℕ} (Z : Finset (Sym2 (Vx (TorV L)))) : ℕ :=
  #(Z.filter (fun e => ∃ u v : TorV L, e = s(Vx.det u, Vx.det v) ∧ SeamH u v))
def SeamV {L : ℕ} (u v : TorV L) : Prop :=
  u.2 = v.2 ∧ (((u.1 : ℕ) = L - 1 ∧ (v.1 : ℕ) = 0) ∨ ((v.1 : ℕ) = L - 1 ∧ (u.1 : ℕ) = 0))
def SeamH {L : ℕ} (u v : TorV L) : Prop :=
  u.1 = v.1 ∧ (((u.2 : ℕ) = L - 1 ∧ (v.2 : ℕ) = 0) ∨ ((v.2 : ℕ) = L - 1 ∧ (u.2 : ℕ) = 0))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Toric.lean:36-38.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 107 more, for example QECChecks.T8.bulk0._native.native_decide.ax_1_1, QECChecks.T8.bulk1._native.native_decide.ax_1_1 and QECChecks.T8.bulk2._native.native_decide.ax_1_1. Each of these 107 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Toric.out:111-220.

QEC.phenom_D2M8_kernel

Theorem 2.4 with measurement errors, P_MW: kernel-only

theorem phenom_D2M8_kernel (T W H : ℕ) (hH : 8 ≤ H) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 2 / 125) :
    PfailMW (boxEdges 3 ![T + 1, W, H] 2) p ≤
      (T + 1) * W * (12827 / 10000) * (499 / 500 * rhoOf (2 / 125) p) ^ (H - 8) /
        (1 - 499 / 500 * rhoOf (2 / 125) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailMW (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ :=
  PrIID Eg p (fun E => ∃ C, IsMinCorr Eg (bd E) C ∧ FailsB E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsB (E C : Finset (Sym2 (Vx V))) : Prop := ¬ (Odd (vdeg C .b1) ↔ Odd (vdeg E .b1))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/PhenomK8.lean:20-23.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_PhenomK8.out:1-1.

'QEC.phenom_D2M8_kernel' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.phenom_D2M8_kernel_ML

Theorem 2.4 with measurement errors, P_ML: kernel-only

theorem phenom_D2M8_kernel_ML (T W H : ℕ) (hH : 8 ≤ H) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 2 / 125) :
    PfailML (boxEdges 3 ![T + 1, W, H] 2) p ≤
      (T + 1) * W * (12827 / 10000) * (499 / 500 * rhoOf (2 / 125) p) ^ (H - 8) /
        (1 - 499 / 500 * rhoOf (2 / 125) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailML (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ := ⨅ dec : Finset V → Bool, PfailDec Eg p dec
noncomputable def PfailDec (Eg : Finset (Sym2 (Vx V))) (p : ℝ) (dec : Finset V → Bool) : ℝ :=
  PrIID Eg p (fun E => dec (bd E) ≠ decide (Odd (vdeg E .b1)))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/PhenomK8.lean:37-40.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_PhenomK8.out:2-2.

'QEC.phenom_D2M8_kernel_ML' depends on axioms: [propext, Classical.choice, Quot.sound]

QEC.phenom_D2

Theorem 2.4 with measurement errors, P_MW: with compiled code

theorem phenom_D2 (T W H : ℕ) (hH : 8 ≤ H) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 2 / 125) :
    PfailMW (boxEdges 3 ![T + 1, W, H] 2) p ≤
      (T + 1) * W * (12827 / 10000) * (499 / 500 * rhoOf (2 / 125) p) ^ (H - 8) /
        (1 - 499 / 500 * rhoOf (2 / 125) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailMW (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ :=
  PrIID Eg p (fun E => ∃ C, IsMinCorr Eg (bd E) C ∧ FailsB E C)
def IsMinCorr (Eg : Finset (Sym2 (Vx V))) (A : Finset V) (C : Finset (Sym2 (Vx V))) : Prop :=
  C ⊆ Eg ∧ bd C = A ∧ ∀ C' ⊆ Eg, bd C' = A → #C ≤ #C'
def FailsB (E C : Finset (Sym2 (Vx V))) : Prop := ¬ (Odd (vdeg C .b1) ↔ Odd (vdeg E .b1))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Phenom.lean:21-24.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 110 more, for example QECChecks.D2.dfs0._native.native_decide.ax_1_1, QECChecks.D2.dfs1._native.native_decide.ax_1_1 and QECChecks.D2.dfs10._native.native_decide.ax_1_1. Each of these 110 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Phenom.out:1-113.

QEC.phenom_D2_ML

Theorem 2.4 with measurement errors, P_ML: with compiled code

theorem phenom_D2_ML (T W H : ℕ) (hH : 8 ≤ H) {p : ℝ} (hp0 : 0 < p) (hp : p ≤ 2 / 125) :
    PfailML (boxEdges 3 ![T + 1, W, H] 2) p ≤
      (T + 1) * W * (12827 / 10000) * (499 / 500 * rhoOf (2 / 125) p) ^ (H - 8) /
        (1 - 499 / 500 * rhoOf (2 / 125) p)
Definitions used in the statement
noncomputable def rhoOf (ps p : ℝ) : ℝ := Real.sqrt (p * (1 - p) / (ps * (1 - ps)))
noncomputable def PfailML (Eg : Finset (Sym2 (Vx V))) (p : ℝ) : ℝ := ⨅ dec : Finset V → Bool, PfailDec Eg p dec
noncomputable def PfailDec (Eg : Finset (Sym2 (Vx V))) (p : ℝ) (dec : Finset V → Bool) : ℝ :=
  PrIID Eg p (fun E => dec (bd E) ≠ decide (Odd (vdeg E .b1)))
noncomputable def PrIID (Eg : Finset α) (p : ℝ) (A : Finset α → Prop) : ℝ :=
  ∑ E ∈ Eg.powerset.filter A, p ^ #E * (1 - p) ^ #(Eg \ E)
def boxEdges (a : Fin n) : Finset (Sym2 (Vx (BoxV n N))) :=
  (((univ ×ˢ univ).filter (fun uv : BoxV n N × BoxV n N => l1B uv.1 uv.2 = 1)).image
      (fun uv => s(Vx.det uv.1, Vx.det uv.2))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) = 0)).image (fun u => s(Vx.det u, Vx.b1))) ∪
    ((univ.filter (fun u : BoxV n N => (u a : ℕ) + 1 = N a)).image (fun u => s(Vx.det u, Vx.b2)))
abbrev BoxV (n : ℕ) (N : Fin n → ℕ) := (i : Fin n) → Fin (N i)
def l1B (u v : BoxV n N) : ℕ := ∑ i, Int.natAbs ((u i : ℤ) - (v i : ℤ))
inductive Vx (V : Type*) where
  | det (v : V) : Vx V
  | b1 : Vx V
  | b2 : Vx V
  deriving DecidableEq, Fintype
def bd (C : Finset (Sym2 (Vx V))) : Finset V := univ.filter (fun v => Odd (vdeg C (Vx.det v)))
def vdeg (C : Finset (Sym2 X)) (x : X) : ℕ := #(C.filter (fun e => x ∈ e))

Source: Zenodo record 24048008, lean_counting.tar.zst/lean_counting/QEC/Thm/Phenom.lean:37-40.

Axioms, as Lean reports them: propext, Classical.choice, Quot.sound and 110 more, for example QECChecks.D2.dfs0._native.native_decide.ax_1_1, QECChecks.D2.dfs1._native.native_decide.ax_1_1 and QECChecks.D2.dfs10._native.native_decide.ax_1_1. Each of these 110 axioms comes from a check that runs as compiled code (native_decide). The full report is recorded in zenodo:24048008/lean_counting.tar.zst/lean_counting/runs/logs/axioms_Phenom.out:114-226.

QECML.theoremB_q103_main

Theorem 2.5, the bound on P_ML from (V6), (Hcov) and the bad-block bound: kernel-only

theorem theoremB_q103_main (sp : S3Prog) (hV6 : sp.V6) (hD : 4 + 2 * sp.R / sp.L = 6) (hL2 : 2 ≤ sp.L)
    (hcov : (sp.toFam hV6).Hcov) (hstat : (sp.toFam hV6).HstatK 2 0.103 3.29e-4)
    {q : ℝ} (hq : q ≤ 0.103) {W H : ℕ} (hW : 1 ≤ W) (hH : 41 * sp.L ≤ H) :
    pMLPlanar (W - 1) (H - 1) q ≤
      36 * (nxOfN 6 sp.L W : ℝ) * Real.exp (-0.1 * ((nyOf sp.L H : ℝ) - 40)) +
        3.8e4 * (nxOfN 6 sp.L W : ℝ) * Real.exp (-0.015 * ((nyOf sp.L H : ℝ) - 40))
Definitions used in the statement
noncomputable def pMLPlanar (w h : ℕ) (q : ℝ) : ℝ := pML (bernProd q) (psyn w h) (pcls w h)
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn (w h : ℕ) : (PEdge w h → ZMod 2) →+ (PVert w h → ZMod 2) where
  toFun e v := ∑ f, (if v ∈ f.ends then 1 else 0) * e f
  map_zero' := by ext v; simp
  map_add' e e' := by ext v; simp [mul_add, Finset.sum_add_distrib]
def pcls (w h : ℕ) : (PEdge w h → ZMod 2) →+ ZMod 2 where
  toFun e := ∑ x, e (.bot x)
  map_zero' := by simp
  map_add' e e' := by simp [Finset.sum_add_distrib]
inductive PEdge (w h : ℕ) where
  | hor (x : Fin w) (y : Fin (h + 1))
  | ver (x : Fin (w + 1)) (y : Fin h)
  | bot (x : Fin (w + 1))
  | top (x : Fin (w + 1))
  deriving DecidableEq
def nxOfN (n0 L W : ℕ) : ℕ := max n0 ((W + L - 1) / L)
def nyOf (L H : ℕ) : ℕ := H / L
structure S3Prog where
  L : ℕ
  R : ℕ
  hL : 1 ≤ L
  prog : ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), Stage1Prog ⟨L, R, nx, ny, hL, hnx, hny⟩
def V6 : Prop := ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), (sp.prog nx ny hnx hny).SyndromeOnly
noncomputable def toFam (hV6 : sp.V6) : S3Fam where
  L := sp.L
  R := sp.R
  hL := sp.hL
  stage1 nx ny hnx hny := (sp.prog nx ny hnx hny).toStage1 (hV6 nx ny hnx hny)
def Hcov : Prop :=
  ∀ (nx ny nx' ny' : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny) (hnx' : 1 ≤ nx') (hny' : 1 ≤ ny')
    (ι : S3Geom.Emb (fam.geom nx' ny' hnx' hny') (fam.geom nx ny hnx hny))
    (c : (fam.geom nx' ny' hnx' hny').Block), ι.Congr c →
    ∀ (D : (fam.geom nx ny hnx hny).V → ZMod 2) (e : (fam.geom nx' ny' hnx' hny').Ed),
      (fam.geom nx' ny' hnx' hny').owner e = c → S3Geom.isBulk e →
        (fam.stage1 nx ny hnx hny).F (ι.B c) D (ι.E e) = (fam.stage1 nx' ny' hnx' hny').F c (D ∘ ι.V) e
def HstatK (K : ℕ) (q ε : ℝ) : Prop :=
  ∀ t : Fin (2 * K + 3), prob (bernProd q) (fun E => (fam.refStage1K K).bad E (fam.refBlockK K t)) ≤ ε
noncomputable def prob {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (A : Ω → Prop) : ℝ :=
  ∑ ω, if A ω then P ω else 0

Source: Zenodo record 24048008, lean_ml.tar.zst/lean_ml/QECML/TwoD/HeadlineQ103.lean:73-78.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_ml_axioms.txt:72.

'QECML.theoremB_q103_main' depends on axioms: [propext, Classical.choice, Quot.sound]

QECML.pMLPlanar_tendsto_zero_subexp_q103

Theorem 2.5, the threshold along subexponential widths: kernel-only

theorem pMLPlanar_tendsto_zero_subexp_q103 (sp : S3Prog) (hV6 : sp.V6) (hD : 4 + 2 * sp.R / sp.L = 6)
    (hL2 : 2 ≤ sp.L) (hcov : (sp.toFam hV6).Hcov) (hstat : (sp.toFam hV6).HstatK 2 0.103 3.29e-4) {W : ℕ → ℕ}
    (hW1 : ∀ H, 1 ≤ W H) (hWs : SubExp W) {q : ℝ} (hq0 : 0 ≤ q) (hq : q ≤ 0.103) :
    Tendsto (fun H : ℕ => pMLPlanar (W H - 1) (H - 1) q) atTop (𝓝 0)
Definitions used in the statement
noncomputable def pMLPlanar (w h : ℕ) (q : ℝ) : ℝ := pML (bernProd q) (psyn w h) (pcls w h)
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn (w h : ℕ) : (PEdge w h → ZMod 2) →+ (PVert w h → ZMod 2) where
  toFun e v := ∑ f, (if v ∈ f.ends then 1 else 0) * e f
  map_zero' := by ext v; simp
  map_add' e e' := by ext v; simp [mul_add, Finset.sum_add_distrib]
def pcls (w h : ℕ) : (PEdge w h → ZMod 2) →+ ZMod 2 where
  toFun e := ∑ x, e (.bot x)
  map_zero' := by simp
  map_add' e e' := by simp [Finset.sum_add_distrib]
inductive PEdge (w h : ℕ) where
  | hor (x : Fin w) (y : Fin (h + 1))
  | ver (x : Fin (w + 1)) (y : Fin h)
  | bot (x : Fin (w + 1))
  | top (x : Fin (w + 1))
  deriving DecidableEq
def SubExp (f : ℕ → ℕ) : Prop :=
  ∀ c : ℝ, 0 < c → Tendsto (fun n : ℕ => (f n : ℝ) * Real.exp (-(c * n))) atTop (𝓝 0)
structure S3Prog where
  L : ℕ
  R : ℕ
  hL : 1 ≤ L
  prog : ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), Stage1Prog ⟨L, R, nx, ny, hL, hnx, hny⟩
def V6 : Prop := ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), (sp.prog nx ny hnx hny).SyndromeOnly
noncomputable def toFam (hV6 : sp.V6) : S3Fam where
  L := sp.L
  R := sp.R
  hL := sp.hL
  stage1 nx ny hnx hny := (sp.prog nx ny hnx hny).toStage1 (hV6 nx ny hnx hny)
def Hcov : Prop :=
  ∀ (nx ny nx' ny' : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny) (hnx' : 1 ≤ nx') (hny' : 1 ≤ ny')
    (ι : S3Geom.Emb (fam.geom nx' ny' hnx' hny') (fam.geom nx ny hnx hny))
    (c : (fam.geom nx' ny' hnx' hny').Block), ι.Congr c →
    ∀ (D : (fam.geom nx ny hnx hny).V → ZMod 2) (e : (fam.geom nx' ny' hnx' hny').Ed),
      (fam.geom nx' ny' hnx' hny').owner e = c → S3Geom.isBulk e →
        (fam.stage1 nx ny hnx hny).F (ι.B c) D (ι.E e) = (fam.stage1 nx' ny' hnx' hny').F c (D ∘ ι.V) e
def HstatK (K : ℕ) (q ε : ℝ) : Prop :=
  ∀ t : Fin (2 * K + 3), prob (bernProd q) (fun E => (fam.refStage1K K).bad E (fam.refBlockK K t)) ≤ ε
noncomputable def prob {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (A : Ω → Prop) : ℝ :=
  ∑ ω, if A ω then P ω else 0

Source: Zenodo record 24048008, lean_ml.tar.zst/lean_ml/QECML/TwoD/ThresholdWidthQ103.lean:123-126.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_ml_axioms.txt:74.

'QECML.pMLPlanar_tendsto_zero_subexp_q103' depends on axioms: [propext, Classical.choice, Quot.sound]

QECML.pMLPlanar_exp_decay_subexp_q103

Theorem 2.5, the eventual bound exp(−H/(200 L)) along subexponential widths: kernel-only

theorem pMLPlanar_exp_decay_subexp_q103 (sp : S3Prog) (hV6 : sp.V6) (hD : 4 + 2 * sp.R / sp.L = 6)
    (hL2 : 2 ≤ sp.L) (hcov : (sp.toFam hV6).Hcov) (hstat : (sp.toFam hV6).HstatK 2 0.103 3.29e-4) {W : ℕ → ℕ}
    (hW1 : ∀ H, 1 ≤ W H) (hWs : SubExp W) {q : ℝ} (hq : q ≤ 0.103) :
    ∀ᶠ H in atTop, pMLPlanar (W H - 1) (H - 1) q ≤ Real.exp (-(1 / (200 * (sp.L : ℝ)) * (H : ℝ)))
Definitions used in the statement
noncomputable def pMLPlanar (w h : ℕ) (q : ℝ) : ℝ := pML (bernProd q) (psyn w h) (pcls w h)
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn (w h : ℕ) : (PEdge w h → ZMod 2) →+ (PVert w h → ZMod 2) where
  toFun e v := ∑ f, (if v ∈ f.ends then 1 else 0) * e f
  map_zero' := by ext v; simp
  map_add' e e' := by ext v; simp [mul_add, Finset.sum_add_distrib]
def pcls (w h : ℕ) : (PEdge w h → ZMod 2) →+ ZMod 2 where
  toFun e := ∑ x, e (.bot x)
  map_zero' := by simp
  map_add' e e' := by simp [Finset.sum_add_distrib]
inductive PEdge (w h : ℕ) where
  | hor (x : Fin w) (y : Fin (h + 1))
  | ver (x : Fin (w + 1)) (y : Fin h)
  | bot (x : Fin (w + 1))
  | top (x : Fin (w + 1))
  deriving DecidableEq
def SubExp (f : ℕ → ℕ) : Prop :=
  ∀ c : ℝ, 0 < c → Tendsto (fun n : ℕ => (f n : ℝ) * Real.exp (-(c * n))) atTop (𝓝 0)
structure S3Prog where
  L : ℕ
  R : ℕ
  hL : 1 ≤ L
  prog : ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), Stage1Prog ⟨L, R, nx, ny, hL, hnx, hny⟩
def V6 : Prop := ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), (sp.prog nx ny hnx hny).SyndromeOnly
noncomputable def toFam (hV6 : sp.V6) : S3Fam where
  L := sp.L
  R := sp.R
  hL := sp.hL
  stage1 nx ny hnx hny := (sp.prog nx ny hnx hny).toStage1 (hV6 nx ny hnx hny)
def Hcov : Prop :=
  ∀ (nx ny nx' ny' : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny) (hnx' : 1 ≤ nx') (hny' : 1 ≤ ny')
    (ι : S3Geom.Emb (fam.geom nx' ny' hnx' hny') (fam.geom nx ny hnx hny))
    (c : (fam.geom nx' ny' hnx' hny').Block), ι.Congr c →
    ∀ (D : (fam.geom nx ny hnx hny).V → ZMod 2) (e : (fam.geom nx' ny' hnx' hny').Ed),
      (fam.geom nx' ny' hnx' hny').owner e = c → S3Geom.isBulk e →
        (fam.stage1 nx ny hnx hny).F (ι.B c) D (ι.E e) = (fam.stage1 nx' ny' hnx' hny').F c (D ∘ ι.V) e
def HstatK (K : ℕ) (q ε : ℝ) : Prop :=
  ∀ t : Fin (2 * K + 3), prob (bernProd q) (fun E => (fam.refStage1K K).bad E (fam.refBlockK K t)) ≤ ε
noncomputable def prob {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (A : Ω → Prop) : ℝ :=
  ∑ ω, if A ω then P ω else 0

Source: Zenodo record 24048008, lean_ml.tar.zst/lean_ml/QECML/TwoD/ThresholdWidthQ103.lean:132-135.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_ml_axioms.txt:75.

'QECML.pMLPlanar_exp_decay_subexp_q103' depends on axioms: [propext, Classical.choice, Quot.sound]

QECML.theoremB_certified_q103

Theorem 2.5, the confidence statement for the bound, with the registered sequential design: kernel-only

theorem theoremB_certified_q103 (sp : S3Prog) (hV6 : sp.V6) (hD : 4 + 2 * sp.R / sp.L = 6) (hL2 : 2 ≤ sp.L)
    (hcov : (sp.toFam hV6).Hcov) {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (hP : ∀ ω, 0 ≤ P ω)
    (Kc : Fin 7 → Fin 3 → Ω → ℕ)
    (hlaw : ∀ t j m, (∑ ω, if Kc t j ω = m then P ω else 0) =
      ((looksQ103 j).choose m : ℝ) * (sp.toFam hV6).refRateK 2 0.103 t ^ m *
        (1 - (sp.toFam hV6).refRateK 2 0.103 t) ^ (looksQ103 j - m)) :
    TheoremQ103Concl sp.L ∨ (∑ ω, if (∀ t, ∃ j, Kc t j ω ≤ cutsQ103 j) then P ω else 0) ≤ 1e-9
Definitions used in the statement
def TheoremQ103Concl (L : ℕ) : Prop :=
  ∀ (q : ℝ), q ≤ 0.103 → ∀ (W H : ℕ), 1 ≤ W → 41 * L ≤ H →
    pMLPlanar (W - 1) (H - 1) q ≤
      36 * (nxOfN 6 L W : ℝ) * Real.exp (-0.1 * ((nyOf L H : ℝ) - 40)) +
        3.8e4 * (nxOfN 6 L W : ℝ) * Real.exp (-0.015 * ((nyOf L H : ℝ) - 40))
noncomputable def refRateK (K : ℕ) (q : ℝ) (t : Fin (2 * K + 3)) : ℝ :=
  prob (bernProd q) (fun E => (fam.refStage1K K).bad E (fam.refBlockK K t))
def looksQ103 : Fin 3 → ℕ := ![125040, 187560, 250080]
def cutsQ103 : Fin 3 → ℕ := ![7, 19, 32]
noncomputable def pMLPlanar (w h : ℕ) (q : ℝ) : ℝ := pML (bernProd q) (psyn w h) (pcls w h)
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn (w h : ℕ) : (PEdge w h → ZMod 2) →+ (PVert w h → ZMod 2) where
  toFun e v := ∑ f, (if v ∈ f.ends then 1 else 0) * e f
  map_zero' := by ext v; simp
  map_add' e e' := by ext v; simp [mul_add, Finset.sum_add_distrib]
def pcls (w h : ℕ) : (PEdge w h → ZMod 2) →+ ZMod 2 where
  toFun e := ∑ x, e (.bot x)
  map_zero' := by simp
  map_add' e e' := by simp [Finset.sum_add_distrib]
inductive PEdge (w h : ℕ) where
  | hor (x : Fin w) (y : Fin (h + 1))
  | ver (x : Fin (w + 1)) (y : Fin h)
  | bot (x : Fin (w + 1))
  | top (x : Fin (w + 1))
  deriving DecidableEq
def nxOfN (n0 L W : ℕ) : ℕ := max n0 ((W + L - 1) / L)
def nyOf (L H : ℕ) : ℕ := H / L
structure S3Prog where
  L : ℕ
  R : ℕ
  hL : 1 ≤ L
  prog : ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), Stage1Prog ⟨L, R, nx, ny, hL, hnx, hny⟩
def V6 : Prop := ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), (sp.prog nx ny hnx hny).SyndromeOnly
noncomputable def toFam (hV6 : sp.V6) : S3Fam where
  L := sp.L
  R := sp.R
  hL := sp.hL
  stage1 nx ny hnx hny := (sp.prog nx ny hnx hny).toStage1 (hV6 nx ny hnx hny)
def Hcov : Prop :=
  ∀ (nx ny nx' ny' : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny) (hnx' : 1 ≤ nx') (hny' : 1 ≤ ny')
    (ι : S3Geom.Emb (fam.geom nx' ny' hnx' hny') (fam.geom nx ny hnx hny))
    (c : (fam.geom nx' ny' hnx' hny').Block), ι.Congr c →
    ∀ (D : (fam.geom nx ny hnx hny).V → ZMod 2) (e : (fam.geom nx' ny' hnx' hny').Ed),
      (fam.geom nx' ny' hnx' hny').owner e = c → S3Geom.isBulk e →
        (fam.stage1 nx ny hnx hny).F (ι.B c) D (ι.E e) = (fam.stage1 nx' ny' hnx' hny').F c (D ∘ ι.V) e
noncomputable def prob {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (A : Ω → Prop) : ℝ :=
  ∑ ω, if A ω then P ω else 0

Source: Zenodo record 24048008, lean_ml.tar.zst/lean_ml/QECML/TwoD/CertQ103.lean:77-83.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_ml_axioms.txt:84.

'QECML.theoremB_certified_q103' depends on axioms: [propext, Classical.choice, Quot.sound]

QECML.threshold_q103_certified

Theorem 2.5, the confidence statement for the threshold, with the registered sequential design: kernel-only

theorem threshold_q103_certified (sp : S3Prog) (hV6 : sp.V6) (hD : 4 + 2 * sp.R / sp.L = 6) (hL2 : 2 ≤ sp.L)
    (hcov : (sp.toFam hV6).Hcov) {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (hP : ∀ ω, 0 ≤ P ω)
    (Kc : Fin 7 → Fin 3 → Ω → ℕ)
    (hlaw : ∀ t j m, (∑ ω, if Kc t j ω = m then P ω else 0) =
      ((looksQ103 j).choose m : ℝ) * (sp.toFam hV6).refRateK 2 0.103 t ^ m *
        (1 - (sp.toFam hV6).refRateK 2 0.103 t) ^ (looksQ103 j - m)) :
    ThresholdConclQ103 sp.L ∨ (∑ ω, if (∀ t, ∃ j, Kc t j ω ≤ cutsQ103 j) then P ω else 0) ≤ 1e-9
Definitions used in the statement
def ThresholdConclQ103 (L : ℕ) : Prop :=
  ∀ W : ℕ → ℕ, (∀ H, 1 ≤ W H) → SubExp W → ∀ q : ℝ, 0 ≤ q → q ≤ 0.103 →
    Tendsto (fun H : ℕ => pMLPlanar (W H - 1) (H - 1) q) atTop (𝓝 0) ∧
      ∀ᶠ H in atTop, pMLPlanar (W H - 1) (H - 1) q ≤ Real.exp (-(1 / (200 * (L : ℝ)) * (H : ℝ)))
noncomputable def refRateK (K : ℕ) (q : ℝ) (t : Fin (2 * K + 3)) : ℝ :=
  prob (bernProd q) (fun E => (fam.refStage1K K).bad E (fam.refBlockK K t))
def looksQ103 : Fin 3 → ℕ := ![125040, 187560, 250080]
def cutsQ103 : Fin 3 → ℕ := ![7, 19, 32]
def SubExp (f : ℕ → ℕ) : Prop :=
  ∀ c : ℝ, 0 < c → Tendsto (fun n : ℕ => (f n : ℝ) * Real.exp (-(c * n))) atTop (𝓝 0)
noncomputable def pMLPlanar (w h : ℕ) (q : ℝ) : ℝ := pML (bernProd q) (psyn w h) (pcls w h)
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn (w h : ℕ) : (PEdge w h → ZMod 2) →+ (PVert w h → ZMod 2) where
  toFun e v := ∑ f, (if v ∈ f.ends then 1 else 0) * e f
  map_zero' := by ext v; simp
  map_add' e e' := by ext v; simp [mul_add, Finset.sum_add_distrib]
def pcls (w h : ℕ) : (PEdge w h → ZMod 2) →+ ZMod 2 where
  toFun e := ∑ x, e (.bot x)
  map_zero' := by simp
  map_add' e e' := by simp [Finset.sum_add_distrib]
inductive PEdge (w h : ℕ) where
  | hor (x : Fin w) (y : Fin (h + 1))
  | ver (x : Fin (w + 1)) (y : Fin h)
  | bot (x : Fin (w + 1))
  | top (x : Fin (w + 1))
  deriving DecidableEq
structure S3Prog where
  L : ℕ
  R : ℕ
  hL : 1 ≤ L
  prog : ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), Stage1Prog ⟨L, R, nx, ny, hL, hnx, hny⟩
def V6 : Prop := ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), (sp.prog nx ny hnx hny).SyndromeOnly
noncomputable def toFam (hV6 : sp.V6) : S3Fam where
  L := sp.L
  R := sp.R
  hL := sp.hL
  stage1 nx ny hnx hny := (sp.prog nx ny hnx hny).toStage1 (hV6 nx ny hnx hny)
def Hcov : Prop :=
  ∀ (nx ny nx' ny' : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny) (hnx' : 1 ≤ nx') (hny' : 1 ≤ ny')
    (ι : S3Geom.Emb (fam.geom nx' ny' hnx' hny') (fam.geom nx ny hnx hny))
    (c : (fam.geom nx' ny' hnx' hny').Block), ι.Congr c →
    ∀ (D : (fam.geom nx ny hnx hny).V → ZMod 2) (e : (fam.geom nx' ny' hnx' hny').Ed),
      (fam.geom nx' ny' hnx' hny').owner e = c → S3Geom.isBulk e →
        (fam.stage1 nx ny hnx hny).F (ι.B c) D (ι.E e) = (fam.stage1 nx' ny' hnx' hny').F c (D ∘ ι.V) e
noncomputable def prob {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (A : Ω → Prop) : ℝ :=
  ∑ ω, if A ω then P ω else 0

Source: Zenodo record 24048008, lean_ml.tar.zst/lean_ml/QECML/TwoD/CertQ103.lean:89-95.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_ml_axioms.txt:85.

'QECML.threshold_q103_certified' depends on axioms: [propext, Classical.choice, Quot.sound]

QECML.theoremB_certified_q103_obs

Theorem 2.5, the confidence statement for the bound, with the observed counts: kernel-only

theorem theoremB_certified_q103_obs (sp : S3Prog) (hV6 : sp.V6) (hD : 4 + 2 * sp.R / sp.L = 6) (hL2 : 2 ≤ sp.L)
    (hcov : (sp.toFam hV6).Hcov) {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (hP : ∀ ω, 0 ≤ P ω)
    (Kc : Fin 7 → Fin 3 → Ω → ℕ)
    (hlaw : ∀ t j m, (∑ ω, if Kc t j ω = m then P ω else 0) =
      ((looksQ103 j).choose m : ℝ) * (sp.toFam hV6).refRateK 2 0.103 t ^ m *
        (1 - (sp.toFam hV6).refRateK 2 0.103 t) ^ (looksQ103 j - m))
    (ω₀ : Ω) (hobs : ∀ t, Kc t (obsLookQ103 t) ω₀ = obsKQ103 t) :
    TheoremQ103Concl sp.L ∨ ((∀ t, ∃ j, Kc t j ω₀ ≤ cutsQ103 j) ∧
      (∑ ω, if (∀ t, ∃ j, Kc t j ω ≤ cutsQ103 j) then P ω else 0) ≤ 1e-9)
Definitions used in the statement
def TheoremQ103Concl (L : ℕ) : Prop :=
  ∀ (q : ℝ), q ≤ 0.103 → ∀ (W H : ℕ), 1 ≤ W → 41 * L ≤ H →
    pMLPlanar (W - 1) (H - 1) q ≤
      36 * (nxOfN 6 L W : ℝ) * Real.exp (-0.1 * ((nyOf L H : ℝ) - 40)) +
        3.8e4 * (nxOfN 6 L W : ℝ) * Real.exp (-0.015 * ((nyOf L H : ℝ) - 40))
noncomputable def refRateK (K : ℕ) (q : ℝ) (t : Fin (2 * K + 3)) : ℝ :=
  prob (bernProd q) (fun E => (fam.refStage1K K).bad E (fam.refBlockK K t))
def looksQ103 : Fin 3 → ℕ := ![125040, 187560, 250080]
def cutsQ103 : Fin 3 → ℕ := ![7, 19, 32]
def obsLookQ103 : Fin 7 → Fin 3 := ![0, 0, 1, 0, 0, 1, 0]
def obsKQ103 : Fin 7 → ℕ := ![2, 4, 10, 7, 3, 12, 4]
noncomputable def pMLPlanar (w h : ℕ) (q : ℝ) : ℝ := pML (bernProd q) (psyn w h) (pcls w h)
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn (w h : ℕ) : (PEdge w h → ZMod 2) →+ (PVert w h → ZMod 2) where
  toFun e v := ∑ f, (if v ∈ f.ends then 1 else 0) * e f
  map_zero' := by ext v; simp
  map_add' e e' := by ext v; simp [mul_add, Finset.sum_add_distrib]
def pcls (w h : ℕ) : (PEdge w h → ZMod 2) →+ ZMod 2 where
  toFun e := ∑ x, e (.bot x)
  map_zero' := by simp
  map_add' e e' := by simp [Finset.sum_add_distrib]
inductive PEdge (w h : ℕ) where
  | hor (x : Fin w) (y : Fin (h + 1))
  | ver (x : Fin (w + 1)) (y : Fin h)
  | bot (x : Fin (w + 1))
  | top (x : Fin (w + 1))
  deriving DecidableEq
def nxOfN (n0 L W : ℕ) : ℕ := max n0 ((W + L - 1) / L)
def nyOf (L H : ℕ) : ℕ := H / L
structure S3Prog where
  L : ℕ
  R : ℕ
  hL : 1 ≤ L
  prog : ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), Stage1Prog ⟨L, R, nx, ny, hL, hnx, hny⟩
def V6 : Prop := ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), (sp.prog nx ny hnx hny).SyndromeOnly
noncomputable def toFam (hV6 : sp.V6) : S3Fam where
  L := sp.L
  R := sp.R
  hL := sp.hL
  stage1 nx ny hnx hny := (sp.prog nx ny hnx hny).toStage1 (hV6 nx ny hnx hny)
def Hcov : Prop :=
  ∀ (nx ny nx' ny' : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny) (hnx' : 1 ≤ nx') (hny' : 1 ≤ ny')
    (ι : S3Geom.Emb (fam.geom nx' ny' hnx' hny') (fam.geom nx ny hnx hny))
    (c : (fam.geom nx' ny' hnx' hny').Block), ι.Congr c →
    ∀ (D : (fam.geom nx ny hnx hny).V → ZMod 2) (e : (fam.geom nx' ny' hnx' hny').Ed),
      (fam.geom nx' ny' hnx' hny').owner e = c → S3Geom.isBulk e →
        (fam.stage1 nx ny hnx hny).F (ι.B c) D (ι.E e) = (fam.stage1 nx' ny' hnx' hny').F c (D ∘ ι.V) e
noncomputable def prob {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (A : Ω → Prop) : ℝ :=
  ∑ ω, if A ω then P ω else 0

Source: Zenodo record 24048008, lean_ml.tar.zst/lean_ml/QECML/TwoD/CertObservedQ103.lean:62-70.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_ml_axioms.txt:97.

'QECML.theoremB_certified_q103_obs' depends on axioms: [propext, Classical.choice, Quot.sound]

QECML.threshold_q103_certified_obs

Theorem 2.5, the confidence statement for the threshold, with the observed counts: kernel-only

theorem threshold_q103_certified_obs (sp : S3Prog) (hV6 : sp.V6) (hD : 4 + 2 * sp.R / sp.L = 6) (hL2 : 2 ≤ sp.L)
    (hcov : (sp.toFam hV6).Hcov) {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (hP : ∀ ω, 0 ≤ P ω)
    (Kc : Fin 7 → Fin 3 → Ω → ℕ)
    (hlaw : ∀ t j m, (∑ ω, if Kc t j ω = m then P ω else 0) =
      ((looksQ103 j).choose m : ℝ) * (sp.toFam hV6).refRateK 2 0.103 t ^ m *
        (1 - (sp.toFam hV6).refRateK 2 0.103 t) ^ (looksQ103 j - m))
    (ω₀ : Ω) (hobs : ∀ t, Kc t (obsLookQ103 t) ω₀ = obsKQ103 t) :
    ThresholdConclQ103 sp.L ∨ ((∀ t, ∃ j, Kc t j ω₀ ≤ cutsQ103 j) ∧
      (∑ ω, if (∀ t, ∃ j, Kc t j ω ≤ cutsQ103 j) then P ω else 0) ≤ 1e-9)
Definitions used in the statement
def ThresholdConclQ103 (L : ℕ) : Prop :=
  ∀ W : ℕ → ℕ, (∀ H, 1 ≤ W H) → SubExp W → ∀ q : ℝ, 0 ≤ q → q ≤ 0.103 →
    Tendsto (fun H : ℕ => pMLPlanar (W H - 1) (H - 1) q) atTop (𝓝 0) ∧
      ∀ᶠ H in atTop, pMLPlanar (W H - 1) (H - 1) q ≤ Real.exp (-(1 / (200 * (L : ℝ)) * (H : ℝ)))
noncomputable def refRateK (K : ℕ) (q : ℝ) (t : Fin (2 * K + 3)) : ℝ :=
  prob (bernProd q) (fun E => (fam.refStage1K K).bad E (fam.refBlockK K t))
def looksQ103 : Fin 3 → ℕ := ![125040, 187560, 250080]
def cutsQ103 : Fin 3 → ℕ := ![7, 19, 32]
def obsLookQ103 : Fin 7 → Fin 3 := ![0, 0, 1, 0, 0, 1, 0]
def obsKQ103 : Fin 7 → ℕ := ![2, 4, 10, 7, 3, 12, 4]
def SubExp (f : ℕ → ℕ) : Prop :=
  ∀ c : ℝ, 0 < c → Tendsto (fun n : ℕ => (f n : ℝ) * Real.exp (-(c * n))) atTop (𝓝 0)
noncomputable def pMLPlanar (w h : ℕ) (q : ℝ) : ℝ := pML (bernProd q) (psyn w h) (pcls w h)
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn (w h : ℕ) : (PEdge w h → ZMod 2) →+ (PVert w h → ZMod 2) where
  toFun e v := ∑ f, (if v ∈ f.ends then 1 else 0) * e f
  map_zero' := by ext v; simp
  map_add' e e' := by ext v; simp [mul_add, Finset.sum_add_distrib]
def pcls (w h : ℕ) : (PEdge w h → ZMod 2) →+ ZMod 2 where
  toFun e := ∑ x, e (.bot x)
  map_zero' := by simp
  map_add' e e' := by simp [Finset.sum_add_distrib]
inductive PEdge (w h : ℕ) where
  | hor (x : Fin w) (y : Fin (h + 1))
  | ver (x : Fin (w + 1)) (y : Fin h)
  | bot (x : Fin (w + 1))
  | top (x : Fin (w + 1))
  deriving DecidableEq
structure S3Prog where
  L : ℕ
  R : ℕ
  hL : 1 ≤ L
  prog : ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), Stage1Prog ⟨L, R, nx, ny, hL, hnx, hny⟩
def V6 : Prop := ∀ (nx ny : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny), (sp.prog nx ny hnx hny).SyndromeOnly
noncomputable def toFam (hV6 : sp.V6) : S3Fam where
  L := sp.L
  R := sp.R
  hL := sp.hL
  stage1 nx ny hnx hny := (sp.prog nx ny hnx hny).toStage1 (hV6 nx ny hnx hny)
def Hcov : Prop :=
  ∀ (nx ny nx' ny' : ℕ) (hnx : 1 ≤ nx) (hny : 1 ≤ ny) (hnx' : 1 ≤ nx') (hny' : 1 ≤ ny')
    (ι : S3Geom.Emb (fam.geom nx' ny' hnx' hny') (fam.geom nx ny hnx hny))
    (c : (fam.geom nx' ny' hnx' hny').Block), ι.Congr c →
    ∀ (D : (fam.geom nx ny hnx hny).V → ZMod 2) (e : (fam.geom nx' ny' hnx' hny').Ed),
      (fam.geom nx' ny' hnx' hny').owner e = c → S3Geom.isBulk e →
        (fam.stage1 nx ny hnx hny).F (ι.B c) D (ι.E e) = (fam.stage1 nx' ny' hnx' hny').F c (D ∘ ι.V) e
noncomputable def prob {Ω : Type*} [Fintype Ω] (P : Ω → ℝ) (A : Ω → Prop) : ℝ :=
  ∑ ω, if A ω then P ω else 0

Source: Zenodo record 24048008, lean_ml.tar.zst/lean_ml/QECML/TwoD/CertObservedQ103.lean:78-86.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_ml_axioms.txt:98.

'QECML.threshold_q103_certified_obs' depends on axioms: [propext, Classical.choice, Quot.sound]

QECD1.d1B_num

Theorem 2.6, the bound on P_ML from (V6), (Hcov) and the bad-block bound: kernel-only

theorem d1B_num (sp : S3Prog3) (hV6 : sp.V6) (hcov : (sp.toFam3 hV6).Hcov3)
    (hstat : (sp.toFam3 hV6).Hstat3 0.02 eps) {q : ℝ} (hq : q ≤ 0.02) {T W H : ℕ} (hW : 1 ≤ W)
    (hH : 5 * 35 ≤ H) :
    pML3 T (W - 1) (H - 1) q ≤
      804 * (blkUp (T + 1) : ℝ) * (blkUp W : ℝ) * Real.exp (-0.1008 * (((H / 35 : ℕ) : ℝ) - 47)) +
        5.11e6 * (blkUp (T + 1) : ℝ) * (blkUp W : ℝ) * Real.exp (-0.007 * (((H / 35 : ℕ) : ℝ) - 47))
Definitions used in the statement
noncomputable def pML3 (T w h : ℕ) (q : ℝ) : ℝ :=
  pML (bernProd q) (psyn3 (T := T) (w := w) (h := h)) (pcls3 (T := T) (w := w) (h := h))
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn3 (X : PEdge3 T w h → ZMod 2) (v : PVert3 T w h) : ZMod 2 :=
  ∑ e ∈ Finset.univ.filter (fun e : PEdge3 T w h => v ∈ e.ends), X e
noncomputable def pcls3 (X : PEdge3 T w h → ZMod 2) : ZMod 2 := ∑ t : Fin (T + 1), ∑ x : Fin (w + 1), X (.bot t x)
def blkUp (m : ℕ) : ℕ := max 5 ((m + 34) / 35)
noncomputable def eps : ℝ := 37 / 2000000
structure S3Prog3 where
  prog : ∀ nt nx ny : ℕ, Stage1Prog3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)
def V6 : Prop := ∀ nt nx ny : ℕ, (sp.prog nt nx ny).SyndromeOnly
noncomputable def toFam3 (hV6 : sp.V6) : S3Fam3 where
  stage1 nt nx ny := (sp.prog nt nx ny).toStage13 (hV6 nt nx ny)
def Hcov3 : Prop :=
  ∀ (nt nx ny nt' nx' ny' : ℕ), 1 ≤ nt → 1 ≤ nx → 1 ≤ ny → 1 ≤ nt' → 1 ≤ nx' → 1 ≤ ny' →
    ∀ (ι : Emb3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1) (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)) (c : V3),
      ι.Congr c → ∀ (D : PVert3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1) → ZMod 2)
        (e : PEdge3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1)), owner3 e = c → ¬ e.isHalf →
          (fam.stage1 nt nx ny).F (ι.B c) D (ι.E e) = (fam.stage1 nt' nx' ny').F c (D ∘ ι.V) e
def Hstat3 (p ε : ℝ) : Prop :=
  ∀ i j : Fin 5, prob p (fun X => (fam.stage1 5 5 5).bad (toZ2 X) (refBlock i j)) ≤ ε
noncomputable def prob (p : ℝ) (A : (ι → Bool) → Prop) : ℝ := ∑ X, if A X then pw p X else 0
noncomputable def pw (p : ℝ) (X : ι → Bool) : ℝ := ∏ e, if X e then p else 1 - p

Source: Zenodo record 24048008, lean_d1.tar.zst/lean_d1/QECD1/TheoremB3.lean:194-199.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_d1_axioms.txt:131.

'QECD1.d1B_num' depends on axioms: [propext, Classical.choice, Quot.sound]

QECD1.pML3_tendsto_zero_subexp

Theorem 2.6, the threshold along subexponential W and T: kernel-only

theorem pML3_tendsto_zero_subexp (sp : S3Prog3) (hV6 : sp.V6) (hcov : (sp.toFam3 hV6).Hcov3)
    (hstat : (sp.toFam3 hV6).Hstat3 0.02 eps) {W T : ℕ → ℕ} (hW1 : ∀ H, 1 ≤ W H) (hWs : SubExp W)
    (hTs : SubExp T) {q : ℝ} (hq0 : 0 ≤ q) (hq : q ≤ 0.02) :
    Tendsto (fun H : ℕ => pML3 (T H) (W H - 1) (H - 1) q) atTop (𝓝 0)
Definitions used in the statement
noncomputable def pML3 (T w h : ℕ) (q : ℝ) : ℝ :=
  pML (bernProd q) (psyn3 (T := T) (w := w) (h := h)) (pcls3 (T := T) (w := w) (h := h))
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn3 (X : PEdge3 T w h → ZMod 2) (v : PVert3 T w h) : ZMod 2 :=
  ∑ e ∈ Finset.univ.filter (fun e : PEdge3 T w h => v ∈ e.ends), X e
noncomputable def pcls3 (X : PEdge3 T w h → ZMod 2) : ZMod 2 := ∑ t : Fin (T + 1), ∑ x : Fin (w + 1), X (.bot t x)
def SubExp (f : ℕ → ℕ) : Prop :=
  ∀ c : ℝ, 0 < c → Tendsto (fun n : ℕ => (f n : ℝ) * Real.exp (-(c * n))) atTop (𝓝 0)
noncomputable def eps : ℝ := 37 / 2000000
structure S3Prog3 where
  prog : ∀ nt nx ny : ℕ, Stage1Prog3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)
def V6 : Prop := ∀ nt nx ny : ℕ, (sp.prog nt nx ny).SyndromeOnly
noncomputable def toFam3 (hV6 : sp.V6) : S3Fam3 where
  stage1 nt nx ny := (sp.prog nt nx ny).toStage13 (hV6 nt nx ny)
def Hcov3 : Prop :=
  ∀ (nt nx ny nt' nx' ny' : ℕ), 1 ≤ nt → 1 ≤ nx → 1 ≤ ny → 1 ≤ nt' → 1 ≤ nx' → 1 ≤ ny' →
    ∀ (ι : Emb3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1) (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)) (c : V3),
      ι.Congr c → ∀ (D : PVert3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1) → ZMod 2)
        (e : PEdge3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1)), owner3 e = c → ¬ e.isHalf →
          (fam.stage1 nt nx ny).F (ι.B c) D (ι.E e) = (fam.stage1 nt' nx' ny').F c (D ∘ ι.V) e
def Hstat3 (p ε : ℝ) : Prop :=
  ∀ i j : Fin 5, prob p (fun X => (fam.stage1 5 5 5).bad (toZ2 X) (refBlock i j)) ≤ ε
noncomputable def prob (p : ℝ) (A : (ι → Bool) → Prop) : ℝ := ∑ X, if A X then pw p X else 0
noncomputable def pw (p : ℝ) (X : ι → Bool) : ℝ := ∏ e, if X e then p else 1 - p

Source: Zenodo record 24048008, lean_d1.tar.zst/lean_d1/QECD1/Threshold3.lean:199-202.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_d1_axioms.txt:8.

'QECD1.pML3_tendsto_zero_subexp' depends on axioms: [propext, Classical.choice, Quot.sound]

QECD1.pML3_exp_decay_subexp

Theorem 2.6, the eventual bound exp(−H/28000) along subexponential W and T: kernel-only

theorem pML3_exp_decay_subexp (sp : S3Prog3) (hV6 : sp.V6) (hcov : (sp.toFam3 hV6).Hcov3)
    (hstat : (sp.toFam3 hV6).Hstat3 0.02 eps) {W T : ℕ → ℕ} (hW1 : ∀ H, 1 ≤ W H) (hWs : SubExp W)
    (hTs : SubExp T) {q : ℝ} (hq : q ≤ 0.02) :
    ∀ᶠ H in atTop, pML3 (T H) (W H - 1) (H - 1) q ≤ Real.exp (-(1 / 28000 * (H : ℝ)))
Definitions used in the statement
noncomputable def pML3 (T w h : ℕ) (q : ℝ) : ℝ :=
  pML (bernProd q) (psyn3 (T := T) (w := w) (h := h)) (pcls3 (T := T) (w := w) (h := h))
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn3 (X : PEdge3 T w h → ZMod 2) (v : PVert3 T w h) : ZMod 2 :=
  ∑ e ∈ Finset.univ.filter (fun e : PEdge3 T w h => v ∈ e.ends), X e
noncomputable def pcls3 (X : PEdge3 T w h → ZMod 2) : ZMod 2 := ∑ t : Fin (T + 1), ∑ x : Fin (w + 1), X (.bot t x)
def SubExp (f : ℕ → ℕ) : Prop :=
  ∀ c : ℝ, 0 < c → Tendsto (fun n : ℕ => (f n : ℝ) * Real.exp (-(c * n))) atTop (𝓝 0)
noncomputable def eps : ℝ := 37 / 2000000
structure S3Prog3 where
  prog : ∀ nt nx ny : ℕ, Stage1Prog3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)
def V6 : Prop := ∀ nt nx ny : ℕ, (sp.prog nt nx ny).SyndromeOnly
noncomputable def toFam3 (hV6 : sp.V6) : S3Fam3 where
  stage1 nt nx ny := (sp.prog nt nx ny).toStage13 (hV6 nt nx ny)
def Hcov3 : Prop :=
  ∀ (nt nx ny nt' nx' ny' : ℕ), 1 ≤ nt → 1 ≤ nx → 1 ≤ ny → 1 ≤ nt' → 1 ≤ nx' → 1 ≤ ny' →
    ∀ (ι : Emb3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1) (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)) (c : V3),
      ι.Congr c → ∀ (D : PVert3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1) → ZMod 2)
        (e : PEdge3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1)), owner3 e = c → ¬ e.isHalf →
          (fam.stage1 nt nx ny).F (ι.B c) D (ι.E e) = (fam.stage1 nt' nx' ny').F c (D ∘ ι.V) e
def Hstat3 (p ε : ℝ) : Prop :=
  ∀ i j : Fin 5, prob p (fun X => (fam.stage1 5 5 5).bad (toZ2 X) (refBlock i j)) ≤ ε
noncomputable def prob (p : ℝ) (A : (ι → Bool) → Prop) : ℝ := ∑ X, if A X then pw p X else 0
noncomputable def pw (p : ℝ) (X : ι → Bool) : ℝ := ∏ e, if X e then p else 1 - p

Source: Zenodo record 24048008, lean_d1.tar.zst/lean_d1/QECD1/Threshold3.lean:206-209.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_d1_axioms.txt:9.

'QECD1.pML3_exp_decay_subexp' depends on axioms: [propext, Classical.choice, Quot.sound]

QECD1.d1B_certified

Theorem 2.6, the confidence statement for the bound: kernel-only

theorem d1B_certified (sp : S3Prog3) (hV6 : sp.V6) (hcov : (sp.toFam3 hV6).Hcov3) {Ω : Type*} [Fintype Ω]
    (P : Ω → ℝ) (hP : ∀ ω, 0 ≤ P ω) (K : Fin 5 × Fin 5 → Ω → ℕ)
    (hlaw : ∀ t j, (∑ ω, if K t ω = j then P ω else 0) =
      ((Nat.choose 3000000 j : ℕ) : ℝ) * refRate3 sp hV6 t ^ j * (1 - refRate3 sp hV6 t) ^ (3000000 - j)) :
    D1BConcl ∨ (∑ ω, if (∀ t, K t ω ≤ 14) then P ω else 0) ≤ 1e-9
Definitions used in the statement
def D1BConcl : Prop :=
  ∀ (q : ℝ), q ≤ 0.02 → ∀ (T W H : ℕ), 1 ≤ W → 5 * 35 ≤ H →
    pML3 T (W - 1) (H - 1) q ≤
      804 * (blkUp (T + 1) : ℝ) * (blkUp W : ℝ) * Real.exp (-0.1008 * (((H / 35 : ℕ) : ℝ) - 47)) +
        5.11e6 * (blkUp (T + 1) : ℝ) * (blkUp W : ℝ) * Real.exp (-0.007 * (((H / 35 : ℕ) : ℝ) - 47))
noncomputable def refRate3 (sp : S3Prog3) (hV6 : sp.V6) (t : Fin 5 × Fin 5) : ℝ :=
  prob 0.02 (fun X => ((sp.toFam3 hV6).stage1 5 5 5).bad (toZ2 X) (refBlock t.1 t.2))
noncomputable def pML3 (T w h : ℕ) (q : ℝ) : ℝ :=
  pML (bernProd q) (psyn3 (T := T) (w := w) (h := h)) (pcls3 (T := T) (w := w) (h := h))
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn3 (X : PEdge3 T w h → ZMod 2) (v : PVert3 T w h) : ZMod 2 :=
  ∑ e ∈ Finset.univ.filter (fun e : PEdge3 T w h => v ∈ e.ends), X e
noncomputable def pcls3 (X : PEdge3 T w h → ZMod 2) : ZMod 2 := ∑ t : Fin (T + 1), ∑ x : Fin (w + 1), X (.bot t x)
def blkUp (m : ℕ) : ℕ := max 5 ((m + 34) / 35)
structure S3Prog3 where
  prog : ∀ nt nx ny : ℕ, Stage1Prog3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)
def V6 : Prop := ∀ nt nx ny : ℕ, (sp.prog nt nx ny).SyndromeOnly
noncomputable def toFam3 (hV6 : sp.V6) : S3Fam3 where
  stage1 nt nx ny := (sp.prog nt nx ny).toStage13 (hV6 nt nx ny)
def Hcov3 : Prop :=
  ∀ (nt nx ny nt' nx' ny' : ℕ), 1 ≤ nt → 1 ≤ nx → 1 ≤ ny → 1 ≤ nt' → 1 ≤ nx' → 1 ≤ ny' →
    ∀ (ι : Emb3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1) (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)) (c : V3),
      ι.Congr c → ∀ (D : PVert3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1) → ZMod 2)
        (e : PEdge3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1)), owner3 e = c → ¬ e.isHalf →
          (fam.stage1 nt nx ny).F (ι.B c) D (ι.E e) = (fam.stage1 nt' nx' ny').F c (D ∘ ι.V) e
noncomputable def prob (p : ℝ) (A : (ι → Bool) → Prop) : ℝ := ∑ X, if A X then pw p X else 0
noncomputable def pw (p : ℝ) (X : ι → Bool) : ℝ := ∏ e, if X e then p else 1 - p

Source: Zenodo record 24048008, lean_d1.tar.zst/lean_d1/QECD1/CertD1.lean:111-115.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_d1_axioms.txt:31.

'QECD1.d1B_certified' depends on axioms: [propext, Classical.choice, Quot.sound]

QECD1.threshold_d1_general_certified

Theorem 2.6, the confidence statement for the threshold: kernel-only

theorem threshold_d1_general_certified (sp : S3Prog3) (hV6 : sp.V6) (hcov : (sp.toFam3 hV6).Hcov3) {Ω : Type*}
    [Fintype Ω] (P : Ω → ℝ) (hP : ∀ ω, 0 ≤ P ω) (K : Fin 5 × Fin 5 → Ω → ℕ)
    (hlaw : ∀ t j, (∑ ω, if K t ω = j then P ω else 0) =
      ((Nat.choose 3000000 j : ℕ) : ℝ) * refRate3 sp hV6 t ^ j * (1 - refRate3 sp hV6 t) ^ (3000000 - j)) :
    (∀ W T : ℕ → ℕ, (∀ H, 1 ≤ W H) → SubExp W → SubExp T → ∀ q : ℝ, 0 ≤ q → q ≤ 0.02 →
      Tendsto (fun H : ℕ => pML3 (T H) (W H - 1) (H - 1) q) atTop (𝓝 0) ∧
        ∀ᶠ H in atTop, pML3 (T H) (W H - 1) (H - 1) q ≤ Real.exp (-(1 / 28000 * (H : ℝ)))) ∨
      (∑ ω, if (∀ t, K t ω ≤ 14) then P ω else 0) ≤ 1e-9
Definitions used in the statement
noncomputable def refRate3 (sp : S3Prog3) (hV6 : sp.V6) (t : Fin 5 × Fin 5) : ℝ :=
  prob 0.02 (fun X => ((sp.toFam3 hV6).stage1 5 5 5).bad (toZ2 X) (refBlock t.1 t.2))
def SubExp (f : ℕ → ℕ) : Prop :=
  ∀ c : ℝ, 0 < c → Tendsto (fun n : ℕ => (f n : ℝ) * Real.exp (-(c * n))) atTop (𝓝 0)
noncomputable def pML3 (T w h : ℕ) (q : ℝ) : ℝ :=
  pML (bernProd q) (psyn3 (T := T) (w := w) (h := h)) (pcls3 (T := T) (w := w) (h := h))
noncomputable def pML (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) : ℝ :=
  pFail P syn cls (mlDec P syn cls)
def pFail (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (dec : S → C) : ℝ :=
  ∑ ω, if dec (syn ω) = cls ω then 0 else P ω
noncomputable def mlDec (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) : C :=
  Classical.choose (Finset.exists_max_image Finset.univ (joint P syn cls s) Finset.univ_nonempty)
def joint (P : Ω → ℝ) (syn : Ω → S) (cls : Ω → C) (s : S) (c : C) : ℝ :=
  ∑ ω, if syn ω = s ∧ cls ω = c then P ω else 0
def bernProd {ι : Type*} [Fintype ι] (q : ℝ) (e : ι → ZMod 2) : ℝ := ∏ i, bern q (e i)
def bern (q : ℝ) (x : ZMod 2) : ℝ := if x = 0 then 1 - q else q
def psyn3 (X : PEdge3 T w h → ZMod 2) (v : PVert3 T w h) : ZMod 2 :=
  ∑ e ∈ Finset.univ.filter (fun e : PEdge3 T w h => v ∈ e.ends), X e
noncomputable def pcls3 (X : PEdge3 T w h → ZMod 2) : ZMod 2 := ∑ t : Fin (T + 1), ∑ x : Fin (w + 1), X (.bot t x)
structure S3Prog3 where
  prog : ∀ nt nx ny : ℕ, Stage1Prog3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)
def V6 : Prop := ∀ nt nx ny : ℕ, (sp.prog nt nx ny).SyndromeOnly
noncomputable def toFam3 (hV6 : sp.V6) : S3Fam3 where
  stage1 nt nx ny := (sp.prog nt nx ny).toStage13 (hV6 nt nx ny)
def Hcov3 : Prop :=
  ∀ (nt nx ny nt' nx' ny' : ℕ), 1 ≤ nt → 1 ≤ nx → 1 ≤ ny → 1 ≤ nt' → 1 ≤ nx' → 1 ≤ ny' →
    ∀ (ι : Emb3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1) (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1)) (c : V3),
      ι.Congr c → ∀ (D : PVert3 (nt * 35 - 1) (nx * 35 - 1) (ny * 35 - 1) → ZMod 2)
        (e : PEdge3 (nt' * 35 - 1) (nx' * 35 - 1) (ny' * 35 - 1)), owner3 e = c → ¬ e.isHalf →
          (fam.stage1 nt nx ny).F (ι.B c) D (ι.E e) = (fam.stage1 nt' nx' ny').F c (D ∘ ι.V) e
noncomputable def prob (p : ℝ) (A : (ι → Bool) → Prop) : ℝ := ∑ X, if A X then pw p X else 0
noncomputable def pw (p : ℝ) (X : ι → Bool) : ℝ := ∏ e, if X e then p else 1 - p

Source: Zenodo record 24048008, lean_d1.tar.zst/lean_d1/QECD1/Threshold3.lean:216-223.

Axioms, as Lean reports them. Recorded in zenodo:24048008/lean_d1_axioms.txt:10.

'QECD1.threshold_d1_general_certified' depends on axioms: [propext, Classical.choice, Quot.sound]