l3lab/ntp-mathlib huggingface dataset:
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  

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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
⊢ Fintype.card m = Fintype.card n

Next tactic:
have : LinearIndependent R fun i => b i • a := by
    have hb := b.linearIndependent
    rw [Fintype.linearIndependent_iff] at hb ⊢
    intro g hg
    apply hb g
    simp only [← smul_assoc, ← Finset.sum_smul, smul_eq_zero] at hg
    exact hg.resolve_right ha
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  have : LinearIndependent R fun i => b i • a := 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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
⊢ LinearIndependent R fun i => b i • a

Next tactic:
have hb := b.linearIndependent
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  have : LinearIndependent R fun i => b i • a := by
    have hb := b.linearIndependent
    

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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
hb : LinearIndependent R ⇑b
⊢ LinearIndependent R fun i => b i • a

Next tactic:
rw [Fintype.linearIndependent_iff] at hb ⊢
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  have : LinearIndependent R fun i => b i • a := by
    have hb := b.linearIndependent
    rw [Fintype.linearIndependent_iff] at hb ⊢
    

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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
hb : ∀ (g : n → R), ∑ i : n, g i • b i = 0 → ∀ (i : n), g i = 0
⊢ ∀ (g : n → R), ∑ i : n, g i • b i • a = 0 → ∀ (i : n), g i = 0

Next tactic:
intro g hg
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  have : LinearIndependent R fun i => b i • a := by
    have hb := b.linearIndependent
    rw [Fintype.linearIndependent_iff] at hb ⊢
    intro g hg
    

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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
hb : ∀ (g : n → R), ∑ i : n, g i • b i = 0 → ∀ (i : n), g i = 0
g : n → R
hg : ∑ i : n, g i • b i • a = 0
⊢ ∀ (i : n), g i = 0

Next tactic:
apply hb g
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  have : LinearIndependent R fun i => b i • a := by
    have hb := b.linearIndependent
    rw [Fintype.linearIndependent_iff] at hb ⊢
    intro g hg
    apply hb g
    

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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
hb : ∀ (g : n → R), ∑ i : n, g i • b i = 0 → ∀ (i : n), g i = 0
g : n → R
hg : ∑ i : n, g i • b i • a = 0
⊢ ∑ i : n, g i • b i = 0

Next tactic:
simp only [← smul_assoc, ← Finset.sum_smul, smul_eq_zero] at hg
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  have : LinearIndependent R fun i => b i • a := by
    have hb := b.linearIndependent
    rw [Fintype.linearIndependent_iff] at hb ⊢
    intro g hg
    apply hb g
    simp only [← smul_assoc, ← Finset.sum_smul, smul_eq_zero] at hg
    

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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
hb : ∀ (g : n → R), ∑ i : n, g i • b i = 0 → ∀ (i : n), g i = 0
g : n → R
hg : ∑ i : n, g i • b i = 0 ∨ a = 0
⊢ ∑ i : n, g i • b i = 0

Next tactic:
exact hg.resolve_right ha
/-- If `S` a module-finite free `R`-algebra, then the `R`-rank of a nonzero `R`-free
ideal `I` of `S` is the same as the rank of `S`. -/
theorem Ideal.rank_eq {R S : Type*} [CommRing R] [StrongRankCondition R] [Ring S] [IsDomain S]
    [Algebra R S] {n m : Type*} [Fintype n] [Fintype m] (b : Basis n R S) {I : Ideal S}
    (hI : I ≠ ⊥) (c : Basis m R I) : Fintype.card m = Fintype.card n := by
  obtain ⟨a, ha⟩ := Submodule.nonzero_mem_of_bot_lt (bot_lt_iff_ne_bot.mpr hI)
  have : LinearIndependent R fun i => b i • a := by
    have hb := b.linearIndependent
    rw [Fintype.linearIndependent_iff] at hb ⊢
    intro g hg
    apply hb g
    simp only [← smul_assoc, ← Finset.sum_smul, smul_eq_zero] at hg
    exact hg.resolve_right ha
  

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
inst✝¹⁰ : Ring R✝
inst✝⁹ : StrongRankCondition R✝
M : Type v
inst✝⁸ : AddCommGroup M
inst✝⁷ : Module R✝ M
R : Type u_2
S : Type u_3
inst✝⁶ : CommRing R
inst✝⁵ : StrongRankCondition R
inst✝⁴ : Ring S
inst✝³ : IsDomain S
inst✝² : Algebra R S
n : Type u_4
m : Type u_5
inst✝¹ : Fintype n
inst✝ : Fintype m
b : Basis n R S
I : Ideal S
hI : I ≠ ⊥
c : Basis m R ↥I
a : ↥I
ha : a ≠ 0
this : LinearIndependent R fun i => b i • a
⊢ Fintype.card m = Fintype.card n

