l3lab/ntp-mathlib huggingface dataset:
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    

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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
⊢ x ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := 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
x : ↥(span R (Set.range v))
a✝ : x ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
⊢ (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v

Next tactic:
simp only [SetLike.coe_sort_coe, ← Set.range_comp]
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      

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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
⊢ Set.range (Subtype.val ∘ fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v

Next tactic:
rfl
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    

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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
⊢ x ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ 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
    intro x _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := 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
x : ↥(span R (Set.range v))
a✝ : x ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
⊢ map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)

Next tactic:
rw [← span_image, Submodule.coeSubtype]
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      

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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
⊢ span R (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) =
    span R (Set.range v)

Next tactic:
exact congr_arg _ 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
    intro x _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    

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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
⊢ x ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (v i) _)) := by
      rw [h₂]
      apply Subtype.mem 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (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
x : ↥(span R (Set.range v))
a✝ : x ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
⊢ ↑x ∈
    map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : ?m.870077 (v i)) }))

Next tactic:
rw [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
    intro x _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (v i) _)) := by
      rw [h₂]
      

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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
⊢ ↑x ∈ span R (Set.range v)

Next tactic:
apply Subtype.mem 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (v i) _)) := by
      rw [h₂]
      apply Subtype.mem 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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
h₃ :
  ↑x ∈
    map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }))
⊢ x ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
rcases mem_map.1 h₃ with ⟨y, hy₁, hy₂⟩
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (v i) _)) := by
      rw [h₂]
      apply Subtype.mem x
    rcases mem_map.1 h₃ with ⟨y, hy₁, hy₂⟩
    

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
hli : LinearIndependent R v
x : ↥(span R (Set.range v))
a✝ : x ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
h₃ :
  ↑x ∈
    map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }))
y : ↥(span R (Set.range v))
hy₁ : y ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })
hy₂ : (Submodule.subtype (span R (Set.range v))) y = ↑x
⊢ x ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
have h_x_eq_y : x = y := by
      rw [Subtype.ext_iff, ← hy₂]
      simp
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (v i) _)) := by
      rw [h₂]
      apply Subtype.mem x
    rcases mem_map.1 h₃ with ⟨y, hy₁, hy₂⟩
    have h_x_eq_y : x = y := 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
x : ↥(span R (Set.range v))
a✝ : x ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
h₃ :
  ↑x ∈
    map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }))
y : ↥(span R (Set.range v))
hy₁ : y ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })
hy₂ : (Submodule.subtype (span R (Set.range v))) y = ↑x
⊢ x = y

Next tactic:
rw [Subtype.ext_iff, ← hy₂]
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (v i) _)) := by
      rw [h₂]
      apply Subtype.mem x
    rcases mem_map.1 h₃ with ⟨y, hy₁, hy₂⟩
    have h_x_eq_y : x = y := by
      rw [Subtype.ext_iff, ← hy₂]
      

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 ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
h₃ :
  ↑x ∈
    map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }))
y : ↥(span R (Set.range v))
hy₁ : y ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })
hy₂ : (Submodule.subtype (span R (Set.range v))) y = ↑x
⊢ (Submodule.subtype (span R (Set.range v))) y = ↑y

Next tactic:
simp
/-- 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 _
    have : ∀ i, v i ∈ span R (range v) := fun i ↦ subset_span (Set.mem_range_self _)
    have h₁ : (((↑) : span R (range v) → M) '' range fun i => ⟨v i, this i⟩) = range v := by
      simp only [SetLike.coe_sort_coe, ← Set.range_comp]
      rfl
    have h₂ : map (Submodule.subtype (span R (range v))) (span R (range fun i => ⟨v i, this i⟩)) =
        span R (range v) := by
      rw [← span_image, Submodule.coeSubtype]
      -- Porting note: why doesn't `rw [h₁]` work here?
      exact congr_arg _ h₁
    have h₃ : (x : M) ∈ map (Submodule.subtype (span R (range v)))
        (span R (Set.range fun i => Subtype.mk (v i) _)) := by
      rw [h₂]
      apply Subtype.mem x
    rcases mem_map.1 h₃ with ⟨y, hy₁, hy₂⟩
    have h_x_eq_y : x = y := by
      rw [Subtype.ext_iff, ← hy₂]
      simp
    

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
hli : LinearIndependent R v
x : ↥(span R (Set.range v))
a✝ : x ∈ ⊤
this : ∀ (i : ι), v i ∈ span R (Set.range v)
h₁ : (Subtype.val '' Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }) = Set.range v
h₂ :
  map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })) =
    span R (Set.range v)
h₃ :
  ↑x ∈
    map (Submodule.subtype (span R (Set.range v)))
      (span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) }))
y : ↥(span R (Set.range v))
hy₁ : y ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ span R (Set.range v)) })
hy₂ : (Submodule.subtype (span R (Set.range v))) y = ↑x
h_x_eq_y : x = y
⊢ x ∈ span R (Set.range fun i => { val := v i, property := (_ : v i ∈ ↑(span R (Set.range v))) })

Next tactic:
rwa [h_x_eq_y]