Exact Lean source
Nonadditivity.ComplexRealTrace
Download original .lean · View on GitHub · Jump to source
Direct imports
Mathlib.Analysis.CStarAlgebra.MatrixdependencyMathlib.LinearAlgebra.Complex.ModuledependencyMathlib.LinearAlgebra.FiniteDimensional.LemmasdependencyMathlib.Analysis.InnerProductSpace.Tracedependency
Imported by project modules
2 direct reverse imports
Relationships above come from literal import commands. The declarations below link to types and references extracted from Lean’s environment. Source text is complete and unchanged.
Declarations in this module
2 project constants, including generated, internal and private declarations.
2 declarations
Full module
1/-2Copyright (c) 2026 the Nonadditivity project contributors.3All rights reserved. See COPYRIGHT.md for licensing and attribution.4-/56import Mathlib.Analysis.CStarAlgebra.Matrix7import Mathlib.LinearAlgebra.Complex.Module8import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas9import Mathlib.Analysis.InnerProductSpace.Trace1011namespace Nonadditivity.ComplexRealTrace1213noncomputable section14set_option backward.isDefEq.respectTransparency false15open scoped BigOperators Matrix Matrix.Norms.L2Operator1617set_option maxHeartbeats 8000001819variable {ι : Type*} [Fintype ι] [DecidableEq ι]2021/-- Restricting a complex matrix operator to real scalars doubles the real22part of its complex trace. -/23theorem trace_restrict (A : Matrix ι ι ℂ) :24((Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) A).restrictScalars ℝ).toLinearMap.trace ℝ25(EuclideanSpace ℂ ι) = 2 * A.trace.re := by26let b := (EuclideanSpace.basisFun ι ℂ).toBasis27let c := Complex.basisOneI.smulTower' b28rw [LinearMap.trace_eq_matrix_trace ℝ c]29simp only [Matrix.trace, Matrix.diag_apply, Fintype.sum_prod_type,30LinearMap.toMatrix_apply, c, Module.Basis.smulTower'_repr,31Module.Basis.smulTower'_apply]32simp only [Fin.sum_univ_two, Complex.coe_basisOneI, Matrix.cons_val_zero, Matrix.cons_val_one,33ContinuousLinearMap.coe_restrictScalars,34LinearMap.restrictScalars_apply, ContinuousLinearMap.coe_coe, map_smul, Finsupp.smul_apply, smul_eq_mul]35have hb (i : ι) : b.repr (Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ) A (b i)) i = A i i := by36simp [b, EuclideanSpace.basisFun_apply,37EuclideanSpace.basisFun_repr, Matrix.mulVec, dotProduct]38simp only [hb, Complex.coe_basisOneI_repr, Matrix.cons_val_zero, Matrix.cons_val_one, Complex.mul_re, Complex.mul_im,39Complex.I_re, Complex.I_im, zero_mul, one_mul, zero_add]40simp only [Finset.sum_add_distrib, Complex.re_sum]41ring4243/-- The same identity for the square, used by Gaussian quadratic variance bounds. -/44theorem trace_square_restrict (A : Matrix ι ι ℂ) :45((((Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) A).restrictScalars ℝ).toLinearMap *46(((Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) A).restrictScalars ℝ).toLinearMap).trace ℝ47(EuclideanSpace ℂ ι) = 2 * (A * A).trace.re := by48have heq :49(((Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) A).restrictScalars ℝ).toLinearMap *50(((Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) A).restrictScalars ℝ).toLinearMap =51(((Matrix.toEuclideanCLM (n := ι) (𝕜 := ℂ)) (A * A)).restrictScalars ℝ).toLinearMap := by52rw [map_mul]53rfl54rw [heq, trace_restrict]5556end57end Nonadditivity.ComplexRealTrace