[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
let ⟨k, hk⟩ := Archimedean.arch a ε0
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
have h : ∃ l, ∀ n ≥ m, a - l • ε < f n :=
  ⟨k + k + 1, fun n hnm =>
    lt_of_lt_of_le
      (show a - (k + (k + 1)) • ε < -|f n| from
        lt_neg.1 <|
          lt_of_le_of_lt (ham n hnm)
            (by
              rw [neg_sub, lt_sub_iff_add_lt, add_nsmul, add_nsmul, one_nsmul]
              exact add_lt_add_of_le_of_lt hk (lt_of_le_of_lt hk (lt_add_of_pos_right _ ε0))))
      (neg_le.2 <| abs_neg (f n) ▸ le_abs_self _)⟩
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm✝ : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
n : ℕ
hnm : n ≥ m
⊢ a < -(a - (k + (k + 1)) • ε)
[PROOFSTEP]
rw [neg_sub, lt_sub_iff_add_lt, add_nsmul, add_nsmul, one_nsmul]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm✝ : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
n : ℕ
hnm : n ≥ m
⊢ a + a < k • ε + (k • ε + ε)
[PROOFSTEP]
exact add_lt_add_of_le_of_lt hk (lt_of_le_of_lt hk (lt_add_of_pos_right _ ε0))
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
let l := Nat.find h
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
have hl : ∀ n : ℕ, n ≥ m → f n > a - l • ε := Nat.find_spec h
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
have hl0 : l ≠ 0 := fun hl0 =>
  not_lt_of_ge (ham m le_rfl) (lt_of_lt_of_le (by have := hl m (le_refl m); simpa [hl0] using this) (le_abs_self (f m)))
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l = 0
⊢ a < f m
[PROOFSTEP]
have := hl m (le_refl m)
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l = 0
this : f m > a - l • ε
⊢ a < f m
[PROOFSTEP]
simpa [hl0] using this
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
cases' not_forall.1 (Nat.find_min h (Nat.pred_lt hl0)) with i hi
[GOAL]
case intro
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : ¬(i ≥ m → a - Nat.pred (Nat.find h) • ε < f i)
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
rw [not_imp, not_lt] at hi 
[GOAL]
case intro
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
⊢ ∃ i, ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
exists i
[GOAL]
case intro
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
⊢ ∀ (j : ℕ), j ≥ i → abs' (f j - f i) < ε
[PROOFSTEP]
intro j hj
[GOAL]
case intro
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
⊢ abs' (f j - f i) < ε
[PROOFSTEP]
have hfij : f j ≤ f i := (Nat.rel_of_forall_rel_succ_of_le_of_le (· ≥ ·) hnm hi.1 hj).le
[GOAL]
case intro
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
hfij : f j ≤ f i
⊢ abs' (f j - f i) < ε
[PROOFSTEP]
rw [abs_of_nonpos (sub_nonpos.2 hfij), neg_sub, sub_lt_iff_lt_add']
[GOAL]
case intro
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
hfij : f j ≤ f i
⊢ f i < f j + ε
[PROOFSTEP]
calc
  f i ≤ a - Nat.pred l • ε := hi.2
  _ = a - l • ε + ε := by
    conv =>
      rhs
      rw [← Nat.succ_pred_eq_of_pos (Nat.pos_of_ne_zero hl0), succ_nsmul', sub_add, add_sub_cancel]
  _ < f j + ε := add_lt_add_right (hl j (le_trans hi.1 hj)) _
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
hfij : f j ≤ f i
⊢ a - Nat.pred l • ε = a - l • ε + ε
[PROOFSTEP]
conv =>
  rhs
  rw [← Nat.succ_pred_eq_of_pos (Nat.pos_of_ne_zero hl0), succ_nsmul', sub_add, add_sub_cancel]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
hfij : f j ≤ f i
| a - Nat.pred l • ε = a - l • ε + ε
[PROOFSTEP]
  rhs
  rw [← Nat.succ_pred_eq_of_pos (Nat.pos_of_ne_zero hl0), succ_nsmul', sub_add, add_sub_cancel]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
hfij : f j ≤ f i
| a - Nat.pred l • ε = a - l • ε + ε
[PROOFSTEP]
  rhs
  rw [← Nat.succ_pred_eq_of_pos (Nat.pos_of_ne_zero hl0), succ_nsmul', sub_add, add_sub_cancel]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
hfij : f j ≤ f i
| a - Nat.pred l • ε = a - l • ε + ε
[PROOFSTEP]
rhs
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f (Nat.succ n) ≤ f n
ε : α
ε0 : ε > 0
k : ℕ
hk : a ≤ k • ε
h : ∃ l, ∀ (n : ℕ), n ≥ m → a - l • ε < f n
l : ℕ := Nat.find h
hl : ∀ (n : ℕ), n ≥ m → f n > a - l • ε
hl0 : l ≠ 0
i : ℕ
hi : i ≥ m ∧ f i ≤ a - Nat.pred (Nat.find h) • ε
j : ℕ
hj : j ≥ i
hfij : f j ≤ f i
| a - l • ε + ε
[PROOFSTEP]
rw [← Nat.succ_pred_eq_of_pos (Nat.pos_of_ne_zero hl0), succ_nsmul', sub_add, add_sub_cancel]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f n ≤ f (Nat.succ n)
⊢ IsCauSeq abs' f
[PROOFSTEP]
refine'
  @Eq.ndrecOn (ℕ → α) _ (IsCauSeq abs) _ _
    (-⟨_, @isCauSeq_of_decreasing_bounded _ _ _ (fun n => -f n) a m (by simpa) (by simpa)⟩ : CauSeq α abs).2
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f n ≤ f (Nat.succ n)
⊢ ∀ (n : ℕ), n ≥ m → abs' ((fun n => -f n) n) ≤ a
[PROOFSTEP]
simpa
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f n ≤ f (Nat.succ n)
⊢ ∀ (n : ℕ), n ≥ m → (fun n => -f n) (Nat.succ n) ≤ (fun n => -f n) n
[PROOFSTEP]
simpa
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f n ≤ f (Nat.succ n)
⊢ ↑(-{ val := fun n => -f n, property := (_ : IsCauSeq abs' fun n => -f n) }) = f
[PROOFSTEP]
ext
[GOAL]
case h
α : Type u_1
β : Type u_2
inst✝³ : Ring β
inst✝² : LinearOrderedField α
inst✝¹ : Archimedean α
abv : β → α
inst✝ : IsAbsoluteValue abv
f : ℕ → α
a : α
m : ℕ
ham : ∀ (n : ℕ), n ≥ m → abs' (f n) ≤ a
hnm : ∀ (n : ℕ), n ≥ m → f n ≤ f (Nat.succ n)
x✝ : ℕ
⊢ ↑(-{ val := fun n => -f n, property := (_ : IsCauSeq abs' fun n => -f n) }) x✝ = f x✝
[PROOFSTEP]
exact neg_neg _
[GOAL]
α : 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
[PROOFSTEP]
intro hm hg ε ε0
[GOAL]
α : 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) < ε
[PROOFSTEP]
cases' hg (ε / 2) (div_pos ε0 (by norm_num)) with i hi
[GOAL]
α : 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
[PROOFSTEP]
norm_num
[GOAL]
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) < ε
[PROOFSTEP]
exists max n i
[GOAL]
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)) < ε
[PROOFSTEP]
intro j ji
[GOAL]
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)) < ε
[PROOFSTEP]
have hi₁ := hi j (le_trans (le_max_right n i) ji)
[GOAL]
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)) < ε
[PROOFSTEP]
have hi₂ := hi (max n i) (le_max_right n i)
[GOAL]
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)) < ε
[PROOFSTEP]
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)
[GOAL]
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)) < ε
[PROOFSTEP]
have := add_lt_add hi₁ hi₂
[GOAL]
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)) < ε
[PROOFSTEP]
rw [abs_sub_comm (∑ k in range (max n i), g k), add_halves ε] at this 
[GOAL]
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)) < ε
[PROOFSTEP]
refine' lt_of_le_of_lt (le_trans (le_trans _ (le_abs_self _)) sub_le) this
[GOAL]
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
[PROOFSTEP]
generalize hk : j - max n i = k
[GOAL]
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
[PROOFSTEP]
clear this hi₂ hi₁ hi ε0 ε hg sub_le
[GOAL]
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
[PROOFSTEP]
rw [tsub_eq_iff_eq_add_of_le ji] at hk 
[GOAL]
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
[PROOFSTEP]
rw [hk]
[GOAL]
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
[PROOFSTEP]
dsimp only
[GOAL]
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
[PROOFSTEP]
clear hk ji j
[GOAL]
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
[PROOFSTEP]
induction' k with k' hi
[GOAL]
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
[PROOFSTEP]
simp [abv_zero abv]
[GOAL]
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
[PROOFSTEP]
simp only [Nat.succ_add, Nat.succ_eq_add_one, Finset.sum_range_succ_comm]
[GOAL]
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
[PROOFSTEP]
simp only [add_assoc, sub_eq_add_neg]
[GOAL]
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)
[PROOFSTEP]
refine le_trans (abv_add _ _ _) ?_
[GOAL]
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)
[PROOFSTEP]
simp only [sub_eq_add_neg] at hi 
[GOAL]
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)
[PROOFSTEP]
refine add_le_add (hm _ (le_add_of_nonneg_of_le (Nat.zero_le _) (le_max_left _ _))) hi
[GOAL]
α : 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
[PROOFSTEP]
simp [h, lt_irrefl] at hx1 
[GOAL]
α : 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)
[PROOFSTEP]
simp only [abv_pow abv, geom_sum_eq hx1']
[GOAL]
α : 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)
[PROOFSTEP]
conv in _ / _ => rw [← neg_div_neg_eq, neg_sub, neg_sub]
[GOAL]
α : 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)
[PROOFSTEP]
rw [← neg_div_neg_eq, neg_sub, neg_sub]
[GOAL]
α : 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)
[PROOFSTEP]
rw [← neg_div_neg_eq, neg_sub, neg_sub]
[GOAL]
α : 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)
[PROOFSTEP]
rw [← neg_div_neg_eq, neg_sub, neg_sub]
[GOAL]
α : 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)
[PROOFSTEP]
have : 0 < 1 - abv x := sub_pos.2 hx1
[GOAL]
α : 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)
[PROOFSTEP]
refine' @isCauSeq_of_mono_bounded _ _ _ _ ((1 : α) / (1 - abv x)) 0 _ _
[GOAL]
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 : ℕ), n ≥ 0 → abs' ((1 - abv x ^ n) / (1 - abv x)) ≤ 1 / (1 - abv x)
[PROOFSTEP]
intro n _
[GOAL]
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)
[PROOFSTEP]
rw [abs_of_nonneg]
[GOAL]
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)
[PROOFSTEP]
gcongr
[GOAL]
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
[PROOFSTEP]
exact sub_le_self _ (abv_pow abv x n ▸ abv_nonneg _ _)
[GOAL]
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)
[PROOFSTEP]
refine' div_nonneg (sub_nonneg.2 _) (sub_nonneg.2 <| le_of_lt hx1)
[GOAL]
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
[PROOFSTEP]
exact pow_le_one _ (by positivity) hx1.le
[GOAL]
α : 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
[PROOFSTEP]
positivity
[GOAL]
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 : ℕ), n ≥ 0 → (1 - abv x ^ n) / (1 - abv x) ≤ (1 - abv x ^ Nat.succ n) / (1 - abv x)
[PROOFSTEP]
intro n _
[GOAL]
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)
[PROOFSTEP]
rw [← one_mul (abv x ^ n), pow_succ]
[GOAL]
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)
[PROOFSTEP]
gcongr
[GOAL]
α : Type u_1
inst✝¹ : LinearOrderedField α
inst✝ : Archimedean α
a x : α
hx1 : abs' x < 1
⊢ IsCauSeq abs' fun m => ∑ n in range m, a * x ^ n
[PROOFSTEP]
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
[GOAL]
α : 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
[PROOFSTEP]
simpa [mul_sum] using this
[GOAL]
α : 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
[PROOFSTEP]
have har1 : |r| < 1 := by rwa [abs_of_nonneg hr0]
[GOAL]
α : 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
[PROOFSTEP]
rwa [abs_of_nonneg hr0]
[GOAL]
α : 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
[PROOFSTEP]
refine' isCauSeq_series_of_abv_le_of_isCauSeq n.succ _ (isCauSeq_geo_series_const (abv (f n.succ) * r⁻¹ ^ n.succ) har1)
[GOAL]
α : 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
[PROOFSTEP]
intro m hmn
[GOAL]
α : 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
[PROOFSTEP]
cases' Classical.em (r = 0) with r_zero r_ne_zero
[GOAL]
case inl
α : 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
r_zero : r = 0
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
have m_pos := lt_of_lt_of_le (Nat.succ_pos n) hmn
[GOAL]
case inl
α : 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
r_zero : r = 0
m_pos : 0 < m
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
have := h m.pred (Nat.le_of_succ_le_succ (by rwa [Nat.succ_pred_eq_of_pos m_pos]))
[GOAL]
α : 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
r_zero : r = 0
m_pos : 0 < m
⊢ Nat.succ n ≤ Nat.succ (Nat.pred m)
[PROOFSTEP]
rwa [Nat.succ_pred_eq_of_pos m_pos]
[GOAL]
case inl
α : 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
r_zero : r = 0
m_pos : 0 < m
this : abv (f (Nat.succ (Nat.pred m))) ≤ r * abv (f (Nat.pred m))
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
simpa [r_zero, Nat.succ_pred_eq_of_pos m_pos, pow_succ] using this
[GOAL]
case inr
α : 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
r_ne_zero : ¬r = 0
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
generalize hk : m - n.succ = k
[GOAL]
case inr
α : 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
r_ne_zero : ¬r = 0
k : ℕ
hk : m - Nat.succ n = k
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
have r_pos : 0 < r := lt_of_le_of_ne hr0 (Ne.symm r_ne_zero)
[GOAL]
case inr
α : 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
r_ne_zero : ¬r = 0
k : ℕ
hk : m - Nat.succ n = k
r_pos : 0 < r
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
replace hk : m = k + n.succ := (tsub_eq_iff_eq_add_of_le hmn).1 hk
[GOAL]
case inr
α : 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
r_ne_zero : ¬r = 0
k : ℕ
r_pos : 0 < r
hk : m = k + Nat.succ n
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
induction' k with k ih generalizing m n
[GOAL]
case inr.zero
α : 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✝
r_ne_zero : ¬r = 0
k : ℕ
r_pos : 0 < r
hk✝ : m✝ = k + Nat.succ n✝
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.zero + Nat.succ n
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
rw [hk, Nat.zero_add, mul_right_comm, inv_pow _ _, ← div_eq_mul_inv, mul_div_cancel]
[GOAL]
case inr.zero.h
α : 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✝
r_ne_zero : ¬r = 0
k : ℕ
r_pos : 0 < r
hk✝ : m✝ = k + Nat.succ n✝
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.zero + Nat.succ n
⊢ r ^ Nat.succ n ≠ 0
[PROOFSTEP]
exact (ne_of_lt (pow_pos r_pos _)).symm
[GOAL]
case inr.succ
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
have kn : k + n.succ ≥ n.succ := by rw [← zero_add n.succ]; exact add_le_add (Nat.zero_le _) (by simp)
[GOAL]
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
⊢ k + Nat.succ n ≥ Nat.succ n
[PROOFSTEP]
rw [← zero_add n.succ]
[GOAL]
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
⊢ k + (0 + Nat.succ n) ≥ 0 + Nat.succ n
[PROOFSTEP]
exact add_le_add (Nat.zero_le _) (by simp)
[GOAL]
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
⊢ Nat.succ n ≤ 0 + Nat.succ n
[PROOFSTEP]
simp
[GOAL]
case inr.succ
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
kn : k + Nat.succ n ≥ Nat.succ n
⊢ abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
[PROOFSTEP]
erw [hk, Nat.succ_add, pow_succ' r, ← mul_assoc]
[GOAL]
case inr.succ
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
kn : k + Nat.succ n ≥ Nat.succ n
⊢ abv (f (Nat.succ (k + Nat.succ n))) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ (k + Nat.succ n) * r
[PROOFSTEP]
refine le_trans (by rw [mul_comm] <;> exact h _ (Nat.le_of_succ_le kn)) (mul_le_mul_of_nonneg_right ?_ hr0)
[GOAL]
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
kn : k + Nat.succ n ≥ Nat.succ n
⊢ abv (f (Nat.succ (k + Nat.succ n))) ≤ ?m.61292 * r
[PROOFSTEP]
rw [mul_comm]
[GOAL]
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
kn : k + Nat.succ n ≥ Nat.succ n
⊢ abv (f (Nat.succ (k + Nat.succ n))) ≤ r * ?a
[PROOFSTEP]
exact h _ (Nat.le_of_succ_le kn)
[GOAL]
case inr.succ
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
kn : k + Nat.succ n ≥ Nat.succ n
⊢ abv (f (k + Nat.succ n)) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ (k + Nat.succ n)
[PROOFSTEP]
exact ih _ h _ (by simp) rfl
[GOAL]
α : 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✝
r_ne_zero : ¬r = 0
k✝ : ℕ
r_pos : 0 < r
hk✝ : m✝ = k✝ + Nat.succ n✝
k : ℕ
ih :
  ∀ (n : ℕ),
    (∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)) →
      ∀ (m : ℕ), Nat.succ n ≤ m → m = k + Nat.succ n → abv (f m) ≤ abv (f (Nat.succ n)) * r⁻¹ ^ Nat.succ n * r ^ m
n : ℕ
h : ∀ (m : ℕ), n ≤ m → abv (f (Nat.succ m)) ≤ r * abv (f m)
m : ℕ
hmn : Nat.succ n ≤ m
hk : m = Nat.succ k + Nat.succ n
kn : k + Nat.succ n ≥ Nat.succ n
⊢ Nat.succ n ≤ k + Nat.succ n
[PROOFSTEP]
simp
[GOAL]
α✝ : Type u_1
inst✝⁴ : LinearOrderedField α✝
inst✝³ : Archimedean α✝
β : Type u_2
inst✝² : Ring β
abv : β → α✝
inst✝¹ : IsAbsoluteValue abv
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : ℕ → ℕ → α
⊢ ∑ m in range n, ∑ k in range (m + 1), f k (m - k) = ∑ m in range n, ∑ k in range (n - m), f m k
[PROOFSTEP]
rw [sum_sigma', sum_sigma']
[GOAL]
α✝ : Type u_1
inst✝⁴ : LinearOrderedField α✝
inst✝³ : Archimedean α✝
β : Type u_2
inst✝² : Ring β
abv : β → α✝
inst✝¹ : IsAbsoluteValue abv
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : ℕ → ℕ → α
⊢ ∑ x in Finset.sigma (range n) fun m => range (m + 1), f x.snd (x.fst - x.snd) =
    ∑ x in Finset.sigma (range n) fun m => range (n - m), f x.fst x.snd
