Correctness of the Toffoli-ladder multi-controlled NOT with clean ancillas
ProvedOPI.mcx_speclean-formalizationquantum-algorithmstwo-fold-opi-construction
Let be a list of control wires, a list of ancilla wires and a target wire of an -bit register. Assume the wires of are pairwise distinct and . The reversible circuit is defined recursively:
- no control: X on ;
- one control: CNOT;
- two controls: Toffoli;
- controls and ancilla : , then , then again.
Statement. For every bit string whose ancillas are all ,
The target is flipped exactly when all controls are , and every other wire, in particular every ancilla, is returned to its initial value.
This is the elementary gate used by the equality tests of the lookup tables. Through them it enters every arithmetic and table gadget of the construction.
Preamble
import Definitions.Def_TwoFoldOPI_CL_Part01
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Circuit
import Definitions.Def_QAlgorithms_Defs_GradientMethods
import Definitions.Def_QAlgorithms_Defs_OPIOraclePrograms
import Definitions.Def_QAlgorithms_Defs_OPIUniformity
import Definitions.Def_QAlgorithms_Defs_Fourier
import Definitions.Def_TwoFoldOPI_elemBits
import Definitions.Def_TwoFoldOPI_schurSquare
import Definitions.Def_TwoFoldOPI_schurFailureSum
import Definitions.Def_CodingTheory
import Definitions.Def_OAIThreeMachineSched01
import Definitions.Def_CookLevin_Cost
import Definitions.Def_TwoFoldOPI_codeOf
import Definitions.Def_TwoFoldOPI_solves
import Definitions.Def_TwoFoldOPI_Input
import Definitions.Def_TwoFoldOPI_CLSerializableF
open OPI
open QAlgorithms
variable {N : ℕ}
Formal statement
theorem OPI.mcx_spec : ∀ (cs as : List (Fin N)) (t : Fin N), cs.length ≤ as.length + 2 →
(cs ++ as ++ [t]).Nodup → ∀ (z : Qubits N), (∀ a ∈ as, z a = false) →
revAct (mcx cs as t) z = Function.update z t (xor (z t) (cs.all fun c => z c)) := by sorrySource
Formalization of Theorem 7.4 (algorithmic part), repository https://github.com/sragavan99/lean-prove2me-fills/blob/db81d0d4e3fa008609ed37789a2eb2f6f08ee48d/WorkInProgress/QuantumOPIVariants/OPI/MCX.lean#L33-L101