l3lab/ntp-mathlib huggingface dataset:
@[nontriviality, simp]
theorem rank_subsingleton [Subsingleton R] : Module.rank R M = 1 := by
  haveI := Module.subsingleton R M
  have : Nonempty { s : Set M // LinearIndependent R ((↑) : s → M) } :=
    ⟨⟨∅, linearIndependent_empty _ _⟩⟩
  rw [Module.rank_def, ciSup_eq_of_forall_le_of_forall_lt_exists_gt]
  · rintro ⟨s, hs⟩
    rw [Cardinal.mk_le_one_iff_set_subsingleton]
    apply subsingleton_of_subsingleton
  intro w hw
  refine' ⟨⟨{0}, _⟩, _⟩
  · rw [linearIndependent_iff']
    

Proof state:
case h₂.refine'_1
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝³ : Ring R
inst✝² : AddCommGroup M
inst✝¹ : Module R M
inst✝ : Subsingleton R
this✝ : Subsingleton M
this : Nonempty { s // LinearIndependent (ι := { x // x ∈ s }) R Subtype.val }
w : Cardinal.{v}
hw : w < 1
⊢ ∀ (s : Finset { x // x ∈ {0} }) (g : { x // x ∈ {0} } → R), ∑ i in s, g i • ↑i = 0 → ∀ i ∈ s, g i = 0

Next tactic:
intros
@[nontriviality, simp]
theorem rank_subsingleton [Subsingleton R] : Module.rank R M = 1 := by
  haveI := Module.subsingleton R M
  have : Nonempty { s : Set M // LinearIndependent R ((↑) : s → M) } :=
    ⟨⟨∅, linearIndependent_empty _ _⟩⟩
  rw [Module.rank_def, ciSup_eq_of_forall_le_of_forall_lt_exists_gt]
  · rintro ⟨s, hs⟩
    rw [Cardinal.mk_le_one_iff_set_subsingleton]
    apply subsingleton_of_subsingleton
  intro w hw
  refine' ⟨⟨{0}, _⟩, _⟩
  · rw [linearIndependent_iff']
    intros
    

Proof state:
case h₂.refine'_1
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝³ : Ring R
inst✝² : AddCommGroup M
inst✝¹ : Module R M
inst✝ : Subsingleton R
this✝ : Subsingleton M
this : Nonempty { s // LinearIndependent (ι := { x // x ∈ s }) R Subtype.val }
w : Cardinal.{v}
hw : w < 1
s✝ : Finset { x // x ∈ {0} }
g✝ : { x // x ∈ {0} } → R
a✝¹ : ∑ i in s✝, g✝ i • ↑i = 0
i✝ : { x // x ∈ {0} }
a✝ : i✝ ∈ s✝
⊢ g✝ i✝ = 0

Next tactic:
exact Subsingleton.elim _ _
@[nontriviality, simp]
theorem rank_subsingleton [Subsingleton R] : Module.rank R M = 1 := by
  haveI := Module.subsingleton R M
  have : Nonempty { s : Set M // LinearIndependent R ((↑) : s → M) } :=
    ⟨⟨∅, linearIndependent_empty _ _⟩⟩
  rw [Module.rank_def, ciSup_eq_of_forall_le_of_forall_lt_exists_gt]
  · rintro ⟨s, hs⟩
    rw [Cardinal.mk_le_one_iff_set_subsingleton]
    apply subsingleton_of_subsingleton
  intro w hw
  refine' ⟨⟨{0}, _⟩, _⟩
  · rw [linearIndependent_iff']
    intros
    exact Subsingleton.elim _ _
  · 

Proof state:
case h₂.refine'_2
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝³ : Ring R
inst✝² : AddCommGroup M
inst✝¹ : Module R M
inst✝ : Subsingleton R
this✝ : Subsingleton M
this : Nonempty { s // LinearIndependent (ι := { x // x ∈ s }) R Subtype.val }
w : Cardinal.{v}
hw : w < 1
⊢ w < #↑↑{ val := {0}, property := (_ : LinearIndependent (ι := { x // x ∈ {0} }) R Subtype.val) }

Next tactic:
exact hw.trans_eq (Cardinal.mk_singleton _).symm
theorem rank_pos [Nontrivial M] : 0 < Module.rank R M := by
  

Proof state:
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial M
⊢ 0 < Module.rank R M

Next tactic:
obtain ⟨x, hx⟩ := exists_ne (0 : M)
theorem rank_pos [Nontrivial M] : 0 < Module.rank R M := by
  obtain ⟨x, hx⟩ := exists_ne (0 : M)
  

Proof state:
case intro
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial M
x : M
hx : x ≠ 0
⊢ 0 < Module.rank R M

Next tactic:
suffices 1 ≤ Module.rank R M by exact zero_lt_one.trans_le this
theorem rank_pos [Nontrivial M] : 0 < Module.rank R M := by
  obtain ⟨x, hx⟩ := exists_ne (0 : M)
  suffices 1 ≤ Module.rank R M by 

Proof state:
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial M
x : M
hx : x ≠ 0
this : 1 ≤ Module.rank R M
⊢ 0 < Module.rank R M

Next tactic:
exact zero_lt_one.trans_le this
theorem rank_pos [Nontrivial M] : 0 < Module.rank R M := by
  obtain ⟨x, hx⟩ := exists_ne (0 : M)
  suffices 1 ≤ Module.rank R M by exact zero_lt_one.trans_le this
  

Proof state:
case intro
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial M
x : M
hx : x ≠ 0
⊢ 1 ≤ Module.rank R M

Next tactic:
letI := Module.nontrivial R M
theorem rank_pos [Nontrivial M] : 0 < Module.rank R M := by
  obtain ⟨x, hx⟩ := exists_ne (0 : M)
  suffices 1 ≤ Module.rank R M by exact zero_lt_one.trans_le this
  letI := Module.nontrivial R M
  

Proof state:
case intro
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial M
x : M
hx : x ≠ 0
this : Nontrivial R := Module.nontrivial R M
⊢ 1 ≤ Module.rank R M

Next tactic:
suffices LinearIndependent R fun y : ({x} : Set M) => (y : M) by
    simpa using cardinal_le_rank_of_linearIndependent this
theorem rank_pos [Nontrivial M] : 0 < Module.rank R M := by
  obtain ⟨x, hx⟩ := exists_ne (0 : M)
  suffices 1 ≤ Module.rank R M by exact zero_lt_one.trans_le this
  letI := Module.nontrivial R M
  suffices LinearIndependent R fun y : ({x} : Set M) => (y : M) by
    

Proof state:
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial M
x : M
hx : x ≠ 0
this✝ : Nontrivial R := Module.nontrivial R M
this : LinearIndependent R fun (y : ↑{x}) => ↑y
⊢ 1 ≤ Module.rank R M

Next tactic:
simpa using cardinal_le_rank_of_linearIndependent this
theorem rank_pos [Nontrivial M] : 0 < Module.rank R M := by
  obtain ⟨x, hx⟩ := exists_ne (0 : M)
  suffices 1 ≤ Module.rank R M by exact zero_lt_one.trans_le this
  letI := Module.nontrivial R M
  suffices LinearIndependent R fun y : ({x} : Set M) => (y : M) by
    simpa using cardinal_le_rank_of_linearIndependent this
  

Proof state:
case intro
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial M
x : M
hx : x ≠ 0
this : Nontrivial R := Module.nontrivial R M
⊢ LinearIndependent R fun (y : ↑{x}) => ↑y

Next tactic:
exact linearIndependent_singleton hx
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  

Proof state:
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
⊢ Module.rank R M = 0 ↔ ∀ (x : M), x = 0

Next tactic:
refine' ⟨fun h => _, fun h => _⟩
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · 

Proof state:
case refine'_1
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
h : Module.rank R M = 0
⊢ ∀ (x : M), x = 0

Next tactic:
contrapose! h
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · contrapose! h
    

Proof state:
case refine'_1
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
h : ∃ x, x ≠ 0
⊢ Module.rank R M ≠ 0

Next tactic:
obtain ⟨x, hx⟩ := h
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · contrapose! h
    obtain ⟨x, hx⟩ := h
    

Proof state:
case refine'_1.intro
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
x : M
hx : x ≠ 0
⊢ Module.rank R M ≠ 0

Next tactic:
letI : Nontrivial M := nontrivial_of_ne _ _ hx
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · contrapose! h
    obtain ⟨x, hx⟩ := h
    letI : Nontrivial M := nontrivial_of_ne _ _ hx
    

Proof state:
case refine'_1.intro
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
x : M
hx : x ≠ 0
this : Nontrivial M := nontrivial_of_ne x 0 hx
⊢ Module.rank R M ≠ 0

Next tactic:
exact rank_pos.ne'
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · contrapose! h
    obtain ⟨x, hx⟩ := h
    letI : Nontrivial M := nontrivial_of_ne _ _ hx
    exact rank_pos.ne'
  · 

Proof state:
case refine'_2
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
h : ∀ (x : M), x = 0
⊢ Module.rank R M = 0

Next tactic:
have : (⊤ : Submodule R M) = ⊥ := by
      ext x
      simp [h x]
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · contrapose! h
    obtain ⟨x, hx⟩ := h
    letI : Nontrivial M := nontrivial_of_ne _ _ hx
    exact rank_pos.ne'
  · have : (⊤ : Submodule R M) = ⊥ := by
      

Proof state:
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
h : ∀ (x : M), x = 0
⊢ ⊤ = ⊥

Next tactic:
ext x
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · contrapose! h
    obtain ⟨x, hx⟩ := h
    letI : Nontrivial M := nontrivial_of_ne _ _ hx
    exact rank_pos.ne'
  · have : (⊤ : Submodule R M) = ⊥ := by
      ext x
      

Proof state:
case h
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
h : ∀ (x : M), x = 0
x : M
⊢ x ∈ ⊤ ↔ x ∈ ⊥

Next tactic:
simp [h x]
theorem rank_zero_iff_forall_zero : Module.rank R M = 0 ↔ ∀ x : M, x = 0 := by
  refine' ⟨fun h => _, fun h => _⟩
  · contrapose! h
    obtain ⟨x, hx⟩ := h
    letI : Nontrivial M := nontrivial_of_ne _ _ hx
    exact rank_pos.ne'
  · have : (⊤ : Submodule R M) = ⊥ := by
      ext x
      simp [h x]
    

Proof state:
case refine'_2
K R✝ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R : Type u
M : Type v
inst✝⁴ : Ring R
inst✝³ : AddCommGroup M
inst✝² : Module R M
inst✝¹ : NoZeroSMulDivisors R M
inst✝ : Nontrivial R
h : ∀ (x : M), x = 0
this : ⊤ = ⊥
⊢ Module.rank R M = 0

Next tactic:
rw [← rank_top, this, rank_bot]
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  

Proof state:
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
⊢ Module.rank R M = 0 ↔ ∀ (x : M), ∃ a, a ≠ 0 ∧ a • x = 0

Next tactic:
nontriviality R
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  

Proof state:
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
⊢ Module.rank R M = 0 ↔ ∀ (x : M), ∃ a, a ≠ 0 ∧ a • x = 0

Next tactic:
constructor
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · 

Proof state:
case mp
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
⊢ Module.rank R M = 0 → ∀ (x : M), ∃ a, a ≠ 0 ∧ a • x = 0

Next tactic:
contrapose!
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    

Proof state:
case mp
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
⊢ (∃ x, ∀ (a : R), a ≠ 0 → a • x ≠ 0) → Module.rank R M ≠ 0

Next tactic:
rintro ⟨x, hx⟩
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    

Proof state:
case mp.intro
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
x : M
hx : ∀ (a : R), a ≠ 0 → a • x ≠ 0
⊢ Module.rank R M ≠ 0

Next tactic:
rw [← Cardinal.one_le_iff_ne_zero]
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    rw [← Cardinal.one_le_iff_ne_zero]
    

Proof state:
case mp.intro
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
x : M
hx : ∀ (a : R), a ≠ 0 → a • x ≠ 0
⊢ 1 ≤ Module.rank R M

Next tactic:
have : LinearIndependent R (fun _ : Unit ↦ x)
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    rw [← Cardinal.one_le_iff_ne_zero]
    have : LinearIndependent R (fun _ : Unit ↦ x)
    · 

Proof state:
case this
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
x : M
hx : ∀ (a : R), a ≠ 0 → a • x ≠ 0
⊢ LinearIndependent R fun x_1 => x

Next tactic:
exact linearIndependent_iff.mpr (fun l hl ↦ Finsupp.unique_ext <| not_not.mp fun H ↦
        hx _ H ((Finsupp.total_unique _ _ _).symm.trans hl))
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    rw [← Cardinal.one_le_iff_ne_zero]
    have : LinearIndependent R (fun _ : Unit ↦ x)
    · exact linearIndependent_iff.mpr (fun l hl ↦ Finsupp.unique_ext <| not_not.mp fun H ↦
        hx _ H ((Finsupp.total_unique _ _ _).symm.trans hl))
    

Proof state:
case mp.intro
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
x : M
hx : ∀ (a : R), a ≠ 0 → a • x ≠ 0
this : LinearIndependent R fun x_1 => x
⊢ 1 ≤ Module.rank R M

Next tactic:
simpa using cardinal_lift_le_rank_of_linearIndependent this
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    rw [← Cardinal.one_le_iff_ne_zero]
    have : LinearIndependent R (fun _ : Unit ↦ x)
    · exact linearIndependent_iff.mpr (fun l hl ↦ Finsupp.unique_ext <| not_not.mp fun H ↦
        hx _ H ((Finsupp.total_unique _ _ _).symm.trans hl))
    simpa using cardinal_lift_le_rank_of_linearIndependent this
  · 

Proof state:
case mpr
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
⊢ (∀ (x : M), ∃ a, a ≠ 0 ∧ a • x = 0) → Module.rank R M = 0

Next tactic:
intro h
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    rw [← Cardinal.one_le_iff_ne_zero]
    have : LinearIndependent R (fun _ : Unit ↦ x)
    · exact linearIndependent_iff.mpr (fun l hl ↦ Finsupp.unique_ext <| not_not.mp fun H ↦
        hx _ H ((Finsupp.total_unique _ _ _).symm.trans hl))
    simpa using cardinal_lift_le_rank_of_linearIndependent this
  · intro h
    

Proof state:
case mpr
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
h : ∀ (x : M), ∃ a, a ≠ 0 ∧ a • x = 0
⊢ Module.rank R M = 0

Next tactic:
rw [← le_zero_iff, Module.rank_def]
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    rw [← Cardinal.one_le_iff_ne_zero]
    have : LinearIndependent R (fun _ : Unit ↦ x)
    · exact linearIndependent_iff.mpr (fun l hl ↦ Finsupp.unique_ext <| not_not.mp fun H ↦
        hx _ H ((Finsupp.total_unique _ _ _).symm.trans hl))
    simpa using cardinal_lift_le_rank_of_linearIndependent this
  · intro h
    rw [← le_zero_iff, Module.rank_def]
    

Proof state:
case mpr
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
h : ∀ (x : M), ∃ a, a ≠ 0 ∧ a • x = 0
⊢ ⨆ ι, #↑↑ι ≤ 0

Next tactic:
apply ciSup_le'
/-- See `rank_zero_iff` for a stronger version with `NoZeroSMulDivisor R M`. -/
lemma rank_eq_zero_iff {R M} [Ring R] [AddCommGroup M] [Module R M] :
    Module.rank R M = 0 ↔ ∀ x : M, ∃ a : R, a ≠ 0 ∧ a • x = 0 := by
  nontriviality R
  constructor
  · contrapose!
    rintro ⟨x, hx⟩
    rw [← Cardinal.one_le_iff_ne_zero]
    have : LinearIndependent R (fun _ : Unit ↦ x)
    · exact linearIndependent_iff.mpr (fun l hl ↦ Finsupp.unique_ext <| not_not.mp fun H ↦
        hx _ H ((Finsupp.total_unique _ _ _).symm.trans hl))
    simpa using cardinal_lift_le_rank_of_linearIndependent this
  · intro h
    rw [← le_zero_iff, Module.rank_def]
    apply ciSup_le'
    

Proof state:
case mpr.h
K R✝¹ : Type u
V V₁ V₂ V₃ : Type v
V' V'₁ : Type v'
V'' : Type v''
ι : Type w
ι' : Type w'
η : Type u₁'
φ : η → Type u_1
R✝ : Type u
M✝ : Type v
inst✝⁷ : Ring R✝
inst✝⁶ : AddCommGroup M✝
inst✝⁵ : Module R✝ M✝
inst✝⁴ : NoZeroSMulDivisors R✝ M✝
inst✝³ : Nontrivial R✝
R : Type u_2
M : Type u_3
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
✝ : Nontrivial R
h : ∀ (x : M), ∃ a, a ≠ 0 ∧ a • x = 0
⊢ ∀ (i : { s // LinearIndependent (ι := { x // x ∈ s }) R Subtype.val }), #↑↑i ≤ 0

Next tactic:
intro ⟨s, hs⟩