[PROOFSTEP]
exact
  sum_bij (fun a _ => ⟨a.2, a.1 - a.2⟩)
    (fun a ha =>
      have h₁ : a.1 < n := mem_range.1 (mem_sigma.1 ha).1
      have h₂ : a.2 < Nat.succ a.1 := mem_range.1 (mem_sigma.1 ha).2
      mem_sigma.2
        ⟨mem_range.2 (lt_of_lt_of_le h₂ h₁), mem_range.2 ((tsub_lt_tsub_iff_right (Nat.le_of_lt_succ h₂)).2 h₁)⟩)
    (fun _ _ => rfl)
    (fun ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ ha hb h =>
      have ha : a₁ < n ∧ a₂ ≤ a₁ := ⟨mem_range.1 (mem_sigma.1 ha).1, Nat.le_of_lt_succ (mem_range.1 (mem_sigma.1 ha).2)⟩
      have hb : b₁ < n ∧ b₂ ≤ b₁ := ⟨mem_range.1 (mem_sigma.1 hb).1, Nat.le_of_lt_succ (mem_range.1 (mem_sigma.1 hb).2)⟩
      have h : a₂ = b₂ ∧ _ := by simpa using h
      have h' : a₁ = b₁ - b₂ + a₂ := (tsub_eq_iff_eq_add_of_le ha.2).1 (eq_of_heq h.2)
      Sigma.mk.inj_iff.2 ⟨tsub_add_cancel_of_le hb.2 ▸ h'.symm ▸ h.1 ▸ rfl, heq_of_eq h.1⟩)
    fun ⟨a₁, a₂⟩ ha =>
    have ha : a₁ < n ∧ a₂ < n - a₁ := ⟨mem_range.1 (mem_sigma.1 ha).1, mem_range.1 (mem_sigma.1 ha).2⟩
    ⟨⟨a₂ + a₁, a₁⟩,
      ⟨mem_sigma.2 ⟨mem_range.2 (lt_tsub_iff_right.1 ha.2), mem_range.2 (Nat.lt_succ_of_le (Nat.le_add_left _ _))⟩,
        Sigma.mk.inj_iff.2 ⟨rfl, heq_of_eq (add_tsub_cancel_right _ _).symm⟩⟩⟩
[GOAL]
α✝ : Type u_1
inst✝⁴ : LinearOrderedField α✝
inst✝³ : Archimedean α✝
β : Type u_2
inst✝² : Ring β
abv : β → α✝
inst✝¹ : IsAbsoluteValue abv
α : Type u_3
inst✝ : AddCommMonoid α
n : ℕ
f : ℕ → ℕ → α
x✝¹ x✝ : (_ : ℕ) × ℕ
a₁ a₂ : ℕ
ha✝ : { fst := a₁, snd := a₂ } ∈ Finset.sigma (range n) fun m => range (m + 1)
b₁ b₂ : ℕ
hb✝ : { fst := b₁, snd := b₂ } ∈ Finset.sigma (range n) fun m => range (m + 1)
h :
  (fun a x => { fst := a.snd, snd := a.fst - a.snd }) { fst := a₁, snd := a₂ } ha✝ =
    (fun a x => { fst := a.snd, snd := a.fst - a.snd }) { fst := b₁, snd := b₂ } hb✝
ha : a₁ < n ∧ a₂ ≤ a₁
hb : b₁ < n ∧ b₂ ≤ b₁
⊢ a₂ = b₂ ∧ HEq (a₁ - a₂) (b₁ - b₂)
[PROOFSTEP]
simpa using h
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Semiring β
inst✝ : IsAbsoluteValue abv
γ : Type u_3
f : γ → β
s : Finset γ
this : DecidableEq γ
⊢ abv (∑ k in ∅, f k) ≤ ∑ k in ∅, abv (f k)
[PROOFSTEP]
simp [abv_zero abv]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Semiring β
inst✝ : IsAbsoluteValue abv
γ : Type u_3
f : γ → β
s✝ : Finset γ
this : DecidableEq γ
a : γ
s : Finset γ
has : ¬a ∈ s
ih : abv (∑ k in s, f k) ≤ ∑ k in s, abv (f k)
⊢ abv (∑ k in insert a s, f k) ≤ ∑ k in insert a s, abv (f k)
[PROOFSTEP]
rw [sum_insert has, sum_insert has]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Semiring β
inst✝ : IsAbsoluteValue abv
γ : Type u_3
f : γ → β
s✝ : Finset γ
this : DecidableEq γ
a : γ
s : Finset γ
has : ¬a ∈ s
ih : abv (∑ k in s, f k) ≤ ∑ k in s, abv (f k)
⊢ abv (f a + ∑ x in s, f x) ≤ abv (f a) + ∑ x in s, abv (f x)
[PROOFSTEP]
exact le_trans (abv_add abv _ _) (add_le_add_left ih _)
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
⊢ 2 > 0
[PROOFSTEP]
norm_num
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
⊢ 0 < 4
[PROOFSTEP]
norm_num
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have h₁ : (∑ m in range K, ∑ k in range (m + 1), a k * b (m - k)) = ∑ m in range K, ∑ n in range (K - m), a m * b n :=
  by simpa using sum_range_diag_flip K fun m n => a m * b n
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
⊢ ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
[PROOFSTEP]
simpa using sum_range_diag_flip K fun m n => a m * b n
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k := by
  simp [Finset.mul_sum]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
⊢ (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
[PROOFSTEP]
simp [Finset.mul_sum]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have h₃ :
  (∑ i in range K, a i * ∑ k in range (K - i), b k) =
    (∑ i in range K, a i * ((∑ k in range (K - i), b k) - ∑ k in range K, b k)) +
      ∑ i in range K, a i * ∑ k in range K, b k :=
  by rw [← sum_add_distrib]; simp [(mul_add _ _ _).symm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
⊢ ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
[PROOFSTEP]
rw [← sum_add_distrib]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
⊢ ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ x in range K, (a x * (∑ k in range (K - x), b k - ∑ k in range K, b k) + a x * ∑ k in range K, b k)
[PROOFSTEP]
simp [(mul_add _ _ _).symm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have two_mul_two : (4 : α) = 2 * 2 := by norm_num
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
⊢ 4 = 2 * 2
[PROOFSTEP]
norm_num
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have hQ0 : Q ≠ 0 := fun h => by simp [h, lt_irrefl] at hQε0 
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
h : Q = 0
⊢ False
[PROOFSTEP]
simp [h, lt_irrefl] at hQε0 
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have h2Q0 : 2 * Q ≠ 0 := mul_ne_zero two_ne_zero hQ0
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε := by
  rw [← div_div, div_mul_cancel _ (Ne.symm (ne_of_lt hP0)), two_mul_two, mul_assoc, ← div_div, div_mul_cancel _ h2Q0,
    add_halves]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
⊢ ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
[PROOFSTEP]
rw [← div_div, div_mul_cancel _ (Ne.symm (ne_of_lt hP0)), two_mul_two, mul_assoc, ← div_div, div_mul_cancel _ h2Q0,
  add_halves]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have hNMK : max N M + 1 < K := lt_of_lt_of_le (by rw [two_mul]; exact lt_add_of_pos_left _ (Nat.succ_pos _)) hK
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
⊢ max N M + 1 < 2 * (max N M + 1)
[PROOFSTEP]
rw [two_mul]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
⊢ max N M + 1 < max N M + 1 + (max N M + 1)
[PROOFSTEP]
exact lt_add_of_pos_left _ (Nat.succ_pos _)
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have hKN : N < K :=
  calc
    N ≤ max N M := le_max_left _ _
    _ < max N M + 1 := (Nat.lt_succ_self _)
    _ < K := hNMK
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have hsumlesum :
  (∑ i in range (max N M + 1), abv (a i) * abv ((∑ k in range (K - i), b k) - ∑ k in range K, b k)) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
[GOAL]
case hsumlesum
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
⊢ ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
[PROOFSTEP]
gcongr with m hmJ
[GOAL]
case hsumlesum.h.h
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
m : ℕ
hmJ : m ∈ range (max N M + 1)
⊢ abv (∑ k in range (K - m), b k - ∑ k in range K, b k) ≤ ε / (2 * P)
[PROOFSTEP]
exact
  le_of_lt
    (hN (K - m)
      (le_tsub_of_add_le_left
        (le_trans
          (by
            rw [two_mul]
            gcongr
            · exact le_of_lt (mem_range.1 hmJ)
            · exact le_trans (le_max_left _ _) (le_of_lt (lt_add_one _)))
          hK))
      K (le_of_lt hKN))
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
m : ℕ
hmJ : m ∈ range (max N M + 1)
⊢ m + N ≤ 2 * (max N M + 1)
[PROOFSTEP]
rw [two_mul]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
m : ℕ
hmJ : m ∈ range (max N M + 1)
⊢ m + N ≤ max N M + 1 + (max N M + 1)
[PROOFSTEP]
gcongr
[GOAL]
case h₁
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
m : ℕ
hmJ : m ∈ range (max N M + 1)
⊢ m ≤ max N M + 1
[PROOFSTEP]
exact le_of_lt (mem_range.1 hmJ)
[GOAL]
case h₂
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
m : ℕ
hmJ : m ∈ range (max N M + 1)
⊢ N ≤ max N M + 1
[PROOFSTEP]
exact le_trans (le_max_left _ _) (le_of_lt (lt_add_one _))
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
have hsumltP : (∑ n in range (max N M + 1), abv (a n)) < P :=
  calc
    (∑ n in range (max N M + 1), abv (a n)) = |∑ n in range (max N M + 1), abv (a n)| :=
      Eq.symm (abs_of_nonneg (sum_nonneg fun x _ => abv_nonneg abv (a x)))
    _ < P := hP (max N M + 1)
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ abv ((∑ k in range K, a k) * ∑ k in range K, b k - ∑ n in range K, ∑ m in range (n + 1), a m * b (n - m)) < ε
[PROOFSTEP]
rw [h₁, h₂, h₃, sum_mul, ← sub_sub, sub_right_comm, sub_self, zero_sub, abv_neg abv]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ abv (∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k)) < ε
[PROOFSTEP]
refine' lt_of_le_of_lt (abv_sum_le_sum_abv _ _) _
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ k in range K, abv (a k * (∑ k in range (K - k), b k - ∑ k in range K, b k)) < ε
[PROOFSTEP]
suffices
  (∑ i in range (max N M + 1), abv (a i) * abv ((∑ k in range (K - i), b k) - ∑ k in range K, b k)) +
      ((∑ i in range K, abv (a i) * abv ((∑ k in range (K - i), b k) - ∑ k in range K, b k)) -
        ∑ i in range (max N M + 1), abv (a i) * abv ((∑ k in range (K - i), b k) - ∑ k in range K, b k)) <
    ε / (2 * P) * P + ε / (4 * Q) * (2 * Q)
  by
  rw [hε] at this 
  simpa [abv_mul abv] using this
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
this :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) +
      (∑ i in range K, abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) -
        ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k)) <
    ε / (2 * P) * P + ε / (4 * Q) * (2 * Q)
⊢ ∑ k in range K, abv (a k * (∑ k in range (K - k), b k - ∑ k in range K, b k)) < ε
[PROOFSTEP]
rw [hε] at this 
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
this :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) +
      (∑ i in range K, abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) -
        ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k)) <
    ε
⊢ ∑ k in range K, abv (a k * (∑ k in range (K - k), b k - ∑ k in range K, b k)) < ε
[PROOFSTEP]
simpa [abv_mul abv] using this
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) +
      (∑ i in range K, abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) -
        ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k)) <
    ε / (2 * P) * P + ε / (4 * Q) * (2 * Q)
[PROOFSTEP]
gcongr
[GOAL]
case h₁
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) < ε / (2 * P) * P
[PROOFSTEP]
exact lt_of_le_of_lt hsumlesum (by rw [← sum_mul, mul_comm]; gcongr)
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P)) < ε / (2 * P) * P
[PROOFSTEP]
rw [← sum_mul, mul_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ε / (2 * P) * ∑ x in range (max N M + 1), abv (a x) < ε / (2 * P) * P
[PROOFSTEP]
gcongr
[GOAL]
case h₂
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ i in range K, abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) -
      ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) <
    ε / (4 * Q) * (2 * Q)
[PROOFSTEP]
rw [sum_range_sub_sum_range (le_of_lt hNMK)]
[GOAL]
case h₂
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ k in filter (fun k => max N M + 1 ≤ k) (range K),
      abv (a k) * abv (∑ k in range (K - k), b k - ∑ k in range K, b k) <
    ε / (4 * Q) * (2 * Q)
[PROOFSTEP]
calc
  (∑ i in (range K).filter fun k => max N M + 1 ≤ k,
        abv (a i) * abv ((∑ k in range (K - i), b k) - ∑ k in range K, b k)) ≤
      ∑ i in (range K).filter fun k => max N M + 1 ≤ k, abv (a i) * (2 * Q) :=
    by
    gcongr
    rw [sub_eq_add_neg]
    refine' le_trans (abv_add _ _ _) _
    rw [two_mul, abv_neg abv]
    gcongr <;> exact le_of_lt (hQ _)
  _ < ε / (4 * Q) * (2 * Q) := by
    rw [← sum_mul, ← sum_range_sub_sum_range (le_of_lt hNMK)]
    have := lt_of_le_of_lt (abv_nonneg _ _) (hQ 0)
    gcongr
    refine'
      lt_of_le_of_lt (le_abs_self _)
        (hM _ (le_trans (Nat.le_succ_of_le (le_max_right _ _)) (le_of_lt hNMK)) _
          (Nat.le_succ_of_le (le_max_right _ _)))
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ i in filter (fun k => max N M + 1 ≤ k) (range K),
      abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in filter (fun k => max N M + 1 ≤ k) (range K), abv (a i) * (2 * Q)
[PROOFSTEP]
gcongr
[GOAL]
case h.h
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => max N M + 1 ≤ k) (range K)
⊢ abv (∑ k in range (K - i✝), b k - ∑ k in range K, b k) ≤ 2 * Q
[PROOFSTEP]
rw [sub_eq_add_neg]
[GOAL]
case h.h
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => max N M + 1 ≤ k) (range K)
⊢ abv (∑ k in range (K - i✝), b k + -∑ k in range K, b k) ≤ 2 * Q
[PROOFSTEP]
refine' le_trans (abv_add _ _ _) _
[GOAL]
case h.h
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => max N M + 1 ≤ k) (range K)
⊢ abv (∑ k in range (K - i✝), b k) + abv (-∑ k in range K, b k) ≤ 2 * Q
[PROOFSTEP]
rw [two_mul, abv_neg abv]
[GOAL]
case h.h
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => max N M + 1 ≤ k) (range K)
⊢ abv (∑ k in range (K - i✝), b k) + abv (∑ k in range K, b k) ≤ Q + Q
[PROOFSTEP]
gcongr
[GOAL]
case h.h.h₁
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => max N M + 1 ≤ k) (range K)
⊢ abv (∑ k in range (K - i✝), b k) ≤ Q
[PROOFSTEP]
exact le_of_lt (hQ _)
[GOAL]
case h.h.h₂
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => max N M + 1 ≤ k) (range K)
⊢ abv (∑ k in range K, b k) ≤ Q
[PROOFSTEP]
exact le_of_lt (hQ _)
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ ∑ i in filter (fun k => max N M + 1 ≤ k) (range K), abv (a i) * (2 * Q) < ε / (4 * Q) * (2 * Q)
[PROOFSTEP]
rw [← sum_mul, ← sum_range_sub_sum_range (le_of_lt hNMK)]
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
⊢ (∑ k in range K, abv (a k) - ∑ k in range (max N M + 1), abv (a k)) * (2 * Q) < ε / (4 * Q) * (2 * Q)
[PROOFSTEP]
have := lt_of_le_of_lt (abv_nonneg _ _) (hQ 0)
[GOAL]
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
this : 0 < Q
⊢ (∑ k in range K, abv (a k) - ∑ k in range (max N M + 1), abv (a k)) * (2 * Q) < ε / (4 * Q) * (2 * Q)
[PROOFSTEP]
gcongr
[GOAL]
case bc
α : Type u_1
β : Type u_2
inst✝² : LinearOrderedField α
abv : β → α
inst✝¹ : Ring β
inst✝ : IsAbsoluteValue abv
a b : ℕ → β
ha : IsCauSeq abs' fun m => ∑ n in range m, abv (a n)
hb : IsCauSeq abv fun m => ∑ n in range m, b n
ε : α
ε0 : 0 < ε
Q : α
hQ : ∀ (i : ℕ), abv (↑{ val := fun m => ∑ n in range m, b n, property := hb } i) < Q
P : α
hP : ∀ (i : ℕ), abs' (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } i) < P
hP0 : 0 < P
hPε0 : 0 < ε / (2 * P)
N : ℕ
hN :
  ∀ (j : ℕ),
    j ≥ N →
      ∀ (k : ℕ),
        k ≥ N →
          abv
              (↑{ val := fun m => ∑ n in range m, b n, property := hb } j -
                ↑{ val := fun m => ∑ n in range m, b n, property := hb } k) <
            ε / (2 * P)
hQε0 : 0 < ε / (4 * Q)
M : ℕ
hM :
  ∀ (j : ℕ),
    j ≥ M →
      ∀ (k : ℕ),
        k ≥ M →
          abs'
              (↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } j -
                ↑{ val := fun m => ∑ n in range m, abv (a n), property := ha } k) <
            ε / (4 * Q)
K : ℕ
hK : K ≥ 2 * (max N M + 1)
h₁ : ∑ m in range K, ∑ k in range (m + 1), a k * b (m - k) = ∑ m in range K, ∑ n in range (K - m), a m * b n
h₂ : (fun i => ∑ k in range (K - i), a i * b k) = fun i => a i * ∑ k in range (K - i), b k
h₃ :
  ∑ i in range K, a i * ∑ k in range (K - i), b k =
    ∑ i in range K, a i * (∑ k in range (K - i), b k - ∑ k in range K, b k) + ∑ i in range K, a i * ∑ k in range K, b k
two_mul_two : 4 = 2 * 2
hQ0 : Q ≠ 0
h2Q0 : 2 * Q ≠ 0
hε : ε / (2 * P) * P + ε / (4 * Q) * (2 * Q) = ε
hNMK : max N M + 1 < K
hKN : N < K
hsumlesum :
  ∑ i in range (max N M + 1), abv (a i) * abv (∑ k in range (K - i), b k - ∑ k in range K, b k) ≤
    ∑ i in range (max N M + 1), abv (a i) * (ε / (2 * P))
hsumltP : ∑ n in range (max N M + 1), abv (a n) < P
this : 0 < Q
⊢ ∑ k in range K, abv (a k) - ∑ k in range (max N M + 1), abv (a k) < ε / (4 * Q)
[PROOFSTEP]
refine'
  lt_of_le_of_lt (le_abs_self _)
    (hM _ (le_trans (Nat.le_succ_of_le (le_max_right _ _)) (le_of_lt hNMK)) _ (Nat.le_succ_of_le (le_max_right _ _)))
[GOAL]
z : ℂ
n : ℕ
hn : ↑abs z < ↑n
hn0 : 0 < ↑n
⊢ ↑abs z / ↑n < 1
[PROOFSTEP]
rwa [div_lt_iff hn0, one_mul]
[GOAL]
z : ℂ
n : ℕ
hn : ↑abs z < ↑n
hn0 : 0 < ↑n
m : ℕ
hm : n ≤ m
⊢ abs' (↑abs (z ^ Nat.succ m / ↑(Nat.factorial (Nat.succ m)))) ≤ ↑abs z / ↑n * abs' (↑abs (z ^ m / ↑(Nat.factorial m)))
[PROOFSTEP]
rw [abs_abs, abs_abs, Nat.factorial_succ, pow_succ, mul_comm m.succ, Nat.cast_mul, ← div_div, mul_div_assoc,
  mul_div_right_comm, map_mul, map_div₀, abs_cast_nat]
[GOAL]
z : ℂ
n : ℕ
hn : ↑abs z < ↑n
hn0 : 0 < ↑n
m : ℕ
hm : n ≤ m
⊢ ↑abs z / ↑(Nat.succ m) * ↑abs (z ^ m / ↑(Nat.factorial m)) ≤ ↑abs z / ↑n * ↑abs (z ^ m / ↑(Nat.factorial m))
[PROOFSTEP]
gcongr
[GOAL]
case h.h.h
z : ℂ
n : ℕ
hn : ↑abs z < ↑n
hn0 : 0 < ↑n
m : ℕ
hm : n ≤ m
⊢ n ≤ Nat.succ m
[PROOFSTEP]
exact le_trans hm (Nat.le_succ _)
[GOAL]
x y : ℂ
⊢ exp 0 = 1
[PROOFSTEP]
rw [exp]
[GOAL]
x y : ℂ
⊢ CauSeq.lim (exp' 0) = 1
[PROOFSTEP]
refine' lim_eq_of_equiv_const fun ε ε0 => ⟨1, fun j hj => _⟩
[GOAL]
x y : ℂ
ε : ℝ
ε0 : ε > 0
j : ℕ
hj : j ≥ 1
⊢ ↑abs (↑(exp' 0 - const (↑abs) 1) j) < ε
[PROOFSTEP]
convert (config := .unfoldSameFun) ε0
[GOAL]
case h.e'_3
x y : ℂ
ε : ℝ
ε0 : ε > 0
j : ℕ
hj : j ≥ 1
⊢ ↑abs (↑(exp' 0 - const (↑abs) 1) j) = 0
[PROOFSTEP]
cases' j with j j
[GOAL]
case h.e'_3.zero
x y : ℂ
ε : ℝ
ε0 : ε > 0
hj : Nat.zero ≥ 1
⊢ ↑abs (↑(exp' 0 - const (↑abs) 1) Nat.zero) = 0
[PROOFSTEP]
exact absurd hj (not_le_of_gt zero_lt_one)
[GOAL]
case h.e'_3.succ
x y : ℂ
ε : ℝ
ε0 : ε > 0
j : ℕ
hj : Nat.succ j ≥ 1
⊢ ↑abs (↑(exp' 0 - const (↑abs) 1) (Nat.succ j)) = 0
[PROOFSTEP]
dsimp [exp']
[GOAL]
case h.e'_3.succ
x y : ℂ
ε : ℝ
ε0 : ε > 0
j : ℕ
hj : Nat.succ j ≥ 1
⊢ ↑abs (∑ m in range (Nat.succ j), 0 ^ m / ↑(Nat.factorial m) - 1) = 0
[PROOFSTEP]
induction' j with j ih
[GOAL]
case h.e'_3.succ.zero
x y : ℂ
ε : ℝ
ε0 : ε > 0
j : ℕ
hj✝ : Nat.succ j ≥ 1
hj : Nat.succ Nat.zero ≥ 1
⊢ ↑abs (∑ m in range (Nat.succ Nat.zero), 0 ^ m / ↑(Nat.factorial m) - 1) = 0
[PROOFSTEP]
dsimp [exp']
[GOAL]
case h.e'_3.succ.zero
x y : ℂ
ε : ℝ
ε0 : ε > 0
j : ℕ
hj✝ : Nat.succ j ≥ 1
hj : Nat.succ Nat.zero ≥ 1
⊢ ↑abs (∑ m in {0}, 0 ^ m / ↑(Nat.factorial m) - 1) = 0
[PROOFSTEP]
simp [show Nat.succ 0 = 1 from rfl]
[GOAL]
case h.e'_3.succ.succ
x y : ℂ
ε : ℝ
ε0 : ε > 0
j✝ : ℕ
hj✝ : Nat.succ j✝ ≥ 1
j : ℕ
ih : Nat.succ j ≥ 1 → ↑abs (∑ m in range (Nat.succ j), 0 ^ m / ↑(Nat.factorial m) - 1) = 0
hj : Nat.succ (Nat.succ j) ≥ 1
⊢ ↑abs (∑ m in range (Nat.succ (Nat.succ j)), 0 ^ m / ↑(Nat.factorial m) - 1) = 0
[PROOFSTEP]
rw [← ih (by simp [show 1 = Nat.succ 0 from rfl, Nat.succ_le_succ])]
[GOAL]
x y : ℂ
ε : ℝ
ε0 : ε > 0
j✝ : ℕ
hj✝ : Nat.succ j✝ ≥ 1
j : ℕ
ih : Nat.succ j ≥ 1 → ↑abs (∑ m in range (Nat.succ j), 0 ^ m / ↑(Nat.factorial m) - 1) = 0
hj : Nat.succ (Nat.succ j) ≥ 1
⊢ Nat.succ j ≥ 1
[PROOFSTEP]
simp [show 1 = Nat.succ 0 from rfl, Nat.succ_le_succ]
[GOAL]
case h.e'_3.succ.succ
x y : ℂ
ε : ℝ
ε0 : ε > 0
j✝ : ℕ
hj✝ : Nat.succ j✝ ≥ 1
j : ℕ
ih : Nat.succ j ≥ 1 → ↑abs (∑ m in range (Nat.succ j), 0 ^ m / ↑(Nat.factorial m) - 1) = 0
hj : Nat.succ (Nat.succ j) ≥ 1
⊢ ↑abs (∑ m in range (Nat.succ (Nat.succ j)), 0 ^ m / ↑(Nat.factorial m) - 1) =
    ↑abs (∑ m in range (Nat.succ j), 0 ^ m / ↑(Nat.factorial m) - 1)
[PROOFSTEP]
simp only [sum_range_succ, pow_succ]
[GOAL]
case h.e'_3.succ.succ
x y : ℂ
ε : ℝ
ε0 : ε > 0
j✝ : ℕ
hj✝ : Nat.succ j✝ ≥ 1
j : ℕ
ih : Nat.succ j ≥ 1 → ↑abs (∑ m in range (Nat.succ j), 0 ^ m / ↑(Nat.factorial m) - 1) = 0
hj : Nat.succ (Nat.succ j) ≥ 1
⊢ ↑abs
      (∑ m in range j, 0 ^ m / ↑(Nat.factorial m) + 0 ^ j / ↑(Nat.factorial j) + 0 * 0 ^ j / ↑(Nat.factorial (j + 1)) -
        1) =
    ↑abs (∑ m in range j, 0 ^ m / ↑(Nat.factorial m) + 0 ^ j / ↑(Nat.factorial j) - 1)
[PROOFSTEP]
simp
[GOAL]
x y : ℂ
⊢ exp (x + y) = exp x * exp y
[PROOFSTEP]
have hj :
  ∀ j : ℕ,
    (∑ m in range j, (x + y) ^ m / m.factorial) =
      ∑ i in range j, ∑ k in range (i + 1), x ^ k / k.factorial * (y ^ (i - k) / (i - k).factorial) :=
  by
  intro j
  refine' Finset.sum_congr rfl fun m _ => _
  rw [add_pow, div_eq_mul_inv, sum_mul]
  refine' Finset.sum_congr rfl fun I hi => _
  have h₁ : (m.choose I : ℂ) ≠ 0 :=
    Nat.cast_ne_zero.2 (pos_iff_ne_zero.1 (Nat.choose_pos (Nat.le_of_lt_succ (mem_range.1 hi))))
  have h₂ := Nat.choose_mul_factorial_mul_factorial (Nat.le_of_lt_succ <| Finset.mem_range.1 hi)
  rw [← h₂, Nat.cast_mul, Nat.cast_mul, mul_inv, mul_inv]
  simp only [mul_left_comm (m.choose I : ℂ), mul_assoc, mul_left_comm (m.choose I : ℂ)⁻¹, mul_comm (m.choose I : ℂ)]
  rw [inv_mul_cancel h₁]
  simp [div_eq_mul_inv, mul_comm, mul_assoc, mul_left_comm]
[GOAL]
x y : ℂ
⊢ ∀ (j : ℕ),
    ∑ m in range j, (x + y) ^ m / ↑(Nat.factorial m) =
      ∑ i in range j, ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k)))
[PROOFSTEP]
intro j
[GOAL]
x y : ℂ
j : ℕ
⊢ ∑ m in range j, (x + y) ^ m / ↑(Nat.factorial m) =
    ∑ i in range j, ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k)))
[PROOFSTEP]
refine' Finset.sum_congr rfl fun m _ => _
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
⊢ (x + y) ^ m / ↑(Nat.factorial m) =
    ∑ k in range (m + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (m - k) / ↑(Nat.factorial (m - k)))
[PROOFSTEP]
rw [add_pow, div_eq_mul_inv, sum_mul]
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
⊢ ∑ x_1 in range (m + 1), x ^ x_1 * y ^ (m - x_1) * ↑(Nat.choose m x_1) * (↑(Nat.factorial m))⁻¹ =
    ∑ k in range (m + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (m - k) / ↑(Nat.factorial (m - k)))
[PROOFSTEP]
refine' Finset.sum_congr rfl fun I hi => _
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
I : ℕ
hi : I ∈ range (m + 1)
⊢ x ^ I * y ^ (m - I) * ↑(Nat.choose m I) * (↑(Nat.factorial m))⁻¹ =
    x ^ I / ↑(Nat.factorial I) * (y ^ (m - I) / ↑(Nat.factorial (m - I)))
[PROOFSTEP]
have h₁ : (m.choose I : ℂ) ≠ 0 :=
  Nat.cast_ne_zero.2 (pos_iff_ne_zero.1 (Nat.choose_pos (Nat.le_of_lt_succ (mem_range.1 hi))))
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
I : ℕ
hi : I ∈ range (m + 1)
h₁ : ↑(Nat.choose m I) ≠ 0
⊢ x ^ I * y ^ (m - I) * ↑(Nat.choose m I) * (↑(Nat.factorial m))⁻¹ =
    x ^ I / ↑(Nat.factorial I) * (y ^ (m - I) / ↑(Nat.factorial (m - I)))
[PROOFSTEP]
have h₂ := Nat.choose_mul_factorial_mul_factorial (Nat.le_of_lt_succ <| Finset.mem_range.1 hi)
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
I : ℕ
hi : I ∈ range (m + 1)
h₁ : ↑(Nat.choose m I) ≠ 0
h₂ : Nat.choose m I * Nat.factorial I * Nat.factorial (m - I) = Nat.factorial m
⊢ x ^ I * y ^ (m - I) * ↑(Nat.choose m I) * (↑(Nat.factorial m))⁻¹ =
    x ^ I / ↑(Nat.factorial I) * (y ^ (m - I) / ↑(Nat.factorial (m - I)))
[PROOFSTEP]
rw [← h₂, Nat.cast_mul, Nat.cast_mul, mul_inv, mul_inv]
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
I : ℕ
hi : I ∈ range (m + 1)
h₁ : ↑(Nat.choose m I) ≠ 0
h₂ : Nat.choose m I * Nat.factorial I * Nat.factorial (m - I) = Nat.factorial m
⊢ x ^ I * y ^ (m - I) * ↑(Nat.choose m I) *
      ((↑(Nat.choose m I))⁻¹ * (↑(Nat.factorial I))⁻¹ * (↑(Nat.factorial (m - I)))⁻¹) =
    x ^ I / ↑(Nat.factorial I) * (y ^ (m - I) / ↑(Nat.factorial (m - I)))
[PROOFSTEP]
simp only [mul_left_comm (m.choose I : ℂ), mul_assoc, mul_left_comm (m.choose I : ℂ)⁻¹, mul_comm (m.choose I : ℂ)]
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
I : ℕ
hi : I ∈ range (m + 1)
h₁ : ↑(Nat.choose m I) ≠ 0
h₂ : Nat.choose m I * Nat.factorial I * Nat.factorial (m - I) = Nat.factorial m
⊢ x ^ I *
      (y ^ (m - I) *
        ((↑(Nat.factorial I))⁻¹ * ((↑(Nat.factorial (m - I)))⁻¹ * ((↑(Nat.choose m I))⁻¹ * ↑(Nat.choose m I))))) =
    x ^ I / ↑(Nat.factorial I) * (y ^ (m - I) / ↑(Nat.factorial (m - I)))
[PROOFSTEP]
rw [inv_mul_cancel h₁]
[GOAL]
x y : ℂ
j m : ℕ
x✝ : m ∈ range j
I : ℕ
hi : I ∈ range (m + 1)
h₁ : ↑(Nat.choose m I) ≠ 0
h₂ : Nat.choose m I * Nat.factorial I * Nat.factorial (m - I) = Nat.factorial m
⊢ x ^ I * (y ^ (m - I) * ((↑(Nat.factorial I))⁻¹ * ((↑(Nat.factorial (m - I)))⁻¹ * 1))) =
    x ^ I / ↑(Nat.factorial I) * (y ^ (m - I) / ↑(Nat.factorial (m - I)))
[PROOFSTEP]
simp [div_eq_mul_inv, mul_comm, mul_assoc, mul_left_comm]
[GOAL]
x y : ℂ
hj :
  ∀ (j : ℕ),
    ∑ m in range j, (x + y) ^ m / ↑(Nat.factorial m) =
      ∑ i in range j, ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k)))
⊢ exp (x + y) = exp x * exp y
[PROOFSTEP]
simp_rw [exp, exp', lim_mul_lim]
[GOAL]
x y : ℂ
hj :
  ∀ (j : ℕ),
    ∑ m in range j, (x + y) ^ m / ↑(Nat.factorial m) =
      ∑ i in range j, ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k)))
