AFTD Auto-Formalizing Theoretical Domains

energy_filter_reduced_entropy

def

For a sequence a : ℤ → ℝ and dimensions n, m : ℕ, letting l = n - m and M sA sB = a ((n : ℤ) / 2 - |sA| - |sB|) for bitstrings sA : Fin m → Bool and sB : Fin l → Bool, energy_filter_reduced_entropy a n m is 0 if the trace of M M^T is 0, and otherwise the entropy ∑ s, Real.negMulLog (λ_s / tr) of the normalized eigenvalues λ_s of M M^T.

Statement

noncomputable def energy_filter_reduced_entropy (a : ℤ → ℝ) (n m : ℕ) : ℝ
Defined in
arXiv:2405.02158
Verified
05 Nov 2026
Axioms
none listed

Read back from the Lean

A function energy_filter_reduced_entropy that takes a coefficient function a : ℤ → ℝ and two natural numbers n and m, and returns a real number computed as follows: 1. Let l = n - m (natural subtraction). 2. Let wA : (Fin m → Bool) → ℤ and wB : (Fin l → Bool) → ℤ map each boolean tuple to its Hamming weight (the count of true values, cast to ℤ). 3. Define the matrix M with rows indexed by Fin m → Bool and columns indexed by Fin l → Bool with entries: M sA sB = a ((n : ℤ) / 2 - wA sA - wB sB) where / is integer division on ℤ. 4. Let hR be the proof that M * Mᴴ (the product of M and its conjugate transpose) is Hermitian, and let its eigenvalues (indexed by Fin m → Bool) be hR.eigenvalues s. 5. Let tr be the sum of these eigenvalues (the trace of M * Mᴴ). 6. If tr = 0, the definition evaluates to 0. Otherwise, it evaluates to: ∑ s, Real.negMulLog (hR.eigenvalues s / tr) which is the Shannon / von Neumann entropy ∑ s, - p_s * log p_s of the normalized eigenvalues p_s = hR.eigenvalues s / tr.

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

/-- Von Neumann entropy of the reduced state of the energy-filtered state on m qubits, via the spectrum of M M^T. -/
noncomputable def energy_filter_reduced_entropy (a : ℤ → ℝ) (n m : ℕ) : ℝ :=
  let l := n - m
  let wA : (Fin m → Bool) → ℤ := fun s => ∑ j : Fin m, if s j then 1 else 0
  let wB : (Fin l → Bool) → ℤ := fun s => ∑ j : Fin l, if s j then 1 else 0
  let M : Matrix (Fin m → Bool) (Fin l → Bool) ℝ :=
    fun sA sB => a ((n : ℤ) / 2 - wA sA - wB sB)
  let hR := Matrix.isHermitian_mul_conjTranspose_self M
  let tr := ∑ s, hR.eigenvalues s
  if tr = 0 then 0 else ∑ s, Real.negMulLog (hR.eigenvalues s / tr)
See it in the graphDiscuss this resultChallenge it