linear_algebra.matrix.ldl
β·
Mathlib.LinearAlgebra.Matrix.LDL
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.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -33,7 +33,7 @@ decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a d
-/
-variable {π : Type _} [IsROrC π]
+variable {π : Type _} [RCLike π]
variable {n : Type _} [LinearOrder n] [IsWellOrder n (Β· < Β·)] [LocallyFiniteOrderBot n]
@@ -123,7 +123,7 @@ theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL
Β· simp only [LDL.diag, hij, diagonal_apply_ne, Ne.def, not_false_iff, mul_mul_apply]
rw [conj_transpose, transpose_map, transpose_transpose, dot_product_mul_vec,
(LDL.lowerInv_orthogonal hS fun h : j = i => hij h.symm).symm, β inner_conj_symm,
- mul_vec_transpose, EuclideanSpace.inner_piLp_equiv_symm, β IsROrC.star_def, β
+ mul_vec_transpose, EuclideanSpace.inner_piLp_equiv_symm, β RCLike.star_def, β
star_dot_product_star, dot_product_comm, star_star]
rfl
#align LDL.diag_eq_lower_inv_conj LDL.diag_eq_lowerInv_conj
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2022 Alexander Bentkamp. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp
-/
-import Mathbin.Analysis.InnerProductSpace.GramSchmidtOrtho
-import Mathbin.LinearAlgebra.Matrix.PosDef
+import Analysis.InnerProductSpace.GramSchmidtOrtho
+import LinearAlgebra.Matrix.PosDef
#align_import linear_algebra.matrix.ldl from "leanprover-community/mathlib"@"2a0ce625dbb0ffbc7d1316597de0b25c1ec75303"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2022 Alexander Bentkamp. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp
-
-! This file was ported from Lean 3 source module linear_algebra.matrix.ldl
-! leanprover-community/mathlib commit 2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Analysis.InnerProductSpace.GramSchmidtOrtho
import Mathbin.LinearAlgebra.Matrix.PosDef
+#align_import linear_algebra.matrix.ldl from "leanprover-community/mathlib"@"2a0ce625dbb0ffbc7d1316597de0b25c1ec75303"
+
/-! # LDL decomposition
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -65,7 +65,7 @@ theorem LDL.lowerInv_eq_gramSchmidtBasis :
(@gramSchmidtBasis π (n β π) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun π n)))α΅ :=
by
- ext (i j)
+ ext i j
rw [LDL.lowerInv, Basis.coePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis]
rfl
#align LDL.lower_inv_eq_gram_schmidt_basis LDL.lowerInv_eq_gramSchmidtBasis
@@ -118,7 +118,7 @@ theorem LDL.lowerInv_triangular {i j : n} (hij : i < j) : LDL.lowerInv hS i j =
by some lower triangular matrix and get a diagonal matrix. -/
theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL.lowerInv hS)α΄΄ :=
by
- ext (i j)
+ ext i j
by_cases hij : i = j
Β·
simpa only [hij, LDL.diag, diagonal_apply_eq, LDL.diagEntries, Matrix.mul_assoc,
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -48,6 +48,7 @@ open scoped Matrix
variable {S : Matrix n n π} [Fintype n] (hS : S.PosDef)
+#print LDL.lowerInv /-
/-- The inverse of the lower triangular matrix `L` of the LDL-decomposition. It is obtained by
applying Gram-Schmidt-Orthogonalization w.r.t. the inner product induced by `Sα΅` on the standard
basis vectors `pi.basis_fun`. -/
@@ -55,7 +56,9 @@ noncomputable def LDL.lowerInv : Matrix n n π :=
@gramSchmidt π (n β π) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun π n)
#align LDL.lower_inv LDL.lowerInv
+-/
+#print LDL.lowerInv_eq_gramSchmidtBasis /-
theorem LDL.lowerInv_eq_gramSchmidtBasis :
LDL.lowerInv hS =
((Pi.basisFun π n).toMatrix
@@ -66,7 +69,9 @@ theorem LDL.lowerInv_eq_gramSchmidtBasis :
rw [LDL.lowerInv, Basis.coePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis]
rfl
#align LDL.lower_inv_eq_gram_schmidt_basis LDL.lowerInv_eq_gramSchmidtBasis
+-/
+#print LDL.invertibleLowerInv /-
noncomputable instance LDL.invertibleLowerInv : Invertible (LDL.lowerInv hS) :=
by
rw [LDL.lowerInv_eq_gramSchmidtBasis]
@@ -76,29 +81,39 @@ noncomputable instance LDL.invertibleLowerInv : Invertible (LDL.lowerInv hS) :=
(Pi.basisFun π n))
infer_instance
#align LDL.invertible_lower_inv LDL.invertibleLowerInv
+-/
+#print LDL.lowerInv_orthogonal /-
theorem LDL.lowerInv_orthogonal {i j : n} (hβ : i β j) :
βͺLDL.lowerInv hS i, Sα΅.mulVec (LDL.lowerInv hS j)β«β = 0 :=
@gramSchmidt_orthogonal π _ _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) _ _ _ _ _ _ _ hβ
#align LDL.lower_inv_orthogonal LDL.lowerInv_orthogonal
+-/
+#print LDL.diagEntries /-
/-- The entries of the diagonal matrix `D` of the LDL decomposition. -/
noncomputable def LDL.diagEntries : n β π := fun i =>
βͺstar (LDL.lowerInv hS i), S.mulVec (star (LDL.lowerInv hS i))β«β
#align LDL.diag_entries LDL.diagEntries
+-/
+#print LDL.diag /-
/-- The diagonal matrix `D` of the LDL decomposition. -/
noncomputable def LDL.diag : Matrix n n π :=
Matrix.diagonal (LDL.diagEntries hS)
#align LDL.diag LDL.diag
+-/
+#print LDL.lowerInv_triangular /-
theorem LDL.lowerInv_triangular {i j : n} (hij : i < j) : LDL.lowerInv hS i j = 0 := by
rw [β
@gramSchmidt_triangular π (n β π) _ (_ : _) (inner_product_space.of_matrix hS.transpose) n _ _ _
i j hij (Pi.basisFun π n),
Pi.basisFun_repr, LDL.lowerInv]
#align LDL.lower_inv_triangular LDL.lowerInv_triangular
+-/
+#print LDL.diag_eq_lowerInv_conj /-
/-- Inverse statement of **LDL decomposition**: we can conjugate a positive definite matrix
by some lower triangular matrix and get a diagonal matrix. -/
theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL.lowerInv hS)α΄΄ :=
@@ -115,12 +130,16 @@ theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL
star_dot_product_star, dot_product_comm, star_star]
rfl
#align LDL.diag_eq_lower_inv_conj LDL.diag_eq_lowerInv_conj
+-/
+#print LDL.lower /-
/-- The lower triangular matrix `L` of the LDL decomposition. -/
noncomputable def LDL.lower :=
(LDL.lowerInv hS)β»ΒΉ
#align LDL.lower LDL.lower
+-/
+#print LDL.lower_conj_diag /-
/-- **LDL decomposition**: any positive definite matrix `S` can be
decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a diagonal matrix. -/
theorem LDL.lower_conj_diag : LDL.lower hS β¬ LDL.diag hS β¬ (LDL.lower hS)α΄΄ = S :=
@@ -130,4 +149,5 @@ theorem LDL.lower_conj_diag : LDL.lower hS β¬ LDL.diag hS β¬ (LDL.lower hS)α΄΄
Matrix.mul_inv_eq_iff_eq_mul_of_invertible]
exact LDL.diag_eq_lowerInv_conj hS
#align LDL.lower_conj_diag LDL.lower_conj_diag
+-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp
! This file was ported from Lean 3 source module linear_algebra.matrix.ldl
-! leanprover-community/mathlib commit 46b633fd842bef9469441c0209906f6dddd2b4f5
+! leanprover-community/mathlib commit 2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -13,6 +13,9 @@ import Mathbin.LinearAlgebra.Matrix.PosDef
/-! # LDL decomposition
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
This file proves the LDL-decomposition of matricies: Any positive definite matrix `S` can be
decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a diagonal matrix.
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -37,7 +37,6 @@ variable {π : Type _} [IsROrC π]
variable {n : Type _} [LinearOrder n] [IsWellOrder n (Β· < Β·)] [LocallyFiniteOrderBot n]
--- mathport name: Β«exprβͺ , β«βΒ»
local notation "βͺ" x ", " y "β«β" => @inner π _ _ ((PiLp.equiv 2 _).symm x) ((PiLp.equiv _ _).symm y)
open Matrix
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -42,7 +42,7 @@ local notation "βͺ" x ", " y "β«β" => @inner π _ _ ((PiLp.equiv 2 _).symm
open Matrix
-open Matrix
+open scoped Matrix
variable {S : Matrix n n π} [Fintype n] (hS : S.PosDef)
mathlib commit https://github.com/leanprover-community/mathlib/commit/fa78268d4d77cb2b2fbc89f0527e2e7807763780
@@ -61,7 +61,7 @@ theorem LDL.lowerInv_eq_gramSchmidtBasis :
(Pi.basisFun π n)))α΅ :=
by
ext (i j)
- rw [LDL.lowerInv, Basis.CoePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis]
+ rw [LDL.lowerInv, Basis.coePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis]
rfl
#align LDL.lower_inv_eq_gram_schmidt_basis LDL.lowerInv_eq_gramSchmidtBasis
mathlib commit https://github.com/leanprover-community/mathlib/commit/55d771df074d0dd020139ee1cd4b95521422df9f
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp
! This file was ported from Lean 3 source module linear_algebra.matrix.ldl
-! leanprover-community/mathlib commit 9f0d61b4475e3c3cba6636ab51cdb1f3949d2e1d
+! leanprover-community/mathlib commit 46b633fd842bef9469441c0209906f6dddd2b4f5
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -50,13 +50,14 @@ variable {S : Matrix n n π} [Fintype n] (hS : S.PosDef)
applying Gram-Schmidt-Orthogonalization w.r.t. the inner product induced by `Sα΅` on the standard
basis vectors `pi.basis_fun`. -/
noncomputable def LDL.lowerInv : Matrix n n π :=
- @gramSchmidt π (n β π) _ (InnerProductSpace.ofMatrix hS.transpose) n _ _ _ (Pi.basisFun π n)
+ @gramSchmidt π (n β π) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
+ (Pi.basisFun π n)
#align LDL.lower_inv LDL.lowerInv
theorem LDL.lowerInv_eq_gramSchmidtBasis :
LDL.lowerInv hS =
((Pi.basisFun π n).toMatrix
- (@gramSchmidtBasis π (n β π) _ (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
+ (@gramSchmidtBasis π (n β π) _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) n _ _ _
(Pi.basisFun π n)))α΅ :=
by
ext (i j)
@@ -69,18 +70,14 @@ noncomputable instance LDL.invertibleLowerInv : Invertible (LDL.lowerInv hS) :=
rw [LDL.lowerInv_eq_gramSchmidtBasis]
haveI :=
Basis.invertibleToMatrix (Pi.basisFun π n)
- (@gramSchmidtBasis π (n β π) _ (inner_product_space.of_matrix hS.transpose) n _ _ _
+ (@gramSchmidtBasis π (n β π) _ (_ : _) (inner_product_space.of_matrix hS.transpose) n _ _ _
(Pi.basisFun π n))
infer_instance
#align LDL.invertible_lower_inv LDL.invertibleLowerInv
theorem LDL.lowerInv_orthogonal {i j : n} (hβ : i β j) :
βͺLDL.lowerInv hS i, Sα΅.mulVec (LDL.lowerInv hS j)β«β = 0 :=
- show
- @inner π (n β π) (InnerProductSpace.ofMatrix hS.transpose).toHasInner (LDL.lowerInv hS i)
- (LDL.lowerInv hS j) =
- 0
- by apply gramSchmidt_orthogonal _ _ hβ
+ @gramSchmidt_orthogonal π _ _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) _ _ _ _ _ _ _ hβ
#align LDL.lower_inv_orthogonal LDL.lowerInv_orthogonal
/-- The entries of the diagonal matrix `D` of the LDL decomposition. -/
@@ -95,8 +92,8 @@ noncomputable def LDL.diag : Matrix n n π :=
theorem LDL.lowerInv_triangular {i j : n} (hij : i < j) : LDL.lowerInv hS i j = 0 := by
rw [β
- @gramSchmidt_triangular π (n β π) _ (inner_product_space.of_matrix hS.transpose) n _ _ _ i j hij
- (Pi.basisFun π n),
+ @gramSchmidt_triangular π (n β π) _ (_ : _) (inner_product_space.of_matrix hS.transpose) n _ _ _
+ i j hij (Pi.basisFun π n),
Pi.basisFun_repr, LDL.lowerInv]
#align LDL.lower_inv_triangular LDL.lowerInv_triangular
mathlib commit https://github.com/leanprover-community/mathlib/commit/02ba8949f486ebecf93fe7460f1ed0564b5e442c
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp
! This file was ported from Lean 3 source module linear_algebra.matrix.ldl
-! leanprover-community/mathlib commit 3fc0b254310908f70a1a75f01147d52e53e9f8a2
+! leanprover-community/mathlib commit 9f0d61b4475e3c3cba6636ab51cdb1f3949d2e1d
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -37,9 +37,8 @@ variable {π : Type _} [IsROrC π]
variable {n : Type _} [LinearOrder n] [IsWellOrder n (Β· < Β·)] [LocallyFiniteOrderBot n]
--- mathport name: Β«exprβͺ , β«Β»
-local notation "βͺ" x ", " y "β«" =>
- @inner π (n β π) (PiLp.innerProductSpace fun _ => π).toHasInner x y
+-- mathport name: Β«exprβͺ , β«βΒ»
+local notation "βͺ" x ", " y "β«β" => @inner π _ _ ((PiLp.equiv 2 _).symm x) ((PiLp.equiv _ _).symm y)
open Matrix
@@ -51,8 +50,7 @@ variable {S : Matrix n n π} [Fintype n] (hS : S.PosDef)
applying Gram-Schmidt-Orthogonalization w.r.t. the inner product induced by `Sα΅` on the standard
basis vectors `pi.basis_fun`. -/
noncomputable def LDL.lowerInv : Matrix n n π :=
- @gramSchmidt π (n β π) _ (InnerProductSpace.ofMatrix hS.transpose) n _ _ _ fun k =>
- Pi.basisFun π n k
+ @gramSchmidt π (n β π) _ (InnerProductSpace.ofMatrix hS.transpose) n _ _ _ (Pi.basisFun π n)
#align LDL.lower_inv LDL.lowerInv
theorem LDL.lowerInv_eq_gramSchmidtBasis :
@@ -77,7 +75,7 @@ noncomputable instance LDL.invertibleLowerInv : Invertible (LDL.lowerInv hS) :=
#align LDL.invertible_lower_inv LDL.invertibleLowerInv
theorem LDL.lowerInv_orthogonal {i j : n} (hβ : i β j) :
- βͺLDL.lowerInv hS i, Sα΅.mulVec (LDL.lowerInv hS j)β« = 0 :=
+ βͺLDL.lowerInv hS i, Sα΅.mulVec (LDL.lowerInv hS j)β«β = 0 :=
show
@inner π (n β π) (InnerProductSpace.ofMatrix hS.transpose).toHasInner (LDL.lowerInv hS i)
(LDL.lowerInv hS j) =
@@ -87,7 +85,7 @@ theorem LDL.lowerInv_orthogonal {i j : n} (hβ : i β j) :
/-- The entries of the diagonal matrix `D` of the LDL decomposition. -/
noncomputable def LDL.diagEntries : n β π := fun i =>
- βͺstar (LDL.lowerInv hS i), S.mulVec (star (LDL.lowerInv hS i))β«
+ βͺstar (LDL.lowerInv hS i), S.mulVec (star (LDL.lowerInv hS i))β«β
#align LDL.diag_entries LDL.diagEntries
/-- The diagonal matrix `D` of the LDL decomposition. -/
@@ -109,12 +107,12 @@ theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL
ext (i j)
by_cases hij : i = j
Β·
- simpa only [hij, LDL.diag, diagonal_apply_eq, LDL.diagEntries, Matrix.mul_assoc, inner,
- Pi.star_apply, IsROrC.star_def, starRingEnd_self_apply]
+ simpa only [hij, LDL.diag, diagonal_apply_eq, LDL.diagEntries, Matrix.mul_assoc,
+ EuclideanSpace.inner_piLp_equiv_symm, star_star]
Β· simp only [LDL.diag, hij, diagonal_apply_ne, Ne.def, not_false_iff, mul_mul_apply]
rw [conj_transpose, transpose_map, transpose_transpose, dot_product_mul_vec,
(LDL.lowerInv_orthogonal hS fun h : j = i => hij h.symm).symm, β inner_conj_symm,
- mul_vec_transpose, EuclideanSpace.inner_eq_star_dotProduct, β IsROrC.star_def, β
+ mul_vec_transpose, EuclideanSpace.inner_piLp_equiv_symm, β IsROrC.star_def, β
star_dot_product_star, dot_product_comm, star_star]
rfl
#align LDL.diag_eq_lower_inv_conj LDL.diag_eq_lowerInv_conj
mathlib commit https://github.com/leanprover-community/mathlib/commit/1a313d8bba1bad05faba71a4a4e9742ab5bd9efd
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp
! This file was ported from Lean 3 source module linear_algebra.matrix.ldl
-! leanprover-community/mathlib commit 0fc5496584478976b86f17941b3ff25ad7c4ebd6
+! leanprover-community/mathlib commit 3fc0b254310908f70a1a75f01147d52e53e9f8a2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -113,7 +113,7 @@ theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL
Pi.star_apply, IsROrC.star_def, starRingEnd_self_apply]
Β· simp only [LDL.diag, hij, diagonal_apply_ne, Ne.def, not_false_iff, mul_mul_apply]
rw [conj_transpose, transpose_map, transpose_transpose, dot_product_mul_vec,
- (LDL.lowerInv_orthogonal hS fun h : j = i => hij h.symm).symm, β inner_conj_sym,
+ (LDL.lowerInv_orthogonal hS fun h : j = i => hij h.symm).symm, β inner_conj_symm,
mul_vec_transpose, EuclideanSpace.inner_eq_star_dotProduct, β IsROrC.star_def, β
star_dot_product_star, dot_product_comm, star_star]
rfl
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -105,7 +105,7 @@ theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS * S * (LDL.low
Β· simp only [diag, diagEntries, EuclideanSpace.inner_piLp_equiv_symm, star_star, hij,
diagonal_apply_eq, Matrix.mul_assoc]
rfl
- Β· simp only [LDL.diag, hij, diagonal_apply_ne, Ne.def, not_false_iff, mul_mul_apply]
+ Β· simp only [LDL.diag, hij, diagonal_apply_ne, Ne, not_false_iff, mul_mul_apply]
rw [conjTranspose, transpose_map, transpose_transpose, dotProduct_mulVec,
(LDL.lowerInv_orthogonal hS fun h : j = i => hij h.symm).symm, β inner_conj_symm,
mulVec_transpose, EuclideanSpace.inner_piLp_equiv_symm, β RCLike.star_def, β
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
.
@@ -30,7 +30,7 @@ decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a d
-/
-variable {π : Type*} [IsROrC π]
+variable {π : Type*} [RCLike π]
variable {n : Type*} [LinearOrder n] [IsWellOrder n (Β· < Β·)] [LocallyFiniteOrderBot n]
section set_options
@@ -108,7 +108,7 @@ theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS * S * (LDL.low
Β· simp only [LDL.diag, hij, diagonal_apply_ne, Ne.def, not_false_iff, mul_mul_apply]
rw [conjTranspose, transpose_map, transpose_transpose, dotProduct_mulVec,
(LDL.lowerInv_orthogonal hS fun h : j = i => hij h.symm).symm, β inner_conj_symm,
- mulVec_transpose, EuclideanSpace.inner_piLp_equiv_symm, β IsROrC.star_def, β
+ mulVec_transpose, EuclideanSpace.inner_piLp_equiv_symm, β RCLike.star_def, β
star_dotProduct_star, dotProduct_comm, star_star]
rfl
#align LDL.diag_eq_lower_inv_conj LDL.diag_eq_lowerInv_conj
Empty lines were removed by executing the following Python script twice
import os
import re
# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
for filename in files:
if filename.endswith('.lean'):
file_path = os.path.join(dir_path, filename)
# Open the file and read its contents
with open(file_path, 'r') as file:
content = file.read()
# Use a regular expression to replace sequences of "variable" lines separated by empty lines
# with sequences without empty lines
modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)
# Write the modified content back to the file
with open(file_path, 'w') as file:
file.write(modified_content)
@@ -31,7 +31,6 @@ decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a d
variable {π : Type*} [IsROrC π]
-
variable {n : Type*} [LinearOrder n] [IsWellOrder n (Β· < Β·)] [LocallyFiniteOrderBot n]
section set_options
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>
@@ -77,13 +77,13 @@ noncomputable instance LDL.invertibleLowerInv : Invertible (LDL.lowerInv hS) :=
#align LDL.invertible_lower_inv LDL.invertibleLowerInv
theorem LDL.lowerInv_orthogonal {i j : n} (hβ : i β j) :
- βͺLDL.lowerInv hS i, Sα΅.mulVec (LDL.lowerInv hS j)β«β = 0 :=
+ βͺLDL.lowerInv hS i, Sα΅ *α΅₯ LDL.lowerInv hS jβ«β = 0 :=
@gramSchmidt_orthogonal π _ _ (_ : _) (InnerProductSpace.ofMatrix hS.transpose) _ _ _ _ _ _ _ hβ
#align LDL.lower_inv_orthogonal LDL.lowerInv_orthogonal
/-- The entries of the diagonal matrix `D` of the LDL decomposition. -/
noncomputable def LDL.diagEntries : n β π := fun i =>
- βͺstar (LDL.lowerInv hS i), S.mulVec (star (LDL.lowerInv hS i))β«β
+ βͺstar (LDL.lowerInv hS i), S *α΅₯ star (LDL.lowerInv hS i)β«β
#align LDL.diag_entries LDL.diagEntries
/-- The diagonal matrix `D` of the LDL decomposition. -/
This removes the (PiLp.equiv 2 fun i => Ξ± i)
abbreviation, replacing it with its implementation (WithLp.equiv 2 (β i, Ξ± i))
. The same thing is done for PiLp.linearEquiv
.
@@ -38,7 +38,8 @@ section set_options
set_option linter.uppercaseLean3 false
set_option quotPrecheck false
-local notation "βͺ" x ", " y "β«β" => @inner π _ _ ((PiLp.equiv 2 _).symm x) ((PiLp.equiv _ _).symm y)
+local notation "βͺ" x ", " y "β«β" =>
+ @inner π _ _ ((WithLp.equiv 2 _).symm x) ((WithLp.equiv _ _).symm y)
open Matrix
I assume this is mathematically sound, though right now we can't generalize many dependencies due to the reliance of InnerProductSpace
.
@@ -42,7 +42,7 @@ local notation "βͺ" x ", " y "β«β" => @inner π _ _ ((PiLp.equiv 2 _).symm
open Matrix
-open scoped Matrix
+open scoped Matrix ComplexOrder
variable {S : Matrix n n π} [Fintype n] (hS : S.PosDef)
β¬
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).
@@ -99,7 +99,7 @@ theorem LDL.lowerInv_triangular {i j : n} (hij : i < j) : LDL.lowerInv hS i j =
/-- Inverse statement of **LDL decomposition**: we can conjugate a positive definite matrix
by some lower triangular matrix and get a diagonal matrix. -/
-theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL.lowerInv hS)α΄΄ := by
+theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS * S * (LDL.lowerInv hS)α΄΄ := by
ext i j
by_cases hij : i = j
Β· simp only [diag, diagEntries, EuclideanSpace.inner_piLp_equiv_symm, star_star, hij,
@@ -120,7 +120,7 @@ noncomputable def LDL.lower :=
/-- **LDL decomposition**: any positive definite matrix `S` can be
decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a diagonal matrix. -/
-theorem LDL.lower_conj_diag : LDL.lower hS β¬ LDL.diag hS β¬ (LDL.lower hS)α΄΄ = S := by
+theorem LDL.lower_conj_diag : LDL.lower hS * LDL.diag hS * (LDL.lower hS)α΄΄ = S := by
rw [LDL.lower, conjTranspose_nonsing_inv, Matrix.mul_assoc,
Matrix.inv_mul_eq_iff_eq_mul_of_invertible (LDL.lowerInv hS),
Matrix.mul_inv_eq_iff_eq_mul_of_invertible]
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -30,9 +30,9 @@ decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a d
-/
-variable {π : Type _} [IsROrC π]
+variable {π : Type*} [IsROrC π]
-variable {n : Type _} [LinearOrder n] [IsWellOrder n (Β· < Β·)] [LocallyFiniteOrderBot n]
+variable {n : Type*} [LinearOrder n] [IsWellOrder n (Β· < Β·)] [LocallyFiniteOrderBot n]
section set_options
@@ -2,15 +2,12 @@
Copyright (c) 2022 Alexander Bentkamp. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alexander Bentkamp
-
-! This file was ported from Lean 3 source module linear_algebra.matrix.ldl
-! leanprover-community/mathlib commit 46b633fd842bef9469441c0209906f6dddd2b4f5
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho
import Mathlib.LinearAlgebra.Matrix.PosDef
+#align_import linear_algebra.matrix.ldl from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
+
/-! # LDL decomposition
This file proves the LDL-decomposition of matrices: Any positive definite matrix `S` can be
ext
(#5258)
Co-authored-by: Xavier Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: JoΓ«l Riou <joel.riou@universite-paris-saclay.fr> Co-authored-by: Riccardo Brasca <riccardo.brasca@gmail.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Pol'tta / Miyahara KΕ <pol_tta@outlook.jp> Co-authored-by: Jason Yuen <jason_yuen2007@hotmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Jireh Loreaux <loreaujy@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Heather Macbeth <25316162+hrmacbeth@users.noreply.github.com> Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com> Co-authored-by: YaΓ«l Dillies <yael.dillies@gmail.com>
@@ -64,7 +64,7 @@ theorem LDL.lowerInv_eq_gramSchmidtBasis :
(Pi.basisFun π n)))α΅ := by
letI := NormedAddCommGroup.ofMatrix hS.transpose
letI := InnerProductSpace.ofMatrix hS.transpose
- ext (i j)
+ ext i j
rw [LDL.lowerInv, Basis.coePiBasisFun.toMatrix_eq_transpose, coe_gramSchmidtBasis]
rfl
#align LDL.lower_inv_eq_gram_schmidt_basis LDL.lowerInv_eq_gramSchmidtBasis
@@ -103,7 +103,7 @@ theorem LDL.lowerInv_triangular {i j : n} (hij : i < j) : LDL.lowerInv hS i j =
/-- Inverse statement of **LDL decomposition**: we can conjugate a positive definite matrix
by some lower triangular matrix and get a diagonal matrix. -/
theorem LDL.diag_eq_lowerInv_conj : LDL.diag hS = LDL.lowerInv hS β¬ S β¬ (LDL.lowerInv hS)α΄΄ := by
- ext (i j)
+ ext i j
by_cases hij : i = j
Β· simp only [diag, diagEntries, EuclideanSpace.inner_piLp_equiv_symm, star_star, hij,
diagonal_apply_eq, Matrix.mul_assoc]
@@ -13,7 +13,7 @@ import Mathlib.LinearAlgebra.Matrix.PosDef
/-! # LDL decomposition
-This file proves the LDL-decomposition of matricies: Any positive definite matrix `S` can be
+This file proves the LDL-decomposition of matrices: Any positive definite matrix `S` can be
decomposed as `S = LDLα΄΄` where `L` is a lower-triangular matrix and `D` is a diagonal matrix.
## Main definitions
The unported dependencies are
algebra.order.module
init.core
linear_algebra.free_module.finite.rank
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
linear_algebra.free_module.rank
algebra.order.monoid.cancel.basic
init.data.list.default
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file