l3lab/ntp-mathlib huggingface dataset:
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    

Proof state:
case refl
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
inst : DecidableEq ι
v : ι → M
i : ι
x y : M
⊢ (fun v => Matrix.det (toMatrix e v)) (update v i (x + y)) =
    (fun v => Matrix.det (toMatrix e v)) (update v i x) + (fun v => Matrix.det (toMatrix e v)) (update v i y)

Next tactic:
simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    

Proof state:
case refl
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
inst : DecidableEq ι
v : ι → M
i : ι
x y : M
⊢ Matrix.det (updateColumn (toMatrix e v) i (⇑(e.repr x) + ⇑(e.repr y))) =
    Matrix.det (updateColumn (toMatrix e v) i ⇑(e.repr x)) + Matrix.det (updateColumn (toMatrix e v) i ⇑(e.repr y))

Next tactic:
convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
⊢ ∀ [inst : DecidableEq ι] (m : ι → M) (i : ι) (c : R) (x : M),
    (fun v => Matrix.det (toMatrix e v)) (update m i (c • x)) = c • (fun v => Matrix.det (toMatrix e v)) (update m i x)

Next tactic:
intro inst u i c x
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
inst : DecidableEq ι
u : ι → M
i : ι
c : R
x : M
⊢ (fun v => Matrix.det (toMatrix e v)) (update u i (c • x)) = c • (fun v => Matrix.det (toMatrix e v)) (update u i x)

Next tactic:
cases Subsingleton.elim inst ‹_›
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    cases Subsingleton.elim inst ‹_›
    

Proof state:
case refl
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
inst : DecidableEq ι
u : ι → M
i : ι
c : R
x : M
⊢ (fun v => Matrix.det (toMatrix e v)) (update u i (c • x)) = c • (fun v => Matrix.det (toMatrix e v)) (update u i x)

Next tactic:
simp only [e.toMatrix_update, Algebra.id.smul_eq_mul, LinearEquiv.map_smul]
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, Algebra.id.smul_eq_mul, LinearEquiv.map_smul]
    -- Porting note: was `apply det_update_column_smul`
    

Proof state:
case refl
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
inst : DecidableEq ι
u : ι → M
i : ι
c : R
x : M
⊢ Matrix.det (updateColumn (toMatrix e u) i ⇑(c • e.repr x)) =
    c * Matrix.det (updateColumn (toMatrix e u) i ⇑(e.repr x))

Next tactic:
convert det_updateColumn_smul (e.toMatrix u) i c (e.repr x)
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, Algebra.id.smul_eq_mul, LinearEquiv.map_smul]
    -- Porting note: was `apply det_update_column_smul`
    convert det_updateColumn_smul (e.toMatrix u) i c (e.repr x)
  map_eq_zero_of_eq' := by
    

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
⊢ ∀ (v : ι → M) (i j : ι),
    v i = v j →
      i ≠ j →
        MultilinearMap.toFun
            { toFun := fun v => Matrix.det (toMatrix e v),
              map_add' :=
                (_ :
                  ∀ [inst : DecidableEq ι] (v : ι → M) (i : ι) (x y : M),
                    (fun v => Matrix.det (toMatrix e v)) (update v i (x + y)) =
                      (fun v => Matrix.det (toMatrix e v)) (update v i x) +
                        (fun v => Matrix.det (toMatrix e v)) (update v i y)),
              map_smul' :=
                (_ :
                  ∀ [inst : DecidableEq ι] (u : ι → M) (i : ι) (c : R) (x : M),
                    (fun v => Matrix.det (toMatrix e v)) (update u i (c • x)) =
                      c • (fun v => Matrix.det (toMatrix e v)) (update u i x)) }
            v =
          0

Next tactic:
intro v i j h hij
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, Algebra.id.smul_eq_mul, LinearEquiv.map_smul]
    -- Porting note: was `apply det_update_column_smul`
    convert det_updateColumn_smul (e.toMatrix u) i c (e.repr x)
  map_eq_zero_of_eq' := by
    intro v i j h hij
    -- Porting note: added
    

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
i j : ι
h : v i = v j
hij : i ≠ j
⊢ MultilinearMap.toFun
      { toFun := fun v => Matrix.det (toMatrix e v),
        map_add' :=
          (_ :
            ∀ [inst : DecidableEq ι] (v : ι → M) (i : ι) (x y : M),
              (fun v => Matrix.det (toMatrix e v)) (update v i (x + y)) =
                (fun v => Matrix.det (toMatrix e v)) (update v i x) +
                  (fun v => Matrix.det (toMatrix e v)) (update v i y)),
        map_smul' :=
          (_ :
            ∀ [inst : DecidableEq ι] (u : ι → M) (i : ι) (c : R) (x : M),
              (fun v => Matrix.det (toMatrix e v)) (update u i (c • x)) =
                c • (fun v => Matrix.det (toMatrix e v)) (update u i x)) }
      v =
    0

