AFTD Auto-Formalizing Theoretical Domains

flag_bound_magic_state

def

The three-qubit bound magic density matrix rho_B is defined by applying the flag Pauli channel F to the projector |phi_+><phi_+|, where |phi_+> = (|0,0,0> + |+,+,+>) / sqrt(2(1 + 1/sqrt(8))) and F(rho) = (1/8) rho + (1/24) sum_{P in P_flag} P rho P with P_flag the 21 three-qubit Paulis having an even number of Y factors and not belonging to {I,Z}^3 or {I,X}^3.

Statement

open Classical in
open scoped BigOperators in
noncomputable def flag_bound_magic_state : Matrix (Fin 3 → Fin 2) (Fin 3 → Fin 2) ℂ
Defined in
arXiv:2611.34872 Eq. (16)
Verified
28 Nov 2026
Axioms
none listed
Built on 4
  • PauliStringA Pauli string of length $n$ is a function $p : \mathrm{Fin}\,n \to \mathrm{PauliBasis}$.
  • pauliMatrixFor a Pauli string $p$ on $n$ qubits, the $2^n\times 2^n$ matrix obtained as the tensor product of the single-qubit Pauli matrices…
  • PauliBasisThe four Pauli basis elements $\{I,X,Y,Z\}$, represented as an inductive type.
  • instFintypePauliStringinstFintypePauliString
Used by 1

Read back from the Lean

The declaration flag_bound_magic_state defines an 8×8 complex matrix, indexed by functions Fin 3 → Fin 2, given by: ((1 : ℂ) / 8) • proj_phi_plus + ((1 : ℂ) / 24) • ∑ P ∈ flag_paulis, pauliMatrix P * proj_phi_plus * pauliMatrix P where: 1. flag_paulis is the Finset of all length-3 Pauli strings p : Fin 3 → PauliBasis satisfying: - The number of indices i : Fin 3 such that p i = PauliBasis.Y is even (Even). - It is not the case that every i : Fin 3 satisfies p i = PauliBasis.I ∨ p i = PauliBasis.Z (i.e., p is not purely composed of $I$ and $Z$). - It is not the case that every i : Fin 3 satisfies p i = PauliBasis.I ∨ p i = PauliBasis.X (i.e., p is not purely composed of $I$ and $X$). 2. t : ℝ is defined as 1 / Real.sqrt 8. 3. u : (Fin 3 → Fin 2) → ℂ is the indicator vector of the all-zero configuration: u x = 1 if x = (fun _ => 0) and 0 otherwise. 4. v : (Fin 3 → Fin 2) → ℂ is the constant vector with value (t : ℂ) at every x. 5. phi_plus : (Fin 3 → Fin 2) → ℂ is the vector defined by phi_plus x = (u x + v x) / (Real.sqrt (2 * (1 + t)) : ℂ). 6. proj_phi_plus : Matrix (Fin 3 → Fin 2) (Fin 3 → Fin 2) ℂ is the outer product Matrix.vecMulVec phi_plus (star phi_plus) (i.e., the rank-1 projection $|\phi^+\rangle\langle\phi^+|$). 7. * denotes matrix multiplication, • denotes scalar multiplication by a complex number, and + denotes matrix addition.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

open Classical in
open scoped BigOperators in
/-- The flag-based three-qubit bound magic state rho_B = F(|phi_+><phi_+|). -/
noncomputable def flag_bound_magic_state : Matrix (Fin 3 → Fin 2) (Fin 3 → Fin 2) ℂ :=
  ((1 : ℂ) / 8) • proj_phi_plus +
    ((1 : ℂ) / 24) • ∑ P ∈ flag_paulis, pauliMatrix P * proj_phi_plus * pauliMatrix P
where
  flag_paulis : Finset (PauliString 3) :=
    Finset.filter (fun p =>
      Even (Finset.card (Finset.filter (fun i => p i = PauliBasis.Y) Finset.univ)) ∧
      ¬ (∀ i, p i = PauliBasis.I ∨ p i = PauliBasis.Z) ∧
      ¬ (∀ i, p i = PauliBasis.I ∨ p i = PauliBasis.X)) Finset.univ
  u : (Fin 3 → Fin 2) → ℂ := fun x => if x = (fun _ => 0) then 1 else 0
  t : ℝ := 1 / Real.sqrt 8
  v : (Fin 3 → Fin 2) → ℂ := fun _ => (t : ℂ)
  phi_plus : (Fin 3 → Fin 2) → ℂ :=
    fun x => (u x + v x) / (Real.sqrt (2 * (1 + t)) : ℂ)
  proj_phi_plus : Matrix (Fin 3 → Fin 2) (Fin 3 → Fin 2) ℂ :=
    Matrix.vecMulVec phi_plus (star phi_plus)
See it in the graphDiscuss this resultChallenge it