⊢ CauSeq.lim
      { val := fun n => ∑ m in range n, (x + y) ^ m / ↑(Nat.factorial m),
        property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, (x + y) ^ m / ↑(Nat.factorial m)) } =
    CauSeq.lim
      ({ val := fun n => ∑ m in range n, x ^ m / ↑(Nat.factorial m),
          property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, x ^ m / ↑(Nat.factorial m)) } *
        { val := fun n => ∑ m in range n, y ^ m / ↑(Nat.factorial m),
          property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, y ^ m / ↑(Nat.factorial m)) })
[PROOFSTEP]
apply (lim_eq_lim_of_equiv _).symm
[GOAL]
x y : ℂ
hj :
  ∀ (j : ℕ),
    ∑ m in range j, (x + y) ^ m / ↑(Nat.factorial m) =
      ∑ i in range j, ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k)))
⊢ { val := fun n => ∑ m in range n, x ^ m / ↑(Nat.factorial m),
        property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, x ^ m / ↑(Nat.factorial m)) } *
      { val := fun n => ∑ m in range n, y ^ m / ↑(Nat.factorial m),
        property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, y ^ m / ↑(Nat.factorial m)) } ≈
    { val := fun n => ∑ m in range n, (x + y) ^ m / ↑(Nat.factorial m),
      property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, (x + y) ^ m / ↑(Nat.factorial m)) }
[PROOFSTEP]
simp only [hj]
[GOAL]
x y : ℂ
hj :
  ∀ (j : ℕ),
    ∑ m in range j, (x + y) ^ m / ↑(Nat.factorial m) =
      ∑ i in range j, ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k)))
⊢ { val := fun n => ∑ m in range n, x ^ m / ↑(Nat.factorial m),
        property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, x ^ m / ↑(Nat.factorial m)) } *
      { val := fun n => ∑ m in range n, y ^ m / ↑(Nat.factorial m),
        property := (_ : IsCauSeq ↑abs fun n => ∑ m in range n, y ^ m / ↑(Nat.factorial m)) } ≈
    {
      val := fun n =>
        ∑ i in range n, ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k))),
      property :=
        (_ :
          (fun f => IsCauSeq (↑abs) f) fun n =>
            ∑ i in range n,
              ∑ k in range (i + 1), x ^ k / ↑(Nat.factorial k) * (y ^ (i - k) / ↑(Nat.factorial (i - k)))) }
[PROOFSTEP]
exact cauchy_product (isCauSeq_abs_exp x) (isCauSeq_exp y)
[GOAL]
x y : ℂ
⊢ (fun z => exp (↑Multiplicative.toAdd z)) 1 = 1
[PROOFSTEP]
simp
[GOAL]
x y : ℂ
⊢ ∀ (x y : Multiplicative ℂ),
    OneHom.toFun { toFun := fun z => exp (↑Multiplicative.toAdd z), map_one' := (_ : exp 0 = 1) } (x * y) =
      OneHom.toFun { toFun := fun z => exp (↑Multiplicative.toAdd z), map_one' := (_ : exp 0 = 1) } x *
        OneHom.toFun { toFun := fun z => exp (↑Multiplicative.toAdd z), map_one' := (_ : exp 0 = 1) } y
[PROOFSTEP]
simp [exp_add]
[GOAL]
x✝ y x : ℂ
⊢ exp (↑0 * x) = exp x ^ 0
[PROOFSTEP]
rw [Nat.cast_zero, zero_mul, exp_zero, pow_zero]
[GOAL]
x✝ y x : ℂ
n : ℕ
⊢ exp (↑(Nat.succ n) * x) = exp x ^ Nat.succ n
[PROOFSTEP]
rw [pow_succ', Nat.cast_add_one, add_mul, exp_add, ← exp_nat_mul _ n, one_mul]
[GOAL]
x y : ℂ
h : exp x = 0
⊢ 0 = 1
[PROOFSTEP]
rw [← exp_zero, ← add_neg_self x, exp_add, h]
[GOAL]
x y : ℂ
h : exp x = 0
⊢ x + -x = 0 * exp (-x)
[PROOFSTEP]
simp
[GOAL]
x y : ℂ
⊢ exp (-x) = (exp x)⁻¹
[PROOFSTEP]
rw [← mul_right_inj' (exp_ne_zero x), ← exp_add]
[GOAL]
x y : ℂ
⊢ exp (x + -x) = exp x * (exp x)⁻¹
[PROOFSTEP]
simp [mul_inv_cancel (exp_ne_zero x)]
[GOAL]
x y : ℂ
⊢ exp (x - y) = exp x / exp y
[PROOFSTEP]
simp [sub_eq_add_neg, exp_add, exp_neg, div_eq_mul_inv]
[GOAL]
x y z : ℂ
n : ℤ
⊢ exp (↑n * z) = exp z ^ n
[PROOFSTEP]
cases n
[GOAL]
case ofNat
x y z : ℂ
a✝ : ℕ
⊢ exp (↑(Int.ofNat a✝) * z) = exp z ^ Int.ofNat a✝
[PROOFSTEP]
simp [exp_nat_mul]
[GOAL]
case negSucc
x y z : ℂ
a✝ : ℕ
⊢ exp (↑(Int.negSucc a✝) * z) = exp z ^ Int.negSucc a✝
[PROOFSTEP]
simp [exp_add, add_mul, pow_add, exp_neg, exp_nat_mul]
[GOAL]
x y : ℂ
⊢ exp (↑(starRingEnd ℂ) x) = ↑(starRingEnd ℂ) (exp x)
[PROOFSTEP]
dsimp [exp]
[GOAL]
x y : ℂ
⊢ CauSeq.lim (exp' (↑(starRingEnd ℂ) x)) = ↑(starRingEnd ℂ) (CauSeq.lim (exp' x))
[PROOFSTEP]
rw [← lim_conj]
[GOAL]
x y : ℂ
⊢ CauSeq.lim (exp' (↑(starRingEnd ℂ) x)) = CauSeq.lim (cauSeqConj (exp' x))
[PROOFSTEP]
refine' congr_arg CauSeq.lim (CauSeq.ext fun _ => _)
[GOAL]
x y : ℂ
x✝ : ℕ
⊢ ↑(exp' (↑(starRingEnd ℂ) x)) x✝ = ↑(cauSeqConj (exp' x)) x✝
[PROOFSTEP]
dsimp [exp', Function.comp, isCauSeq_conj, cauSeqConj]
[GOAL]
x y : ℂ
x✝ : ℕ
⊢ ∑ m in range x✝, ↑(starRingEnd ℂ) x ^ m / ↑(Nat.factorial m) =
    ↑(starRingEnd ℂ) (∑ m in range x✝, x ^ m / ↑(Nat.factorial m))
[PROOFSTEP]
rw [(starRingEnd _).map_sum]
[GOAL]
x y : ℂ
x✝ : ℕ
⊢ ∑ m in range x✝, ↑(starRingEnd ℂ) x ^ m / ↑(Nat.factorial m) =
    ∑ x_1 in range x✝, ↑(starRingEnd ℂ) (x ^ x_1 / ↑(Nat.factorial x_1))
[PROOFSTEP]
refine' sum_congr rfl fun n _ => _
[GOAL]
x y : ℂ
x✝¹ n : ℕ
x✝ : n ∈ range x✝¹
⊢ ↑(starRingEnd ℂ) x ^ n / ↑(Nat.factorial n) = ↑(starRingEnd ℂ) (x ^ n / ↑(Nat.factorial n))
[PROOFSTEP]
rw [map_div₀, map_pow, ← ofReal_nat_cast, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ ↑(starRingEnd ℂ) (exp ↑x) = exp ↑x
[PROOFSTEP]
rw [← exp_conj, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (exp ↑x).im = 0
[PROOFSTEP]
rw [← ofReal_exp_ofReal_re, ofReal_im]
[GOAL]
x y : ℂ
⊢ sinh 0 = 0
[PROOFSTEP]
simp [sinh]
[GOAL]
x y : ℂ
⊢ sinh (-x) = -sinh x
[PROOFSTEP]
simp [sinh, exp_neg, (neg_div _ _).symm, add_mul]
[GOAL]
x y a b c d : ℂ
⊢ (a - b) * (c + d) + (a + b) * (c - d) = 2 * (a * c - b * d)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ sinh (x + y) = sinh x * cosh y + cosh x * sinh y
[PROOFSTEP]
rw [← mul_right_inj' (two_ne_zero' ℂ), two_sinh, exp_add, neg_add, exp_add, eq_comm, mul_add, ← mul_assoc, two_sinh,
  mul_left_comm, two_sinh, ← mul_right_inj' (two_ne_zero' ℂ), mul_add, mul_left_comm, two_cosh, ← mul_assoc, two_cosh]
[GOAL]
x y : ℂ
⊢ (exp x - exp (-x)) * (exp y + exp (-y)) + (exp x + exp (-x)) * (exp y - exp (-y)) =
    2 * (exp x * exp y - exp (-x) * exp (-y))
[PROOFSTEP]
exact sinh_add_aux
[GOAL]
x y : ℂ
⊢ cosh 0 = 1
[PROOFSTEP]
simp [cosh]
[GOAL]
x y : ℂ
⊢ cosh (-x) = cosh x
[PROOFSTEP]
simp [add_comm, cosh, exp_neg]
[GOAL]
x y a b c d : ℂ
⊢ (a + b) * (c + d) + (a - b) * (c - d) = 2 * (a * c + b * d)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ cosh (x + y) = cosh x * cosh y + sinh x * sinh y
[PROOFSTEP]
rw [← mul_right_inj' (two_ne_zero' ℂ), two_cosh, exp_add, neg_add, exp_add, eq_comm, mul_add, ← mul_assoc, two_cosh, ←
  mul_assoc, two_sinh, ← mul_right_inj' (two_ne_zero' ℂ), mul_add, mul_left_comm, two_cosh, mul_left_comm, two_sinh]
[GOAL]
x y : ℂ
⊢ (exp x + exp (-x)) * (exp y + exp (-y)) + (exp x - exp (-x)) * (exp y - exp (-y)) =
    2 * (exp x * exp y + exp (-x) * exp (-y))
[PROOFSTEP]
exact cosh_add_aux
[GOAL]
x y : ℂ
⊢ sinh (x - y) = sinh x * cosh y - cosh x * sinh y
[PROOFSTEP]
simp [sub_eq_add_neg, sinh_add, sinh_neg, cosh_neg]
[GOAL]
x y : ℂ
⊢ cosh (x - y) = cosh x * cosh y - sinh x * sinh y
[PROOFSTEP]
simp [sub_eq_add_neg, cosh_add, sinh_neg, cosh_neg]
[GOAL]
x y : ℂ
⊢ sinh (↑(starRingEnd ℂ) x) = ↑(starRingEnd ℂ) (sinh x)
[PROOFSTEP]
rw [sinh, ← RingHom.map_neg, exp_conj, exp_conj, ← RingHom.map_sub, sinh, map_div₀]
  --Porting note: not nice
[GOAL]
x y : ℂ
⊢ ↑(starRingEnd ℂ) (exp x - exp (-x)) / 2 = ↑(starRingEnd ℂ) (exp x - exp (-x)) / ↑(starRingEnd ℂ) 2
[PROOFSTEP]
simp [← one_add_one_eq_two]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ ↑(starRingEnd ℂ) (sinh ↑x) = sinh ↑x
[PROOFSTEP]
rw [← sinh_conj, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (sinh ↑x).im = 0
[PROOFSTEP]
rw [← ofReal_sinh_ofReal_re, ofReal_im]
[GOAL]
x y : ℂ
⊢ cosh (↑(starRingEnd ℂ) x) = ↑(starRingEnd ℂ) (cosh x)
[PROOFSTEP]
rw [cosh, ← RingHom.map_neg, exp_conj, exp_conj, ← RingHom.map_add, cosh, map_div₀]
  --Porting note: not nice
[GOAL]
x y : ℂ
⊢ ↑(starRingEnd ℂ) (exp x + exp (-x)) / 2 = ↑(starRingEnd ℂ) (exp x + exp (-x)) / ↑(starRingEnd ℂ) 2
[PROOFSTEP]
simp [← one_add_one_eq_two]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ ↑(starRingEnd ℂ) (cosh ↑x) = cosh ↑x
[PROOFSTEP]
rw [← cosh_conj, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (cosh ↑x).im = 0
[PROOFSTEP]
rw [← ofReal_cosh_ofReal_re, ofReal_im]
[GOAL]
x y : ℂ
⊢ tanh 0 = 0
[PROOFSTEP]
simp [tanh]
[GOAL]
x y : ℂ
⊢ tanh (-x) = -tanh x
[PROOFSTEP]
simp [tanh, neg_div]
[GOAL]
x y : ℂ
⊢ tanh (↑(starRingEnd ℂ) x) = ↑(starRingEnd ℂ) (tanh x)
[PROOFSTEP]
rw [tanh, sinh_conj, cosh_conj, ← map_div₀, tanh]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ ↑(starRingEnd ℂ) (tanh ↑x) = tanh ↑x
[PROOFSTEP]
rw [← tanh_conj, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (tanh ↑x).im = 0
[PROOFSTEP]
rw [← ofReal_tanh_ofReal_re, ofReal_im]
[GOAL]
x y : ℂ
⊢ cosh x + sinh x = exp x
[PROOFSTEP]
rw [← mul_right_inj' (two_ne_zero' ℂ), mul_add, two_cosh, two_sinh, add_add_sub_cancel, two_mul]
[GOAL]
x y : ℂ
⊢ sinh x + cosh x = exp x
[PROOFSTEP]
rw [add_comm, cosh_add_sinh]
[GOAL]
x y : ℂ
⊢ cosh x - sinh x = exp (-x)
[PROOFSTEP]
rw [← mul_right_inj' (two_ne_zero' ℂ), mul_sub, two_cosh, two_sinh, add_sub_sub_cancel, two_mul]
[GOAL]
x y : ℂ
⊢ sinh x - cosh x = -exp (-x)
[PROOFSTEP]
rw [← neg_sub, cosh_sub_sinh]
[GOAL]
x y : ℂ
⊢ cosh x ^ 2 - sinh x ^ 2 = 1
[PROOFSTEP]
rw [sq_sub_sq, cosh_add_sinh, cosh_sub_sinh, ← exp_add, add_neg_self, exp_zero]
[GOAL]
x y : ℂ
⊢ cosh x ^ 2 = sinh x ^ 2 + 1
[PROOFSTEP]
rw [← cosh_sq_sub_sinh_sq x]
[GOAL]
x y : ℂ
⊢ cosh x ^ 2 = sinh x ^ 2 + (cosh x ^ 2 - sinh x ^ 2)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ sinh x ^ 2 = cosh x ^ 2 - 1
[PROOFSTEP]
rw [← cosh_sq_sub_sinh_sq x]
[GOAL]
x y : ℂ
⊢ sinh x ^ 2 = cosh x ^ 2 - (cosh x ^ 2 - sinh x ^ 2)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ cosh (2 * x) = cosh x ^ 2 + sinh x ^ 2
[PROOFSTEP]
rw [two_mul, cosh_add, sq, sq]
[GOAL]
x y : ℂ
⊢ sinh (2 * x) = 2 * sinh x * cosh x
[PROOFSTEP]
rw [two_mul, sinh_add]
[GOAL]
x y : ℂ
⊢ sinh x * cosh x + cosh x * sinh x = 2 * sinh x * cosh x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ cosh (3 * x) = 4 * cosh x ^ 3 - 3 * cosh x
[PROOFSTEP]
have h1 : x + 2 * x = 3 * x := by ring
[GOAL]
x y : ℂ
⊢ x + 2 * x = 3 * x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cosh (3 * x) = 4 * cosh x ^ 3 - 3 * cosh x
[PROOFSTEP]
rw [← h1, cosh_add x (2 * x)]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cosh x * cosh (2 * x) + sinh x * sinh (2 * x) = 4 * cosh x ^ 3 - 3 * cosh x
[PROOFSTEP]
simp only [cosh_two_mul, sinh_two_mul]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cosh x * (cosh x ^ 2 + sinh x ^ 2) + sinh x * (2 * sinh x * cosh x) = 4 * cosh x ^ 3 - 3 * cosh x
[PROOFSTEP]
have h2 : sinh x * (2 * sinh x * cosh x) = 2 * cosh x * sinh x ^ 2 := by ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ sinh x * (2 * sinh x * cosh x) = 2 * cosh x * sinh x ^ 2
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : sinh x * (2 * sinh x * cosh x) = 2 * cosh x * sinh x ^ 2
⊢ cosh x * (cosh x ^ 2 + sinh x ^ 2) + sinh x * (2 * sinh x * cosh x) = 4 * cosh x ^ 3 - 3 * cosh x
[PROOFSTEP]
rw [h2, sinh_sq]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : sinh x * (2 * sinh x * cosh x) = 2 * cosh x * sinh x ^ 2
⊢ cosh x * (cosh x ^ 2 + (cosh x ^ 2 - 1)) + 2 * cosh x * (cosh x ^ 2 - 1) = 4 * cosh x ^ 3 - 3 * cosh x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ sinh (3 * x) = 4 * sinh x ^ 3 + 3 * sinh x
[PROOFSTEP]
have h1 : x + 2 * x = 3 * x := by ring
[GOAL]
x y : ℂ
⊢ x + 2 * x = 3 * x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ sinh (3 * x) = 4 * sinh x ^ 3 + 3 * sinh x
[PROOFSTEP]
rw [← h1, sinh_add x (2 * x)]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ sinh x * cosh (2 * x) + cosh x * sinh (2 * x) = 4 * sinh x ^ 3 + 3 * sinh x
[PROOFSTEP]
simp only [cosh_two_mul, sinh_two_mul]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ sinh x * (cosh x ^ 2 + sinh x ^ 2) + cosh x * (2 * sinh x * cosh x) = 4 * sinh x ^ 3 + 3 * sinh x
[PROOFSTEP]
have h2 : cosh x * (2 * sinh x * cosh x) = 2 * sinh x * cosh x ^ 2 := by ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cosh x * (2 * sinh x * cosh x) = 2 * sinh x * cosh x ^ 2
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : cosh x * (2 * sinh x * cosh x) = 2 * sinh x * cosh x ^ 2
⊢ sinh x * (cosh x ^ 2 + sinh x ^ 2) + cosh x * (2 * sinh x * cosh x) = 4 * sinh x ^ 3 + 3 * sinh x
[PROOFSTEP]
rw [h2, cosh_sq]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : cosh x * (2 * sinh x * cosh x) = 2 * sinh x * cosh x ^ 2
⊢ sinh x * (sinh x ^ 2 + 1 + sinh x ^ 2) + 2 * sinh x * (sinh x ^ 2 + 1) = 4 * sinh x ^ 3 + 3 * sinh x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ sin 0 = 0
[PROOFSTEP]
simp [sin]
[GOAL]
x y : ℂ
⊢ sin (-x) = -sin x
[PROOFSTEP]
simp [sin, sub_eq_add_neg, exp_neg, (neg_div _ _).symm, add_mul]
[GOAL]
x y : ℂ
⊢ sinh (x * I) = sin x * I
[PROOFSTEP]
rw [← mul_right_inj' (two_ne_zero' ℂ), two_sinh, ← mul_assoc, two_sin, mul_assoc, I_mul_I, mul_neg_one, neg_sub,
  neg_mul_eq_neg_mul]
[GOAL]
x y : ℂ
⊢ cosh (x * I) = cos x
[PROOFSTEP]
rw [← mul_right_inj' (two_ne_zero' ℂ), two_cosh, two_cos, neg_mul_eq_neg_mul]
[GOAL]
x y : ℂ
⊢ tanh (x * I) = tan x * I
[PROOFSTEP]
rw [tanh_eq_sinh_div_cosh, cosh_mul_I, sinh_mul_I, mul_div_right_comm, tan]
[GOAL]
x y : ℂ
⊢ cos (x * I) = cosh x
[PROOFSTEP]
rw [← cosh_mul_I]
[GOAL]
x y : ℂ
⊢ cosh (x * I * I) = cosh x
[PROOFSTEP]
ring_nf
[GOAL]
x y : ℂ
⊢ cosh (x * I ^ 2) = cosh x
[PROOFSTEP]
simp
[GOAL]
x y : ℂ
⊢ sin (x * I) = sinh x * I
[PROOFSTEP]
have h : I * sin (x * I) = -sinh x := by
  rw [mul_comm, ← sinh_mul_I]
  ring_nf
  simp
