AFTD Auto-Formalizing Theoretical Domains

HermitianMat.conj

defimported Lean

The Hermitian matrix given by conjugating by a (possibly rectangular) Matrix. If we required B to be square, this would apply to any Semigroup+StarMul (as proved by IsSelfAdjoint.conjugate). But this lets us conjugate to other sizes too, as is done in e.g. Kraus operators. That is, it's a _heterogeneous_ conjguation.

Statement

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open HermitianMat in
variable {α R 𝕜 : Type*} {m n : Type*} in
variable [Star R] [TrivialStar R] in
variable [RCLike 𝕜] in
variable [CommRing α] [StarRing α] [Fintype n] in
variable (A : HermitianMat n α) in
set_option backward.isDefEq.respectTransparency false in
def HermitianMat.conj {m} (B : Matrix m n α) : HermitianMat n α →+ HermitianMat m α
Defined in
QuantumInfo, `HermitianMat.conj`
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
16 Oct 2026
Axioms
none listed
Built on 58
Used by 20

Lean source view module on GitHub

set_option autoImplicit true in
set_option relaxedAutoImplicit true in
open HermitianMat in
variable {α R 𝕜 : Type*} {m n : Type*} in
variable [Star R] [TrivialStar R] in
variable [RCLike 𝕜] in
variable [CommRing α] [StarRing α] [Fintype n] in
variable (A : HermitianMat n α) in
set_option backward.isDefEq.respectTransparency false in
/-- The Hermitian matrix given by conjugating by a (possibly rectangular) Matrix. If we required `B` to be square, this would apply to any `Semigroup`+`StarMul` (as proved by `IsSelfAdjoint.conjugate`). But this lets us conjugate to other sizes too, as is done in e.g. Kraus operators. That is, it's a _heterogeneous_ conjguation. -/
def HermitianMat.conj {m} (B : Matrix m n α) : HermitianMat n α →+ HermitianMat m α where
  toFun A :=
    ⟨B * A.mat * B.conjTranspose, by
    ext
    simp only [Matrix.star_apply, Matrix.mul_apply, Matrix.conjTranspose_apply, Finset.sum_mul,
      star_sum, star_mul', star_star, show ∀ (a b : n), star (A.mat b a) = A.mat a b from congrFun₂ A.property]
    rw [Finset.sum_comm]
    congr! 2
    ring⟩
  map_add' _ _ := by ext1; simp [Matrix.mul_add, Matrix.add_mul]
  map_zero' := by simp
See it in the graphDiscuss this resultChallenge it