l3lab/ntp-mathlib huggingface dataset:
theorem isCauSeq_series_of_abv_le_of_isCauSeq {f : ℕ → β} {g : ℕ → α} (n : ℕ) :
    (∀ m, n ≤ m → abv (f m) ≤ g m) →
      (IsCauSeq abs fun n => ∑ i in range n, g i) → IsCauSeq abv fun n => ∑ i in range n, f i := by
  intro hm hg ε ε0
  cases' hg (ε / 2) (div_pos ε0 (by norm_num)) with i hi
  exists max n i
  intro j ji
  have hi₁ := hi j (le_trans (le_max_right n i) ji)
  have hi₂ := hi (max n i) (le_max_right n i)
  have sub_le :=
    abs_sub_le (∑ k in range j, g k) (∑ k in range i, g k) (∑ k in range (max n i), g k)
  have := add_lt_add hi₁ hi₂
  rw [abs_sub_comm (∑ k in range (max n i), g k), add_halves ε] at this
  refine' lt_of_le_of_lt (le_trans (le_trans _ (le_abs_self _)) sub_le) this
  generalize hk : j - max n i = k
  clear this hi₂ hi₁ hi ε0 ε hg sub_le
  rw [tsub_eq_iff_eq_add_of_le ji] at hk
  rw [hk]
  dsimp only
  clear hk ji j
  induction' k with k' hi
  · simp [abv_zero abv]
  · simp only [Nat.succ_add, Nat.succ_eq_add_one, Finset.sum_range_succ_comm]
    simp only [add_assoc, sub_eq_add_neg]
    

