l3lab/ntp-mathlib huggingface dataset:
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by 

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
e : (Finsupp.total ι M R ⇑b) (b.repr x) = x
i i' : ι
r : (fun i => { val := b i, property := (_ : b i ∈ w) }) i = (fun i => { val := b i, property := (_ : b i ∈ w) }) i'
⊢ b i = b i'

Next tactic:
simpa only [Subtype.mk_eq_mk] using r
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
e : (Finsupp.total ι M R ⇑b) (b.repr x) = x
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
⊢ False

Next tactic:
simp_rw [Finsupp.total_apply] at e
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  simp_rw [Finsupp.total_apply] at e
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
e : (Finsupp.sum (b.repr x) fun i a => a • b i) = x
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
⊢ False

Next tactic:
change ((b.repr x).sum fun (i : ι) (a : R) ↦ a • (u i : M)) = ((⟨x, p⟩ : w) : M) at e
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  simp_rw [Finsupp.total_apply] at e
  change ((b.repr x).sum fun (i : ι) (a : R) ↦ a • (u i : M)) = ((⟨x, p⟩ : w) : M) at e
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
e : (Finsupp.sum (b.repr x) fun i a => a • ↑(u i)) = ↑{ val := x, property := p }
⊢ False

Next tactic:
rw [← Finsupp.sum_embDomain (f := u) (g := fun x r ↦ r • (x : M)), ← Finsupp.total_apply] at e
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  simp_rw [Finsupp.total_apply] at e
  change ((b.repr x).sum fun (i : ι) (a : R) ↦ a • (u i : M)) = ((⟨x, p⟩ : w) : M) at e
  rw [← Finsupp.sum_embDomain (f := u) (g := fun x r ↦ r • (x : M)), ← Finsupp.total_apply] at e
  -- Now we can contradict the linear independence of `hi`
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
e : (Finsupp.total (↑w) M R fun x => ↑x) (Finsupp.embDomain u (b.repr x)) = ↑{ val := x, property := p }
⊢ False

Next tactic:
refine' hi.total_ne_of_not_mem_support _ _ e
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  simp_rw [Finsupp.total_apply] at e
  change ((b.repr x).sum fun (i : ι) (a : R) ↦ a • (u i : M)) = ((⟨x, p⟩ : w) : M) at e
  rw [← Finsupp.sum_embDomain (f := u) (g := fun x r ↦ r • (x : M)), ← Finsupp.total_apply] at e
  -- Now we can contradict the linear independence of `hi`
  refine' hi.total_ne_of_not_mem_support _ _ e
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
e : (Finsupp.total (↑w) M R fun x => ↑x) (Finsupp.embDomain u (b.repr x)) = ↑{ val := x, property := p }
⊢ { val := x, property := p } ∉ (Finsupp.embDomain u (b.repr x)).support

