analysis.normed_space.star.matrixMathlib.Analysis.NormedSpace.Star.Matrix

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -5,7 +5,7 @@ Authors: Hans Parshall
 -/
 import Analysis.Matrix
 import Analysis.NormedSpace.Basic
-import Data.IsROrC.Basic
+import Analysis.RCLike.Basic
 import LinearAlgebra.UnitaryGroup
 
 #align_import analysis.normed_space.star.matrix from "leanprover-community/mathlib"@"5d0c76894ada7940957143163d7b921345474cbc"
@@ -26,7 +26,7 @@ variable {𝕜 m n E : Type _}
 
 section EntrywiseSupNorm
 
-variable [IsROrC 𝕜] [Fintype n] [DecidableEq n]
+variable [RCLike 𝕜] [Fintype n] [DecidableEq n]
 
 #print entry_norm_bound_of_unitary /-
 theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.unitaryGroup n 𝕜)
@@ -46,18 +46,18 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
       simp only [eq_self_iff_true, Finset.mem_univ_val, and_self_iff, sq_eq_sq]
   -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ
   have diag_eq_norm_sum : (U ⬝ Uᴴ) i i = ∑ x : n, ‖U i x‖ ^ 2 := by
-    simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, IsROrC.mul_conj,
-      IsROrC.normSq_eq_def', IsROrC.ofReal_pow]
+    simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, RCLike.mul_conj,
+      RCLike.normSq_eq_def', RCLike.ofReal_pow]
   -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ, real part
