[GOAL]
⊢ Tendsto (fun k => ∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1)) atTop (𝓝 (π / 4))
[PROOFSTEP]
rw [tendsto_iff_norm_tendsto_zero, ← tendsto_zero_iff_norm_tendsto_zero]
  -- (1) We introduce a useful sequence `u` of values in [0,1], then prove that another sequence
    --     constructed from `u` tends to `0` at `+∞`
[GOAL]
⊢ Tendsto (fun e => ∑ i in Finset.range e, (-1) ^ i / (2 * ↑i + 1) - π / 4) atTop (𝓝 0)
[PROOFSTEP]
let u := fun k : ℕ => (k : NNReal) ^ (-1 / (2 * (k : ℝ) + 1))
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
⊢ Tendsto (fun e => ∑ i in Finset.range e, (-1) ^ i / (2 * ↑i + 1) - π / 4) atTop (𝓝 0)
[PROOFSTEP]
have H : Tendsto (fun k : ℕ => (1 : ℝ) - u k + u k ^ (2 * (k : ℝ) + 1)) atTop (𝓝 0) :=
  by
  convert
    (((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add tendsto_inv_atTop_zero).comp
      tendsto_nat_cast_atTop_atTop using
    1
  · ext k
    simp only [NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
    rw [← rpow_mul (Nat.cast_nonneg k) (-1 / (2 * (k : ℝ) + 1)) (2 * (k : ℝ) + 1),
      @div_mul_cancel _ _ (2 * (k : ℝ) + 1) _ (by norm_cast; simp only [Nat.succ_ne_zero, not_false_iff]),
      rpow_neg_one k, sub_eq_add_neg]
  ·
    simp only [add_zero, add_right_neg]
      -- (2) We convert the limit in our goal to an inequality
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
⊢ Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
[PROOFSTEP]
convert
  (((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add tendsto_inv_atTop_zero).comp
    tendsto_nat_cast_atTop_atTop using
  1
[GOAL]
case h.e'_3
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
⊢ (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) = (fun x => 1 + -x ^ (-1 / (2 * x + 1)) + x⁻¹) ∘ Nat.cast
[PROOFSTEP]
ext k
[GOAL]
case h.e'_3.h
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
k : ℕ
⊢ 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1)) = ((fun x => 1 + -x ^ (-1 / (2 * x + 1)) + x⁻¹) ∘ Nat.cast) k
[PROOFSTEP]
simp only [NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
[GOAL]
case h.e'_3.h
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
k : ℕ
⊢ 1 - ↑k ^ (-1 / (2 * ↑k + 1)) + (↑k ^ (-1 / (2 * ↑k + 1))) ^ (2 * ↑k + 1) = 1 + -↑k ^ (-1 / (2 * ↑k + 1)) + (↑k)⁻¹
[PROOFSTEP]
rw [← rpow_mul (Nat.cast_nonneg k) (-1 / (2 * (k : ℝ) + 1)) (2 * (k : ℝ) + 1),
  @div_mul_cancel _ _ (2 * (k : ℝ) + 1) _ (by norm_cast; simp only [Nat.succ_ne_zero, not_false_iff]), rpow_neg_one k,
  sub_eq_add_neg]
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
k : ℕ
⊢ 2 * ↑k + 1 ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
k : ℕ
⊢ ¬2 * k + 1 = 0
[PROOFSTEP]
simp only [Nat.succ_ne_zero, not_false_iff]
[GOAL]
case h.e'_5
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
⊢ 𝓝 0 = 𝓝 (1 + -1 + 0)
[PROOFSTEP]
simp only [add_zero, add_right_neg]
  -- (2) We convert the limit in our goal to an inequality
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
⊢ Tendsto (fun e => ∑ i in Finset.range e, (-1) ^ i / (2 * ↑i + 1) - π / 4) atTop (𝓝 0)
[PROOFSTEP]
refine' squeeze_zero_norm _ H
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
⊢ ∀ (n : ℕ), ‖∑ i in Finset.range n, (-1) ^ i / (2 * ↑i + 1) - π / 4‖ ≤ 1 - ↑(u n) + ↑(u n ^ (2 * ↑n + 1))
[PROOFSTEP]
intro k
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
⊢ ‖∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1) - π / 4‖ ≤ 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
let U := u k
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
⊢ ‖∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1) - π / 4‖ ≤ 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
let b (i : ℕ) x := (-(1 : ℝ)) ^ i * x ^ (2 * i + 1) / (2 * i + 1)
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
⊢ ‖∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1) - π / 4‖ ≤ 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
let f x := arctan x - ∑ i in Finset.range k, b i x
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
⊢ ‖∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1) - π / 4‖ ≤ 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
suffices f_bound : |f 1 - f 0| ≤ (1 : ℝ) - U + U ^ (2 * (k : ℝ) + 1)
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
f_bound : |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
⊢ ‖∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1) - π / 4‖ ≤ 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
rw [← norm_neg]
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
f_bound : |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
⊢ ‖-(∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1) - π / 4)‖ ≤ 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
convert f_bound using 1
[GOAL]
case h.e'_3
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
f_bound : |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
⊢ ‖-(∑ i in Finset.range k, (-1) ^ i / (2 * ↑i + 1) - π / 4)‖ = |f 1 - f 0|
[PROOFSTEP]
simp
  -- We show that `U` is indeed in [0,1]
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have hU1 : (U : ℝ) ≤ 1 := by
  by_cases hk : k = 0
  · simp [hk]
  ·
    exact
      rpow_le_one_of_one_le_of_nonpos (by norm_cast; exact Nat.succ_le_iff.mpr (Nat.pos_of_ne_zero hk))
        (le_of_lt
          (@div_neg_of_neg_of_pos _ _ (-(1 : ℝ)) (2 * k + 1) (neg_neg_iff_pos.mpr zero_lt_one)
            (by norm_cast; exact Nat.succ_pos')))
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
⊢ ↑U ≤ 1
[PROOFSTEP]
by_cases hk : k = 0
[GOAL]
case pos
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hk : k = 0
⊢ ↑U ≤ 1
[PROOFSTEP]
simp [hk]
[GOAL]
case neg
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hk : ¬k = 0
⊢ ↑U ≤ 1
[PROOFSTEP]
exact
  rpow_le_one_of_one_le_of_nonpos (by norm_cast; exact Nat.succ_le_iff.mpr (Nat.pos_of_ne_zero hk))
    (le_of_lt
      (@div_neg_of_neg_of_pos _ _ (-(1 : ℝ)) (2 * k + 1) (neg_neg_iff_pos.mpr zero_lt_one)
        (by norm_cast; exact Nat.succ_pos')))
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hk : ¬k = 0
⊢ 1 ≤ ↑↑k
[PROOFSTEP]
norm_cast
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hk : ¬k = 0
⊢ 1 ≤ k
[PROOFSTEP]
exact Nat.succ_le_iff.mpr (Nat.pos_of_ne_zero hk)
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hk : ¬k = 0
⊢ 0 < 2 * ↑k + 1
[PROOFSTEP]
norm_cast
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hk : ¬k = 0
⊢ 0 < 2 * k + 1
[PROOFSTEP]
exact Nat.succ_pos'
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have hU2 := NNReal.coe_nonneg U
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
let f' := fun x : ℝ => (-x ^ 2) ^ k / (1 + x ^ 2)
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have has_deriv_at_f : ∀ x, HasDerivAt f (f' x) x := by
  intro x
  have has_deriv_at_b : ∀ i ∈ Finset.range k, HasDerivAt (b i) ((-x ^ 2) ^ i) x :=
    by
    intro i _
    convert HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1)) (HasDerivAt.pow (2 * i + 1) (hasDerivAt_id x)) using 1
    · ext y
      simp only [id.def]
      ring
    · simp
      rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith), pow_mul x 2 i, ←
        mul_pow (-1 : ℝ) (x ^ 2) i]
      ring_nf
  convert (hasDerivAt_arctan x).sub (HasDerivAt.sum has_deriv_at_b) using 1
  have g_sum := @geom_sum_eq _ _ (-x ^ 2) ((neg_nonpos.mpr (sq_nonneg x)).trans_lt zero_lt_one).ne k
  simp only at g_sum ⊢
  rw [g_sum, ← neg_add' (x ^ 2) 1, add_comm (x ^ 2) 1, sub_eq_add_neg, neg_div', neg_div_neg_eq]
  ring
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
⊢ ∀ (x : ℝ), HasDerivAt f (f' x) x
[PROOFSTEP]
intro x
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
⊢ HasDerivAt f (f' x) x
[PROOFSTEP]
have has_deriv_at_b : ∀ i ∈ Finset.range k, HasDerivAt (b i) ((-x ^ 2) ^ i) x :=
  by
  intro i _
  convert HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1)) (HasDerivAt.pow (2 * i + 1) (hasDerivAt_id x)) using 1
  · ext y
    simp only [id.def]
    ring
  · simp
    rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith), pow_mul x 2 i, ←
      mul_pow (-1 : ℝ) (x ^ 2) i]
    ring_nf
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
⊢ ∀ (i : ℕ), i ∈ Finset.range k → HasDerivAt (b i) ((-x ^ 2) ^ i) x
[PROOFSTEP]
intro i _
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
⊢ HasDerivAt (b i) ((-x ^ 2) ^ i) x
[PROOFSTEP]
convert HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1)) (HasDerivAt.pow (2 * i + 1) (hasDerivAt_id x)) using 1
[GOAL]
case h.e'_6
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
⊢ b i = fun y => (-1) ^ i / (2 * ↑i + 1) * id y ^ (2 * i + 1)
[PROOFSTEP]
ext y
[GOAL]
case h.e'_6.h
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
y : ℝ
⊢ b i y = (-1) ^ i / (2 * ↑i + 1) * id y ^ (2 * i + 1)
[PROOFSTEP]
simp only [id.def]
[GOAL]
case h.e'_6.h
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
y : ℝ
⊢ (-1) ^ i * y ^ (2 * i + 1) / (2 * ↑i + 1) = (-1) ^ i / (2 * ↑i + 1) * y ^ (2 * i + 1)
[PROOFSTEP]
ring
[GOAL]
case h.e'_7
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
⊢ (-x ^ 2) ^ i = (-1) ^ i / (2 * ↑i + 1) * (↑(2 * i + 1) * id x ^ (2 * i + 1 - 1) * 1)
[PROOFSTEP]
simp
[GOAL]
case h.e'_7
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
⊢ (-x ^ 2) ^ i = (-1) ^ i / (2 * ↑i + 1) * ((2 * ↑i + 1) * x ^ (2 * i))
[PROOFSTEP]
rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith), pow_mul x 2 i, ←
  mul_pow (-1 : ℝ) (x ^ 2) i]
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
⊢ 2 * ↑i + 1 ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
⊢ ¬2 * i + 1 = 0
[PROOFSTEP]
linarith
[GOAL]
case h.e'_7
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
i : ℕ
a✝ : i ∈ Finset.range k
⊢ (-x ^ 2) ^ i = (-1 * x ^ 2) ^ i
[PROOFSTEP]
ring_nf
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
has_deriv_at_b : ∀ (i : ℕ), i ∈ Finset.range k → HasDerivAt (b i) ((-x ^ 2) ^ i) x
⊢ HasDerivAt f (f' x) x
[PROOFSTEP]
convert (hasDerivAt_arctan x).sub (HasDerivAt.sum has_deriv_at_b) using 1
[GOAL]
case h.e'_7
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
has_deriv_at_b : ∀ (i : ℕ), i ∈ Finset.range k → HasDerivAt (b i) ((-x ^ 2) ^ i) x
⊢ f' x = ↑1 / (↑1 + x ^ 2) - ∑ i in Finset.range k, (-x ^ 2) ^ i
[PROOFSTEP]
have g_sum := @geom_sum_eq _ _ (-x ^ 2) ((neg_nonpos.mpr (sq_nonneg x)).trans_lt zero_lt_one).ne k
[GOAL]
case h.e'_7
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
has_deriv_at_b : ∀ (i : ℕ), i ∈ Finset.range k → HasDerivAt (b i) ((-x ^ 2) ^ i) x
g_sum : ∑ i in Finset.range k, (-x ^ 2) ^ i = ((-x ^ 2) ^ k - 1) / (-x ^ 2 - 1)
⊢ f' x = ↑1 / (↑1 + x ^ 2) - ∑ i in Finset.range k, (-x ^ 2) ^ i
[PROOFSTEP]
simp only at g_sum ⊢
[GOAL]
case h.e'_7
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
has_deriv_at_b : ∀ (i : ℕ), i ∈ Finset.range k → HasDerivAt (b i) ((-x ^ 2) ^ i) x
g_sum : ∑ i in Finset.range k, (-x ^ 2) ^ i = ((-x ^ 2) ^ k - 1) / (-x ^ 2 - 1)
⊢ (-x ^ 2) ^ k / (↑1 + x ^ 2) = ↑1 / (↑1 + x ^ 2) - ∑ i in Finset.range k, (-x ^ 2) ^ i
[PROOFSTEP]
rw [g_sum, ← neg_add' (x ^ 2) 1, add_comm (x ^ 2) 1, sub_eq_add_neg, neg_div', neg_div_neg_eq]
[GOAL]
case h.e'_7
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
x : ℝ
has_deriv_at_b : ∀ (i : ℕ), i ∈ Finset.range k → HasDerivAt (b i) ((-x ^ 2) ^ i) x
g_sum : ∑ i in Finset.range k, (-x ^ 2) ^ i = ((-x ^ 2) ^ k - 1) / (-x ^ 2 - 1)
⊢ (-x ^ 2) ^ k / (↑1 + x ^ 2) = ↑1 / (↑1 + x ^ 2) + ((-x ^ 2) ^ k - 1) / (1 + x ^ 2)
[PROOFSTEP]
ring
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have hderiv1 : ∀ x ∈ Icc (U : ℝ) 1, HasDerivWithinAt f (f' x) (Icc (U : ℝ) 1) x := fun x _ =>
  (has_deriv_at_f x).hasDerivWithinAt
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have hderiv2 : ∀ x ∈ Icc 0 (U : ℝ), HasDerivWithinAt f (f' x) (Icc 0 (U : ℝ)) x := fun x _ =>
  (has_deriv_at_f x).hasDerivWithinAt
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have f'_bound : ∀ x ∈ Icc (-1 : ℝ) 1, |f' x| ≤ |x| ^ (2 * k) :=
  by
  intro x _
  rw [abs_div, IsAbsoluteValue.abv_pow abs (-x ^ 2) k, abs_neg, IsAbsoluteValue.abv_pow abs x 2, ← pow_mul]
  refine' div_le_of_nonneg_of_le_mul (abs_nonneg _) (pow_nonneg (abs_nonneg _) _) _
  refine' le_mul_of_one_le_right (pow_nonneg (abs_nonneg _) _) _
  rw_mod_cast [abs_of_nonneg (add_nonneg zero_le_one (sq_nonneg x) : (0 : ℝ) ≤ _)]
  exact (le_add_of_nonneg_right (sq_nonneg x) : (1 : ℝ) ≤ _)
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
⊢ ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
[PROOFSTEP]
intro x _
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
x : ℝ
a✝ : x ∈ Icc (-1) 1
⊢ |f' x| ≤ |x| ^ (2 * k)
[PROOFSTEP]
rw [abs_div, IsAbsoluteValue.abv_pow abs (-x ^ 2) k, abs_neg, IsAbsoluteValue.abv_pow abs x 2, ← pow_mul]
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
x : ℝ
a✝ : x ∈ Icc (-1) 1
⊢ |x| ^ (2 * k) / |↑1 + x ^ 2| ≤ |x| ^ (2 * k)
[PROOFSTEP]
refine' div_le_of_nonneg_of_le_mul (abs_nonneg _) (pow_nonneg (abs_nonneg _) _) _
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
x : ℝ
a✝ : x ∈ Icc (-1) 1
⊢ |x| ^ (2 * k) ≤ |x| ^ (2 * k) * |↑1 + x ^ 2|
[PROOFSTEP]
refine' le_mul_of_one_le_right (pow_nonneg (abs_nonneg _) _) _
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
x : ℝ
a✝ : x ∈ Icc (-1) 1
⊢ 1 ≤ |↑1 + x ^ 2|
[PROOFSTEP]
rw_mod_cast [abs_of_nonneg (add_nonneg zero_le_one (sq_nonneg x) : (0 : ℝ) ≤ _)]
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
x : ℝ
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * k + 1))) atTop (𝓝 0)
hU1 : U ≤ 1
hU2 : 0 ≤ U
a✝ : x ∈ Icc (↑(Int.negSucc 0)) 1
⊢ 1 ≤ 1 + x ^ 2
[PROOFSTEP]
exact (le_add_of_nonneg_right (sq_nonneg x) : (1 : ℝ) ≤ _)
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have hbound1 : ∀ x ∈ Ico (U : ℝ) 1, |f' x| ≤ 1 :=
  by
  rintro x ⟨hx_left, hx_right⟩
  have hincr := pow_le_pow_of_le_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
  rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
  rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
  linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_of_lt hx_right)))]
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
⊢ ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
[PROOFSTEP]
rintro x ⟨hx_left, hx_right⟩
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
x : ℝ
hx_left : ↑U ≤ x
hx_right : x < 1
⊢ |f' x| ≤ 1
[PROOFSTEP]
have hincr := pow_le_pow_of_le_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
x : ℝ
hx_left : ↑U ≤ x
hx_right : x < 1
hincr : x ^ (2 * k) ≤ 1 ^ (2 * k)
⊢ |f' x| ≤ 1
[PROOFSTEP]
rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
x : ℝ
hx_left : ↑U ≤ x
hx_right : x < 1
hincr : |x| ^ (2 * k) ≤ 1
⊢ |f' x| ≤ 1
[PROOFSTEP]
rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
x : ℝ
hx_left : ↑U ≤ x
hx_right : |x| < 1
hincr : |x| ^ (2 * k) ≤ 1
⊢ |f' x| ≤ 1
[PROOFSTEP]
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_of_lt hx_right)))]
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have hbound2 : ∀ x ∈ Ico 0 (U : ℝ), |f' x| ≤ U ^ (2 * k) :=
  by
  rintro x ⟨hx_left, hx_right⟩
  have hincr := pow_le_pow_of_le_left hx_left (le_of_lt hx_right) (2 * k)
  rw [← abs_of_nonneg hx_left] at hincr hx_right
  rw [← abs_of_nonneg hU2] at hU1 hx_right
  exact (f'_bound x (mem_Icc.mpr (abs_le.mp (le_trans (le_of_lt hx_right) hU1)))).trans hincr
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
⊢ ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
[PROOFSTEP]
rintro x ⟨hx_left, hx_right⟩
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
x : ℝ
hx_left : 0 ≤ x
hx_right : x < ↑U
⊢ |f' x| ≤ ↑(U ^ (2 * k))
[PROOFSTEP]
have hincr := pow_le_pow_of_le_left hx_left (le_of_lt hx_right) (2 * k)
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
x : ℝ
hx_left : 0 ≤ x
hx_right : x < ↑U
hincr : x ^ (2 * k) ≤ ↑U ^ (2 * k)
⊢ |f' x| ≤ ↑(U ^ (2 * k))
[PROOFSTEP]
rw [← abs_of_nonneg hx_left] at hincr hx_right
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
x : ℝ
hx_left : 0 ≤ x
hx_right : |x| < ↑U
hincr : |x| ^ (2 * k) ≤ ↑U ^ (2 * k)
⊢ |f' x| ≤ ↑(U ^ (2 * k))
[PROOFSTEP]
rw [← abs_of_nonneg hU2] at hU1 hx_right
[GOAL]
case intro
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : |↑U| ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
x : ℝ
hx_left : 0 ≤ x
hx_right : |x| < |↑U|
hincr : |x| ^ (2 * k) ≤ ↑U ^ (2 * k)
⊢ |f' x| ≤ ↑(U ^ (2 * k))
[PROOFSTEP]
exact (f'_bound x (mem_Icc.mpr (abs_le.mp (le_trans (le_of_lt hx_right) hU1)))).trans hincr
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
hbound2 : ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have mvt1 := norm_image_sub_le_of_norm_deriv_le_segment' hderiv1 hbound1 _ (right_mem_Icc.mpr hU1)
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
hbound2 : ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
mvt1 : ‖f 1 - f ↑U‖ ≤ 1 * (1 - ↑U)
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
have mvt2 :=
  norm_image_sub_le_of_norm_deriv_le_segment' hderiv2 hbound2 _
    (right_mem_Icc.mpr hU2)
      -- The following algebra is enough to complete the proof
[GOAL]
case f_bound
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
hbound2 : ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
mvt1 : ‖f 1 - f ↑U‖ ≤ 1 * (1 - ↑U)
mvt2 : ‖f ↑U - f 0‖ ≤ ↑(U ^ (2 * k)) * (↑U - 0)
⊢ |f 1 - f 0| ≤ 1 - ↑U + ↑(U ^ (2 * ↑k + 1))
[PROOFSTEP]
calc
  |f 1 - f 0| = |f 1 - f U + (f U - f 0)| := by simp
  _ ≤ 1 * (1 - U) + U ^ (2 * k) * (U - 0) := (le_trans (abs_add (f 1 - f U) (f U - f 0)) (add_le_add mvt1 mvt2))
  _ = 1 - U + (U : ℝ) ^ (2 * k) * U := by simp
  _ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) := by rw [← pow_succ' (U : ℝ) (2 * k)]; norm_cast
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
hbound2 : ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
mvt1 : ‖f 1 - f ↑U‖ ≤ 1 * (1 - ↑U)
mvt2 : ‖f ↑U - f 0‖ ≤ ↑(U ^ (2 * k)) * (↑U - 0)
⊢ |f 1 - f 0| = |f 1 - f ↑U + (f ↑U - f 0)|
[PROOFSTEP]
simp
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
hbound2 : ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
mvt1 : ‖f 1 - f ↑U‖ ≤ 1 * (1 - ↑U)
mvt2 : ‖f ↑U - f 0‖ ≤ ↑(U ^ (2 * k)) * (↑U - 0)
⊢ 1 * (1 - ↑U) + ↑(U ^ (2 * k)) * (↑U - 0) = 1 - ↑U + ↑U ^ (2 * k) * ↑U
[PROOFSTEP]
simp
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
hbound2 : ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
mvt1 : ‖f 1 - f ↑U‖ ≤ 1 * (1 - ↑U)
mvt2 : ‖f ↑U - f 0‖ ≤ ↑(U ^ (2 * k)) * (↑U - 0)
⊢ 1 - ↑U + ↑U ^ (2 * k) * ↑U = 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
rw [← pow_succ' (U : ℝ) (2 * k)]
[GOAL]
u : ℕ → NNReal := fun k => ↑k ^ (-1 / (2 * ↑k + 1))
H : Tendsto (fun k => 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))) atTop (𝓝 0)
k : ℕ
U : NNReal := u k
b : ℕ → ℝ → ℝ := fun i x => (-1) ^ i * x ^ (2 * i + 1) / (2 * ↑i + 1)
f : ℝ → ℝ := fun x => arctan x - ∑ i in Finset.range k, b i x
hU1 : ↑U ≤ 1
hU2 : 0 ≤ ↑U
f' : ℝ → ℝ := fun x => (-x ^ 2) ^ k / (↑1 + x ^ 2)
has_deriv_at_f : ∀ (x : ℝ), HasDerivAt f (f' x) x
hderiv1 : ∀ (x : ℝ), x ∈ Icc (↑U) 1 → HasDerivWithinAt f (f' x) (Icc (↑U) 1) x
hderiv2 : ∀ (x : ℝ), x ∈ Icc 0 ↑U → HasDerivWithinAt f (f' x) (Icc 0 ↑U) x
f'_bound : ∀ (x : ℝ), x ∈ Icc (-1) 1 → |f' x| ≤ |x| ^ (2 * k)
hbound1 : ∀ (x : ℝ), x ∈ Ico (↑U) 1 → |f' x| ≤ 1
hbound2 : ∀ (x : ℝ), x ∈ Ico 0 ↑U → |f' x| ≤ ↑(U ^ (2 * k))
mvt1 : ‖f 1 - f ↑U‖ ≤ 1 * (1 - ↑U)
mvt2 : ‖f ↑U - f 0‖ ≤ ↑(U ^ (2 * k)) * (↑U - 0)
⊢ 1 - ↑U + ↑U ^ (2 * k + 1) = 1 - ↑(u k) + ↑(u k ^ (2 * ↑k + 1))
[PROOFSTEP]
norm_cast


[GOAL]
ι : Type u_1
I : Box ι
inst✝ : Countable ι
⊢ MeasurableSet ↑I
[PROOFSTEP]
rw [coe_eq_pi]
[GOAL]
ι : Type u_1
I : Box ι
inst✝ : Countable ι
⊢ MeasurableSet (pi univ fun i => Ioc (lower I i) (upper I i))
[PROOFSTEP]
exact MeasurableSet.univ_pi fun i => measurableSet_Ioc
[GOAL]
ι : Type u_1
I : Box ι
inst✝ : Fintype ι
⊢ ↑I =ᵐ[volume] ↑Box.Icc I
[PROOFSTEP]
rw [coe_eq_pi]
[GOAL]
ι : Type u_1
I : Box ι
inst✝ : Fintype ι
⊢ (pi univ fun i => Ioc (lower I i) (upper I i)) =ᵐ[volume] ↑Box.Icc I
[PROOFSTEP]
exact Measure.univ_pi_Ioc_ae_eq_Icc
[GOAL]
ι : Type u_1
inst✝¹ : Finite ι
I : Box ι
π : Prepartition I
μ : Measure (ι → ℝ)
inst✝ : IsLocallyFiniteMeasure μ
⊢ ENNReal.toReal (↑↑μ (Prepartition.iUnion π)) = ∑ J in π.boxes, ENNReal.toReal (↑↑μ ↑J)
[PROOFSTEP]
erw [← ENNReal.toReal_sum, π.iUnion_def, measure_biUnion_finset π.pairwiseDisjoint]
[GOAL]
ι : Type u_1
inst✝¹ : Finite ι
I : Box ι
π : Prepartition I
μ : Measure (ι → ℝ)
inst✝ : IsLocallyFiniteMeasure μ
⊢ ∀ (b : Box ι), b ∈ π.boxes → MeasurableSet ↑b
ι : Type u_1
inst✝¹ : Finite ι
I : Box ι
π : Prepartition I
μ : Measure (ι → ℝ)
inst✝ : IsLocallyFiniteMeasure μ
⊢ ∀ (a : Box ι), a ∈ π.boxes → ↑↑μ ↑a ≠ ⊤
[PROOFSTEP]
exacts [fun J _ => J.measurableSet_coe, fun J _ => (J.measure_coe_lt_top μ).ne]
[GOAL]
ι : Type u_1
inst✝¹ : Fintype ι
μ : Measure (ι → ℝ)
inst✝ : IsLocallyFiniteMeasure μ
J : Box ι
x✝ : ↑J ≤ ⊤
π : Prepartition J
hπ : Prepartition.IsPartition π
⊢ ∑ Ji in π.boxes, (fun J => ENNReal.toReal (↑↑μ ↑J)) Ji = (fun J => ENNReal.toReal (↑↑μ ↑J)) J
[PROOFSTEP]
rw [← π.measure_iUnion_toReal, hπ.iUnion_eq]
[GOAL]
ι : Type u_1
inst✝ : Fintype ι
I : Box ι
⊢ ↑(Measure.toBoxAdditive volume) I = ∏ i : ι, (upper I i - lower I i)
[PROOFSTEP]
rw [Measure.toBoxAdditive_apply, coe_eq_pi, Real.volume_pi_Ioc_toReal I.lower_le_upper]
[GOAL]
ι : Type u_1
inst✝ : Fintype ι
I : Box ι
⊢ ENNReal.toReal (↑↑volume ↑I) = ∏ i : ι, (upper I i - lower I i)
[PROOFSTEP]
rw [coe_eq_pi, Real.volume_pi_Ioc_toReal I.lower_le_upper]
[GOAL]
ι : Type u_1
inst✝ : Fintype ι
n : ℕ
i : Fin (n + 1)
I : Box (Fin (n + 1))
⊢ (∏ j : Fin n, (upper (face I i) j - lower (face I i) j)) * (upper I i - lower I i) =
    ∏ j : Fin (n + 1), (upper I j - lower I j)
[PROOFSTEP]
simp only [face_lower, face_upper, (· ∘ ·), Fin.prod_univ_succAbove _ i, mul_comm]
[GOAL]
ι : Type u_1
inst✝² : Fintype ι
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
I : Box ι
x : E
⊢ ↑(↑BoxAdditiveMap.volume I) x = (∏ j : ι, (upper I j - lower I j)) • x
[PROOFSTEP]
rw [BoxAdditiveMap.volume, toSMul_apply]
[GOAL]
ι : Type u_1
inst✝² : Fintype ι
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace ℝ E
I : Box ι
x : E
⊢ ↑(Measure.toBoxAdditive volume) I • x = (∏ j : ι, (upper I j - lower I j)) • x
[PROOFSTEP]
exact congr_arg₂ (· • ·) I.volume_apply rfl


[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
⊢ ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2
[PROOFSTEP]
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
⊢ inner x y = 0 ↔ angle x y = π / 2
[PROOFSTEP]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
⊢ ‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2
[PROOFSTEP]
rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
⊢ inner x y = 0 ↔ angle x y = π / 2
[PROOFSTEP]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ angle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖)
[PROOFSTEP]
rw [angle, inner_add_right, h, add_zero, real_inner_self_eq_norm_mul_norm]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.arccos (‖x‖ * ‖x‖ / (‖x‖ * ‖x + y‖)) = Real.arccos (‖x‖ / ‖x + y‖)
[PROOFSTEP]
by_cases hx : ‖x‖ = 0
[GOAL]
case pos
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
hx : ‖x‖ = 0
⊢ Real.arccos (‖x‖ * ‖x‖ / (‖x‖ * ‖x + y‖)) = Real.arccos (‖x‖ / ‖x + y‖)
[PROOFSTEP]
simp [hx]
[GOAL]
case neg
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
hx : ¬‖x‖ = 0
⊢ Real.arccos (‖x‖ * ‖x‖ / (‖x‖ * ‖x + y‖)) = Real.arccos (‖x‖ / ‖x + y‖)
[PROOFSTEP]
rw [div_mul_eq_div_div, mul_self_div_self]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ angle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖)
[PROOFSTEP]
have hxy : ‖x + y‖ ^ 2 ≠ 0 :=
  by
  rw [pow_two, norm_add_sq_eq_norm_sq_add_norm_sq_real h, ne_comm]
  refine' ne_of_lt _
  rcases h0 with (h0 | h0)
  · exact Left.add_pos_of_pos_of_nonneg (mul_self_pos.2 (norm_ne_zero_iff.2 h0)) (mul_self_nonneg _)
  · exact Left.add_pos_of_nonneg_of_pos (mul_self_nonneg _) (mul_self_pos.2 (norm_ne_zero_iff.2 h0))
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ ‖x + y‖ ^ 2 ≠ 0
[PROOFSTEP]
rw [pow_two, norm_add_sq_eq_norm_sq_add_norm_sq_real h, ne_comm]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ 0 ≠ ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
refine' ne_of_lt _
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ 0 < ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
rcases h0 with (h0 | h0)
[GOAL]
case inl
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ 0 < ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
exact Left.add_pos_of_pos_of_nonneg (mul_self_pos.2 (norm_ne_zero_iff.2 h0)) (mul_self_nonneg _)
[GOAL]
case inr
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : y ≠ 0
⊢ 0 < ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
exact Left.add_pos_of_nonneg_of_pos (mul_self_nonneg _) (mul_self_pos.2 (norm_ne_zero_iff.2 h0))
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
hxy : ‖x + y‖ ^ 2 ≠ 0
⊢ angle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖)
[PROOFSTEP]
rw [angle_add_eq_arccos_of_inner_eq_zero h, Real.arccos_eq_arcsin (div_nonneg (norm_nonneg _) (norm_nonneg _)), div_pow,
  one_sub_div hxy]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
hxy : ‖x + y‖ ^ 2 ≠ 0
⊢ Real.arcsin (Real.sqrt ((‖x + y‖ ^ 2 - ‖x‖ ^ 2) / ‖x + y‖ ^ 2)) = Real.arcsin (‖y‖ / ‖x + y‖)
[PROOFSTEP]
nth_rw 1 [pow_two]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
hxy : ‖x + y‖ ^ 2 ≠ 0
⊢ Real.arcsin (Real.sqrt ((‖x + y‖ * ‖x + y‖ - ‖x‖ ^ 2) / ‖x + y‖ ^ 2)) = Real.arcsin (‖y‖ / ‖x + y‖)
[PROOFSTEP]
rw [norm_add_sq_eq_norm_sq_add_norm_sq_real h, pow_two, add_sub_cancel', ← pow_two, ← div_pow,
  Real.sqrt_sq (div_nonneg (norm_nonneg _) (norm_nonneg _))]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ angle x (x + y) = Real.arctan (‖y‖ / ‖x‖)
[PROOFSTEP]
rw [angle_add_eq_arcsin_of_inner_eq_zero h (Or.inl h0), Real.arctan_eq_arcsin, ← div_mul_eq_div_div,
  norm_add_eq_sqrt_iff_real_inner_eq_zero.2 h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ Real.arcsin (‖y‖ / Real.sqrt (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)) = Real.arcsin (‖y‖ / (‖x‖ * Real.sqrt (↑1 + (‖y‖ / ‖x‖) ^ 2)))
[PROOFSTEP]
nth_rw 3 [← Real.sqrt_sq (norm_nonneg x)]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ Real.arcsin (‖y‖ / Real.sqrt (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)) =
    Real.arcsin (‖y‖ / (Real.sqrt (‖x‖ ^ 2) * Real.sqrt (↑1 + (‖y‖ / ‖x‖) ^ 2)))
[PROOFSTEP]
rw_mod_cast [← Real.sqrt_mul (sq_nonneg _), div_pow, pow_two, pow_two, mul_add, mul_one, mul_div, mul_comm (‖x‖ * ‖x‖),
  ← mul_div, div_self (mul_self_pos.2 (norm_ne_zero_iff.2 h0)).ne', mul_one]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ 0 < angle x (x + y)
[PROOFSTEP]
rw [angle_add_eq_arccos_of_inner_eq_zero h, Real.arccos_pos, norm_add_eq_sqrt_iff_real_inner_eq_zero.2 h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖x‖ / Real.sqrt (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) < 1
[PROOFSTEP]
by_cases hx : x = 0
[GOAL]
case pos
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
hx : x = 0
⊢ ‖x‖ / Real.sqrt (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) < 1
[PROOFSTEP]
simp [hx]
[GOAL]
case neg
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
hx : ¬x = 0
⊢ ‖x‖ / Real.sqrt (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖) < 1
[PROOFSTEP]
rw [div_lt_one
    (Real.sqrt_pos.2 (Left.add_pos_of_pos_of_nonneg (mul_self_pos.2 (norm_ne_zero_iff.2 hx)) (mul_self_nonneg _))),
  Real.lt_sqrt (norm_nonneg _), pow_two]
[GOAL]
case neg
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
hx : ¬x = 0
⊢ ‖x‖ * ‖x‖ < ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
simpa [hx] using h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ angle x (x + y) ≤ π / 2
[PROOFSTEP]
rw [angle_add_eq_arccos_of_inner_eq_zero h, Real.arccos_le_pi_div_two]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ 0 ≤ ‖x‖ / ‖x + y‖
[PROOFSTEP]
exact div_nonneg (norm_nonneg _) (norm_nonneg _)
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ angle x (x + y) < π / 2
[PROOFSTEP]
rw [angle_add_eq_arccos_of_inner_eq_zero h, Real.arccos_lt_pi_div_two, norm_add_eq_sqrt_iff_real_inner_eq_zero.2 h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ 0 < ‖x‖ / Real.sqrt (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)
[PROOFSTEP]
exact
  div_pos (norm_pos_iff.2 h0)
    (Real.sqrt_pos.2 (Left.add_pos_of_pos_of_nonneg (mul_self_pos.2 (norm_ne_zero_iff.2 h0)) (mul_self_nonneg _)))
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.cos (angle x (x + y)) = ‖x‖ / ‖x + y‖
[PROOFSTEP]
rw [angle_add_eq_arccos_of_inner_eq_zero h,
  Real.cos_arccos (le_trans (by norm_num) (div_nonneg (norm_nonneg _) (norm_nonneg _)))
    (div_le_one_of_le _ (norm_nonneg _))]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ -1 ≤ 0
[PROOFSTEP]
norm_num
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ ‖x‖ ≤ ‖x + y‖
[PROOFSTEP]
rw [mul_self_le_mul_self_iff (norm_nonneg _) (norm_nonneg _), norm_add_sq_eq_norm_sq_add_norm_sq_real h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ ‖x‖ * ‖x‖ ≤ ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
exact le_add_of_nonneg_right (mul_self_nonneg _)
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ Real.sin (angle x (x + y)) = ‖y‖ / ‖x + y‖
[PROOFSTEP]
rw [angle_add_eq_arcsin_of_inner_eq_zero h h0,
  Real.sin_arcsin (le_trans (by norm_num) (div_nonneg (norm_nonneg _) (norm_nonneg _)))
    (div_le_one_of_le _ (norm_nonneg _))]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ -1 ≤ 0
[PROOFSTEP]
norm_num
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ ‖y‖ ≤ ‖x + y‖
[PROOFSTEP]
rw [mul_self_le_mul_self_iff (norm_nonneg _) (norm_nonneg _), norm_add_sq_eq_norm_sq_add_norm_sq_real h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ ‖y‖ * ‖y‖ ≤ ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
exact le_add_of_nonneg_left (mul_self_nonneg _)
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.tan (angle x (x + y)) = ‖y‖ / ‖x‖
[PROOFSTEP]
by_cases h0 : x = 0
[GOAL]
case pos
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0
⊢ Real.tan (angle x (x + y)) = ‖y‖ / ‖x‖
[PROOFSTEP]
simp [h0]
[GOAL]
case neg
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬x = 0
⊢ Real.tan (angle x (x + y)) = ‖y‖ / ‖x‖
[PROOFSTEP]
rw [angle_add_eq_arctan_of_inner_eq_zero h h0, Real.tan_arctan]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.cos (angle x (x + y)) * ‖x + y‖ = ‖x‖
[PROOFSTEP]
rw [cos_angle_add_of_inner_eq_zero h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ ‖x‖ / ‖x + y‖ * ‖x + y‖ = ‖x‖
[PROOFSTEP]
by_cases hxy : ‖x + y‖ = 0
[GOAL]
case pos
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
hxy : ‖x + y‖ = 0
⊢ ‖x‖ / ‖x + y‖ * ‖x + y‖ = ‖x‖
[PROOFSTEP]
have h' := norm_add_sq_eq_norm_sq_add_norm_sq_real h
[GOAL]
case pos
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
hxy : ‖x + y‖ = 0
h' : ‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
⊢ ‖x‖ / ‖x + y‖ * ‖x + y‖ = ‖x‖
[PROOFSTEP]
rw [hxy, zero_mul, eq_comm, add_eq_zero_iff' (mul_self_nonneg ‖x‖) (mul_self_nonneg ‖y‖), mul_self_eq_zero] at h'
[GOAL]
case pos
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
hxy : ‖x + y‖ = 0
h' : ‖x‖ = 0 ∧ ‖y‖ * ‖y‖ = 0
⊢ ‖x‖ / ‖x + y‖ * ‖x + y‖ = ‖x‖
[PROOFSTEP]
simp [h'.1]
[GOAL]
case neg
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
hxy : ¬‖x + y‖ = 0
⊢ ‖x‖ / ‖x + y‖ * ‖x + y‖ = ‖x‖
[PROOFSTEP]
exact div_mul_cancel _ hxy
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.sin (angle x (x + y)) * ‖x + y‖ = ‖y‖
[PROOFSTEP]
by_cases h0 : x = 0 ∧ y = 0
[GOAL]
case pos
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∧ y = 0
⊢ Real.sin (angle x (x + y)) * ‖x + y‖ = ‖y‖
[PROOFSTEP]
simp [h0]
[GOAL]
case neg
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬(x = 0 ∧ y = 0)
⊢ Real.sin (angle x (x + y)) * ‖x + y‖ = ‖y‖
[PROOFSTEP]
rw [not_and_or] at h0
[GOAL]
case neg
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬x = 0 ∨ ¬y = 0
⊢ Real.sin (angle x (x + y)) * ‖x + y‖ = ‖y‖
[PROOFSTEP]
rw [sin_angle_add_of_inner_eq_zero h h0, div_mul_cancel]
[GOAL]
case neg.h
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬x = 0 ∨ ¬y = 0
⊢ ‖x + y‖ ≠ 0
[PROOFSTEP]
rw [← mul_self_ne_zero, norm_add_sq_eq_norm_sq_add_norm_sq_real h]
[GOAL]
case neg.h
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬x = 0 ∨ ¬y = 0
⊢ ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ≠ 0
[PROOFSTEP]
refine' (ne_of_lt _).symm
[GOAL]
case neg.h
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬x = 0 ∨ ¬y = 0
⊢ 0 < ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
rcases h0 with (h0 | h0)
[GOAL]
case neg.h.inl
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬x = 0
⊢ 0 < ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
exact Left.add_pos_of_pos_of_nonneg (mul_self_pos.2 (norm_ne_zero_iff.2 h0)) (mul_self_nonneg _)
[GOAL]
case neg.h.inr
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : ¬y = 0
⊢ 0 < ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖
[PROOFSTEP]
exact Left.add_pos_of_nonneg_of_pos (mul_self_nonneg _) (mul_self_pos.2 (norm_ne_zero_iff.2 h0))
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y = 0
⊢ Real.tan (angle x (x + y)) * ‖x‖ = ‖y‖
[PROOFSTEP]
rw [tan_angle_add_of_inner_eq_zero h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y = 0
⊢ ‖y‖ / ‖x‖ * ‖x‖ = ‖y‖
[PROOFSTEP]
rcases h0 with (h0 | h0)
[GOAL]
case inl
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ ‖y‖ / ‖x‖ * ‖x‖ = ‖y‖
[PROOFSTEP]
simp [h0]
[GOAL]
case inr
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : y = 0
⊢ ‖y‖ / ‖x‖ * ‖x‖ = ‖y‖
[PROOFSTEP]
simp [h0]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y = 0
⊢ ‖x‖ / Real.cos (angle x (x + y)) = ‖x + y‖
[PROOFSTEP]
rw [cos_angle_add_of_inner_eq_zero h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y = 0
⊢ ‖x‖ / (‖x‖ / ‖x + y‖) = ‖x + y‖
[PROOFSTEP]
rcases h0 with (h0 | h0)
[GOAL]
case inl
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ ‖x‖ / (‖x‖ / ‖x + y‖) = ‖x + y‖
[PROOFSTEP]
rw [div_div_eq_mul_div, mul_comm, div_eq_mul_inv, mul_inv_cancel_right₀ (norm_ne_zero_iff.2 h0)]
[GOAL]
case inr
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : y = 0
⊢ ‖x‖ / (‖x‖ / ‖x + y‖) = ‖x + y‖
[PROOFSTEP]
simp [h0]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖y‖ / Real.sin (angle x (x + y)) = ‖x + y‖
[PROOFSTEP]
rcases h0 with (h0 | h0)
[GOAL]
case inl
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0
⊢ ‖y‖ / Real.sin (angle x (x + y)) = ‖x + y‖
[PROOFSTEP]
simp [h0]
[GOAL]
case inr
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : y ≠ 0
⊢ ‖y‖ / Real.sin (angle x (x + y)) = ‖x + y‖
[PROOFSTEP]
rw [sin_angle_add_of_inner_eq_zero h (Or.inr h0), div_div_eq_mul_div, mul_comm, div_eq_mul_inv,
  mul_inv_cancel_right₀ (norm_ne_zero_iff.2 h0)]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖y‖ / Real.tan (angle x (x + y)) = ‖x‖
[PROOFSTEP]
rw [tan_angle_add_of_inner_eq_zero h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖y‖ / (‖y‖ / ‖x‖) = ‖x‖
[PROOFSTEP]
rcases h0 with (h0 | h0)
[GOAL]
case inl
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0
⊢ ‖y‖ / (‖y‖ / ‖x‖) = ‖x‖
[PROOFSTEP]
simp [h0]
[GOAL]
case inr
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : y ≠ 0
⊢ ‖y‖ / (‖y‖ / ‖x‖) = ‖x‖
[PROOFSTEP]
rw [div_div_eq_mul_div, mul_comm, div_eq_mul_inv, mul_inv_cancel_right₀ (norm_ne_zero_iff.2 h0)]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ angle x (x - y) = Real.arccos (‖x‖ / ‖x - y‖)
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
⊢ angle x (x - y) = Real.arccos (‖x‖ / ‖x - y‖)
[PROOFSTEP]
rw [sub_eq_add_neg, angle_add_eq_arccos_of_inner_eq_zero h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ angle x (x - y) = Real.arcsin (‖y‖ / ‖x - y‖)
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ angle x (x - y) = Real.arcsin (‖y‖ / ‖x - y‖)
[PROOFSTEP]
rw [or_comm, ← neg_ne_zero, or_comm] at h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ -y ≠ 0
⊢ angle x (x - y) = Real.arcsin (‖y‖ / ‖x - y‖)
[PROOFSTEP]
rw [sub_eq_add_neg, angle_add_eq_arcsin_of_inner_eq_zero h h0, norm_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ angle x (x - y) = Real.arctan (‖y‖ / ‖x‖)
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0
⊢ angle x (x - y) = Real.arctan (‖y‖ / ‖x‖)
[PROOFSTEP]
rw [sub_eq_add_neg, angle_add_eq_arctan_of_inner_eq_zero h h0, norm_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ 0 < angle x (x - y)
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x = 0 ∨ y ≠ 0
⊢ 0 < angle x (x - y)
[PROOFSTEP]
rw [← neg_ne_zero] at h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x = 0 ∨ -y ≠ 0
⊢ 0 < angle x (x - y)
[PROOFSTEP]
rw [sub_eq_add_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x = 0 ∨ -y ≠ 0
⊢ 0 < angle x (x + -y)
[PROOFSTEP]
exact angle_add_pos_of_inner_eq_zero h h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ angle x (x - y) ≤ π / 2
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
⊢ angle x (x - y) ≤ π / 2
[PROOFSTEP]
rw [sub_eq_add_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
⊢ angle x (x + -y) ≤ π / 2
[PROOFSTEP]
exact angle_add_le_pi_div_two_of_inner_eq_zero h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0
⊢ angle x (x - y) < π / 2
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0
⊢ angle x (x - y) < π / 2
[PROOFSTEP]
rw [sub_eq_add_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0
⊢ angle x (x + -y) < π / 2
[PROOFSTEP]
exact angle_add_lt_pi_div_two_of_inner_eq_zero h h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.cos (angle x (x - y)) = ‖x‖ / ‖x - y‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
⊢ Real.cos (angle x (x - y)) = ‖x‖ / ‖x - y‖
[PROOFSTEP]
rw [sub_eq_add_neg, cos_angle_add_of_inner_eq_zero h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ Real.sin (angle x (x - y)) = ‖y‖ / ‖x - y‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ y ≠ 0
⊢ Real.sin (angle x (x - y)) = ‖y‖ / ‖x - y‖
[PROOFSTEP]
rw [or_comm, ← neg_ne_zero, or_comm] at h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ -y ≠ 0
⊢ Real.sin (angle x (x - y)) = ‖y‖ / ‖x - y‖
[PROOFSTEP]
rw [sub_eq_add_neg, sin_angle_add_of_inner_eq_zero h h0, norm_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.tan (angle x (x - y)) = ‖y‖ / ‖x‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
⊢ Real.tan (angle x (x - y)) = ‖y‖ / ‖x‖
[PROOFSTEP]
rw [sub_eq_add_neg, tan_angle_add_of_inner_eq_zero h, norm_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.cos (angle x (x - y)) * ‖x - y‖ = ‖x‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
⊢ Real.cos (angle x (x - y)) * ‖x - y‖ = ‖x‖
[PROOFSTEP]
rw [sub_eq_add_neg, cos_angle_add_mul_norm_of_inner_eq_zero h]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
⊢ Real.sin (angle x (x - y)) * ‖x - y‖ = ‖y‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
⊢ Real.sin (angle x (x - y)) * ‖x - y‖ = ‖y‖
[PROOFSTEP]
rw [sub_eq_add_neg, sin_angle_add_mul_norm_of_inner_eq_zero h, norm_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y = 0
⊢ Real.tan (angle x (x - y)) * ‖x‖ = ‖y‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ y = 0
⊢ Real.tan (angle x (x - y)) * ‖x‖ = ‖y‖
[PROOFSTEP]
rw [← neg_eq_zero] at h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ -y = 0
⊢ Real.tan (angle x (x - y)) * ‖x‖ = ‖y‖
[PROOFSTEP]
rw [sub_eq_add_neg, tan_angle_add_mul_norm_of_inner_eq_zero h h0, norm_neg]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x ≠ 0 ∨ y = 0
⊢ ‖x‖ / Real.cos (angle x (x - y)) = ‖x - y‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ y = 0
⊢ ‖x‖ / Real.cos (angle x (x - y)) = ‖x - y‖
[PROOFSTEP]
rw [← neg_eq_zero] at h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x ≠ 0 ∨ -y = 0
⊢ ‖x‖ / Real.cos (angle x (x - y)) = ‖x - y‖
[PROOFSTEP]
rw [sub_eq_add_neg, norm_div_cos_angle_add_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖y‖ / Real.sin (angle x (x - y)) = ‖x - y‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖y‖ / Real.sin (angle x (x - y)) = ‖x - y‖
[PROOFSTEP]
rw [← neg_ne_zero] at h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x = 0 ∨ -y ≠ 0
⊢ ‖y‖ / Real.sin (angle x (x - y)) = ‖x - y‖
[PROOFSTEP]
rw [sub_eq_add_neg, ← norm_neg, norm_div_sin_angle_add_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x y = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖y‖ / Real.tan (angle x (x - y)) = ‖x‖
[PROOFSTEP]
rw [← neg_eq_zero, ← inner_neg_right] at h
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x = 0 ∨ y ≠ 0
⊢ ‖y‖ / Real.tan (angle x (x - y)) = ‖x‖
[PROOFSTEP]
rw [← neg_ne_zero] at h0
[GOAL]
V : Type u_1
inst✝¹ : NormedAddCommGroup V
inst✝ : InnerProductSpace ℝ V
x y : V
h : inner x (-y) = 0
h0 : x = 0 ∨ -y ≠ 0
⊢ ‖y‖ / Real.tan (angle x (x - y)) = ‖x‖
[PROOFSTEP]
rw [sub_eq_add_neg, ← norm_neg, norm_div_tan_angle_add_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p1 p2 p3 : P
⊢ dist p1 p3 * dist p1 p3 = dist p1 p2 * dist p1 p2 + dist p3 p2 * dist p3 p2 ↔ ∠ p1 p2 p3 = π / 2
[PROOFSTEP]
erw [dist_comm p3 p2, dist_eq_norm_vsub V p1 p3, dist_eq_norm_vsub V p1 p2, dist_eq_norm_vsub V p2 p3, ←
  norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two, vsub_sub_vsub_cancel_right p1, ←
  neg_vsub_eq_vsub_rev p2 p3, norm_neg]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
⊢ ∠ p₂ p₃ p₁ = Real.arccos (dist p₃ p₂ / dist p₁ p₃)
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
⊢ ∠ p₂ p₃ p₁ = Real.arccos (dist p₃ p₂ / dist p₁ p₃)
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub' V p₃ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  angle_add_eq_arccos_of_inner_eq_zero h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₁ ≠ p₂ ∨ p₃ ≠ p₂
⊢ ∠ p₂ p₃ p₁ = Real.arcsin (dist p₁ p₂ / dist p₁ p₃)
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₁ ≠ p₂ ∨ p₃ ≠ p₂
⊢ ∠ p₂ p₃ p₁ = Real.arcsin (dist p₁ p₂ / dist p₁ p₃)
[PROOFSTEP]
rw [← @vsub_ne_zero V, @ne_comm _ p₃, ← @vsub_ne_zero V _ _ _ p₂, or_comm] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ ≠ 0 ∨ p₁ -ᵥ p₂ ≠ 0
⊢ ∠ p₂ p₃ p₁ = Real.arcsin (dist p₁ p₂ / dist p₁ p₃)
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  angle_add_eq_arcsin_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₃ ≠ p₂
⊢ ∠ p₂ p₃ p₁ = Real.arctan (dist p₁ p₂ / dist p₃ p₂)
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₃ ≠ p₂
⊢ ∠ p₂ p₃ p₁ = Real.arctan (dist p₁ p₂ / dist p₃ p₂)
[PROOFSTEP]
rw [ne_comm, ← @vsub_ne_zero V] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ ≠ 0
⊢ ∠ p₂ p₃ p₁ = Real.arctan (dist p₁ p₂ / dist p₃ p₂)
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub' V p₃ p₂, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  angle_add_eq_arctan_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₁ ≠ p₂ ∨ p₃ = p₂
⊢ 0 < ∠ p₂ p₃ p₁
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₁ ≠ p₂ ∨ p₃ = p₂
⊢ 0 < ∠ p₂ p₃ p₁
[PROOFSTEP]
rw [← @vsub_ne_zero V, eq_comm, ← @vsub_eq_zero_iff_eq V, or_comm] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ = 0 ∨ p₁ -ᵥ p₂ ≠ 0
⊢ 0 < ∠ p₂ p₃ p₁
[PROOFSTEP]
rw [angle, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ = 0 ∨ p₁ -ᵥ p₂ ≠ 0
⊢ 0 < InnerProductGeometry.angle (p₂ -ᵥ p₃) (p₂ -ᵥ p₃ + (p₁ -ᵥ p₂))
[PROOFSTEP]
exact angle_add_pos_of_inner_eq_zero h h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
⊢ ∠ p₂ p₃ p₁ ≤ π / 2
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
⊢ ∠ p₂ p₃ p₁ ≤ π / 2
[PROOFSTEP]
rw [angle, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
⊢ InnerProductGeometry.angle (p₂ -ᵥ p₃) (p₂ -ᵥ p₃ + (p₁ -ᵥ p₂)) ≤ π / 2
[PROOFSTEP]
exact angle_add_le_pi_div_two_of_inner_eq_zero h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₃ ≠ p₂
⊢ ∠ p₂ p₃ p₁ < π / 2
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₃ ≠ p₂
⊢ ∠ p₂ p₃ p₁ < π / 2
[PROOFSTEP]
rw [ne_comm, ← @vsub_ne_zero V] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ ≠ 0
⊢ ∠ p₂ p₃ p₁ < π / 2
[PROOFSTEP]
rw [angle, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ ≠ 0
⊢ InnerProductGeometry.angle (p₂ -ᵥ p₃) (p₂ -ᵥ p₃ + (p₁ -ᵥ p₂)) < π / 2
[PROOFSTEP]
exact angle_add_lt_pi_div_two_of_inner_eq_zero h h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
⊢ Real.cos (∠ p₂ p₃ p₁) = dist p₃ p₂ / dist p₁ p₃
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
⊢ Real.cos (∠ p₂ p₃ p₁) = dist p₃ p₂ / dist p₁ p₃
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub' V p₃ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  cos_angle_add_of_inner_eq_zero h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₁ ≠ p₂ ∨ p₃ ≠ p₂
⊢ Real.sin (∠ p₂ p₃ p₁) = dist p₁ p₂ / dist p₁ p₃
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₁ ≠ p₂ ∨ p₃ ≠ p₂
⊢ Real.sin (∠ p₂ p₃ p₁) = dist p₁ p₂ / dist p₁ p₃
[PROOFSTEP]
rw [← @vsub_ne_zero V, @ne_comm _ p₃, ← @vsub_ne_zero V _ _ _ p₂, or_comm] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ ≠ 0 ∨ p₁ -ᵥ p₂ ≠ 0
⊢ Real.sin (∠ p₂ p₃ p₁) = dist p₁ p₂ / dist p₁ p₃
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  sin_angle_add_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
⊢ Real.tan (∠ p₂ p₃ p₁) = dist p₁ p₂ / dist p₃ p₂
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
⊢ Real.tan (∠ p₂ p₃ p₁) = dist p₁ p₂ / dist p₃ p₂
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub' V p₃ p₂, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  tan_angle_add_of_inner_eq_zero h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
⊢ Real.cos (∠ p₂ p₃ p₁) * dist p₁ p₃ = dist p₃ p₂
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
⊢ Real.cos (∠ p₂ p₃ p₁) * dist p₁ p₃ = dist p₃ p₂
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub' V p₃ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  cos_angle_add_mul_norm_of_inner_eq_zero h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
⊢ Real.sin (∠ p₂ p₃ p₁) * dist p₁ p₃ = dist p₁ p₂
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
⊢ Real.sin (∠ p₂ p₃ p₁) * dist p₁ p₃ = dist p₁ p₂
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  sin_angle_add_mul_norm_of_inner_eq_zero h]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₁ = p₂ ∨ p₃ ≠ p₂
⊢ Real.tan (∠ p₂ p₃ p₁) * dist p₃ p₂ = dist p₁ p₂
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₁ = p₂ ∨ p₃ ≠ p₂
⊢ Real.tan (∠ p₂ p₃ p₁) * dist p₃ p₂ = dist p₁ p₂
[PROOFSTEP]
rw [ne_comm, ← @vsub_ne_zero V, ← @vsub_eq_zero_iff_eq V, or_comm] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ ≠ 0 ∨ p₁ -ᵥ p₂ = 0
⊢ Real.tan (∠ p₂ p₃ p₁) * dist p₃ p₂ = dist p₁ p₂
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub' V p₃ p₂, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  tan_angle_add_mul_norm_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₁ = p₂ ∨ p₃ ≠ p₂
⊢ dist p₃ p₂ / Real.cos (∠ p₂ p₃ p₁) = dist p₁ p₃
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₁ = p₂ ∨ p₃ ≠ p₂
⊢ dist p₃ p₂ / Real.cos (∠ p₂ p₃ p₁) = dist p₁ p₃
[PROOFSTEP]
rw [ne_comm, ← @vsub_ne_zero V, ← @vsub_eq_zero_iff_eq V, or_comm] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ ≠ 0 ∨ p₁ -ᵥ p₂ = 0
⊢ dist p₃ p₂ / Real.cos (∠ p₂ p₃ p₁) = dist p₁ p₃
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub' V p₃ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  norm_div_cos_angle_add_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₁ ≠ p₂ ∨ p₃ = p₂
⊢ dist p₁ p₂ / Real.sin (∠ p₂ p₃ p₁) = dist p₁ p₃
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₁ ≠ p₂ ∨ p₃ = p₂
⊢ dist p₁ p₂ / Real.sin (∠ p₂ p₃ p₁) = dist p₁ p₃
[PROOFSTEP]
rw [eq_comm, ← @vsub_ne_zero V, ← @vsub_eq_zero_iff_eq V, or_comm] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ = 0 ∨ p₁ -ᵥ p₂ ≠ 0
⊢ dist p₁ p₂ / Real.sin (∠ p₂ p₃ p₁) = dist p₁ p₃
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub V p₁ p₃, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  norm_div_sin_angle_add_of_inner_eq_zero h h0]
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : ∠ p₁ p₂ p₃ = π / 2
h0 : p₁ ≠ p₂ ∨ p₃ = p₂
⊢ dist p₁ p₂ / Real.tan (∠ p₂ p₃ p₁) = dist p₃ p₂
[PROOFSTEP]
rw [angle, ← inner_eq_zero_iff_angle_eq_pi_div_two, real_inner_comm, ← neg_eq_zero, ← inner_neg_left,
  neg_vsub_eq_vsub_rev] at h
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₁ ≠ p₂ ∨ p₃ = p₂
⊢ dist p₁ p₂ / Real.tan (∠ p₂ p₃ p₁) = dist p₃ p₂
[PROOFSTEP]
rw [eq_comm, ← @vsub_ne_zero V, ← @vsub_eq_zero_iff_eq V, or_comm] at h0
[GOAL]
V : Type u_1
P : Type u_2
inst✝³ : NormedAddCommGroup V
inst✝² : InnerProductSpace ℝ V
inst✝¹ : MetricSpace P
inst✝ : NormedAddTorsor V P
p₁ p₂ p₃ : P
h : inner (p₂ -ᵥ p₃) (p₁ -ᵥ p₂) = 0
h0 : p₂ -ᵥ p₃ = 0 ∨ p₁ -ᵥ p₂ ≠ 0
⊢ dist p₁ p₂ / Real.tan (∠ p₂ p₃ p₁) = dist p₃ p₂
[PROOFSTEP]
rw [angle, dist_eq_norm_vsub V p₁ p₂, dist_eq_norm_vsub' V p₃ p₂, ← vsub_add_vsub_cancel p₁ p₂ p₃, add_comm,
  norm_div_tan_angle_add_of_inner_eq_zero h h0]


[GOAL]
α : Type u_1
𝕜 : Type u_2
inst✝¹ : IsROrC 𝕜
inst✝ : MeasurableSpace α
f : α → 𝕜
μ : MeasureTheory.Measure α
hre : Measurable fun x => ↑IsROrC.re (f x)
him : Measurable fun x => ↑IsROrC.im (f x)
⊢ Measurable f
[PROOFSTEP]
convert
  Measurable.add (M := 𝕜) (IsROrC.measurable_ofReal.comp hre) ((IsROrC.measurable_ofReal.comp him).mul_const IsROrC.I)
[GOAL]
case h.e'_5.h
α : Type u_1
𝕜 : Type u_2
inst✝¹ : IsROrC 𝕜
inst✝ : MeasurableSpace α
f : α → 𝕜
μ : MeasureTheory.Measure α
hre : Measurable fun x => ↑IsROrC.re (f x)
him : Measurable fun x => ↑IsROrC.im (f x)
x✝ : α
⊢ f x✝ = (IsROrC.ofReal ∘ fun x => ↑IsROrC.re (f x)) x✝ + (IsROrC.ofReal ∘ fun x => ↑IsROrC.im (f x)) x✝ * IsROrC.I
[PROOFSTEP]
exact (IsROrC.re_add_im _).symm
[GOAL]
α : Type u_1
𝕜 : Type u_2
inst✝¹ : IsROrC 𝕜
inst✝ : MeasurableSpace α
f : α → 𝕜
μ : MeasureTheory.Measure α
hre : AEMeasurable fun x => ↑IsROrC.re (f x)
him : AEMeasurable fun x => ↑IsROrC.im (f x)
⊢ AEMeasurable f
[PROOFSTEP]
convert
  AEMeasurable.add (M := 𝕜) (IsROrC.measurable_ofReal.comp_aemeasurable hre)
    ((IsROrC.measurable_ofReal.comp_aemeasurable him).mul_const IsROrC.I)
[GOAL]
case h.e'_5.h
α : Type u_1
𝕜 : Type u_2
inst✝¹ : IsROrC 𝕜
inst✝ : MeasurableSpace α
f : α → 𝕜
μ : MeasureTheory.Measure α
hre : AEMeasurable fun x => ↑IsROrC.re (f x)
him : AEMeasurable fun x => ↑IsROrC.im (f x)
x✝ : α
⊢ f x✝ = (IsROrC.ofReal ∘ fun x => ↑IsROrC.re (f x)) x✝ + (IsROrC.ofReal ∘ fun x => ↑IsROrC.im (f x)) x✝ * IsROrC.I
[PROOFSTEP]
exact (IsROrC.re_add_im _).symm