[GOAL]
x y : ℂ
⊢ I * sin (x * I) = -sinh x
[PROOFSTEP]
rw [mul_comm, ← sinh_mul_I]
[GOAL]
x y : ℂ
⊢ sinh (x * I * I) = -sinh x
[PROOFSTEP]
ring_nf
[GOAL]
x y : ℂ
⊢ sinh (x * I ^ 2) = -sinh x
[PROOFSTEP]
simp
[GOAL]
x y : ℂ
h : I * sin (x * I) = -sinh x
⊢ sin (x * I) = sinh x * I
[PROOFSTEP]
rw [← neg_neg (sinh x), ← h]
[GOAL]
x y : ℂ
h : I * sin (x * I) = -sinh x
⊢ sin (x * I) = -(I * sin (x * I)) * I
[PROOFSTEP]
ext
[GOAL]
case a
x y : ℂ
h : I * sin (x * I) = -sinh x
⊢ (sin (x * I)).re = (-(I * sin (x * I)) * I).re
[PROOFSTEP]
simp
[GOAL]
case a
x y : ℂ
h : I * sin (x * I) = -sinh x
⊢ (sin (x * I)).im = (-(I * sin (x * I)) * I).im
[PROOFSTEP]
simp
[GOAL]
x y : ℂ
⊢ tan (x * I) = tanh x * I
[PROOFSTEP]
rw [tan, sin_mul_I, cos_mul_I, mul_div_right_comm, tanh_eq_sinh_div_cosh]
[GOAL]
x y : ℂ
⊢ sin (x + y) = sin x * cos y + cos x * sin y
[PROOFSTEP]
rw [← mul_left_inj' I_ne_zero, ← sinh_mul_I, add_mul, add_mul, mul_right_comm, ← sinh_mul_I, mul_assoc, ← sinh_mul_I, ←
  cosh_mul_I, ← cosh_mul_I, sinh_add]
[GOAL]
x y : ℂ
⊢ cos 0 = 1
[PROOFSTEP]
simp [cos]
[GOAL]
x y : ℂ
⊢ cos (-x) = cos x
[PROOFSTEP]
simp [cos, sub_eq_add_neg, exp_neg, add_comm]
[GOAL]
x y a b c d : ℂ
⊢ (a + b) * (c + d) - (b - a) * (d - c) * -1 = 2 * (a * c + b * d)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ cos (x + y) = cos x * cos y - sin x * sin y
[PROOFSTEP]
rw [← cosh_mul_I, add_mul, cosh_add, cosh_mul_I, cosh_mul_I, sinh_mul_I, sinh_mul_I, mul_mul_mul_comm, I_mul_I,
  mul_neg_one, sub_eq_add_neg]
[GOAL]
x y : ℂ
⊢ sin (x - y) = sin x * cos y - cos x * sin y
[PROOFSTEP]
simp [sub_eq_add_neg, sin_add, sin_neg, cos_neg]
[GOAL]
x y : ℂ
⊢ cos (x - y) = cos x * cos y + sin x * sin y
[PROOFSTEP]
simp [sub_eq_add_neg, cos_add, sin_neg, cos_neg]
[GOAL]
x✝ y✝ x y : ℂ
⊢ sin (x + y * I) = sin x * cosh y + cos x * sinh y * I
[PROOFSTEP]
rw [sin_add, cos_mul_I, sin_mul_I, mul_assoc]
[GOAL]
x y z : ℂ
⊢ sin z = sin ↑z.re * cosh ↑z.im + cos ↑z.re * sinh ↑z.im * I
[PROOFSTEP]
convert sin_add_mul_I z.re z.im
[GOAL]
case h.e'_2.h.e'_1
x y z : ℂ
⊢ z = ↑z.re + ↑z.im * I
[PROOFSTEP]
exact (re_add_im z).symm
[GOAL]
x✝ y✝ x y : ℂ
⊢ cos (x + y * I) = cos x * cosh y - sin x * sinh y * I
[PROOFSTEP]
rw [cos_add, cos_mul_I, sin_mul_I, mul_assoc]
[GOAL]
x y z : ℂ
⊢ cos z = cos ↑z.re * cosh ↑z.im - sin ↑z.re * sinh ↑z.im * I
[PROOFSTEP]
convert cos_add_mul_I z.re z.im
[GOAL]
case h.e'_2.h.e'_1
x y z : ℂ
⊢ z = ↑z.re + ↑z.im * I
[PROOFSTEP]
exact (re_add_im z).symm
[GOAL]
x y : ℂ
⊢ sin x - sin y = 2 * sin ((x - y) / 2) * cos ((x + y) / 2)
[PROOFSTEP]
have s1 := sin_add ((x + y) / 2) ((x - y) / 2)
[GOAL]
x y : ℂ
s1 : sin ((x + y) / 2 + (x - y) / 2) = sin ((x + y) / 2) * cos ((x - y) / 2) + cos ((x + y) / 2) * sin ((x - y) / 2)
⊢ sin x - sin y = 2 * sin ((x - y) / 2) * cos ((x + y) / 2)
[PROOFSTEP]
have s2 := sin_sub ((x + y) / 2) ((x - y) / 2)
[GOAL]
x y : ℂ
s1 : sin ((x + y) / 2 + (x - y) / 2) = sin ((x + y) / 2) * cos ((x - y) / 2) + cos ((x + y) / 2) * sin ((x - y) / 2)
s2 : sin ((x + y) / 2 - (x - y) / 2) = sin ((x + y) / 2) * cos ((x - y) / 2) - cos ((x + y) / 2) * sin ((x - y) / 2)
⊢ sin x - sin y = 2 * sin ((x - y) / 2) * cos ((x + y) / 2)
[PROOFSTEP]
rw [div_add_div_same, add_sub, add_right_comm, add_sub_cancel, half_add_self] at s1 
[GOAL]
x y : ℂ
s1 : sin x = sin ((x + y) / 2) * cos ((x - y) / 2) + cos ((x + y) / 2) * sin ((x - y) / 2)
s2 : sin ((x + y) / 2 - (x - y) / 2) = sin ((x + y) / 2) * cos ((x - y) / 2) - cos ((x + y) / 2) * sin ((x - y) / 2)
⊢ sin x - sin y = 2 * sin ((x - y) / 2) * cos ((x + y) / 2)
[PROOFSTEP]
rw [div_sub_div_same, ← sub_add, add_sub_cancel', half_add_self] at s2 
[GOAL]
x y : ℂ
s1 : sin x = sin ((x + y) / 2) * cos ((x - y) / 2) + cos ((x + y) / 2) * sin ((x - y) / 2)
s2 : sin y = sin ((x + y) / 2) * cos ((x - y) / 2) - cos ((x + y) / 2) * sin ((x - y) / 2)
⊢ sin x - sin y = 2 * sin ((x - y) / 2) * cos ((x + y) / 2)
[PROOFSTEP]
rw [s1, s2]
[GOAL]
x y : ℂ
s1 : sin x = sin ((x + y) / 2) * cos ((x - y) / 2) + cos ((x + y) / 2) * sin ((x - y) / 2)
s2 : sin y = sin ((x + y) / 2) * cos ((x - y) / 2) - cos ((x + y) / 2) * sin ((x - y) / 2)
⊢ sin ((x + y) / 2) * cos ((x - y) / 2) + cos ((x + y) / 2) * sin ((x - y) / 2) -
      (sin ((x + y) / 2) * cos ((x - y) / 2) - cos ((x + y) / 2) * sin ((x - y) / 2)) =
    2 * sin ((x - y) / 2) * cos ((x + y) / 2)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ cos x - cos y = -2 * sin ((x + y) / 2) * sin ((x - y) / 2)
[PROOFSTEP]
have s1 := cos_add ((x + y) / 2) ((x - y) / 2)
[GOAL]
x y : ℂ
s1 : cos ((x + y) / 2 + (x - y) / 2) = cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2)
⊢ cos x - cos y = -2 * sin ((x + y) / 2) * sin ((x - y) / 2)
[PROOFSTEP]
have s2 := cos_sub ((x + y) / 2) ((x - y) / 2)
[GOAL]
x y : ℂ
s1 : cos ((x + y) / 2 + (x - y) / 2) = cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2)
s2 : cos ((x + y) / 2 - (x - y) / 2) = cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)
⊢ cos x - cos y = -2 * sin ((x + y) / 2) * sin ((x - y) / 2)
[PROOFSTEP]
rw [div_add_div_same, add_sub, add_right_comm, add_sub_cancel, half_add_self] at s1 
[GOAL]
x y : ℂ
s1 : cos x = cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2)
s2 : cos ((x + y) / 2 - (x - y) / 2) = cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)
⊢ cos x - cos y = -2 * sin ((x + y) / 2) * sin ((x - y) / 2)
[PROOFSTEP]
rw [div_sub_div_same, ← sub_add, add_sub_cancel', half_add_self] at s2 
[GOAL]
x y : ℂ
s1 : cos x = cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2)
s2 : cos y = cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)
⊢ cos x - cos y = -2 * sin ((x + y) / 2) * sin ((x - y) / 2)
[PROOFSTEP]
rw [s1, s2]
[GOAL]
x y : ℂ
s1 : cos x = cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2)
s2 : cos y = cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)
⊢ cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2) -
      (cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)) =
    -2 * sin ((x + y) / 2) * sin ((x - y) / 2)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ cos x + cos y = 2 * cos ((x + y) / 2) * cos ((x - y) / 2)
[PROOFSTEP]
have h2 : (2 : ℂ) ≠ 0 := by norm_num
[GOAL]
x y : ℂ
⊢ 2 ≠ 0
[PROOFSTEP]
norm_num
[GOAL]
x y : ℂ
h2 : 2 ≠ 0
⊢ cos x + cos y = 2 * cos ((x + y) / 2) * cos ((x - y) / 2)
[PROOFSTEP]
calc
  cos x + cos y = cos ((x + y) / 2 + (x - y) / 2) + cos ((x + y) / 2 - (x - y) / 2) := ?_
  _ =
      cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2) +
        (cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)) :=
    ?_
  _ = 2 * cos ((x + y) / 2) * cos ((x - y) / 2) := ?_
[GOAL]
case calc_1
x y : ℂ
h2 : 2 ≠ 0
⊢ cos x + cos y = cos ((x + y) / 2 + (x - y) / 2) + cos ((x + y) / 2 - (x - y) / 2)
[PROOFSTEP]
congr
[GOAL]
case calc_1.e_a.e_z
x y : ℂ
h2 : 2 ≠ 0
⊢ x = (x + y) / 2 + (x - y) / 2
[PROOFSTEP]
field_simp [h2]
[GOAL]
case calc_1.e_a.e_z
x y : ℂ
h2 : 2 ≠ 0
⊢ y = (x + y) / 2 - (x - y) / 2
[PROOFSTEP]
field_simp [h2]
[GOAL]
case calc_2
x y : ℂ
h2 : 2 ≠ 0
⊢ cos ((x + y) / 2 + (x - y) / 2) + cos ((x + y) / 2 - (x - y) / 2) =
    cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2) +
      (cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2))
[PROOFSTEP]
rw [cos_add, cos_sub]
[GOAL]
case calc_3
x y : ℂ
h2 : 2 ≠ 0
⊢ cos ((x + y) / 2) * cos ((x - y) / 2) - sin ((x + y) / 2) * sin ((x - y) / 2) +
      (cos ((x + y) / 2) * cos ((x - y) / 2) + sin ((x + y) / 2) * sin ((x - y) / 2)) =
    2 * cos ((x + y) / 2) * cos ((x - y) / 2)
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ sin (↑(starRingEnd ℂ) x) = ↑(starRingEnd ℂ) (sin x)
[PROOFSTEP]
rw [← mul_left_inj' I_ne_zero, ← sinh_mul_I, ← conj_neg_I, ← RingHom.map_mul, ← RingHom.map_mul, sinh_conj, mul_neg,
  sinh_neg, sinh_mul_I, mul_neg]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ ↑(starRingEnd ℂ) (sin ↑x) = sin ↑x
