Documentation

CsdLean4.Empirical.QM.MeasurementGidneyAdderHybrid

The measurement-based Gidney adder on the full register: the n-fold hybrid amplitude equality #

Category: 3-Local (QM-validity content; no CSD ontology).

MeasurementGidneyAdder.lean re-costs the Gidney adder — n Toffoli forward, 0 on the measured reverse pass — and MeasurementAdderHybrid.lean proved the amplitude-level statement for the AND-adder. This module is the same statement for the Gidney adder, on the general hybrid semantics of HybridLift.lean. Here the per-Toffoli picture is right: the reverse block of a Gidney cell is [CX cin cout, CCX a b cout, CX cin b, CX cin a], and when its Toffoli fires the ancilla cout holds exactly the fresh AND (a ⊕ cin) ∧ (b ⊕ cin) of the (still shifted) addend wires — an AND-shaped block, so Gidney's single-CZ gadget is exact there, one per cell, with the two un-shifting CNOTs kept as unitaries around it (gidneyHybridCell).

With MeasurementAdderHybrid.lean this closes link 11's measurement-gadget strand: both measurement-based adders of the corpus are amplitude-exact on the full register, at the Toffoli counts their re-costs state (n here, 3n there).

Honest scope #

Per-outcome representation: each of the 2ⁿ outcome strings has probability 2⁻ⁿ and every branch carries the right data. The Toffoli count of the reverse pass is 0 as gidneyMeasAddToffoli_eq states; the measurement count is n. No ECDSA resource claim.

Boolean facts #

theorem CSD.Empirical.QM.majority_xor_carry (a b c : Bool) :
(Reversible.majority a b c ^^ c) = ((a ^^ c) && (b ^^ c))

MAJ(a,b,c) ⊕ c = (a ⊕ c) ∧ (b ⊕ c): the Gidney cell's fresh AND is the carry-out minus the carry-in.

theorem CSD.Empirical.QM.regOfState_and (x y : Bool) :
(if (x && y) = true then 1 else 0) = ((if x = true then 1 else 0) * if y = true then 1 else 0) + 0

A Boolean AND in the Fin 2 recast: the product, as the one-pair parity.

The hybrid reverse pass #

The hybrid reverse block of cell k: the reversed Gidney cell with its Toffoli replaced by the single-correction gadget on the fresh AND (A k ⊕ G k) ∧ (B k ⊕ G k), the un-shifting CNOTs kept as unitaries.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    The unitary reverse block of cell k: the same gates with the Toffoli in place.

    The hybrid reverse pass over cells k−1, …, 0 (cell k−1 first, as in the reverse pass).

    Equations
    Instances For

      The hybrid Gidney adder: the forward and sum passes as unitaries, then the hybrid reverse pass over all n cells.

      Equations
      Instances For

        The shaped unitary reverse pass is the reverse pass.

        The invariant #

        def CSD.Empirical.QM.AgreeOff {m n : ℕ} (L : Reversible.GidneyLayout m n) (k : ℕ) (u : Fin m → Fin 2) (T : Reversible.State m) :

        Off the outcome ancillas of cells k, …, n−1, the register state u read as Booleans agrees with the Boolean state T.

        Equations
        Instances For
          def CSD.Empirical.QM.HoldsOutcomes {m n : ℕ} (L : Reversible.GidneyLayout m n) (mo : ℕ → Fin 2) (k : ℕ) (u : Fin m → Fin 2) :

          The outcome ancillas of cells k, …, n−1 hold their outcomes.

          Equations
          Instances For

            The wires of cells 0, …, k−1 still hold their post-forward values.

            Equations
            Instances For
              theorem CSD.Empirical.QM.gidneyHybrid_invariant {m n : ℕ} (L : Reversible.GidneyLayout m n) (mo : ℕ → Fin 2) (t : Reversible.State m) (hcell : ∀ j < n, (t (L.G (j + 1)) ^^ t (L.G j)) = (t (L.A j) && t (L.B j))) (k : ℕ) :

              The hybrid reverse pass against the unitary one, cell by cell. If, before the cells k−1, …, 0, the register state agrees with the Boolean state off the outcome ancillas of the cells already processed, those hold their outcomes, and the cells to come are still fresh, then the hybrid pass is well-formed, its shadow agrees with the unitary pass off all outcome ancillas, and every outcome ancilla holds its outcome.

              The carry invariant after the forward and sum passes #

              After the forward and sum passes, each cell's fresh AND is its carry-out minus its carry-in: G (j+1) ⊕ G j = A j ∧ B j on the (shifted) addend wires.

              ★★ The n-fold hybrid amplitude equality #

              The hybrid run is well-formed on every clean-ancilla basis input, and its shadow is the unitary adder's output off the outcome ancillas, which hold the outcomes.

              ★★ The n-fold hybrid amplitude equality for the Gidney adder. On every basis input with clean carry ancillas, the hybrid adder — forward and sum passes, then the gadget on each cell's fresh AND with outcomes mo — produces (√2)⁻¹^n • |out⟩, out the run's shadow.

              theorem CSD.Empirical.QM.gidneyHybridAdd_shadow_data {m n : ℕ} (L : Reversible.GidneyLayout m n) (mo : ℕ → Fin 2) (s : Reversible.State m) (hG0 : ∀ (j : ℕ), s (L.G j) = false) (i : Fin m) (hi : ∀ j < n, i ≠ L.G (j + 1)) :

              The data agree with the unitary adder on every wire other than the n carry ancillas G 1, …, G n.

              theorem CSD.Empirical.QM.gidneyHybridAdd_shadow_outcome {m n : ℕ} (L : Reversible.GidneyLayout m n) (mo : ℕ → Fin 2) (s : Reversible.State m) (hG0 : ∀ (j : ℕ), s (L.G j) = false) (j : ℕ) (hj : j < n) :

              The ancillas hold the outcomes.

              The sum is right on every branch: the sum register holds (A + B) mod 2ⁿ, exactly as for the unitary adder (gidneyAdd_correct).

              theorem CSD.Empirical.QM.gidneyHybridAdd_shadow_A {m n : ℕ} (L : Reversible.GidneyLayout m n) (mo : ℕ → Fin 2) (s : Reversible.State m) (hG0 : ∀ (j : ℕ), s (L.G j) = false) (k : ℕ) :

              The addends are restored on every branch (the un-shifting CNOTs run as unitaries).