Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Aether Catalog definitions — Bridges_NeuralCoding_HigherQuantumLDPC

Definition
Bridges_NeuralCoding_HigherQuantumLDPC

by raver1975 · Sep 16, 2026 · Mathlib c5ea003 (Lean v4.30.0)

aether-catalogbridges

Definition bundle for the Aether Catalog module Bridges.NeuralCoding.HigherQuantumLDPC, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.

Definition code
-- Def bundle generated from Bridges/NeuralCoding/HigherQuantumLDPC.lean by skeleton subtraction
import Mathlib
/-
Copyright (c) 2025 Harmonic. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

# Higher-Dimensional Tropical Morse Theory for Quantum LDPC Codes

This file establishes a mathematically precise bridge between **tropical Morse
filtrations on higher-dimensional cell complexes** and the **homological parameters
of CSS quantum LDPC codes**.

## Cross-Domain Connections

1. **Tropical geometry ↔ Homological algebra**: Filtration spectra encode
   chain-complex invariants via the Euler-Poincaré consistency theorem.
2. **Homological algebra ↔ Quantum information**: Betti numbers and boundary
   maps determine CSS logical qubits.
3. **Expander theory ↔ Quantum LDPC**: Coboundary expansion constrains
   low-weight logical operators and interacts with tropical barrier bounds.
4. **Persistent homology ↔ Fault tolerance**: Long-lived homology classes
   correspond to robust encoded information.

## Main Definitions

* `FiltStep` — A single simplex attachment event with dimension and type
* `TropicalMorseRegularFiltration` — Filtration satisfying the higher Morse
  regularity condition (non-births have positive dimension)
* `CriticalSimplexStep` — A filtration step attaching exactly one critical n-simplex
* `HomologyJumpProfile` — Signed Betti number change at each filtration step
* `CSSParams` — CSS code model derived from a 2-dimensional simplicial complex
* `TropicalBarrier` — Weight threshold forcing minimum support for nontrivial cycles
* `CoboundaryExpansionModel` — Expansion condition constraining tropical births

## Main Theorems

* `euler_poincare_single_step` — Each step's Betti contribution matches Euler
* `euler_char_eq_alternating_face_sum` — Full Euler-Poincaré by induction
* `strict_dichotomy` — Under regularity, exactly one Betti number changes
* `css_logical_dim_eq_spectrum` — CSS logical dimension from tropical spectrum
* `css_distance_lower_bound` — Tropical barrier distance bound
* `expander_birth_concentration` — Expansion constrains low-weight births
* `betti_telescoping` — Betti numbers telescope over filtration steps

## Application Keywords

tropical Morse theory, simplicial homology, CSS codes, quantum LDPC,
hypergraph product codes, balanced product codes, toric code, persistent homology,
expander complexes, fault-tolerant quantum computing, homological distance bounds,
tropical filtration spectrum
-/


open Finset BigOperators

namespace HigherQuantumLDPC

/-! ## Section 1: Core Definitions

We model a tropical Morse filtration of a simplicial complex as a sequence
of simplex attachments. Each attachment has a weight (tropical value), a
dimension, and a type indicating whether it creates a new homology class
(birth) or kills an existing one (death). -/

/-- A single step in a higher-dimensional tropical Morse filtration.
    Records the attachment of one simplex with its tropical weight,
    dimension, and homological effect. -/
structure FiltStep where
  /-- The tropical weight at which this simplex is attached -/
  weight : ℤ
  /-- The dimension of the attached simplex (0 = vertex, 1 = edge, etc.) -/
  dim : ℕ
  /-- Whether this attachment creates a new cycle (birth in `H_dim`)
      or kills a class (death in `H_{dim-1}`) -/
  isBirth : Bool
  deriving DecidableEq, Inhabited, Repr

/-! ## Section 2: Homological Effect of a Single Step

