AFTD Auto-Formalizing Theoretical Domains

Matrix.cfc_diagonal

theoremverifiedformalizationimported Lean

Matrix.cfc_diagonal

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
open ComplexOrder in
variable {d π•œ : Type*} [Fintype d] [DecidableEq d] [RCLike π•œ] in
set_option backward.isDefEq.respectTransparency false in
@[simp]
theorem Matrix.cfc_diagonal (g : d β†’ ℝ) (f : ℝ β†’ ℝ) :
    cfc f (Matrix.diagonal (fun x ↦ (g x : π•œ))) = diagonal (RCLike.ofReal ∘ f ∘ g)
Formalizes
QuantumInfo, `Matrix.cfc_diagonal`
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.
What was changed in Matrix.cfc_diagonal
--- QuantumInfo/ForMathlib/Matrix.lean:862 (Matrix.cfc_diagonal)
+++ as compiled here
@@ -1,4 +1,13 @@
+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
+open ComplexOrder in
+variable {d π•œ : Type*} [Fintype d] [DecidableEq d] [RCLike π•œ] in
 set_option backward.isDefEq.respectTransparency false in
 @[simp]
-theorem cfc_diagonal (g : d β†’ ℝ) (f : ℝ β†’ ℝ) :
+theorem Matrix.cfc_diagonal (g : d β†’ ℝ) (f : ℝ β†’ ℝ) :
     cfc f (Matrix.diagonal (fun x ↦ (g x : π•œ))) = diagonal (RCLike.ofReal ∘ f ∘ g) := by
@@ -9,3 +18,3 @@
   --TODO cfc_cont_tac
-  rw [cfc, dite_eq_left ⟨h_self_adjoint, continuousOn_iff_continuous_domRestrict.mpr <| by fun_prop⟩]
+  rw [cfc, dif_pos ⟨h_self_adjoint, continuousOn_iff_continuous_domRestrict.mpr <| by fun_prop⟩]
   rw [cfcHom_eq_of_continuous_of_map_id]
Verified
16 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 6

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
open ComplexOrder in
variable {d π•œ : Type*} [Fintype d] [DecidableEq d] [RCLike π•œ] in
set_option backward.isDefEq.respectTransparency false in
@[simp]
theorem Matrix.cfc_diagonal (g : d β†’ ℝ) (f : ℝ β†’ ℝ) :
    cfc f (Matrix.diagonal (fun x ↦ (g x : π•œ))) = diagonal (RCLike.ofReal ∘ f ∘ g) := by
  --Thanks Aristotle
  have h_self_adjoint : _root_.IsSelfAdjoint (diagonal (fun x => (g x : π•œ))) := by
      change Matrix.conjTranspose _ = _
      simp [Matrix.conjTranspose]
  --TODO cfc_cont_tac
  rw [cfc, dif_pos ⟨h_self_adjoint, continuousOn_iff_continuous_domRestrict.mpr <| by fun_prop⟩]
  rw [cfcHom_eq_of_continuous_of_map_id]
  rotate_left
  Β· refine' { .. }
    use fun f ↦ Matrix.diagonal fun x ↦ f ⟨g x, (by
      simpa [algebraMap_eq_diagonal, diagonal_apply] using
        congr_arg (Β· x x) Β·.exists_left_inv.choose_spec
      )⟩
    Β· simp
    Β· simp [diagonal, ← Matrix.ext_iff, mul_apply]
      intro x y i j
      split_ifs with h
      Β· subst h; simp
      Β· rfl
    Β· simp
    Β· simp [diagonal, funext_iff]
      intro x y i j
      split_ifs with h
      Β· simp
      Β· simp
    Β· simp [← ext_iff, diagonal]
      exact fun r i j ↦ rfl
    Β· simp [← ext_iff, diagonal]
      grind [RCLike.conj_ofReal]
  Β· dsimp [diagonal]
    continuity
  Β· simp [diagonal]
  Β· simp [diagonal]
See it in the graphDiscuss this resultChallenge it