cfahlgren1/math / lean /ComparatorChallenges /RegularParity.lean
cfahlgren1's picture
download
raw
2.71 kB
import Mathlib
namespace OAI
noncomputable section
open scoped BigOperators Matrix.Norms.L2Operator
namespace QAC
abbrev Bit := Fin 2
abbrev Word (N : ℕ) := Fin N → Bit
abbrev Operator (N : ℕ) := Matrix (Word N) (Word N) ℂ
abbrev QubitOperator := Matrix Bit Bit ℂ
/-- Tensor product in the computational basis. -/
def tensorMatrix {N : ℕ} (a : Fin N → QubitOperator) : Operator N :=
fun x y => ∏ i, a i (x i) (y i)
/-- A one-qubit unitary or an unbounded-arity Toffoli gate. -/
inductive Gate (N : ℕ) where
| local (q : Fin N) (u : Matrix.unitaryGroup Bit ℂ)
| toffoli (controls : Finset (Fin N)) (target : Fin N) (hne : target ∉ controls)
namespace Gate
def support {N : ℕ} : Gate N → Finset (Fin N)
| .local q _ => {q}
| .toffoli c t _ => insert t c
/-- A Toffoli flips its target iff all controls are one. -/
def toffoliWord {N : ℕ} (c : Finset (Fin N)) (t : Fin N) (x : Word N) : Word N :=
if ∀ i ∈ c, x i = 1 then Function.update x t (1 - x t) else x
def matrix {N : ℕ} : Gate N → Operator N
| .local q u => tensorMatrix fun i => if i = q then (u : QubitOperator) else 1
| .toffoli c t _ => fun x y => if x = toffoliWord c t y then 1 else 0
end Gate
structure PhysicalLayer (N : ℕ) where
gates : List (Gate N)
disjoint : gates.Pairwise (fun A B => Disjoint A.support B.support)
def physicalLayerMatrix {N : ℕ} (L : PhysicalLayer N) : Operator N :=
(L.gates.map Gate.matrix).prod
/-- Chronological order: the rightmost matrix acts first. -/
def physicalCircuitMatrix {N : ℕ} (layers : List (PhysicalLayer N)) : Operator N :=
((layers.map physicalLayerMatrix).reverse).prod
/-- The computational-basis input with the remaining qubits initialized to zero. -/
def inputWord {n N : ℕ} (x : Word n) : Word N :=
fun i => if h : i.val < n then x ⟨i.val, h⟩ else 0
def parity {n : ℕ} (x : Word n) : Bit := ∑ i, x i
/-- Born probability, summing all final garbage with no cleanliness assumption. -/
def successProbability {n N : ℕ} (W : Operator N) (out : Fin N) (x : Word n) : ℝ :=
∑ y : Word N, if y out = parity x then Complex.normSq (W y (inputWord x)) else 0
/-- Fixed-depth circuits with polynomially many total qubits cannot compute parity
with worst-case success at least two thirds. -/
theorem parity_lower_bound_polynomial_size (d k C : ℕ)
(_hd : 0 < d) (_hk : 0 < k) (_hC : 0 < C) :
∃ n₀ : ℕ, ∀ n ≥ n₀, ∀ N : ℕ, n ≤ N → N ≤ C * (n + 1) ^ k →
∀ layers : List (PhysicalLayer N), layers.length ≤ d →
∀ out : Fin N, ∃ x : Word n,
successProbability (physicalCircuitMatrix layers) out x < (2 : ℝ) / 3 := by
sorry
end QAC
end
end OAI

Xet Storage Details

Size:
2.71 kB
·
Xet hash:
351c3726f3ee75784d5bd519ee9744953894a950d69b6498f1538f770bd6707f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.