Next tactic:
simp only [Finset.mem_map, Finsupp.support_embDomain]
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  simp_rw [Finsupp.total_apply] at e
  change ((b.repr x).sum fun (i : ι) (a : R) ↦ a • (u i : M)) = ((⟨x, p⟩ : w) : M) at e
  rw [← Finsupp.sum_embDomain (f := u) (g := fun x r ↦ r • (x : M)), ← Finsupp.total_apply] at e
  -- Now we can contradict the linear independence of `hi`
  refine' hi.total_ne_of_not_mem_support _ _ e
  simp only [Finset.mem_map, Finsupp.support_embDomain]
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
e : (Finsupp.total (↑w) M R fun x => ↑x) (Finsupp.embDomain u (b.repr x)) = ↑{ val := x, property := p }
⊢ ¬∃ a ∈ (b.repr x).support,
      { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
            inj' :=
              (_ :
                ∀ (i i' : ι),
                  (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
                      (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
                    i = i') }
          a =
        { val := x, property := p }

Next tactic:
rintro ⟨j, -, W⟩
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  simp_rw [Finsupp.total_apply] at e
  change ((b.repr x).sum fun (i : ι) (a : R) ↦ a • (u i : M)) = ((⟨x, p⟩ : w) : M) at e
  rw [← Finsupp.sum_embDomain (f := u) (g := fun x r ↦ r • (x : M)), ← Finsupp.total_apply] at e
  -- Now we can contradict the linear independence of `hi`
  refine' hi.total_ne_of_not_mem_support _ _ e
  simp only [Finset.mem_map, Finsupp.support_embDomain]
  rintro ⟨j, -, W⟩
  

Proof state:
case intro.intro
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
e : (Finsupp.total (↑w) M R fun x => ↑x) (Finsupp.embDomain u (b.repr x)) = ↑{ val := x, property := p }
j : ι
W :
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
        inj' :=
          (_ :
            ∀ (i i' : ι),
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
                  (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
                i = i') }
      j =
    { val := x, property := p }
⊢ False

Next tactic:
simp only [Embedding.coeFn_mk, Subtype.mk_eq_mk] at W
/-- Any basis is a maximal linear independent set.
-/
theorem maximal [Nontrivial R] (b : Basis ι R M) : b.linearIndependent.Maximal := fun w hi h => by
  -- If `w` is strictly bigger than `range b`,
  apply le_antisymm h
  -- then choose some `x ∈ w \ range b`,
  intro x p
  by_contra q
  -- and write it in terms of the basis.
  have e := b.total_repr x
  -- This then expresses `x` as a linear combination
  -- of elements of `w` which are in the range of `b`,
  let u : ι ↪ w :=
    ⟨fun i => ⟨b i, h ⟨i, rfl⟩⟩, fun i i' r =>
      b.injective (by simpa only [Subtype.mk_eq_mk] using r)⟩
  simp_rw [Finsupp.total_apply] at e
  change ((b.repr x).sum fun (i : ι) (a : R) ↦ a • (u i : M)) = ((⟨x, p⟩ : w) : M) at e
  rw [← Finsupp.sum_embDomain (f := u) (g := fun x r ↦ r • (x : M)), ← Finsupp.total_apply] at e
  -- Now we can contradict the linear independence of `hi`
  refine' hi.total_ne_of_not_mem_support _ _ e
  simp only [Finset.mem_map, Finsupp.support_embDomain]
  rintro ⟨j, -, W⟩
  simp only [Embedding.coeFn_mk, Subtype.mk_eq_mk] at W
  

Proof state:
case intro.intro
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x✝ y : M
b✝ : Basis ι R M
inst✝ : Nontrivial R
b : Basis ι R M
w : Set M
hi : LinearIndependent (ι := { x // x ∈ w }) R Subtype.val
h : Set.range ⇑b ≤ w
x : M
p : x ∈ w
q : x ∉ Set.range ⇑b
u : ι ↪ ↑w :=
  { toFun := fun i => { val := b i, property := (_ : b i ∈ w) },
    inj' :=
      (_ :
        ∀ (i i' : ι),
          (fun i => { val := b i, property := (_ : b i ∈ w) }) i =
              (fun i => { val := b i, property := (_ : b i ∈ w) }) i' →
            i = i') }
e : (Finsupp.total (↑w) M R fun x => ↑x) (Finsupp.embDomain u (b.repr x)) = ↑{ val := x, property := p }
j : ι
W : b j = x
⊢ False

Next tactic:
apply q ⟨j, W⟩
theorem mk_apply (i : ι) : Basis.mk hli hsp i = v i :=
  show Finsupp.total _ _ _ v _ = v i by 

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁸ : Ring R
inst✝⁷ : CommRing R₂
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup M'
inst✝⁴ : AddCommGroup M''
inst✝³ : Module R M
inst✝² : Module R₂ M
inst✝¹ : Module R M'
inst✝ : Module R M''
c d : R
x y : M
b : Basis ι R M
hli : LinearIndependent R v
hsp : ⊤ ≤ span R (Set.range v)
i : ι
⊢ ((Finsupp.total ι M R v) fun₀ | i => 1) = v i

Next tactic:
simp
/-- Given a basis, the `i`th element of the dual basis evaluates to 1 on the `i`th element of the
basis. -/
theorem mk_coord_apply_eq (i : ι) : (Basis.mk hli hsp).coord i (v i) = 1 :=
  show hli.repr ⟨v i, Submodule.subset_span (mem_range_self i)⟩ i = 1 by 

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁸ : Ring R
inst✝⁷ : CommRing R₂
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup M'
inst✝⁴ : AddCommGroup M''
inst✝³ : Module R M
inst✝² : Module R₂ M
inst✝¹ : Module R M'
inst✝ : Module R M''
c d : R
x y : M
b : Basis ι R M
hli : LinearIndependent R v
hsp : ⊤ ≤ span R (Set.range v)
i : ι
⊢ ((LinearIndependent.repr hli) { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) }) i = 1

Next tactic:
simp [hli.repr_eq_single i]
/-- Given a basis, the `i`th element of the dual basis evaluates to 0 on the `j`th element of the
basis if `j ≠ i`. -/
theorem mk_coord_apply_ne {i j : ι} (h : j ≠ i) : (Basis.mk hli hsp).coord i (v j) = 0 :=
  show hli.repr ⟨v j, Submodule.subset_span (mem_range_self j)⟩ i = 0 by
    

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁸ : Ring R
inst✝⁷ : CommRing R₂
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup M'
inst✝⁴ : AddCommGroup M''
inst✝³ : Module R M
inst✝² : Module R₂ M
inst✝¹ : Module R M'
inst✝ : Module R M''
c d : R
x y : M
b : Basis ι R M
hli : LinearIndependent R v
hsp : ⊤ ≤ span R (Set.range v)
i j : ι
h : j ≠ i
⊢ ((LinearIndependent.repr hli) { val := v j, property := (_ : v j ∈ ↑(span R (Set.range v))) }) i = 0

Next tactic:
simp [hli.repr_eq_single j, h]
/-- Given a basis, the `i`th element of the dual basis evaluates to the Kronecker delta on the
`j`th element of the basis. -/
theorem mk_coord_apply [DecidableEq ι] {i j : ι} :
    (Basis.mk hli hsp).coord i (v j) = if j = i then 1 else 0 := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x y : M
b : Basis ι R M
hli : LinearIndependent R v
hsp : ⊤ ≤ span R (Set.range v)
inst✝ : DecidableEq ι
i j : ι
⊢ (coord (Basis.mk hli hsp) i) (v j) = if j = i then 1 else 0

Next tactic:
rcases eq_or_ne j i with h | h
/-- Given a basis, the `i`th element of the dual basis evaluates to the Kronecker delta on the
`j`th element of the basis. -/
theorem mk_coord_apply [DecidableEq ι] {i j : ι} :
    (Basis.mk hli hsp).coord i (v j) = if j = i then 1 else 0 := by
  rcases eq_or_ne j i with h | h
  · 

Proof state:
case inl
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x y : M
b : Basis ι R M
hli : LinearIndependent R v
hsp : ⊤ ≤ span R (Set.range v)
inst✝ : DecidableEq ι
i j : ι
h : j = i
⊢ (coord (Basis.mk hli hsp) i) (v j) = if j = i then 1 else 0

Next tactic:
simp only [h, if_true, eq_self_iff_true, mk_coord_apply_eq i]
/-- Given a basis, the `i`th element of the dual basis evaluates to the Kronecker delta on the
`j`th element of the basis. -/
theorem mk_coord_apply [DecidableEq ι] {i j : ι} :
    (Basis.mk hli hsp).coord i (v j) = if j = i then 1 else 0 := by
  rcases eq_or_ne j i with h | h
  · simp only [h, if_true, eq_self_iff_true, mk_coord_apply_eq i]
  · 

Proof state:
case inr
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁹ : Ring R
inst✝⁸ : CommRing R₂
inst✝⁷ : AddCommGroup M
inst✝⁶ : AddCommGroup M'
inst✝⁵ : AddCommGroup M''
inst✝⁴ : Module R M
inst✝³ : Module R₂ M
inst✝² : Module R M'
inst✝¹ : Module R M''
c d : R
x y : M
b : Basis ι R M
hli : LinearIndependent R v
hsp : ⊤ ≤ span R (Set.range v)
inst✝ : DecidableEq ι
i j : ι
h : j ≠ i
⊢ (coord (Basis.mk hli hsp) i) (v j) = if j = i then 1 else 0

Next tactic:
simp only [h, if_false, mk_coord_apply_ne h]
/-- A linear independent family of vectors is a basis for their span. -/
protected noncomputable def span : Basis ι R (span R (range v)) :=
  Basis.mk (linearIndependent_span hli) <| by
    

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁸ : Ring R
inst✝⁷ : CommRing R₂
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup M'
inst✝⁴ : AddCommGroup M''
inst✝³ : Module R M
inst✝² : Module R₂ M
inst✝¹ : Module R M'
inst✝ : Module R M''
c d : R
x y : M
b : Basis ι R M
hli : LinearIndependent R v
⊢ ⊤ ≤ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
intro x _
/-- A linear independent family of vectors is a basis for their span. -/
protected noncomputable def span : Basis ι R (span R (range v)) :=
  Basis.mk (linearIndependent_span hli) <| by
    intro x _
    

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
R₂ : Type u_4
K : Type u_5
M : Type u_6
M' : Type u_7
M'' : Type u_8
V : Type u
V' : Type u_9
v : ι → M
inst✝⁸ : Ring R
inst✝⁷ : CommRing R₂
inst✝⁶ : AddCommGroup M
inst✝⁵ : AddCommGroup M'
inst✝⁴ : AddCommGroup M''
inst✝³ : Module R M
inst✝² : Module R₂ M
inst✝¹ : Module R M'
inst✝ : Module R M''
c d : R
x✝ y : M
b : Basis ι R M
hli : LinearIndependent R v
x : ↥(span R (Set.range v))
a✝ : x ∈ ⊤
⊢ x ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)