Skip to content

Commit 471a56e

Browse files
feat(Data.Matrix.Invertible): the binomial inverse theorem (#31507)
Proves the “binomial inverse theorem”, a variant of the Woodbury identity. This is one of the 1000+ list.
1 parent 00eaaa3 commit 471a56e

File tree

3 files changed

+92
-4
lines changed

3 files changed

+92
-4
lines changed

Mathlib/Data/Matrix/Invertible.lean

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,34 @@ protected theorem invOf_mul_cancel_right (A : Matrix m n α) (B : Matrix n n α)
4848
protected theorem mul_invOf_cancel_right (A : Matrix m n α) (B : Matrix n n α) [Invertible B] :
4949
A * B * ⅟B = A := by rw [Matrix.mul_assoc, mul_invOf_self, Matrix.mul_one]
5050

51+
/-- A copy oy of `invOf_mul_eq_iff_eq_mul_left` for rectangular matrices. -/
52+
protected theorem invOf_mul_eq_iff_eq_mul_left
53+
{A B : Matrix n m α} {C : Matrix n n α} [Invertible C] :
54+
⅟C * A = B ↔ A = C * B := by
55+
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
56+
· rw [← h, Matrix.mul_invOf_cancel_left]
57+
· rw [h, Matrix.invOf_mul_cancel_left]
58+
59+
/-- A copy oy of `mul_left_eq_iff_eq_invOf_mul` for rectangular matrices. -/
60+
protected theorem mul_left_eq_iff_eq_invOf_mul
61+
{A B : Matrix n m α} {C : Matrix n n α} [Invertible C] :
62+
C * A = B ↔ A = ⅟C * B := by
63+
rw [eq_comm, ← Matrix.invOf_mul_eq_iff_eq_mul_left, eq_comm]
64+
65+
/-- A copy oy of `mul_invOf_eq_iff_eq_mul_right` for rectangular matrices. -/
66+
protected theorem mul_invOf_eq_iff_eq_mul_right
67+
{A B : Matrix m n α} {C : Matrix n n α} [Invertible C] :
68+
A * ⅟C = B ↔ A = B * C := by
69+
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
70+
· rw [← h, Matrix.invOf_mul_cancel_right]
71+
· rw [h, Matrix.mul_invOf_cancel_right]
72+
73+
/-- A copy oy of `mul_right_eq_iff_eq_mul_invOf` for rectangular matrices. -/
74+
protected theorem mul_right_eq_iff_eq_mul_invOf
75+
{A B : Matrix m n α} {C : Matrix n n α} [Invertible C] :
76+
A * C = B ↔ A = B * ⅟C := by
77+
rw [eq_comm, ← Matrix.mul_invOf_eq_iff_eq_mul_right, eq_comm]
78+
5179
section ConjTranspose
5280
variable [StarRing α] (A : Matrix n n α)
5381

@@ -159,14 +187,59 @@ def invertibleAddMulMul : Invertible (A + U * C * V) where
159187
invOf_mul_self := add_mul_mul_invOf_mul_eq_one' _ _ _ _
160188
mul_invOf_self := add_mul_mul_invOf_mul_eq_one _ _ _ _
161189

162-
/-- The **Woodbury Identity** (`⅟` version). -/
190+
/-- The **Woodbury Identity** (`⅟` version).
191+
192+
See `Matrix.invOf_add_mul_mul'` for the Binomial Inverse Theorem. -/
163193
theorem invOf_add_mul_mul [Invertible (A + U * C * V)] :
164194
⅟(A + U * C * V) = ⅟A - ⅟A * U * ⅟(⅟C + V * ⅟A * U) * V * ⅟A := by
165195
letI := invertibleAddMulMul A U C V
166196
convert (rfl : ⅟(A + U * C * V) = _)
167197

168198
end Woodbury
169199

200+
section BinomialInverseTheorem
201+
202+
variable [Fintype m] [DecidableEq m] [Ring α]
203+
(A : Matrix n n α) (U : Matrix n m α) (C : Matrix m m α) (V : Matrix m n α)
204+
[Invertible A] [Invertible (C + C * V * ⅟A * U * C)]
205+
206+
lemma add_mul_mul_mul_invOf_eq_one :
207+
(A + U * C * V) * (⅟A - ⅟A * U * C * ⅟(C + C * V * ⅟A * U * C) * C * V * ⅟A) = 1 := by
208+
simp only [Matrix.mul_sub, Matrix.add_mul, mul_invOf_self']
209+
rw [add_sub_assoc, add_eq_left, sub_eq_zero]
210+
simp only [← Matrix.mul_assoc, mul_invOf_self', Matrix.one_mul]
211+
simp only [← Matrix.add_mul]
212+
congr
213+
rw [← Matrix.mul_right_eq_iff_eq_mul_invOf]
214+
simp only [Matrix.add_mul, Matrix.mul_add, Matrix.mul_assoc]
215+
216+
lemma add_mul_mul_mul_invOf_eq_one' :
217+
(⅟A - ⅟A * U * C * ⅟(C + C * V * ⅟A * U * C) * C * V * ⅟A) * (A + U * C * V) = 1 := by
218+
simp only [Matrix.mul_add, Matrix.sub_mul, invOf_mul_self']
219+
rw [sub_add, sub_eq_self, sub_eq_zero]
220+
simp only [Matrix.mul_assoc, ← Matrix.mul_sub]
221+
congr
222+
rw [eq_sub_iff_add_eq, ← Matrix.mul_add]
223+
rw [Matrix.invOf_mul_eq_iff_eq_mul_left]
224+
simp only [Matrix.add_mul, invOf_mul_self', Matrix.mul_one, add_right_inj]
225+
simp only [Matrix.mul_assoc]
226+
227+
/-- If matrices `A` and `C + C * V * A⁻¹ * U * C` are invertible, then so is `A + U * C * V`. -/
228+
def invertibleAddMulMul' : Invertible (A + U * C * V) where
229+
invOf := ⅟A - ⅟A * U * C * ⅟(C + C * V * ⅟A * U * C) * C * V * ⅟A
230+
invOf_mul_self := add_mul_mul_mul_invOf_eq_one' A U C V
231+
mul_invOf_self := add_mul_mul_mul_invOf_eq_one A U C V
232+
233+
/-- The **Binomial Inverse Theorem** (`⅟` version).
234+
235+
See `Matrix.invOf_add_mul_mul` for the Woodbury identity. -/
236+
theorem invOf_add_mul_mul' [Invertible (A + U * C * V)] :
237+
⅟(A + U * C * V) = ⅟A - ⅟A * U * C * ⅟(C + C * V * ⅟A * U * C) * C * V * ⅟A := by
238+
letI := invertibleAddMulMul' A U C V
239+
convert (rfl : ⅟(A + U * C * V) = _)
240+
241+
end BinomialInverseTheorem
242+
170243
end Ring
171244

172245
end Matrix

Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ theorem inv_mul_cancel_right_of_invertible (B : Matrix m n α) [Invertible A] :
260260
theorem inv_mul_cancel_left_of_invertible (B : Matrix n m α) [Invertible A] : A⁻¹ * (A * B) = B :=
261261
nonsing_inv_mul_cancel_left A B (isUnit_det_of_invertible A)
262262

263-
theorem inv_mul_eq_iff_eq_mul_of_invertible (A B C : Matrix n n α) [Invertible A] :
263+
theorem inv_mul_eq_iff_eq_mul_of_invertible (A : Matrix n n α) [Invertible A] (B C : Matrix n m α) :
264264
A⁻¹ * B = C ↔ B = A * C :=
265265
fun h => by rw [← h, mul_inv_cancel_left_of_invertible],
266266
fun h => by rw [h, inv_mul_cancel_left_of_invertible]⟩
267267

268-
theorem mul_inv_eq_iff_eq_mul_of_invertible (A B C : Matrix n n α) [Invertible A] :
268+
theorem mul_inv_eq_iff_eq_mul_of_invertible (A : Matrix n n α) [Invertible A] (B C : Matrix m n α) :
269269
B * A⁻¹ = C ↔ B = C * A :=
270270
fun h => by rw [← h, inv_mul_cancel_right_of_invertible],
271271
fun h => by rw [h, mul_inv_cancel_right_of_invertible]⟩
@@ -588,7 +588,9 @@ section Woodbury
588588
variable [Fintype m] [DecidableEq m]
589589
variable (A : Matrix n n α) (U : Matrix n m α) (C : Matrix m m α) (V : Matrix m n α)
590590

591-
/-- The **Woodbury Identity** (`⁻¹` version). -/
591+
/-- The **Woodbury Identity** (`⁻¹` version).
592+
593+
See ``add_mul_mul_inv_eq_sub'` for the binomial inverse theorem. -/
592594
theorem add_mul_mul_inv_eq_sub (hA : IsUnit A) (hC : IsUnit C) (hAC : IsUnit (C⁻¹ + V * A⁻¹ * U)) :
593595
(A + U * C * V)⁻¹ = A⁻¹ - A⁻¹ * U * (C⁻¹ + V * A⁻¹ * U)⁻¹ * V * A⁻¹ := by
594596
obtain ⟨_⟩ := hA.nonempty_invertible
@@ -599,6 +601,16 @@ theorem add_mul_mul_inv_eq_sub (hA : IsUnit A) (hC : IsUnit C) (hAC : IsUnit (C
599601
simp only [← invOf_eq_nonsing_inv]
600602
apply invOf_add_mul_mul
601603

604+
/-- The **binomial inverse theorem** (variant of the Woodbury identity). -/
605+
theorem add_mul_mul_inv_eq_sub' (hA : IsUnit A) (h : IsUnit (C + C * V * A⁻¹ * U * C)) :
606+
(A + U * C * V)⁻¹ = A⁻¹ - A⁻¹ * U * C * (C + C * V * A⁻¹ * U * C)⁻¹ * C * V * A⁻¹ := by
607+
obtain ⟨_⟩ := hA.nonempty_invertible
608+
obtain ⟨ih⟩ := h.nonempty_invertible
609+
simp only [← invOf_eq_nonsing_inv] at ih
610+
letI := invertibleAddMulMul' A U C V
611+
simp only [← invOf_eq_nonsing_inv]
612+
apply invOf_add_mul_mul'
613+
602614
end Woodbury
603615

604616
@[simp]

docs/1000.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,9 @@ Q1547975:
17041704

17051705
Q1551745:
17061706
title: Binomial inverse theorem
1707+
decl: Matrix.invOf_add_mul_mul'
1708+
authors: Antoine Chambert-Loir
1709+
date: 2025-11-11
17071710

17081711
Q1555342:
17091712
title: Reeh–Schlieder theorem

0 commit comments

Comments
 (0)