Repository navigation
feat(LinearAlgebra): accretive matrices - #46486
Rida-Hamadani wants to merge 1 commit into
Conversation
PR summary 42f7d3d58aImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
| Current number | Change | Type (weak) |
|---|---|---|
| 5153 | 1 | exposed public sections |
Current commit 42f7d3d58a
Reference commit 4694f18024
This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
|
||
| A matrix `M` is accretive if `xᴴMx` is non-negative for all `x`, and strictly accretive if `xᴴMx` | ||
| is positive for all non-zero `x`. | ||
|
|
There was a problem hiding this comment.
maybe mention here that we can use this when positive (semi-)definiteness is too strong and when we don't need the matrix to be Hermitian?
| theorem submatrix {M : Matrix n n R} (hM : M.IsAccretive) (e : m → n) : | ||
| (M.submatrix e e).IsAccretive := by | ||
| intro x | ||
| simpa [Finsupp.sum_mapDomain_index, add_mul, mul_add] using hM <| x.mapDomain e | ||
|
|
||
| theorem transpose {M : Matrix n n R'} (hM : M.IsAccretive) : Mᵀ.IsAccretive := by |
|
|
||
| /-- A finite matrix `M : Matrix n n R` is accretive iff it is `xᴴ * M * x` is non-negative for | ||
| all `x`. -/ | ||
| @[simp] theorem isAccretive_iff_dotProduct_mulVec {M : Matrix n n R} : |
| simpa [Finsupp.sum_mapDomain_index, add_mul, mul_add] using hM <| x.mapDomain e | ||
|
|
||
| theorem transpose {M : Matrix n n R'} (hM : M.IsAccretive) : Mᵀ.IsAccretive := by | ||
| have (a b c : R') : a * b * c = c * b * a := by ring |
There was a problem hiding this comment.
Does by exact? return anything, by pure chance? Sometimes these theorems happen to have names.
| IsAccretive (ofNat(d) : Matrix n n R) := | ||
| .natCast d | ||
|
|
||
| protected theorem intCast [StarOrderedRing R] [DecidableEq n] (d : ℤ) (hd : 0 ≤ d) : |
There was a problem hiding this comment.
Does this not follow immediately from d = diagonal d?
| protected lemma one [StarOrderedRing R] [DecidableEq n] : IsAccretive (1 : Matrix n n R) := | ||
| fun _ ↦ Finsupp.sum_nonneg fun i _ ↦ Finsupp.sum_nonneg fun j _ ↦ by | ||
| obtain rfl | hij := eq_or_ne i j <;> simp [*] | ||
|
|
||
| protected theorem natCast [StarOrderedRing R] [DecidableEq n] (d : ℕ) : | ||
| IsAccretive (d : Matrix n n R) := | ||
| fun _ ↦ Finsupp.sum_nonneg fun i _ ↦ Finsupp.sum_nonneg fun j _ ↦ by | ||
| obtain rfl | hij := eq_or_ne i j <;> simp [← diagonal_natCast', star_left_conjugate_nonneg, *] | ||
|
|
||
| protected theorem ofNat [StarOrderedRing R] [DecidableEq n] (d : ℕ) [d.AtLeastTwo] : | ||
| IsAccretive (ofNat(d) : Matrix n n R) := | ||
| .natCast d |
There was a problem hiding this comment.
These are all corollaries of the intCast theorem, right?
| end IsAccretive | ||
|
|
||
| @[simp] | ||
| theorem isAccretive_submatrix_equiv {M : Matrix n n R} (e : m ≃ n) : |
There was a problem hiding this comment.
can you move this right after IsAccretive.submatrix?
| (M.submatrix e e).IsAccretive ↔ M.IsAccretive := | ||
| ⟨fun h ↦ by simpa using h.submatrix e.symm, fun h ↦ h.submatrix _⟩ | ||
|
|
||
| theorem isAccretive_sum {ι : Type*} [AddLeftMono R] |
There was a problem hiding this comment.
You can prove this almost immediately with AddSubmonoid.sum_mem.
| IsStrictlyAccretive (diagonal d) ↔ ∀ i, 0 < d i := | ||
| ⟨fun h i ↦ by simpa using h (x := .single i 1), .diagonal⟩ | ||
|
|
||
| @[simp, nontriviality] |
There was a problem hiding this comment.
Can't imagine this is very performant as a simp lemma, because it will fire often and fail often.
| rw [Finset.sum_insert hins] | ||
| by_cases h : ¬ hi.Nonempty | ||
| · simp_all | ||
| · exact IsStrictlyAccretive.add (hA _ <| Finset.mem_insert_self i hi) <| | ||
| H (not_not.mp h) fun _ _hi => hA _ (Finset.mem_insert_of_mem _hi) |
There was a problem hiding this comment.
| rw [Finset.sum_insert hins] | |
| by_cases h : ¬ hi.Nonempty | |
| · simp_all | |
| · exact IsStrictlyAccretive.add (hA _ <| Finset.mem_insert_self i hi) <| | |
| H (not_not.mp h) fun _ _hi => hA _ (Finset.mem_insert_of_mem _hi) | |
| rw [Finset.sum_insert hins] | |
| by_cases h : ¬ hi.Nonempty | |
| · simp_all | |
| · exact IsStrictlyAccretive.add (hA _ <| Finset.mem_insert_self i hi) <| | |
| H (not_not.mp h) fun _ _hi => hA _ (Finset.mem_insert_of_mem _hi) |
| namespace IsAccretive | ||
|
|
||
| omit [Fintype n] in | ||
| /-- A matrix `M : Matrix n n R` is accretive iff every finite principal submatrix is accretive. -/ |
There was a problem hiding this comment.
"principal" seems extraneous.
| omit [Fintype n] in | ||
| /-- A matrix `M : Matrix n n R` is accretive iff every finite principal submatrix is accretive. -/ | ||
| theorem _root_.Matrix.isAccretive_iff_submatrix_finset {M : Matrix n n R} : | ||
| M.IsAccretive ↔ ∀ s : Finset n, (M.submatrix (↑) (↑) : Matrix s s R).IsAccretive := by |
There was a problem hiding this comment.
Is this a very useful theorem in practice? The implication follows from IsAccretive.submatrix, and doesn't the converse follow from just plugging in s = univ?
Is this theorem true without the Fintype assumption?
| 0 < star x ⬝ᵥ (M *ᵥ x) := isStrictlyAccretive_iff_dotProduct_mulVec.mp hM hx | ||
|
|
||
| omit [Fintype n] in | ||
| /-- A matrix `M : Matrix n n R` is strictly accretive iff every finite principal submatrix is |
There was a problem hiding this comment.
again, "principal" seems extraneous.
|
Having just read the Zulip thread, it seems that this PR is blocked because the current definition: def IsAccretive (M : Matrix n n R) : Prop :=
∀ x : n →₀ R, 0 ≤ x.sum fun i xi ↦ x.sum fun j xj ↦ star xi * M i j * xjdoes not correspond to the definition of an accretive matrix in the informal literature in the case that If I've got that right, then I suppose one way to unblock things without a refactor would be to demand the "real part" function as a parameter in the base definition. E.g., something like: def IsAccretiveFor {R S : Type*} [CommRing S] [Ring R] [Algebra S R] [StarRing R] [PartialOrder S]
(re : R → S) (M : Matrix n n R) : Prop :=
∀ x : n →₀ R, 0 ≤ re (x.sum fun i xi ↦ x.sum fun j xj ↦ star xi * M i j * xj)Probably this is not worth it but I just thought I'd mention this. |
|
Or |
This is the positive semi-definite condition with the symmetry condition dropped. Strict version is also supplied. Discussion at #mathlib4 > Accretive matrices.