-- Mathlib/LinearAlgebra/Dimension/Localization.lean
/-- A domain that is not (left) Ore is of infinite rank.
See [cohn_1995] Proposition 1.3.6 -/
lemma aleph0_le_rank_of_isEmpty_oreSet (hS : IsEmpty (OreLocalization.OreSet R⁰)) :
    ℵ₀ ≤ Module.rank R R

Proof state:
case intro.intro.succ
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg : ∑ k ∈ Finset.range n, g (k + 1) • (r * ↑s ^ (k + 1 + x)) + g 0 • (r * ↑s ^ (0 + x)) = 0
i : ℕ
hin : i < n + 1
⊢ g i = 0

Tactic:
by_cases hg0 : g 0 = 0

Result:
case pos
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg : ∑ k ∈ Finset.range n, g (k + 1) • (r * ↑s ^ (k + 1 + x)) + g 0 • (r * ↑s ^ (0 + x)) = 0
i : ℕ
hin : i < n + 1
hg0 : g 0 = 0
⊢ g i = 0

case neg
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg : ∑ k ∈ Finset.range n, g (k + 1) • (r * ↑s ^ (k + 1 + x)) + g 0 • (r * ↑s ^ (0 + x)) = 0
i : ℕ
hin : i < n + 1
hg0 : ¬g 0 = 0
⊢ g i = 0

Proof state:
case intro.intro
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
⊢ LinearIndependent R fun i => r * ↑s ^ ↑i

Tactic:
suffices ∀ (g : ℕ → R) (x), (∑ i ∈ Finset.range n, g i • (r * s ^ (i + x))) = 0 →
    ∀ i < n, g i = 0 by
  refine Fintype.linearIndependent_iff.mpr fun g hg i ↦ ?_
  simpa only [dif_pos i.prop] using this (fun i ↦ if h : i < n then g ⟨i, h⟩ else 0) 0
    (by simp [← Fin.sum_univ_eq_sum_range, ← hg]) i i.prop

Result:
case intro.intro
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
⊢ ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0

Proof state:
case pos
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg : ∑ k ∈ Finset.range n, g (k + 1) • (r * ↑s ^ (k + 1 + x)) + g 0 • (r * ↑s ^ (0 + x)) = 0
i : ℕ
hin : i < n + 1
hg0 : g 0 = 0
⊢ g i = 0

Tactic:
simp only [hg0, zero_smul, add_zero, add_assoc] at hg

Result:
case pos
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x i : ℕ
hin : i < n + 1
hg0 : g 0 = 0
hg : ∑ x_1 ∈ Finset.range n, g (x_1 + 1) • (r * ↑s ^ (x_1 + (1 + x))) = 0
⊢ g i = 0

Proof state:
case intro.intro
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
⊢ ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0

Tactic:
intro g x hg i hin

Result:
case intro.intro
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
g : ℕ → R
x : ℕ
hg : ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0
i : ℕ
hin : i < n
⊢ g i = 0

Proof state:
case pos.zero
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg0 : g 0 = 0
hg : ∑ x_1 ∈ Finset.range n, g (x_1 + 1) • (r * ↑s ^ (x_1 + (1 + x))) = 0
hin : 0 < n + 1
⊢ g 0 = 0

case pos.succ
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg0 : g 0 = 0
hg : ∑ x_1 ∈ Finset.range n, g (x_1 + 1) • (r * ↑s ^ (x_1 + (1 + x))) = 0
n✝ : ℕ
hin : n✝ + 1 < n + 1
⊢ g (n✝ + 1) = 0

Tactic:
exacts [hg0, IH _ _ hg _ (Nat.succ_lt_succ_iff.mp hin)]

Result:
no goals

Proof state:
case pos
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x i : ℕ
hin : i < n + 1
hg0 : g 0 = 0
hg : ∑ x_1 ∈ Finset.range n, g (x_1 + 1) • (r * ↑s ^ (x_1 + (1 + x))) = 0
⊢ g i = 0

Tactic:
cases i

Result:
case pos.zero
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg0 : g 0 = 0
hg : ∑ x_1 ∈ Finset.range n, g (x_1 + 1) • (r * ↑s ^ (x_1 + (1 + x))) = 0
hin : 0 < n + 1
⊢ g 0 = 0

case pos.succ
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg0 : g 0 = 0
hg : ∑ x_1 ∈ Finset.range n, g (x_1 + 1) • (r * ↑s ^ (x_1 + (1 + x))) = 0
n✝ : ℕ
hin : n✝ + 1 < n + 1
⊢ g (n✝ + 1) = 0

Proof state:
case neg
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x : ℕ
hg : ∑ k ∈ Finset.range n, g (k + 1) • (r * ↑s ^ (k + 1 + x)) + g 0 • (r * ↑s ^ (0 + x)) = 0
i : ℕ
hin : i < n + 1
hg0 : ¬g 0 = 0
⊢ g i = 0

Tactic:
simp only [MulOpposite.smul_eq_mul_unop, zero_add, ← add_comm _ x, pow_add _ _ x,
  ← mul_assoc, pow_succ, ← Finset.sum_mul, pow_zero, one_mul, smul_eq_mul] at hg

Result:
case neg
R : Type u_1
inst✝¹ : Ring R
inst✝ : IsDomain R
r : R
s : ↥R⁰
h : ∀ (r' : R) (s' : ↥R⁰), ↑s' * r ≠ r' * ↑s
n : ℕ
IH : ∀ (g : ℕ → R) (x : ℕ), ∑ i ∈ Finset.range n, g i • (r * ↑s ^ (i + x)) = 0 → ∀ i < n, g i = 0
g : ℕ → R
x i : ℕ
hin : i < n + 1
hg0 : ¬g 0 = 0
hg : (∑ i ∈ Finset.range n, g (i + 1) * r * ↑s ^ i) * ↑s * ↑s ^ x + g 0 * r * ↑s ^ x = 0
⊢ g i = 0