[PROOFSTEP]
rw [← sin_conj, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (sin ↑x).im = 0
[PROOFSTEP]
rw [← ofReal_sin_ofReal_re, ofReal_im]
[GOAL]
x y : ℂ
⊢ cos (↑(starRingEnd ℂ) x) = ↑(starRingEnd ℂ) (cos x)
[PROOFSTEP]
rw [← cosh_mul_I, ← conj_neg_I, ← RingHom.map_mul, ← cosh_mul_I, cosh_conj, mul_neg, cosh_neg]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ ↑(starRingEnd ℂ) (cos ↑x) = cos ↑x
[PROOFSTEP]
rw [← cos_conj, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (cos ↑x).im = 0
[PROOFSTEP]
rw [← ofReal_cos_ofReal_re, ofReal_im]
[GOAL]
x y : ℂ
⊢ tan 0 = 0
[PROOFSTEP]
simp [tan]
[GOAL]
x✝ y x : ℂ
hx : cos x ≠ 0
⊢ tan x * cos x = sin x
[PROOFSTEP]
rw [tan_eq_sin_div_cos, div_mul_cancel _ hx]
[GOAL]
x y : ℂ
⊢ tan (-x) = -tan x
[PROOFSTEP]
simp [tan, neg_div]
[GOAL]
x y : ℂ
⊢ tan (↑(starRingEnd ℂ) x) = ↑(starRingEnd ℂ) (tan x)
[PROOFSTEP]
rw [tan, sin_conj, cos_conj, ← map_div₀, tan]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ ↑(starRingEnd ℂ) (tan ↑x) = tan ↑x
[PROOFSTEP]
rw [← tan_conj, conj_ofReal]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (tan ↑x).im = 0
[PROOFSTEP]
rw [← ofReal_tan_ofReal_re, ofReal_im]
[GOAL]
x y : ℂ
⊢ cos x + sin x * I = exp (x * I)
[PROOFSTEP]
rw [← cosh_add_sinh, sinh_mul_I, cosh_mul_I]
[GOAL]
x y : ℂ
⊢ cos x - sin x * I = exp (-x * I)
[PROOFSTEP]
rw [neg_mul, ← cosh_sub_sinh, sinh_mul_I, cosh_mul_I]
[GOAL]
x y : ℂ
⊢ sin x ^ 2 + cos x ^ 2 = cosh (x * I) ^ 2 - sinh (x * I) ^ 2
[PROOFSTEP]
rw [cosh_mul_I, sinh_mul_I, mul_pow, I_sq, mul_neg_one, sub_neg_eq_add, add_comm]
[GOAL]
x y : ℂ
⊢ cos x ^ 2 + sin x ^ 2 = 1
[PROOFSTEP]
rw [add_comm, sin_sq_add_cos_sq]
[GOAL]
x y : ℂ
⊢ cos (2 * x) = cos x ^ 2 - sin x ^ 2
[PROOFSTEP]
rw [two_mul, cos_add, ← sq, ← sq]
[GOAL]
x y : ℂ
⊢ cos (2 * x) = 2 * cos x ^ 2 - 1
[PROOFSTEP]
rw [cos_two_mul', eq_sub_iff_add_eq.2 (sin_sq_add_cos_sq x), ← sub_add, sub_add_eq_add_sub, two_mul]
[GOAL]
x y : ℂ
⊢ sin (2 * x) = 2 * sin x * cos x
[PROOFSTEP]
rw [two_mul, sin_add, two_mul, add_mul, mul_comm]
[GOAL]
x y : ℂ
⊢ cos x ^ 2 = 1 / 2 + cos (2 * x) / 2
[PROOFSTEP]
simp [cos_two_mul, div_add_div_same, mul_div_cancel_left, two_ne_zero, -one_div]
[GOAL]
x y : ℂ
⊢ cos x ^ 2 = 1 - sin x ^ 2
[PROOFSTEP]
rw [← sin_sq_add_cos_sq x, add_sub_cancel']
[GOAL]
x y : ℂ
⊢ sin x ^ 2 = 1 - cos x ^ 2
[PROOFSTEP]
rw [← sin_sq_add_cos_sq x, add_sub_cancel]
[GOAL]
x✝ y x : ℂ
hx : cos x ≠ 0
⊢ (1 + tan x ^ 2)⁻¹ = cos x ^ 2
[PROOFSTEP]
have : cos x ^ 2 ≠ 0 := pow_ne_zero 2 hx
[GOAL]
x✝ y x : ℂ
hx : cos x ≠ 0
this : cos x ^ 2 ≠ 0
⊢ (1 + tan x ^ 2)⁻¹ = cos x ^ 2
[PROOFSTEP]
rw [tan_eq_sin_div_cos, div_pow]
[GOAL]
x✝ y x : ℂ
hx : cos x ≠ 0
this : cos x ^ 2 ≠ 0
⊢ (1 + sin x ^ 2 / cos x ^ 2)⁻¹ = cos x ^ 2
[PROOFSTEP]
field_simp [this]
[GOAL]
x✝ y x : ℂ
hx : cos x ≠ 0
⊢ tan x ^ 2 / (1 + tan x ^ 2) = sin x ^ 2
[PROOFSTEP]
simp only [← tan_mul_cos hx, mul_pow, ← inv_one_add_tan_sq hx, div_eq_mul_inv, one_mul]
[GOAL]
x y : ℂ
⊢ cos (3 * x) = 4 * cos x ^ 3 - 3 * cos x
[PROOFSTEP]
have h1 : x + 2 * x = 3 * x := by ring
[GOAL]
x y : ℂ
⊢ x + 2 * x = 3 * x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cos (3 * x) = 4 * cos x ^ 3 - 3 * cos x
[PROOFSTEP]
rw [← h1, cos_add x (2 * x)]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cos x * cos (2 * x) - sin x * sin (2 * x) = 4 * cos x ^ 3 - 3 * cos x
[PROOFSTEP]
simp only [cos_two_mul, sin_two_mul, mul_add, mul_sub, mul_one, sq]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cos x * (2 * (cos x * cos x)) - cos x - sin x * (2 * sin x * cos x) = 4 * cos x ^ 3 - 3 * cos x
[PROOFSTEP]
have h2 : 4 * cos x ^ 3 = 2 * cos x * cos x * cos x + 2 * cos x * cos x ^ 2 := by ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ 4 * cos x ^ 3 = 2 * cos x * cos x * cos x + 2 * cos x * cos x ^ 2
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : 4 * cos x ^ 3 = 2 * cos x * cos x * cos x + 2 * cos x * cos x ^ 2
⊢ cos x * (2 * (cos x * cos x)) - cos x - sin x * (2 * sin x * cos x) = 4 * cos x ^ 3 - 3 * cos x
[PROOFSTEP]
rw [h2, cos_sq']
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : 4 * cos x ^ 3 = 2 * cos x * cos x * cos x + 2 * cos x * cos x ^ 2
⊢ cos x * (2 * (cos x * cos x)) - cos x - sin x * (2 * sin x * cos x) =
    2 * cos x * cos x * cos x + 2 * cos x * (1 - sin x ^ 2) - 3 * cos x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ sin (3 * x) = 3 * sin x - 4 * sin x ^ 3
[PROOFSTEP]
have h1 : x + 2 * x = 3 * x := by ring
[GOAL]
x y : ℂ
⊢ x + 2 * x = 3 * x
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ sin (3 * x) = 3 * sin x - 4 * sin x ^ 3
[PROOFSTEP]
rw [← h1, sin_add x (2 * x)]
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ sin x * cos (2 * x) + cos x * sin (2 * x) = 3 * sin x - 4 * sin x ^ 3
[PROOFSTEP]
simp only [cos_two_mul, sin_two_mul, cos_sq']
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ sin x * (2 * (1 - sin x ^ 2) - 1) + cos x * (2 * sin x * cos x) = 3 * sin x - 4 * sin x ^ 3
[PROOFSTEP]
have h2 : cos x * (2 * sin x * cos x) = 2 * sin x * cos x ^ 2 := by ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
⊢ cos x * (2 * sin x * cos x) = 2 * sin x * cos x ^ 2
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : cos x * (2 * sin x * cos x) = 2 * sin x * cos x ^ 2
⊢ sin x * (2 * (1 - sin x ^ 2) - 1) + cos x * (2 * sin x * cos x) = 3 * sin x - 4 * sin x ^ 3
[PROOFSTEP]
rw [h2, cos_sq']
[GOAL]
x y : ℂ
h1 : x + 2 * x = 3 * x
h2 : cos x * (2 * sin x * cos x) = 2 * sin x * cos x ^ 2
⊢ sin x * (2 * (1 - sin x ^ 2) - 1) + 2 * sin x * (1 - sin x ^ 2) = 3 * sin x - 4 * sin x ^ 3
[PROOFSTEP]
ring
[GOAL]
x y : ℂ
⊢ exp (x + y * I) = exp x * (cos y + sin y * I)
[PROOFSTEP]
rw [exp_add, exp_mul_I]
[GOAL]
x y : ℂ
⊢ exp x = exp ↑x.re * (cos ↑x.im + sin ↑x.im * I)
[PROOFSTEP]
rw [← exp_add_mul_I, re_add_im]
[GOAL]
x y : ℂ
⊢ (exp x).re = Real.exp x.re * Real.cos x.im
[PROOFSTEP]
rw [exp_eq_exp_re_mul_sin_add_cos]
[GOAL]
x y : ℂ
⊢ (exp ↑x.re * (cos ↑x.im + sin ↑x.im * I)).re = Real.exp x.re * Real.cos x.im
[PROOFSTEP]
simp [exp_ofReal_re, cos_ofReal_re]
[GOAL]
x y : ℂ
⊢ (exp x).im = Real.exp x.re * Real.sin x.im
[PROOFSTEP]
rw [exp_eq_exp_re_mul_sin_add_cos]
[GOAL]
x y : ℂ
⊢ (exp ↑x.re * (cos ↑x.im + sin ↑x.im * I)).im = Real.exp x.re * Real.sin x.im
[PROOFSTEP]
simp [exp_ofReal_re, sin_ofReal_re]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (exp (↑x * I)).re = Real.cos x
[PROOFSTEP]
simp [exp_mul_I, cos_ofReal_re]
[GOAL]
x✝ y : ℂ
x : ℝ
⊢ (exp (↑x * I)).im = Real.sin x
[PROOFSTEP]
simp [exp_mul_I, sin_ofReal_re]
[GOAL]
x y : ℂ
n : ℕ
z : ℂ
⊢ (cos z + sin z * I) ^ n = cos (↑n * z) + sin (↑n * z) * I
[PROOFSTEP]
rw [← exp_mul_I, ← exp_mul_I]
[GOAL]
x y : ℂ
n : ℕ
z : ℂ
⊢ exp (z * I) ^ n = exp (↑n * z * I)
[PROOFSTEP]
induction' n with n ih
[GOAL]
case zero
x y z : ℂ
⊢ exp (z * I) ^ Nat.zero = exp (↑Nat.zero * z * I)
[PROOFSTEP]
rw [pow_zero, Nat.cast_zero, zero_mul, zero_mul, exp_zero]
[GOAL]
case succ
x y z : ℂ
n : ℕ
ih : exp (z * I) ^ n = exp (↑n * z * I)
⊢ exp (z * I) ^ Nat.succ n = exp (↑(Nat.succ n) * z * I)
[PROOFSTEP]
rw [pow_succ', ih, Nat.cast_succ, add_mul, add_mul, one_mul, exp_add]
[GOAL]
x y : ℝ
⊢ exp 0 = 1
[PROOFSTEP]
simp [Real.exp]
[GOAL]
x y : ℝ
⊢ exp (x + y) = exp x * exp y
[PROOFSTEP]
simp [exp_add, exp]
[GOAL]
x y : ℝ
⊢ (fun x => exp (↑Multiplicative.toAdd x)) 1 = 1
[PROOFSTEP]
simp
[GOAL]
x y : ℝ
⊢ ∀ (x y : Multiplicative ℝ),
    OneHom.toFun { toFun := fun x => exp (↑Multiplicative.toAdd x), map_one' := (_ : exp 0 = 1) } (x * y) =
      OneHom.toFun { toFun := fun x => exp (↑Multiplicative.toAdd x), map_one' := (_ : exp 0 = 1) } x *
        OneHom.toFun { toFun := fun x => exp (↑Multiplicative.toAdd x), map_one' := (_ : exp 0 = 1) } y
[PROOFSTEP]
simp [exp_add]
[GOAL]
x✝ y x : ℝ
n : ℕ
⊢ ↑(exp (↑n * x)) = ↑(exp x ^ n)
[PROOFSTEP]
simp [exp_nat_mul]
[GOAL]
x y : ℝ
h : exp x = 0
⊢ Complex.exp ↑x = 0
[PROOFSTEP]
rw [exp, ← ofReal_inj] at h 
[GOAL]
x y : ℝ
h : ↑(Complex.exp ↑x).re = ↑0
⊢ Complex.exp ↑x = 0
[PROOFSTEP]
simp_all
[GOAL]
x y : ℝ
⊢ ↑(exp (-x)) = ↑(exp x)⁻¹
[PROOFSTEP]
simp [exp_neg]
[GOAL]
x y : ℝ
⊢ exp (x - y) = exp x / exp y
[PROOFSTEP]
simp [sub_eq_add_neg, exp_add, exp_neg, div_eq_mul_inv]
[GOAL]
x y : ℝ
⊢ sin 0 = 0
[PROOFSTEP]
simp [sin]
[GOAL]
x y : ℝ
⊢ sin (-x) = -sin x
[PROOFSTEP]
simp [sin, exp_neg, (neg_div _ _).symm, add_mul]
[GOAL]
x y : ℝ
⊢ ↑(sin (x + y)) = ↑(sin x * cos y + cos x * sin y)
[PROOFSTEP]
simp [sin_add]
[GOAL]
x y : ℝ
⊢ cos 0 = 1
[PROOFSTEP]
simp [cos]
[GOAL]
x y : ℝ
⊢ cos (-x) = cos x
[PROOFSTEP]
simp [cos, exp_neg]
[GOAL]
x y : ℝ
⊢ cos (abs' x) = cos x
[PROOFSTEP]
cases le_total x 0
[GOAL]
case inl
x y : ℝ
h✝ : x ≤ 0
⊢ cos (abs' x) = cos x
[PROOFSTEP]
simp only [*, _root_.abs_of_nonneg, abs_of_nonpos, cos_neg]
[GOAL]
case inr
x y : ℝ
h✝ : 0 ≤ x
⊢ cos (abs' x) = cos x
[PROOFSTEP]
simp only [*, _root_.abs_of_nonneg, abs_of_nonpos, cos_neg]
[GOAL]
x y : ℝ
⊢ ↑(cos (x + y)) = ↑(cos x * cos y - sin x * sin y)
[PROOFSTEP]
simp [cos_add]
[GOAL]
x y : ℝ
⊢ sin (x - y) = sin x * cos y - cos x * sin y
[PROOFSTEP]
simp [sub_eq_add_neg, sin_add, sin_neg, cos_neg]
[GOAL]
x y : ℝ
⊢ cos (x - y) = cos x * cos y + sin x * sin y
[PROOFSTEP]
simp [sub_eq_add_neg, cos_add, sin_neg, cos_neg]
[GOAL]
x y : ℝ
⊢ ↑(sin x - sin y) = ↑(2 * sin ((x - y) / 2) * cos ((x + y) / 2))
[PROOFSTEP]
simp [sin_sub_sin]
[GOAL]
x y : ℝ
⊢ ↑(cos x - cos y) = ↑(-2 * sin ((x + y) / 2) * sin ((x - y) / 2))
[PROOFSTEP]
simp [cos_sub_cos]
[GOAL]
x y : ℝ
⊢ ↑(cos x + cos y) = ↑(2 * cos ((x + y) / 2) * cos ((x - y) / 2))
[PROOFSTEP]
simp [cos_add_cos]
[GOAL]
x y : ℝ
⊢ ↑(tan x) = ↑(sin x / cos x)
[PROOFSTEP]
simp [tan_eq_sin_div_cos]
[GOAL]
x✝ y x : ℝ
hx : cos x ≠ 0
⊢ tan x * cos x = sin x
[PROOFSTEP]
rw [tan_eq_sin_div_cos, div_mul_cancel _ hx]
[GOAL]
x y : ℝ
⊢ tan 0 = 0
[PROOFSTEP]
simp [tan]
[GOAL]
x y : ℝ
⊢ tan (-x) = -tan x
[PROOFSTEP]
simp [tan, neg_div]
[GOAL]
x y : ℝ
⊢ ↑(sin x ^ 2 + cos x ^ 2) = ↑1
[PROOFSTEP]
simp [sin_sq_add_cos_sq]
[GOAL]
x y : ℝ
⊢ cos x ^ 2 + sin x ^ 2 = 1
[PROOFSTEP]
rw [add_comm, sin_sq_add_cos_sq]
[GOAL]
x y : ℝ
⊢ sin x ^ 2 ≤ 1
[PROOFSTEP]
rw [← sin_sq_add_cos_sq x]
[GOAL]
x y : ℝ
⊢ sin x ^ 2 ≤ sin x ^ 2 + cos x ^ 2
[PROOFSTEP]
exact le_add_of_nonneg_right (sq_nonneg _)
[GOAL]
x y : ℝ
⊢ cos x ^ 2 ≤ 1
[PROOFSTEP]
rw [← sin_sq_add_cos_sq x]
[GOAL]
x y : ℝ
⊢ cos x ^ 2 ≤ sin x ^ 2 + cos x ^ 2
[PROOFSTEP]
exact le_add_of_nonneg_left (sq_nonneg _)
[GOAL]
x y : ℝ
⊢ sin x * sin x ≤ 1
[PROOFSTEP]
simp only [← sq, sin_sq_le_one]
[GOAL]
x y : ℝ
⊢ cos x * cos x ≤ 1
[PROOFSTEP]
simp only [← sq, cos_sq_le_one]
[GOAL]
x y : ℝ
⊢ ↑(cos (2 * x)) = ↑(2 * cos x ^ 2 - 1)
[PROOFSTEP]
simp [cos_two_mul]
[GOAL]
x y : ℝ
⊢ ↑(cos (2 * x)) = ↑(cos x ^ 2 - sin x ^ 2)
[PROOFSTEP]
simp [cos_two_mul']
[GOAL]
x y : ℝ
⊢ ↑(sin (2 * x)) = ↑(2 * sin x * cos x)
[PROOFSTEP]
simp [sin_two_mul]
[GOAL]
x y : ℝ
⊢ ↑(cos x ^ 2) = ↑(1 / 2 + cos (2 * x) / 2)
[PROOFSTEP]
simp [cos_sq]
[GOAL]
x y : ℝ
⊢ cos x ^ 2 = 1 - sin x ^ 2
[PROOFSTEP]
rw [← sin_sq_add_cos_sq x, add_sub_cancel']
[GOAL]
x✝ y x : ℝ
⊢ abs' (sin x) = sqrt (1 - cos x ^ 2)
[PROOFSTEP]
rw [← sin_sq, sqrt_sq_eq_abs]
[GOAL]
x✝ y x : ℝ
⊢ abs' (cos x) = sqrt (1 - sin x ^ 2)
[PROOFSTEP]
rw [← cos_sq', sqrt_sq_eq_abs]
[GOAL]
x✝ y x : ℝ
hx : cos x ≠ 0
this : Complex.cos ↑x ≠ 0
⊢ ↑(1 + tan x ^ 2)⁻¹ = ↑(cos x ^ 2)
[PROOFSTEP]
simpa using Complex.inv_one_add_tan_sq this
[GOAL]
x✝ y x : ℝ
hx : cos x ≠ 0
⊢ tan x ^ 2 / (1 + tan x ^ 2) = sin x ^ 2
[PROOFSTEP]
simp only [← tan_mul_cos hx, mul_pow, ← inv_one_add_tan_sq hx, div_eq_mul_inv, one_mul]
[GOAL]
x✝ y x : ℝ
hx : 0 < cos x
⊢ (sqrt (1 + tan x ^ 2))⁻¹ = cos x
[PROOFSTEP]
rw [← sqrt_sq hx.le, ← sqrt_inv, inv_one_add_tan_sq hx.ne']
[GOAL]
x✝ y x : ℝ
hx : 0 < cos x
⊢ tan x / sqrt (1 + tan x ^ 2) = sin x
[PROOFSTEP]
rw [← tan_mul_cos hx.ne', ← inv_sqrt_one_add_tan_sq hx, div_eq_mul_inv]
[GOAL]
x y : ℝ
⊢ cos (3 * x) = 4 * cos x ^ 3 - 3 * cos x
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(cos (3 * x)) = ↑(4 * cos x ^ 3 - 3 * cos x)
[PROOFSTEP]
simp [cos_three_mul]
[GOAL]
x y : ℝ
⊢ sin (3 * x) = 3 * sin x - 4 * sin x ^ 3
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(sin (3 * x)) = ↑(3 * sin x - 4 * sin x ^ 3)
[PROOFSTEP]
simp [sin_three_mul]
[GOAL]
x✝ y x : ℝ
⊢ ↑(sinh x) = ↑((exp x - exp (-x)) / 2)
[PROOFSTEP]
simp [Complex.sinh]
[GOAL]
x y : ℝ
⊢ sinh 0 = 0
[PROOFSTEP]
simp [sinh]
[GOAL]
x y : ℝ
⊢ sinh (-x) = -sinh x
[PROOFSTEP]
simp [sinh, exp_neg, (neg_div _ _).symm, add_mul]
[GOAL]
x y : ℝ
⊢ sinh (x + y) = sinh x * cosh y + cosh x * sinh y
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(sinh (x + y)) = ↑(sinh x * cosh y + cosh x * sinh y)
[PROOFSTEP]
simp [sinh_add]
[GOAL]
x✝ y x : ℝ
⊢ cosh x * 2 = exp x + exp (-x)
[PROOFSTEP]
rw [cosh, exp, exp, Complex.ofReal_neg, Complex.cosh, mul_two, ← Complex.add_re, ← mul_two,
  div_mul_cancel _ (two_ne_zero' ℂ), Complex.add_re]
[GOAL]
x y : ℝ
⊢ cosh 0 = 1
[PROOFSTEP]
simp [cosh]
[GOAL]
x y : ℝ
⊢ ↑(cosh (-x)) = ↑(cosh x)
[PROOFSTEP]
simp
[GOAL]
x y : ℝ
⊢ cosh (abs' x) = cosh x
[PROOFSTEP]
cases le_total x 0
[GOAL]
case inl
x y : ℝ
h✝ : x ≤ 0
⊢ cosh (abs' x) = cosh x
[PROOFSTEP]
simp [*, _root_.abs_of_nonneg, abs_of_nonpos]
[GOAL]
case inr
x y : ℝ
h✝ : 0 ≤ x
⊢ cosh (abs' x) = cosh x
[PROOFSTEP]
simp [*, _root_.abs_of_nonneg, abs_of_nonpos]
[GOAL]
x y : ℝ
⊢ cosh (x + y) = cosh x * cosh y + sinh x * sinh y
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(cosh (x + y)) = ↑(cosh x * cosh y + sinh x * sinh y)
[PROOFSTEP]
simp [cosh_add]
[GOAL]
x y : ℝ
⊢ sinh (x - y) = sinh x * cosh y - cosh x * sinh y
[PROOFSTEP]
simp [sub_eq_add_neg, sinh_add, sinh_neg, cosh_neg]
[GOAL]
x y : ℝ
⊢ cosh (x - y) = cosh x * cosh y - sinh x * sinh y
[PROOFSTEP]
simp [sub_eq_add_neg, cosh_add, sinh_neg, cosh_neg]
[GOAL]
x y : ℝ
⊢ ↑(tanh x) = ↑(sinh x / cosh x)
[PROOFSTEP]
simp [tanh_eq_sinh_div_cosh]
[GOAL]
x y : ℝ
⊢ tanh 0 = 0
[PROOFSTEP]
simp [tanh]
[GOAL]
x y : ℝ
⊢ tanh (-x) = -tanh x
[PROOFSTEP]
simp [tanh, neg_div]
[GOAL]
x y : ℝ
⊢ cosh x + sinh x = exp x
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(cosh x + sinh x) = ↑(exp x)
[PROOFSTEP]
simp
[GOAL]
x y : ℝ
⊢ sinh x + cosh x = exp x
[PROOFSTEP]
rw [add_comm, cosh_add_sinh]
[GOAL]
x y : ℝ
⊢ cosh x - sinh x = exp (-x)
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(cosh x - sinh x) = ↑(exp (-x))
[PROOFSTEP]
simp
[GOAL]
x y : ℝ
⊢ sinh x - cosh x = -exp (-x)
[PROOFSTEP]
rw [← neg_sub, cosh_sub_sinh]
[GOAL]
x✝ y x : ℝ
⊢ cosh x ^ 2 - sinh x ^ 2 = 1
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x✝ y x : ℝ
⊢ ↑(cosh x ^ 2 - sinh x ^ 2) = ↑1
[PROOFSTEP]
simp
[GOAL]
x y : ℝ
⊢ cosh x ^ 2 = sinh x ^ 2 + 1
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(cosh x ^ 2) = ↑(sinh x ^ 2 + 1)
[PROOFSTEP]
simp [cosh_sq]
[GOAL]
x y : ℝ
⊢ sinh x ^ 2 = cosh x ^ 2 - 1
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(sinh x ^ 2) = ↑(cosh x ^ 2 - 1)
[PROOFSTEP]
simp [sinh_sq]
[GOAL]
x y : ℝ
⊢ cosh (2 * x) = cosh x ^ 2 + sinh x ^ 2
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(cosh (2 * x)) = ↑(cosh x ^ 2 + sinh x ^ 2)
[PROOFSTEP]
simp [cosh_two_mul]
[GOAL]
x y : ℝ
⊢ sinh (2 * x) = 2 * sinh x * cosh x
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(sinh (2 * x)) = ↑(2 * sinh x * cosh x)
[PROOFSTEP]
simp [sinh_two_mul]
[GOAL]
x y : ℝ
⊢ cosh (3 * x) = 4 * cosh x ^ 3 - 3 * cosh x
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(cosh (3 * x)) = ↑(4 * cosh x ^ 3 - 3 * cosh x)
[PROOFSTEP]
simp [cosh_three_mul]
[GOAL]
x y : ℝ
⊢ sinh (3 * x) = 4 * sinh x ^ 3 + 3 * sinh x
[PROOFSTEP]
rw [← ofReal_inj]
[GOAL]
x y : ℝ
⊢ ↑(sinh (3 * x)) = ↑(4 * sinh x ^ 3 + 3 * sinh x)
[PROOFSTEP]
simp [sinh_three_mul]
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
n : ℕ
⊢ ∑ i in range n, x ^ i / ↑i ! ≤
    CauSeq.lim { val := fun n => (↑(exp' ↑x) n).re, property := (_ : IsCauSeq abs' fun n => (↑(exp' ↑x) n).re) }
[PROOFSTEP]
refine' le_lim (CauSeq.le_of_exists ⟨n, fun j hj => _⟩)
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
n j : ℕ
hj : j ≥ n
⊢ ↑(const abs' (∑ i in range n, x ^ i / ↑i !)) j ≤
    ↑{ val := fun n => (↑(exp' ↑x) n).re, property := (_ : IsCauSeq abs' fun n => (↑(exp' ↑x) n).re) } j
[PROOFSTEP]
simp only [exp', const_apply, re_sum]
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
n j : ℕ
hj : j ≥ n
⊢ ∑ i in range n, x ^ i / ↑i ! ≤ ∑ i in range j, (↑x ^ i / ↑i !).re
[PROOFSTEP]
norm_cast
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
n j : ℕ
hj : j ≥ n
⊢ ∑ i in range n, x ^ i / ↑i ! ≤ ∑ i in range j, x ^ i / ↑i !
[PROOFSTEP]
rw [← Nat.add_sub_of_le hj, Finset.sum_range_add]
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
n j : ℕ
hj : j ≥ n
⊢ ∑ i in range n, x ^ i / ↑i ! ≤
    ∑ x_1 in range n, x ^ x_1 / ↑x_1 ! + ∑ x_1 in range (j - n), x ^ (n + x_1) / ↑(n + x_1)!
[PROOFSTEP]
refine' le_add_of_nonneg_right (sum_nonneg fun i _ => _)
[GOAL]
x✝¹ y x : ℝ
hx : 0 ≤ x
n j : ℕ
hj : j ≥ n
i : ℕ
x✝ : i ∈ range (j - n)
⊢ 0 ≤ x ^ (n + i) / ↑(n + i)!
[PROOFSTEP]
positivity
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
n : ℕ
⊢ CauSeq.lim { val := fun n => (↑(exp' ↑x) n).re, property := (_ : IsCauSeq abs' fun n => (↑(exp' ↑x) n).re) } = exp x
[PROOFSTEP]
rw [exp, Complex.exp, ← cauSeqRe, lim_re]
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
⊢ 1 + x + x ^ 2 / 2 = ∑ i in range 3, x ^ i / ↑i !
[PROOFSTEP]
simp [Finset.sum_range_succ]
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
⊢ x ^ 2 / 2 = x ^ 2 / (1 + 1)
[PROOFSTEP]
ring_nf
[GOAL]
x✝ y x : ℝ
hx : 0 < x
⊢ x + 1 < 1 + x + x ^ 2 / 2
[PROOFSTEP]
nlinarith
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
⊢ x + 1 ≤ exp x
[PROOFSTEP]
rcases eq_or_lt_of_le hx with (rfl | h)
[GOAL]
case inl
x y : ℝ
hx : 0 ≤ 0
⊢ 0 + 1 ≤ exp 0
[PROOFSTEP]
simp
[GOAL]
case inr
x✝ y x : ℝ
hx : 0 ≤ x
h : 0 < x
⊢ x + 1 ≤ exp x
[PROOFSTEP]
exact (add_one_lt_exp_of_pos h).le
[GOAL]
x✝ y x : ℝ
hx : 0 ≤ x
⊢ 1 ≤ exp x
[PROOFSTEP]
linarith [add_one_le_exp_of_nonneg hx]
[GOAL]
x✝ y x : ℝ
h : x ≤ 0
⊢ 0 < exp x
[PROOFSTEP]
rw [← neg_neg x, Real.exp_neg]
[GOAL]
x✝ y x : ℝ
h : x ≤ 0
⊢ 0 < (exp (-x))⁻¹
[PROOFSTEP]
exact inv_pos.2 (lt_of_lt_of_le zero_lt_one (one_le_exp (neg_nonneg.2 h)))
[GOAL]
x✝ y✝ x y : ℝ
h : x < y
⊢ exp x < exp y
[PROOFSTEP]
rw [← sub_add_cancel y x, Real.exp_add]
[GOAL]
x✝ y✝ x y : ℝ
h : x < y
⊢ exp x < exp (y - x) * exp x
[PROOFSTEP]
exact (lt_mul_iff_one_lt_left (exp_pos _)).2 (lt_of_lt_of_le (by linarith) (add_one_le_exp_of_nonneg (by linarith)))
[GOAL]
x✝ y✝ x y : ℝ
h : x < y
⊢ 1 < y - x + 1
[PROOFSTEP]
linarith
[GOAL]
x✝ y✝ x y : ℝ
h : x < y
⊢ 0 ≤ y - x
[PROOFSTEP]
linarith
[GOAL]
x✝ y x : ℝ
⊢ 1 < exp x ↔ 0 < x
[PROOFSTEP]
rw [← exp_zero, exp_lt_exp]
[GOAL]
x✝ y x : ℝ
⊢ exp x < 1 ↔ x < 0
[PROOFSTEP]
rw [← exp_zero, exp_lt_exp]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
m : ℕ
hm : m ∈ filter (fun k => n ≤ k) (range j)
⊢ n ≤ m
[PROOFSTEP]
simp at hm 
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
m : ℕ
hm : m < j ∧ n ≤ m
⊢ n ≤ m
[PROOFSTEP]
tauto
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
m : ℕ
hm : m ∈ filter (fun k => n ≤ k) (range j)
⊢ m < j
[PROOFSTEP]
simp at hm 
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
m : ℕ
hm : m < j ∧ n ≤ m
⊢ m < j
[PROOFSTEP]
tauto
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
m : ℕ
hm : m ∈ filter (fun k => n ≤ k) (range j)
⊢ 1 / ↑(Nat.factorial m) = 1 / ↑(Nat.factorial ((fun m x => m - n) m hm + n))
[PROOFSTEP]
rw [tsub_add_cancel_of_le]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
m : ℕ
hm : m ∈ filter (fun k => n ≤ k) (range j)
⊢ n ≤ m
[PROOFSTEP]
simp at *
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
m : ℕ
hm : m < j ∧ n ≤ m
⊢ n ≤ m
[PROOFSTEP]
tauto
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
a₁ a₂ : ℕ
ha₁ : a₁ ∈ filter (fun k => n ≤ k) (range j)
ha₂ : a₂ ∈ filter (fun k => n ≤ k) (range j)
h : (fun m x => m - n) a₁ ha₁ = (fun m x => m - n) a₂ ha₂
⊢ a₁ = a₂
[PROOFSTEP]
rwa [tsub_eq_iff_eq_add_of_le, tsub_add_eq_add_tsub, eq_comm, tsub_eq_iff_eq_add_of_le, add_left_inj, eq_comm] at h 
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
a₁ a₂ : ℕ
ha₁ : a₁ ∈ filter (fun k => n ≤ k) (range j)
ha₂ : a₂ ∈ filter (fun k => n ≤ k) (range j)
h✝ : (fun m x => m - n) a₁ ha₁ = (fun m x => m - n) a₂ ha₂
h : a₂ + n - n = a₁
⊢ n ≤ a₂ + n
[PROOFSTEP]
simp at *
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
a₁ a₂ : ℕ
ha₁ : a₁ ∈ filter (fun k => n ≤ k) (range j)
ha₂ : a₂ ∈ filter (fun k => n ≤ k) (range j)
h✝ : (fun m x => m - n) a₁ ha₁ = (fun m x => m - n) a₂ ha₂
h : a₁ = (fun m x => m - n) a₂ ha₂ + n
⊢ n ≤ a₂
[PROOFSTEP]
simp at *
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
a₁ a₂ : ℕ
ha₁ : a₁ ∈ filter (fun k => n ≤ k) (range j)
ha₂ : a₂ ∈ filter (fun k => n ≤ k) (range j)
h : (fun m x => m - n) a₁ ha₁ = (fun m x => m - n) a₂ ha₂
⊢ n ≤ a₁
[PROOFSTEP]
simp at *
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
a₁ a₂ : ℕ
ha₁ : a₁ ∈ filter (fun k => n ≤ k) (range j)
ha₂ : a₂ ∈ filter (fun k => n ≤ k) (range j)
h✝ : a₁ - n = a₂ - n
h : a₁ = a₂ - n + n
⊢ n ≤ a₂
[PROOFSTEP]
aesop
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
a₁ a₂ : ℕ
ha₁ : a₁ ∈ filter (fun k => n ≤ k) (range j)
ha₂ : a₂ ∈ filter (fun k => n ≤ k) (range j)
h : a₁ - n = a₂ - n
⊢ n ≤ a₁
[PROOFSTEP]
aesop
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
b : ℕ
hb : b ∈ range (j - n)
⊢ b = (fun m x => m - n) (b + n) (_ : b + n ∈ filter (fun k => n ≤ k) (range j))
[PROOFSTEP]
dsimp
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
b : ℕ
hb : b ∈ range (j - n)
⊢ b = b + n - n
[PROOFSTEP]
rw [add_tsub_cancel_right]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
⊢ ∑ m in range (j - n), 1 / ↑(Nat.factorial (m + n)) ≤ ∑ m in range (j - n), (↑(Nat.factorial n) * ↑(Nat.succ n) ^ m)⁻¹
[PROOFSTEP]
simp_rw [one_div]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
⊢ ∑ x in range (j - n), (↑(Nat.factorial (x + n)))⁻¹ ≤ ∑ m in range (j - n), (↑(Nat.factorial n) * ↑(Nat.succ n) ^ m)⁻¹
[PROOFSTEP]
gcongr
[GOAL]
case h.h
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
i✝ : ℕ
a✝ : i✝ ∈ range (j - n)
⊢ ↑(Nat.factorial n) * ↑(Nat.succ n) ^ i✝ ≤ ↑(Nat.factorial (i✝ + n))
[PROOFSTEP]
rw [← Nat.cast_pow, ← Nat.cast_mul, Nat.cast_le, add_comm]
[GOAL]
case h.h
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
i✝ : ℕ
a✝ : i✝ ∈ range (j - n)
⊢ Nat.factorial n * Nat.succ n ^ i✝ ≤ Nat.factorial (n + i✝)
[PROOFSTEP]
exact Nat.factorial_mul_pow_le_factorial
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
⊢ ∑ m in range (j - n), (↑(Nat.factorial n) * ↑(Nat.succ n) ^ m)⁻¹ =
    (↑(Nat.factorial n))⁻¹ * ∑ m in range (j - n), (↑(Nat.succ n))⁻¹ ^ m
[PROOFSTEP]
simp [mul_inv, mul_sum.symm, sum_mul.symm, -Nat.factorial_succ, mul_comm, inv_pow]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
⊢ (↑(Nat.factorial n))⁻¹ * ∑ m in range (j - n), (↑(Nat.succ n))⁻¹ ^ m =
    (↑(Nat.succ n) - ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n)) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h₁ : (n.succ : α) ≠ 1 := @Nat.cast_one α _ ▸ mt Nat.cast_inj.1 (mt Nat.succ.inj (pos_iff_ne_zero.1 hn))
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
h₁ : ↑(Nat.succ n) ≠ 1
⊢ (↑(Nat.factorial n))⁻¹ * ∑ m in range (j - n), (↑(Nat.succ n))⁻¹ ^ m =
    (↑(Nat.succ n) - ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n)) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h₂ : (n.succ : α) ≠ 0 := by positivity
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
h₁ : ↑(Nat.succ n) ≠ 1
⊢ ↑(Nat.succ n) ≠ 0
[PROOFSTEP]
positivity
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
h₁ : ↑(Nat.succ n) ≠ 1
h₂ : ↑(Nat.succ n) ≠ 0
⊢ (↑(Nat.factorial n))⁻¹ * ∑ m in range (j - n), (↑(Nat.succ n))⁻¹ ^ m =
    (↑(Nat.succ n) - ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n)) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h₃ : (n.factorial * n : α) ≠ 0 := by positivity
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
h₁ : ↑(Nat.succ n) ≠ 1
h₂ : ↑(Nat.succ n) ≠ 0
⊢ ↑(Nat.factorial n) * ↑n ≠ 0
[PROOFSTEP]
positivity
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
h₁ : ↑(Nat.succ n) ≠ 1
h₂ : ↑(Nat.succ n) ≠ 0
h₃ : ↑(Nat.factorial n) * ↑n ≠ 0
⊢ (↑(Nat.factorial n))⁻¹ * ∑ m in range (j - n), (↑(Nat.succ n))⁻¹ ^ m =
    (↑(Nat.succ n) - ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n)) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h₄ : (n.succ - 1 : α) = n := by simp
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
h₁ : ↑(Nat.succ n) ≠ 1
h₂ : ↑(Nat.succ n) ≠ 0
h₃ : ↑(Nat.factorial n) * ↑n ≠ 0
⊢ ↑(Nat.succ n) - 1 = ↑n
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
h₁ : ↑(Nat.succ n) ≠ 1
h₂ : ↑(Nat.succ n) ≠ 0
h₃ : ↑(Nat.factorial n) * ↑n ≠ 0
h₄ : ↑(Nat.succ n) - 1 = ↑n
⊢ (↑(Nat.factorial n))⁻¹ * ∑ m in range (j - n), (↑(Nat.succ n))⁻¹ ^ m =
    (↑(Nat.succ n) - ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n)) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
rw [geom_sum_inv h₁ h₂, eq_div_iff_mul_eq h₃, mul_comm _ (n.factorial * n : α), ← mul_assoc (n.factorial⁻¹ : α), ←
  mul_inv_rev, h₄, ← mul_assoc (n.factorial * n : α), mul_comm (n : α) n.factorial, mul_inv_cancel h₃, one_mul,
  mul_comm]
[GOAL]
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
⊢ (↑(Nat.succ n) - ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n)) / (↑(Nat.factorial n) * ↑n) ≤
    ↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
gcongr
[GOAL]
case h
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
⊢ ↑(Nat.succ n) - ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n) ≤ ↑(Nat.succ n)
[PROOFSTEP]
apply sub_le_self
[GOAL]
case h.a
α : Type u_1
inst✝ : LinearOrderedField α
n j : ℕ
hn : 0 < n
⊢ 0 ≤ ↑(Nat.succ n) * (↑(Nat.succ n))⁻¹ ^ (j - n)
[PROOFSTEP]
positivity
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
⊢ ↑abs (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ ↑abs x ^ n * (↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹)
[PROOFSTEP]
rw [← lim_const (abv := Complex.abs) (∑ m in range n, _), exp, sub_eq_add_neg, ← lim_neg, lim_add, ← lim_abs]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
⊢ CauSeq.lim (cauSeqAbs (exp' x + -const (↑abs) (∑ m in range n, x ^ m / ↑(Nat.factorial m)))) ≤
    ↑abs x ^ n * (↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹)
[PROOFSTEP]
refine' lim_le (CauSeq.le_of_exists ⟨n, fun j hj => _⟩)
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ↑(cauSeqAbs (exp' x + -const (↑abs) (∑ m in range n, x ^ m / ↑(Nat.factorial m)))) j ≤
    ↑(const abs' (↑abs x ^ n * (↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹))) j
[PROOFSTEP]
simp_rw [← sub_eq_add_neg]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ↑(cauSeqAbs (exp' x - const (↑abs) (∑ m in range n, x ^ m / ↑(Nat.factorial m)))) j ≤
    ↑(const abs' (↑abs x ^ n * (↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹))) j
[PROOFSTEP]
show
  abs ((∑ m in range j, x ^ m / m.factorial) - ∑ m in range n, x ^ m / m.factorial) ≤
    abs x ^ n * ((n.succ : ℝ) * (n.factorial * n : ℝ)⁻¹)
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ↑abs (∑ m in range j, x ^ m / ↑(Nat.factorial m) - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤
    ↑abs x ^ n * (↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹)
[PROOFSTEP]
rw [sum_range_sub_sum_range hj]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ↑abs (∑ k in filter (fun k => n ≤ k) (range j), x ^ k / ↑(Nat.factorial k)) ≤
    ↑abs x ^ n * (↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹)
[PROOFSTEP]
calc
  abs (∑ m in (range j).filter fun k => n ≤ k, (x ^ m / m.factorial : ℂ)) =
      abs (∑ m in (range j).filter fun k => n ≤ k, (x ^ n * (x ^ (m - n) / m.factorial) : ℂ)) :=
    by
    refine' congr_arg abs (sum_congr rfl fun m hm => _)
    rw [mem_filter, mem_range] at hm 
    rw [← mul_div_assoc, ← pow_add, add_tsub_cancel_of_le hm.2]
  _ ≤ ∑ m in filter (fun k => n ≤ k) (range j), abs (x ^ n * (x ^ (m - n) / m.factorial)) :=
    (abv_sum_le_sum_abv (abv := Complex.abs) _ _)
  _ ≤ ∑ m in filter (fun k => n ≤ k) (range j), abs x ^ n * (1 / m.factorial) :=
    by
    simp_rw [map_mul, map_pow, map_div₀, abs_cast_nat]
    gcongr
    · rw [abv_pow abs]
      exact pow_le_one _ (abs.nonneg _) hx
  _ = abs x ^ n * ∑ m in (range j).filter fun k => n ≤ k, (1 / m.factorial : ℝ) := by
    simp [abs_mul, abv_pow abs, abs_div, mul_sum.symm]
  _ ≤ abs x ^ n * (n.succ * (n.factorial * n : ℝ)⁻¹) := by
    gcongr
    exact sum_div_factorial_le _ _ hn
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ↑abs (∑ m in filter (fun k => n ≤ k) (range j), x ^ m / ↑(Nat.factorial m)) =
    ↑abs (∑ m in filter (fun k => n ≤ k) (range j), x ^ n * (x ^ (m - n) / ↑(Nat.factorial m)))
[PROOFSTEP]
refine' congr_arg abs (sum_congr rfl fun m hm => _)
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
m : ℕ
hm : m ∈ filter (fun k => n ≤ k) (range j)
⊢ x ^ m / ↑(Nat.factorial m) = x ^ n * (x ^ (m - n) / ↑(Nat.factorial m))
[PROOFSTEP]
rw [mem_filter, mem_range] at hm 
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
m : ℕ
hm : m < j ∧ n ≤ m
⊢ x ^ m / ↑(Nat.factorial m) = x ^ n * (x ^ (m - n) / ↑(Nat.factorial m))
[PROOFSTEP]
rw [← mul_div_assoc, ← pow_add, add_tsub_cancel_of_le hm.2]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ∑ m in filter (fun k => n ≤ k) (range j), ↑abs (x ^ n * (x ^ (m - n) / ↑(Nat.factorial m))) ≤
    ∑ m in filter (fun k => n ≤ k) (range j), ↑abs x ^ n * (1 / ↑(Nat.factorial m))
[PROOFSTEP]
simp_rw [map_mul, map_pow, map_div₀, abs_cast_nat]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ∑ x_1 in filter (fun k => n ≤ k) (range j), ↑abs x ^ n * (↑abs (x ^ (x_1 - n)) / ↑(Nat.factorial x_1)) ≤
    ∑ x_1 in filter (fun k => n ≤ k) (range j), ↑abs x ^ n * (1 / ↑(Nat.factorial x_1))
[PROOFSTEP]
gcongr
[GOAL]
case h.h.h
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => n ≤ k) (range j)
⊢ ↑abs (x ^ (i✝ - n)) ≤ 1
[PROOFSTEP]
rw [abv_pow abs]
[GOAL]
case h.h.h
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
i✝ : ℕ
a✝ : i✝ ∈ filter (fun k => n ≤ k) (range j)
⊢ ↑abs x ^ (i✝ - n) ≤ 1
[PROOFSTEP]
exact pow_le_one _ (abs.nonneg _) hx
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ∑ m in filter (fun k => n ≤ k) (range j), ↑abs x ^ n * (1 / ↑(Nat.factorial m)) =
    ↑abs x ^ n * ∑ m in filter (fun k => n ≤ k) (range j), 1 / ↑(Nat.factorial m)
[PROOFSTEP]
simp [abs_mul, abv_pow abs, abs_div, mul_sum.symm]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ↑abs x ^ n * ∑ m in filter (fun k => n ≤ k) (range j), 1 / ↑(Nat.factorial m) ≤
    ↑abs x ^ n * (↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹)
[PROOFSTEP]
gcongr
[GOAL]
case h
x : ℂ
hx : ↑abs x ≤ 1
n : ℕ
hn : 0 < n
j : ℕ
hj : j ≥ n
⊢ ∑ m in filter (fun k => n ≤ k) (range j), 1 / ↑(Nat.factorial m) ≤ ↑(Nat.succ n) * (↑(Nat.factorial n) * ↑n)⁻¹
[PROOFSTEP]
exact sum_div_factorial_le _ _ hn
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
⊢ ↑abs (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
rw [← lim_const (abv := Complex.abs) (∑ m in range n, _), exp, sub_eq_add_neg, ← lim_neg, lim_add, ← lim_abs]
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
⊢ CauSeq.lim (cauSeqAbs (exp' x + -const (↑abs) (∑ m in range n, x ^ m / ↑(Nat.factorial m)))) ≤
    ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
refine' lim_le (CauSeq.le_of_exists ⟨n, fun j hj => _⟩)
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj : j ≥ n
⊢ ↑(cauSeqAbs (exp' x + -const (↑abs) (∑ m in range n, x ^ m / ↑(Nat.factorial m)))) j ≤
    ↑(const abs' (↑abs x ^ n / ↑(Nat.factorial n) * 2)) j
[PROOFSTEP]
simp_rw [← sub_eq_add_neg]
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj : j ≥ n
⊢ ↑(cauSeqAbs (exp' x - const (↑abs) (∑ m in range n, x ^ m / ↑(Nat.factorial m)))) j ≤
    ↑(const abs' (↑abs x ^ n / ↑(Nat.factorial n) * 2)) j
[PROOFSTEP]
show abs ((∑ m in range j, x ^ m / m.factorial) - ∑ m in range n, x ^ m / m.factorial) ≤ abs x ^ n / n.factorial * 2
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj : j ≥ n
⊢ ↑abs (∑ m in range j, x ^ m / ↑(Nat.factorial m) - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤
    ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
let k := j - n
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj : j ≥ n
k : ℕ := j - n
⊢ ↑abs (∑ m in range j, x ^ m / ↑(Nat.factorial m) - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤
    ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
have hj : j = n + k := (add_tsub_cancel_of_le hj).symm
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ↑abs (∑ m in range j, x ^ m / ↑(Nat.factorial m) - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤
    ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
rw [hj, sum_range_add_sub_sum_range]
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ↑abs (∑ k in range k, x ^ (n + k) / ↑(Nat.factorial (n + k))) ≤ ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
calc
  abs (∑ i : ℕ in range k, x ^ (n + i) / ((n + i).factorial : ℂ)) ≤
      ∑ i : ℕ in range k, abs (x ^ (n + i) / ((n + i).factorial : ℂ)) :=
    abv_sum_le_sum_abv _ _
  _ ≤ ∑ i : ℕ in range k, abs x ^ (n + i) / (n + i).factorial := by simp [Complex.abs_cast_nat, map_div₀, abv_pow abs]
  _ ≤ ∑ i : ℕ in range k, abs x ^ (n + i) / ((n.factorial : ℝ) * (n.succ : ℝ) ^ i) := ?_
  _ = ∑ i : ℕ in range k, abs x ^ n / n.factorial * (abs x ^ i / (n.succ : ℝ) ^ i) := ?_
  _ ≤ abs x ^ n / ↑n.factorial * 2 := ?_
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ∑ i in range k, ↑abs (x ^ (n + i) / ↑(Nat.factorial (n + i))) ≤
    ∑ i in range k, ↑abs x ^ (n + i) / ↑(Nat.factorial (n + i))
[PROOFSTEP]
simp [Complex.abs_cast_nat, map_div₀, abv_pow abs]
[GOAL]
case calc_1
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ∑ i in range k, ↑abs x ^ (n + i) / ↑(Nat.factorial (n + i)) ≤
    ∑ i in range k, ↑abs x ^ (n + i) / (↑(Nat.factorial n) * ↑(Nat.succ n) ^ i)
[PROOFSTEP]
gcongr
[GOAL]
case calc_1.h.h
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
i✝ : ℕ
a✝ : i✝ ∈ range k
⊢ ↑(Nat.factorial n) * ↑(Nat.succ n) ^ i✝ ≤ ↑(Nat.factorial (n + i✝))
[PROOFSTEP]
exact_mod_cast Nat.factorial_mul_pow_le_factorial
[GOAL]
case calc_2
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ∑ i in range k, ↑abs x ^ (n + i) / (↑(Nat.factorial n) * ↑(Nat.succ n) ^ i) =
    ∑ i in range k, ↑abs x ^ n / ↑(Nat.factorial n) * (↑abs x ^ i / ↑(Nat.succ n) ^ i)
[PROOFSTEP]
refine' Finset.sum_congr rfl fun _ _ => _
[GOAL]
case calc_2
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
x✝¹ : ℕ
x✝ : x✝¹ ∈ range k
⊢ ↑abs x ^ (n + x✝¹) / (↑(Nat.factorial n) * ↑(Nat.succ n) ^ x✝¹) =
    ↑abs x ^ n / ↑(Nat.factorial n) * (↑abs x ^ x✝¹ / ↑(Nat.succ n) ^ x✝¹)
[PROOFSTEP]
simp only [pow_add, div_eq_inv_mul, mul_inv, mul_left_comm, mul_assoc]
[GOAL]
case calc_3
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ∑ i in range k, ↑abs x ^ n / ↑(Nat.factorial n) * (↑abs x ^ i / ↑(Nat.succ n) ^ i) ≤
    ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
rw [← mul_sum]
[GOAL]
case calc_3
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ↑abs x ^ n / ↑(Nat.factorial n) * ∑ x_1 in range k, ↑abs x ^ x_1 / ↑(Nat.succ n) ^ x_1 ≤
    ↑abs x ^ n / ↑(Nat.factorial n) * 2
[PROOFSTEP]
gcongr
[GOAL]
case calc_3.h
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ∑ x_1 in range k, ↑abs x ^ x_1 / ↑(Nat.succ n) ^ x_1 ≤ 2
[PROOFSTEP]
simp_rw [← div_pow]
[GOAL]
case calc_3.h
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ∑ x_1 in range (j - n), (↑abs x / ↑(Nat.succ n)) ^ x_1 ≤ 2
[PROOFSTEP]
rw [geom_sum_eq, div_le_iff_of_neg]
[GOAL]
case calc_3.h
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ 2 * (↑abs x / ↑(Nat.succ n) - 1) ≤ (↑abs x / ↑(Nat.succ n)) ^ (j - n) - 1
[PROOFSTEP]
trans (-1 : ℝ)
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ 2 * (↑abs x / ↑(Nat.succ n) - 1) ≤ -1
[PROOFSTEP]
linarith
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ -1 ≤ (↑abs x / ↑(Nat.succ n)) ^ (j - n) - 1
[PROOFSTEP]
simp only [neg_le_sub_iff_le_add, div_pow, Nat.cast_succ, le_add_iff_nonneg_left]
[GOAL]
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ 0 ≤ ↑abs x ^ (j - n) / (↑n + 1) ^ (j - n)
[PROOFSTEP]
positivity
[GOAL]
case calc_3.h
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ↑abs x / ↑(Nat.succ n) - 1 < 0
[PROOFSTEP]
linarith
[GOAL]
case calc_3.h.h
x : ℂ
n : ℕ
hx : ↑abs x / ↑(Nat.succ n) ≤ 1 / 2
j : ℕ
hj✝ : j ≥ n
k : ℕ := j - n
hj : j = n + k
⊢ ↑abs x / ↑(Nat.succ n) ≠ 1
[PROOFSTEP]
linarith
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
⊢ ↑abs (exp x - 1) = ↑abs (exp x - ∑ m in range 1, x ^ m / ↑(Nat.factorial m))
[PROOFSTEP]
simp [sum_range_succ]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
⊢ 0 < 1
[PROOFSTEP]
decide
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
⊢ ↑abs x ^ 1 * (↑(Nat.succ 1) * (↑(Nat.factorial 1) * ↑1)⁻¹) = 2 * ↑abs x
[PROOFSTEP]
simp [two_mul, mul_two, mul_add, mul_comm, add_mul]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
⊢ ↑abs (exp x - 1 - x) = ↑abs (exp x - ∑ m in range 2, x ^ m / ↑(Nat.factorial m))
[PROOFSTEP]
simp [sub_eq_add_neg, sum_range_succ_comm, add_assoc]
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
⊢ 0 < 2
[PROOFSTEP]
decide
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
⊢ ↑abs x ^ 2 * (↑(Nat.succ 2) * (↑(Nat.factorial 2) * ↑2)⁻¹) ≤ ↑abs x ^ 2 * 1
[PROOFSTEP]
gcongr
[GOAL]
case h
x : ℂ
hx : ↑abs x ≤ 1
⊢ ↑(Nat.succ 2) * (↑(Nat.factorial 2) * ↑2)⁻¹ ≤ 1
[PROOFSTEP]
norm_num
[GOAL]
x : ℂ
hx : ↑abs x ≤ 1
⊢ ↑abs x ^ 2 * 1 = ↑abs x ^ 2
[PROOFSTEP]
rw [mul_one]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
n : ℕ
hn : 0 < n
⊢ abs' (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ abs' x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
[PROOFSTEP]
have hxc : Complex.abs x ≤ 1 := by exact_mod_cast hx
[GOAL]
x : ℝ
hx : abs' x ≤ 1
n : ℕ
hn : 0 < n
⊢ ↑Complex.abs ↑x ≤ 1
[PROOFSTEP]
exact_mod_cast hx
[GOAL]
x : ℝ
hx : abs' x ≤ 1
n : ℕ
hn : 0 < n
hxc : ↑Complex.abs ↑x ≤ 1
⊢ abs' (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ abs' x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
[PROOFSTEP]
convert exp_bound hxc hn using 2
[GOAL]
case h.e'_3
x : ℝ
hx : abs' x ≤ 1
n : ℕ
hn : 0 < n
hxc : ↑Complex.abs ↑x ≤ 1
⊢ abs' (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) =
    ↑Complex.abs (Complex.exp ↑x - ∑ m in range n, ↑x ^ m / ↑(Nat.factorial m))
[PROOFSTEP]
simp only [← abs_ofReal, ← ofReal_sub, ← ofReal_exp, ← ofReal_sum, ← ofReal_pow, ← ofReal_div, ← ofReal_nat_cast]
[GOAL]
case h.e'_4.h.e'_5
x : ℝ
hx : abs' x ≤ 1
n : ℕ
hn : 0 < n
hxc : ↑Complex.abs ↑x ≤ 1
⊢ abs' x ^ n = ↑Complex.abs ↑x ^ n
[PROOFSTEP]
simp only [← abs_ofReal, ← ofReal_sub, ← ofReal_exp, ← ofReal_sum, ← ofReal_pow, ← ofReal_div, ← ofReal_nat_cast]
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
⊢ exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑n + 1) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h3 : |x| = x := by simpa
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
⊢ abs' x = x
[PROOFSTEP]
simpa
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
h3 : abs' x = x
⊢ exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑n + 1) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h4 : |x| ≤ 1 := by rwa [h3]
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
h3 : abs' x = x
⊢ abs' x ≤ 1
[PROOFSTEP]
rwa [h3]
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
h3 : abs' x = x
h4 : abs' x ≤ 1
⊢ exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑n + 1) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h' := Real.exp_bound h4 hn
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
h3 : abs' x = x
h4 : abs' x ≤ 1
h' :
  abs' (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ abs' x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
⊢ exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑n + 1) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
rw [h3] at h' 
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
h3 : abs' x = x
h4 : abs' x ≤ 1
h' : abs' (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
⊢ exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑n + 1) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have h'' := (abs_sub_le_iff.1 h').1
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
h3 : abs' x = x
h4 : abs' x ≤ 1
h' : abs' (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
h'' : exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m) ≤ x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
⊢ exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑n + 1) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
have t := sub_le_iff_le_add'.1 h''
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x ≤ 1
n : ℕ
hn : 0 < n
h3 : abs' x = x
h4 : abs' x ≤ 1
h' : abs' (exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m)) ≤ x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
h'' : exp x - ∑ m in range n, x ^ m / ↑(Nat.factorial m) ≤ x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
t : exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑(Nat.succ n) / (↑(Nat.factorial n) * ↑n))
⊢ exp x ≤ ∑ m in range n, x ^ m / ↑(Nat.factorial m) + x ^ n * (↑n + 1) / (↑(Nat.factorial n) * ↑n)
[PROOFSTEP]
simpa [mul_div_assoc] using t
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ abs' (exp x - 1) ≤ 2 * abs' x
[PROOFSTEP]
have : abs' x ≤ 1 := by exact_mod_cast hx
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ abs' x ≤ 1
[PROOFSTEP]
exact_mod_cast hx
[GOAL]
x : ℝ
hx this : abs' x ≤ 1
⊢ abs' (exp x - 1) ≤ 2 * abs' x
[PROOFSTEP]
have := Complex.abs_exp_sub_one_le (x := x) (by simpa using this)
[GOAL]
x : ℝ
hx this : abs' x ≤ 1
⊢ ↑Complex.abs ↑x ≤ 1
[PROOFSTEP]
simpa using this
[GOAL]
x : ℝ
hx this✝ : abs' x ≤ 1
this : ↑Complex.abs (Complex.exp ↑x - 1) ≤ 2 * ↑Complex.abs ↑x
⊢ abs' (exp x - 1) ≤ 2 * abs' x
[PROOFSTEP]
rw [← ofReal_exp, ← ofReal_one, ← ofReal_sub, abs_ofReal, abs_ofReal] at this 
[GOAL]
x : ℝ
hx this✝ : abs' x ≤ 1
this : abs' (exp x - 1) ≤ 2 * abs' x
⊢ abs' (exp x - 1) ≤ 2 * abs' x
[PROOFSTEP]
exact this
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ abs' (exp x - 1 - x) ≤ x ^ 2
[PROOFSTEP]
rw [← _root_.sq_abs]
  --Porting note: was
    --exact_mod_cast Complex.abs_exp_sub_one_sub_id_le this
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ abs' (exp x - 1 - x) ≤ abs' x ^ 2
[PROOFSTEP]
have : Complex.abs x ≤ 1 := by exact_mod_cast hx
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs ↑x ≤ 1
[PROOFSTEP]
exact_mod_cast hx
[GOAL]
x : ℝ
hx : abs' x ≤ 1
this : ↑Complex.abs ↑x ≤ 1
⊢ abs' (exp x - 1 - x) ≤ abs' x ^ 2
[PROOFSTEP]
have := Complex.abs_exp_sub_one_sub_id_le this
[GOAL]
x : ℝ
hx : abs' x ≤ 1
this✝ : ↑Complex.abs ↑x ≤ 1
this : ↑Complex.abs (Complex.exp ↑x - 1 - ↑x) ≤ ↑Complex.abs ↑x ^ 2
⊢ abs' (exp x - 1 - x) ≤ abs' x ^ 2
[PROOFSTEP]
rw [← ofReal_one, ← ofReal_exp, ← ofReal_sub, ← ofReal_sub, abs_ofReal, abs_ofReal] at this 
[GOAL]
x : ℝ
hx : abs' x ≤ 1
this✝ : ↑Complex.abs ↑x ≤ 1
this : abs' (exp x - 1 - x) ≤ abs' x ^ 2
⊢ abs' (exp x - 1 - x) ≤ abs' x ^ 2
[PROOFSTEP]
exact this
[GOAL]
x r : ℝ
⊢ expNear 0 x r = r
[PROOFSTEP]
simp [expNear]
[GOAL]
n : ℕ
x r : ℝ
⊢ expNear (n + 1) x r = expNear n x (1 + x / (↑n + 1) * r)
[PROOFSTEP]
simp [expNear, range_succ, mul_add, add_left_comm, add_assoc, pow_succ, div_eq_mul_inv, mul_inv]
[GOAL]
n : ℕ
x r : ℝ
⊢ x * x ^ n * ((↑(Nat.factorial n))⁻¹ * (↑n + 1)⁻¹) * r = x ^ n * (↑(Nat.factorial n))⁻¹ * (x * (↑n + 1)⁻¹ * r)
[PROOFSTEP]
ac_rfl
[GOAL]
n : ℕ
x r₁ r₂ : ℝ
⊢ expNear n x r₁ - expNear n x r₂ = x ^ n / ↑(Nat.factorial n) * (r₁ - r₂)
[PROOFSTEP]
simp [expNear, mul_sub]
[GOAL]
n m : ℕ
x : ℝ
e₁ : n + 1 = m
h : abs' x ≤ 1
⊢ abs' (exp x - expNear m x 0) ≤ abs' x ^ m / ↑(Nat.factorial m) * ((↑m + 1) / ↑m)
[PROOFSTEP]
simp [expNear]
[GOAL]
n m : ℕ
x : ℝ
e₁ : n + 1 = m
h : abs' x ≤ 1
⊢ abs' (exp x - ∑ m in range m, x ^ m / ↑(Nat.factorial m)) ≤ abs' x ^ m / ↑(Nat.factorial m) * ((↑m + 1) / ↑m)
[PROOFSTEP]
convert exp_bound (n := m) h ?_ using 1
[GOAL]
case h.e'_4
n m : ℕ
x : ℝ
e₁ : n + 1 = m
h : abs' x ≤ 1
⊢ abs' x ^ m / ↑(Nat.factorial m) * ((↑m + 1) / ↑m) = abs' x ^ m * (↑(Nat.succ m) / (↑(Nat.factorial m) * ↑m))
n m : ℕ x : ℝ e₁ : n + 1 = m h : abs' x ≤ 1 ⊢ 0 < m
[PROOFSTEP]
field_simp [mul_comm]
[GOAL]
n m : ℕ
x : ℝ
e₁ : n + 1 = m
h : abs' x ≤ 1
⊢ 0 < m
[PROOFSTEP]
linarith
[GOAL]
n : ℕ
x a₁ b₁ : ℝ
m : ℕ
e₁ : n + 1 = m
a₂ b₂ : ℝ
e : abs' (1 + x / ↑m * a₂ - a₁) ≤ b₁ - abs' x / ↑m * b₂
h : abs' (exp x - expNear m x a₂) ≤ abs' x ^ m / ↑(Nat.factorial m) * b₂
⊢ abs' (exp x - expNear n x a₁) ≤ abs' x ^ n / ↑(Nat.factorial n) * b₁
[PROOFSTEP]
refine' (abs_sub_le _ _ _).trans ((add_le_add_right h _).trans _)
[GOAL]
n : ℕ
x a₁ b₁ : ℝ
m : ℕ
e₁ : n + 1 = m
a₂ b₂ : ℝ
e : abs' (1 + x / ↑m * a₂ - a₁) ≤ b₁ - abs' x / ↑m * b₂
h : abs' (exp x - expNear m x a₂) ≤ abs' x ^ m / ↑(Nat.factorial m) * b₂
⊢ abs' x ^ m / ↑(Nat.factorial m) * b₂ + abs' (expNear m x a₂ - expNear n x a₁) ≤ abs' x ^ n / ↑(Nat.factorial n) * b₁
[PROOFSTEP]
subst e₁
[GOAL]
n : ℕ
x a₁ b₁ a₂ b₂ : ℝ
e : abs' (1 + x / ↑(n + 1) * a₂ - a₁) ≤ b₁ - abs' x / ↑(n + 1) * b₂
h : abs' (exp x - expNear (n + 1) x a₂) ≤ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂
⊢ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂ + abs' (expNear (n + 1) x a₂ - expNear n x a₁) ≤
    abs' x ^ n / ↑(Nat.factorial n) * b₁
[PROOFSTEP]
rw [expNear_succ, expNear_sub, abs_mul]
[GOAL]
n : ℕ
x a₁ b₁ a₂ b₂ : ℝ
e : abs' (1 + x / ↑(n + 1) * a₂ - a₁) ≤ b₁ - abs' x / ↑(n + 1) * b₂
h : abs' (exp x - expNear (n + 1) x a₂) ≤ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂
⊢ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂ +
      abs' (x ^ n / ↑(Nat.factorial n)) * abs' (1 + x / (↑n + 1) * a₂ - a₁) ≤
    abs' x ^ n / ↑(Nat.factorial n) * b₁
[PROOFSTEP]
convert mul_le_mul_of_nonneg_left (a := abs' x ^ n / ↑(Nat.factorial n)) (le_sub_iff_add_le'.1 e) ?_ using 1
[GOAL]
case h.e'_3
n : ℕ
x a₁ b₁ a₂ b₂ : ℝ
e : abs' (1 + x / ↑(n + 1) * a₂ - a₁) ≤ b₁ - abs' x / ↑(n + 1) * b₂
h : abs' (exp x - expNear (n + 1) x a₂) ≤ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂
⊢ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂ +
      abs' (x ^ n / ↑(Nat.factorial n)) * abs' (1 + x / (↑n + 1) * a₂ - a₁) =
    abs' x ^ n / ↑(Nat.factorial n) * (abs' x / ↑(n + 1) * b₂ + abs' (1 + x / ↑(n + 1) * a₂ - a₁))
[PROOFSTEP]
simp [mul_add, pow_succ', div_eq_mul_inv, abs_mul, abs_inv, ← pow_abs, mul_inv]
[GOAL]
case h.e'_3
n : ℕ
x a₁ b₁ a₂ b₂ : ℝ
e : abs' (1 + x / ↑(n + 1) * a₂ - a₁) ≤ b₁ - abs' x / ↑(n + 1) * b₂
h : abs' (exp x - expNear (n + 1) x a₂) ≤ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂
⊢ abs' x ^ n * abs' x * ((↑(Nat.factorial n))⁻¹ * (↑n + 1)⁻¹) * b₂ =
    abs' x ^ n * (↑(Nat.factorial n))⁻¹ * (abs' x * (↑n + 1)⁻¹ * b₂)
[PROOFSTEP]
ac_rfl
[GOAL]
n : ℕ
x a₁ b₁ a₂ b₂ : ℝ
e : abs' (1 + x / ↑(n + 1) * a₂ - a₁) ≤ b₁ - abs' x / ↑(n + 1) * b₂
h : abs' (exp x - expNear (n + 1) x a₂) ≤ abs' x ^ (n + 1) / ↑(Nat.factorial (n + 1)) * b₂
⊢ 0 ≤ abs' x ^ n / ↑(Nat.factorial n)
[PROOFSTEP]
simp [div_nonneg, abs_nonneg]
[GOAL]
n : ℕ
x a b : ℝ
m : ℕ
e₁ : n + 1 = m
rm : ℝ
er : ↑m = rm
h : abs' x ≤ 1
e : abs' (1 - a) ≤ b - abs' x / rm * ((rm + 1) / rm)
⊢ abs' (exp x - expNear n x a) ≤ abs' x ^ n / ↑(Nat.factorial n) * b
[PROOFSTEP]
subst er
[GOAL]
n : ℕ
x a b : ℝ
m : ℕ
e₁ : n + 1 = m
h : abs' x ≤ 1
e : abs' (1 - a) ≤ b - abs' x / ↑m * ((↑m + 1) / ↑m)
⊢ abs' (exp x - expNear n x a) ≤ abs' x ^ n / ↑(Nat.factorial n) * b
[PROOFSTEP]
exact exp_approx_succ _ e₁ _ _ (by simpa using e) (exp_approx_end _ _ _ e₁ h)
[GOAL]
n : ℕ
x a b : ℝ
m : ℕ
e₁ : n + 1 = m
h : abs' x ≤ 1
e : abs' (1 - a) ≤ b - abs' x / ↑m * ((↑m + 1) / ↑m)
⊢ abs' (1 + x / ↑m * 0 - a) ≤ b - abs' x / ↑m * ((↑m + 1) / ↑m)
[PROOFSTEP]
simpa using e
[GOAL]
n : ℕ
a₁ b₁ : ℝ
m : ℕ
en : n + 1 = m
rm : ℝ
er : ↑m = rm
h : abs' (exp 1 - expNear m 1 ((a₁ - 1) * rm)) ≤ abs' 1 ^ m / ↑(Nat.factorial m) * (b₁ * rm)
⊢ abs' (exp 1 - expNear n 1 a₁) ≤ abs' 1 ^ n / ↑(Nat.factorial n) * b₁
[PROOFSTEP]
subst er
[GOAL]
n : ℕ
a₁ b₁ : ℝ
m : ℕ
en : n + 1 = m
h : abs' (exp 1 - expNear m 1 ((a₁ - 1) * ↑m)) ≤ abs' 1 ^ m / ↑(Nat.factorial m) * (b₁ * ↑m)
⊢ abs' (exp 1 - expNear n 1 a₁) ≤ abs' 1 ^ n / ↑(Nat.factorial n) * b₁
[PROOFSTEP]
refine' exp_approx_succ _ en _ _ _ h
[GOAL]
n : ℕ
a₁ b₁ : ℝ
m : ℕ
en : n + 1 = m
h : abs' (exp 1 - expNear m 1 ((a₁ - 1) * ↑m)) ≤ abs' 1 ^ m / ↑(Nat.factorial m) * (b₁ * ↑m)
⊢ abs' (1 + 1 / ↑m * ((a₁ - 1) * ↑m) - a₁) ≤ b₁ - abs' 1 / ↑m * (b₁ * ↑m)
[PROOFSTEP]
field_simp [show (m : ℝ) ≠ 0 by norm_cast; linarith]
[GOAL]
n : ℕ
a₁ b₁ : ℝ
m : ℕ
en : n + 1 = m
h : abs' (exp 1 - expNear m 1 ((a₁ - 1) * ↑m)) ≤ abs' 1 ^ m / ↑(Nat.factorial m) * (b₁ * ↑m)
⊢ ↑m ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
n : ℕ
a₁ b₁ : ℝ
m : ℕ
en : n + 1 = m
h : abs' (exp 1 - expNear m 1 ((a₁ - 1) * ↑m)) ≤ abs' 1 ^ m / ↑(Nat.factorial m) * (b₁ * ↑m)
⊢ ¬m = 0
[PROOFSTEP]
linarith
[GOAL]
x a b : ℝ
h : abs' (exp x - expNear 0 x a) ≤ abs' x ^ 0 / ↑(Nat.factorial 0) * b
⊢ abs' (exp x - a) ≤ b
[PROOFSTEP]
simpa using h
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ abs' (cos x - (1 - x ^ 2 / 2)) = ↑Complex.abs (Complex.cos ↑x - (1 - ↑x ^ 2 / 2))
[PROOFSTEP]
rw [← abs_ofReal]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs ↑(cos x - (1 - x ^ 2 / 2)) = ↑Complex.abs (Complex.cos ↑x - (1 - ↑x ^ 2 / 2))
[PROOFSTEP]
simp
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.cos ↑x - (1 - ↑x ^ 2 / 2)) =
    ↑Complex.abs ((Complex.exp (↑x * I) + Complex.exp (-↑x * I) - (2 - ↑x ^ 2)) / 2)
[PROOFSTEP]
simp [Complex.cos, sub_div, add_div, neg_div, div_self (two_ne_zero' ℂ)]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ Complex.exp (↑x * I) + Complex.exp (-↑x * I) - (2 - ↑x ^ 2) =
    Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m) +
      (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m))
[PROOFSTEP]
simp only [sum_range_succ]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ Complex.exp (↑x * I) + Complex.exp (-↑x * I) - (2 - ↑x ^ 2) =
    Complex.exp (↑x * I) -
        (∑ m in range 0, (↑x * I) ^ m / ↑(Nat.factorial m) + (↑x * I) ^ 0 / ↑(Nat.factorial 0) +
              (↑x * I) ^ 1 / ↑(Nat.factorial 1) +
            (↑x * I) ^ 2 / ↑(Nat.factorial 2) +
          (↑x * I) ^ 3 / ↑(Nat.factorial 3)) +
      (Complex.exp (-↑x * I) -
        (∑ m in range 0, (-↑x * I) ^ m / ↑(Nat.factorial m) + (-↑x * I) ^ 0 / ↑(Nat.factorial 0) +
              (-↑x * I) ^ 1 / ↑(Nat.factorial 1) +
            (-↑x * I) ^ 2 / ↑(Nat.factorial 2) +
          (-↑x * I) ^ 3 / ↑(Nat.factorial 3)))
[PROOFSTEP]
simp [pow_succ]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ Complex.exp (↑x * I) + Complex.exp (-(↑x * I)) - (2 - ↑x * ↑x) =
    Complex.exp (↑x * I) -
        (1 + ↑x * I + ↑x * I * (↑x * I) / (1 + 1) + ↑x * I * (↑x * I * (↑x * I)) / ((2 + 1) * (1 + 1))) +
      (Complex.exp (-(↑x * I)) -
        (1 + -(↑x * I) + ↑x * I * (↑x * I) / (1 + 1) + -(↑x * I * (↑x * I * (↑x * I))) / ((2 + 1) * (1 + 1))))
[PROOFSTEP]
apply Complex.ext
[GOAL]
case a
x : ℝ
hx : abs' x ≤ 1
⊢ (Complex.exp (↑x * I) + Complex.exp (-(↑x * I)) - (2 - ↑x * ↑x)).re =
    (Complex.exp (↑x * I) -
          (1 + ↑x * I + ↑x * I * (↑x * I) / (1 + 1) + ↑x * I * (↑x * I * (↑x * I)) / ((2 + 1) * (1 + 1))) +
        (Complex.exp (-(↑x * I)) -
          (1 + -(↑x * I) + ↑x * I * (↑x * I) / (1 + 1) + -(↑x * I * (↑x * I * (↑x * I))) / ((2 + 1) * (1 + 1))))).re
[PROOFSTEP]
simp [div_eq_mul_inv, normSq]
[GOAL]
case a
x : ℝ
hx : abs' x ≤ 1
⊢ (Complex.exp (↑x * I) + Complex.exp (-(↑x * I)) - (2 - ↑x * ↑x)).im =
    (Complex.exp (↑x * I) -
          (1 + ↑x * I + ↑x * I * (↑x * I) / (1 + 1) + ↑x * I * (↑x * I * (↑x * I)) / ((2 + 1) * (1 + 1))) +
        (Complex.exp (-(↑x * I)) -
          (1 + -(↑x * I) + ↑x * I * (↑x * I) / (1 + 1) + -(↑x * I * (↑x * I * (↑x * I))) / ((2 + 1) * (1 + 1))))).im
[PROOFSTEP]
simp [div_eq_mul_inv, normSq]
[GOAL]
case a
x : ℝ
hx : abs' x ≤ 1
⊢ cos x + (Complex.exp (-(↑x * I))).re - (2 - x * x) =
    cos x - (1 + -(x * x * (1 + 1)⁻¹)) + ((Complex.exp (-(↑x * I))).re - (1 + -(x * x * (1 + 1)⁻¹)))
[PROOFSTEP]
ring_nf
[GOAL]
case a
x : ℝ
hx : abs' x ≤ 1
⊢ sin x + (Complex.exp (-(↑x * I))).im =
    sin x - (x + -(x * (x * x) * ((1 + 1)⁻¹ * ((2 + 1) * ((2 + 1)⁻¹ * (2 + 1)⁻¹))))) +
      ((Complex.exp (-(↑x * I))).im - (-x + x * (x * x) * ((1 + 1)⁻¹ * ((2 + 1) * ((2 + 1)⁻¹ * (2 + 1)⁻¹)))))
[PROOFSTEP]
ring_nf
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs
      ((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m) +
          (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m))) /
        2) ≤
    ↑Complex.abs ((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2) +
      ↑Complex.abs ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2)
[PROOFSTEP]
rw [add_div]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs
      ((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2 +
        (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2) ≤
    ↑Complex.abs ((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2) +
      ↑Complex.abs ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2)
[PROOFSTEP]
exact Complex.abs.add_le _ _
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs ((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2) +
      ↑Complex.abs ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2) =
    ↑Complex.abs (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2 +
      ↑Complex.abs (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2
[PROOFSTEP]
simp [map_div₀]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2 +
      ↑Complex.abs (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2 ≤
    ↑Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2 +
      ↑Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2
[PROOFSTEP]
gcongr
[GOAL]
case h₁.h
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) ≤
    ↑Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)
[PROOFSTEP]
exact Complex.exp_bound (by simpa) (by decide)
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (↑x * I) ≤ 1
[PROOFSTEP]
simpa
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ 0 < 4
[PROOFSTEP]
decide
[GOAL]
case h₂.h
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) ≤
    ↑Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)
[PROOFSTEP]
exact Complex.exp_bound (by simpa) (by decide)
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (-↑x * I) ≤ 1
[PROOFSTEP]
simpa
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ 0 < 4
[PROOFSTEP]
decide
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2 +
      ↑Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2 ≤
    abs' x ^ 4 * (5 / 96)
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ abs' (sin x - (x - x ^ 3 / 6)) = ↑Complex.abs (Complex.sin ↑x - ↑(x - x ^ 3 / 6))
[PROOFSTEP]
rw [← abs_ofReal]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs ↑(sin x - (x - x ^ 3 / 6)) = ↑Complex.abs (Complex.sin ↑x - ↑(x - x ^ 3 / 6))
[PROOFSTEP]
simp
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.sin ↑x - ↑(x - x ^ 3 / 6)) =
    ↑Complex.abs (((Complex.exp (-↑x * I) - Complex.exp (↑x * I)) * I - ↑(2 * x - x ^ 3 / 3)) / 2)
[PROOFSTEP]
simp [Complex.sin, sub_div, add_div, neg_div, mul_div_cancel_left _ (two_ne_zero' ℂ), div_div,
  show (3 : ℂ) * 2 = 6 by norm_num]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ 3 * 2 = 6
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ (Complex.exp (-↑x * I) - Complex.exp (↑x * I)) * I - ↑(2 * x - x ^ 3 / 3) =
    (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m) -
        (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m))) *
      I
[PROOFSTEP]
simp only [sum_range_succ]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ (Complex.exp (-↑x * I) - Complex.exp (↑x * I)) * I - ↑(2 * x - x ^ 3 / 3) =
    (Complex.exp (-↑x * I) -
          (∑ m in range 0, (-↑x * I) ^ m / ↑(Nat.factorial m) + (-↑x * I) ^ 0 / ↑(Nat.factorial 0) +
                (-↑x * I) ^ 1 / ↑(Nat.factorial 1) +
              (-↑x * I) ^ 2 / ↑(Nat.factorial 2) +
            (-↑x * I) ^ 3 / ↑(Nat.factorial 3)) -
        (Complex.exp (↑x * I) -
          (∑ m in range 0, (↑x * I) ^ m / ↑(Nat.factorial m) + (↑x * I) ^ 0 / ↑(Nat.factorial 0) +
                (↑x * I) ^ 1 / ↑(Nat.factorial 1) +
              (↑x * I) ^ 2 / ↑(Nat.factorial 2) +
            (↑x * I) ^ 3 / ↑(Nat.factorial 3)))) *
      I
[PROOFSTEP]
simp [pow_succ]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ (Complex.exp (-(↑x * I)) - Complex.exp (↑x * I)) * I - (2 * ↑x - ↑x * (↑x * ↑x) / 3) =
    (Complex.exp (-(↑x * I)) -
          (1 + -(↑x * I) + ↑x * I * (↑x * I) / (1 + 1) + -(↑x * I * (↑x * I * (↑x * I))) / ((2 + 1) * (1 + 1))) -
        (Complex.exp (↑x * I) -
          (1 + ↑x * I + ↑x * I * (↑x * I) / (1 + 1) + ↑x * I * (↑x * I * (↑x * I)) / ((2 + 1) * (1 + 1))))) *
      I
[PROOFSTEP]
apply Complex.ext
[GOAL]
case a
x : ℝ
hx : abs' x ≤ 1
⊢ ((Complex.exp (-(↑x * I)) - Complex.exp (↑x * I)) * I - (2 * ↑x - ↑x * (↑x * ↑x) / 3)).re =
    ((Complex.exp (-(↑x * I)) -
            (1 + -(↑x * I) + ↑x * I * (↑x * I) / (1 + 1) + -(↑x * I * (↑x * I * (↑x * I))) / ((2 + 1) * (1 + 1))) -
          (Complex.exp (↑x * I) -
            (1 + ↑x * I + ↑x * I * (↑x * I) / (1 + 1) + ↑x * I * (↑x * I * (↑x * I)) / ((2 + 1) * (1 + 1))))) *
        I).re
[PROOFSTEP]
simp [div_eq_mul_inv, normSq]
[GOAL]
case a
x : ℝ
hx : abs' x ≤ 1
⊢ ((Complex.exp (-(↑x * I)) - Complex.exp (↑x * I)) * I - (2 * ↑x - ↑x * (↑x * ↑x) / 3)).im =
    ((Complex.exp (-(↑x * I)) -
            (1 + -(↑x * I) + ↑x * I * (↑x * I) / (1 + 1) + -(↑x * I * (↑x * I * (↑x * I))) / ((2 + 1) * (1 + 1))) -
          (Complex.exp (↑x * I) -
            (1 + ↑x * I + ↑x * I * (↑x * I) / (1 + 1) + ↑x * I * (↑x * I * (↑x * I)) / ((2 + 1) * (1 + 1))))) *
        I).im
[PROOFSTEP]
simp [div_eq_mul_inv, normSq]
[GOAL]
case a
x : ℝ
hx : abs' x ≤ 1
⊢ sin x - (Complex.exp (-(↑x * I))).im - (2 * x - x * (x * x) * 3⁻¹) =
    sin x - (x + -(x * (x * x) * ((1 + 1)⁻¹ * ((2 + 1) * ((2 + 1)⁻¹ * (2 + 1)⁻¹))))) -
      ((Complex.exp (-(↑x * I))).im - (-x + x * (x * x) * ((1 + 1)⁻¹ * ((2 + 1) * ((2 + 1)⁻¹ * (2 + 1)⁻¹)))))
[PROOFSTEP]
ring
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs
      ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m) -
            (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m))) *
          I /
        2) ≤
    ↑Complex.abs ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) * I / 2) +
      ↑Complex.abs (-((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) * I) / 2)
[PROOFSTEP]
rw [sub_mul, sub_eq_add_neg, add_div]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs
      ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) * I / 2 +
        -((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) * I) / 2) ≤
    ↑Complex.abs ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) * I / 2) +
      ↑Complex.abs (-((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) * I) / 2)
[PROOFSTEP]
exact Complex.abs.add_le _ _
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs ((Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) * I / 2) +
      ↑Complex.abs (-((Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) * I) / 2) =
    ↑Complex.abs (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2 +
      ↑Complex.abs (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2
[PROOFSTEP]
simp [add_comm, map_div₀]
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) / 2 +
      ↑Complex.abs (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) / 2 ≤
    ↑Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2 +
      ↑Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2
[PROOFSTEP]
gcongr
[GOAL]
case h₁.h
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.exp (↑x * I) - ∑ m in range 4, (↑x * I) ^ m / ↑(Nat.factorial m)) ≤
    ↑Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)
[PROOFSTEP]
exact Complex.exp_bound (by simpa) (by decide)
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (↑x * I) ≤ 1
[PROOFSTEP]
simpa
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ 0 < 4
[PROOFSTEP]
decide
[GOAL]
case h₂.h
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (Complex.exp (-↑x * I) - ∑ m in range 4, (-↑x * I) ^ m / ↑(Nat.factorial m)) ≤
    ↑Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)
[PROOFSTEP]
exact Complex.exp_bound (by simpa) (by decide)
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (-↑x * I) ≤ 1
[PROOFSTEP]
simpa
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ 0 < 4
[PROOFSTEP]
decide
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ ↑Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2 +
      ↑Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹) / 2 ≤
    abs' x ^ 4 * (5 / 96)
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ abs' x ^ 4 * (5 / 96) + x ^ 2 / 2 ≤ 1 * (5 / 96) + 1 / 2
[PROOFSTEP]
gcongr
[GOAL]
case h₁.h
x : ℝ
hx : abs' x ≤ 1
⊢ abs' x ^ 4 ≤ 1
[PROOFSTEP]
exact pow_le_one _ (abs_nonneg _) hx
[GOAL]
case h₂.h
x : ℝ
hx : abs' x ≤ 1
⊢ x ^ 2 ≤ 1
[PROOFSTEP]
rw [sq, ← abs_mul_self, abs_mul]
[GOAL]
case h₂.h
x : ℝ
hx : abs' x ≤ 1
⊢ abs' x * abs' x ≤ 1
[PROOFSTEP]
exact mul_le_one hx (abs_nonneg _) hx
[GOAL]
x : ℝ
hx : abs' x ≤ 1
⊢ 1 * (5 / 96) + 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ abs' x ^ 4 * (5 / 96) + x ^ 3 / 6 ≤ x * (5 / 96) + x / 6
[PROOFSTEP]
gcongr
[GOAL]
case h₁.h
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ abs' x ^ 4 ≤ x
[PROOFSTEP]
calc
  |x| ^ 4 ≤ |x| ^ 1 := pow_le_pow_of_le_one (abs_nonneg _) (by rwa [_root_.abs_of_nonneg (le_of_lt hx0)]) (by decide)
  _ = x := by simp [_root_.abs_of_nonneg (le_of_lt hx0)]
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ abs' x ≤ 1
[PROOFSTEP]
rwa [_root_.abs_of_nonneg (le_of_lt hx0)]
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ 1 ≤ 4
[PROOFSTEP]
decide
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ abs' x ^ 1 = x
[PROOFSTEP]
simp [_root_.abs_of_nonneg (le_of_lt hx0)]
[GOAL]
case h₂.h
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ x ^ 3 ≤ x
[PROOFSTEP]
calc
  x ^ 3 ≤ x ^ 1 := pow_le_pow_of_le_one (le_of_lt hx0) hx (by decide)
  _ = x := pow_one _
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ 1 ≤ 3
[PROOFSTEP]
decide
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ x * (5 / 96) + x / 6 < x
[PROOFSTEP]
linarith
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 1
⊢ abs' x ≤ 1
[PROOFSTEP]
rwa [_root_.abs_of_nonneg (le_of_lt hx0)]
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 2
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 2
⊢ x ≤ 1 * 2
[PROOFSTEP]
simpa
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 2
this : x / 2 ≤ 1
⊢ 0 < 2
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 2
this : x / 2 ≤ 1
⊢ abs' (x / 2) ≤ 1
[PROOFSTEP]
rwa [_root_.abs_of_nonneg (le_of_lt (half_pos hx0))]
[GOAL]
x : ℝ
hx0 : 0 < x
hx : x ≤ 2
this : x / 2 ≤ 1
⊢ 2 * sin (x / 2) * cos (x / 2) = sin x
[PROOFSTEP]
rw [← sin_two_mul, two_mul, add_halves]
[GOAL]
⊢ abs' 1 ≤ 1
[PROOFSTEP]
simp
[GOAL]
⊢ abs' 1 ^ 4 * (5 / 96) + (1 - 1 ^ 2 / 2) ≤ 2 / 3
[PROOFSTEP]
norm_num
[GOAL]
⊢ 2 * cos 1 ^ 2 - 1 ≤ 2 * (2 / 3) ^ 2 - 1
[PROOFSTEP]
gcongr
[GOAL]
case h.h.ha
⊢ 0 ≤ cos 1
[PROOFSTEP]
exact cos_one_pos.le
[GOAL]
case h.h.hab
⊢ cos 1 ≤ 2 / 3
[PROOFSTEP]
apply cos_one_le
[GOAL]
⊢ 2 * (2 / 3) ^ 2 - 1 < 0
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ exp x < 1 / (1 - x)
[PROOFSTEP]
have H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
[GOAL]
case H
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ 0 < 1 - (1 + x + x ^ 2) * (1 - x)
[PROOFSTEP]
calc
  0 < x ^ 3 := by positivity
  _ = 1 - (1 + x + x ^ 2) * (1 - x) := by ring
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ 0 < x ^ 3
[PROOFSTEP]
positivity
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ x ^ 3 = 1 - (1 + x + x ^ 2) * (1 - x)
[PROOFSTEP]
ring
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ exp x < 1 / (1 - x)
[PROOFSTEP]
calc
  exp x ≤ _ := exp_bound' h1.le h2.le zero_lt_three
  _ ≤ 1 + x + x ^ 2 := by
    -- Porting note: was `norm_num [Finset.sum] <;> nlinarith`
          -- This proof should be restored after the norm_num plugin for big operators is ported.
          -- (It may also need the positivity extensions in #3907.)
    rw [Finset.sum, range_val]
    nth_rw 1 [← two_add_one_eq_three]
    rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
    nth_rw 3 [← one_add_one_eq_two]
    rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
    nth_rw 3 [← zero_add 1]
    rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
    rw [Multiset.range_zero, Multiset.map_zero, Multiset.sum_zero]
    norm_num
    nlinarith
  _ < 1 / (1 - x) := by rw [lt_div_iff] <;> nlinarith
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ ∑ m in range 3, x ^ m / ↑(Nat.factorial m) + x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤ 1 + x + x ^ 2
[PROOFSTEP]
rw [Finset.sum, range_val]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ Multiset.sum (Multiset.map (fun m => x ^ m / ↑(Nat.factorial m)) (Multiset.range 3)) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
nth_rw 1 [← two_add_one_eq_three]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ Multiset.sum (Multiset.map (fun m => x ^ m / ↑(Nat.factorial m)) (Multiset.range (2 + 1))) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ x ^ 2 / ↑(Nat.factorial 2) + Multiset.sum (Multiset.map (fun m => x ^ m / ↑(Nat.factorial m)) (Multiset.range 2)) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
nth_rw 3 [← one_add_one_eq_two]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ x ^ 2 / ↑(Nat.factorial 2) +
        Multiset.sum (Multiset.map (fun m => x ^ m / ↑(Nat.factorial m)) (Multiset.range (1 + 1))) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ x ^ 2 / ↑(Nat.factorial 2) +
        (x ^ 1 / ↑(Nat.factorial 1) +
          Multiset.sum (Multiset.map (fun m => x ^ m / ↑(Nat.factorial m)) (Multiset.range 1))) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
nth_rw 3 [← zero_add 1]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ x ^ 2 / ↑(Nat.factorial 2) +
        (x ^ 1 / ↑(Nat.factorial 1) +
          Multiset.sum (Multiset.map (fun m => x ^ m / ↑(Nat.factorial m)) (Multiset.range (0 + 1)))) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ x ^ 2 / ↑(Nat.factorial 2) +
        (x ^ 1 / ↑(Nat.factorial 1) +
          (x ^ 0 / ↑(Nat.factorial 0) +
            Multiset.sum (Multiset.map (fun m => x ^ m / ↑(Nat.factorial m)) (Multiset.range 0)))) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
rw [Multiset.range_zero, Multiset.map_zero, Multiset.sum_zero]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ x ^ 2 / ↑(Nat.factorial 2) + (x ^ 1 / ↑(Nat.factorial 1) + (x ^ 0 / ↑(Nat.factorial 0) + 0)) +
      x ^ 3 * (↑3 + 1) / (↑(Nat.factorial 3) * ↑3) ≤
    1 + x + x ^ 2
[PROOFSTEP]
norm_num
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ x ^ 2 / 2 + (x + 1) + x ^ 3 * 4 / 18 ≤ 1 + x + x ^ 2
[PROOFSTEP]
nlinarith
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ 1 + x + x ^ 2 < 1 / (1 - x)
[PROOFSTEP]
rw [lt_div_iff]
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ (1 + x + x ^ 2) * (1 - x) < 1
[PROOFSTEP]
nlinarith
[GOAL]
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ 0 < 1 - x
[PROOFSTEP]
nlinarith
[GOAL]
x : ℝ
h1 : 0 ≤ x
h2 : x < 1
⊢ exp x ≤ 1 / (1 - x)
[PROOFSTEP]
rcases eq_or_lt_of_le h1 with (rfl | h1)
[GOAL]
case inl
h1 : 0 ≤ 0
h2 : 0 < 1
⊢ exp 0 ≤ 1 / (1 - 0)
[PROOFSTEP]
simp
[GOAL]
case inr
x : ℝ
h1✝ : 0 ≤ x
h2 : x < 1
h1 : 0 < x
⊢ exp x ≤ 1 / (1 - x)
[PROOFSTEP]
exact (exp_bound_div_one_sub_of_interval' h1 h2).le
[GOAL]
y : ℝ
h : 0 < y
⊢ 1 - y < exp (-y)
[PROOFSTEP]
cases' le_or_lt 1 y with h' h'
[GOAL]
case inl
y : ℝ
h : 0 < y
h' : 1 ≤ y
⊢ 1 - y < exp (-y)
[PROOFSTEP]
linarith [(-y).exp_pos]
[GOAL]
case inr
y : ℝ
h : 0 < y
h' : y < 1
⊢ 1 - y < exp (-y)
[PROOFSTEP]
rw [exp_neg, lt_inv _ y.exp_pos, inv_eq_one_div]
[GOAL]
case inr
y : ℝ
h : 0 < y
h' : y < 1
⊢ exp y < 1 / (1 - y)
[PROOFSTEP]
exact exp_bound_div_one_sub_of_interval' h h'
[GOAL]
y : ℝ
h : 0 < y
h' : y < 1
⊢ 0 < 1 - y
[PROOFSTEP]
linarith
[GOAL]
y : ℝ
h : 0 ≤ y
⊢ 1 - y ≤ exp (-y)
[PROOFSTEP]
rcases eq_or_lt_of_le h with (rfl | h)
[GOAL]
case inl
h : 0 ≤ 0
⊢ 1 - 0 ≤ exp (-0)
[PROOFSTEP]
simp
[GOAL]
case inr
y : ℝ
h✝ : 0 ≤ y
h : 0 < y
⊢ 1 - y ≤ exp (-y)
[PROOFSTEP]
exact (one_sub_lt_exp_minus_of_pos h).le
[GOAL]
x : ℝ
h : x < 0
⊢ x + 1 < exp x
[PROOFSTEP]
have h1 : 0 < -x := by linarith
[GOAL]
x : ℝ
h : x < 0
⊢ 0 < -x
[PROOFSTEP]
linarith
[GOAL]
x : ℝ
h : x < 0
h1 : 0 < -x
⊢ x + 1 < exp x
[PROOFSTEP]
simpa [add_comm] using one_sub_lt_exp_minus_of_pos h1
[GOAL]
x : ℝ
hx : x ≠ 0
⊢ x + 1 < exp x
[PROOFSTEP]
cases' lt_or_gt_of_ne hx with h h
[GOAL]
case inl
x : ℝ
hx : x ≠ 0
h : x < 0
⊢ x + 1 < exp x
[PROOFSTEP]
exact add_one_lt_exp_of_neg h
[GOAL]
case inr
x : ℝ
hx : x ≠ 0
h : x > 0
⊢ x + 1 < exp x
[PROOFSTEP]
exact add_one_lt_exp_of_pos h
[GOAL]
x : ℝ
⊢ x + 1 ≤ exp x
[PROOFSTEP]
cases' le_or_lt 0 x with h h
[GOAL]
case inl
x : ℝ
h : 0 ≤ x
⊢ x + 1 ≤ exp x
[PROOFSTEP]
exact Real.add_one_le_exp_of_nonneg h
[GOAL]
case inr
x : ℝ
h : x < 0
⊢ x + 1 ≤ exp x
[PROOFSTEP]
exact (add_one_lt_exp_of_neg h).le
[GOAL]
n : ℕ
t : ℝ
ht' : t ≤ ↑n
⊢ (1 - t / ↑n) ^ n ≤ exp (-t)
[PROOFSTEP]
rcases eq_or_ne n 0 with (rfl | hn)
[GOAL]
case inl
t : ℝ
ht' : t ≤ ↑0
⊢ (1 - t / ↑0) ^ 0 ≤ exp (-t)
[PROOFSTEP]
simp
[GOAL]
case inl
t : ℝ
ht' : t ≤ ↑0
⊢ t ≤ 0
[PROOFSTEP]
rwa [Nat.cast_zero] at ht' 
[GOAL]
case inr
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ (1 - t / ↑n) ^ n ≤ exp (-t)
[PROOFSTEP]
convert pow_le_pow_of_le_left ?_ (add_one_le_exp (-(t / n))) n using 2
[GOAL]
case h.e'_3.h.e'_5
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ 1 - t / ↑n = -(t / ↑n) + 1
[PROOFSTEP]
abel
[GOAL]
case h.e'_3.h.e'_5
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ 1 - t / ↑n = -(t / ↑n) + 1
[PROOFSTEP]
abel
[GOAL]
case h.e'_4
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ exp (-t) = exp (-(t / ↑n)) ^ n
[PROOFSTEP]
rw [← Real.exp_nat_mul]
[GOAL]
case h.e'_4
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ exp (-t) = exp (↑n * -(t / ↑n))
[PROOFSTEP]
congr 1
[GOAL]
case h.e'_4.e_x
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ -t = ↑n * -(t / ↑n)
[PROOFSTEP]
field_simp [(Nat.cast_ne_zero (R := ℝ)).mpr hn]
[GOAL]
case h.e'_4.e_x
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ t * ↑n = ↑n * t
[PROOFSTEP]
ring_nf
[GOAL]
case inr
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ 0 ≤ -(t / ↑n) + 1
[PROOFSTEP]
rwa [add_comm, ← sub_eq_add_neg, sub_nonneg, div_le_one]
[GOAL]
case inr
n : ℕ
t : ℝ
ht' : t ≤ ↑n
hn : n ≠ 0
⊢ 0 < ↑n
[PROOFSTEP]
positivity
[GOAL]
x : ℝ
⊢ ↑abs (cos ↑x + sin ↑x * I) = 1
[PROOFSTEP]
have := Real.sin_sq_add_cos_sq x
[GOAL]
x : ℝ
this : Real.sin x ^ 2 + Real.cos x ^ 2 = 1
⊢ ↑abs (cos ↑x + sin ↑x * I) = 1
[PROOFSTEP]
simp_all [add_comm, abs, normSq, sq, sin_ofReal_re, cos_ofReal_re, mul_re]
[GOAL]
x : ℝ
⊢ ↑abs (exp ↑x) = Real.exp x
[PROOFSTEP]
rw [← ofReal_exp]
[GOAL]
x : ℝ
⊢ ↑abs ↑(Real.exp x) = Real.exp x
[PROOFSTEP]
exact abs_of_nonneg (le_of_lt (Real.exp_pos _))
[GOAL]
x : ℝ
⊢ ↑abs (exp (↑x * I)) = 1
[PROOFSTEP]
rw [exp_mul_I, abs_cos_add_sin_mul_I]
[GOAL]
z : ℂ
⊢ ↑abs (exp z) = Real.exp z.re
[PROOFSTEP]
rw [exp_eq_exp_re_mul_sin_add_cos, map_mul, abs_exp_ofReal, abs_cos_add_sin_mul_I, mul_one]
[GOAL]
x y : ℂ
⊢ ↑abs (exp x) = ↑abs (exp y) ↔ x.re = y.re
[PROOFSTEP]
rw [abs_exp, abs_exp, Real.exp_eq_exp]