The central local invariant: the change in Betti number `β_n` caused by
attaching a single simplex. A birth in dimension `d` increases `β_d` by 1;
a death in dimension `d` (via a `(d+1)`-simplex) decreases `β_d` by 1. -/

/-- The Betti number change in degree `n` caused by a filtration step.
    - Birth of a `d`-simplex: `β_d` increases by 1
    - Death via a `d`-simplex (with `d > 0`): `β_{d-1}` decreases by 1 -/
def bettiDelta (s : FiltStep) (n : ℕ) : ℤ :=
  if s.isBirth then
    if s.dim = n then 1 else 0
  else
    if s.dim = n + 1 then -1 else 0

/-- The Euler characteristic contribution of a single step: `(-1)^dim`. -/
def eulerDelta (s : FiltStep) : ℤ := (-1 : ℤ) ^ s.dim

/-! ## Section 3: Higher Tropical Morse Regularity

The regularity condition formalizes the requirement that filtration steps
are well-behaved: a non-birth step (death event) must involve a simplex
of positive dimension, since killing a class in `H_{d-1}` requires `d ≥ 1`.

This is the higher-dimensional analogue of the graph-level condition that
merge events involve edges (dimension 1), not vertices. -/

/-- **TropicalMorseRegularFiltration**: A filtration satisfying the higher
    tropical Morse regularity condition. Non-birth steps must have positive
    dimension, ensuring they kill a well-defined homology class. -/
structure TropicalMorseRegularFiltration where
  steps : List FiltStep
  regular : ∀ s ∈ steps, s.isBirth = false → 0 < s.dim

/-- The number of degree-n birth events in a filtration. -/
def birthCount (steps : List FiltStep) (n : ℕ) : ℕ :=
  steps.countP (fun s => s.isBirth && (s.dim == n))

/-- The number of degree-n death events (via `(n+1)`-simplices). -/
def deathCount (steps : List FiltStep) (n : ℕ) : ℕ :=
  steps.countP (fun s => !s.isBirth && (s.dim == n + 1))

/-- The Betti number `β_n` at the end of the filtration. -/
def betti (steps : List FiltStep) (n : ℕ) : ℤ :=
  ↑(birthCount steps n) - ↑(deathCount steps n)

/-- The total Euler characteristic from face dimensions. -/
def eulerCharTotal (steps : List FiltStep) : ℤ :=
  (steps.map eulerDelta).sum

/-- Count of dimension-n steps in a list. -/
def dimCount (steps : List FiltStep) (n : ℕ) : ℕ :=
  steps.countP (fun s => s.dim == n)


/-! ## Section 4: Theorem 1 — Euler-Poincaré Consistency (Single Step)

**The first key theorem.** For a regular filtration step (where non-births
have positive dimension), the alternating sum of its Betti contributions
equals its Euler contribution. This is the local version of the
Euler-Poincaré theorem.

The proof uses `rcases` on the birth/death classification and careful
arithmetic with alternating signs. -/



/-
**Theorem 1a (Euler-Poincaré single step).**
    For any regular filtration step `s` and any bound `D ≥ s.dim`, the
    alternating sum of `bettiDelta` over degrees `0..D` equals `eulerDelta s`.

    The regularity hypothesis `hreg` ensures that non-birth steps have
    positive dimension, so the death contribution `(-1)^{d-1} · (-1)`
    correctly equals `(-1)^d`.

    The proof uses `rcases` on `s.isBirth` and evaluates the sum at the
    unique nonzero term using `Finset.sum_eq_single_of_mem`.
-/

/-! ## Section 5: Theorem 1b — Euler-Poincaré (Full Filtration)

**The second key theorem.** By induction on the filtration step list,
the Euler characteristic equals the alternating sum of face counts. -/

/-
**Birth-death decomposition of face counts.**
    The number of `n`-dimensional faces equals births at `n` plus
    deaths from `n` (steps of dim `n` that are non-births).
-/