Proof state:
case intro.succ
α : Type u_1
β : Type u_2
inst✝² : Ring β
inst✝¹ : LinearOrderedField α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
g : ℕ → α
n : ℕ
hm : ∀ (m : ℕ), n ≤ m → abv (f m) ≤ g m
i k' : ℕ
hi :
  abv (∑ i in range (k' + max n i), f i - ∑ i in range (max n i), f i) ≤
    ∑ k in range (k' + max n i), g k - ∑ k in range (max n i), g k
⊢ abv (f (k' + max n i) + (∑ x in range (k' + max n i), f x + -∑ x in range (max n i), f x)) ≤
    g (k' + max n i) + (∑ x in range (k' + max n i), g x + -∑ x in range (max n i), g x)

Next tactic:
refine le_trans (abv_add _ _ _) ?_
theorem isCauSeq_series_of_abv_le_of_isCauSeq {f : ℕ → β} {g : ℕ → α} (n : ℕ) :
    (∀ m, n ≤ m → abv (f m) ≤ g m) →
      (IsCauSeq abs fun n => ∑ i in range n, g i) → IsCauSeq abv fun n => ∑ i in range n, f i := by
  intro hm hg ε ε0
  cases' hg (ε / 2) (div_pos ε0 (by norm_num)) with i hi
  exists max n i
  intro j ji
  have hi₁ := hi j (le_trans (le_max_right n i) ji)
  have hi₂ := hi (max n i) (le_max_right n i)
  have sub_le :=
    abs_sub_le (∑ k in range j, g k) (∑ k in range i, g k) (∑ k in range (max n i), g k)
  have := add_lt_add hi₁ hi₂
  rw [abs_sub_comm (∑ k in range (max n i), g k), add_halves ε] at this
  refine' lt_of_le_of_lt (le_trans (le_trans _ (le_abs_self _)) sub_le) this
  generalize hk : j - max n i = k
  clear this hi₂ hi₁ hi ε0 ε hg sub_le
  rw [tsub_eq_iff_eq_add_of_le ji] at hk
  rw [hk]
  dsimp only
  clear hk ji j
  induction' k with k' hi
  · simp [abv_zero abv]
  · simp only [Nat.succ_add, Nat.succ_eq_add_one, Finset.sum_range_succ_comm]
    simp only [add_assoc, sub_eq_add_neg]
    refine le_trans (abv_add _ _ _) ?_
    

Proof state:
case intro.succ
α : Type u_1
β : Type u_2
inst✝² : Ring β
inst✝¹ : LinearOrderedField α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
g : ℕ → α
n : ℕ
hm : ∀ (m : ℕ), n ≤ m → abv (f m) ≤ g m
i k' : ℕ
hi :
  abv (∑ i in range (k' + max n i), f i - ∑ i in range (max n i), f i) ≤
    ∑ k in range (k' + max n i), g k - ∑ k in range (max n i), g k
⊢ abv (f (k' + max n i)) + abv (∑ x in range (k' + max n i), f x + -∑ x in range (max n i), f x) ≤
    g (k' + max n i) + (∑ x in range (k' + max n i), g x + -∑ x in range (max n i), g x)

Next tactic:
simp only [sub_eq_add_neg] at hi
theorem isCauSeq_series_of_abv_le_of_isCauSeq {f : ℕ → β} {g : ℕ → α} (n : ℕ) :
    (∀ m, n ≤ m → abv (f m) ≤ g m) →
      (IsCauSeq abs fun n => ∑ i in range n, g i) → IsCauSeq abv fun n => ∑ i in range n, f i := by
  intro hm hg ε ε0
  cases' hg (ε / 2) (div_pos ε0 (by norm_num)) with i hi
  exists max n i
  intro j ji
  have hi₁ := hi j (le_trans (le_max_right n i) ji)
  have hi₂ := hi (max n i) (le_max_right n i)
  have sub_le :=
    abs_sub_le (∑ k in range j, g k) (∑ k in range i, g k) (∑ k in range (max n i), g k)
  have := add_lt_add hi₁ hi₂
  rw [abs_sub_comm (∑ k in range (max n i), g k), add_halves ε] at this
  refine' lt_of_le_of_lt (le_trans (le_trans _ (le_abs_self _)) sub_le) this
  generalize hk : j - max n i = k
  clear this hi₂ hi₁ hi ε0 ε hg sub_le
  rw [tsub_eq_iff_eq_add_of_le ji] at hk
  rw [hk]
  dsimp only
  clear hk ji j
  induction' k with k' hi
  · simp [abv_zero abv]
  · simp only [Nat.succ_add, Nat.succ_eq_add_one, Finset.sum_range_succ_comm]
    simp only [add_assoc, sub_eq_add_neg]
    refine le_trans (abv_add _ _ _) ?_
    simp only [sub_eq_add_neg] at hi
    

Proof state:
case intro.succ
α : Type u_1
β : Type u_2
inst✝² : Ring β
inst✝¹ : LinearOrderedField α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
g : ℕ → α
n : ℕ
hm : ∀ (m : ℕ), n ≤ m → abv (f m) ≤ g m
i k' : ℕ
hi :
  abv (∑ i in range (k' + max n i), f i + -∑ i in range (max n i), f i) ≤
    ∑ k in range (k' + max n i), g k + -∑ k in range (max n i), g k
⊢ abv (f (k' + max n i)) + abv (∑ x in range (k' + max n i), f x + -∑ x in range (max n i), f x) ≤
    g (k' + max n i) + (∑ x in range (k' + max n i), g x + -∑ x in range (max n i), g x)

Next tactic:
refine add_le_add (hm _ (le_add_of_nonneg_of_le (Nat.zero_le _) (le_max_left _ _))) hi
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by 

Proof state:
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
h : abv x = 1
⊢ False

Next tactic:
simp [h, lt_irrefl] at hx1
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      

Proof state:
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
⊢ IsCauSeq abs' fun m => ∑ n in range m, abv (x ^ n)

Next tactic:
simp only [abv_pow abv, geom_sum_eq hx1']
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      

Proof state:
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
⊢ IsCauSeq abs' fun m => (abv x ^ m - 1) / (abv x - 1)

Next tactic:
conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => 

Proof state:
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
m : ℕ
| (abv x ^ m - 1) / (abv x - 1)

Next tactic:
rw [← neg_div_neg_eq, neg_sub, neg_sub]
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      

Proof state:
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
⊢ IsCauSeq abs' fun m => (1 - abv x ^ m) / (1 - abv x)

Next tactic:
have : 0 < 1 - abv x := sub_pos.2 hx1
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      

Proof state:
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
⊢ IsCauSeq abs' fun m => (1 - abv x ^ m) / (1 - abv x)

Next tactic:
refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · 

Proof state:
case refine'_1
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
⊢ ∀ n ≥ 0, abs' ((1 - abv x ^ n) / (1 - abv x)) ≤ 1 / (1 - abv x)

Next tactic:
intro n _
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        

Proof state:
case refine'_1
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ abs' ((1 - abv x ^ n) / (1 - abv x)) ≤ 1 / (1 - abv x)

Next tactic:
rw [abs_of_nonneg]
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        

Proof state:
case refine'_1
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ (1 - abv x ^ n) / (1 - abv x) ≤ 1 / (1 - abv x)
case refine'_1
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ 0 ≤ (1 - abv x ^ n) / (1 - abv x)

Next tactic:
gcongr
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        gcongr
        · 

Proof state:
case refine'_1.h
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ 1 - abv x ^ n ≤ 1

Next tactic:
exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        gcongr
        · exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
        

Proof state:
case refine'_1
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ 0 ≤ (1 - abv x ^ n) / (1 - abv x)

Next tactic:
refine' div_nonneg (sub_nonneg.2 _) (sub_nonneg.2 <| le_of_lt hx1)
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        gcongr
        · exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
        refine' div_nonneg (sub_nonneg.2 _) (sub_nonneg.2 <| le_of_lt hx1)
        

Proof state:
case refine'_1
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ abv x ^ n ≤ 1

Next tactic:
exact pow_le_one _ (by positivity) hx1.le
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        gcongr
        · exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
        refine' div_nonneg (sub_nonneg.2 _) (sub_nonneg.2 <| le_of_lt hx1)
        exact pow_le_one _ (by 

Proof state:
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ 0 ≤ abv x

Next tactic:
positivity
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        gcongr
        · exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
        refine' div_nonneg (sub_nonneg.2 _) (sub_nonneg.2 <| le_of_lt hx1)
        exact pow_le_one _ (by positivity) hx1.le
      · 

Proof state:
case refine'_2
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
⊢ ∀ n ≥ 0, (1 - abv x ^ n) / (1 - abv x) ≤ (1 - abv x ^ Nat.succ n) / (1 - abv x)

Next tactic:
intro n _
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        gcongr
        · exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
        refine' div_nonneg (sub_nonneg.2 _) (sub_nonneg.2 <| le_of_lt hx1)
        exact pow_le_one _ (by positivity) hx1.le
      · intro n _
        

Proof state:
case refine'_2
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ (1 - abv x ^ n) / (1 - abv x) ≤ (1 - abv x ^ Nat.succ n) / (1 - abv x)

Next tactic:
rw [← one_mul (abv x ^ n), pow_succ]
theorem isCauSeq_geo_series {β : Type*} [Ring β] [Nontrivial β] {abv : β → α} [IsAbsoluteValue abv]
    (x : β) (hx1 : abv x < 1) : IsCauSeq abv fun n => ∑ m in range n, x ^ m :=
  have hx1' : abv x ≠ 1 := fun h => by simp [h, lt_irrefl] at hx1
  isCauSeq_series_of_abv_isCauSeq
    (by
      simp only [abv_pow abv, geom_sum_eq hx1']
      conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
      have : 0 < 1 - abv x := sub_pos.2 hx1
      refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
      · intro n _
        rw [abs_of_nonneg]
        gcongr
        · exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
        refine' div_nonneg (sub_nonneg.2 _) (sub_nonneg.2 <| le_of_lt hx1)
        exact pow_le_one _ (by positivity) hx1.le
      · intro n _
        rw [← one_mul (abv x ^ n), pow_succ]
        

Proof state:
case refine'_2
α : Type u_1
inst✝⁴ : LinearOrderedField α
inst✝³ : Archimedean α
β : Type u_2
inst✝² : Ring β
inst✝¹ : Nontrivial β
abv : β → α
inst✝ : IsAbsoluteValue abv
x : β
hx1 : abv x < 1
hx1' : abv x ≠ 1
this : 0 < 1 - abv x
n : ℕ
a✝ : n ≥ 0
⊢ (1 - 1 * abv x ^ n) / (1 - abv x) ≤ (1 - abv x * abv x ^ n) / (1 - abv x)

Next tactic:
gcongr
theorem isCauSeq_geo_series_const (a : α) {x : α} (hx1 : |x| < 1) :
    IsCauSeq abs fun m => ∑ n in range m, (a * x ^ n) := by
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : Archimedean α
a x : α
hx1 : abs' x < 1
⊢ IsCauSeq abs' fun m => ∑ n in range m, a * x ^ n

Next tactic:
have : IsCauSeq abs fun m => a * ∑ n in range m, (x ^ n) :=
    (CauSeq.const abs a *
      (show CauSeq α abs from ⟨fun n => ∑ m in range n, x ^ m, isCauSeq_geo_series x hx1⟩)).2
theorem isCauSeq_geo_series_const (a : α) {x : α} (hx1 : |x| < 1) :
    IsCauSeq abs fun m => ∑ n in range m, (a * x ^ n) := by
  have : IsCauSeq abs fun m => a * ∑ n in range m, (x ^ n) :=
    (CauSeq.const abs a *
      (show CauSeq α abs from ⟨fun n => ∑ m in range n, x ^ m, isCauSeq_geo_series x hx1⟩)).2
  

Proof state:
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : Archimedean α
a x : α
hx1 : abs' x < 1
this : IsCauSeq abs' fun m => a * ∑ n in range m, x ^ n
⊢ IsCauSeq abs' fun m => ∑ n in range m, a * x ^ n

Next tactic:
simpa [mul_sum] using this
theorem series_ratio_test {f : ℕ → β} (n : ℕ) (r : α) (hr0 : 0 ≤ r) (hr1 : r < 1)
    (h : ∀ m, n ≤ m → abv (f m.succ) ≤ r * abv (f m)) :
    IsCauSeq abv fun m => ∑ n in range m, f n := by
  

Proof state:
α : Type u_1
inst✝³ : LinearOrderedField α
inst✝² : Archimedean α
β : Type u_2
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
n : ℕ
r : α
hr0 : 0 ≤ r
hr1 : r < 1
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
⊢ IsCauSeq abv fun m => ∑ n in range m, f n

Next tactic:
have har1 : |r| < 1 := by rwa [abs_of_nonneg hr0]
theorem series_ratio_test {f : ℕ → β} (n : ℕ) (r : α) (hr0 : 0 ≤ r) (hr1 : r < 1)
    (h : ∀ m, n ≤ m → abv (f m.succ) ≤ r * abv (f m)) :
    IsCauSeq abv fun m => ∑ n in range m, f n := by
  have har1 : |r| < 1 := by 

Proof state:
α : Type u_1
inst✝³ : LinearOrderedField α
inst✝² : Archimedean α
β : Type u_2
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
n : ℕ
r : α
hr0 : 0 ≤ r
hr1 : r < 1
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
⊢ abs' r < 1

Next tactic:
rwa [abs_of_nonneg hr0]
theorem series_ratio_test {f : ℕ → β} (n : ℕ) (r : α) (hr0 : 0 ≤ r) (hr1 : r < 1)
    (h : ∀ m, n ≤ m → abv (f m.succ) ≤ r * abv (f m)) :
    IsCauSeq abv fun m => ∑ n in range m, f n := by
  have har1 : |r| < 1 := by rwa [abs_of_nonneg hr0]
  

Proof state:
α : Type u_1
inst✝³ : LinearOrderedField α
inst✝² : Archimedean α
β : Type u_2
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
n : ℕ
r : α
hr0 : 0 ≤ r
hr1 : r < 1
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
har1 : abs' r < 1
⊢ IsCauSeq abv fun m => ∑ n in range m, f n

Next tactic:
refine'
    isCauSeq_series_of_abv_le_of_isCauSeq n.succ _
      (isCauSeq_geo_series_const (abv (f n.succ) * r⁻¹ ^ n.succ) har1)
theorem series_ratio_test {f : ℕ → β} (n : ℕ) (r : α) (hr0 : 0 ≤ r) (hr1 : r < 1)
    (h : ∀ m, n ≤ m → abv (f m.succ) ≤ r * abv (f m)) :
    IsCauSeq abv fun m => ∑ n in range m, f n := by
  have har1 : |r| < 1 := by rwa [abs_of_nonneg hr0]
  refine'
    isCauSeq_series_of_abv_le_of_isCauSeq n.succ _
      (isCauSeq_geo_series_const (abv (f n.succ) * r⁻¹ ^ n.succ) har1)
  

Proof state:
α : Type u_1
inst✝³ : LinearOrderedField α
inst✝² : Archimedean α
β : Type u_2
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
n : ℕ
r : α
hr0 : 0 ≤ r
hr1 : r < 1
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
har1 : abs' r < 1
⊢ ∀ (m : ℕ), Nat.succ n ≤ m → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m

Next tactic:
intro m hmn
theorem series_ratio_test {f : ℕ → β} (n : ℕ) (r : α) (hr0 : 0 ≤ r) (hr1 : r < 1)
    (h : ∀ m, n ≤ m → abv (f m.succ) ≤ r * abv (f m)) :
    IsCauSeq abv fun m => ∑ n in range m, f n := by
  have har1 : |r| < 1 := by rwa [abs_of_nonneg hr0]
  refine'
    isCauSeq_series_of_abv_le_of_isCauSeq n.succ _
      (isCauSeq_geo_series_const (abv (f n.succ) * r⁻¹ ^ n.succ) har1)
  intro m hmn
  

Proof state:
α : Type u_1
inst✝³ : LinearOrderedField α
inst✝² : Archimedean α
β : Type u_2
inst✝¹ : Ring β
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → β
n : ℕ
r : α
hr0 : 0 ≤ r
hr1 : r < 1
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
har1 : abs' r < 1
m : ℕ
hmn : Nat.succ n ≤ m
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m

Next tactic:
cases' Classical.em (r = 0) with r_zero r_ne_zero