Theorem: isCauSeq_series_of_abv_le_of_isCauSeq
File: Mathlib/Data/Complex/Exponential.lean

tactic: intro hm hg ε ε0
state_before: α : Type u_1
β : Type u_2
inst✝² : Ring β
inst✝¹ : LinearOrderedField α
abv : β → α
inst✝ : IsAbsoluteValue abv
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

tactic: cases' hg (ε / 2) (div_pos ε0 (by norm_num)) with i hi
state_before: α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) i) < ε

tactic: exists max n i
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) i) < ε

tactic: intro j ji
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
⊢ ∀ (j : ℕ), j ≥ max n i → abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) < ε

tactic: have hi₁ := hi j (le_trans (le_max_right n i) ji)
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) < ε

tactic: have hi₂ := hi (max n i) (le_max_right n i)
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
hi₁ : abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) < ε

tactic: 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)
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
hi₁ : abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
hi₂ : abs' ((fun n => ∑ i in range n, g i) (max n i) - (fun n => ∑ i in range n, g i) i) < ε / 2
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) < ε

tactic: have := add_lt_add hi₁ hi₂
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
hi₁ : abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
hi₂ : abs' ((fun n => ∑ i in range n, g i) (max n i) - (fun n => ∑ i in range n, g i) i) < ε / 2
sub_le :
  abs' (∑ k in range j, g k - ∑ k in range (max n i), g k) ≤
    abs' (∑ k in range j, g k - ∑ k in range i, g k) + abs' (∑ k in range i, g k - ∑ k in range (max n i), g k)
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) < ε

tactic: rw [abs_sub_comm (∑ k in range (max n i), g k), add_halves ε] at this
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
hi₁ : abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
hi₂ : abs' ((fun n => ∑ i in range n, g i) (max n i) - (fun n => ∑ i in range n, g i) i) < ε / 2
sub_le :
  abs' (∑ k in range j, g k - ∑ k in range (max n i), g k) ≤
    abs' (∑ k in range j, g k - ∑ k in range i, g k) + abs' (∑ k in range i, g k - ∑ k in range (max n i), g k)
this :
  abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) +
      abs' ((fun n => ∑ i in range n, g i) (max n i) - (fun n => ∑ i in range n, g i) i) <
    ε / 2 + ε / 2
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) < ε

tactic: refine' lt_of_le_of_lt (le_trans (le_trans _ (le_abs_self _)) sub_le) this
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
hi₁ : abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
hi₂ : abs' ((fun n => ∑ i in range n, g i) (max n i) - (fun n => ∑ i in range n, g i) i) < ε / 2
sub_le :
  abs' (∑ k in range j, g k - ∑ k in range (max n i), g k) ≤
    abs' (∑ k in range j, g k - ∑ k in range i, g k) + abs' (∑ k in range i, g k - ∑ k in range (max n i), g k)
this :
  abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) +
      abs' ((fun n => ∑ i in range n, g i) i - ∑ k in range (max n i), g k) <
    ε
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) < ε

tactic: generalize hk : j - max n i = k
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
hi₁ : abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
hi₂ : abs' ((fun n => ∑ i in range n, g i) (max n i) - (fun n => ∑ i in range n, g i) i) < ε / 2
sub_le :
  abs' (∑ k in range j, g k - ∑ k in range (max n i), g k) ≤
    abs' (∑ k in range j, g k - ∑ k in range i, g k) + abs' (∑ k in range i, g k - ∑ k in range (max n i), g k)
this :
  abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) +
      abs' ((fun n => ∑ i in range n, g i) i - ∑ k in range (max n i), g k) <
    ε
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) ≤
    ∑ k in range j, g k - ∑ k in range (max n i), g k

tactic: clear this hi₂ hi₁ hi ε0 ε hg sub_le
state_before: case intro
α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
i : ℕ
hi : ∀ (j : ℕ), j ≥ i → abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
j : ℕ
ji : j ≥ max n i
hi₁ : abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) < ε / 2
hi₂ : abs' ((fun n => ∑ i in range n, g i) (max n i) - (fun n => ∑ i in range n, g i) i) < ε / 2
sub_le :
  abs' (∑ k in range j, g k - ∑ k in range (max n i), g k) ≤
    abs' (∑ k in range j, g k - ∑ k in range i, g k) + abs' (∑ k in range i, g k - ∑ k in range (max n i), g k)
this :
  abs' ((fun n => ∑ i in range n, g i) j - (fun n => ∑ i in range n, g i) i) +
      abs' ((fun n => ∑ i in range n, g i) i - ∑ k in range (max n i), g k) <
    ε
k : ℕ
hk : j - max n i = k
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) ≤
    ∑ k in range j, g k - ∑ k in range (max n i), g k

tactic: rw [tsub_eq_iff_eq_add_of_le ji] at hk
state_before: case intro
α : 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 j : ℕ
ji : j ≥ max n i
k : ℕ
hk : j - max n i = k
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) ≤
    ∑ k in range j, g k - ∑ k in range (max n i), g k

tactic: rw [hk]
state_before: case intro
α : 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 j : ℕ
ji : j ≥ max n i
k : ℕ
hk : j = k + max n i
⊢ abv ((fun n => ∑ i in range n, f i) j - (fun n => ∑ i in range n, f i) (max n i)) ≤
    ∑ k in range j, g k - ∑ k in range (max n i), g k

tactic: dsimp only
state_before: case intro
α : 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 j : ℕ
ji : j ≥ max n i
k : ℕ
hk : j = k + max n i
⊢ abv ((fun n => ∑ i in range n, f i) (k + max n i) - (fun n => ∑ i in range n, f i) (max n i)) ≤
    ∑ k in range (k + max n i), g k - ∑ k in range (max n i), g k

tactic: clear hk ji j
state_before: case intro
α : 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 j : ℕ
ji : j ≥ max n i
k : ℕ
hk : j = k + max n i
⊢ 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

tactic: induction' k with k' hi
state_before: case intro
α : 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 : ℕ
⊢ 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

tactic: norm_num
state_before: α : 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
hg : IsCauSeq abs' fun n => ∑ i in range n, g i
ε : α
ε0 : ε > 0
⊢ 0 < 2

tactic: simp [abv_zero abv]
state_before: case intro.zero
α : 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 : ℕ
⊢ abv (∑ i in range (Nat.zero + max n i), f i - ∑ i in range (max n i), f i) ≤
    ∑ k in range (Nat.zero + max n i), g k - ∑ k in range (max n i), g k

tactic: simp only [Nat.succ_add, Nat.succ_eq_add_one, Finset.sum_range_succ_comm]
state_before: 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 (∑ i in range (Nat.succ k' + max n i), f i - ∑ i in range (max n i), f i) ≤
    ∑ k in range (Nat.succ k' + max n i), g k - ∑ k in range (max n i), g k

tactic: simp only [add_assoc, sub_eq_add_neg]
state_before: 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

tactic: refine le_trans (abv_add _ _ _) ?_
state_before: 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)

tactic: simp only [sub_eq_add_neg] at hi
state_before: 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)

tactic: refine add_le_add (hm _ (le_add_of_nonneg_of_le (Nat.zero_le _) (le_max_left _ _))) hi
state_before: 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)