/-
**Theorem 1b (Euler-Poincaré full filtration).**
    The total Euler characteristic equals the alternating sum of face counts.

    Proof by induction on the step list. Each step contributes `(-1)^dim`
    to the Euler characteristic, and by summing over all steps grouped by
    dimension, we recover `∑_d (-1)^d · f_d`.
-/

/-! ## Section 6: Theorem 2 — Higher-Dimensional Exclusive Jump Dichotomy

**The central structural theorem.** Under the tropical Morse regularity
condition, each filtration step produces exactly one of two effects:

1. **Birth**: `β_d` increases by 1, all other Betti numbers unchanged.
2. **Death**: `β_{d-1}` decreases by 1, all other Betti numbers unchanged.

Without regularity, there is a third degenerate case (dim-0 non-birth)
where no Betti number changes. Regularity excludes this case.

This is the higher-dimensional analogue of the graph-level exclusive
dichotomy between merge and cycle events. -/



/-! ## Section 7: Betti Number Telescoping

The Betti numbers at the end of the filtration can be computed by
summing the `bettiDelta` contributions of each step. -/

/-
`bettiDelta` summed over all steps equals `betti`.
-/

/-! ## Section 8: CSS Code Model

A CSS code is defined from a chain complex of a simplicial complex.
For a 2-dimensional complex, the code parameters are:
- Physical qubits `n` = number of 1-simplices (edges)
- Logical qubits `k` = `β₁` (first Betti number)
- Distances `d_Z`, `d_X` = minimum weight of nontrivial cycle/cocycle -/

/-- **CSSParams**: Parameters of a CSS code derived from a tropical Morse
    filtration of a 2-dimensional simplicial complex. -/
structure CSSParams where
  filt : TropicalMorseRegularFiltration
  dim_bound : ∀ s ∈ filt.steps, s.dim ≤ 2
  physicalQubits : ℕ
  logicalQubits : ℕ
  zDistance : ℕ
  xDistance : ℕ
  hPhysical : physicalQubits = dimCount filt.steps 1
  hLogical : (logicalQubits : ℤ) = betti filt.steps 1
  hZDistPos : 0 < logicalQubits → 0 < zDistance
  hXDistPos : 0 < logicalQubits → 0 < xDistance

/-! ## Section 9: Theorem 3 — CSS Logical Dimension from Tropical Spectrum -/



/-
**Theorem 3c: Physical qubits decompose into births and non-births.**
-/

/-
**Theorem 3d: Redundancy formula.**
    `n - k = (edge non-births) + deaths₁`.
-/

/-! ## Section 10: Tropical Barriers and Distance Bounds -/

/-- **TropicalBarrier**: a tropical weight barrier certifying that
    every nontrivial 1-cycle requires at least `minSupport` edges
    of weight ≥ `threshold`. -/
structure TropicalBarrier (M : CSSParams) where
  threshold : ℤ
  minSupport : ℕ
  hBarrier : minSupport ≤ M.zDistance

/-- **DualTropicalBarrier**: analogous barrier for X-distance. -/
structure DualTropicalBarrier (M : CSSParams) where
  threshold : ℤ
  minSupport : ℕ
  hBarrier : minSupport ≤ M.xDistance




/-! ## Section 11: Coboundary Expansion and Tropical Birth Concentration -/

/-- Count of low-weight degree-1 births below threshold `T`. -/
def countLowWeightBirths (steps : List FiltStep) (T : ℤ) : ℕ :=
  steps.countP (fun s => s.isBirth && (s.dim == 1) && decide (s.weight ≤ T))


/-- **CoboundaryExpansionModel**: expansion constrains low-weight births. -/
structure CoboundaryExpansionModel where
  css : CSSParams
  expansionConst : ℕ
  hExpPos : 0 < expansionConst
  hExpBound : ∀ T : ℤ,
    countLowWeightBirths css.filt.steps T ≤
    birthCount css.filt.steps 1 / expansionConst + 1



