Skip to content

Commit c3bb4de

Browse files
feat: add LinearIndependent.update (leanprover-community#40219)
From flt-regular.
1 parent 3c96a30 commit c3bb4de

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Mathlib/LinearAlgebra/LinearIndependent/Lemmas.lean

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,27 @@ theorem LinearIndependent.of_pairwise_dual_eq_zero_one (v : ι → M) (f : ι
523523

524524
end Module
525525

526+
open Finsupp in
527+
/-- A linearly independent family of vectors `f` remains linearly independent when we substitute one
528+
of the terms with a vector `m` provided there exists a non-zero divisor `r`, such that `r • m`
529+
belongs to the span of `f` with non-zero-divisor coefficients. -/
530+
lemma LinearIndependent.update [DecidableEq ι] [CommRing R] [AddCommGroup M] [Module R M]
531+
{f : ι → M} (hf : LinearIndependent R f) (i : ι) (m : M)
532+
(hg : ∃ r ∈ nonZeroDivisors R, ∃ l : ι →₀ R,
533+
l i ∈ nonZeroDivisors R ∧ r • m = linearCombination R f l) :
534+
LinearIndependent R (Function.update f i m) := by
535+
rw [linearIndependent_iff] at hf ⊢
536+
obtain ⟨r, hr, l, hl, hg⟩ := hg
537+
intros l' hl'
538+
apply_fun (r • ·) at hl'
539+
simp_rw [Pi.update_eq_sub_add_single, ← bilinearCombination_apply _ (S := R), map_add, map_sub,
540+
bilinearCombination_apply, LinearMap.add_apply, LinearMap.sub_apply,
541+
linearCombination_single_index, smul_add, smul_sub, smul_zero, smul_comm r (l' i) m,
542+
hg, ← LinearMap.map_smul, smul_smul, ← linearCombination_single, ← map_sub, ← map_add] at hl'
543+
replace hl' : ∀ j, (r * l' j - (single i (r * l' i)) j) + l' i * l j = 0 :=
544+
fun j ↦ DFunLike.congr_fun (hf _ hl') j
545+
grind [mem_nonZeroDivisors_iff]
546+
526547
/-!
527548
### Properties which require `DivisionRing K`
528549

0 commit comments

Comments
 (0)