l3lab/ntp-mathlib huggingface dataset:
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    

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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
⊢ LinearMap.det (↑e ∘ₗ f ∘ₗ ↑(LinearEquiv.symm e)) = LinearMap.det f

Next tactic:
by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · 

Proof state:
case pos
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
H : ∃ s, Nonempty (Basis { x // x ∈ s } A M)
⊢ LinearMap.det (↑e ∘ₗ f ∘ₗ ↑(LinearEquiv.symm e)) = LinearMap.det f

Next tactic:
rcases H with ⟨s, ⟨b⟩⟩
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      

Proof state:
case pos.intro.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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
s : Finset M
b : Basis { x // x ∈ s } A M
⊢ LinearMap.det (↑e ∘ₗ f ∘ₗ ↑(LinearEquiv.symm e)) = LinearMap.det f

Next tactic:
rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
      · 

Proof state:
case pos.intro.intro.hMM'
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
s : Finset M
b : Basis { x // x ∈ s } A M
⊢ (toMatrix b (Basis.map b e)) ↑e * (toMatrix (Basis.map b e) b) ↑(LinearEquiv.symm e) = 1

Next tactic:
rw [← toMatrix_comp, LinearEquiv.comp_coe, e.symm_trans_self, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.symm_trans_self, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
      · 

Proof state:
case pos.intro.intro.hM'M
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
s : Finset M
b : Basis { x // x ∈ s } A M
⊢ (toMatrix (Basis.map b e) b) ↑(LinearEquiv.symm e) * (toMatrix b (Basis.map b e)) ↑e = 1

Next tactic:
rw [← toMatrix_comp, LinearEquiv.comp_coe, e.self_trans_symm, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.symm_trans_self, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.self_trans_symm, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
    · 

Proof state:
case neg
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
H : ¬∃ s, Nonempty (Basis { x // x ∈ s } A M)
⊢ LinearMap.det (↑e ∘ₗ f ∘ₗ ↑(LinearEquiv.symm e)) = LinearMap.det f

Next tactic:
have H' : ¬∃ t : Finset N, Nonempty (Basis t A N) := by
        contrapose! H
        rcases H with ⟨s, ⟨b⟩⟩
        exact ⟨_, ⟨(b.map e.symm).reindexFinsetRange⟩⟩
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.symm_trans_self, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.self_trans_symm, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
    · have H' : ¬∃ t : Finset N, Nonempty (Basis t A N) := 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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
H : ¬∃ s, Nonempty (Basis { x // x ∈ s } A M)
⊢ ¬∃ t, Nonempty (Basis { x // x ∈ t } A N)

Next tactic:
contrapose! H
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.symm_trans_self, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.self_trans_symm, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
    · have H' : ¬∃ t : Finset N, Nonempty (Basis t A N) := by
        contrapose! H
        

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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
H : ∃ t, Nonempty (Basis { x // x ∈ t } A N)
⊢ ∃ s, Nonempty (Basis { x // x ∈ s } A M)

Next tactic:
rcases H with ⟨s, ⟨b⟩⟩
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.symm_trans_self, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.self_trans_symm, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
    · have H' : ¬∃ t : Finset N, Nonempty (Basis t A N) := by
        contrapose! H
        rcases H with ⟨s, ⟨b⟩⟩
        

Proof state:
case intro.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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
s : Finset N
b : Basis { x // x ∈ s } A N
⊢ ∃ s, Nonempty (Basis { x // x ∈ s } A M)

Next tactic:
exact ⟨_, ⟨(b.map e.symm).reindexFinsetRange⟩⟩
/-- Conjugating a linear map by a linear equiv does not change its determinant. -/
@[simp]
theorem det_conj {N : Type*} [AddCommGroup N] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
    LinearMap.det ((e : M →ₗ[A] N) ∘ₗ f ∘ₗ (e.symm : N →ₗ[A] M)) = LinearMap.det f := by
  classical
    by_cases H : ∃ s : Finset M, Nonempty (Basis s A M)
    · rcases H with ⟨s, ⟨b⟩⟩
      rw [← det_toMatrix b f, ← det_toMatrix (b.map e), toMatrix_comp (b.map e) b (b.map e),
        toMatrix_comp (b.map e) b b, ← Matrix.mul_assoc, Matrix.det_conj_of_mul_eq_one]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.symm_trans_self, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
      · rw [← toMatrix_comp, LinearEquiv.comp_coe, e.self_trans_symm, LinearEquiv.refl_toLinearMap,
          toMatrix_id]
    · have H' : ¬∃ t : Finset N, Nonempty (Basis t A N) := by
        contrapose! H
        rcases H with ⟨s, ⟨b⟩⟩
        exact ⟨_, ⟨(b.map e.symm).reindexFinsetRange⟩⟩
      

Proof state:
case neg
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
N : Type u_7
inst✝¹ : AddCommGroup N
inst✝ : Module A N
f : M →ₗ[A] M
e : M ≃ₗ[A] N
H : ¬∃ s, Nonempty (Basis { x // x ∈ s } A M)
H' : ¬∃ t, Nonempty (Basis { x // x ∈ t } A N)
⊢ LinearMap.det (↑e ∘ₗ f ∘ₗ ↑(LinearEquiv.symm e)) = LinearMap.det f

Next tactic:
simp only [coe_det, H, H', MonoidHom.one_apply, dif_neg, not_false_eq_true]
/-- If a linear map is invertible, so is its determinant. -/
theorem isUnit_det {A : Type*} [CommRing A] [Module A M] (f : M →ₗ[A] M) (hf : IsUnit f) :
    IsUnit (LinearMap.det f) := 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
A✝ : Type u_5
inst✝⁴ : CommRing A✝
inst✝³ : Module A✝ M
κ : Type u_6
inst✝² : Fintype κ
A : Type u_7
inst✝¹ : CommRing A
inst✝ : Module A M
f : M →ₗ[A] M
hf : IsUnit f
⊢ IsUnit (LinearMap.det f)

Next tactic:
obtain ⟨g, hg⟩ : ∃ g, f.comp g = 1 := hf.exists_right_inv
/-- If a linear map is invertible, so is its determinant. -/
theorem isUnit_det {A : Type*} [CommRing A] [Module A M] (f : M →ₗ[A] M) (hf : IsUnit f) :
    IsUnit (LinearMap.det f) := by
  obtain ⟨g, hg⟩ : ∃ g, f.comp g = 1 := hf.exists_right_inv
  

Proof state:
case 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
A✝ : Type u_5
inst✝⁴ : CommRing A✝
inst✝³ : Module A✝ M
κ : Type u_6
inst✝² : Fintype κ
A : Type u_7
inst✝¹ : CommRing A
inst✝ : Module A M
f : M →ₗ[A] M
hf : IsUnit f
g : M →ₗ[A] M
hg : f ∘ₗ g = 1
⊢ IsUnit (LinearMap.det f)

Next tactic:
have : LinearMap.det f * LinearMap.det g = 1 := by
    simp only [← LinearMap.det_comp, hg, MonoidHom.map_one]
/-- If a linear map is invertible, so is its determinant. -/
theorem isUnit_det {A : Type*} [CommRing A] [Module A M] (f : M →ₗ[A] M) (hf : IsUnit f) :
    IsUnit (LinearMap.det f) := by
  obtain ⟨g, hg⟩ : ∃ g, f.comp g = 1 := hf.exists_right_inv
  have : LinearMap.det f * LinearMap.det g = 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
A✝ : Type u_5
inst✝⁴ : CommRing A✝
inst✝³ : Module A✝ M
κ : Type u_6
inst✝² : Fintype κ
A : Type u_7
inst✝¹ : CommRing A
inst✝ : Module A M
f : M →ₗ[A] M
hf : IsUnit f
g : M →ₗ[A] M
hg : f ∘ₗ g = 1
⊢ LinearMap.det f * LinearMap.det g = 1

Next tactic:
simp only [← LinearMap.det_comp, hg, MonoidHom.map_one]
/-- If a linear map is invertible, so is its determinant. -/
theorem isUnit_det {A : Type*} [CommRing A] [Module A M] (f : M →ₗ[A] M) (hf : IsUnit f) :
    IsUnit (LinearMap.det f) := by
  obtain ⟨g, hg⟩ : ∃ g, f.comp g = 1 := hf.exists_right_inv
  have : LinearMap.det f * LinearMap.det g = 1 := by
    simp only [← LinearMap.det_comp, hg, MonoidHom.map_one]
  

Proof state:
case 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
A✝ : Type u_5
inst✝⁴ : CommRing A✝
inst✝³ : Module A✝ M
κ : Type u_6
inst✝² : Fintype κ
A : Type u_7
inst✝¹ : CommRing A
inst✝ : Module A M
f : M →ₗ[A] M
hf : IsUnit f
g : M →ₗ[A] M
hg : f ∘ₗ g = 1
this : LinearMap.det f * LinearMap.det g = 1
⊢ IsUnit (LinearMap.det f)

Next tactic:
exact isUnit_of_mul_eq_one _ _ this
/-- If a linear map has determinant different from `1`, then the space is finite-dimensional. -/
theorem finiteDimensional_of_det_ne_one {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] (f : M →ₗ[𝕜] M)
    (hf : LinearMap.det f ≠ 1) : FiniteDimensional 𝕜 M := 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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f ≠ 1
⊢ FiniteDimensional 𝕜 M

Next tactic:
by_cases H : ∃ s : Finset M, Nonempty (Basis s 𝕜 M)
/-- If a linear map has determinant different from `1`, then the space is finite-dimensional. -/
theorem finiteDimensional_of_det_ne_one {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] (f : M →ₗ[𝕜] M)
    (hf : LinearMap.det f ≠ 1) : FiniteDimensional 𝕜 M := by
  by_cases H : ∃ s : Finset M, Nonempty (Basis s 𝕜 M)
  · 

Proof state:
case pos
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f ≠ 1
H : ∃ s, Nonempty (Basis { x // x ∈ s } 𝕜 M)
⊢ FiniteDimensional 𝕜 M

Next tactic:
rcases H with ⟨s, ⟨hs⟩⟩
/-- If a linear map has determinant different from `1`, then the space is finite-dimensional. -/
theorem finiteDimensional_of_det_ne_one {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] (f : M →ₗ[𝕜] M)
    (hf : LinearMap.det f ≠ 1) : FiniteDimensional 𝕜 M := by
  by_cases H : ∃ s : Finset M, Nonempty (Basis s 𝕜 M)
  · rcases H with ⟨s, ⟨hs⟩⟩
    

Proof state:
case pos.intro.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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f ≠ 1
s : Finset M
hs : Basis { x // x ∈ s } 𝕜 M
⊢ FiniteDimensional 𝕜 M

Next tactic:
exact FiniteDimensional.of_fintype_basis hs
/-- If a linear map has determinant different from `1`, then the space is finite-dimensional. -/
theorem finiteDimensional_of_det_ne_one {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] (f : M →ₗ[𝕜] M)
    (hf : LinearMap.det f ≠ 1) : FiniteDimensional 𝕜 M := by
  by_cases H : ∃ s : Finset M, Nonempty (Basis s 𝕜 M)
  · rcases H with ⟨s, ⟨hs⟩⟩
    exact FiniteDimensional.of_fintype_basis hs
  · 

Proof state:
case neg
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f ≠ 1
H : ¬∃ s, Nonempty (Basis { x // x ∈ s } 𝕜 M)
⊢ FiniteDimensional 𝕜 M

Next tactic:
classical simp [LinearMap.coe_det, H] at hf
/-- If a linear map has determinant different from `1`, then the space is finite-dimensional. -/
theorem finiteDimensional_of_det_ne_one {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] (f : M →ₗ[𝕜] M)
    (hf : LinearMap.det f ≠ 1) : FiniteDimensional 𝕜 M := by
  by_cases H : ∃ s : Finset M, Nonempty (Basis s 𝕜 M)
  · rcases H with ⟨s, ⟨hs⟩⟩
    exact FiniteDimensional.of_fintype_basis hs
  · classical 

Proof state:
case neg
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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f ≠ 1
H : ¬∃ s, Nonempty (Basis { x // x ∈ s } 𝕜 M)
⊢ FiniteDimensional 𝕜 M

Next tactic:
simp [LinearMap.coe_det, H] at hf
/-- If the determinant of a map vanishes, then the map is not onto. -/
theorem range_lt_top_of_det_eq_zero {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] {f : M →ₗ[𝕜] M}
    (hf : LinearMap.det f = 0) : LinearMap.range f < ⊤ := 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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f = 0
⊢ range f < ⊤

Next tactic:
have : FiniteDimensional 𝕜 M := by simp [f.finiteDimensional_of_det_ne_one, hf]
/-- If the determinant of a map vanishes, then the map is not onto. -/
theorem range_lt_top_of_det_eq_zero {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] {f : M →ₗ[𝕜] M}
    (hf : LinearMap.det f = 0) : LinearMap.range f < ⊤ := by
  have : FiniteDimensional 𝕜 M := 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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f = 0
⊢ FiniteDimensional 𝕜 M

Next tactic:
simp [f.finiteDimensional_of_det_ne_one, hf]
/-- If the determinant of a map vanishes, then the map is not onto. -/
theorem range_lt_top_of_det_eq_zero {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] {f : M →ₗ[𝕜] M}
    (hf : LinearMap.det f = 0) : LinearMap.range f < ⊤ := by
  have : FiniteDimensional 𝕜 M := by simp [f.finiteDimensional_of_det_ne_one, hf]
  

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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
hf : LinearMap.det f = 0
this : FiniteDimensional 𝕜 M
⊢ range f < ⊤

Next tactic:
contrapose hf
/-- If the determinant of a map vanishes, then the map is not onto. -/
theorem range_lt_top_of_det_eq_zero {𝕜 : Type*} [Field 𝕜] [Module 𝕜 M] {f : M →ₗ[𝕜] M}
    (hf : LinearMap.det f = 0) : LinearMap.range f < ⊤ := by
  have : FiniteDimensional 𝕜 M := by simp [f.finiteDimensional_of_det_ne_one, hf]
  contrapose hf
  

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
A : Type u_5
inst✝⁴ : CommRing A
inst✝³ : Module A M
κ : Type u_6
inst✝² : Fintype κ
𝕜 : Type u_7
inst✝¹ : Field 𝕜
inst✝ : Module 𝕜 M
f : M →ₗ[𝕜] M
this : FiniteDimensional 𝕜 M
hf : ¬range f < ⊤
⊢ ¬LinearMap.det f = 0

Next tactic:
simp only [lt_top_iff_ne_top, Classical.not_not, ← isUnit_iff_range_eq_top] at hf