Next tactic:
exact le_antisymm
    (b.card_le_card_of_linearIndependent (c.linearIndependent.map' (Submodule.subtype I)
      ((LinearMap.ker_eq_bot (f := (Submodule.subtype I : I →ₗ[R] S))).mpr Subtype.coe_injective)))
    (c.card_le_card_of_linearIndependent this)
@[simp]
theorem rank_self : Module.rank R R = 1 := 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
inst✝³ : Ring R
inst✝² : StrongRankCondition R
M : Type v
inst✝¹ : AddCommGroup M
inst✝ : Module R M
⊢ Module.rank R R = 1

Next tactic:
rw [← Cardinal.lift_inj, ← (Basis.singleton PUnit R).mk_eq_rank, Cardinal.mk_punit]
/-- The rank of a free module `V` over an infinite scalar ring `K` is the cardinality of `V`
whenever `#R < #V`. -/
lemma rank_eq_mk_of_infinite_lt [Infinite K] (h_lt : lift.{v} #K < lift.{u} #V) :
    Module.rank K V = #V := 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
inst✝¹¹ : Ring K
inst✝¹⁰ : StrongRankCondition K
inst✝⁹ : AddCommGroup V
inst✝⁸ : Module K V
inst✝⁷ : Free K V
inst✝⁶ : AddCommGroup V'
inst✝⁵ : Module K V'
inst✝⁴ : Free K V'
inst✝³ : AddCommGroup V₁
inst✝² : Module K V₁
inst✝¹ : Free K V₁
inst✝ : Infinite K
h_lt : lift.{v, u} #K < lift.{u, v} #V
⊢ Module.rank K V = #V

Next tactic:
have : Infinite V := infinite_iff.mpr <| lift_le.mp <| le_trans (by simp) h_lt.le
/-- The rank of a free module `V` over an infinite scalar ring `K` is the cardinality of `V`
whenever `#R < #V`. -/
lemma rank_eq_mk_of_infinite_lt [Infinite K] (h_lt : lift.{v} #K < lift.{u} #V) :
    Module.rank K V = #V := by
  have : Infinite V := infinite_iff.mpr <| lift_le.mp <| le_trans (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
inst✝¹¹ : Ring K
inst✝¹⁰ : StrongRankCondition K
inst✝⁹ : AddCommGroup V
inst✝⁸ : Module K V
inst✝⁷ : Free K V
inst✝⁶ : AddCommGroup V'
inst✝⁵ : Module K V'
inst✝⁴ : Free K V'
inst✝³ : AddCommGroup V₁
inst✝² : Module K V₁
inst✝¹ : Free K V₁
inst✝ : Infinite K
h_lt : lift.{v, u} #K < lift.{u, v} #V
⊢ lift.{u, v} ℵ₀ ≤ lift.{v, u} #K

Next tactic:
simp
/-- The rank of a free module `V` over an infinite scalar ring `K` is the cardinality of `V`
whenever `#R < #V`. -/
lemma rank_eq_mk_of_infinite_lt [Infinite K] (h_lt : lift.{v} #K < lift.{u} #V) :
    Module.rank K V = #V := by
  have : Infinite V := infinite_iff.mpr <| lift_le.mp <| le_trans (by simp) h_lt.le
  

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
inst✝¹¹ : Ring K
inst✝¹⁰ : StrongRankCondition K
inst✝⁹ : AddCommGroup V
inst✝⁸ : Module K V
inst✝⁷ : Free K V
inst✝⁶ : AddCommGroup V'
inst✝⁵ : Module K V'
inst✝⁴ : Free K V'
inst✝³ : AddCommGroup V₁
inst✝² : Module K V₁
inst✝¹ : Free K V₁
inst✝ : Infinite K
h_lt : lift.{v, u} #K < lift.{u, v} #V
this : Infinite V
⊢ Module.rank K V = #V

Next tactic:
have h : lift #V = lift #(ChooseBasisIndex K V →₀ K) := lift_mk_eq'.mpr ⟨(chooseBasis K V).repr⟩
/-- The rank of a free module `V` over an infinite scalar ring `K` is the cardinality of `V`
whenever `#R < #V`. -/
lemma rank_eq_mk_of_infinite_lt [Infinite K] (h_lt : lift.{v} #K < lift.{u} #V) :
    Module.rank K V = #V := by
  have : Infinite V := infinite_iff.mpr <| lift_le.mp <| le_trans (by simp) h_lt.le
  have h : lift #V = lift #(ChooseBasisIndex K V →₀ K) := lift_mk_eq'.mpr ⟨(chooseBasis K V).repr⟩
  

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
inst✝¹¹ : Ring K
inst✝¹⁰ : StrongRankCondition K
inst✝⁹ : AddCommGroup V
inst✝⁸ : Module K V
inst✝⁷ : Free K V
inst✝⁶ : AddCommGroup V'
inst✝⁵ : Module K V'
inst✝⁴ : Free K V'
inst✝³ : AddCommGroup V₁
inst✝² : Module K V₁
inst✝¹ : Free K V₁
inst✝ : Infinite K
h_lt : lift.{v, u} #K < lift.{u, v} #V
this : Infinite V
h : lift.{max u v, v} #V = lift.{v, max v u} #(ChooseBasisIndex K V →₀ K)
⊢ Module.rank K V = #V

Next tactic:
simp only [mk_finsupp_lift_of_infinite', lift_id', ← rank_eq_card_chooseBasisIndex, lift_max,
    lift_lift] at h
/-- The rank of a free module `V` over an infinite scalar ring `K` is the cardinality of `V`
whenever `#R < #V`. -/
lemma rank_eq_mk_of_infinite_lt [Infinite K] (h_lt : lift.{v} #K < lift.{u} #V) :
    Module.rank K V = #V := by
  have : Infinite V := infinite_iff.mpr <| lift_le.mp <| le_trans (by simp) h_lt.le
  have h : lift #V = lift #(ChooseBasisIndex K V →₀ K) := lift_mk_eq'.mpr ⟨(chooseBasis K V).repr⟩
  simp only [mk_finsupp_lift_of_infinite', lift_id', ← rank_eq_card_chooseBasisIndex, lift_max,
    lift_lift] at h
  

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
inst✝¹¹ : Ring K
inst✝¹⁰ : StrongRankCondition K
inst✝⁹ : AddCommGroup V
inst✝⁸ : Module K V
inst✝⁷ : Free K V
inst✝⁶ : AddCommGroup V'
inst✝⁵ : Module K V'
inst✝⁴ : Free K V'
inst✝³ : AddCommGroup V₁
inst✝² : Module K V₁
inst✝¹ : Free K V₁
inst✝ : Infinite K
h_lt : lift.{v, u} #K < lift.{u, v} #V
this : Infinite V
h : lift.{max u v, v} #V = max (lift.{max u v, v} (Module.rank K V)) (lift.{v, u} #K)
⊢ Module.rank K V = #V

Next tactic:
refine lift_inj.mp ((max_eq_iff.mp h.symm).resolve_right <| not_and_of_not_left _ ?_).left
/-- The rank of a free module `V` over an infinite scalar ring `K` is the cardinality of `V`
whenever `#R < #V`. -/
lemma rank_eq_mk_of_infinite_lt [Infinite K] (h_lt : lift.{v} #K < lift.{u} #V) :
    Module.rank K V = #V := by
  have : Infinite V := infinite_iff.mpr <| lift_le.mp <| le_trans (by simp) h_lt.le
  have h : lift #V = lift #(ChooseBasisIndex K V →₀ K) := lift_mk_eq'.mpr ⟨(chooseBasis K V).repr⟩
  simp only [mk_finsupp_lift_of_infinite', lift_id', ← rank_eq_card_chooseBasisIndex, lift_max,
    lift_lift] at h
  refine lift_inj.mp ((max_eq_iff.mp h.symm).resolve_right <| not_and_of_not_left _ ?_).left
  

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
inst✝¹¹ : Ring K
inst✝¹⁰ : StrongRankCondition K
inst✝⁹ : AddCommGroup V
inst✝⁸ : Module K V
inst✝⁷ : Free K V
inst✝⁶ : AddCommGroup V'
inst✝⁵ : Module K V'
inst✝⁴ : Free K V'
inst✝³ : AddCommGroup V₁
inst✝² : Module K V₁
inst✝¹ : Free K V₁
inst✝ : Infinite K
h_lt : lift.{v, u} #K < lift.{u, v} #V
this : Infinite V
h : lift.{max u v, v} #V = max (lift.{max u v, v} (Module.rank K V)) (lift.{v, u} #K)
⊢ ¬lift.{v, u} #K = lift.{max u v, v} #V

Next tactic:
exact (lift_umax.{v, u}.symm ▸ h_lt).ne
/-- Two vector spaces are isomorphic if they have the same dimension. -/
theorem nonempty_linearEquiv_of_lift_rank_eq
    (cnd : Cardinal.lift.{v'} (Module.rank K V) = Cardinal.lift.{v} (Module.rank K V')) :
    Nonempty (V ≃ₗ[K] V') := 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
inst✝¹⁰ : Ring K
inst✝⁹ : StrongRankCondition K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
inst✝⁶ : Module.Free K V
inst✝⁵ : AddCommGroup V'
inst✝⁴ : Module K V'
inst✝³ : Module.Free K V'
inst✝² : AddCommGroup V₁
inst✝¹ : Module K V₁
inst✝ : Module.Free K V₁
cnd : lift.{v', v} (Module.rank K V) = lift.{v, v'} (Module.rank K V')
⊢ Nonempty (V ≃ₗ[K] V')

Next tactic:
obtain ⟨⟨_, B⟩⟩ := Module.Free.exists_basis (R := K) (M := V)
/-- Two vector spaces are isomorphic if they have the same dimension. -/
theorem nonempty_linearEquiv_of_lift_rank_eq
    (cnd : Cardinal.lift.{v'} (Module.rank K V) = Cardinal.lift.{v} (Module.rank K V')) :
    Nonempty (V ≃ₗ[K] V') := by
  obtain ⟨⟨_, B⟩⟩ := Module.Free.exists_basis (R := K) (M := V)
  

Proof state:
case intro.mk
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
inst✝¹⁰ : Ring K
inst✝⁹ : StrongRankCondition K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
inst✝⁶ : Module.Free K V
inst✝⁵ : AddCommGroup V'
inst✝⁴ : Module K V'
inst✝³ : Module.Free K V'
inst✝² : AddCommGroup V₁
inst✝¹ : Module K V₁
inst✝ : Module.Free K V₁
cnd : lift.{v', v} (Module.rank K V) = lift.{v, v'} (Module.rank K V')
fst✝ : Type v
B : Basis fst✝ K V
⊢ Nonempty (V ≃ₗ[K] V')

Next tactic:
obtain ⟨⟨_, B'⟩⟩ := Module.Free.exists_basis (R := K) (M := V')
/-- Two vector spaces are isomorphic if they have the same dimension. -/
theorem nonempty_linearEquiv_of_lift_rank_eq
    (cnd : Cardinal.lift.{v'} (Module.rank K V) = Cardinal.lift.{v} (Module.rank K V')) :
    Nonempty (V ≃ₗ[K] V') := by
  obtain ⟨⟨_, B⟩⟩ := Module.Free.exists_basis (R := K) (M := V)
  obtain ⟨⟨_, B'⟩⟩ := Module.Free.exists_basis (R := K) (M := V')
  

Proof state:
case intro.mk.intro.mk
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
inst✝¹⁰ : Ring K
inst✝⁹ : StrongRankCondition K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
inst✝⁶ : Module.Free K V
inst✝⁵ : AddCommGroup V'
inst✝⁴ : Module K V'
inst✝³ : Module.Free K V'
inst✝² : AddCommGroup V₁
inst✝¹ : Module K V₁
inst✝ : Module.Free K V₁
cnd : lift.{v', v} (Module.rank K V) = lift.{v, v'} (Module.rank K V')
fst✝¹ : Type v
B : Basis fst✝¹ K V
fst✝ : Type v'
B' : Basis fst✝ K V'
⊢ Nonempty (V ≃ₗ[K] V')

Next tactic:
have : Cardinal.lift.{v', v} #_ = Cardinal.lift.{v, v'} #_ := by
    rw [B.mk_eq_rank'', cnd, B'.mk_eq_rank'']
/-- Two vector spaces are isomorphic if they have the same dimension. -/
theorem nonempty_linearEquiv_of_lift_rank_eq
    (cnd : Cardinal.lift.{v'} (Module.rank K V) = Cardinal.lift.{v} (Module.rank K V')) :
    Nonempty (V ≃ₗ[K] V') := by
  obtain ⟨⟨_, B⟩⟩ := Module.Free.exists_basis (R := K) (M := V)
  obtain ⟨⟨_, B'⟩⟩ := Module.Free.exists_basis (R := K) (M := V')
  have : Cardinal.lift.{v', v} #_ = Cardinal.lift.{v, v'} #_ := 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
inst✝¹⁰ : Ring K
inst✝⁹ : StrongRankCondition K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
inst✝⁶ : Module.Free K V
inst✝⁵ : AddCommGroup V'
inst✝⁴ : Module K V'
inst✝³ : Module.Free K V'
inst✝² : AddCommGroup V₁
inst✝¹ : Module K V₁
inst✝ : Module.Free K V₁
cnd : lift.{v', v} (Module.rank K V) = lift.{v, v'} (Module.rank K V')
fst✝¹ : Type v
B : Basis fst✝¹ K V
fst✝ : Type v'
B' : Basis fst✝ K V'
⊢ lift.{v', v} #?m.545380 = lift.{v, v'} #?m.545382

Next tactic:
rw [B.mk_eq_rank'', cnd, B'.mk_eq_rank'']
/-- Two vector spaces are isomorphic if they have the same dimension. -/
theorem nonempty_linearEquiv_of_lift_rank_eq
    (cnd : Cardinal.lift.{v'} (Module.rank K V) = Cardinal.lift.{v} (Module.rank K V')) :
    Nonempty (V ≃ₗ[K] V') := by
  obtain ⟨⟨_, B⟩⟩ := Module.Free.exists_basis (R := K) (M := V)
  obtain ⟨⟨_, B'⟩⟩ := Module.Free.exists_basis (R := K) (M := V')
  have : Cardinal.lift.{v', v} #_ = Cardinal.lift.{v, v'} #_ := by
    rw [B.mk_eq_rank'', cnd, B'.mk_eq_rank'']
  

Proof state:
case intro.mk.intro.mk
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
inst✝¹⁰ : Ring K
inst✝⁹ : StrongRankCondition K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
inst✝⁶ : Module.Free K V
inst✝⁵ : AddCommGroup V'
inst✝⁴ : Module K V'
inst✝³ : Module.Free K V'
inst✝² : AddCommGroup V₁
inst✝¹ : Module K V₁
inst✝ : Module.Free K V₁
cnd : lift.{v', v} (Module.rank K V) = lift.{v, v'} (Module.rank K V')
fst✝¹ : Type v
B : Basis fst✝¹ K V
fst✝ : Type v'
B' : Basis fst✝ K V'
this : lift.{v', v} #fst✝¹ = lift.{v, v'} #fst✝
⊢ Nonempty (V ≃ₗ[K] V')

Next tactic:
exact (Cardinal.lift_mk_eq.{v, v', 0}.1 this).map (B.equiv B')
/-- If `M` and `N` are free, then the rank of `M × N` is
`(Module.rank R M).lift + (Module.rank R N).lift`. -/
@[simp]
theorem rank_prod : Module.rank K (V × V') =
    Cardinal.lift.{v'} (Module.rank K V) + Cardinal.lift.{v, v'} (Module.rank K V') := 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
inst✝¹⁰ : Ring K
inst✝⁹ : StrongRankCondition K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
inst✝⁶ : Module.Free K V
inst✝⁵ : AddCommGroup V'
inst✝⁴ : Module K V'
inst✝³ : Module.Free K V'
inst✝² : AddCommGroup V₁
inst✝¹ : Module K V₁
inst✝ : Module.Free K V₁
⊢ Module.rank K (V × V') = lift.{v', v} (Module.rank K V) + lift.{v, v'} (Module.rank K V')

Next tactic:
simpa [rank_eq_card_chooseBasisIndex K V, rank_eq_card_chooseBasisIndex K V', lift_umax,
    lift_umax'] using ((chooseBasis K V).prod (chooseBasis K V')).mk_eq_rank.symm
/-- If `M` and `N` are free (and lie in the same universe), the rank of `M × N` is
  `(Module.rank R M) + (Module.rank R N)`. -/
theorem rank_prod' : Module.rank K (V × V₁) = Module.rank K V + Module.rank K V₁ := 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
inst✝¹⁰ : Ring K
inst✝⁹ : StrongRankCondition K
inst✝⁸ : AddCommGroup V
inst✝⁷ : Module K V
inst✝⁶ : Module.Free K V
inst✝⁵ : AddCommGroup V'
inst✝⁴ : Module K V'
inst✝³ : Module.Free K V'
inst✝² : AddCommGroup V₁
inst✝¹ : Module K V₁
inst✝ : Module.Free K V₁
⊢ Module.rank K (V × V₁) = Module.rank K V + Module.rank K V₁

Next tactic:
simp