Next tactic:
simp only
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, Algebra.id.smul_eq_mul, LinearEquiv.map_smul]
    -- Porting note: was `apply det_update_column_smul`
    convert det_updateColumn_smul (e.toMatrix u) i c (e.repr x)
  map_eq_zero_of_eq' := by
    intro v i j h hij
    -- Porting note: added
    simp only
    

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
i j : ι
h : v i = v j
hij : i ≠ j
⊢ Matrix.det (toMatrix e v) = 0

Next tactic:
rw [← Function.update_eq_self i v, h, ← det_transpose, e.toMatrix_update, ← updateRow_transpose,
      ← e.toMatrix_transpose_apply]
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, Algebra.id.smul_eq_mul, LinearEquiv.map_smul]
    -- Porting note: was `apply det_update_column_smul`
    convert det_updateColumn_smul (e.toMatrix u) i c (e.repr x)
  map_eq_zero_of_eq' := by
    intro v i j h hij
    -- Porting note: added
    simp only
    rw [← Function.update_eq_self i v, h, ← det_transpose, e.toMatrix_update, ← updateRow_transpose,
      ← e.toMatrix_transpose_apply]
    

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
i j : ι
h : v i = v j
hij : i ≠ j
⊢ Matrix.det (updateRow (toMatrix e v)ᵀ i ((toMatrix e v)ᵀ j)) = 0

Next tactic:
apply det_zero_of_row_eq hij
/-- The determinant of a family of vectors with respect to some basis, as an alternating
multilinear map. -/
nonrec def Basis.det : M [Λ^ι]→ₗ[R] R where
  toFun v := det (e.toMatrix v)
  map_add' := by
    intro inst v i x y
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, LinearEquiv.map_add, Finsupp.coe_add]
    -- Porting note: was `exact det_update_column_add _ _ _ _`
    convert det_updateColumn_add (e.toMatrix v) i (e.repr x) (e.repr y)
  map_smul' := by
    intro inst u i c x
    cases Subsingleton.elim inst ‹_›
    simp only [e.toMatrix_update, Algebra.id.smul_eq_mul, LinearEquiv.map_smul]
    -- Porting note: was `apply det_update_column_smul`
    convert det_updateColumn_smul (e.toMatrix u) i c (e.repr x)
  map_eq_zero_of_eq' := by
    intro v i j h hij
    -- Porting note: added
    simp only
    rw [← Function.update_eq_self i v, h, ← det_transpose, e.toMatrix_update, ← updateRow_transpose,
      ← e.toMatrix_transpose_apply]
    apply det_zero_of_row_eq hij
    

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
i j : ι
h : v i = v j
hij : i ≠ j
⊢ updateRow (toMatrix e v)ᵀ i ((toMatrix e v)ᵀ j) i = updateRow (toMatrix e v)ᵀ i ((toMatrix e v)ᵀ j) j

Next tactic:
rw [updateRow_ne hij.symm, updateRow_self]
theorem Basis.det_self : e.det e = 1 := by 

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
⊢ (det e) ⇑e = 1

Next tactic:
simp [e.det_apply]
@[simp]
theorem Basis.det_isEmpty [IsEmpty ι] : e.det = AlternatingMap.constOfIsEmpty R M ι 1 := by
  

Proof state:
R : Type u_1
inst✝⁷ : CommRing R
M : Type u_2
inst✝⁶ : AddCommGroup M
inst✝⁵ : Module R M
M' : Type u_3
inst✝⁴ : AddCommGroup M'
inst✝³ : Module R M'
ι : Type u_4
inst✝² : DecidableEq ι
inst✝¹ : Fintype ι
e : Basis ι R M
inst✝ : IsEmpty ι
⊢ det e = AlternatingMap.constOfIsEmpty R M ι 1

Next tactic:
ext v
@[simp]
theorem Basis.det_isEmpty [IsEmpty ι] : e.det = AlternatingMap.constOfIsEmpty R M ι 1 := by
  ext v
  

Proof state:
case H
R : Type u_1
inst✝⁷ : CommRing R
M : Type u_2
inst✝⁶ : AddCommGroup M
inst✝⁵ : Module R M
M' : Type u_3
inst✝⁴ : AddCommGroup M'
inst✝³ : Module R M'
ι : Type u_4
inst✝² : DecidableEq ι
inst✝¹ : Fintype ι
e : Basis ι R M
inst✝ : IsEmpty ι
v : ι → M
⊢ (det e) v = (AlternatingMap.constOfIsEmpty R M ι 1) v

Next tactic:
exact Matrix.det_isEmpty
/-- `Basis.det` is not the zero map. -/
theorem Basis.det_ne_zero [Nontrivial R] : e.det ≠ 0 := fun h => by 

Proof state:
R : Type u_1
inst✝⁷ : CommRing R
M : Type u_2
inst✝⁶ : AddCommGroup M
inst✝⁵ : Module R M
M' : Type u_3
inst✝⁴ : AddCommGroup M'
inst✝³ : Module R M'
ι : Type u_4
inst✝² : DecidableEq ι
inst✝¹ : Fintype ι
e : Basis ι R M
inst✝ : Nontrivial R
h : det e = 0
⊢ False