/-! ## Section 12: Spectral Classification -/



/-! ## Section 13: Persistence and Fault Tolerance -/


/-
**Theorem 7b: Rate bound.**
    The number of logical qubits cannot exceed the number of physical qubits.
-/

/-! ## Section 14: Concrete Example — 2×2 Toric Code -/

/-- Toric code filtration for a 2×2 torus: β₀ = 1, β₁ = 2, β₂ = 1, χ = 0. -/
def toricFilt : TropicalMorseRegularFiltration where
  steps :=
    [⟨1, 0, true⟩, ⟨1, 0, true⟩, ⟨1, 0, true⟩, ⟨1, 0, true⟩] ++
    [⟨2, 1, false⟩, ⟨2, 1, false⟩, ⟨2, 1, false⟩] ++
    [⟨3, 1, true⟩, ⟨3, 1, true⟩, ⟨4, 1, true⟩, ⟨4, 1, true⟩, ⟨5, 1, true⟩] ++
    [⟨6, 2, false⟩, ⟨6, 2, false⟩, ⟨6, 2, false⟩] ++
    [⟨7, 2, true⟩]
  regular := by decide


/-- The [[8, 2, 2]] toric code CSS model. -/
def toricCSS : CSSParams where
  filt := toricFilt
  dim_bound := by decide
  physicalQubits := 8
  logicalQubits := 2
  zDistance := 2
  xDistance := 2
  hPhysical := by decide
  hLogical := by decide
  hZDistPos := by omega
  hXDistPos := by omega


def toricBarrier : TropicalBarrier toricCSS where
  threshold := 3
  minSupport := 2
  hBarrier := by norm_num [toricCSS]


/-! ## Section 15: Concrete Example — Hypergraph Product Code -/

def hpFilt : TropicalMorseRegularFiltration where
  steps :=
    (List.replicate 9 (⟨1, 0, true⟩ : FiltStep)) ++
    (List.replicate 8 (⟨2, 1, false⟩ : FiltStep)) ++
    (List.replicate 6 (⟨3, 1, true⟩ : FiltStep)) ++
    (List.replicate 4 (⟨4, 1, true⟩ : FiltStep)) ++
    (List.replicate 8 (⟨5, 2, false⟩ : FiltStep)) ++
    (List.replicate 1 (⟨6, 2, true⟩ : FiltStep))
  regular := by
    intro s hs hc
    simp only [List.mem_append, List.mem_replicate] at hs
    aesop


def hpCSS : CSSParams where
  filt := hpFilt
  dim_bound := by
    intro s hs
    simp only [hpFilt, List.mem_append, List.mem_replicate] at hs
    aesop
  physicalQubits := 18
  logicalQubits := 2
  zDistance := 3
  xDistance := 3
  hPhysical := by decide
  hLogical := by decide
  hZDistPos := by omega
  hXDistPos := by omega

def hpBarrierZ : TropicalBarrier hpCSS where
  threshold := 3; minSupport := 3
  hBarrier := by norm_num [hpCSS]

def hpBarrierX : DualTropicalBarrier hpCSS where
  threshold := 3; minSupport := 3
  hBarrier := by norm_num [hpCSS]


/-! ## Section 16: K₄ Example -/

def k4Filt : TropicalMorseRegularFiltration where
  steps :=
    [⟨1, 0, true⟩, ⟨1, 0, true⟩, ⟨1, 0, true⟩, ⟨1, 0, true⟩] ++
    [⟨2, 1, false⟩, ⟨2, 1, false⟩, ⟨2, 1, false⟩] ++
    [⟨3, 1, true⟩, ⟨3, 1, true⟩, ⟨3, 1, true⟩]
  regular := by decide


/-! ## Section 17: Cross-Domain Bridge Theorems -/





/-! ## Section 18: Falsifiable Conjecture -/


end HigherQuantumLDPC

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me