two_level_environment_trace
For d ≥ 2 and 0 ≤ p ≤ 1 and every real t, the trace of two_level_environment d p t is 1.
Statement
theorem two_level_environment_trace (d : ℕ) (hd : 2 ≤ d) (p t : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) :
(two_level_environment d p t).trace = 1- Source
- Sanity lemma for two_level_environment, serving OP-2466: it has trace one.
- Verified
- 27 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- two_level_environmentWith d : ℕ and real numbers p, t, returns the complex d×d matrix (1 − t)·I/d + t·|ψ⟩⟨ψ|, where ψ : Fin d → ℝ has ψ j = √p when the…
The proof, explained
The trace of the d × d matrix two_level_environment d p t is computed as the sum of its diagonal entries. Because d ≥ 2, we write d = n + 2 and peel off the first two diagonal entries from the remaining n entries. For the first two entries, the rank-one perturbation contributes t * (√p)^2 = t * p and t * (√(1 - p))^2 = t * (1 - p), while on all other entries it vanishes, leaving only the constant term (1 - t)/(n + 2). Summing all components gives (n + 2) * (1 - t)/(n + 2) + t * (p + 1 - p) = (1 - t) + t = 1.
The dimension d can be written as n + 2 for some natural number n.
Since d ≥ 2, Nat.exists_eq_add_of_le yields some n with d = 2 + n, which by basic linear arithmetic (omega) is n + 2. We substitute this form for d.
uses
Nat.exists_eq_add_of_leobtain ⟨n, rfl⟩ : ∃ n, d = n + 2 := by obtain ⟨n, rfl⟩ := Nat.exists_eq_add_of_le hd exact ⟨n, by omega⟩
The trace decomposes into the j = 0 and j = 1 diagonal terms plus the sum over the remaining n indices.
By definition, the trace is the sum of the diagonal entries over Fin (n + 2). Applying Fin.sum_univ_succ twice splits off the j = 0 term and then the j = 1 term, leaving the sum over the remaining n indices.
uses
Fin.sum_univ_succchange ∑ j : Fin (n + 2), two_level_environment (n + 2) p t j j = 1 rw [Fin.sum_univ_succ, Fin.sum_univ_succ] have h1 : (Fin.succ (0 : Fin (n + 1)) : Fin (n + 2)) = 1 := rfl rw [h1]
Unfolding the definition, the trace expression evaluates to ((1 - t)/(n + 2) + t * (√p)^2) + ((1 - t)/(n + 2) + t * (√(1 - p))^2) + n * ((1 - t)/(n + 2)).
Unfolding two_level_environment, the rank-one component has value √p at index 0, √(1 - p) at index 1, and 0 at all indices j ≥ 2. Simplifying the zero products with mul_zero and add_zero, the remaining sum is a constant (1 - t)/(n + 2) over an n-element set, which by Finset.sum_const, Finset.card_univ, Fintype.card_fin, and nsmul_eq_mul evaluates to n * ((1 - t)/(n + 2)).
uses
mul_zero,add_zero,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_muldsimp [two_level_environment] simp only [mul_zero, add_zero] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]
In the complex numbers, (√p)^2 = p and (√(1 - p))^2 = 1 - p.
Since p ≥ 0 and 1 - p ≥ 0 (the latter by linarith from p ≤ 1), Real.mul_self_sqrt gives √p * √p = p and √(1 - p) * √(1 - p) = 1 - p in the reals, which cast to the complex numbers via norm_cast.
uses
Real.mul_self_sqrthave hp : (√p : ℂ) * (√p : ℂ) = (p : ℂ) := by norm_cast exact Real.mul_self_sqrt hp0 have hp' : (√(1 - p) : ℂ) * (√(1 - p) : ℂ) = (1 - p : ℂ) := by norm_cast exact Real.mul_self_sqrt (by linarith)
The trace expression simplifies to (1 - t)/(n + 2) + t * p + (1 - t)/(n + 2) + t * (1 - p) + n * ((1 - t)/(n + 2)) = 1.
Reassociating the products using mul_assoc, we substitute the squared square roots with p and 1 - p, and push the complex casts through the expression.
uses
mul_assocrw [mul_assoc (t : ℂ), hp, mul_assoc (t : ℂ), hp'] push_cast
The trace is equal to 1.
Since n + 2 ≠ 0 in ℂ, field_simp clears denominators, reducing the equation to a polynomial identity in n, t, and p, which holds by standard ring arithmetic (ring).
have hn : ((n : ℂ) + 2) ≠ 0 := by norm_cast field_simp ring
Nat.exists_eq_add_of_le- If m ≤ n, then n = m + k for some natural number k.
Fin.sum_univ_succ- A sum over Fin (n + 1) splits into the term at 0 plus the sum of the remaining terms over Fin n.
mul_zero- Multiplying by zero on the right gives zero (a * 0 = 0).
add_zero- Adding zero on the right leaves an element unchanged (a + 0 = a).
Finset.sum_const- The sum of a constant b over a finite set s is equal to |s| • b.
Finset.card_univ- The cardinality of the universal finset univ of a finite type is the cardinality of that type.
Fintype.card_fin- The cardinality of Fin n is n.
nsmul_eq_mul- Natural-number scalar multiplication n • a equals the product n * a in a ring.
Real.mul_self_sqrt- For any non-negative real x ≥ 0, √x * √x = x.
mul_assoc- Multiplication is associative: (a * b) * c = a * (b * c).
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem two_level_environment_trace (d : ℕ) (hd : 2 ≤ d) (p t : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) : (two_level_environment d p t).trace = 1 := by obtain ⟨n, rfl⟩ : ∃ n, d = n + 2 := by obtain ⟨n, rfl⟩ := Nat.exists_eq_add_of_le hd exact ⟨n, by omega⟩ change ∑ j : Fin (n + 2), two_level_environment (n + 2) p t j j = 1 rw [Fin.sum_univ_succ, Fin.sum_univ_succ] have h1 : (Fin.succ (0 : Fin (n + 1)) : Fin (n + 2)) = 1 := rfl rw [h1] dsimp [two_level_environment] simp only [mul_zero, add_zero] simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have hp : (√p : ℂ) * (√p : ℂ) = (p : ℂ) := by norm_cast exact Real.mul_self_sqrt hp0 have hp' : (√(1 - p) : ℂ) * (√(1 - p) : ℂ) = (1 - p : ℂ) := by norm_cast exact Real.mul_self_sqrt (by linarith) rw [mul_assoc (t : ℂ), hp, mul_assoc (t : ℂ), hp'] push_cast have hn : ((n : ℂ) + 2) ≠ 0 := by norm_cast field_simp ring