AFTD Auto-Formalizing Theoretical Domains

Matrix.PosSemidef.traceLeft

theoremverifiedformalizationimported Lean

Matrix.PosSemidef.traceLeft

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Matrix in
open BigOperators in
variable {n ๐•œ : Type*} in
variable [RCLike ๐•œ] [DecidableEq n] in
open scoped ComplexOrder MatrixOrder in
variable [AddCommMonoid R] [Fintype d] in
open ComplexOrder in
variable {dโ‚ dโ‚‚ : Type*} {A : Matrix (dโ‚ ร— dโ‚‚) (dโ‚ ร— dโ‚‚) ๐•œ} in
variable [Fintype dโ‚‚] [Fintype dโ‚] in
theorem Matrix.PosSemidef.traceLeft [DecidableEq dโ‚] (hA : A.PosSemidef) : A.traceLeft.PosSemidef
Formalizes
QuantumInfo, `Matrix.PosSemidef.traceLeft`
Lean proof
By Alex Meiburg, from github.com/leanprover-community/physlib at e411c6e89692 (Copyright (c) 2025 Alex Meiburg. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.34.1.
Verified
17 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open Matrix in
open BigOperators in
variable {n ๐•œ : Type*} in
variable [RCLike ๐•œ] [DecidableEq n] in
open scoped ComplexOrder MatrixOrder in
variable [AddCommMonoid R] [Fintype d] in
open ComplexOrder in
variable {dโ‚ dโ‚‚ : Type*} {A : Matrix (dโ‚ ร— dโ‚‚) (dโ‚ ร— dโ‚‚) ๐•œ} in
variable [Fintype dโ‚‚] [Fintype dโ‚] in
theorem Matrix.PosSemidef.traceLeft [DecidableEq dโ‚] (hA : A.PosSemidef) : A.traceLeft.PosSemidef := by
  rw [Matrix.posSemidef_iff_dotProduct_mulVec] at hA โŠข
  constructor
  ยท exact hA.1.traceLeft
  ยท intro x
    convert Finset.sum_nonneg (s := .univ)
      (fun (i : dโ‚) _ โ†ฆ hA.2 (fun (j,k) โ†ฆ if i = j then x k else 0))
    simp_rw [Matrix.traceLeft, dotProduct_mulVec]
    simpa [dotProduct, vecMul_eq_sum, ite_apply, Fintype.sum_prod_type, Finset.mul_sum, Finset.sum_mul,
      apply_ite] using Finset.sum_comm_cycle
See it in the graphDiscuss this resultChallenge it