case H
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ 0 < 1 - (1 + x + x ^ 2) * (1 - x)

x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ exp x < 1 / (1 - x)
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ exp x < 1 / (1 - x)
have H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
no goals
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ exp x < 1 / (1 - x)
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
no goals
case H
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ 0 < 1 - (1 + x + x ^ 2) * (1 - x)
calc
  0 < x ^ 3 := by positivity
  _ = 1 - (1 + x + x ^ 2) * (1 - x) := by ring
no goals
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ 0 < x ^ 3
positivity
no goals
x : ℝ
h1 : 0 < x
h2 : x < 1
⊢ x ^ 3 = 1 - (1 + x + x ^ 2) * (1 - x)
ring
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
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
rw [Finset.sum, range_val]
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
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
nth_rw 1 [← two_add_one_eq_three]
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
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
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
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
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
nth_rw 3 [← one_add_one_eq_two]
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
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
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
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
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
nth_rw 3 [← zero_add 1]
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
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
rw [← Nat.succ_eq_add_one, Multiset.range_succ, Multiset.map_cons, Multiset.sum_cons]
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
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
rw [Multiset.range_zero, Multiset.map_zero, Multiset.sum_zero]
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
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
norm_num
no goals
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
nlinarith
no goals
x : ℝ
h1 : 0 < x
h2 : x < 1
H : 0 < 1 - (1 + x + x ^ 2) * (1 - x)
⊢ 1 + x + x ^ 2 < 1 / (1 - x)
rw [lt_div_iff] <;> nlinarith