Skip to content

Commit 0ce5741

Browse files
committed
feat(LinearAlgebra/Span/Defs): replace Submodule.exists_add_eq_of_codisjoint with an iff (#26796)
Instead of introducing another theorem to go the other way, I have upgraded this one to an iff. The changed order of terms is preferable in my application (and probably others) because to prove the existential it is enough to provide the two witnesses first and leave everything else to simp.
1 parent 3551f9d commit 0ce5741

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Mathlib/LinearAlgebra/BilinearForm/Orthogonal.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ lemma ker_restrict_eq_of_codisjoint {p q : Submodule R M} (hpq : Codisjoint p q)
288288
simp only [LinearMap.mem_ker, Submodule.mem_comap, Submodule.coe_subtype]
289289
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
290290
· ext w
291-
obtain ⟨x, hx, y, hy, rfl⟩ := Submodule.exists_add_eq_of_codisjoint hpq w
291+
obtain ⟨x, y, hx, hy, rfl⟩ := Submodule.codisjoint_iff_exists_add_eq.mp hpq w
292292
simpa [hB z hz y hy] using LinearMap.congr_fun h ⟨x, hx⟩
293293
· ext ⟨x, hx⟩
294294
simpa using LinearMap.congr_fun h x

Mathlib/LinearAlgebra/PerfectPairing/Restrict.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ private lemma restrict_aux : Bijective (p.toLinearMap.compl₁₂ i j) := by
5454
· set F : Module.Dual R N := f ∘ₗ j.linearProjOfIsCompl _ hj hij.isCompl_right with hF
5555
have hF (n : N') : F (j n) = f n := by simp [hF]
5656
set m : M := p.toDualLeft.symm F with hm
57-
obtain ⟨-, ⟨m₀, rfl⟩, y, hy, hm'⟩ :=
58-
Submodule.exists_add_eq_of_codisjoint hij.isCompl_left.codisjoint m
57+
obtain ⟨-, y, ⟨m₀, rfl⟩, hy, hm'⟩ :=
58+
Submodule.codisjoint_iff_exists_add_eq.mp hij.isCompl_left.codisjoint m
5959
refine ⟨m₀, LinearMap.ext fun n ↦ ?_⟩
6060
replace hy : (p y) (j n) = 0 := by
6161
simp only [Submodule.mem_map, Submodule.mem_dualAnnihilator] at hy

Mathlib/LinearAlgebra/Span/Defs.lean

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,13 @@ theorem mem_sup : x ∈ p ⊔ p' ↔ ∃ y ∈ p, ∃ z ∈ p', y + z = x :=
349349
theorem mem_sup' : x ∈ p ⊔ p' ↔ ∃ (y : p) (z : p'), (y : M) + z = x :=
350350
mem_sup.trans <| by simp only [Subtype.exists, exists_prop]
351351

352-
lemma exists_add_eq_of_codisjoint (h : Codisjoint p p') (x : M) :
353-
∃ y ∈ p, ∃ z ∈ p', y + z = x := by
354-
suffices x ∈ p ⊔ p' by exact Submodule.mem_sup.mp this
355-
simpa only [h.eq_top] using Submodule.mem_top
352+
theorem codisjoint_iff_exists_add_eq :
353+
Codisjoint p p' ↔ ∀ z, ∃ x y, x ∈ p ∧ y ∈ p' ∧ x + y = z := by
354+
rw [codisjoint_iff, eq_top_iff']
355+
exact forall_congr' (fun z => mem_sup.trans <| by simp)
356+
357+
@[deprecated (since := "2025-07-05")]
358+
alias ⟨exists_add_eq_of_codisjoint, _⟩ := codisjoint_iff_exists_add_eq
356359

357360
variable (p p')
358361

0 commit comments

Comments
 (0)