-  have re_diag_eq_norm_sum : IsROrC.re ((U ⬝ Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 :=
+  have re_diag_eq_norm_sum : RCLike.re ((U ⬝ Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 :=
     by
-    rw [IsROrC.ext_iff] at diag_eq_norm_sum
+    rw [RCLike.ext_iff] at diag_eq_norm_sum
     rw [diag_eq_norm_sum.1]
     norm_cast
   -- Since U is unitary, the diagonal entries of U ⬝ Uᴴ are all 1
   have mul_eq_one : U ⬝ Uᴴ = 1 := unitary.mul_star_self_of_mem hU
-  have diag_eq_one : IsROrC.re ((U ⬝ Uᴴ) i i) = 1 := by
-    simp only [mul_eq_one, eq_self_iff_true, Matrix.one_apply_eq, IsROrC.one_re]
+  have diag_eq_one : RCLike.re ((U ⬝ Uᴴ) i i) = 1 := by
+    simp only [mul_eq_one, eq_self_iff_true, Matrix.one_apply_eq, RCLike.one_re]
   -- Putting it all together
   rw [← sq_le_one_iff (norm_nonneg (U i j)), ← diag_eq_one, re_diag_eq_norm_sum]
   exact norm_sum
Diff
@@ -37,7 +37,7 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
     by
     apply Multiset.single_le_sum
     · intro x h_x
-      rw [Multiset.mem_map] at h_x 
+      rw [Multiset.mem_map] at h_x
       cases' h_x with a h_a
       rw [← h_a.2]
       apply sq_nonneg
@@ -51,7 +51,7 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
   -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ, real part
   have re_diag_eq_norm_sum : IsROrC.re ((U ⬝ Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 :=
     by
-    rw [IsROrC.ext_iff] at diag_eq_norm_sum 
+    rw [IsROrC.ext_iff] at diag_eq_norm_sum
     rw [diag_eq_norm_sum.1]
     norm_cast
   -- Since U is unitary, the diagonal entries of U ⬝ Uᴴ are all 1
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2022 Hans Parshall. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Hans Parshall
 -/
-import Mathbin.Analysis.Matrix
-import Mathbin.Analysis.NormedSpace.Basic
-import Mathbin.Data.IsROrC.Basic
-import Mathbin.LinearAlgebra.UnitaryGroup
+import Analysis.Matrix
+import Analysis.NormedSpace.Basic
+import Data.IsROrC.Basic
+import LinearAlgebra.UnitaryGroup
 
 #align_import analysis.normed_space.star.matrix from "leanprover-community/mathlib"@"5d0c76894ada7940957143163d7b921345474cbc"
 
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2022 Hans Parshall. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Hans Parshall
-
-! This file was ported from Lean 3 source module analysis.normed_space.star.matrix
-! leanprover-community/mathlib commit 5d0c76894ada7940957143163d7b921345474cbc
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Matrix
 import Mathbin.Analysis.NormedSpace.Basic
 import Mathbin.Data.IsROrC.Basic
 import Mathbin.LinearAlgebra.UnitaryGroup
 
+#align_import analysis.normed_space.star.matrix from "leanprover-community/mathlib"@"5d0c76894ada7940957143163d7b921345474cbc"
+
 /-!
 # Unitary matrices
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Hans Parshall
 
 ! This file was ported from Lean 3 source module analysis.normed_space.star.matrix
-! leanprover-community/mathlib commit 468b141b14016d54b479eb7a0fff1e360b7e3cf6
+! leanprover-community/mathlib commit 5d0c76894ada7940957143163d7b921345474cbc
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -16,6 +16,9 @@ import Mathbin.LinearAlgebra.UnitaryGroup
 /-!
 # Unitary matrices
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file collects facts about the unitary matrices over `𝕜` (either `ℝ` or `ℂ`).
 -/
 
Diff
@@ -28,6 +28,7 @@ section EntrywiseSupNorm
 
 variable [IsROrC 𝕜] [Fintype n] [DecidableEq n]
 
+#print entry_norm_bound_of_unitary /-
 theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.unitaryGroup n 𝕜)
     (i j : n) : ‖U i j‖ ≤ 1 :=
   by
@@ -61,9 +62,11 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
   rw [← sq_le_one_iff (norm_nonneg (U i j)), ← diag_eq_one, re_diag_eq_norm_sum]
   exact norm_sum
 #align entry_norm_bound_of_unitary entry_norm_bound_of_unitary
+-/
 
 attribute [local instance] Matrix.normedAddCommGroup
 
+#print entrywise_sup_norm_bound_of_unitary /-
 /-- The entrywise sup norm of a unitary matrix is at most 1. -/
 theorem entrywise_sup_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.unitaryGroup n 𝕜) :
     ‖U‖ ≤ 1 := by
@@ -71,6 +74,7 @@ theorem entrywise_sup_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Ma
   intro i j
   exact entry_norm_bound_of_unitary hU _ _
 #align entrywise_sup_norm_bound_of_unitary entrywise_sup_norm_bound_of_unitary
+-/
 
 end EntrywiseSupNorm
 
Diff
@@ -36,7 +36,7 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
     by
     apply Multiset.single_le_sum
     · intro x h_x
-      rw [Multiset.mem_map] at h_x
+      rw [Multiset.mem_map] at h_x 
       cases' h_x with a h_a
       rw [← h_a.2]
       apply sq_nonneg
@@ -50,7 +50,7 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
   -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ, real part
   have re_diag_eq_norm_sum : IsROrC.re ((U ⬝ Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 :=
     by
-    rw [IsROrC.ext_iff] at diag_eq_norm_sum
+    rw [IsROrC.ext_iff] at diag_eq_norm_sum 
     rw [diag_eq_norm_sum.1]
     norm_cast
   -- Since U is unitary, the diagonal entries of U ⬝ Uᴴ are all 1
Diff
@@ -20,7 +20,7 @@ This file collects facts about the unitary matrices over `𝕜` (either `ℝ` or
 -/
 
 
-open BigOperators Matrix
+open scoped BigOperators Matrix
 
 variable {𝕜 m n E : Type _}
 
Diff
@@ -46,7 +46,7 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
   -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ
   have diag_eq_norm_sum : (U ⬝ Uᴴ) i i = ∑ x : n, ‖U i x‖ ^ 2 := by
     simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, IsROrC.mul_conj,
-      IsROrC.normSq_eq_def', IsROrC.of_real_pow]
+      IsROrC.normSq_eq_def', IsROrC.ofReal_pow]
   -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ, real part
   have re_diag_eq_norm_sum : IsROrC.re ((U ⬝ Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 :=
     by

Changes in mathlib4

mathlib3
mathlib4
chore: adaptations to lean 4.8.0 (#12549)
Diff
@@ -157,7 +157,7 @@ def instL2OpMetricSpace : MetricSpace (Matrix m n 𝕜) := by
       dist_eq := l2OpNormedAddCommGroupAux.dist_eq }
   exact normed_add_comm_group.replaceUniformity <| by
     congr
-    rw [← @UniformAddGroup.toUniformSpace_eq _ (instUniformSpaceMatrix m n 𝕜) _ _]
+    rw [← @UniformAddGroup.toUniformSpace_eq _ (Matrix.instUniformSpace m n 𝕜) _ _]
     rw [@UniformAddGroup.toUniformSpace_eq _ PseudoEMetricSpace.toUniformSpace _ _]
 
 scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpMetricSpace
chore: reformat deprecation warnings on one line, if possible (#12335)

Occasionally, remove a "deprecated by" or "deprecated since", to fit the line length.

This is desirable (to me) because

  • it's more compact: I don't see a good reason for these declarations taking up more space than needed; as I understand it, deprecated lemmas are not supposed to be used in mathlib anyway
  • putting the date on the same line as the attribute makes it easier to discover un-dated deprecations; they also ease writing a tool to replace these by a machine-readable version using leanprover/lean4#3968
Diff
@@ -175,32 +175,24 @@ scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedAddCommGroup
 lemma l2_opNorm_def (A : Matrix m n 𝕜) :
     ‖A‖ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖ := rfl
 
-@[deprecated]
-alias l2_op_norm_def :=
-  l2_opNorm_def -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_norm_def := l2_opNorm_def -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_def (A : Matrix m n 𝕜) :
     ‖A‖₊ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖₊ := rfl
 
-@[deprecated]
-alias l2_op_nnnorm_def :=
-  l2_opNNNorm_def -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_nnnorm_def := l2_opNNNorm_def -- deprecated on 2024-02-02
 
 lemma l2_opNorm_conjTranspose [DecidableEq m] (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
   rw [l2_opNorm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
     toLin_conjTranspose, adjoint_toContinuousLinearMap]
   exact ContinuousLinearMap.adjoint.norm_map _
 
-@[deprecated]
-alias l2_op_norm_conjTranspose :=
-  l2_opNorm_conjTranspose -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_norm_conjTranspose := l2_opNorm_conjTranspose -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_conjTranspose [DecidableEq m] (A : Matrix m n 𝕜) : ‖Aᴴ‖₊ = ‖A‖₊ :=
   Subtype.ext <| l2_opNorm_conjTranspose _
 
-@[deprecated]
-alias l2_op_nnnorm_conjTranspose :=
-  l2_opNNNorm_conjTranspose -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_nnnorm_conjTranspose := l2_opNNNorm_conjTranspose -- 2024-02-02
 
 lemma l2_opNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ = ‖A‖ * ‖A‖ := by
   classical
@@ -208,33 +200,27 @@ lemma l2_opNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ =
     Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun m 𝕜).toBasis), toLin_conjTranspose]
   exact ContinuousLinearMap.norm_adjoint_comp_self _
 
-@[deprecated]
-alias l2_op_norm_conjTranspose_mul_self :=
-  l2_opNorm_conjTranspose_mul_self -- deprecated on 2024-02-02
+@[deprecated] -- deprecated on 2024-02-02
+alias l2_op_norm_conjTranspose_mul_self := l2_opNorm_conjTranspose_mul_self
 
 lemma l2_opNNNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖₊ = ‖A‖₊ * ‖A‖₊ :=
   Subtype.ext <| l2_opNorm_conjTranspose_mul_self _
 
-@[deprecated]
-alias l2_op_nnnorm_conjTranspose_mul_self :=
-  l2_opNNNorm_conjTranspose_mul_self -- deprecated on 2024-02-02
+@[deprecated] -- deprecated on 2024-02-02
+alias l2_op_nnnorm_conjTranspose_mul_self := l2_opNNNorm_conjTranspose_mul_self
 
 -- note: with only a type ascription in the left-hand side, Lean picks the wrong norm.
 lemma l2_opNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
     ‖(EuclideanSpace.equiv m 𝕜).symm <| A *ᵥ x‖ ≤ ‖A‖ * ‖x‖ :=
   toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) |>.trans toContinuousLinearMap A |>.le_opNorm x
 
-@[deprecated]
-alias l2_op_norm_mulVec :=
-  l2_opNorm_mulVec -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_norm_mulVec := l2_opNorm_mulVec -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
     ‖(EuclideanSpace.equiv m 𝕜).symm <| A *ᵥ x‖₊ ≤ ‖A‖₊ * ‖x‖₊ :=
   A.l2_opNorm_mulVec x
 
-@[deprecated]
-alias l2_op_nnnorm_mulVec :=
-  l2_opNNNorm_mulVec -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_nnnorm_mulVec := l2_opNNNorm_mulVec -- deprecated on 2024-02-02
 
 lemma l2_opNorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) :
     ‖A * B‖ ≤ ‖A‖ * ‖B‖ := by
@@ -245,16 +231,12 @@ lemma l2_opNorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) :
   ext1 x
   exact congr($(Matrix.toLin'_mul A B) x)
 
-@[deprecated]
-alias l2_op_norm_mul :=
-  l2_opNorm_mul -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_norm_mul := l2_opNorm_mul -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ :=
   l2_opNorm_mul A B
 
-@[deprecated]
-alias l2_op_nnnorm_mul :=
-  l2_opNNNorm_mul -- deprecated on 2024-02-02
+@[deprecated] alias l2_op_nnnorm_mul := l2_opNNNorm_mul -- deprecated on 2024-02-02
 
 /-- The normed algebra structure on `Matrix n n 𝕜` arising from the operator norm given by the
 identification with (continuous) linear endmorphisms of `EuclideanSpace 𝕜 n`. -/
move(RCLike): Move out of Data (#11753)

RCLike is an analytic typeclass, hence should be under Analysis

Diff
@@ -5,7 +5,7 @@ Authors: Hans Parshall
 -/
 import Mathlib.Analysis.InnerProductSpace.Adjoint
 import Mathlib.Analysis.Matrix
-import Mathlib.Data.RCLike.Basic
+import Mathlib.Analysis.RCLike.Basic
 import Mathlib.LinearAlgebra.UnitaryGroup
 import Mathlib.Topology.UniformSpace.Matrix
 
chore: Rename IsROrC to RCLike (#10819)

IsROrC contains data, which goes against the expectation that classes prefixed with Is are prop-valued. People have been complaining about this on and off, so this PR renames IsROrC to RCLike.

Diff
@@ -5,7 +5,7 @@ Authors: Hans Parshall
 -/
 import Mathlib.Analysis.InnerProductSpace.Adjoint
 import Mathlib.Analysis.Matrix
-import Mathlib.Data.IsROrC.Basic
+import Mathlib.Data.RCLike.Basic
 import Mathlib.LinearAlgebra.UnitaryGroup
 import Mathlib.Topology.UniformSpace.Matrix
 
@@ -44,7 +44,7 @@ variable {𝕜 m n l E : Type*}
 
 section EntrywiseSupNorm
 
-variable [IsROrC 𝕜] [Fintype n] [DecidableEq n]
+variable [RCLike 𝕜] [Fintype n] [DecidableEq n]
 
 theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.unitaryGroup n 𝕜)
     (i j : n) : ‖U i j‖ ≤ 1 := by
@@ -61,17 +61,17 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
       simp only [eq_self_iff_true, Finset.mem_univ_val, and_self_iff, sq_eq_sq]
   -- The L2 norm of a row is a diagonal entry of U * Uᴴ
   have diag_eq_norm_sum : (U * Uᴴ) i i = (∑ x : n, ‖U i x‖ ^ 2 : ℝ) := by
-    simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, IsROrC.mul_conj,
-      IsROrC.normSq_eq_def', IsROrC.ofReal_pow]; norm_cast
+    simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, RCLike.mul_conj,
+      RCLike.normSq_eq_def', RCLike.ofReal_pow]; norm_cast
   -- The L2 norm of a row is a diagonal entry of U * Uᴴ, real part
-  have re_diag_eq_norm_sum : IsROrC.re ((U * Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 := by
-    rw [IsROrC.ext_iff] at diag_eq_norm_sum
+  have re_diag_eq_norm_sum : RCLike.re ((U * Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 := by
+    rw [RCLike.ext_iff] at diag_eq_norm_sum
     rw [diag_eq_norm_sum.1]
     norm_cast
   -- Since U is unitary, the diagonal entries of U * Uᴴ are all 1
   have mul_eq_one : U * Uᴴ = 1 := unitary.mul_star_self_of_mem hU
-  have diag_eq_one : IsROrC.re ((U * Uᴴ) i i) = 1 := by
-    simp only [mul_eq_one, eq_self_iff_true, Matrix.one_apply_eq, IsROrC.one_re]
+  have diag_eq_one : RCLike.re ((U * Uᴴ) i i) = 1 := by
+    simp only [mul_eq_one, eq_self_iff_true, Matrix.one_apply_eq, RCLike.one_re]
   -- Putting it all together
   rw [← sq_le_one_iff (norm_nonneg (U i j)), ← diag_eq_one, re_diag_eq_norm_sum]
   exact norm_sum
@@ -97,7 +97,7 @@ noncomputable section L2OpNorm
 namespace Matrix
 open LinearMap
 
-variable [IsROrC 𝕜]
+variable [RCLike 𝕜]
 variable [Fintype m] [Fintype n] [DecidableEq n] [Fintype l] [DecidableEq l]
 
 /-- The natural star algebra equivalence between matrices and continuous linear endomoporphisms
chore(Star/Matrix): drop DecidableEq assumptions (#11557)
Diff
@@ -98,7 +98,7 @@ namespace Matrix
 open LinearMap
 
 variable [IsROrC 𝕜]
-variable [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [Fintype l] [DecidableEq l]
+variable [Fintype m] [Fintype n] [DecidableEq n] [Fintype l] [DecidableEq l]
 
 /-- The natural star algebra equivalence between matrices and continuous linear endomoporphisms
 of Euclidean space induced by the orthonormal basis `EuclideanSpace.basisFun`.
@@ -186,7 +186,7 @@ lemma l2_opNNNorm_def (A : Matrix m n 𝕜) :
 alias l2_op_nnnorm_def :=
   l2_opNNNorm_def -- deprecated on 2024-02-02
 
-lemma l2_opNorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
+lemma l2_opNorm_conjTranspose [DecidableEq m] (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
   rw [l2_opNorm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
     toLin_conjTranspose, adjoint_toContinuousLinearMap]
   exact ContinuousLinearMap.adjoint.norm_map _
@@ -195,7 +195,7 @@ lemma l2_opNorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
 alias l2_op_norm_conjTranspose :=
   l2_opNorm_conjTranspose -- deprecated on 2024-02-02
 
-lemma l2_opNNNorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖₊ = ‖A‖₊ :=
+lemma l2_opNNNorm_conjTranspose [DecidableEq m] (A : Matrix m n 𝕜) : ‖Aᴴ‖₊ = ‖A‖₊ :=
   Subtype.ext <| l2_opNorm_conjTranspose _
 
 @[deprecated]
@@ -203,6 +203,7 @@ alias l2_op_nnnorm_conjTranspose :=
   l2_opNNNorm_conjTranspose -- deprecated on 2024-02-02
 
 lemma l2_opNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ = ‖A‖ * ‖A‖ := by
+  classical
   rw [l2_opNorm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
     Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun m 𝕜).toBasis), toLin_conjTranspose]
   exact ContinuousLinearMap.norm_adjoint_comp_self _
doc: fix typo (#10380)

Fixed a minor typo.

Diff
@@ -25,7 +25,7 @@ This transports the operator norm on `EuclideanSpace 𝕜 n →L[𝕜] Euclidean
 
 ## Main statements
 
-* `entry_norm_bound_of_unitary`: the entries of a unitary matrix are uniformly boundd by `1`.
+* `entry_norm_bound_of_unitary`: the entries of a unitary matrix are uniformly bound by `1`.
 
 ## Implementation details
 
Deprecate allowing auto-replacement (#10302)

Following these Zulip discussions, I realised that my deprecation script produced a deprecation syntax that did not allow for auto-replacement in Sébastien's #10185.

This PR fixes the deprecation statements, allowing self-correction: 119 times I replaced

@[deprecated xxx] --> @[deprecated].

Diff
@@ -175,14 +175,14 @@ scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedAddCommGroup
 lemma l2_opNorm_def (A : Matrix m n 𝕜) :
     ‖A‖ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖ := rfl
 
-@[deprecated l2_opNorm_def]
+@[deprecated]
 alias l2_op_norm_def :=
   l2_opNorm_def -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_def (A : Matrix m n 𝕜) :
     ‖A‖₊ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖₊ := rfl
 
-@[deprecated l2_opNNNorm_def]
+@[deprecated]
 alias l2_op_nnnorm_def :=
   l2_opNNNorm_def -- deprecated on 2024-02-02
 
@@ -191,14 +191,14 @@ lemma l2_opNorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
     toLin_conjTranspose, adjoint_toContinuousLinearMap]
   exact ContinuousLinearMap.adjoint.norm_map _
 
-@[deprecated l2_opNorm_conjTranspose]
+@[deprecated]
 alias l2_op_norm_conjTranspose :=
   l2_opNorm_conjTranspose -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖₊ = ‖A‖₊ :=
   Subtype.ext <| l2_opNorm_conjTranspose _
 
-@[deprecated l2_opNNNorm_conjTranspose]
+@[deprecated]
 alias l2_op_nnnorm_conjTranspose :=
   l2_opNNNorm_conjTranspose -- deprecated on 2024-02-02
 
@@ -207,14 +207,14 @@ lemma l2_opNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ =
     Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun m 𝕜).toBasis), toLin_conjTranspose]
   exact ContinuousLinearMap.norm_adjoint_comp_self _
 
-@[deprecated l2_opNorm_conjTranspose_mul_self]
+@[deprecated]
 alias l2_op_norm_conjTranspose_mul_self :=
   l2_opNorm_conjTranspose_mul_self -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖₊ = ‖A‖₊ * ‖A‖₊ :=
   Subtype.ext <| l2_opNorm_conjTranspose_mul_self _
 
-@[deprecated l2_opNNNorm_conjTranspose_mul_self]
+@[deprecated]
 alias l2_op_nnnorm_conjTranspose_mul_self :=
   l2_opNNNorm_conjTranspose_mul_self -- deprecated on 2024-02-02
 
@@ -223,7 +223,7 @@ lemma l2_opNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
     ‖(EuclideanSpace.equiv m 𝕜).symm <| A *ᵥ x‖ ≤ ‖A‖ * ‖x‖ :=
   toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) |>.trans toContinuousLinearMap A |>.le_opNorm x
 
-@[deprecated l2_opNorm_mulVec]
+@[deprecated]
 alias l2_op_norm_mulVec :=
   l2_opNorm_mulVec -- deprecated on 2024-02-02
 
@@ -231,7 +231,7 @@ lemma l2_opNNNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
     ‖(EuclideanSpace.equiv m 𝕜).symm <| A *ᵥ x‖₊ ≤ ‖A‖₊ * ‖x‖₊ :=
   A.l2_opNorm_mulVec x
 
-@[deprecated l2_opNNNorm_mulVec]
+@[deprecated]
 alias l2_op_nnnorm_mulVec :=
   l2_opNNNorm_mulVec -- deprecated on 2024-02-02
 
@@ -244,14 +244,14 @@ lemma l2_opNorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) :
   ext1 x
   exact congr($(Matrix.toLin'_mul A B) x)
 
-@[deprecated l2_opNorm_mul]
+@[deprecated]
 alias l2_op_norm_mul :=
   l2_opNorm_mul -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ :=
   l2_opNorm_mul A B
 
-@[deprecated l2_opNNNorm_mul]
+@[deprecated]
 alias l2_op_nnnorm_mul :=
   l2_opNNNorm_mul -- deprecated on 2024-02-02
 
chore: Matrix.mulVec and Matrix.vecMul get infix notation (#10297)

Zulip discussion: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Notation.20for.20mul_vec.20and.20vec_mul

Co-authored-by: Martin Dvorak <mdvorak@ista.ac.at>

Diff
@@ -220,7 +220,7 @@ alias l2_op_nnnorm_conjTranspose_mul_self :=
 
 -- note: with only a type ascription in the left-hand side, Lean picks the wrong norm.
 lemma l2_opNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
-    ‖(EuclideanSpace.equiv m 𝕜).symm <| A.mulVec x‖ ≤ ‖A‖ * ‖x‖ :=
+    ‖(EuclideanSpace.equiv m 𝕜).symm <| A *ᵥ x‖ ≤ ‖A‖ * ‖x‖ :=
   toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) |>.trans toContinuousLinearMap A |>.le_opNorm x
 
 @[deprecated l2_opNorm_mulVec]
@@ -228,7 +228,7 @@ alias l2_op_norm_mulVec :=
   l2_opNorm_mulVec -- deprecated on 2024-02-02
 
 lemma l2_opNNNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
-    ‖(EuclideanSpace.equiv m 𝕜).symm <| A.mulVec x‖₊ ≤ ‖A‖₊ * ‖x‖₊ :=
+    ‖(EuclideanSpace.equiv m 𝕜).symm <| A *ᵥ x‖₊ ≤ ‖A‖₊ * ‖x‖₊ :=
   A.l2_opNorm_mulVec x
 
 @[deprecated l2_opNNNorm_mulVec]
chore(NormedSpace/Basic): move some theorems to NormedSpace.Real (#10206)

This way we don't switch between general normed spaces and real normed spaces back and forth throughout the file.

Diff
@@ -5,7 +5,6 @@ Authors: Hans Parshall
 -/
 import Mathlib.Analysis.InnerProductSpace.Adjoint
 import Mathlib.Analysis.Matrix
-import Mathlib.Analysis.NormedSpace.Basic
 import Mathlib.Data.IsROrC.Basic
 import Mathlib.LinearAlgebra.UnitaryGroup
 import Mathlib.Topology.UniformSpace.Matrix
refactor(Data/FunLike): use unbundled inheritance from FunLike (#8386)

The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike is EquivLike, since that has a custom coe_injective' field that is easier to implement. All other classes should take FunLike or EquivLike as a parameter.

Zulip thread

Important changes

Previously, morphism classes would be Type-valued and extend FunLike:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

After this PR, they should be Prop-valued and take FunLike as a parameter:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  [FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

(Note that A B stay marked as outParam even though they are not purely required to be so due to the FunLike parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam is slightly faster.)

Similarly, MyEquivClass should take EquivLike as a parameter.

As a result, every mention of [MyHomClass F A B] should become [FunLike F A B] [MyHomClass F A B].

Remaining issues

Slower (failing) search

While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul is more expensive. This is due to suboptimal processing of arguments. For example:

variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)

theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y

example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _

Before this PR, applying map_mul f gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Since M and N are out_params, [MulHomClass F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found.

After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Now [FunLike F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found, before trying MulHomClass F M N which fails. Since the Mul hierarchy is very big, this can be slow to fail, especially when there is no such Mul instance.

A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N] because MulHomClass fails or succeeds much faster than the others.

As a consequence, the simpNF linter is much slower since by design it tries and fails to apply many map_ lemmas. The same issue occurs a few times in existing calls to simp [map_mul], where map_mul is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.

simp not firing sometimes

This affects map_smulₛₗ and related definitions. For simp lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw can find every argument to map_smulₛₗ successfully but simp can't: leanprover/lean4#3701.

Missing instances due to unification failing

Especially in the category theory library, we might sometimes have a type A which is also accessible as a synonym (Bundled A hA).1. Instance synthesis doesn't always work if we have f : A →* B but x * y : (Bundled A hA).1 or vice versa. This seems to be mostly fixed by keeping A B as outParams in MulHomClass F A B. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1 instead of using the syntax in the discrimination tree.)

Workaround for issues

The timeouts can be worked around for now by specifying which map_mul we mean, either as map_mul f for some explicit f, or as e.g. MonoidHomClass.map_mul.

map_smulₛₗ not firing as simp lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ a simp lemma instead of the generic map_smulₛₗ. Writing simp [map_smulₛₗ _] also works.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -132,14 +132,14 @@ lemma piLp_equiv_toEuclideanCLM (A : Matrix n n 𝕜) (x : EuclideanSpace 𝕜 n
 /-- An auxiliary definition used only to construct the true `NormedAddCommGroup` (and `Metric`)
 structure provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedAddCommGroupL2Op`.  -/
 def l2OpNormedAddCommGroupAux : NormedAddCommGroup (Matrix m n 𝕜) :=
-  @NormedAddCommGroup.induced ((Matrix m n 𝕜) ≃ₗ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 m))
+  @NormedAddCommGroup.induced ((Matrix m n 𝕜) ≃ₗ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 m)) _
     _ _ _ ContinuousLinearMap.toNormedAddCommGroup.toNormedAddGroup _ _ <|
     (toEuclideanLin.trans toContinuousLinearMap).injective
 
 /-- An auxiliary definition used only to construct the true `NormedRing` (and `Metric`) structure
 provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedRingL2Op`.  -/
 def l2OpNormedRingAux : NormedRing (Matrix n n 𝕜) :=
-  @NormedRing.induced ((Matrix n n 𝕜) ≃⋆ₐ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 n))
+  @NormedRing.induced ((Matrix n n 𝕜) ≃⋆ₐ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 n)) _
     _ _ _ ContinuousLinearMap.toNormedRing _ _ toEuclideanCLM.injective
 
 open Bornology Filter
chore: rename op_norm to opNorm (#10185)

Co-authored-by: adomani <adomani@gmail.com>

Diff
@@ -173,54 +173,94 @@ def instL2OpNormedAddCommGroup : NormedAddCommGroup (Matrix m n 𝕜) where
 
 scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedAddCommGroup
 
-lemma l2_op_norm_def (A : Matrix m n 𝕜) :
+lemma l2_opNorm_def (A : Matrix m n 𝕜) :
     ‖A‖ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖ := rfl
 
-lemma l2_op_nnnorm_def (A : Matrix m n 𝕜) :
+@[deprecated l2_opNorm_def]
+alias l2_op_norm_def :=
+  l2_opNorm_def -- deprecated on 2024-02-02
+
+lemma l2_opNNNorm_def (A : Matrix m n 𝕜) :
     ‖A‖₊ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖₊ := rfl
 
-lemma l2_op_norm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
-  rw [l2_op_norm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
+@[deprecated l2_opNNNorm_def]
+alias l2_op_nnnorm_def :=
+  l2_opNNNorm_def -- deprecated on 2024-02-02
+
+lemma l2_opNorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
+  rw [l2_opNorm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
     toLin_conjTranspose, adjoint_toContinuousLinearMap]
   exact ContinuousLinearMap.adjoint.norm_map _
 
-lemma l2_op_nnnorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖₊ = ‖A‖₊ :=
-  Subtype.ext <| l2_op_norm_conjTranspose _
+@[deprecated l2_opNorm_conjTranspose]
+alias l2_op_norm_conjTranspose :=
+  l2_opNorm_conjTranspose -- deprecated on 2024-02-02
+
+lemma l2_opNNNorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖₊ = ‖A‖₊ :=
+  Subtype.ext <| l2_opNorm_conjTranspose _
 
-lemma l2_op_norm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ = ‖A‖ * ‖A‖ := by
-  rw [l2_op_norm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
+@[deprecated l2_opNNNorm_conjTranspose]
+alias l2_op_nnnorm_conjTranspose :=
+  l2_opNNNorm_conjTranspose -- deprecated on 2024-02-02
+
+lemma l2_opNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ = ‖A‖ * ‖A‖ := by
+  rw [l2_opNorm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
     Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun m 𝕜).toBasis), toLin_conjTranspose]
   exact ContinuousLinearMap.norm_adjoint_comp_self _
 
-lemma l2_op_nnnorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖₊ = ‖A‖₊ * ‖A‖₊ :=
-  Subtype.ext <| l2_op_norm_conjTranspose_mul_self _
+@[deprecated l2_opNorm_conjTranspose_mul_self]
+alias l2_op_norm_conjTranspose_mul_self :=
+  l2_opNorm_conjTranspose_mul_self -- deprecated on 2024-02-02
+
+lemma l2_opNNNorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖₊ = ‖A‖₊ * ‖A‖₊ :=
+  Subtype.ext <| l2_opNorm_conjTranspose_mul_self _
+
+@[deprecated l2_opNNNorm_conjTranspose_mul_self]
+alias l2_op_nnnorm_conjTranspose_mul_self :=
+  l2_opNNNorm_conjTranspose_mul_self -- deprecated on 2024-02-02
 
 -- note: with only a type ascription in the left-hand side, Lean picks the wrong norm.
-lemma l2_op_norm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
+lemma l2_opNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
     ‖(EuclideanSpace.equiv m 𝕜).symm <| A.mulVec x‖ ≤ ‖A‖ * ‖x‖ :=
-  toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) |>.trans toContinuousLinearMap A |>.le_op_norm x
+  toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) |>.trans toContinuousLinearMap A |>.le_opNorm x
+
+@[deprecated l2_opNorm_mulVec]
+alias l2_op_norm_mulVec :=
+  l2_opNorm_mulVec -- deprecated on 2024-02-02
 
-lemma l2_op_nnnorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
+lemma l2_opNNNorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
     ‖(EuclideanSpace.equiv m 𝕜).symm <| A.mulVec x‖₊ ≤ ‖A‖₊ * ‖x‖₊ :=
-  A.l2_op_norm_mulVec x
+  A.l2_opNorm_mulVec x
+
+@[deprecated l2_opNNNorm_mulVec]
+alias l2_op_nnnorm_mulVec :=
+  l2_opNNNorm_mulVec -- deprecated on 2024-02-02
 
-lemma l2_op_norm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) :
+lemma l2_opNorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) :
     ‖A * B‖ ≤ ‖A‖ * ‖B‖ := by
-  simp only [l2_op_norm_def]
+  simp only [l2_opNorm_def]
   have := (toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) ≪≫ₗ toContinuousLinearMap) A
-    |>.op_norm_comp_le <| (toEuclideanLin (n := l) (m := n) (𝕜 := 𝕜) ≪≫ₗ toContinuousLinearMap) B
+    |>.opNorm_comp_le <| (toEuclideanLin (n := l) (m := n) (𝕜 := 𝕜) ≪≫ₗ toContinuousLinearMap) B
   convert this
   ext1 x
   exact congr($(Matrix.toLin'_mul A B) x)
 
-lemma l2_op_nnnorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ :=
-  l2_op_norm_mul A B
+@[deprecated l2_opNorm_mul]
+alias l2_op_norm_mul :=
+  l2_opNorm_mul -- deprecated on 2024-02-02
+
+lemma l2_opNNNorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ :=
+  l2_opNorm_mul A B
+
+@[deprecated l2_opNNNorm_mul]
+alias l2_op_nnnorm_mul :=
+  l2_opNNNorm_mul -- deprecated on 2024-02-02
 
 /-- The normed algebra structure on `Matrix n n 𝕜` arising from the operator norm given by the
 identification with (continuous) linear endmorphisms of `EuclideanSpace 𝕜 n`. -/
 def instL2OpNormedSpace : NormedSpace 𝕜 (Matrix m n 𝕜) where
   norm_smul_le r x := by
-    rw [l2_op_norm_def, LinearEquiv.map_smul]
+    rw [l2_opNorm_def, LinearEquiv.map_smul]
     exact norm_smul_le r ((toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap x)
 
 scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedSpace
@@ -233,10 +273,10 @@ def instL2OpNormedRing : NormedRing (Matrix n n 𝕜) where
 
 scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedRing
 
-/-- This is the same as `Matrix.l2_op_norm_def`, but with a more bundled RHS for square matrices. -/
+/-- This is the same as `Matrix.l2_opNorm_def`, but with a more bundled RHS for square matrices. -/
 lemma cstar_norm_def (A : Matrix n n 𝕜) : ‖A‖ = ‖toEuclideanCLM (n := n) (𝕜 := 𝕜) A‖ := rfl
 
-/-- This is the same as `Matrix.l2_op_nnnorm_def`, but with a more bundled RHS for square
+/-- This is the same as `Matrix.l2_opNNNorm_def`, but with a more bundled RHS for square
 matrices. -/
 lemma cstar_nnnorm_def (A : Matrix n n 𝕜) : ‖A‖₊ = ‖toEuclideanCLM (n := n) (𝕜 := 𝕜) A‖₊ := rfl
 
@@ -250,7 +290,7 @@ scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedAlgebra
 /-- The operator norm on `Matrix n n 𝕜` given by the identification with (continuous) linear
 endmorphisms of `EuclideanSpace 𝕜 n` makes it into a `L2OpRing`. -/
 lemma instCstarRing : CstarRing (Matrix n n 𝕜) where
-  norm_star_mul_self := l2_op_norm_conjTranspose_mul_self _
+  norm_star_mul_self := l2_opNorm_conjTranspose_mul_self _
 
 scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instCstarRing
 
fix: Clm -> CLM, Cle -> CLE (#10018)

Rename

  • Complex.equivRealProdClmComplex.equivRealProdCLM;
    • TODO: should this one use CLE?
  • Complex.reClmComplex.reCLM;
  • Complex.imClmComplex.imCLM;
  • Complex.conjLieComplex.conjLIE;
  • Complex.conjCleComplex.conjCLE;
  • Complex.ofRealLiComplex.ofRealLI;
  • Complex.ofRealClmComplex.ofRealCLM;
  • fderivInnerClmfderivInnerCLM;
  • LinearPMap.adjointDomainMkClmLinearPMap.adjointDomainMkCLM;
  • LinearPMap.adjointDomainMkClmExtendLinearPMap.adjointDomainMkCLMExtend;
  • IsROrC.reClmIsROrC.reCLM;
  • IsROrC.imClmIsROrC.imCLM;
  • IsROrC.conjLieIsROrC.conjLIE;
  • IsROrC.conjCleIsROrC.conjCLE;
  • IsROrC.ofRealLiIsROrC.ofRealLI;
  • IsROrC.ofRealClmIsROrC.ofRealCLM;
  • MeasureTheory.condexpL1ClmMeasureTheory.condexpL1CLM;
  • algebraMapClmalgebraMapCLM;
  • WeakDual.CharacterSpace.toClmWeakDual.CharacterSpace.toCLM;
  • BoundedContinuousFunction.evalClmBoundedContinuousFunction.evalCLM;
  • ContinuousMap.evalClmContinuousMap.evalCLM;
  • TrivSqZeroExt.fstClmTrivSqZeroExt.fstClm;
  • TrivSqZeroExt.sndClmTrivSqZeroExt.sndCLM;
  • TrivSqZeroExt.inlClmTrivSqZeroExt.inlCLM;
  • TrivSqZeroExt.inrClmTrivSqZeroExt.inrCLM

and related theorems.

Diff
@@ -106,26 +106,26 @@ of Euclidean space induced by the orthonormal basis `EuclideanSpace.basisFun`.
 
 This is a more-bundled version of `Matrix.toEuclideanLin`, for the special case of square matrices,
 followed by a more-bundled version of `LinearMap.toContinuousLinearMap`. -/
-def toEuclideanClm :
+def toEuclideanCLM :
     Matrix n n 𝕜 ≃⋆ₐ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 n) :=
   toMatrixOrthonormal (EuclideanSpace.basisFun n 𝕜) |>.symm.trans <|
     { toContinuousLinearMap with
       map_mul' := fun _ _ ↦ rfl
       map_star' := adjoint_toContinuousLinearMap }
 
-lemma coe_toEuclideanClm_eq_toEuclideanLin (A : Matrix n n 𝕜) :
-    (toEuclideanClm (n := n) (𝕜 := 𝕜) A : _ →ₗ[𝕜] _) = toEuclideanLin A :=
+lemma coe_toEuclideanCLM_eq_toEuclideanLin (A : Matrix n n 𝕜) :
+    (toEuclideanCLM (n := n) (𝕜 := 𝕜) A : _ →ₗ[𝕜] _) = toEuclideanLin A :=
   rfl
 
 @[simp]
-lemma toEuclideanClm_piLp_equiv_symm (A : Matrix n n 𝕜) (x : n → 𝕜) :
-    toEuclideanClm (n := n) (𝕜 := 𝕜) A ((WithLp.equiv _ _).symm x) =
+lemma toEuclideanCLM_piLp_equiv_symm (A : Matrix n n 𝕜) (x : n → 𝕜) :
+    toEuclideanCLM (n := n) (𝕜 := 𝕜) A ((WithLp.equiv _ _).symm x) =
       (WithLp.equiv _ _).symm (toLin' A x) :=
   rfl
 
 @[simp]
-lemma piLp_equiv_toEuclideanClm (A : Matrix n n 𝕜) (x : EuclideanSpace 𝕜 n) :
-    WithLp.equiv _ _ (toEuclideanClm (n := n) (𝕜 := 𝕜) A x) =
+lemma piLp_equiv_toEuclideanCLM (A : Matrix n n 𝕜) (x : EuclideanSpace 𝕜 n) :
+    WithLp.equiv _ _ (toEuclideanCLM (n := n) (𝕜 := 𝕜) A x) =
       toLin' A (WithLp.equiv _ _ x) :=
   rfl
 
@@ -140,7 +140,7 @@ def l2OpNormedAddCommGroupAux : NormedAddCommGroup (Matrix m n 𝕜) :=
 provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedRingL2Op`.  -/
 def l2OpNormedRingAux : NormedRing (Matrix n n 𝕜) :=
   @NormedRing.induced ((Matrix n n 𝕜) ≃⋆ₐ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 n))
-    _ _ _ ContinuousLinearMap.toNormedRing _ _ toEuclideanClm.injective
+    _ _ _ ContinuousLinearMap.toNormedRing _ _ toEuclideanCLM.injective
 
 open Bornology Filter
 open scoped Topology Uniformity
@@ -234,11 +234,11 @@ def instL2OpNormedRing : NormedRing (Matrix n n 𝕜) where
 scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedRing
 
 /-- This is the same as `Matrix.l2_op_norm_def`, but with a more bundled RHS for square matrices. -/
-lemma cstar_norm_def (A : Matrix n n 𝕜) : ‖A‖ = ‖toEuclideanClm (n := n) (𝕜 := 𝕜) A‖ := rfl
+lemma cstar_norm_def (A : Matrix n n 𝕜) : ‖A‖ = ‖toEuclideanCLM (n := n) (𝕜 := 𝕜) A‖ := rfl
 
 /-- This is the same as `Matrix.l2_op_nnnorm_def`, but with a more bundled RHS for square
 matrices. -/
-lemma cstar_nnnorm_def (A : Matrix n n 𝕜) : ‖A‖₊ = ‖toEuclideanClm (n := n) (𝕜 := 𝕜) A‖₊ := rfl
+lemma cstar_nnnorm_def (A : Matrix n n 𝕜) : ‖A‖₊ = ‖toEuclideanCLM (n := n) (𝕜 := 𝕜) A‖₊ := rfl
 
 /-- The normed algebra structure on `Matrix n n 𝕜` arising from the operator norm given by the
 identification with (continuous) linear endmorphisms of `EuclideanSpace 𝕜 n`. -/
chore(Analysis.NormedSpace.Star.Matrix): add missing nnnorm lemmas (#9600)
Diff
@@ -184,11 +184,17 @@ lemma l2_op_norm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := b
     toLin_conjTranspose, adjoint_toContinuousLinearMap]
   exact ContinuousLinearMap.adjoint.norm_map _
 
+lemma l2_op_nnnorm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖₊ = ‖A‖₊ :=
+  Subtype.ext <| l2_op_norm_conjTranspose _
+
 lemma l2_op_norm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ = ‖A‖ * ‖A‖ := by
   rw [l2_op_norm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
     Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun m 𝕜).toBasis), toLin_conjTranspose]
   exact ContinuousLinearMap.norm_adjoint_comp_self _
 
+lemma l2_op_nnnorm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖₊ = ‖A‖₊ * ‖A‖₊ :=
+  Subtype.ext <| l2_op_norm_conjTranspose_mul_self _
+
 -- note: with only a type ascription in the left-hand side, Lean picks the wrong norm.
 lemma l2_op_norm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
     ‖(EuclideanSpace.equiv m 𝕜).symm <| A.mulVec x‖ ≤ ‖A‖ * ‖x‖ :=
feat: provide the ℓ² operator norm on matrices (#9474)

This adds the (unique) C⋆-norm on matrices Matrix n n 𝕜 with IsROrC 𝕜 within the scope Matrix.L2OpNorm. This norm coincides with the operator norm induced by the ℓ² norm (i.e., the norm on Matrix m n 𝕜 obtained by pulling back the norm from EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 m). Where possible, we state results for rectangular matrices.

Diff
@@ -3,23 +3,45 @@ Copyright (c) 2022 Hans Parshall. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Hans Parshall
 -/
+import Mathlib.Analysis.InnerProductSpace.Adjoint
 import Mathlib.Analysis.Matrix
 import Mathlib.Analysis.NormedSpace.Basic
 import Mathlib.Data.IsROrC.Basic
 import Mathlib.LinearAlgebra.UnitaryGroup
+import Mathlib.Topology.UniformSpace.Matrix
 
 #align_import analysis.normed_space.star.matrix from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6"
 
 /-!
-# Unitary matrices
+# Analytic properties of the `star` operation on matrices
+
+This transports the operator norm on `EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 m` to
+`Matrix m n 𝕜`. See the file `Analysis.Matrix` for many other matrix norms.
+
+## Main definitions
+
+* `Matrix.instNormedRingL2Op`: the (necessarily unique) normed ring structure on `Matrix n n 𝕜`
+  which ensure it is a `CstarRing` in `Matrix.instCstarRing`. This is a scoped instance in the
+  namespace `Matrix.L2OpNorm` in order to avoid choosing a global norm for `Matrix`.
+
+## Main statements
+
+* `entry_norm_bound_of_unitary`: the entries of a unitary matrix are uniformly boundd by `1`.
+
+## Implementation details
+
+We take care to ensure the topology and uniformity induced by `Matrix.instMetricSpaceL2Op`
+coincide with the existing topology and uniformity on matrices.
+
+## TODO
+
+* Show that `‖diagonal (v : n → 𝕜)‖ = ‖v‖`.
 
-This file collects facts about the unitary matrices over `𝕜` (either `ℝ` or `ℂ`).
 -/
 
 
 open scoped BigOperators Matrix
-
-variable {𝕜 m n E : Type*}
+variable {𝕜 m n l E : Type*}
 
 section EntrywiseSupNorm
 
@@ -70,3 +92,162 @@ theorem entrywise_sup_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Ma
 #align entrywise_sup_norm_bound_of_unitary entrywise_sup_norm_bound_of_unitary
 
 end EntrywiseSupNorm
+
+noncomputable section L2OpNorm
+
+namespace Matrix
+open LinearMap
+
+variable [IsROrC 𝕜]
+variable [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n] [Fintype l] [DecidableEq l]
+
+/-- The natural star algebra equivalence between matrices and continuous linear endomoporphisms
+of Euclidean space induced by the orthonormal basis `EuclideanSpace.basisFun`.
+
+This is a more-bundled version of `Matrix.toEuclideanLin`, for the special case of square matrices,
+followed by a more-bundled version of `LinearMap.toContinuousLinearMap`. -/
+def toEuclideanClm :
+    Matrix n n 𝕜 ≃⋆ₐ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 n) :=
+  toMatrixOrthonormal (EuclideanSpace.basisFun n 𝕜) |>.symm.trans <|
+    { toContinuousLinearMap with
+      map_mul' := fun _ _ ↦ rfl
+      map_star' := adjoint_toContinuousLinearMap }
+
+lemma coe_toEuclideanClm_eq_toEuclideanLin (A : Matrix n n 𝕜) :
+    (toEuclideanClm (n := n) (𝕜 := 𝕜) A : _ →ₗ[𝕜] _) = toEuclideanLin A :=
+  rfl
+
+@[simp]
+lemma toEuclideanClm_piLp_equiv_symm (A : Matrix n n 𝕜) (x : n → 𝕜) :
+    toEuclideanClm (n := n) (𝕜 := 𝕜) A ((WithLp.equiv _ _).symm x) =
+      (WithLp.equiv _ _).symm (toLin' A x) :=
+  rfl
+
+@[simp]
+lemma piLp_equiv_toEuclideanClm (A : Matrix n n 𝕜) (x : EuclideanSpace 𝕜 n) :
+    WithLp.equiv _ _ (toEuclideanClm (n := n) (𝕜 := 𝕜) A x) =
+      toLin' A (WithLp.equiv _ _ x) :=
+  rfl
+
+/-- An auxiliary definition used only to construct the true `NormedAddCommGroup` (and `Metric`)
+structure provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedAddCommGroupL2Op`.  -/
+def l2OpNormedAddCommGroupAux : NormedAddCommGroup (Matrix m n 𝕜) :=
+  @NormedAddCommGroup.induced ((Matrix m n 𝕜) ≃ₗ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 m))
+    _ _ _ ContinuousLinearMap.toNormedAddCommGroup.toNormedAddGroup _ _ <|
+    (toEuclideanLin.trans toContinuousLinearMap).injective
+
+/-- An auxiliary definition used only to construct the true `NormedRing` (and `Metric`) structure
+provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedRingL2Op`.  -/
+def l2OpNormedRingAux : NormedRing (Matrix n n 𝕜) :=
+  @NormedRing.induced ((Matrix n n 𝕜) ≃⋆ₐ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 n))
+    _ _ _ ContinuousLinearMap.toNormedRing _ _ toEuclideanClm.injective
+
+open Bornology Filter
+open scoped Topology Uniformity
+
+/-- The metric on `Matrix m n 𝕜` arising from the operator norm given by the identification with
+(continuous) linear maps of `EuclideanSpace`. -/
+def instL2OpMetricSpace : MetricSpace (Matrix m n 𝕜) := by
+  /- We first replace the topology so that we can automatically replace the uniformity using
+  `UniformAddGroup.toUniformSpace_eq`. -/
+  letI normed_add_comm_group : NormedAddCommGroup (Matrix m n 𝕜) :=
+    { l2OpNormedAddCommGroupAux.replaceTopology <|
+        (toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap
+        |>.toContinuousLinearEquiv.toHomeomorph.inducing.induced with
+      norm := l2OpNormedAddCommGroupAux.norm
+      dist_eq := l2OpNormedAddCommGroupAux.dist_eq }
+  exact normed_add_comm_group.replaceUniformity <| by
+    congr
+    rw [← @UniformAddGroup.toUniformSpace_eq _ (instUniformSpaceMatrix m n 𝕜) _ _]
+    rw [@UniformAddGroup.toUniformSpace_eq _ PseudoEMetricSpace.toUniformSpace _ _]
+
+scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpMetricSpace
+
+open scoped Matrix.L2OpNorm
+
+/-- The norm structure on `Matrix m n 𝕜` arising from the operator norm given by the identification
+with (continuous) linear maps of `EuclideanSpace`. -/
+def instL2OpNormedAddCommGroup : NormedAddCommGroup (Matrix m n 𝕜) where
+  norm := l2OpNormedAddCommGroupAux.norm
+  dist_eq := l2OpNormedAddCommGroupAux.dist_eq
+
+scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedAddCommGroup
+
+lemma l2_op_norm_def (A : Matrix m n 𝕜) :
+    ‖A‖ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖ := rfl
+
+lemma l2_op_nnnorm_def (A : Matrix m n 𝕜) :
+    ‖A‖₊ = ‖(toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap A‖₊ := rfl
+
+lemma l2_op_norm_conjTranspose (A : Matrix m n 𝕜) : ‖Aᴴ‖ = ‖A‖ := by
+  rw [l2_op_norm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
+    toLin_conjTranspose, adjoint_toContinuousLinearMap]
+  exact ContinuousLinearMap.adjoint.norm_map _
+
+lemma l2_op_norm_conjTranspose_mul_self (A : Matrix m n 𝕜) : ‖Aᴴ * A‖ = ‖A‖ * ‖A‖ := by
+  rw [l2_op_norm_def, toEuclideanLin_eq_toLin_orthonormal, LinearEquiv.trans_apply,
+    Matrix.toLin_mul (v₂ := (EuclideanSpace.basisFun m 𝕜).toBasis), toLin_conjTranspose]
+  exact ContinuousLinearMap.norm_adjoint_comp_self _
+
+-- note: with only a type ascription in the left-hand side, Lean picks the wrong norm.
+lemma l2_op_norm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
+    ‖(EuclideanSpace.equiv m 𝕜).symm <| A.mulVec x‖ ≤ ‖A‖ * ‖x‖ :=
+  toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) |>.trans toContinuousLinearMap A |>.le_op_norm x
+
+lemma l2_op_nnnorm_mulVec (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
+    ‖(EuclideanSpace.equiv m 𝕜).symm <| A.mulVec x‖₊ ≤ ‖A‖₊ * ‖x‖₊ :=
+  A.l2_op_norm_mulVec x
+
+lemma l2_op_norm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) :
+    ‖A * B‖ ≤ ‖A‖ * ‖B‖ := by
+  simp only [l2_op_norm_def]
+  have := (toEuclideanLin (n := n) (m := m) (𝕜 := 𝕜) ≪≫ₗ toContinuousLinearMap) A
+    |>.op_norm_comp_le <| (toEuclideanLin (n := l) (m := n) (𝕜 := 𝕜) ≪≫ₗ toContinuousLinearMap) B
+  convert this
+  ext1 x
+  exact congr($(Matrix.toLin'_mul A B) x)
+
+lemma l2_op_nnnorm_mul (A : Matrix m n 𝕜) (B : Matrix n l 𝕜) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ :=
+  l2_op_norm_mul A B
+
+/-- The normed algebra structure on `Matrix n n 𝕜` arising from the operator norm given by the
+identification with (continuous) linear endmorphisms of `EuclideanSpace 𝕜 n`. -/
+def instL2OpNormedSpace : NormedSpace 𝕜 (Matrix m n 𝕜) where
+  norm_smul_le r x := by
+    rw [l2_op_norm_def, LinearEquiv.map_smul]
+    exact norm_smul_le r ((toEuclideanLin (𝕜 := 𝕜) (m := m) (n := n)).trans toContinuousLinearMap x)
+
+scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedSpace
+
+/-- The normed ring structure on `Matrix n n 𝕜` arising from the operator norm given by the
+identification with (continuous) linear endmorphisms of `EuclideanSpace 𝕜 n`. -/
+def instL2OpNormedRing : NormedRing (Matrix n n 𝕜) where
+  dist_eq := l2OpNormedRingAux.dist_eq
+  norm_mul := l2OpNormedRingAux.norm_mul
+
+scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedRing
+
+/-- This is the same as `Matrix.l2_op_norm_def`, but with a more bundled RHS for square matrices. -/
+lemma cstar_norm_def (A : Matrix n n 𝕜) : ‖A‖ = ‖toEuclideanClm (n := n) (𝕜 := 𝕜) A‖ := rfl
+
+/-- This is the same as `Matrix.l2_op_nnnorm_def`, but with a more bundled RHS for square
+matrices. -/
+lemma cstar_nnnorm_def (A : Matrix n n 𝕜) : ‖A‖₊ = ‖toEuclideanClm (n := n) (𝕜 := 𝕜) A‖₊ := rfl
+
+/-- The normed algebra structure on `Matrix n n 𝕜` arising from the operator norm given by the
+identification with (continuous) linear endmorphisms of `EuclideanSpace 𝕜 n`. -/
+def instL2OpNormedAlgebra : NormedAlgebra 𝕜 (Matrix n n 𝕜) where
+  norm_smul_le := norm_smul_le
+
+scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instL2OpNormedAlgebra
+
+/-- The operator norm on `Matrix n n 𝕜` given by the identification with (continuous) linear
+endmorphisms of `EuclideanSpace 𝕜 n` makes it into a `L2OpRing`. -/
+lemma instCstarRing : CstarRing (Matrix n n 𝕜) where
+  norm_star_mul_self := l2_op_norm_conjTranspose_mul_self _
+
+scoped[Matrix.L2OpNorm] attribute [instance] Matrix.instCstarRing
+
+end Matrix
+
+end L2OpNorm
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -19,8 +19,6 @@ This file collects facts about the unitary matrices over `𝕜` (either `ℝ` or
 
 open scoped BigOperators Matrix
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 variable {𝕜 m n E : Type*}
 
 section EntrywiseSupNorm
@@ -41,7 +39,7 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
       use j
       simp only [eq_self_iff_true, Finset.mem_univ_val, and_self_iff, sq_eq_sq]
   -- The L2 norm of a row is a diagonal entry of U * Uᴴ
-  have diag_eq_norm_sum : (U * Uᴴ) i i = ∑ x : n, ‖U i x‖ ^ 2 := by
+  have diag_eq_norm_sum : (U * Uᴴ) i i = (∑ x : n, ‖U i x‖ ^ 2 : ℝ) := by
     simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, IsROrC.mul_conj,
       IsROrC.normSq_eq_def', IsROrC.ofReal_pow]; norm_cast
   -- The L2 norm of a row is a diagonal entry of U * Uᴴ, real part
refactor(Data/Matrix): Eliminate notation in favor of HMul (#6487)

The main difficulty here is that * has a slightly difference precedence to . notably around smul and neg.

The other annoyance is that ↑U ⬝ A ⬝ ↑U⁻¹ : Matrix m m 𝔸 now has to be written U.val * A * (U⁻¹).val in order to typecheck.

A downside of this change to consider: if you have a goal of A * (B * C) = (A * B) * C, mul_assoc now gives the illusion of matching, when in fact Matrix.mul_assoc is needed. Previously the distinct symbol made it easy to avoid this mistake.

On the flipside, there is now no need to rewrite by Matrix.mul_eq_mul all the time (indeed, the lemma is now removed).

Diff
@@ -40,18 +40,18 @@ theorem entry_norm_bound_of_unitary {U : Matrix n n 𝕜} (hU : U ∈ Matrix.uni
     · rw [Multiset.mem_map]
       use j
       simp only [eq_self_iff_true, Finset.mem_univ_val, and_self_iff, sq_eq_sq]
-  -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ
-  have diag_eq_norm_sum : (U ⬝ Uᴴ) i i = ∑ x : n, ‖U i x‖ ^ 2 := by
+  -- The L2 norm of a row is a diagonal entry of U * Uᴴ
+  have diag_eq_norm_sum : (U * Uᴴ) i i = ∑ x : n, ‖U i x‖ ^ 2 := by
     simp only [Matrix.mul_apply, Matrix.conjTranspose_apply, ← starRingEnd_apply, IsROrC.mul_conj,
       IsROrC.normSq_eq_def', IsROrC.ofReal_pow]; norm_cast
-  -- The L2 norm of a row is a diagonal entry of U ⬝ Uᴴ, real part
-  have re_diag_eq_norm_sum : IsROrC.re ((U ⬝ Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 := by
+  -- The L2 norm of a row is a diagonal entry of U * Uᴴ, real part
+  have re_diag_eq_norm_sum : IsROrC.re ((U * Uᴴ) i i) = ∑ x : n, ‖U i x‖ ^ 2 := by
     rw [IsROrC.ext_iff] at diag_eq_norm_sum
     rw [diag_eq_norm_sum.1]
     norm_cast
-  -- Since U is unitary, the diagonal entries of U ⬝ Uᴴ are all 1
-  have mul_eq_one : U ⬝ Uᴴ = 1 := unitary.mul_star_self_of_mem hU
-  have diag_eq_one : IsROrC.re ((U ⬝ Uᴴ) i i) = 1 := by
+  -- Since U is unitary, the diagonal entries of U * Uᴴ are all 1
+  have mul_eq_one : U * Uᴴ = 1 := unitary.mul_star_self_of_mem hU
+  have diag_eq_one : IsROrC.re ((U * Uᴴ) i i) = 1 := by
     simp only [mul_eq_one, eq_self_iff_true, Matrix.one_apply_eq, IsROrC.one_re]
   -- Putting it all together
   rw [← sq_le_one_iff (norm_nonneg (U i j)), ← diag_eq_one, re_diag_eq_norm_sum]
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -21,7 +21,7 @@ open scoped BigOperators Matrix
 
 local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
-variable {𝕜 m n E : Type _}
+variable {𝕜 m n E : Type*}
 
 section EntrywiseSupNorm
 
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -19,7 +19,7 @@ This file collects facts about the unitary matrices over `𝕜` (either `ℝ` or
 
 open scoped BigOperators Matrix
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 variable {𝕜 m n E : Type _}
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2022 Hans Parshall. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Hans Parshall
-
-! This file was ported from Lean 3 source module analysis.normed_space.star.matrix
-! leanprover-community/mathlib commit 468b141b14016d54b479eb7a0fff1e360b7e3cf6
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Matrix
 import Mathlib.Analysis.NormedSpace.Basic
 import Mathlib.Data.IsROrC.Basic
 import Mathlib.LinearAlgebra.UnitaryGroup
 
+#align_import analysis.normed_space.star.matrix from "leanprover-community/mathlib"@"468b141b14016d54b479eb7a0fff1e360b7e3cf6"
+
 /-!
 # Unitary matrices
 
feat: port Analysis.NormedSpace.Star.Matrix (#5360)

Dependencies 12 + 910

911 files ported (98.7%)
403949 lines ported (98.6%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file