|
|
|
|
SSL Matrix.lean
Interaktion und PortierbarkeitLean
|
|
/-
Copyright (c) 2022 Hans Parshall. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hans Parshall
-/
module
public import Mathlib.Analysis.CStarAlgebra.Classes
public import Mathlib.Analysis.InnerProductSpace.Adjoint
public import Mathlib.Analysis.Matrix.Normed
public import Mathlib.Topology.UniformSpace.Matrix
/-!
# 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 `Mathlib/Analysis/Matrix.lean` 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.Norms.L2Operator` 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 bound 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.
-/
@[expose] public section
open WithLp
open scoped Matrix
variable { m n l : Type*}
section EntrywiseSupNorm
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
-- The norm squared of an entry is at most the L2 norm of its row.
have norm_sum : ‖U i j‖ ^ 2 ≤ ∑ x, ‖U i x‖ ^ 2 := by
apply Multiset.single_le_sum
· intro x h_x
rw [Multiset.mem_map] at h_x
obtain ⟨a, h_a⟩ := h_x
rw [← h_a.2]
apply sq_nonneg
· rw [Multiset.mem_map]
use j
simp only [Finset.mem_univ_val, and_self_iff]
-- 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, RCLike.mul_conj]
norm_cast
-- The L2 norm of a row is a diagonal entry of U * Uᴴ, real part
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 : RCLike.re ((U * Uᴴ) i i) = 1 := by
simp only [mul_eq_one, 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
set_option backward.isDefEq.respectTransparency false in
open scoped Matrix.Norms.Elementwise in
/-- 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
simp_rw [pi_norm_le_iff_of_nonneg zero_le_one]
intros
exact entry_norm_bound_of_unitary hU _ _
end EntrywiseSupNorm
noncomputable section L2OpNorm
namespace Matrix
open LinearMap
variable [RCLike ]
variable [Fintype m] [Fintype n] [DecidableEq n] [Fintype l] [DecidableEq l]
/-- The natural star algebra equivalence between matrices and continuous linear endomorphisms
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 }
@[fun_prop]
lemma continuous_uncurry_toEuclideanCLM :
Continuous (fun (S, x) ↦ toEuclideanCLM (n := n) ( := ) S x) := by
refine Continuous.comp (by fun_prop) <| continuous_pi fun i ↦ ?_
simp only [LinearEquiv.toEquiv_symm, Equiv.symm_symm, Equiv.invFun_as_coe,
LinearEquiv.coe_symm_toEquiv, toMatrix'_symm, OrthonormalBasis.coe_toBasis_repr,
LinearEquiv.coe_coe, LinearEquiv.trans_apply, LinearIsometryEquiv.coe_toLinearEquiv,
linearEquiv_apply, AddEquiv.toEquiv_eq_coe, Equiv.toFun_as_coe, EquivLike.coe_coe,
addEquiv_apply, toLin'_apply, LinearEquiv.symm_mk, coe_mk, AddHom.coe_mk, LinearEquiv.coe_mk,
LinearEquiv.coe_toEquiv, Finsupp.linearEquivFunOnFinite_apply,
Finsupp.equivFunOnFinite_symm_apply_apply]
fun_prop
lemma coe_toEuclideanCLM_eq_toEuclideanLin (A : Matrix n n ) :
(toEuclideanCLM (n := n) ( := ) A : _ →ₗ[] _) = toEuclideanLin A :=
rfl
@[simp]
lemma toEuclideanCLM_toLp (A : Matrix n n ) (x : n → ) :
toEuclideanCLM (n := n) ( := ) A (toLp _ x) = toLp _ (A *ᵥ x) := rfl
@[simp]
lemma ofLp_toEuclideanCLM (A : Matrix n n ) (x : EuclideanSpace n) :
ofLp (toEuclideanCLM (n := n) ( := ) A x) = A *ᵥ ofLp x := rfl
open scoped RealInnerProductSpace in
lemma inner_toEuclideanCLM (A : Matrix n n ℝ) (x y : EuclideanSpace ℝ n) :
⟪x, toEuclideanCLM ( := ℝ) A y⟫ = x ⬝ᵥ A *ᵥ y := by
simp only [toEuclideanCLM, AddHom.toFun_eq_coe, LinearMap.coe_toAddHom, LinearEquiv.coe_coe,
LinearEquiv.invFun_eq_symm, LinearMap.coe_toContinuousLinearMap_symm, StarAlgEquiv.trans_apply,
LinearMap.toMatrixOrthonormal_symm_apply, LinearMap.toMatrix_symm, StarAlgEquiv.coe_mk,
StarRingEquiv.coe_mk, RingEquiv.coe_mk, Equiv.coe_fn_mk, LinearMap.coe_toContinuousLinearMap',
toLin_apply, mulVec_eq_sum, OrthonormalBasis.coe_toBasis_repr_apply,
EuclideanSpace.basisFun_repr, op_smul_eq_smul, Finset.sum_apply, Pi.smul_apply, transpose_apply,
smul_eq_mul, OrthonormalBasis.coe_toBasis, EuclideanSpace.basisFun_apply, PiLp.inner_apply,
ofLp_sum, ofLp_smul, PiLp.ofLp_single, RCLike.inner_apply, conj_trivial, dotProduct]
congr with i
rw [mul_comm (x.ofLp i)]
simp [Pi.single_apply]
/-- An auxiliary definition used only to construct the true `NormedAddCommGroup` (and `Metric`)
structure provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedAddCommGroupL2Op`. -/
@[instance_reducible]
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`. -/
@[instance_reducible]
def l2OpNormedRingAux : NormedRing (Matrix n n ) :=
@NormedRing.induced ((Matrix n n ) ≃⋆ₐ[] (EuclideanSpace n →L[] EuclideanSpace n)) _
_ _ _ ContinuousLinearMap.toNormedRing _ _ toEuclideanCLM.injective
open 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`. -/
@[instance_reducible]
def instL2OpMetricSpace : MetricSpace (Matrix m n ) := by
/- We first replace the topology so that we can automatically replace the uniformity using
`IsUniformAddGroup.toUniformSpace_eq`. -/
letI normed_add_comm_group : NormedAddCommGroup (Matrix m n ) :=
{ l2OpNormedAddCommGroupAux.replaceTopology <|
(toEuclideanLin ( := ) (m := m) (n := n)).trans toContinuousLinearMap
|>.toContinuousLinearEquiv.toHomeomorph.isInducing.eq_induced with
norm := l2OpNormedAddCommGroupAux.norm
dist_eq := l2OpNormedAddCommGroupAux.dist_eq }
exact normed_add_comm_group.replaceUniformity <| by
congr
rw [← @IsUniformAddGroup.rightUniformSpace_eq _ (Matrix.instUniformSpace m n ) _ _]
rw [@IsUniformAddGroup.rightUniformSpace_eq _ PseudoEMetricSpace.toUniformSpace _ _]
scoped[Matrix.Norms.L2Operator] attribute [instance] Matrix.instL2OpMetricSpace
open scoped Matrix.Norms.L2Operator
/-- The norm structure on `Matrix m n ` arising from the operator norm given by the identification
with (continuous) linear maps of `EuclideanSpace`. -/
@[instance_reducible]
def instL2OpNormedAddCommGroup : NormedAddCommGroup (Matrix m n ) where
norm := l2OpNormedAddCommGroupAux.norm
dist_eq := l2OpNormedAddCommGroupAux.dist_eq
scoped[Matrix.Norms.L2Operator] attribute [instance] Matrix.instL2OpNormedAddCommGroup
lemma l2_opNorm_def (A : Matrix m n ) :
‖A‖ = ‖(toEuclideanLin ( := ) (m := m) (n := n)).trans toContinuousLinearMap A‖ := rfl
lemma l2_opNNNorm_def (A : Matrix m n ) :
‖A‖₊ = ‖(toEuclideanLin ( := ) (m := m) (n := n)).trans toContinuousLinearMap A‖₊ := rfl
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 _
lemma l2_opNNNorm_conjTranspose [DecidableEq m] (A : Matrix m n ) : ‖Aᴴ‖₊ = ‖A‖₊ :=
Subtype.ext <| l2_opNorm_conjTranspose _
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 _
lemma l2_opNNNorm_conjTranspose_mul_self (A : Matrix m n ) : ‖Aᴴ * A‖₊ = ‖A‖₊ * ‖A‖₊ :=
Subtype.ext <| l2_opNorm_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
lemma l2_opNNNorm_mulVec (A : Matrix m n ) (x : EuclideanSpace n) :
‖(EuclideanSpace.equiv m ).symm <| A *ᵥ x‖₊ ≤ ‖A‖₊ * ‖x‖₊ :=
A.l2_opNorm_mulVec x
lemma l2_opNorm_mul (A : Matrix m n ) (B : Matrix n l ) :
‖A * B‖ ≤ ‖A‖ * ‖B‖ := by
simp only [l2_opNorm_def]
have := (toEuclideanLin (n := n) (m := m) ( := ) ≪≫ₗ toContinuousLinearMap) A
|>.opNorm_comp_le <| (toEuclideanLin (n := l) (m := n) ( := ) ≪≫ₗ toContinuousLinearMap) B
convert this
ext1 x
congrm toLp 2 ($(Matrix.toLin'_mul A B) x)
lemma l2_opNNNorm_mul (A : Matrix m n ) (B : Matrix n l ) : ‖A * B‖₊ ≤ ‖A‖₊ * ‖B‖₊ :=
l2_opNorm_mul A B
lemma l2_opNorm_toEuclideanCLM (A : Matrix n n ) :
‖toEuclideanCLM (n := n) ( := ) A‖ = ‖A‖ := rfl
@[simp]
lemma l2_opNorm_diagonal (v : n → ) : ‖(diagonal v : Matrix n n )‖ = ‖v‖ := by
set T := toEuclideanCLM (n := n) ( := ) (diagonal v)
rw [← l2_opNorm_toEuclideanCLM]
refine le_antisymm ?_ ?_
· refine T.opNorm_le_bound (norm_nonneg _) fun x ↦ ?_
refine (sq_le_sq₀ (by positivity) (by positivity)).mp ?_
simp only [(T x).norm_sq_eq, ofLp_toEuclideanCLM, mulVec_diagonal, norm_mul, T]
calc _ ≤ _ := Finset.sum_le_sum fun i _ ↦ by grw [mul_pow, norm_le_pi_norm v i]
_ = _ := by simp [mul_pow, EuclideanSpace.norm_sq_eq x, Finset.mul_sum]
· refine (pi_norm_le_iff_of_nonneg (norm_nonneg T)).mpr fun i ↦ ?_
calc _ = ‖T (toLp 2 (Pi.single i (1 : )))‖ := by
rw [toEuclideanCLM_toLp (diagonal v) (Pi.single i (1 : ))]
simp
_ ≤ _ := by grw [T.le_opNorm]; simp
@[simp]
lemma l2_opNNNorm_diagonal (v : n → ) : ‖(diagonal v : Matrix n n )‖₊ = ‖v‖₊ :=
Subtype.ext <| l2_opNorm_diagonal (n := n) ( := ) v
/-- The normed algebra structure on `Matrix n n ` arising from the operator norm given by the
identification with (continuous) linear endomorphisms of `EuclideanSpace n`. -/
@[instance_reducible]
def instL2OpNormedSpace : NormedSpace (Matrix m n ) where
norm_smul_le r x := by
rw [l2_opNorm_def, map_smul]
exact norm_smul_le r ((toEuclideanLin ( := ) (m := m) (n := n)).trans toContinuousLinearMap x)
scoped[Matrix.Norms.L2Operator] attribute [instance] Matrix.instL2OpNormedSpace
/-- The normed ring structure on `Matrix n n ` arising from the operator norm given by the
identification with (continuous) linear endomorphisms of `EuclideanSpace n`. -/
@[instance_reducible]
def instL2OpNormedRing : NormedRing (Matrix n n ) where
dist_eq := l2OpNormedRingAux.dist_eq
norm_mul_le := l2OpNormedRingAux.norm_mul_le
scoped[Matrix.Norms.L2Operator] attribute [instance] Matrix.instL2OpNormedRing
/-- 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_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
@[deprecated (since := "2026-10-31")] alias cstar_nnnorm_def := cstar_nnNorm_def
/-- The normed algebra structure on `Matrix n n ` arising from the operator norm given by the
identification with (continuous) linear endomorphisms of `EuclideanSpace n`. -/
@[instance_reducible]
def instL2OpNormedAlgebra : NormedAlgebra (Matrix n n ) where
norm_smul_le := norm_smul_le
scoped[Matrix.Norms.L2Operator] attribute [instance] Matrix.instL2OpNormedAlgebra
/-- The operator norm on `Matrix n n ` given by the identification with (continuous) linear
endomorphisms of `EuclideanSpace n` makes it into a `L2OpRing`. -/
lemma instCStarRing : CStarRing (Matrix n n ) where
norm_mul_self_le M := le_of_eq <| Eq.symm <| l2_opNorm_conjTranspose_mul_self M
scoped[Matrix.Norms.L2Operator] attribute [instance] Matrix.instCStarRing
/-- The matrices `Matrix n n ℂ` with the L2 operator norm form a `CStarAlgebra`. -/
@[instance_reducible] noncomputable def instCStarAlgebra {n : Type*} [Fintype n] [DecidableEq n] :
CStarAlgebra (Matrix n n ℂ) where
scoped[Matrix.Norms.L2Operator] attribute [instance] Matrix.instCStarAlgebra
end Matrix
end L2OpNorm
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.108Angebot
¤
*Bot Zugriff
|
|
2026-11-24
|
|
|
|
|