l3lab/ntp-mathlib huggingface dataset:
/-- The canonical map out of a direct sum of a family of submodules is injective when the submodules
are `CompleteLattice.Independent`.

Note that this is not generally true for `[Semiring R]`, for instance when `A` is the
`ℕ`-submodules of the positive and negative integers.

See `Counterexamples/DirectSumIsInternal.lean` for a proof of this fact. -/
theorem Independent.dfinsupp_lsum_injective {p : ι → Submodule R N} (h : Independent p) :
    Function.Injective (lsum ℕ (M := fun i ↦ ↥(p i)) fun i => (p i).subtype) := by
  -- simplify everything down to binders over equalities in `N`
  rw [independent_iff_forall_dfinsupp] at h
  suffices LinearMap.ker (lsum ℕ (M := fun i ↦ ↥(p i)) fun i => (p i).subtype) = ⊥ by
    -- Lean can't find this without our help
    letI thisI : AddCommGroup (Π₀ i, p i) := inferInstance
    rw [LinearMap.ker_eq_bot] at this
    exact this
  rw [LinearMap.ker_eq_bot']
  intro m hm
  ext i : 1
  -- split `m` into the piece at `i` and the pieces elsewhere, to match `h`
  rw [DFinsupp.zero_apply, ← neg_eq_zero]
  

Proof state:
case h
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝² : Ring R
inst✝¹ : AddCommGroup N
inst✝ : Module R N
p : ι → Submodule R N
h :
  ∀ (i : ι) (x : ↥(p i)) (v : Π₀ (i : ι), ↥(p i)), ((lsum ℕ) fun i => Submodule.subtype (p i)) (erase i v) = ↑x → x = 0
m : Π₀ (i : ι), ↥(p i)
hm : ((lsum ℕ) fun i => Submodule.subtype (p i)) m = 0
i : ι
⊢ -m i = 0

Next tactic:
refine' h i (-m i) m _
/-- The canonical map out of a direct sum of a family of submodules is injective when the submodules
are `CompleteLattice.Independent`.

Note that this is not generally true for `[Semiring R]`, for instance when `A` is the
`ℕ`-submodules of the positive and negative integers.

See `Counterexamples/DirectSumIsInternal.lean` for a proof of this fact. -/
theorem Independent.dfinsupp_lsum_injective {p : ι → Submodule R N} (h : Independent p) :
    Function.Injective (lsum ℕ (M := fun i ↦ ↥(p i)) fun i => (p i).subtype) := by
  -- simplify everything down to binders over equalities in `N`
  rw [independent_iff_forall_dfinsupp] at h
  suffices LinearMap.ker (lsum ℕ (M := fun i ↦ ↥(p i)) fun i => (p i).subtype) = ⊥ by
    -- Lean can't find this without our help
    letI thisI : AddCommGroup (Π₀ i, p i) := inferInstance
    rw [LinearMap.ker_eq_bot] at this
    exact this
  rw [LinearMap.ker_eq_bot']
  intro m hm
  ext i : 1
  -- split `m` into the piece at `i` and the pieces elsewhere, to match `h`
  rw [DFinsupp.zero_apply, ← neg_eq_zero]
  refine' h i (-m i) m _
  

Proof state:
case h
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝² : Ring R
inst✝¹ : AddCommGroup N
inst✝ : Module R N
p : ι → Submodule R N
h :
  ∀ (i : ι) (x : ↥(p i)) (v : Π₀ (i : ι), ↥(p i)), ((lsum ℕ) fun i => Submodule.subtype (p i)) (erase i v) = ↑x → x = 0
m : Π₀ (i : ι), ↥(p i)
hm : ((lsum ℕ) fun i => Submodule.subtype (p i)) m = 0
i : ι
⊢ ((lsum ℕ) fun i => Submodule.subtype (p i)) (erase i m) = ↑(-m i)

Next tactic:
rwa [← erase_add_single i m, LinearMap.map_add, lsum_single, Submodule.subtype_apply,
    add_eq_zero_iff_eq_neg, ← Submodule.coe_neg] at hm
/-- The canonical map out of a direct sum of a family of additive subgroups is injective when the
additive subgroups are `CompleteLattice.Independent`. -/
theorem Independent.dfinsupp_sumAddHom_injective {p : ι → AddSubgroup N} (h : Independent p) :
    Function.Injective (sumAddHom fun i => (p i).subtype) := by
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝² : Ring R
inst✝¹ : AddCommGroup N
inst✝ : Module R N
p : ι → AddSubgroup N
h : Independent p
⊢ Function.Injective ⇑(sumAddHom fun i => AddSubgroup.subtype (p i))

Next tactic:
rw [← independent_map_orderIso_iff (AddSubgroup.toIntSubmodule : AddSubgroup N ≃o _)] at h
/-- The canonical map out of a direct sum of a family of additive subgroups is injective when the
additive subgroups are `CompleteLattice.Independent`. -/
theorem Independent.dfinsupp_sumAddHom_injective {p : ι → AddSubgroup N} (h : Independent p) :
    Function.Injective (sumAddHom fun i => (p i).subtype) := by
  rw [← independent_map_orderIso_iff (AddSubgroup.toIntSubmodule : AddSubgroup N ≃o _)] at h
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝² : Ring R
inst✝¹ : AddCommGroup N
inst✝ : Module R N
p : ι → AddSubgroup N
h : Independent (⇑AddSubgroup.toIntSubmodule ∘ p)
⊢ Function.Injective ⇑(sumAddHom fun i => AddSubgroup.subtype (p i))

Next tactic:
exact h.dfinsupp_lsum_injective
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
⊢ LinearIndependent R v

Next tactic:
let _ := Classical.decEq ι
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝ : DecidableEq ι := Classical.decEq ι
⊢ LinearIndependent R v

Next tactic:
let _ := Classical.decEq R
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
⊢ LinearIndependent R v

Next tactic:
rw [linearIndependent_iff]
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
⊢ ∀ (l : ι →₀ R), (Finsupp.total ι N R v) l = 0 → l = 0

Next tactic:
intro l hl
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
⊢ l = 0

Next tactic:
let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
⊢ l = 0

Next tactic:
have ha : a = 0 := by
    apply hp.dfinsupp_lsum_injective
    rwa [← lsum_comp_mapRange_toSpanSingleton _ hv] at hl
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  have ha : a = 0 := by
    

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
⊢ a = 0

Next tactic:
apply hp.dfinsupp_lsum_injective
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  have ha : a = 0 := by
    apply hp.dfinsupp_lsum_injective
    

Proof state:
case a
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
⊢ ((lsum ℕ) fun i => Submodule.subtype (p i)) a = ((lsum ℕ) fun i => Submodule.subtype (p i)) 0

Next tactic:
rwa [← lsum_comp_mapRange_toSpanSingleton _ hv] at hl
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  have ha : a = 0 := by
    apply hp.dfinsupp_lsum_injective
    rwa [← lsum_comp_mapRange_toSpanSingleton _ hv] at hl
  

Proof state:
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
ha : a = 0
⊢ l = 0

Next tactic:
ext i
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  have ha : a = 0 := by
    apply hp.dfinsupp_lsum_injective
    rwa [← lsum_comp_mapRange_toSpanSingleton _ hv] at hl
  ext i
  

Proof state:
case h
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
ha : a = 0
i : ι
⊢ l i = 0 i

Next tactic:
apply smul_left_injective R (hv' i)
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  have ha : a = 0 := by
    apply hp.dfinsupp_lsum_injective
    rwa [← lsum_comp_mapRange_toSpanSingleton _ hv] at hl
  ext i
  apply smul_left_injective R (hv' i)
  

Proof state:
case h.a
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
ha : a = 0
i : ι
⊢ (fun c => c • v i) (l i) = (fun c => c • v i) (0 i)

Next tactic:
have : l i • v i = a i := rfl
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  have ha : a = 0 := by
    apply hp.dfinsupp_lsum_injective
    rwa [← lsum_comp_mapRange_toSpanSingleton _ hv] at hl
  ext i
  apply smul_left_injective R (hv' i)
  have : l i • v i = a i := rfl
  

Proof state:
case h.a
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
ha : a = 0
i : ι
this : l i • v i = ↑(a i)
⊢ (fun c => c • v i) (l i) = (fun c => c • v i) (0 i)

Next tactic:
simp only [coe_zero, Pi.zero_apply, ZeroMemClass.coe_zero, smul_eq_zero, ha] at this
/-- If a family of submodules is `Independent`, then a choice of nonzero vector from each submodule
forms a linearly independent family.

See also `CompleteLattice.Independent.linearIndependent'`. -/
theorem Independent.linearIndependent [NoZeroSMulDivisors R N] (p : ι → Submodule R N)
    (hp : Independent p) {v : ι → N} (hv : ∀ i, v i ∈ p i) (hv' : ∀ i, v i ≠ 0) :
    LinearIndependent R v := by
  let _ := Classical.decEq ι
  let _ := Classical.decEq R
  rw [linearIndependent_iff]
  intro l hl
  let a :=
    DFinsupp.mapRange.linearMap (fun i => LinearMap.toSpanSingleton R (p i) ⟨v i, hv i⟩)
      l.toDFinsupp
  have ha : a = 0 := by
    apply hp.dfinsupp_lsum_injective
    rwa [← lsum_comp_mapRange_toSpanSingleton _ hv] at hl
  ext i
  apply smul_left_injective R (hv' i)
  have : l i • v i = a i := rfl
  simp only [coe_zero, Pi.zero_apply, ZeroMemClass.coe_zero, smul_eq_zero, ha] at this
  

Proof state:
case h.a
ι : Type u_1
R : Type u_2
S : Type u_3
M : ι → Type u_4
N : Type u_5
dec_ι : DecidableEq ι
inst✝³ : Ring R
inst✝² : AddCommGroup N
inst✝¹ : Module R N
inst✝ : NoZeroSMulDivisors R N
p : ι → Submodule R N
hp : Independent p
v : ι → N
hv : ∀ (i : ι), v i ∈ p i
hv' : ∀ (i : ι), v i ≠ 0
x✝¹ : DecidableEq ι := Classical.decEq ι
x✝ : DecidableEq R := Classical.decEq R
l : ι →₀ R
hl : (Finsupp.total ι N R v) l = 0
a : Π₀ (i : ι), ↥(p i) :=
  (mapRange.linearMap fun i => LinearMap.toSpanSingleton R ↥(p i) { val := v i, property := (_ : v i ∈ p i) })
    (Finsupp.toDFinsupp l)
ha : a = 0
i : ι
this : l i = 0 ∨ v i = 0
⊢ (fun c => c • v i) (l i) = (fun c => c • v i) (0 i)

Next tactic:
simpa
@[to_additive]
theorem diff_mul_diff : diff ϕ R S * diff ϕ S T = diff ϕ R T :=
  prod_mul_distrib.symm.trans
    (prod_congr rfl fun q _ =>
      (ϕ.map_mul _ _).symm.trans
        (congr_arg ϕ
          (by 

Proof state:
G : Type u_1
inst✝² : Group G
H : Subgroup G
A : Type u_2
inst✝¹ : CommGroup A
ϕ : ↥H →* A
R S T : ↑(leftTransversals ↑H)
inst✝ : FiniteIndex H
q : G ⧸ H
x✝ : q ∈ univ
⊢ {
        val :=
          (↑((MemLeftTransversals.toEquiv (_ : ↑R ∈ leftTransversals ↑H)) q))⁻¹ *
            ↑((MemLeftTransversals.toEquiv (_ : ↑S ∈ leftTransversals ↑H)) q),
        property :=
          (_ :
            (↑((MemLeftTransversals.toEquiv (_ : ↑R ∈ leftTransversals ↑H)) q))⁻¹ *
                ↑((MemLeftTransversals.toEquiv (_ : ↑S ∈ leftTransversals ↑H)) q) ∈
              H) } *
      {
        val :=
          (↑((MemLeftTransversals.toEquiv (_ : ↑S ∈ leftTransversals ↑H)) q))⁻¹ *
            ↑((MemLeftTransversals.toEquiv (_ : ↑T ∈ leftTransversals ↑H)) q),
        property :=
          (_ :
            (↑((MemLeftTransversals.toEquiv (_ : ↑S ∈ leftTransversals ↑H)) q))⁻¹ *
                ↑((MemLeftTransversals.toEquiv (_ : ↑T ∈ leftTransversals ↑H)) q) ∈
              H) } =
    {
      val :=
        (↑((MemLeftTransversals.toEquiv (_ : ↑R ∈ leftTransversals ↑H)) q))⁻¹ *
          ↑((MemLeftTransversals.toEquiv (_ : ↑T ∈ leftTransversals ↑H)) q),
      property :=
        (_ :
          (↑((MemLeftTransversals.toEquiv (_ : ↑R ∈ leftTransversals ↑H)) q))⁻¹ *
              ↑((MemLeftTransversals.toEquiv (_ : ↑T ∈ leftTransversals ↑H)) q) ∈
            H) }

Next tactic:
simp_rw [Subtype.ext_iff, coe_mul, mul_assoc, mul_inv_cancel_left]
@[to_additive]
theorem smul_diff_smul (g : G) : diff ϕ (g • S) (g • T) = diff ϕ S T :=
  let _ := H.fintypeQuotientOfFiniteIndex
  prod_bij' (fun q _ => g⁻¹ • q) (fun _ _ => mem_univ _)
    (fun _ _ =>
      congr_arg ϕ
        (by
          

Proof state:
G : Type u_1
inst✝² : Group G
H : Subgroup G
A : Type u_2
inst✝¹ : CommGroup A
ϕ : ↥H →* A
R S T : ↑(leftTransversals ↑H)
inst✝ : FiniteIndex H
g : G
x✝² : Fintype (G ⧸ H) := fintypeQuotientOfFiniteIndex H
x✝¹ : G ⧸ H
x✝ : x✝¹ ∈ univ
⊢ {
      val :=
        (↑((MemLeftTransversals.toEquiv (_ : ↑(g • S) ∈ leftTransversals ↑H)) x✝¹))⁻¹ *
          ↑((MemLeftTransversals.toEquiv (_ : ↑(g • T) ∈ leftTransversals ↑H)) x✝¹),
      property :=
        (_ :
          (↑((MemLeftTransversals.toEquiv (_ : ↑(g • S) ∈ leftTransversals ↑H)) x✝¹))⁻¹ *
              ↑((MemLeftTransversals.toEquiv (_ : ↑(g • T) ∈ leftTransversals ↑H)) x✝¹) ∈
            H) } =
    {
      val :=
        (↑((MemLeftTransversals.toEquiv (_ : ↑S ∈ leftTransversals ↑H)) ((fun q x => g⁻¹ • q) x✝¹ x✝)))⁻¹ *
          ↑((MemLeftTransversals.toEquiv (_ : ↑T ∈ leftTransversals ↑H)) ((fun q x => g⁻¹ • q) x✝¹ x✝)),
      property :=
        (_ :
          (↑((MemLeftTransversals.toEquiv (_ : ↑S ∈ leftTransversals ↑H)) ((fun q x => g⁻¹ • q) x✝¹ x✝)))⁻¹ *
              ↑((MemLeftTransversals.toEquiv (_ : ↑T ∈ leftTransversals ↑H)) ((fun q x => g⁻¹ • q) x✝¹ x✝)) ∈
            H) }

Next tactic:
simp_rw [smul_apply_eq_smul_apply_inv_smul, smul_eq_mul, mul_inv_rev, mul_assoc,
            inv_mul_cancel_left]