Theorem: Real.exp_bound_div_one_sub_of_interval'
File: Mathlib/Data/Complex/Exponential.lean

tactic: have H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
state_before: x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ exp x < 1 / (1 - x)

tactic: calc
  exp x ≤ _ := exp_bound' h1.le h2.le zero_lt_three
  _ ≤ 1 + x + x ^ 2 := by
    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
state_before: x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ exp x < 1 / (1 - x)

tactic: calc
  0 < x ^ 3 := by positivity
  _ = 1 - (1 + x + x ^ 2) * (1 - x) := by ring
state_before: case H
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ 0 < 1 - (1 + x + x ^ 2) * (1 - x)

tactic: positivity
state_before: x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ 0 < x ^ 3

tactic: ring
state_before: x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ x ^ 3 = 1 - (1 + x + x ^ 2) * (1 - x)

tactic: rw [Finset.sum, range_val]
state_before: 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

tactic: nth_rw 1 [← two_add_one_eq_three]
state_before: 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

tactic: rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
state_before: 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

tactic: nth_rw 3 [← one_add_one_eq_two]
state_before: 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

tactic: rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
state_before: 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

tactic: nth_rw 3 [← zero_add 1]
state_before: 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

tactic: rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
state_before: 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

tactic: rw [Multiset.range_zero, Multiset.map_zero, Multiset.sum_zero]
state_before: 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

tactic: norm_num
state_before: 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

tactic: nlinarith
state_before: 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

tactic: rw [lt_div_iff] <;> nlinarith
state_before: x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ 1 + x + x ^ 2 < 1 / (1 - x)