Next tactic:
simpa [h] using e.det_self
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
⊢ LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit ((Basis.det e) v)

Next tactic:
constructor
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · 

Proof state:
case mp
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
⊢ LinearIndependent R v ∧ span R (Set.range v) = ⊤ → IsUnit ((Basis.det e) v)

Next tactic:
rintro ⟨hli, hspan⟩
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    

Proof state:
case mp.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
hli : LinearIndependent R v
hspan : span R (Set.range v) = ⊤
⊢ IsUnit ((Basis.det e) v)

Next tactic:
set v' := Basis.mk hli hspan.ge
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    

Proof state:
case mp.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
hli : LinearIndependent R v
hspan : span R (Set.range v) = ⊤
v' : Basis ι R M := Basis.mk hli (_ : ⊤ ≤ span R (Set.range v))
⊢ IsUnit ((Basis.det e) v)

Next tactic:
rw [e.det_apply]
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    

Proof state:
case mp.intro
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
hli : LinearIndependent R v
hspan : span R (Set.range v) = ⊤
v' : Basis ι R M := Basis.mk hli (_ : ⊤ ≤ span R (Set.range v))
⊢ IsUnit (det (Basis.toMatrix e v))

Next tactic:
convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
    

Proof state:
case h.e'_3.h.e'_6
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
hli : LinearIndependent R v
hspan : span R (Set.range v) = ⊤
v' : Basis ι R M := Basis.mk hli (_ : ⊤ ≤ span R (Set.range v))
⊢ Basis.toMatrix e v = (toMatrix v' e) ↑(LinearEquiv.refl R M)

Next tactic:
ext i j
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
    ext i j
    

Proof state:
case h.e'_3.h.e'_6.a.h
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
hli : LinearIndependent R v
hspan : span R (Set.range v) = ⊤
v' : Basis ι R M := Basis.mk hli (_ : ⊤ ≤ span R (Set.range v))
i j : ι
⊢ Basis.toMatrix e v i j = (toMatrix v' e) (↑(LinearEquiv.refl R M)) i j

Next tactic:
simp
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
    ext i j
    simp
  · 

Proof state:
case mpr
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
⊢ IsUnit ((Basis.det e) v) → LinearIndependent R v ∧ span R (Set.range v) = ⊤

Next tactic:
intro h
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
    ext i j
    simp
  · intro h
    

Proof state:
case mpr
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
h : IsUnit ((Basis.det e) v)
⊢ LinearIndependent R v ∧ span R (Set.range v) = ⊤

Next tactic:
rw [Basis.det_apply, Basis.toMatrix_eq_toMatrix_constr] at h
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
    ext i j
    simp
  · intro h
    rw [Basis.det_apply, Basis.toMatrix_eq_toMatrix_constr] at h
    

Proof state:
case mpr
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
h : IsUnit (det ((toMatrix e e) ((Basis.constr e ℕ) v)))
⊢ LinearIndependent R v ∧ span R (Set.range v) = ⊤

Next tactic:
set v' := Basis.map e (LinearEquiv.ofIsUnitDet h) with v'_def
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
    ext i j
    simp
  · intro h
    rw [Basis.det_apply, Basis.toMatrix_eq_toMatrix_constr] at h
    set v' := Basis.map e (LinearEquiv.ofIsUnitDet h) with v'_def
    

Proof state:
case mpr
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
h : IsUnit (det ((toMatrix e e) ((Basis.constr e ℕ) v)))
v' : Basis ι R M := Basis.map e (LinearEquiv.ofIsUnitDet h)
v'_def : v' = Basis.map e (LinearEquiv.ofIsUnitDet h)
⊢ LinearIndependent R v ∧ span R (Set.range v) = ⊤

Next tactic:
have : ⇑v' = v := by
      ext i
      rw [v'_def, Basis.map_apply, LinearEquiv.ofIsUnitDet_apply, e.constr_basis]
theorem is_basis_iff_det {v : ι → M} :
    LinearIndependent R v ∧ span R (Set.range v) = ⊤ ↔ IsUnit (e.det v) := by
  constructor
  · rintro ⟨hli, hspan⟩
    set v' := Basis.mk hli hspan.ge
    rw [e.det_apply]
    convert LinearEquiv.isUnit_det (LinearEquiv.refl R M) v' e using 2
    ext i j
    simp
  · intro h
    rw [Basis.det_apply, Basis.toMatrix_eq_toMatrix_constr] at h
    set v' := Basis.map e (LinearEquiv.ofIsUnitDet h) with v'_def
    have : ⇑v' = v := by
      

Proof state:
R : Type u_1
inst✝⁶ : CommRing R
M : Type u_2
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
M' : Type u_3
inst✝³ : AddCommGroup M'
inst✝² : Module R M'
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
e : Basis ι R M
v : ι → M
h : IsUnit (det ((toMatrix e e) ((Basis.constr e ℕ) v)))
v' : Basis ι R M := Basis.map e (LinearEquiv.ofIsUnitDet h)
v'_def : v' = Basis.map e (LinearEquiv.ofIsUnitDet h)
⊢ ⇑v' = v

Next tactic:
ext i