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

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

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

tactic: 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]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs (Complex.sin ↑x - ↑(x - x ^ 3 / 6)) =
    Complex.abs (((cexp (-↑x * I) - cexp (↑x * I)) * I - ↑(2 * x - x ^ 3 / 3)) / 2)
state_after: no goals

tactic: norm_num
state_before: x : ℝ
hx : |x| ≤ 1
⊢ 3 * 2 = 6
state_after: no goals

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

tactic: apply Complex.ext <;> simp [div_eq_mul_inv, normSq]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ (cexp (-(↑x * I)) - cexp (↑x * I)) * I - (2 * ↑x - ↑1 * ↑x * ↑x * ↑x / 3) =
    (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)))) *
      I
state_after: case a
x : ℝ
hx : |x| ≤ 1
⊢ sin x - (cexp (-(↑x * I))).im - (2 * x - x * x * x * 3⁻¹) =
    sin x - (x + -(x * x * x * ((1 + 1 + 1 + 1 + 1 + 1) * ((1 + 1 + 1 + 1 + 1 + 1)⁻¹ * (1 + 1 + 1 + 1 + 1 + 1)⁻¹)))) -
      ((cexp (-(↑x * I))).im -
        (-x + x * x * x * ((1 + 1 + 1 + 1 + 1 + 1) * ((1 + 1 + 1 + 1 + 1 + 1)⁻¹ * (1 + 1 + 1 + 1 + 1 + 1)⁻¹))))

tactic: ring
state_before: case a
x : ℝ
hx : |x| ≤ 1
⊢ sin x - (cexp (-(↑x * I))).im - (2 * x - x * x * x * 3⁻¹) =
    sin x - (x + -(x * x * x * ((1 + 1 + 1 + 1 + 1 + 1) * ((1 + 1 + 1 + 1 + 1 + 1)⁻¹ * (1 + 1 + 1 + 1 + 1 + 1)⁻¹)))) -
      ((cexp (-(↑x * I))).im -
        (-x + x * x * x * ((1 + 1 + 1 + 1 + 1 + 1) * ((1 + 1 + 1 + 1 + 1 + 1)⁻¹ * (1 + 1 + 1 + 1 + 1 + 1)⁻¹))))
state_after: no goals

tactic: rw [sub_mul, sub_eq_add_neg, 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)) *
          I /
        2) ≤
    Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) * I / 2) +
      Complex.abs (-((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) * I) / 2)
state_after: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs
      ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) * I / 2 +
        -((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) * I) / 2) ≤
    Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) * I / 2) +
      Complex.abs (-((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) * I) / 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) * I / 2 +
        -((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) * I) / 2) ≤
    Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) * I / 2) +
      Complex.abs (-((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) * I) / 2)
state_after: no goals

tactic: simp [add_comm, map_div₀]
state_before: x : ℝ
hx : |x| ≤ 1
⊢ Complex.abs ((cexp (-↑x * I) - ∑ m ∈ range 4, (-↑x * I) ^ m / ↑m.factorial) * I / 2) +
      Complex.abs (-((cexp (↑x * I) - ∑ m ∈ range 4, (↑x * I) ^ m / ↑m.factorial) * I) / 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