Theorem: Real.cos_bound
File: Mathlib/Data/Complex/Exponential.lean

tactic: rw [← abs_ofReal]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ |cos x - (1 - x ^ 2 / 2)| = Complex.abs (Complex.cos ↑x - (1 - ↑x ^ 2 / 2))
state_after: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs ↑(cos x - (1 - x ^ 2 / 2)) = Complex.abs (Complex.cos ↑x - (1 - ↑x ^ 2 / 2))

tactic: simp
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs ↑(cos x - (1 - x ^ 2 / 2)) = Complex.abs (Complex.cos ↑x - (1 - ↑x ^ 2 / 2))
state_after: no goals

tactic: simp [Complex.cos, sub_div, add_div, neg_div, div_self (two_ne_zero' ℂ)]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (Complex.cos ↑x - (1 - ↑x ^ 2 / 2)) = Complex.abs ((cexp (↑x * I) + cexp (-↑x * I) - (2 - ↑x ^ 2)) / 2)
state_after: no goals

tactic: simp only [sum_range_succ, neg_mul, pow_succ, pow_zero, mul_one, range_zero, sum_empty,
  Nat.factorial, Nat.cast_one, ne_eq, one_ne_zero, not_false_eq_true, div_self,
  zero_add, div_one, Nat.mul_one, Nat.cast_succ, Nat.cast_mul, Nat.cast_ofNat, mul_neg,
  neg_neg]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ cexp (↑x * I) + cexp (-↑x * I) - (2 - ↑x ^ 2) =
    cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial +
      (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial)
state_after: x : ℝ
hx : |x| ≤ 1
⊢ cexp (↑x * I) + cexp (-(↑x * I)) - (2 - 1 * ↑x * ↑x) =
    cexp (↑x * I) -
        (1 / (↑0 + 1) + 1 * (↑x * I) / (↑0 + 1) + 1 * (↑x * I) * (↑x * I) / (↑0 + 1 + 1) +
          1 * (↑x * I) * (↑x * I) * (↑x * I) / (↑0 + 1 + 1 + 1 + 1 + 1 + 1)) +
      (cexp (-(↑x * I)) -
        (1 / (↑0 + 1) + -(1 * (↑x * I)) / (↑0 + 1) + 1 * (↑x * I) * (↑x * I) / (↑0 + 1 + 1) +
          -(1 * (↑x * I) * (↑x * I) * (↑x * I)) / (↑0 + 1 + 1 + 1 + 1 + 1 + 1)))

tactic: apply Complex.ext <;> simp [div_eq_mul_inv, normSq] <;> ring_nf
state_before: x : ℝ
hx : |x| ≤ 1
⊢ cexp (↑x * I) + cexp (-(↑x * I)) - (2 - 1 * ↑x * ↑x) =
    cexp (↑x * I) -
        (1 / (↑0 + 1) + 1 * (↑x * I) / (↑0 + 1) + 1 * (↑x * I) * (↑x * I) / (↑0 + 1 + 1) +
          1 * (↑x * I) * (↑x * I) * (↑x * I) / (↑0 + 1 + 1 + 1 + 1 + 1 + 1)) +
      (cexp (-(↑x * I)) -
        (1 / (↑0 + 1) + -(1 * (↑x * I)) / (↑0 + 1) + 1 * (↑x * I) * (↑x * I) / (↑0 + 1 + 1) +
          -(1 * (↑x * I) * (↑x * I) * (↑x * I)) / (↑0 + 1 + 1 + 1 + 1 + 1 + 1)))
state_after: no goals

tactic: rw [add_div]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs
      ((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial +
          (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial)) /
        2) ≤
    Complex.abs ((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2) +
      Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 2)
state_after: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs
      ((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2 +
        (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 2) ≤
    Complex.abs ((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2) +
      Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 2)

tactic: exact Complex.abs.add_le _ _
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs
      ((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2 +
        (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 2) ≤
    Complex.abs ((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2) +
      Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 2)
state_after: no goals

tactic: simp [map_div₀]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs ((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2) +
      Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 2) =
    Complex.abs (cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2 +
      Complex.abs (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 2
state_after: no goals

tactic: gcongr
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) / 2 +
      Complex.abs (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) / 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
state_after: case h₁.hab
x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) ≤
    Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)

case h₂.hab
x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) ≤
    Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)

tactic: exact Complex.exp_bound (by simpa) (by decide)
state_before: case h₁.hab
x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) ≤
    Complex.abs (↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)
state_after: no goals

tactic: simpa
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (↑x * I) ≤ 1
state_after: no goals

tactic: decide
state_before: x : ℝ
hx : |x| ≤ 1
⊢ 0 < 4
state_after: no goals

tactic: exact Complex.exp_bound (by simpa) (by decide)
state_before: case h₂.hab
x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) ≤
    Complex.abs (-↑x * I) ^ 4 * (↑(Nat.succ 4) * (↑(Nat.factorial 4) * ↑4)⁻¹)
state_after: no goals

tactic: simpa
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (-↑x * I) ≤ 1
state_after: no goals

tactic: norm_num [Nat.factorial]
state_before: x : ℝ
hx : |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 ≤
    |x| ^ 4 * (5 / 96)
state_after: no goals