Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | rank int64 0 2.4k |
|---|---|---|---|---|---|---|
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
| Mathlib/Analysis/ODE/Gronwall.lean | 79 | 83 | theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by |
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
| 2,139 |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
#align gronwall_bound_x0 gronwallBound_x0
| Mathlib/Analysis/ODE/Gronwall.lean | 86 | 89 | theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by |
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one]
· simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero]
| 2,139 |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
#align gronwall_bound_x0 gronwallBound_x0
theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one]
· simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero]
#align gronwall_bound_ε0 gronwallBound_ε0
| Mathlib/Analysis/ODE/Gronwall.lean | 92 | 93 | theorem gronwallBound_ε0_δ0 (K x : ℝ) : gronwallBound 0 K 0 x = 0 := by |
simp only [gronwallBound_ε0, zero_mul]
| 2,139 |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
#align gronwall_bound_x0 gronwallBound_x0
theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one]
· simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero]
#align gronwall_bound_ε0 gronwallBound_ε0
theorem gronwallBound_ε0_δ0 (K x : ℝ) : gronwallBound 0 K 0 x = 0 := by
simp only [gronwallBound_ε0, zero_mul]
#align gronwall_bound_ε0_δ0 gronwallBound_ε0_δ0
| Mathlib/Analysis/ODE/Gronwall.lean | 96 | 101 | theorem gronwallBound_continuous_ε (δ K x : ℝ) : Continuous fun ε => gronwallBound δ K ε x := by |
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK]
exact continuous_const.add (continuous_id.mul continuous_const)
· simp only [gronwallBound_of_K_ne_0 hK]
exact continuous_const.add ((continuous_id.mul continuous_const).mul continuous_const)
| 2,139 |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
#align gronwall_bound_x0 gronwallBound_x0
theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one]
· simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero]
#align gronwall_bound_ε0 gronwallBound_ε0
theorem gronwallBound_ε0_δ0 (K x : ℝ) : gronwallBound 0 K 0 x = 0 := by
simp only [gronwallBound_ε0, zero_mul]
#align gronwall_bound_ε0_δ0 gronwallBound_ε0_δ0
theorem gronwallBound_continuous_ε (δ K x : ℝ) : Continuous fun ε => gronwallBound δ K ε x := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK]
exact continuous_const.add (continuous_id.mul continuous_const)
· simp only [gronwallBound_of_K_ne_0 hK]
exact continuous_const.add ((continuous_id.mul continuous_const).mul continuous_const)
#align gronwall_bound_continuous_ε gronwallBound_continuous_ε
| Mathlib/Analysis/ODE/Gronwall.lean | 113 | 132 | theorem le_gronwallBound_of_liminf_deriv_right_le {f f' : ℝ → ℝ} {δ K ε : ℝ} {a b : ℝ}
(hf : ContinuousOn f (Icc a b))
(hf' : ∀ x ∈ Ico a b, ∀ r, f' x < r → ∃ᶠ z in 𝓝[>] x, (z - x)⁻¹ * (f z - f x) < r)
(ha : f a ≤ δ) (bound : ∀ x ∈ Ico a b, f' x ≤ K * f x + ε) :
∀ x ∈ Icc a b, f x ≤ gronwallBound δ K ε (x - a) := by |
have H : ∀ x ∈ Icc a b, ∀ ε' ∈ Ioi ε, f x ≤ gronwallBound δ K ε' (x - a) := by
intro x hx ε' hε'
apply image_le_of_liminf_slope_right_lt_deriv_boundary hf hf'
· rwa [sub_self, gronwallBound_x0]
· exact fun x => hasDerivAt_gronwallBound_shift δ K ε' x a
· intro x hx hfB
rw [← hfB]
apply lt_of_le_of_lt (bound x hx)
exact add_lt_add_left (mem_Ioi.1 hε') _
· exact hx
intro x hx
change f x ≤ (fun ε' => gronwallBound δ K ε' (x - a)) ε
convert continuousWithinAt_const.closure_le _ _ (H x hx)
· simp only [closure_Ioi, left_mem_Ici]
exact (gronwallBound_continuous_ε δ K (x - a)).continuousWithinAt
| 2,139 |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 46 | 46 | theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by | simp [expNegInvGlue, hx]
| 2,140 |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by simp [expNegInvGlue, hx]
#align exp_neg_inv_glue.zero_of_nonpos expNegInvGlue.zero_of_nonpos
@[simp] -- Porting note (#10756): new lemma
protected theorem zero : expNegInvGlue 0 = 0 := zero_of_nonpos le_rfl
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 53 | 54 | theorem pos_of_pos {x : ℝ} (hx : 0 < x) : 0 < expNegInvGlue x := by |
simp [expNegInvGlue, not_le.2 hx, exp_pos]
| 2,140 |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by simp [expNegInvGlue, hx]
#align exp_neg_inv_glue.zero_of_nonpos expNegInvGlue.zero_of_nonpos
@[simp] -- Porting note (#10756): new lemma
protected theorem zero : expNegInvGlue 0 = 0 := zero_of_nonpos le_rfl
theorem pos_of_pos {x : ℝ} (hx : 0 < x) : 0 < expNegInvGlue x := by
simp [expNegInvGlue, not_le.2 hx, exp_pos]
#align exp_neg_inv_glue.pos_of_pos expNegInvGlue.pos_of_pos
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 58 | 61 | theorem nonneg (x : ℝ) : 0 ≤ expNegInvGlue x := by |
cases le_or_gt x 0 with
| inl h => exact ge_of_eq (zero_of_nonpos h)
| inr h => exact le_of_lt (pos_of_pos h)
| 2,140 |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by simp [expNegInvGlue, hx]
#align exp_neg_inv_glue.zero_of_nonpos expNegInvGlue.zero_of_nonpos
@[simp] -- Porting note (#10756): new lemma
protected theorem zero : expNegInvGlue 0 = 0 := zero_of_nonpos le_rfl
theorem pos_of_pos {x : ℝ} (hx : 0 < x) : 0 < expNegInvGlue x := by
simp [expNegInvGlue, not_le.2 hx, exp_pos]
#align exp_neg_inv_glue.pos_of_pos expNegInvGlue.pos_of_pos
theorem nonneg (x : ℝ) : 0 ≤ expNegInvGlue x := by
cases le_or_gt x 0 with
| inl h => exact ge_of_eq (zero_of_nonpos h)
| inr h => exact le_of_lt (pos_of_pos h)
#align exp_neg_inv_glue.nonneg expNegInvGlue.nonneg
-- Porting note (#10756): new lemma
@[simp] theorem zero_iff_nonpos {x : ℝ} : expNegInvGlue x = 0 ↔ x ≤ 0 :=
⟨fun h ↦ not_lt.mp fun h' ↦ (pos_of_pos h').ne' h, zero_of_nonpos⟩
#noalign exp_neg_inv_glue.P_aux
#noalign exp_neg_inv_glue.f_aux
#noalign exp_neg_inv_glue.f_aux_zero_eq
#noalign exp_neg_inv_glue.f_aux_deriv
#noalign exp_neg_inv_glue.f_aux_deriv_pos
#noalign exp_neg_inv_glue.f_aux_limit
#noalign exp_neg_inv_glue.f_aux_deriv_zero
#noalign exp_neg_inv_glue.f_aux_has_deriv_at
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 91 | 99 | theorem tendsto_polynomial_inv_mul_zero (p : ℝ[X]) :
Tendsto (fun x ↦ p.eval x⁻¹ * expNegInvGlue x) (𝓝 0) (𝓝 0) := by |
simp only [expNegInvGlue, mul_ite, mul_zero]
refine tendsto_const_nhds.if ?_
simp only [not_le]
have : Tendsto (fun x ↦ p.eval x⁻¹ / exp x⁻¹) (𝓝[>] 0) (𝓝 0) :=
p.tendsto_div_exp_atTop.comp tendsto_inv_zero_atTop
refine this.congr' <| mem_of_superset self_mem_nhdsWithin fun x hx ↦ ?_
simp [expNegInvGlue, hx.out.not_le, exp_neg, div_eq_mul_inv]
| 2,140 |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by simp [expNegInvGlue, hx]
#align exp_neg_inv_glue.zero_of_nonpos expNegInvGlue.zero_of_nonpos
@[simp] -- Porting note (#10756): new lemma
protected theorem zero : expNegInvGlue 0 = 0 := zero_of_nonpos le_rfl
theorem pos_of_pos {x : ℝ} (hx : 0 < x) : 0 < expNegInvGlue x := by
simp [expNegInvGlue, not_le.2 hx, exp_pos]
#align exp_neg_inv_glue.pos_of_pos expNegInvGlue.pos_of_pos
theorem nonneg (x : ℝ) : 0 ≤ expNegInvGlue x := by
cases le_or_gt x 0 with
| inl h => exact ge_of_eq (zero_of_nonpos h)
| inr h => exact le_of_lt (pos_of_pos h)
#align exp_neg_inv_glue.nonneg expNegInvGlue.nonneg
-- Porting note (#10756): new lemma
@[simp] theorem zero_iff_nonpos {x : ℝ} : expNegInvGlue x = 0 ↔ x ≤ 0 :=
⟨fun h ↦ not_lt.mp fun h' ↦ (pos_of_pos h').ne' h, zero_of_nonpos⟩
#noalign exp_neg_inv_glue.P_aux
#noalign exp_neg_inv_glue.f_aux
#noalign exp_neg_inv_glue.f_aux_zero_eq
#noalign exp_neg_inv_glue.f_aux_deriv
#noalign exp_neg_inv_glue.f_aux_deriv_pos
#noalign exp_neg_inv_glue.f_aux_limit
#noalign exp_neg_inv_glue.f_aux_deriv_zero
#noalign exp_neg_inv_glue.f_aux_has_deriv_at
theorem tendsto_polynomial_inv_mul_zero (p : ℝ[X]) :
Tendsto (fun x ↦ p.eval x⁻¹ * expNegInvGlue x) (𝓝 0) (𝓝 0) := by
simp only [expNegInvGlue, mul_ite, mul_zero]
refine tendsto_const_nhds.if ?_
simp only [not_le]
have : Tendsto (fun x ↦ p.eval x⁻¹ / exp x⁻¹) (𝓝[>] 0) (𝓝 0) :=
p.tendsto_div_exp_atTop.comp tendsto_inv_zero_atTop
refine this.congr' <| mem_of_superset self_mem_nhdsWithin fun x hx ↦ ?_
simp [expNegInvGlue, hx.out.not_le, exp_neg, div_eq_mul_inv]
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 101 | 117 | theorem hasDerivAt_polynomial_eval_inv_mul (p : ℝ[X]) (x : ℝ) :
HasDerivAt (fun x ↦ p.eval x⁻¹ * expNegInvGlue x)
((X ^ 2 * (p - derivative (R := ℝ) p)).eval x⁻¹ * expNegInvGlue x) x := by |
rcases lt_trichotomy x 0 with hx | rfl | hx
· rw [zero_of_nonpos hx.le, mul_zero]
refine (hasDerivAt_const _ 0).congr_of_eventuallyEq ?_
filter_upwards [gt_mem_nhds hx] with y hy
rw [zero_of_nonpos hy.le, mul_zero]
· rw [expNegInvGlue.zero, mul_zero, hasDerivAt_iff_tendsto_slope]
refine ((tendsto_polynomial_inv_mul_zero (p * X)).mono_left inf_le_left).congr fun x ↦ ?_
simp [slope_def_field, div_eq_mul_inv, mul_right_comm]
· have := ((p.hasDerivAt x⁻¹).mul (hasDerivAt_neg _).exp).comp x (hasDerivAt_inv hx.ne')
convert this.congr_of_eventuallyEq _ using 1
· simp [expNegInvGlue, hx.not_le]
ring
· filter_upwards [lt_mem_nhds hx] with y hy
simp [expNegInvGlue, hy.not_le]
| 2,140 |
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.PolynomialExp
#align_import analysis.calculus.bump_function_inner from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Topology
open Polynomial Real Filter Set Function
open scoped Polynomial
def expNegInvGlue (x : ℝ) : ℝ :=
if x ≤ 0 then 0 else exp (-x⁻¹)
#align exp_neg_inv_glue expNegInvGlue
namespace expNegInvGlue
theorem zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : expNegInvGlue x = 0 := by simp [expNegInvGlue, hx]
#align exp_neg_inv_glue.zero_of_nonpos expNegInvGlue.zero_of_nonpos
@[simp] -- Porting note (#10756): new lemma
protected theorem zero : expNegInvGlue 0 = 0 := zero_of_nonpos le_rfl
theorem pos_of_pos {x : ℝ} (hx : 0 < x) : 0 < expNegInvGlue x := by
simp [expNegInvGlue, not_le.2 hx, exp_pos]
#align exp_neg_inv_glue.pos_of_pos expNegInvGlue.pos_of_pos
theorem nonneg (x : ℝ) : 0 ≤ expNegInvGlue x := by
cases le_or_gt x 0 with
| inl h => exact ge_of_eq (zero_of_nonpos h)
| inr h => exact le_of_lt (pos_of_pos h)
#align exp_neg_inv_glue.nonneg expNegInvGlue.nonneg
-- Porting note (#10756): new lemma
@[simp] theorem zero_iff_nonpos {x : ℝ} : expNegInvGlue x = 0 ↔ x ≤ 0 :=
⟨fun h ↦ not_lt.mp fun h' ↦ (pos_of_pos h').ne' h, zero_of_nonpos⟩
#noalign exp_neg_inv_glue.P_aux
#noalign exp_neg_inv_glue.f_aux
#noalign exp_neg_inv_glue.f_aux_zero_eq
#noalign exp_neg_inv_glue.f_aux_deriv
#noalign exp_neg_inv_glue.f_aux_deriv_pos
#noalign exp_neg_inv_glue.f_aux_limit
#noalign exp_neg_inv_glue.f_aux_deriv_zero
#noalign exp_neg_inv_glue.f_aux_has_deriv_at
theorem tendsto_polynomial_inv_mul_zero (p : ℝ[X]) :
Tendsto (fun x ↦ p.eval x⁻¹ * expNegInvGlue x) (𝓝 0) (𝓝 0) := by
simp only [expNegInvGlue, mul_ite, mul_zero]
refine tendsto_const_nhds.if ?_
simp only [not_le]
have : Tendsto (fun x ↦ p.eval x⁻¹ / exp x⁻¹) (𝓝[>] 0) (𝓝 0) :=
p.tendsto_div_exp_atTop.comp tendsto_inv_zero_atTop
refine this.congr' <| mem_of_superset self_mem_nhdsWithin fun x hx ↦ ?_
simp [expNegInvGlue, hx.out.not_le, exp_neg, div_eq_mul_inv]
theorem hasDerivAt_polynomial_eval_inv_mul (p : ℝ[X]) (x : ℝ) :
HasDerivAt (fun x ↦ p.eval x⁻¹ * expNegInvGlue x)
((X ^ 2 * (p - derivative (R := ℝ) p)).eval x⁻¹ * expNegInvGlue x) x := by
rcases lt_trichotomy x 0 with hx | rfl | hx
· rw [zero_of_nonpos hx.le, mul_zero]
refine (hasDerivAt_const _ 0).congr_of_eventuallyEq ?_
filter_upwards [gt_mem_nhds hx] with y hy
rw [zero_of_nonpos hy.le, mul_zero]
· rw [expNegInvGlue.zero, mul_zero, hasDerivAt_iff_tendsto_slope]
refine ((tendsto_polynomial_inv_mul_zero (p * X)).mono_left inf_le_left).congr fun x ↦ ?_
simp [slope_def_field, div_eq_mul_inv, mul_right_comm]
· have := ((p.hasDerivAt x⁻¹).mul (hasDerivAt_neg _).exp).comp x (hasDerivAt_inv hx.ne')
convert this.congr_of_eventuallyEq _ using 1
· simp [expNegInvGlue, hx.not_le]
ring
· filter_upwards [lt_mem_nhds hx] with y hy
simp [expNegInvGlue, hy.not_le]
theorem differentiable_polynomial_eval_inv_mul (p : ℝ[X]) :
Differentiable ℝ (fun x ↦ p.eval x⁻¹ * expNegInvGlue x) := fun x ↦
(hasDerivAt_polynomial_eval_inv_mul p x).differentiableAt
theorem continuous_polynomial_eval_inv_mul (p : ℝ[X]) :
Continuous (fun x ↦ p.eval x⁻¹ * expNegInvGlue x) :=
(differentiable_polynomial_eval_inv_mul p).continuous
| Mathlib/Analysis/SpecialFunctions/SmoothTransition.lean | 127 | 135 | theorem contDiff_polynomial_eval_inv_mul {n : ℕ∞} (p : ℝ[X]) :
ContDiff ℝ n (fun x ↦ p.eval x⁻¹ * expNegInvGlue x) := by |
apply contDiff_all_iff_nat.2 (fun m => ?_) n
induction m generalizing p with
| zero => exact contDiff_zero.2 <| continuous_polynomial_eval_inv_mul _
| succ m ihm =>
refine contDiff_succ_iff_deriv.2 ⟨differentiable_polynomial_eval_inv_mul _, ?_⟩
convert ihm (X ^ 2 * (p - derivative (R := ℝ) p)) using 2
exact (hasDerivAt_polynomial_eval_inv_mul p _).deriv
| 2,140 |
import Mathlib.Order.Monotone.Odd
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
#align_import analysis.special_functions.trigonometric.deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
namespace Complex
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Deriv.lean | 35 | 41 | theorem hasStrictDerivAt_sin (x : ℂ) : HasStrictDerivAt sin (cos x) x := by |
simp only [cos, div_eq_mul_inv]
convert ((((hasStrictDerivAt_id x).neg.mul_const I).cexp.sub
((hasStrictDerivAt_id x).mul_const I).cexp).mul_const I).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
rw [sub_mul, mul_assoc, mul_assoc, I_mul_I, neg_one_mul, neg_neg, mul_one, one_mul, mul_assoc,
I_mul_I, mul_neg_one, sub_neg_eq_add, add_comm]
| 2,141 |
import Mathlib.Order.Monotone.Odd
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
#align_import analysis.special_functions.trigonometric.deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
namespace Complex
theorem hasStrictDerivAt_sin (x : ℂ) : HasStrictDerivAt sin (cos x) x := by
simp only [cos, div_eq_mul_inv]
convert ((((hasStrictDerivAt_id x).neg.mul_const I).cexp.sub
((hasStrictDerivAt_id x).mul_const I).cexp).mul_const I).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
rw [sub_mul, mul_assoc, mul_assoc, I_mul_I, neg_one_mul, neg_neg, mul_one, one_mul, mul_assoc,
I_mul_I, mul_neg_one, sub_neg_eq_add, add_comm]
#align complex.has_strict_deriv_at_sin Complex.hasStrictDerivAt_sin
theorem hasDerivAt_sin (x : ℂ) : HasDerivAt sin (cos x) x :=
(hasStrictDerivAt_sin x).hasDerivAt
#align complex.has_deriv_at_sin Complex.hasDerivAt_sin
theorem contDiff_sin {n} : ContDiff ℂ n sin :=
(((contDiff_neg.mul contDiff_const).cexp.sub (contDiff_id.mul contDiff_const).cexp).mul
contDiff_const).div_const _
#align complex.cont_diff_sin Complex.contDiff_sin
theorem differentiable_sin : Differentiable ℂ sin := fun x => (hasDerivAt_sin x).differentiableAt
#align complex.differentiable_sin Complex.differentiable_sin
theorem differentiableAt_sin {x : ℂ} : DifferentiableAt ℂ sin x :=
differentiable_sin x
#align complex.differentiable_at_sin Complex.differentiableAt_sin
@[simp]
theorem deriv_sin : deriv sin = cos :=
funext fun x => (hasDerivAt_sin x).deriv
#align complex.deriv_sin Complex.deriv_sin
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Deriv.lean | 68 | 73 | theorem hasStrictDerivAt_cos (x : ℂ) : HasStrictDerivAt cos (-sin x) x := by |
simp only [sin, div_eq_mul_inv, neg_mul_eq_neg_mul]
convert (((hasStrictDerivAt_id x).mul_const I).cexp.add
((hasStrictDerivAt_id x).neg.mul_const I).cexp).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
ring
| 2,141 |
import Mathlib.Order.Monotone.Odd
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
#align_import analysis.special_functions.trigonometric.deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
namespace Complex
theorem hasStrictDerivAt_sin (x : ℂ) : HasStrictDerivAt sin (cos x) x := by
simp only [cos, div_eq_mul_inv]
convert ((((hasStrictDerivAt_id x).neg.mul_const I).cexp.sub
((hasStrictDerivAt_id x).mul_const I).cexp).mul_const I).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
rw [sub_mul, mul_assoc, mul_assoc, I_mul_I, neg_one_mul, neg_neg, mul_one, one_mul, mul_assoc,
I_mul_I, mul_neg_one, sub_neg_eq_add, add_comm]
#align complex.has_strict_deriv_at_sin Complex.hasStrictDerivAt_sin
theorem hasDerivAt_sin (x : ℂ) : HasDerivAt sin (cos x) x :=
(hasStrictDerivAt_sin x).hasDerivAt
#align complex.has_deriv_at_sin Complex.hasDerivAt_sin
theorem contDiff_sin {n} : ContDiff ℂ n sin :=
(((contDiff_neg.mul contDiff_const).cexp.sub (contDiff_id.mul contDiff_const).cexp).mul
contDiff_const).div_const _
#align complex.cont_diff_sin Complex.contDiff_sin
theorem differentiable_sin : Differentiable ℂ sin := fun x => (hasDerivAt_sin x).differentiableAt
#align complex.differentiable_sin Complex.differentiable_sin
theorem differentiableAt_sin {x : ℂ} : DifferentiableAt ℂ sin x :=
differentiable_sin x
#align complex.differentiable_at_sin Complex.differentiableAt_sin
@[simp]
theorem deriv_sin : deriv sin = cos :=
funext fun x => (hasDerivAt_sin x).deriv
#align complex.deriv_sin Complex.deriv_sin
theorem hasStrictDerivAt_cos (x : ℂ) : HasStrictDerivAt cos (-sin x) x := by
simp only [sin, div_eq_mul_inv, neg_mul_eq_neg_mul]
convert (((hasStrictDerivAt_id x).mul_const I).cexp.add
((hasStrictDerivAt_id x).neg.mul_const I).cexp).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
ring
#align complex.has_strict_deriv_at_cos Complex.hasStrictDerivAt_cos
theorem hasDerivAt_cos (x : ℂ) : HasDerivAt cos (-sin x) x :=
(hasStrictDerivAt_cos x).hasDerivAt
#align complex.has_deriv_at_cos Complex.hasDerivAt_cos
theorem contDiff_cos {n} : ContDiff ℂ n cos :=
((contDiff_id.mul contDiff_const).cexp.add (contDiff_neg.mul contDiff_const).cexp).div_const _
#align complex.cont_diff_cos Complex.contDiff_cos
theorem differentiable_cos : Differentiable ℂ cos := fun x => (hasDerivAt_cos x).differentiableAt
#align complex.differentiable_cos Complex.differentiable_cos
theorem differentiableAt_cos {x : ℂ} : DifferentiableAt ℂ cos x :=
differentiable_cos x
#align complex.differentiable_at_cos Complex.differentiableAt_cos
theorem deriv_cos {x : ℂ} : deriv cos x = -sin x :=
(hasDerivAt_cos x).deriv
#align complex.deriv_cos Complex.deriv_cos
@[simp]
theorem deriv_cos' : deriv cos = fun x => -sin x :=
funext fun _ => deriv_cos
#align complex.deriv_cos' Complex.deriv_cos'
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Deriv.lean | 103 | 107 | theorem hasStrictDerivAt_sinh (x : ℂ) : HasStrictDerivAt sinh (cosh x) x := by |
simp only [cosh, div_eq_mul_inv]
convert ((hasStrictDerivAt_exp x).sub (hasStrictDerivAt_id x).neg.cexp).mul_const (2 : ℂ)⁻¹
using 1
rw [id, mul_neg_one, sub_eq_add_neg, neg_neg]
| 2,141 |
import Mathlib.Order.Monotone.Odd
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic
#align_import analysis.special_functions.trigonometric.deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
namespace Complex
theorem hasStrictDerivAt_sin (x : ℂ) : HasStrictDerivAt sin (cos x) x := by
simp only [cos, div_eq_mul_inv]
convert ((((hasStrictDerivAt_id x).neg.mul_const I).cexp.sub
((hasStrictDerivAt_id x).mul_const I).cexp).mul_const I).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
rw [sub_mul, mul_assoc, mul_assoc, I_mul_I, neg_one_mul, neg_neg, mul_one, one_mul, mul_assoc,
I_mul_I, mul_neg_one, sub_neg_eq_add, add_comm]
#align complex.has_strict_deriv_at_sin Complex.hasStrictDerivAt_sin
theorem hasDerivAt_sin (x : ℂ) : HasDerivAt sin (cos x) x :=
(hasStrictDerivAt_sin x).hasDerivAt
#align complex.has_deriv_at_sin Complex.hasDerivAt_sin
theorem contDiff_sin {n} : ContDiff ℂ n sin :=
(((contDiff_neg.mul contDiff_const).cexp.sub (contDiff_id.mul contDiff_const).cexp).mul
contDiff_const).div_const _
#align complex.cont_diff_sin Complex.contDiff_sin
theorem differentiable_sin : Differentiable ℂ sin := fun x => (hasDerivAt_sin x).differentiableAt
#align complex.differentiable_sin Complex.differentiable_sin
theorem differentiableAt_sin {x : ℂ} : DifferentiableAt ℂ sin x :=
differentiable_sin x
#align complex.differentiable_at_sin Complex.differentiableAt_sin
@[simp]
theorem deriv_sin : deriv sin = cos :=
funext fun x => (hasDerivAt_sin x).deriv
#align complex.deriv_sin Complex.deriv_sin
theorem hasStrictDerivAt_cos (x : ℂ) : HasStrictDerivAt cos (-sin x) x := by
simp only [sin, div_eq_mul_inv, neg_mul_eq_neg_mul]
convert (((hasStrictDerivAt_id x).mul_const I).cexp.add
((hasStrictDerivAt_id x).neg.mul_const I).cexp).mul_const (2 : ℂ)⁻¹ using 1
simp only [Function.comp, id]
ring
#align complex.has_strict_deriv_at_cos Complex.hasStrictDerivAt_cos
theorem hasDerivAt_cos (x : ℂ) : HasDerivAt cos (-sin x) x :=
(hasStrictDerivAt_cos x).hasDerivAt
#align complex.has_deriv_at_cos Complex.hasDerivAt_cos
theorem contDiff_cos {n} : ContDiff ℂ n cos :=
((contDiff_id.mul contDiff_const).cexp.add (contDiff_neg.mul contDiff_const).cexp).div_const _
#align complex.cont_diff_cos Complex.contDiff_cos
theorem differentiable_cos : Differentiable ℂ cos := fun x => (hasDerivAt_cos x).differentiableAt
#align complex.differentiable_cos Complex.differentiable_cos
theorem differentiableAt_cos {x : ℂ} : DifferentiableAt ℂ cos x :=
differentiable_cos x
#align complex.differentiable_at_cos Complex.differentiableAt_cos
theorem deriv_cos {x : ℂ} : deriv cos x = -sin x :=
(hasDerivAt_cos x).deriv
#align complex.deriv_cos Complex.deriv_cos
@[simp]
theorem deriv_cos' : deriv cos = fun x => -sin x :=
funext fun _ => deriv_cos
#align complex.deriv_cos' Complex.deriv_cos'
theorem hasStrictDerivAt_sinh (x : ℂ) : HasStrictDerivAt sinh (cosh x) x := by
simp only [cosh, div_eq_mul_inv]
convert ((hasStrictDerivAt_exp x).sub (hasStrictDerivAt_id x).neg.cexp).mul_const (2 : ℂ)⁻¹
using 1
rw [id, mul_neg_one, sub_eq_add_neg, neg_neg]
#align complex.has_strict_deriv_at_sinh Complex.hasStrictDerivAt_sinh
theorem hasDerivAt_sinh (x : ℂ) : HasDerivAt sinh (cosh x) x :=
(hasStrictDerivAt_sinh x).hasDerivAt
#align complex.has_deriv_at_sinh Complex.hasDerivAt_sinh
theorem contDiff_sinh {n} : ContDiff ℂ n sinh :=
(contDiff_exp.sub contDiff_neg.cexp).div_const _
#align complex.cont_diff_sinh Complex.contDiff_sinh
theorem differentiable_sinh : Differentiable ℂ sinh := fun x => (hasDerivAt_sinh x).differentiableAt
#align complex.differentiable_sinh Complex.differentiable_sinh
theorem differentiableAt_sinh {x : ℂ} : DifferentiableAt ℂ sinh x :=
differentiable_sinh x
#align complex.differentiable_at_sinh Complex.differentiableAt_sinh
@[simp]
theorem deriv_sinh : deriv sinh = cosh :=
funext fun x => (hasDerivAt_sinh x).deriv
#align complex.deriv_sinh Complex.deriv_sinh
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Deriv.lean | 134 | 138 | theorem hasStrictDerivAt_cosh (x : ℂ) : HasStrictDerivAt cosh (sinh x) x := by |
simp only [sinh, div_eq_mul_inv]
convert ((hasStrictDerivAt_exp x).add (hasStrictDerivAt_id x).neg.cexp).mul_const (2 : ℂ)⁻¹
using 1
rw [id, mul_neg_one, sub_eq_add_neg]
| 2,141 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 57 | 61 | theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by |
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
| 2,142 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 65 | 65 | theorem arsinh_zero : arsinh 0 = 0 := by | simp [arsinh]
| 2,142 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 69 | 73 | theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by |
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
| 2,142 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
#align real.arsinh_neg Real.arsinh_neg
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 78 | 79 | theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by |
rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp
| 2,142 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
#align real.arsinh_neg Real.arsinh_neg
@[simp]
theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by
rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp
#align real.sinh_arsinh Real.sinh_arsinh
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 83 | 84 | theorem cosh_arsinh (x : ℝ) : cosh (arsinh x) = √(1 + x ^ 2) := by |
rw [← sqrt_sq (cosh_pos _).le, cosh_sq', sinh_arsinh]
| 2,142 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
#align real.arsinh_neg Real.arsinh_neg
@[simp]
theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by
rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp
#align real.sinh_arsinh Real.sinh_arsinh
@[simp]
theorem cosh_arsinh (x : ℝ) : cosh (arsinh x) = √(1 + x ^ 2) := by
rw [← sqrt_sq (cosh_pos _).le, cosh_sq', sinh_arsinh]
#align real.cosh_arsinh Real.cosh_arsinh
theorem sinh_surjective : Surjective sinh :=
LeftInverse.surjective sinh_arsinh
#align real.sinh_surjective Real.sinh_surjective
theorem sinh_bijective : Bijective sinh :=
⟨sinh_injective, sinh_surjective⟩
#align real.sinh_bijective Real.sinh_bijective
@[simp]
theorem arsinh_sinh (x : ℝ) : arsinh (sinh x) = x :=
rightInverse_of_injective_of_leftInverse sinh_injective sinh_arsinh x
#align real.arsinh_sinh Real.arsinh_sinh
@[simps]
def sinhEquiv : ℝ ≃ ℝ where
toFun := sinh
invFun := arsinh
left_inv := arsinh_sinh
right_inv := sinh_arsinh
#align real.sinh_equiv Real.sinhEquiv
@[simps! (config := .asFn)]
def sinhOrderIso : ℝ ≃o ℝ where
toEquiv := sinhEquiv
map_rel_iff' := @sinh_le_sinh
#align real.sinh_order_iso Real.sinhOrderIso
@[simps! (config := .asFn)]
def sinhHomeomorph : ℝ ≃ₜ ℝ :=
sinhOrderIso.toHomeomorph
#align real.sinh_homeomorph Real.sinhHomeomorph
theorem arsinh_bijective : Bijective arsinh :=
sinhEquiv.symm.bijective
#align real.arsinh_bijective Real.arsinh_bijective
theorem arsinh_injective : Injective arsinh :=
sinhEquiv.symm.injective
#align real.arsinh_injective Real.arsinh_injective
theorem arsinh_surjective : Surjective arsinh :=
sinhEquiv.symm.surjective
#align real.arsinh_surjective Real.arsinh_surjective
theorem arsinh_strictMono : StrictMono arsinh :=
sinhOrderIso.symm.strictMono
#align real.arsinh_strict_mono Real.arsinh_strictMono
@[simp]
theorem arsinh_inj : arsinh x = arsinh y ↔ x = y :=
arsinh_injective.eq_iff
#align real.arsinh_inj Real.arsinh_inj
@[simp]
theorem arsinh_le_arsinh : arsinh x ≤ arsinh y ↔ x ≤ y :=
sinhOrderIso.symm.le_iff_le
#align real.arsinh_le_arsinh Real.arsinh_le_arsinh
@[gcongr] protected alias ⟨_, GCongr.arsinh_le_arsinh⟩ := arsinh_le_arsinh
@[simp]
theorem arsinh_lt_arsinh : arsinh x < arsinh y ↔ x < y :=
sinhOrderIso.symm.lt_iff_lt
#align real.arsinh_lt_arsinh Real.arsinh_lt_arsinh
@[simp]
theorem arsinh_eq_zero_iff : arsinh x = 0 ↔ x = 0 :=
arsinh_injective.eq_iff' arsinh_zero
#align real.arsinh_eq_zero_iff Real.arsinh_eq_zero_iff
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 164 | 164 | theorem arsinh_nonneg_iff : 0 ≤ arsinh x ↔ 0 ≤ x := by | rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
| 2,142 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
#align real.arsinh_neg Real.arsinh_neg
@[simp]
theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by
rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp
#align real.sinh_arsinh Real.sinh_arsinh
@[simp]
theorem cosh_arsinh (x : ℝ) : cosh (arsinh x) = √(1 + x ^ 2) := by
rw [← sqrt_sq (cosh_pos _).le, cosh_sq', sinh_arsinh]
#align real.cosh_arsinh Real.cosh_arsinh
theorem sinh_surjective : Surjective sinh :=
LeftInverse.surjective sinh_arsinh
#align real.sinh_surjective Real.sinh_surjective
theorem sinh_bijective : Bijective sinh :=
⟨sinh_injective, sinh_surjective⟩
#align real.sinh_bijective Real.sinh_bijective
@[simp]
theorem arsinh_sinh (x : ℝ) : arsinh (sinh x) = x :=
rightInverse_of_injective_of_leftInverse sinh_injective sinh_arsinh x
#align real.arsinh_sinh Real.arsinh_sinh
@[simps]
def sinhEquiv : ℝ ≃ ℝ where
toFun := sinh
invFun := arsinh
left_inv := arsinh_sinh
right_inv := sinh_arsinh
#align real.sinh_equiv Real.sinhEquiv
@[simps! (config := .asFn)]
def sinhOrderIso : ℝ ≃o ℝ where
toEquiv := sinhEquiv
map_rel_iff' := @sinh_le_sinh
#align real.sinh_order_iso Real.sinhOrderIso
@[simps! (config := .asFn)]
def sinhHomeomorph : ℝ ≃ₜ ℝ :=
sinhOrderIso.toHomeomorph
#align real.sinh_homeomorph Real.sinhHomeomorph
theorem arsinh_bijective : Bijective arsinh :=
sinhEquiv.symm.bijective
#align real.arsinh_bijective Real.arsinh_bijective
theorem arsinh_injective : Injective arsinh :=
sinhEquiv.symm.injective
#align real.arsinh_injective Real.arsinh_injective
theorem arsinh_surjective : Surjective arsinh :=
sinhEquiv.symm.surjective
#align real.arsinh_surjective Real.arsinh_surjective
theorem arsinh_strictMono : StrictMono arsinh :=
sinhOrderIso.symm.strictMono
#align real.arsinh_strict_mono Real.arsinh_strictMono
@[simp]
theorem arsinh_inj : arsinh x = arsinh y ↔ x = y :=
arsinh_injective.eq_iff
#align real.arsinh_inj Real.arsinh_inj
@[simp]
theorem arsinh_le_arsinh : arsinh x ≤ arsinh y ↔ x ≤ y :=
sinhOrderIso.symm.le_iff_le
#align real.arsinh_le_arsinh Real.arsinh_le_arsinh
@[gcongr] protected alias ⟨_, GCongr.arsinh_le_arsinh⟩ := arsinh_le_arsinh
@[simp]
theorem arsinh_lt_arsinh : arsinh x < arsinh y ↔ x < y :=
sinhOrderIso.symm.lt_iff_lt
#align real.arsinh_lt_arsinh Real.arsinh_lt_arsinh
@[simp]
theorem arsinh_eq_zero_iff : arsinh x = 0 ↔ x = 0 :=
arsinh_injective.eq_iff' arsinh_zero
#align real.arsinh_eq_zero_iff Real.arsinh_eq_zero_iff
@[simp]
theorem arsinh_nonneg_iff : 0 ≤ arsinh x ↔ 0 ≤ x := by rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
#align real.arsinh_nonneg_iff Real.arsinh_nonneg_iff
@[simp]
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 168 | 168 | theorem arsinh_nonpos_iff : arsinh x ≤ 0 ↔ x ≤ 0 := by | rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
| 2,142 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.SpecialFunctions.Log.Basic
#align_import analysis.special_functions.arsinh from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open Function Filter Set
open scoped Topology
namespace Real
variable {x y : ℝ}
-- @[pp_nodot] is no longer needed
def arsinh (x : ℝ) :=
log (x + √(1 + x ^ 2))
#align real.arsinh Real.arsinh
theorem exp_arsinh (x : ℝ) : exp (arsinh x) = x + √(1 + x ^ 2) := by
apply exp_log
rw [← neg_lt_iff_pos_add']
apply lt_sqrt_of_sq_lt
simp
#align real.exp_arsinh Real.exp_arsinh
@[simp]
theorem arsinh_zero : arsinh 0 = 0 := by simp [arsinh]
#align real.arsinh_zero Real.arsinh_zero
@[simp]
theorem arsinh_neg (x : ℝ) : arsinh (-x) = -arsinh x := by
rw [← exp_eq_exp, exp_arsinh, exp_neg, exp_arsinh]
apply eq_inv_of_mul_eq_one_left
rw [neg_sq, neg_add_eq_sub, add_comm x, mul_comm, ← sq_sub_sq, sq_sqrt, add_sub_cancel_right]
exact add_nonneg zero_le_one (sq_nonneg _)
#align real.arsinh_neg Real.arsinh_neg
@[simp]
theorem sinh_arsinh (x : ℝ) : sinh (arsinh x) = x := by
rw [sinh_eq, ← arsinh_neg, exp_arsinh, exp_arsinh, neg_sq]; field_simp
#align real.sinh_arsinh Real.sinh_arsinh
@[simp]
theorem cosh_arsinh (x : ℝ) : cosh (arsinh x) = √(1 + x ^ 2) := by
rw [← sqrt_sq (cosh_pos _).le, cosh_sq', sinh_arsinh]
#align real.cosh_arsinh Real.cosh_arsinh
theorem sinh_surjective : Surjective sinh :=
LeftInverse.surjective sinh_arsinh
#align real.sinh_surjective Real.sinh_surjective
theorem sinh_bijective : Bijective sinh :=
⟨sinh_injective, sinh_surjective⟩
#align real.sinh_bijective Real.sinh_bijective
@[simp]
theorem arsinh_sinh (x : ℝ) : arsinh (sinh x) = x :=
rightInverse_of_injective_of_leftInverse sinh_injective sinh_arsinh x
#align real.arsinh_sinh Real.arsinh_sinh
@[simps]
def sinhEquiv : ℝ ≃ ℝ where
toFun := sinh
invFun := arsinh
left_inv := arsinh_sinh
right_inv := sinh_arsinh
#align real.sinh_equiv Real.sinhEquiv
@[simps! (config := .asFn)]
def sinhOrderIso : ℝ ≃o ℝ where
toEquiv := sinhEquiv
map_rel_iff' := @sinh_le_sinh
#align real.sinh_order_iso Real.sinhOrderIso
@[simps! (config := .asFn)]
def sinhHomeomorph : ℝ ≃ₜ ℝ :=
sinhOrderIso.toHomeomorph
#align real.sinh_homeomorph Real.sinhHomeomorph
theorem arsinh_bijective : Bijective arsinh :=
sinhEquiv.symm.bijective
#align real.arsinh_bijective Real.arsinh_bijective
theorem arsinh_injective : Injective arsinh :=
sinhEquiv.symm.injective
#align real.arsinh_injective Real.arsinh_injective
theorem arsinh_surjective : Surjective arsinh :=
sinhEquiv.symm.surjective
#align real.arsinh_surjective Real.arsinh_surjective
theorem arsinh_strictMono : StrictMono arsinh :=
sinhOrderIso.symm.strictMono
#align real.arsinh_strict_mono Real.arsinh_strictMono
@[simp]
theorem arsinh_inj : arsinh x = arsinh y ↔ x = y :=
arsinh_injective.eq_iff
#align real.arsinh_inj Real.arsinh_inj
@[simp]
theorem arsinh_le_arsinh : arsinh x ≤ arsinh y ↔ x ≤ y :=
sinhOrderIso.symm.le_iff_le
#align real.arsinh_le_arsinh Real.arsinh_le_arsinh
@[gcongr] protected alias ⟨_, GCongr.arsinh_le_arsinh⟩ := arsinh_le_arsinh
@[simp]
theorem arsinh_lt_arsinh : arsinh x < arsinh y ↔ x < y :=
sinhOrderIso.symm.lt_iff_lt
#align real.arsinh_lt_arsinh Real.arsinh_lt_arsinh
@[simp]
theorem arsinh_eq_zero_iff : arsinh x = 0 ↔ x = 0 :=
arsinh_injective.eq_iff' arsinh_zero
#align real.arsinh_eq_zero_iff Real.arsinh_eq_zero_iff
@[simp]
theorem arsinh_nonneg_iff : 0 ≤ arsinh x ↔ 0 ≤ x := by rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
#align real.arsinh_nonneg_iff Real.arsinh_nonneg_iff
@[simp]
theorem arsinh_nonpos_iff : arsinh x ≤ 0 ↔ x ≤ 0 := by rw [← sinh_le_sinh, sinh_zero, sinh_arsinh]
#align real.arsinh_nonpos_iff Real.arsinh_nonpos_iff
@[simp]
theorem arsinh_pos_iff : 0 < arsinh x ↔ 0 < x :=
lt_iff_lt_of_le_iff_le arsinh_nonpos_iff
#align real.arsinh_pos_iff Real.arsinh_pos_iff
@[simp]
theorem arsinh_neg_iff : arsinh x < 0 ↔ x < 0 :=
lt_iff_lt_of_le_iff_le arsinh_nonneg_iff
#align real.arsinh_neg_iff Real.arsinh_neg_iff
| Mathlib/Analysis/SpecialFunctions/Arsinh.lean | 181 | 184 | theorem hasStrictDerivAt_arsinh (x : ℝ) : HasStrictDerivAt arsinh (√(1 + x ^ 2))⁻¹ x := by |
convert sinhHomeomorph.toPartialHomeomorph.hasStrictDerivAt_symm (mem_univ x) (cosh_pos _).ne'
(hasStrictDerivAt_sinh _) using 2
exact (cosh_arsinh _).symm
| 2,142 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 40 | 44 | theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by |
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 48 | 54 | theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by |
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 57 | 69 | theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by |
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 72 | 85 | theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by |
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 88 | 94 | theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by |
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 98 | 110 | theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by |
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
· exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine mul_pos ?_ (zpow_pos_of_pos hx _)
norm_cast
refine int_prod_range_pos (by decide) fun hm => ?_
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
· exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine mul_pos ?_ (zpow_pos_of_pos hx _)
norm_cast
refine int_prod_range_pos (by decide) fun hm => ?_
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
#align strict_convex_on_zpow strictConvexOn_zpow
section SqrtMulLog
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 115 | 119 | theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
HasDerivAt (fun x => √x * log x) ((2 + log x) / (2 * √x)) x := by |
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
one_div, one_div, ← div_eq_inv_mul]
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
· exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine mul_pos ?_ (zpow_pos_of_pos hx _)
norm_cast
refine int_prod_range_pos (by decide) fun hm => ?_
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
#align strict_convex_on_zpow strictConvexOn_zpow
section SqrtMulLog
theorem hasDerivAt_sqrt_mul_log {x : ℝ} (hx : x ≠ 0) :
HasDerivAt (fun x => √x * log x) ((2 + log x) / (2 * √x)) x := by
convert (hasDerivAt_sqrt hx).mul (hasDerivAt_log hx) using 1
rw [add_div, div_mul_cancel_left₀ two_ne_zero, ← div_eq_mul_inv, sqrt_div_self', add_comm,
one_div, one_div, ← div_eq_inv_mul]
#align has_deriv_at_sqrt_mul_log hasDerivAt_sqrt_mul_log
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 122 | 129 | theorem deriv_sqrt_mul_log (x : ℝ) :
deriv (fun x => √x * log x) x = (2 + log x) / (2 * √x) := by |
cases' lt_or_le 0 x with hx hx
· exact (hasDerivAt_sqrt_mul_log hx.ne').deriv
· rw [sqrt_eq_zero_of_nonpos hx, mul_zero, div_zero]
refine HasDerivWithinAt.deriv_eq_zero ?_ (uniqueDiffOn_Iic 0 x hx)
refine (hasDerivWithinAt_const x _ 0).congr_of_mem (fun x hx => ?_) hx
rw [sqrt_eq_zero_of_nonpos hx, zero_mul]
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
· exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine mul_pos ?_ (zpow_pos_of_pos hx _)
norm_cast
refine int_prod_range_pos (by decide) fun hm => ?_
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
#align strict_convex_on_zpow strictConvexOn_zpow
open scoped Real
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 168 | 171 | theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin := by |
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuousOn_sin fun x hx => ?_
rw [interior_Icc] at hx
simp [sin_pos_of_mem_Ioo hx]
| 2,143 |
import Mathlib.Analysis.Calculus.Deriv.ZPow
import Mathlib.Analysis.SpecialFunctions.Sqrt
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
import Mathlib.Analysis.Convex.Deriv
#align_import analysis.convex.specific_functions.deriv from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
open Real Set
open scoped NNReal
theorem strictConvexOn_pow {n : ℕ} (hn : 2 ≤ n) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
apply StrictMonoOn.strictConvexOn_of_deriv (convex_Ici _) (continuousOn_pow _)
rw [deriv_pow', interior_Ici]
exact fun x (hx : 0 < x) y _ hxy => mul_lt_mul_of_pos_left
(pow_lt_pow_left hxy hx.le <| Nat.sub_ne_zero_of_lt hn) (by positivity)
#align strict_convex_on_pow strictConvexOn_pow
theorem Even.strictConvexOn_pow {n : ℕ} (hn : Even n) (h : n ≠ 0) :
StrictConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
apply StrictMono.strictConvexOn_univ_of_deriv (continuous_pow n)
rw [deriv_pow']
replace h := Nat.pos_of_ne_zero h
exact StrictMono.const_mul (Odd.strictMono_pow <| Nat.Even.sub_odd h hn <| Nat.odd_iff.2 rfl)
(Nat.cast_pos.2 h)
#align even.strict_convex_on_pow Even.strictConvexOn_pow
theorem Finset.prod_nonneg_of_card_nonpos_even {α β : Type*} [LinearOrderedCommRing β] {f : α → β}
[DecidablePred fun x => f x ≤ 0] {s : Finset α} (h0 : Even (s.filter fun x => f x ≤ 0).card) :
0 ≤ ∏ x ∈ s, f x :=
calc
0 ≤ ∏ x ∈ s, (if f x ≤ 0 then (-1 : β) else 1) * f x :=
Finset.prod_nonneg fun x _ => by
split_ifs with hx
· simp [hx]
simp? at hx ⊢ says simp only [not_le, one_mul] at hx ⊢
exact le_of_lt hx
_ = _ := by
rw [Finset.prod_mul_distrib, Finset.prod_ite, Finset.prod_const_one, mul_one,
Finset.prod_const, neg_one_pow_eq_pow_mod_two, Nat.even_iff.1 h0, pow_zero, one_mul]
#align finset.prod_nonneg_of_card_nonpos_even Finset.prod_nonneg_of_card_nonpos_even
theorem int_prod_range_nonneg (m : ℤ) (n : ℕ) (hn : Even n) :
0 ≤ ∏ k ∈ Finset.range n, (m - k) := by
rcases hn with ⟨n, rfl⟩
induction' n with n ihn
· simp
rw [← two_mul] at ihn
rw [← two_mul, mul_add, mul_one, ← one_add_one_eq_two, ← add_assoc,
Finset.prod_range_succ, Finset.prod_range_succ, mul_assoc]
refine mul_nonneg ihn ?_; generalize (1 + 1) * n = k
rcases le_or_lt m k with hmk | hmk
· have : m ≤ k + 1 := hmk.trans (lt_add_one (k : ℤ)).le
convert mul_nonneg_of_nonpos_of_nonpos (sub_nonpos_of_le hmk) _
convert sub_nonpos_of_le this
· exact mul_nonneg (sub_nonneg_of_le hmk.le) (sub_nonneg_of_le hmk)
#align int_prod_range_nonneg int_prod_range_nonneg
theorem int_prod_range_pos {m : ℤ} {n : ℕ} (hn : Even n) (hm : m ∉ Ico (0 : ℤ) n) :
0 < ∏ k ∈ Finset.range n, (m - k) := by
refine (int_prod_range_nonneg m n hn).lt_of_ne fun h => hm ?_
rw [eq_comm, Finset.prod_eq_zero_iff] at h
obtain ⟨a, ha, h⟩ := h
rw [sub_eq_zero.1 h]
exact ⟨Int.ofNat_zero_le _, Int.ofNat_lt.2 <| Finset.mem_range.1 ha⟩
#align int_prod_range_pos int_prod_range_pos
theorem strictConvexOn_zpow {m : ℤ} (hm₀ : m ≠ 0) (hm₁ : m ≠ 1) :
StrictConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m := by
apply strictConvexOn_of_deriv2_pos' (convex_Ioi 0)
· exact (continuousOn_zpow₀ m).mono fun x hx => ne_of_gt hx
intro x hx
rw [mem_Ioi] at hx
rw [iter_deriv_zpow]
refine mul_pos ?_ (zpow_pos_of_pos hx _)
norm_cast
refine int_prod_range_pos (by decide) fun hm => ?_
rw [← Finset.coe_Ico] at hm
norm_cast at hm
fin_cases hm <;> simp_all -- Porting note: `simp_all` was `cc`
#align strict_convex_on_zpow strictConvexOn_zpow
open scoped Real
theorem strictConcaveOn_sin_Icc : StrictConcaveOn ℝ (Icc 0 π) sin := by
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuousOn_sin fun x hx => ?_
rw [interior_Icc] at hx
simp [sin_pos_of_mem_Ioo hx]
#align strict_concave_on_sin_Icc strictConcaveOn_sin_Icc
| Mathlib/Analysis/Convex/SpecificFunctions/Deriv.lean | 174 | 177 | theorem strictConcaveOn_cos_Icc : StrictConcaveOn ℝ (Icc (-(π / 2)) (π / 2)) cos := by |
apply strictConcaveOn_of_deriv2_neg (convex_Icc _ _) continuousOn_cos fun x hx => ?_
rw [interior_Icc] at hx
simp [cos_pos_of_mem_Ioo hx]
| 2,143 |
import Mathlib.Data.Nat.Choose.Factorization
import Mathlib.NumberTheory.Primorial
import Mathlib.Analysis.Convex.SpecificFunctions.Basic
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Tactic.NormNum.Prime
#align_import number_theory.bertrand from "leanprover-community/mathlib"@"a16665637b378379689c566204817ae792ac8b39"
section Real
open Real
namespace Bertrand
| Mathlib/NumberTheory/Bertrand.lean | 52 | 102 | theorem real_main_inequality {x : ℝ} (x_large : (512 : ℝ) ≤ x) :
x * (2 * x) ^ √(2 * x) * 4 ^ (2 * x / 3) ≤ 4 ^ x := by |
let f : ℝ → ℝ := fun x => log x + √(2 * x) * log (2 * x) - log 4 / 3 * x
have hf' : ∀ x, 0 < x → 0 < x * (2 * x) ^ √(2 * x) / 4 ^ (x / 3) := fun x h =>
div_pos (mul_pos h (rpow_pos_of_pos (mul_pos two_pos h) _)) (rpow_pos_of_pos four_pos _)
have hf : ∀ x, 0 < x → f x = log (x * (2 * x) ^ √(2 * x) / 4 ^ (x / 3)) := by
intro x h5
have h6 := mul_pos (zero_lt_two' ℝ) h5
have h7 := rpow_pos_of_pos h6 (√(2 * x))
rw [log_div (mul_pos h5 h7).ne' (rpow_pos_of_pos four_pos _).ne', log_mul h5.ne' h7.ne',
log_rpow h6, log_rpow zero_lt_four, ← mul_div_right_comm, ← mul_div, mul_comm x]
have h5 : 0 < x := lt_of_lt_of_le (by norm_num1) x_large
rw [← div_le_one (rpow_pos_of_pos four_pos x), ← div_div_eq_mul_div, ← rpow_sub four_pos, ←
mul_div 2 x, mul_div_left_comm, ← mul_one_sub, (by norm_num1 : (1 : ℝ) - 2 / 3 = 1 / 3),
mul_one_div, ← log_nonpos_iff (hf' x h5), ← hf x h5]
-- porting note (#11083): the proof was rewritten, because it was too slow
have h : ConcaveOn ℝ (Set.Ioi 0.5) f := by
apply ConcaveOn.sub
· apply ConcaveOn.add
· exact strictConcaveOn_log_Ioi.concaveOn.subset
(Set.Ioi_subset_Ioi (by norm_num)) (convex_Ioi 0.5)
convert ((strictConcaveOn_sqrt_mul_log_Ioi.concaveOn.comp_linearMap
((2 : ℝ) • LinearMap.id))) using 1
ext x
simp only [Set.mem_Ioi, Set.mem_preimage, LinearMap.smul_apply,
LinearMap.id_coe, id_eq, smul_eq_mul]
rw [← mul_lt_mul_left (two_pos)]
norm_num1
rfl
apply ConvexOn.smul
· refine div_nonneg (log_nonneg (by norm_num1)) (by norm_num1)
· exact convexOn_id (convex_Ioi (0.5 : ℝ))
suffices ∃ x1 x2, 0.5 < x1 ∧ x1 < x2 ∧ x2 ≤ x ∧ 0 ≤ f x1 ∧ f x2 ≤ 0 by
obtain ⟨x1, x2, h1, h2, h0, h3, h4⟩ := this
exact (h.right_le_of_le_left'' h1 ((h1.trans h2).trans_le h0) h2 h0 (h4.trans h3)).trans h4
refine ⟨18, 512, by norm_num1, by norm_num1, x_large, ?_, ?_⟩
· have : √(2 * 18 : ℝ) = 6 := (sqrt_eq_iff_mul_self_eq_of_pos (by norm_num1)).mpr (by norm_num1)
rw [hf _ (by norm_num1), log_nonneg_iff (by positivity), this, one_le_div (by norm_num1)]
norm_num1
· have : √(2 * 512) = 32 :=
(sqrt_eq_iff_mul_self_eq_of_pos (by norm_num1)).mpr (by norm_num1)
rw [hf _ (by norm_num1), log_nonpos_iff (hf' _ (by norm_num1)), this,
div_le_one (by positivity)]
conv in 512 => equals 2 ^ 9 => norm_num1
conv in 2 * 512 => equals 2 ^ 10 => norm_num1
conv in 32 => rw [← Nat.cast_ofNat]
rw [rpow_natCast, ← pow_mul, ← pow_add]
conv in 4 => equals 2 ^ (2 : ℝ) => rw [rpow_two]; norm_num1
rw [← rpow_mul, ← rpow_natCast]
on_goal 1 => apply rpow_le_rpow_of_exponent_le
all_goals norm_num1
| 2,144 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 32 | 40 | theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by |
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 43 | 44 | theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by |
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 47 | 57 | theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by |
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 60 | 61 | theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by |
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 69 | 72 | theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by |
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 75 | 76 | theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by |
rw [← not_exists, not_iff_not, tan_eq_zero_iff]
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by
rw [← not_exists, not_iff_not, tan_eq_zero_iff]
#align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 87 | 88 | theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by |
simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm]
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by
rw [← not_exists, not_iff_not, tan_eq_zero_iff]
#align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two
theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by
simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 90 | 101 | theorem cos_eq_cos_iff {x y : ℂ} : cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x :=
calc
cos x = cos y ↔ cos x - cos y = 0 := sub_eq_zero.symm
_ ↔ -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by | rw [cos_sub_cos]
_ ↔ sin ((x + y) / 2) = 0 ∨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : ℂ) ≠ 0)]
_ ↔ sin ((x - y) / 2) = 0 ∨ sin ((x + y) / 2) = 0 := or_comm
_ ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ ∃ k : ℤ, y = 2 * k * π - x := by
apply or_congr <;>
field_simp [sin_eq_zero_iff, (by norm_num : -(2 : ℂ) ≠ 0), eq_sub_iff_add_eq',
sub_eq_iff_eq_add, mul_comm (2 : ℂ), mul_right_comm _ (2 : ℂ)]
constructor <;> · rintro ⟨k, rfl⟩; use -k; simp
_ ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := exists_or.symm
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by
rw [← not_exists, not_iff_not, tan_eq_zero_iff]
#align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two
theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by
simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm]
theorem cos_eq_cos_iff {x y : ℂ} : cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x :=
calc
cos x = cos y ↔ cos x - cos y = 0 := sub_eq_zero.symm
_ ↔ -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by rw [cos_sub_cos]
_ ↔ sin ((x + y) / 2) = 0 ∨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : ℂ) ≠ 0)]
_ ↔ sin ((x - y) / 2) = 0 ∨ sin ((x + y) / 2) = 0 := or_comm
_ ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ ∃ k : ℤ, y = 2 * k * π - x := by
apply or_congr <;>
field_simp [sin_eq_zero_iff, (by norm_num : -(2 : ℂ) ≠ 0), eq_sub_iff_add_eq',
sub_eq_iff_eq_add, mul_comm (2 : ℂ), mul_right_comm _ (2 : ℂ)]
constructor <;> · rintro ⟨k, rfl⟩; use -k; simp
_ ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := exists_or.symm
#align complex.cos_eq_cos_iff Complex.cos_eq_cos_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 104 | 107 | theorem sin_eq_sin_iff {x y : ℂ} :
sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1) * π - x := by |
simp only [← Complex.cos_sub_pi_div_two, cos_eq_cos_iff, sub_eq_iff_eq_add]
refine exists_congr fun k => or_congr ?_ ?_ <;> refine Eq.congr rfl ?_ <;> field_simp <;> ring
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by
rw [← not_exists, not_iff_not, tan_eq_zero_iff]
#align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two
theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by
simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm]
theorem cos_eq_cos_iff {x y : ℂ} : cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x :=
calc
cos x = cos y ↔ cos x - cos y = 0 := sub_eq_zero.symm
_ ↔ -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by rw [cos_sub_cos]
_ ↔ sin ((x + y) / 2) = 0 ∨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : ℂ) ≠ 0)]
_ ↔ sin ((x - y) / 2) = 0 ∨ sin ((x + y) / 2) = 0 := or_comm
_ ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ ∃ k : ℤ, y = 2 * k * π - x := by
apply or_congr <;>
field_simp [sin_eq_zero_iff, (by norm_num : -(2 : ℂ) ≠ 0), eq_sub_iff_add_eq',
sub_eq_iff_eq_add, mul_comm (2 : ℂ), mul_right_comm _ (2 : ℂ)]
constructor <;> · rintro ⟨k, rfl⟩; use -k; simp
_ ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := exists_or.symm
#align complex.cos_eq_cos_iff Complex.cos_eq_cos_iff
theorem sin_eq_sin_iff {x y : ℂ} :
sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1) * π - x := by
simp only [← Complex.cos_sub_pi_div_two, cos_eq_cos_iff, sub_eq_iff_eq_add]
refine exists_congr fun k => or_congr ?_ ?_ <;> refine Eq.congr rfl ?_ <;> field_simp <;> ring
#align complex.sin_eq_sin_iff Complex.sin_eq_sin_iff
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 110 | 112 | theorem cos_eq_one_iff {x : ℂ} : cos x = 1 ↔ ∃ k : ℤ, k * (2 * π) = x := by |
rw [← cos_zero, eq_comm, cos_eq_cos_iff]
simp [mul_assoc, mul_left_comm, eq_comm]
| 2,145 |
import Mathlib.Algebra.QuadraticDiscriminant
import Mathlib.Analysis.Convex.SpecificFunctions.Deriv
import Mathlib.Analysis.SpecialFunctions.Pow.Complex
#align_import analysis.special_functions.trigonometric.complex from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem cos_eq_zero_iff {θ : ℂ} : cos θ = 0 ↔ ∃ k : ℤ, θ = (2 * k + 1) * π / 2 := by
have h : (exp (θ * I) + exp (-θ * I)) / 2 = 0 ↔ exp (2 * θ * I) = -1 := by
rw [@div_eq_iff _ _ (exp (θ * I) + exp (-θ * I)) 2 0 two_ne_zero, zero_mul,
add_eq_zero_iff_eq_neg, neg_eq_neg_one_mul, ← div_eq_iff (exp_ne_zero _), ← exp_sub]
ring_nf
rw [cos, h, ← exp_pi_mul_I, exp_eq_exp_iff_exists_int, mul_right_comm]
refine exists_congr fun x => ?_
refine (iff_of_eq <| congr_arg _ ?_).trans (mul_right_inj' <| mul_ne_zero two_ne_zero I_ne_zero)
field_simp; ring
#align complex.cos_eq_zero_iff Complex.cos_eq_zero_iff
theorem cos_ne_zero_iff {θ : ℂ} : cos θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ (2 * k + 1) * π / 2 := by
rw [← not_exists, not_iff_not, cos_eq_zero_iff]
#align complex.cos_ne_zero_iff Complex.cos_ne_zero_iff
theorem sin_eq_zero_iff {θ : ℂ} : sin θ = 0 ↔ ∃ k : ℤ, θ = k * π := by
rw [← Complex.cos_sub_pi_div_two, cos_eq_zero_iff]
constructor
· rintro ⟨k, hk⟩
use k + 1
field_simp [eq_add_of_sub_eq hk]
ring
· rintro ⟨k, rfl⟩
use k - 1
field_simp
ring
#align complex.sin_eq_zero_iff Complex.sin_eq_zero_iff
theorem sin_ne_zero_iff {θ : ℂ} : sin θ ≠ 0 ↔ ∀ k : ℤ, θ ≠ k * π := by
rw [← not_exists, not_iff_not, sin_eq_zero_iff]
#align complex.sin_ne_zero_iff Complex.sin_ne_zero_iff
theorem tan_eq_zero_iff {θ : ℂ} : tan θ = 0 ↔ ∃ k : ℤ, k * π / 2 = θ := by
rw [tan, div_eq_zero_iff, ← mul_eq_zero, ← mul_right_inj' two_ne_zero, mul_zero,
← mul_assoc, ← sin_two_mul, sin_eq_zero_iff]
field_simp [mul_comm, eq_comm]
#align complex.tan_eq_zero_iff Complex.tan_eq_zero_iff
theorem tan_ne_zero_iff {θ : ℂ} : tan θ ≠ 0 ↔ ∀ k : ℤ, (k * π / 2 : ℂ) ≠ θ := by
rw [← not_exists, not_iff_not, tan_eq_zero_iff]
#align complex.tan_ne_zero_iff Complex.tan_ne_zero_iff
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align complex.tan_int_mul_pi_div_two Complex.tan_int_mul_pi_div_two
theorem tan_eq_zero_iff' {θ : ℂ} (hθ : cos θ ≠ 0) : tan θ = 0 ↔ ∃ k : ℤ, k * π = θ := by
simp only [tan, hθ, div_eq_zero_iff, sin_eq_zero_iff]; simp [eq_comm]
theorem cos_eq_cos_iff {x y : ℂ} : cos x = cos y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x :=
calc
cos x = cos y ↔ cos x - cos y = 0 := sub_eq_zero.symm
_ ↔ -2 * sin ((x + y) / 2) * sin ((x - y) / 2) = 0 := by rw [cos_sub_cos]
_ ↔ sin ((x + y) / 2) = 0 ∨ sin ((x - y) / 2) = 0 := by simp [(by norm_num : (2 : ℂ) ≠ 0)]
_ ↔ sin ((x - y) / 2) = 0 ∨ sin ((x + y) / 2) = 0 := or_comm
_ ↔ (∃ k : ℤ, y = 2 * k * π + x) ∨ ∃ k : ℤ, y = 2 * k * π - x := by
apply or_congr <;>
field_simp [sin_eq_zero_iff, (by norm_num : -(2 : ℂ) ≠ 0), eq_sub_iff_add_eq',
sub_eq_iff_eq_add, mul_comm (2 : ℂ), mul_right_comm _ (2 : ℂ)]
constructor <;> · rintro ⟨k, rfl⟩; use -k; simp
_ ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = 2 * k * π - x := exists_or.symm
#align complex.cos_eq_cos_iff Complex.cos_eq_cos_iff
theorem sin_eq_sin_iff {x y : ℂ} :
sin x = sin y ↔ ∃ k : ℤ, y = 2 * k * π + x ∨ y = (2 * k + 1) * π - x := by
simp only [← Complex.cos_sub_pi_div_two, cos_eq_cos_iff, sub_eq_iff_eq_add]
refine exists_congr fun k => or_congr ?_ ?_ <;> refine Eq.congr rfl ?_ <;> field_simp <;> ring
#align complex.sin_eq_sin_iff Complex.sin_eq_sin_iff
theorem cos_eq_one_iff {x : ℂ} : cos x = 1 ↔ ∃ k : ℤ, k * (2 * π) = x := by
rw [← cos_zero, eq_comm, cos_eq_cos_iff]
simp [mul_assoc, mul_left_comm, eq_comm]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Complex.lean | 114 | 116 | theorem cos_eq_neg_one_iff {x : ℂ} : cos x = -1 ↔ ∃ k : ℤ, π + k * (2 * π) = x := by |
rw [← neg_eq_iff_eq_neg, ← cos_sub_pi, cos_eq_one_iff]
simp only [eq_sub_iff_add_eq']
| 2,145 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Real
open Set Filter
open scoped Topology Real
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean | 32 | 38 | theorem tan_add {x y : ℝ}
(h : ((∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) ∨
(∃ k : ℤ, x = (2 * k + 1) * π / 2) ∧ ∃ l : ℤ, y = (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by |
simpa only [← Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div,
Complex.ofReal_mul, Complex.ofReal_tan] using
@Complex.tan_add (x : ℂ) (y : ℂ) (by convert h <;> norm_cast)
| 2,146 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Real
open Set Filter
open scoped Topology Real
theorem tan_add {x y : ℝ}
(h : ((∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) ∨
(∃ k : ℤ, x = (2 * k + 1) * π / 2) ∧ ∃ l : ℤ, y = (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by
simpa only [← Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div,
Complex.ofReal_mul, Complex.ofReal_tan] using
@Complex.tan_add (x : ℂ) (y : ℂ) (by convert h <;> norm_cast)
#align real.tan_add Real.tan_add
theorem tan_add' {x y : ℝ}
(h : (∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) :=
tan_add (Or.inl h)
#align real.tan_add' Real.tan_add'
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean | 47 | 49 | theorem tan_two_mul {x : ℝ} : tan (2 * x) = 2 * tan x / (1 - tan x ^ 2) := by |
have := @Complex.tan_two_mul x
norm_cast at *
| 2,146 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Real
open Set Filter
open scoped Topology Real
theorem tan_add {x y : ℝ}
(h : ((∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) ∨
(∃ k : ℤ, x = (2 * k + 1) * π / 2) ∧ ∃ l : ℤ, y = (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by
simpa only [← Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div,
Complex.ofReal_mul, Complex.ofReal_tan] using
@Complex.tan_add (x : ℂ) (y : ℂ) (by convert h <;> norm_cast)
#align real.tan_add Real.tan_add
theorem tan_add' {x y : ℝ}
(h : (∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) :=
tan_add (Or.inl h)
#align real.tan_add' Real.tan_add'
theorem tan_two_mul {x : ℝ} : tan (2 * x) = 2 * tan x / (1 - tan x ^ 2) := by
have := @Complex.tan_two_mul x
norm_cast at *
#align real.tan_two_mul Real.tan_two_mul
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align real.tan_int_mul_pi_div_two Real.tan_int_mul_pi_div_two
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean | 56 | 60 | theorem continuousOn_tan : ContinuousOn tan {x | cos x ≠ 0} := by |
suffices ContinuousOn (fun x => sin x / cos x) {x | cos x ≠ 0} by
have h_eq : (fun x => sin x / cos x) = tan := by ext1 x; rw [tan_eq_sin_div_cos]
rwa [h_eq] at this
exact continuousOn_sin.div continuousOn_cos fun x => id
| 2,146 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Real
open Set Filter
open scoped Topology Real
theorem tan_add {x y : ℝ}
(h : ((∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) ∨
(∃ k : ℤ, x = (2 * k + 1) * π / 2) ∧ ∃ l : ℤ, y = (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by
simpa only [← Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div,
Complex.ofReal_mul, Complex.ofReal_tan] using
@Complex.tan_add (x : ℂ) (y : ℂ) (by convert h <;> norm_cast)
#align real.tan_add Real.tan_add
theorem tan_add' {x y : ℝ}
(h : (∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) :=
tan_add (Or.inl h)
#align real.tan_add' Real.tan_add'
theorem tan_two_mul {x : ℝ} : tan (2 * x) = 2 * tan x / (1 - tan x ^ 2) := by
have := @Complex.tan_two_mul x
norm_cast at *
#align real.tan_two_mul Real.tan_two_mul
theorem tan_int_mul_pi_div_two (n : ℤ) : tan (n * π / 2) = 0 :=
tan_eq_zero_iff.mpr (by use n)
#align real.tan_int_mul_pi_div_two Real.tan_int_mul_pi_div_two
theorem continuousOn_tan : ContinuousOn tan {x | cos x ≠ 0} := by
suffices ContinuousOn (fun x => sin x / cos x) {x | cos x ≠ 0} by
have h_eq : (fun x => sin x / cos x) = tan := by ext1 x; rw [tan_eq_sin_div_cos]
rwa [h_eq] at this
exact continuousOn_sin.div continuousOn_cos fun x => id
#align real.continuous_on_tan Real.continuousOn_tan
@[continuity]
theorem continuous_tan : Continuous fun x : {x | cos x ≠ 0} => tan x :=
continuousOn_iff_continuous_restrict.1 continuousOn_tan
#align real.continuous_tan Real.continuous_tan
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean | 68 | 86 | theorem continuousOn_tan_Ioo : ContinuousOn tan (Ioo (-(π / 2)) (π / 2)) := by |
refine ContinuousOn.mono continuousOn_tan fun x => ?_
simp only [and_imp, mem_Ioo, mem_setOf_eq, Ne]
rw [cos_eq_zero_iff]
rintro hx_gt hx_lt ⟨r, hxr_eq⟩
rcases le_or_lt 0 r with h | h
· rw [lt_iff_not_ge] at hx_lt
refine hx_lt ?_
rw [hxr_eq, ← one_mul (π / 2), mul_div_assoc, ge_iff_le, mul_le_mul_right (half_pos pi_pos)]
simp [h]
· rw [lt_iff_not_ge] at hx_gt
refine hx_gt ?_
rw [hxr_eq, ← one_mul (π / 2), mul_div_assoc, ge_iff_le, neg_mul_eq_neg_mul,
mul_le_mul_right (half_pos pi_pos)]
have hr_le : r ≤ -1 := by rwa [Int.lt_iff_add_one_le, ← le_neg_iff_add_nonpos_right] at h
rw [← le_sub_iff_add_le, mul_comm, ← le_div_iff]
· set_option tactic.skipAssignedInstances false in norm_num
rw [← Int.cast_one, ← Int.cast_neg]; norm_cast
· exact zero_lt_two
| 2,146 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace InnerProductGeometry
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 43 | 46 | theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by |
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
| 2,147 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace InnerProductGeometry
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_add_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq'
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 56 | 59 | theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by |
rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
| 2,147 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace InnerProductGeometry
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_add_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq'
theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_sub_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq'
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 69 | 73 | theorem angle_add_eq_arccos_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) :
angle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by |
rw [angle, inner_add_right, h, add_zero, real_inner_self_eq_norm_mul_norm]
by_cases hx : ‖x‖ = 0; · simp [hx]
rw [div_mul_eq_div_div, mul_self_div_self]
| 2,147 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace InnerProductGeometry
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_add_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq'
theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_sub_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq'
theorem angle_add_eq_arccos_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) :
angle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by
rw [angle, inner_add_right, h, add_zero, real_inner_self_eq_norm_mul_norm]
by_cases hx : ‖x‖ = 0; · simp [hx]
rw [div_mul_eq_div_div, mul_self_div_self]
#align inner_product_geometry.angle_add_eq_arccos_of_inner_eq_zero InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 77 | 91 | theorem angle_add_eq_arcsin_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x ≠ 0 ∨ y ≠ 0) :
angle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖) := by |
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))
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]
nth_rw 1 [pow_two]
rw [norm_add_sq_eq_norm_sq_add_norm_sq_real h, pow_two, add_sub_cancel_left, ← pow_two, ← div_pow,
Real.sqrt_sq (div_nonneg (norm_nonneg _) (norm_nonneg _))]
| 2,147 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace InnerProductGeometry
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_add_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq'
theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_sub_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq'
theorem angle_add_eq_arccos_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) :
angle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by
rw [angle, inner_add_right, h, add_zero, real_inner_self_eq_norm_mul_norm]
by_cases hx : ‖x‖ = 0; · simp [hx]
rw [div_mul_eq_div_div, mul_self_div_self]
#align inner_product_geometry.angle_add_eq_arccos_of_inner_eq_zero InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero
theorem angle_add_eq_arcsin_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x ≠ 0 ∨ y ≠ 0) :
angle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖) := by
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))
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]
nth_rw 1 [pow_two]
rw [norm_add_sq_eq_norm_sq_add_norm_sq_real h, pow_two, add_sub_cancel_left, ← pow_two, ← div_pow,
Real.sqrt_sq (div_nonneg (norm_nonneg _) (norm_nonneg _))]
#align inner_product_geometry.angle_add_eq_arcsin_of_inner_eq_zero InnerProductGeometry.angle_add_eq_arcsin_of_inner_eq_zero
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 95 | 101 | theorem angle_add_eq_arctan_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x ≠ 0) :
angle x (x + y) = Real.arctan (‖y‖ / ‖x‖) := by |
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]
nth_rw 3 [← Real.sqrt_sq (norm_nonneg x)]
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]
| 2,147 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan
import Mathlib.Geometry.Euclidean.Angle.Unoriented.Affine
#align_import geometry.euclidean.angle.unoriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace InnerProductGeometry
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
theorem norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_add_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_add_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x + y‖ * ‖x + y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_add_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_add_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_add_sq_eq_norm_sq_add_norm_sq'
theorem norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two (x y : V) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ ↔ angle x y = π / 2 := by
rw [norm_sub_sq_eq_norm_sq_add_norm_sq_iff_real_inner_eq_zero]
exact inner_eq_zero_iff_angle_eq_pi_div_two x y
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two
theorem norm_sub_sq_eq_norm_sq_add_norm_sq' (x y : V) (h : angle x y = π / 2) :
‖x - y‖ * ‖x - y‖ = ‖x‖ * ‖x‖ + ‖y‖ * ‖y‖ :=
(norm_sub_sq_eq_norm_sq_add_norm_sq_iff_angle_eq_pi_div_two x y).2 h
#align inner_product_geometry.norm_sub_sq_eq_norm_sq_add_norm_sq' InnerProductGeometry.norm_sub_sq_eq_norm_sq_add_norm_sq'
theorem angle_add_eq_arccos_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) :
angle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by
rw [angle, inner_add_right, h, add_zero, real_inner_self_eq_norm_mul_norm]
by_cases hx : ‖x‖ = 0; · simp [hx]
rw [div_mul_eq_div_div, mul_self_div_self]
#align inner_product_geometry.angle_add_eq_arccos_of_inner_eq_zero InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero
theorem angle_add_eq_arcsin_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x ≠ 0 ∨ y ≠ 0) :
angle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖) := by
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))
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]
nth_rw 1 [pow_two]
rw [norm_add_sq_eq_norm_sq_add_norm_sq_real h, pow_two, add_sub_cancel_left, ← pow_two, ← div_pow,
Real.sqrt_sq (div_nonneg (norm_nonneg _) (norm_nonneg _))]
#align inner_product_geometry.angle_add_eq_arcsin_of_inner_eq_zero InnerProductGeometry.angle_add_eq_arcsin_of_inner_eq_zero
theorem angle_add_eq_arctan_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x ≠ 0) :
angle x (x + y) = Real.arctan (‖y‖ / ‖x‖) := by
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]
nth_rw 3 [← Real.sqrt_sq (norm_nonneg x)]
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]
#align inner_product_geometry.angle_add_eq_arctan_of_inner_eq_zero InnerProductGeometry.angle_add_eq_arctan_of_inner_eq_zero
| Mathlib/Geometry/Euclidean/Angle/Unoriented/RightAngle.lean | 105 | 112 | theorem angle_add_pos_of_inner_eq_zero {x y : V} (h : ⟪x, y⟫ = 0) (h0 : x = 0 ∨ y ≠ 0) :
0 < angle x (x + y) := by |
rw [angle_add_eq_arccos_of_inner_eq_zero h, Real.arccos_pos,
norm_add_eq_sqrt_iff_real_inner_eq_zero.2 h]
by_cases hx : x = 0; · simp [hx]
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]
simpa [hx] using h0
| 2,147 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.complex_deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
| Mathlib/Analysis/SpecialFunctions/Trigonometric/ComplexDeriv.lean | 25 | 28 | theorem hasStrictDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasStrictDerivAt tan (1 / cos x ^ 2) x := by |
convert (hasStrictDerivAt_sin x).div (hasStrictDerivAt_cos x) h using 1
rw_mod_cast [← sin_sq_add_cos_sq x]
ring
| 2,148 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.complex_deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem hasStrictDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasStrictDerivAt tan (1 / cos x ^ 2) x := by
convert (hasStrictDerivAt_sin x).div (hasStrictDerivAt_cos x) h using 1
rw_mod_cast [← sin_sq_add_cos_sq x]
ring
#align complex.has_strict_deriv_at_tan Complex.hasStrictDerivAt_tan
theorem hasDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasDerivAt tan (1 / cos x ^ 2) x :=
(hasStrictDerivAt_tan h).hasDerivAt
#align complex.has_deriv_at_tan Complex.hasDerivAt_tan
open scoped Topology
| Mathlib/Analysis/SpecialFunctions/Trigonometric/ComplexDeriv.lean | 37 | 44 | theorem tendsto_abs_tan_of_cos_eq_zero {x : ℂ} (hx : cos x = 0) :
Tendsto (fun x => abs (tan x)) (𝓝[≠] x) atTop := by |
simp only [tan_eq_sin_div_cos, ← norm_eq_abs, norm_div]
have A : sin x ≠ 0 := fun h => by simpa [*, sq] using sin_sq_add_cos_sq x
have B : Tendsto cos (𝓝[≠] x) (𝓝[≠] 0) :=
hx ▸ (hasDerivAt_cos x).tendsto_punctured_nhds (neg_ne_zero.2 A)
exact continuous_sin.continuousWithinAt.norm.mul_atTop (norm_pos_iff.2 A)
(tendsto_norm_nhdsWithin_zero.comp B).inv_tendsto_zero
| 2,148 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.complex_deriv from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
noncomputable section
namespace Complex
open Set Filter
open scoped Real
theorem hasStrictDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasStrictDerivAt tan (1 / cos x ^ 2) x := by
convert (hasStrictDerivAt_sin x).div (hasStrictDerivAt_cos x) h using 1
rw_mod_cast [← sin_sq_add_cos_sq x]
ring
#align complex.has_strict_deriv_at_tan Complex.hasStrictDerivAt_tan
theorem hasDerivAt_tan {x : ℂ} (h : cos x ≠ 0) : HasDerivAt tan (1 / cos x ^ 2) x :=
(hasStrictDerivAt_tan h).hasDerivAt
#align complex.has_deriv_at_tan Complex.hasDerivAt_tan
open scoped Topology
theorem tendsto_abs_tan_of_cos_eq_zero {x : ℂ} (hx : cos x = 0) :
Tendsto (fun x => abs (tan x)) (𝓝[≠] x) atTop := by
simp only [tan_eq_sin_div_cos, ← norm_eq_abs, norm_div]
have A : sin x ≠ 0 := fun h => by simpa [*, sq] using sin_sq_add_cos_sq x
have B : Tendsto cos (𝓝[≠] x) (𝓝[≠] 0) :=
hx ▸ (hasDerivAt_cos x).tendsto_punctured_nhds (neg_ne_zero.2 A)
exact continuous_sin.continuousWithinAt.norm.mul_atTop (norm_pos_iff.2 A)
(tendsto_norm_nhdsWithin_zero.comp B).inv_tendsto_zero
#align complex.tendsto_abs_tan_of_cos_eq_zero Complex.tendsto_abs_tan_of_cos_eq_zero
theorem tendsto_abs_tan_atTop (k : ℤ) :
Tendsto (fun x => abs (tan x)) (𝓝[≠] ((2 * k + 1) * π / 2 : ℂ)) atTop :=
tendsto_abs_tan_of_cos_eq_zero <| cos_eq_zero_iff.2 ⟨k, rfl⟩
#align complex.tendsto_abs_tan_at_top Complex.tendsto_abs_tan_atTop
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/ComplexDeriv.lean | 53 | 56 | theorem continuousAt_tan {x : ℂ} : ContinuousAt tan x ↔ cos x ≠ 0 := by |
refine ⟨fun hc h₀ => ?_, fun h => (hasDerivAt_tan h).continuousAt⟩
exact not_tendsto_nhds_of_tendsto_atTop (tendsto_abs_tan_of_cos_eq_zero h₀) _
(hc.norm.tendsto.mono_left inf_le_left)
| 2,148 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 30 | 49 | theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by |
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
| 2,149 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 66 | 71 | theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by |
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
| 2,149 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 74 | 79 | theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by |
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
| 2,149 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 82 | 90 | theorem differentiableWithinAt_arcsin_Ici {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by |
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩
rintro h rfl
have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by
filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using
sin_arcsin'
have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp)
simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
| 2,149 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
theorem differentiableWithinAt_arcsin_Ici {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩
rintro h rfl
have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by
filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using
sin_arcsin'
have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp)
simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
#align real.differentiable_within_at_arcsin_Ici Real.differentiableWithinAt_arcsin_Ici
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 93 | 98 | theorem differentiableWithinAt_arcsin_Iic {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Iic x) x ↔ x ≠ 1 := by |
refine ⟨fun h => ?_, fun h => (hasDerivWithinAt_arcsin_Iic h).differentiableWithinAt⟩
rw [← neg_neg x, ← image_neg_Ici] at h
have := (h.comp (-x) differentiableWithinAt_id.neg (mapsTo_image _ _)).neg
simpa [(· ∘ ·), differentiableWithinAt_arcsin_Ici] using this
| 2,149 |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Ici Real.hasDerivWithinAt_arcsin_Ici
theorem hasDerivWithinAt_arcsin_Iic {x : ℝ} (h : x ≠ 1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Iic x) x := by
rcases em (x = -1) with (rfl | h')
· convert (hasDerivWithinAt_const (-1 : ℝ) _ (-(π / 2))).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_le_neg_one]
· exact (hasDerivAt_arcsin h' h).hasDerivWithinAt
#align real.has_deriv_within_at_arcsin_Iic Real.hasDerivWithinAt_arcsin_Iic
theorem differentiableWithinAt_arcsin_Ici {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Ici x) x ↔ x ≠ -1 := by
refine ⟨?_, fun h => (hasDerivWithinAt_arcsin_Ici h).differentiableWithinAt⟩
rintro h rfl
have : sin ∘ arcsin =ᶠ[𝓝[≥] (-1 : ℝ)] id := by
filter_upwards [Icc_mem_nhdsWithin_Ici ⟨le_rfl, neg_lt_self (zero_lt_one' ℝ)⟩] with x using
sin_arcsin'
have := h.hasDerivWithinAt.sin.congr_of_eventuallyEq this.symm (by simp)
simpa using (uniqueDiffOn_Ici _ _ left_mem_Ici).eq_deriv _ this (hasDerivWithinAt_id _ _)
#align real.differentiable_within_at_arcsin_Ici Real.differentiableWithinAt_arcsin_Ici
theorem differentiableWithinAt_arcsin_Iic {x : ℝ} :
DifferentiableWithinAt ℝ arcsin (Iic x) x ↔ x ≠ 1 := by
refine ⟨fun h => ?_, fun h => (hasDerivWithinAt_arcsin_Iic h).differentiableWithinAt⟩
rw [← neg_neg x, ← image_neg_Ici] at h
have := (h.comp (-x) differentiableWithinAt_id.neg (mapsTo_image _ _)).neg
simpa [(· ∘ ·), differentiableWithinAt_arcsin_Ici] using this
#align real.differentiable_within_at_arcsin_Iic Real.differentiableWithinAt_arcsin_Iic
theorem differentiableAt_arcsin {x : ℝ} : DifferentiableAt ℝ arcsin x ↔ x ≠ -1 ∧ x ≠ 1 :=
⟨fun h => ⟨differentiableWithinAt_arcsin_Ici.1 h.differentiableWithinAt,
differentiableWithinAt_arcsin_Iic.1 h.differentiableWithinAt⟩,
fun h => (hasDerivAt_arcsin h.1 h.2).differentiableAt⟩
#align real.differentiable_at_arcsin Real.differentiableAt_arcsin
@[simp]
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 108 | 114 | theorem deriv_arcsin : deriv arcsin = fun x => 1 / √(1 - x ^ 2) := by |
funext x
by_cases h : x ≠ -1 ∧ x ≠ 1
· exact (hasDerivAt_arcsin h.1 h.2).deriv
· rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_arcsin.1 h)]
simp only [not_and_or, Ne, Classical.not_not] at h
rcases h with (rfl | rfl) <;> simp
| 2,149 |
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.NormedSpace.RCLike
import Mathlib.Order.Filter.Curry
#align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Filter
open scoped uniformity Filter Topology
section LimitsOfDerivatives
variable {ι : Type*} {l : Filter ι} {E : Type*} [NormedAddCommGroup E] {𝕜 : Type*} [RCLike 𝕜]
[NormedSpace 𝕜 E] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {f : ι → E → G}
{g : E → G} {f' : ι → E → E →L[𝕜] G} {g' : E → E →L[𝕜] G} {x : E}
| Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean | 112 | 163 | theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (𝓝 x))
(hf : ∀ᶠ n : ι × E in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2)
(hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (𝓝 x) := by |
letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _
rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero] at hf' ⊢
suffices
TendstoUniformlyOnFilter (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0
(l ×ˢ l) (𝓝 x) ∧
TendstoUniformlyOnFilter (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (𝓝 x) by
have := this.1.add this.2
rw [add_zero] at this
exact this.congr (by simp)
constructor
· -- This inequality follows from the mean value theorem. To apply it, we will need to shrink our
-- neighborhood to small enough ball
rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢
intro ε hε
have := (tendsto_swap4_prod.eventually (hf.prod_mk hf)).diag_of_prod_right
obtain ⟨a, b, c, d, e⟩ := eventually_prod_iff.1 ((hf' ε hε).and this)
obtain ⟨R, hR, hR'⟩ := Metric.nhds_basis_ball.eventually_iff.mp d
let r := min 1 R
have hr : 0 < r := by simp [r, hR]
have hr' : ∀ ⦃y : E⦄, y ∈ Metric.ball x r → c y := fun y hy =>
hR' (lt_of_lt_of_le (Metric.mem_ball.mp hy) (min_le_right _ _))
have hxy : ∀ y : E, y ∈ Metric.ball x r → ‖y - x‖ < 1 := by
intro y hy
rw [Metric.mem_ball, dist_eq_norm] at hy
exact lt_of_lt_of_le hy (min_le_left _ _)
have hxyε : ∀ y : E, y ∈ Metric.ball x r → ε * ‖y - x‖ < ε := by
intro y hy
exact (mul_lt_iff_lt_one_right hε.lt).mpr (hxy y hy)
-- With a small ball in hand, apply the mean value theorem
refine
eventually_prod_iff.mpr
⟨_, b, fun e : E => Metric.ball x r e,
eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩
simp only [Pi.zero_apply, dist_zero_left] at e ⊢
refine lt_of_le_of_lt ?_ (hxyε y hy)
exact
Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le
(fun y hy => ((e hn (hr' hy)).2.1.sub (e hn (hr' hy)).2.2).hasFDerivWithinAt)
(fun y hy => (e hn (hr' hy)).1.le) (convex_ball x r) (Metric.mem_ball_self hr) hy
· -- This is just `hfg` run through `eventually_prod_iff`
refine Metric.tendstoUniformlyOnFilter_iff.mpr fun ε hε => ?_
obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε
exact
eventually_prod_iff.mpr
⟨fun n : ι × ι => f n.1 x ∈ t ∧ f n.2 x ∈ t,
eventually_prod_iff.mpr ⟨_, ht, _, ht, fun {n} hn {n'} hn' => ⟨hn, hn'⟩⟩,
fun _ => True,
by simp,
fun {n} hn {y} _ => by simpa [norm_sub_rev, dist_eq_norm] using ht' _ hn.1 _ hn.2⟩
| 2,150 |
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.NormedSpace.RCLike
import Mathlib.Order.Filter.Curry
#align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Filter
open scoped uniformity Filter Topology
section LimitsOfDerivatives
variable {ι : Type*} {l : Filter ι} {E : Type*} [NormedAddCommGroup E] {𝕜 : Type*} [RCLike 𝕜]
[NormedSpace 𝕜 E] {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G] {f : ι → E → G}
{g : E → G} {f' : ι → E → E →L[𝕜] G} {g' : E → E →L[𝕜] G} {x : E}
theorem uniformCauchySeqOnFilter_of_fderiv (hf' : UniformCauchySeqOnFilter f' l (𝓝 x))
(hf : ∀ᶠ n : ι × E in l ×ˢ 𝓝 x, HasFDerivAt (f n.1) (f' n.1 n.2) n.2)
(hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOnFilter f l (𝓝 x) := by
letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _
rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero] at hf' ⊢
suffices
TendstoUniformlyOnFilter (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0
(l ×ˢ l) (𝓝 x) ∧
TendstoUniformlyOnFilter (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0 (l ×ˢ l) (𝓝 x) by
have := this.1.add this.2
rw [add_zero] at this
exact this.congr (by simp)
constructor
· -- This inequality follows from the mean value theorem. To apply it, we will need to shrink our
-- neighborhood to small enough ball
rw [Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢
intro ε hε
have := (tendsto_swap4_prod.eventually (hf.prod_mk hf)).diag_of_prod_right
obtain ⟨a, b, c, d, e⟩ := eventually_prod_iff.1 ((hf' ε hε).and this)
obtain ⟨R, hR, hR'⟩ := Metric.nhds_basis_ball.eventually_iff.mp d
let r := min 1 R
have hr : 0 < r := by simp [r, hR]
have hr' : ∀ ⦃y : E⦄, y ∈ Metric.ball x r → c y := fun y hy =>
hR' (lt_of_lt_of_le (Metric.mem_ball.mp hy) (min_le_right _ _))
have hxy : ∀ y : E, y ∈ Metric.ball x r → ‖y - x‖ < 1 := by
intro y hy
rw [Metric.mem_ball, dist_eq_norm] at hy
exact lt_of_lt_of_le hy (min_le_left _ _)
have hxyε : ∀ y : E, y ∈ Metric.ball x r → ε * ‖y - x‖ < ε := by
intro y hy
exact (mul_lt_iff_lt_one_right hε.lt).mpr (hxy y hy)
-- With a small ball in hand, apply the mean value theorem
refine
eventually_prod_iff.mpr
⟨_, b, fun e : E => Metric.ball x r e,
eventually_mem_set.mpr (Metric.nhds_basis_ball.mem_of_mem hr), fun {n} hn {y} hy => ?_⟩
simp only [Pi.zero_apply, dist_zero_left] at e ⊢
refine lt_of_le_of_lt ?_ (hxyε y hy)
exact
Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le
(fun y hy => ((e hn (hr' hy)).2.1.sub (e hn (hr' hy)).2.2).hasFDerivWithinAt)
(fun y hy => (e hn (hr' hy)).1.le) (convex_ball x r) (Metric.mem_ball_self hr) hy
· -- This is just `hfg` run through `eventually_prod_iff`
refine Metric.tendstoUniformlyOnFilter_iff.mpr fun ε hε => ?_
obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε
exact
eventually_prod_iff.mpr
⟨fun n : ι × ι => f n.1 x ∈ t ∧ f n.2 x ∈ t,
eventually_prod_iff.mpr ⟨_, ht, _, ht, fun {n} hn {n'} hn' => ⟨hn, hn'⟩⟩,
fun _ => True,
by simp,
fun {n} hn {y} _ => by simpa [norm_sub_rev, dist_eq_norm] using ht' _ hn.1 _ hn.2⟩
#align uniform_cauchy_seq_on_filter_of_fderiv uniformCauchySeqOnFilter_of_fderiv
| Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean | 176 | 220 | theorem uniformCauchySeqOn_ball_of_fderiv {r : ℝ} (hf' : UniformCauchySeqOn f' l (Metric.ball x r))
(hf : ∀ n : ι, ∀ y : E, y ∈ Metric.ball x r → HasFDerivAt (f n) (f' n y) y)
(hfg : Cauchy (map (fun n => f n x) l)) : UniformCauchySeqOn f l (Metric.ball x r) := by |
letI : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _
have : NeBot l := (cauchy_map_iff.1 hfg).1
rcases le_or_lt r 0 with (hr | hr)
· simp only [Metric.ball_eq_empty.2 hr, UniformCauchySeqOn, Set.mem_empty_iff_false,
IsEmpty.forall_iff, eventually_const, imp_true_iff]
rw [SeminormedAddGroup.uniformCauchySeqOn_iff_tendstoUniformlyOn_zero] at hf' ⊢
suffices
TendstoUniformlyOn (fun (n : ι × ι) (z : E) => f n.1 z - f n.2 z - (f n.1 x - f n.2 x)) 0
(l ×ˢ l) (Metric.ball x r) ∧
TendstoUniformlyOn (fun (n : ι × ι) (_ : E) => f n.1 x - f n.2 x) 0
(l ×ˢ l) (Metric.ball x r) by
have := this.1.add this.2
rw [add_zero] at this
refine this.congr ?_
filter_upwards with n z _ using (by simp)
constructor
· -- This inequality follows from the mean value theorem
rw [Metric.tendstoUniformlyOn_iff] at hf' ⊢
intro ε hε
obtain ⟨q, hqpos, hq⟩ : ∃ q : ℝ, 0 < q ∧ q * r < ε := by
simp_rw [mul_comm]
exact exists_pos_mul_lt hε.lt r
apply (hf' q hqpos.gt).mono
intro n hn y hy
simp_rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn ⊢
have mvt :=
Convex.norm_image_sub_le_of_norm_hasFDerivWithin_le
(fun z hz => ((hf n.1 z hz).sub (hf n.2 z hz)).hasFDerivWithinAt) (fun z hz => (hn z hz).le)
(convex_ball x r) (Metric.mem_ball_self hr) hy
refine lt_of_le_of_lt mvt ?_
have : q * ‖y - x‖ < q * r :=
mul_lt_mul' rfl.le (by simpa only [dist_eq_norm] using Metric.mem_ball.mp hy) (norm_nonneg _)
hqpos
exact this.trans hq
· -- This is just `hfg` run through `eventually_prod_iff`
refine Metric.tendstoUniformlyOn_iff.mpr fun ε hε => ?_
obtain ⟨t, ht, ht'⟩ := (Metric.cauchy_iff.mp hfg).2 ε hε
rw [eventually_prod_iff]
refine ⟨fun n => f n x ∈ t, ht, fun n => f n x ∈ t, ht, ?_⟩
intro n hn n' hn' z _
rw [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg, ← dist_eq_norm]
exact ht' _ hn _ hn'
| 2,150 |
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.NormedSpace.RCLike
import Mathlib.Order.Filter.Curry
#align_import analysis.calculus.uniform_limits_deriv from "leanprover-community/mathlib"@"3f655f5297b030a87d641ad4e825af8d9679eb0b"
open Filter
open scoped uniformity Filter Topology
section deriv
variable {ι : Type*} {l : Filter ι} {𝕜 : Type*} [RCLike 𝕜] {G : Type*} [NormedAddCommGroup G]
[NormedSpace 𝕜 G] {f : ι → 𝕜 → G} {g : 𝕜 → G} {f' : ι → 𝕜 → G} {g' : 𝕜 → G} {x : 𝕜}
| Mathlib/Analysis/Calculus/UniformLimitsDeriv.lean | 455 | 474 | theorem UniformCauchySeqOnFilter.one_smulRight {l' : Filter 𝕜}
(hf' : UniformCauchySeqOnFilter f' l l') :
UniformCauchySeqOnFilter (fun n => fun z => (1 : 𝕜 →L[𝕜] 𝕜).smulRight (f' n z)) l l' := by |
-- The tricky part of this proof is that operator norms are written in terms of `≤` whereas
-- metrics are written in terms of `<`. So we need to shrink `ε` utilizing the archimedean
-- property of `ℝ`
rw [SeminormedAddGroup.uniformCauchySeqOnFilter_iff_tendstoUniformlyOnFilter_zero,
Metric.tendstoUniformlyOnFilter_iff] at hf' ⊢
intro ε hε
obtain ⟨q, hq, hq'⟩ := exists_between hε.lt
apply (hf' q hq).mono
intro n hn
refine lt_of_le_of_lt ?_ hq'
simp only [dist_eq_norm, Pi.zero_apply, zero_sub, norm_neg] at hn ⊢
refine ContinuousLinearMap.opNorm_le_bound _ hq.le ?_
intro z
simp only [ContinuousLinearMap.coe_sub', Pi.sub_apply, ContinuousLinearMap.smulRight_apply,
ContinuousLinearMap.one_apply]
rw [← smul_sub, norm_smul, mul_comm]
gcongr
| 2,150 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric TopologicalSpace Function Asymptotics Filter
open scoped Topology NNReal
variable {α β 𝕜 E F : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ}
variable [NormedSpace 𝕜 F]
variable {f : α → E → F} {f' : α → E → E →L[𝕜] F} {g : α → 𝕜 → F} {g' : α → 𝕜 → F} {v : ℕ → α → ℝ}
{s : Set E} {t : Set 𝕜} {x₀ x : E} {y₀ y : 𝕜} {N : ℕ∞}
| Mathlib/Analysis/Calculus/SmoothSeries.lean | 43 | 54 | theorem summable_of_summable_hasFDerivAt_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable (f · x₀))
(hx : x ∈ s) : Summable fun n => f n x := by |
haveI := Classical.decEq α
rw [summable_iff_cauchySeq_finset] at hf0 ⊢
have A : UniformCauchySeqOn (fun t : Finset α => fun x => ∑ i ∈ t, f' i x) atTop s :=
(tendstoUniformlyOn_tsum hu hf').uniformCauchySeqOn
-- Porting note: Lean 4 failed to find `f` by unification
refine cauchy_map_of_uniformCauchySeqOn_fderiv (f := fun t x ↦ ∑ i ∈ t, f i x)
hs h's A (fun t y hy => ?_) hx₀ hx hf0
exact HasFDerivAt.sum fun i _ => hf i y hy
| 2,151 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric TopologicalSpace Function Asymptotics Filter
open scoped Topology NNReal
variable {α β 𝕜 E F : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ}
variable [NormedSpace 𝕜 F]
variable {f : α → E → F} {f' : α → E → E →L[𝕜] F} {g : α → 𝕜 → F} {g' : α → 𝕜 → F} {v : ℕ → α → ℝ}
{s : Set E} {t : Set 𝕜} {x₀ x : E} {y₀ y : 𝕜} {N : ℕ∞}
theorem summable_of_summable_hasFDerivAt_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable (f · x₀))
(hx : x ∈ s) : Summable fun n => f n x := by
haveI := Classical.decEq α
rw [summable_iff_cauchySeq_finset] at hf0 ⊢
have A : UniformCauchySeqOn (fun t : Finset α => fun x => ∑ i ∈ t, f' i x) atTop s :=
(tendstoUniformlyOn_tsum hu hf').uniformCauchySeqOn
-- Porting note: Lean 4 failed to find `f` by unification
refine cauchy_map_of_uniformCauchySeqOn_fderiv (f := fun t x ↦ ∑ i ∈ t, f i x)
hs h's A (fun t y hy => ?_) hx₀ hx hf0
exact HasFDerivAt.sum fun i _ => hf i y hy
#align summable_of_summable_has_fderiv_at_of_is_preconnected summable_of_summable_hasFDerivAt_of_isPreconnected
| Mathlib/Analysis/Calculus/SmoothSeries.lean | 60 | 66 | theorem summable_of_summable_hasDerivAt_of_isPreconnected (hu : Summable u) (ht : IsOpen t)
(h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y)
(hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable (g · y₀))
(hy : y ∈ t) : Summable fun n => g n y := by |
simp_rw [hasDerivAt_iff_hasFDerivAt] at hg
refine summable_of_summable_hasFDerivAt_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy
simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
| 2,151 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric TopologicalSpace Function Asymptotics Filter
open scoped Topology NNReal
variable {α β 𝕜 E F : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ}
variable [NormedSpace 𝕜 F]
variable {f : α → E → F} {f' : α → E → E →L[𝕜] F} {g : α → 𝕜 → F} {g' : α → 𝕜 → F} {v : ℕ → α → ℝ}
{s : Set E} {t : Set 𝕜} {x₀ x : E} {y₀ y : 𝕜} {N : ℕ∞}
theorem summable_of_summable_hasFDerivAt_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable (f · x₀))
(hx : x ∈ s) : Summable fun n => f n x := by
haveI := Classical.decEq α
rw [summable_iff_cauchySeq_finset] at hf0 ⊢
have A : UniformCauchySeqOn (fun t : Finset α => fun x => ∑ i ∈ t, f' i x) atTop s :=
(tendstoUniformlyOn_tsum hu hf').uniformCauchySeqOn
-- Porting note: Lean 4 failed to find `f` by unification
refine cauchy_map_of_uniformCauchySeqOn_fderiv (f := fun t x ↦ ∑ i ∈ t, f i x)
hs h's A (fun t y hy => ?_) hx₀ hx hf0
exact HasFDerivAt.sum fun i _ => hf i y hy
#align summable_of_summable_has_fderiv_at_of_is_preconnected summable_of_summable_hasFDerivAt_of_isPreconnected
theorem summable_of_summable_hasDerivAt_of_isPreconnected (hu : Summable u) (ht : IsOpen t)
(h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y)
(hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable (g · y₀))
(hy : y ∈ t) : Summable fun n => g n y := by
simp_rw [hasDerivAt_iff_hasFDerivAt] at hg
refine summable_of_summable_hasFDerivAt_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy
simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
| Mathlib/Analysis/Calculus/SmoothSeries.lean | 72 | 84 | theorem hasFDerivAt_tsum_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable fun n => f n x₀)
(hx : x ∈ s) : HasFDerivAt (fun y => ∑' n, f n y) (∑' n, f' n x) x := by |
classical
have A :
∀ x : E, x ∈ s → Tendsto (fun t : Finset α => ∑ n ∈ t, f n x) atTop (𝓝 (∑' n, f n x)) := by
intro y hy
apply Summable.hasSum
exact summable_of_summable_hasFDerivAt_of_isPreconnected hu hs h's hf hf' hx₀ hf0 hy
refine hasFDerivAt_of_tendstoUniformlyOn hs (tendstoUniformlyOn_tsum hu hf')
(fun t y hy => ?_) A _ hx
exact HasFDerivAt.sum fun n _ => hf n y hy
| 2,151 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric TopologicalSpace Function Asymptotics Filter
open scoped Topology NNReal
variable {α β 𝕜 E F : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ}
variable [NormedSpace 𝕜 F]
variable {f : α → E → F} {f' : α → E → E →L[𝕜] F} {g : α → 𝕜 → F} {g' : α → 𝕜 → F} {v : ℕ → α → ℝ}
{s : Set E} {t : Set 𝕜} {x₀ x : E} {y₀ y : 𝕜} {N : ℕ∞}
theorem summable_of_summable_hasFDerivAt_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable (f · x₀))
(hx : x ∈ s) : Summable fun n => f n x := by
haveI := Classical.decEq α
rw [summable_iff_cauchySeq_finset] at hf0 ⊢
have A : UniformCauchySeqOn (fun t : Finset α => fun x => ∑ i ∈ t, f' i x) atTop s :=
(tendstoUniformlyOn_tsum hu hf').uniformCauchySeqOn
-- Porting note: Lean 4 failed to find `f` by unification
refine cauchy_map_of_uniformCauchySeqOn_fderiv (f := fun t x ↦ ∑ i ∈ t, f i x)
hs h's A (fun t y hy => ?_) hx₀ hx hf0
exact HasFDerivAt.sum fun i _ => hf i y hy
#align summable_of_summable_has_fderiv_at_of_is_preconnected summable_of_summable_hasFDerivAt_of_isPreconnected
theorem summable_of_summable_hasDerivAt_of_isPreconnected (hu : Summable u) (ht : IsOpen t)
(h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y)
(hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable (g · y₀))
(hy : y ∈ t) : Summable fun n => g n y := by
simp_rw [hasDerivAt_iff_hasFDerivAt] at hg
refine summable_of_summable_hasFDerivAt_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy
simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
theorem hasFDerivAt_tsum_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable fun n => f n x₀)
(hx : x ∈ s) : HasFDerivAt (fun y => ∑' n, f n y) (∑' n, f' n x) x := by
classical
have A :
∀ x : E, x ∈ s → Tendsto (fun t : Finset α => ∑ n ∈ t, f n x) atTop (𝓝 (∑' n, f n x)) := by
intro y hy
apply Summable.hasSum
exact summable_of_summable_hasFDerivAt_of_isPreconnected hu hs h's hf hf' hx₀ hf0 hy
refine hasFDerivAt_of_tendstoUniformlyOn hs (tendstoUniformlyOn_tsum hu hf')
(fun t y hy => ?_) A _ hx
exact HasFDerivAt.sum fun n _ => hf n y hy
#align has_fderiv_at_tsum_of_is_preconnected hasFDerivAt_tsum_of_isPreconnected
| Mathlib/Analysis/Calculus/SmoothSeries.lean | 91 | 99 | theorem hasDerivAt_tsum_of_isPreconnected (hu : Summable u) (ht : IsOpen t)
(h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y)
(hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable fun n => g n y₀)
(hy : y ∈ t) : HasDerivAt (fun z => ∑' n, g n z) (∑' n, g' n y) y := by |
simp_rw [hasDerivAt_iff_hasFDerivAt] at hg ⊢
convert hasFDerivAt_tsum_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy
· exact (ContinuousLinearMap.smulRightL 𝕜 𝕜 F 1).map_tsum <|
.of_norm_bounded u hu fun n ↦ hg' n y hy
· simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
| 2,151 |
import Mathlib.Analysis.Calculus.ContDiff.Basic
import Mathlib.Analysis.Calculus.UniformLimitsDeriv
import Mathlib.Topology.Algebra.InfiniteSum.Module
import Mathlib.Analysis.NormedSpace.FunctionSeries
#align_import analysis.calculus.series from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Metric TopologicalSpace Function Asymptotics Filter
open scoped Topology NNReal
variable {α β 𝕜 E F : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E]
[NormedAddCommGroup F] [CompleteSpace F] {u : α → ℝ}
variable [NormedSpace 𝕜 F]
variable {f : α → E → F} {f' : α → E → E →L[𝕜] F} {g : α → 𝕜 → F} {g' : α → 𝕜 → F} {v : ℕ → α → ℝ}
{s : Set E} {t : Set 𝕜} {x₀ x : E} {y₀ y : 𝕜} {N : ℕ∞}
theorem summable_of_summable_hasFDerivAt_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable (f · x₀))
(hx : x ∈ s) : Summable fun n => f n x := by
haveI := Classical.decEq α
rw [summable_iff_cauchySeq_finset] at hf0 ⊢
have A : UniformCauchySeqOn (fun t : Finset α => fun x => ∑ i ∈ t, f' i x) atTop s :=
(tendstoUniformlyOn_tsum hu hf').uniformCauchySeqOn
-- Porting note: Lean 4 failed to find `f` by unification
refine cauchy_map_of_uniformCauchySeqOn_fderiv (f := fun t x ↦ ∑ i ∈ t, f i x)
hs h's A (fun t y hy => ?_) hx₀ hx hf0
exact HasFDerivAt.sum fun i _ => hf i y hy
#align summable_of_summable_has_fderiv_at_of_is_preconnected summable_of_summable_hasFDerivAt_of_isPreconnected
theorem summable_of_summable_hasDerivAt_of_isPreconnected (hu : Summable u) (ht : IsOpen t)
(h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y)
(hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable (g · y₀))
(hy : y ∈ t) : Summable fun n => g n y := by
simp_rw [hasDerivAt_iff_hasFDerivAt] at hg
refine summable_of_summable_hasFDerivAt_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy
simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
theorem hasFDerivAt_tsum_of_isPreconnected (hu : Summable u) (hs : IsOpen s)
(h's : IsPreconnected s) (hf : ∀ n x, x ∈ s → HasFDerivAt (f n) (f' n x) x)
(hf' : ∀ n x, x ∈ s → ‖f' n x‖ ≤ u n) (hx₀ : x₀ ∈ s) (hf0 : Summable fun n => f n x₀)
(hx : x ∈ s) : HasFDerivAt (fun y => ∑' n, f n y) (∑' n, f' n x) x := by
classical
have A :
∀ x : E, x ∈ s → Tendsto (fun t : Finset α => ∑ n ∈ t, f n x) atTop (𝓝 (∑' n, f n x)) := by
intro y hy
apply Summable.hasSum
exact summable_of_summable_hasFDerivAt_of_isPreconnected hu hs h's hf hf' hx₀ hf0 hy
refine hasFDerivAt_of_tendstoUniformlyOn hs (tendstoUniformlyOn_tsum hu hf')
(fun t y hy => ?_) A _ hx
exact HasFDerivAt.sum fun n _ => hf n y hy
#align has_fderiv_at_tsum_of_is_preconnected hasFDerivAt_tsum_of_isPreconnected
theorem hasDerivAt_tsum_of_isPreconnected (hu : Summable u) (ht : IsOpen t)
(h't : IsPreconnected t) (hg : ∀ n y, y ∈ t → HasDerivAt (g n) (g' n y) y)
(hg' : ∀ n y, y ∈ t → ‖g' n y‖ ≤ u n) (hy₀ : y₀ ∈ t) (hg0 : Summable fun n => g n y₀)
(hy : y ∈ t) : HasDerivAt (fun z => ∑' n, g n z) (∑' n, g' n y) y := by
simp_rw [hasDerivAt_iff_hasFDerivAt] at hg ⊢
convert hasFDerivAt_tsum_of_isPreconnected hu ht h't hg ?_ hy₀ hg0 hy
· exact (ContinuousLinearMap.smulRightL 𝕜 𝕜 F 1).map_tsum <|
.of_norm_bounded u hu fun n ↦ hg' n y hy
· simpa? says simpa only [ContinuousLinearMap.norm_smulRight_apply, norm_one, one_mul]
| Mathlib/Analysis/Calculus/SmoothSeries.lean | 104 | 109 | theorem summable_of_summable_hasFDerivAt (hu : Summable u)
(hf : ∀ n x, HasFDerivAt (f n) (f' n x) x) (hf' : ∀ n x, ‖f' n x‖ ≤ u n)
(hf0 : Summable fun n => f n x₀) (x : E) : Summable fun n => f n x := by |
let _ : NormedSpace ℝ E := NormedSpace.restrictScalars ℝ 𝕜 _
exact summable_of_summable_hasFDerivAt_of_isPreconnected hu isOpen_univ isPreconnected_univ
(fun n x _ => hf n x) (fun n x _ => hf' n x) (mem_univ _) hf0 (mem_univ _)
| 2,151 |
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.fderiv_symmetric from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open Asymptotics Set
open scoped Topology
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup F]
[NormedSpace ℝ F] {s : Set E} (s_conv : Convex ℝ s) {f : E → F} {f' : E → E →L[ℝ] F}
{f'' : E →L[ℝ] E →L[ℝ] F} (hf : ∀ x ∈ interior s, HasFDerivAt f (f' x) x) {x : E} (xs : x ∈ s)
(hx : HasFDerivWithinAt f' f'' (interior s) x)
| Mathlib/Analysis/Calculus/FDeriv/Symmetric.lean | 68 | 172 | theorem Convex.taylor_approx_two_segment {v w : E} (hv : x + v ∈ interior s)
(hw : x + v + w ∈ interior s) :
(fun h : ℝ => f (x + h • v + h • w)
- f (x + h • v) - h • f' x w - h ^ 2 • f'' v w - (h ^ 2 / 2) • f'' w w) =o[𝓝[>] 0]
fun h => h ^ 2 := by |
-- it suffices to check that the expression is bounded by `ε * ((‖v‖ + ‖w‖) * ‖w‖) * h^2` for
-- small enough `h`, for any positive `ε`.
refine IsLittleO.trans_isBigO
(isLittleO_iff.2 fun ε εpos => ?_) (isBigO_const_mul_self ((‖v‖ + ‖w‖) * ‖w‖) _ _)
-- consider a ball of radius `δ` around `x` in which the Taylor approximation for `f''` is
-- good up to `δ`.
rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, isLittleO_iff] at hx
rcases Metric.mem_nhdsWithin_iff.1 (hx εpos) with ⟨δ, δpos, sδ⟩
have E1 : ∀ᶠ h in 𝓝[>] (0 : ℝ), h * (‖v‖ + ‖w‖) < δ := by
have : Filter.Tendsto (fun h => h * (‖v‖ + ‖w‖)) (𝓝[>] (0 : ℝ)) (𝓝 (0 * (‖v‖ + ‖w‖))) :=
(continuous_id.mul continuous_const).continuousWithinAt
apply (tendsto_order.1 this).2 δ
simpa only [zero_mul] using δpos
have E2 : ∀ᶠ h in 𝓝[>] (0 : ℝ), (h : ℝ) < 1 :=
mem_nhdsWithin_Ioi_iff_exists_Ioo_subset.2
⟨(1 : ℝ), by simp only [mem_Ioi, zero_lt_one], fun x hx => hx.2⟩
filter_upwards [E1, E2, self_mem_nhdsWithin] with h hδ h_lt_1 hpos
-- we consider `h` small enough that all points under consideration belong to this ball,
-- and also with `0 < h < 1`.
replace hpos : 0 < h := hpos
have xt_mem : ∀ t ∈ Icc (0 : ℝ) 1, x + h • v + (t * h) • w ∈ interior s := by
intro t ht
have : x + h • v ∈ interior s := s_conv.add_smul_mem_interior xs hv ⟨hpos, h_lt_1.le⟩
rw [← smul_smul]
apply s_conv.interior.add_smul_mem this _ ht
rw [add_assoc] at hw
rw [add_assoc, ← smul_add]
exact s_conv.add_smul_mem_interior xs hw ⟨hpos, h_lt_1.le⟩
-- define a function `g` on `[0,1]` (identified with `[v, v + w]`) such that `g 1 - g 0` is the
-- quantity to be estimated. We will check that its derivative is given by an explicit
-- expression `g'`, that we can bound. Then the desired bound for `g 1 - g 0` follows from the
-- mean value inequality.
let g t :=
f (x + h • v + (t * h) • w) - (t * h) • f' x w - (t * h ^ 2) • f'' v w -
((t * h) ^ 2 / 2) • f'' w w
set g' := fun t =>
f' (x + h • v + (t * h) • w) (h • w) - h • f' x w - h ^ 2 • f'' v w - (t * h ^ 2) • f'' w w
with hg'
-- check that `g'` is the derivative of `g`, by a straightforward computation
have g_deriv : ∀ t ∈ Icc (0 : ℝ) 1, HasDerivWithinAt g (g' t) (Icc 0 1) t := by
intro t ht
apply_rules [HasDerivWithinAt.sub, HasDerivWithinAt.add]
· refine (hf _ ?_).comp_hasDerivWithinAt _ ?_
· exact xt_mem t ht
apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.const_add, HasDerivAt.smul_const,
hasDerivAt_mul_const]
· apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_mul_const]
· apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_mul_const]
· suffices H : HasDerivWithinAt (fun u => ((u * h) ^ 2 / 2) • f'' w w)
((((2 : ℕ) : ℝ) * (t * h) ^ (2 - 1) * (1 * h) / 2) • f'' w w) (Icc 0 1) t by
convert H using 2
ring
apply_rules [HasDerivAt.hasDerivWithinAt, HasDerivAt.smul_const, hasDerivAt_id',
HasDerivAt.pow, HasDerivAt.mul_const]
-- check that `g'` is uniformly bounded, with a suitable bound `ε * ((‖v‖ + ‖w‖) * ‖w‖) * h^2`.
have g'_bound : ∀ t ∈ Ico (0 : ℝ) 1, ‖g' t‖ ≤ ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by
intro t ht
have I : ‖h • v + (t * h) • w‖ ≤ h * (‖v‖ + ‖w‖) :=
calc
‖h • v + (t * h) • w‖ ≤ ‖h • v‖ + ‖(t * h) • w‖ := norm_add_le _ _
_ = h * ‖v‖ + t * (h * ‖w‖) := by
simp only [norm_smul, Real.norm_eq_abs, hpos.le, abs_of_nonneg, abs_mul, ht.left,
mul_assoc]
_ ≤ h * ‖v‖ + 1 * (h * ‖w‖) := by gcongr; exact ht.2.le
_ = h * (‖v‖ + ‖w‖) := by ring
calc
‖g' t‖ = ‖(f' (x + h • v + (t * h) • w) - f' x - f'' (h • v + (t * h) • w)) (h • w)‖ := by
rw [hg']
have : h * (t * h) = t * (h * h) := by ring
simp only [ContinuousLinearMap.coe_sub', ContinuousLinearMap.map_add, pow_two,
ContinuousLinearMap.add_apply, Pi.smul_apply, smul_sub, smul_add, smul_smul, ← sub_sub,
ContinuousLinearMap.coe_smul', Pi.sub_apply, ContinuousLinearMap.map_smul, this]
_ ≤ ‖f' (x + h • v + (t * h) • w) - f' x - f'' (h • v + (t * h) • w)‖ * ‖h • w‖ :=
(ContinuousLinearMap.le_opNorm _ _)
_ ≤ ε * ‖h • v + (t * h) • w‖ * ‖h • w‖ := by
apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
have H : x + h • v + (t * h) • w ∈ Metric.ball x δ ∩ interior s := by
refine ⟨?_, xt_mem t ⟨ht.1, ht.2.le⟩⟩
rw [add_assoc, add_mem_ball_iff_norm]
exact I.trans_lt hδ
simpa only [mem_setOf_eq, add_assoc x, add_sub_cancel_left] using sδ H
_ ≤ ε * (‖h • v‖ + ‖h • w‖) * ‖h • w‖ := by
gcongr
apply (norm_add_le _ _).trans
gcongr
simp only [norm_smul, Real.norm_eq_abs, abs_mul, abs_of_nonneg, ht.1, hpos.le, mul_assoc]
exact mul_le_of_le_one_left (mul_nonneg hpos.le (norm_nonneg _)) ht.2.le
_ = ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by
simp only [norm_smul, Real.norm_eq_abs, abs_mul, abs_of_nonneg, hpos.le]; ring
-- conclude using the mean value inequality
have I : ‖g 1 - g 0‖ ≤ ε * ((‖v‖ + ‖w‖) * ‖w‖) * h ^ 2 := by
simpa only [mul_one, sub_zero] using
norm_image_sub_le_of_norm_deriv_le_segment' g_deriv g'_bound 1 (right_mem_Icc.2 zero_le_one)
convert I using 1
· congr 1
simp only [g, Nat.one_ne_zero, add_zero, one_mul, zero_div, zero_mul, sub_zero,
zero_smul, Ne, not_false_iff, bit0_eq_zero, zero_pow]
abel
· simp only [Real.norm_eq_abs, abs_mul, add_nonneg (norm_nonneg v) (norm_nonneg w), abs_of_nonneg,
hpos.le, mul_assoc, norm_nonneg, abs_pow]
| 2,152 |
import Mathlib.Algebra.Polynomial.Module.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
open scoped Interval Topology Nat
open Set
variable {𝕜 E F : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E :=
(k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀
#align taylor_coeff_within taylorCoeffWithin
noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E :=
(Finset.range (n + 1)).sum fun k =>
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀))
#align taylor_within taylorWithin
noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E :=
PolynomialModule.eval x (taylorWithin f n s x₀)
#align taylor_within_eval taylorWithinEval
| Mathlib/Analysis/Calculus/Taylor.lean | 74 | 79 | theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ +
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by |
dsimp only [taylorWithin]
rw [Finset.sum_range_succ]
| 2,153 |
import Mathlib.Algebra.Polynomial.Module.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
open scoped Interval Topology Nat
open Set
variable {𝕜 E F : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E :=
(k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀
#align taylor_coeff_within taylorCoeffWithin
noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E :=
(Finset.range (n + 1)).sum fun k =>
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀))
#align taylor_within taylorWithin
noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E :=
PolynomialModule.eval x (taylorWithin f n s x₀)
#align taylor_within_eval taylorWithinEval
theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ +
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by
dsimp only [taylorWithin]
rw [Finset.sum_range_succ]
#align taylor_within_succ taylorWithin_succ
@[simp]
| Mathlib/Analysis/Calculus/Taylor.lean | 83 | 92 | theorem taylorWithinEval_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f (n + 1) s x₀ x = taylorWithinEval f n s x₀ x +
(((n + 1 : ℝ) * n !)⁻¹ * (x - x₀) ^ (n + 1)) • iteratedDerivWithin (n + 1) f s x₀ := by |
simp_rw [taylorWithinEval, taylorWithin_succ, LinearMap.map_add, PolynomialModule.comp_eval]
congr
simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C,
PolynomialModule.eval_single, mul_inv_rev]
dsimp only [taylorCoeffWithin]
rw [← mul_smul, mul_comm, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one,
mul_inv_rev]
| 2,153 |
import Mathlib.Algebra.Polynomial.Module.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
open scoped Interval Topology Nat
open Set
variable {𝕜 E F : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E :=
(k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀
#align taylor_coeff_within taylorCoeffWithin
noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E :=
(Finset.range (n + 1)).sum fun k =>
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀))
#align taylor_within taylorWithin
noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E :=
PolynomialModule.eval x (taylorWithin f n s x₀)
#align taylor_within_eval taylorWithinEval
theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ +
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by
dsimp only [taylorWithin]
rw [Finset.sum_range_succ]
#align taylor_within_succ taylorWithin_succ
@[simp]
theorem taylorWithinEval_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f (n + 1) s x₀ x = taylorWithinEval f n s x₀ x +
(((n + 1 : ℝ) * n !)⁻¹ * (x - x₀) ^ (n + 1)) • iteratedDerivWithin (n + 1) f s x₀ := by
simp_rw [taylorWithinEval, taylorWithin_succ, LinearMap.map_add, PolynomialModule.comp_eval]
congr
simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C,
PolynomialModule.eval_single, mul_inv_rev]
dsimp only [taylorCoeffWithin]
rw [← mul_smul, mul_comm, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one,
mul_inv_rev]
#align taylor_within_eval_succ taylorWithinEval_succ
@[simp]
| Mathlib/Analysis/Calculus/Taylor.lean | 97 | 102 | theorem taylor_within_zero_eval (f : ℝ → E) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f 0 s x₀ x = f x₀ := by |
dsimp only [taylorWithinEval]
dsimp only [taylorWithin]
dsimp only [taylorCoeffWithin]
simp
| 2,153 |
import Mathlib.Algebra.Polynomial.Module.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
open scoped Interval Topology Nat
open Set
variable {𝕜 E F : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E :=
(k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀
#align taylor_coeff_within taylorCoeffWithin
noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E :=
(Finset.range (n + 1)).sum fun k =>
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀))
#align taylor_within taylorWithin
noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E :=
PolynomialModule.eval x (taylorWithin f n s x₀)
#align taylor_within_eval taylorWithinEval
theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ +
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by
dsimp only [taylorWithin]
rw [Finset.sum_range_succ]
#align taylor_within_succ taylorWithin_succ
@[simp]
theorem taylorWithinEval_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f (n + 1) s x₀ x = taylorWithinEval f n s x₀ x +
(((n + 1 : ℝ) * n !)⁻¹ * (x - x₀) ^ (n + 1)) • iteratedDerivWithin (n + 1) f s x₀ := by
simp_rw [taylorWithinEval, taylorWithin_succ, LinearMap.map_add, PolynomialModule.comp_eval]
congr
simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C,
PolynomialModule.eval_single, mul_inv_rev]
dsimp only [taylorCoeffWithin]
rw [← mul_smul, mul_comm, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one,
mul_inv_rev]
#align taylor_within_eval_succ taylorWithinEval_succ
@[simp]
theorem taylor_within_zero_eval (f : ℝ → E) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f 0 s x₀ x = f x₀ := by
dsimp only [taylorWithinEval]
dsimp only [taylorWithin]
dsimp only [taylorCoeffWithin]
simp
#align taylor_within_zero_eval taylor_within_zero_eval
@[simp]
| Mathlib/Analysis/Calculus/Taylor.lean | 107 | 111 | theorem taylorWithinEval_self (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithinEval f n s x₀ x₀ = f x₀ := by |
induction' n with k hk
· exact taylor_within_zero_eval _ _ _ _
simp [hk]
| 2,153 |
import Mathlib.Algebra.Polynomial.Module.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
open scoped Interval Topology Nat
open Set
variable {𝕜 E F : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E :=
(k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀
#align taylor_coeff_within taylorCoeffWithin
noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E :=
(Finset.range (n + 1)).sum fun k =>
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀))
#align taylor_within taylorWithin
noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E :=
PolynomialModule.eval x (taylorWithin f n s x₀)
#align taylor_within_eval taylorWithinEval
theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ +
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by
dsimp only [taylorWithin]
rw [Finset.sum_range_succ]
#align taylor_within_succ taylorWithin_succ
@[simp]
theorem taylorWithinEval_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f (n + 1) s x₀ x = taylorWithinEval f n s x₀ x +
(((n + 1 : ℝ) * n !)⁻¹ * (x - x₀) ^ (n + 1)) • iteratedDerivWithin (n + 1) f s x₀ := by
simp_rw [taylorWithinEval, taylorWithin_succ, LinearMap.map_add, PolynomialModule.comp_eval]
congr
simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C,
PolynomialModule.eval_single, mul_inv_rev]
dsimp only [taylorCoeffWithin]
rw [← mul_smul, mul_comm, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one,
mul_inv_rev]
#align taylor_within_eval_succ taylorWithinEval_succ
@[simp]
theorem taylor_within_zero_eval (f : ℝ → E) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f 0 s x₀ x = f x₀ := by
dsimp only [taylorWithinEval]
dsimp only [taylorWithin]
dsimp only [taylorCoeffWithin]
simp
#align taylor_within_zero_eval taylor_within_zero_eval
@[simp]
theorem taylorWithinEval_self (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithinEval f n s x₀ x₀ = f x₀ := by
induction' n with k hk
· exact taylor_within_zero_eval _ _ _ _
simp [hk]
#align taylor_within_eval_self taylorWithinEval_self
| Mathlib/Analysis/Calculus/Taylor.lean | 114 | 120 | theorem taylor_within_apply (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f n s x₀ x =
∑ k ∈ Finset.range (n + 1), ((k ! : ℝ)⁻¹ * (x - x₀) ^ k) • iteratedDerivWithin k f s x₀ := by |
induction' n with k hk
· simp
rw [taylorWithinEval_succ, Finset.sum_range_succ, hk]
simp [Nat.factorial]
| 2,153 |
import Mathlib.Algebra.Polynomial.Module.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
open scoped Interval Topology Nat
open Set
variable {𝕜 E F : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E :=
(k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀
#align taylor_coeff_within taylorCoeffWithin
noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E :=
(Finset.range (n + 1)).sum fun k =>
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀))
#align taylor_within taylorWithin
noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E :=
PolynomialModule.eval x (taylorWithin f n s x₀)
#align taylor_within_eval taylorWithinEval
theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ +
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by
dsimp only [taylorWithin]
rw [Finset.sum_range_succ]
#align taylor_within_succ taylorWithin_succ
@[simp]
theorem taylorWithinEval_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f (n + 1) s x₀ x = taylorWithinEval f n s x₀ x +
(((n + 1 : ℝ) * n !)⁻¹ * (x - x₀) ^ (n + 1)) • iteratedDerivWithin (n + 1) f s x₀ := by
simp_rw [taylorWithinEval, taylorWithin_succ, LinearMap.map_add, PolynomialModule.comp_eval]
congr
simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C,
PolynomialModule.eval_single, mul_inv_rev]
dsimp only [taylorCoeffWithin]
rw [← mul_smul, mul_comm, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one,
mul_inv_rev]
#align taylor_within_eval_succ taylorWithinEval_succ
@[simp]
theorem taylor_within_zero_eval (f : ℝ → E) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f 0 s x₀ x = f x₀ := by
dsimp only [taylorWithinEval]
dsimp only [taylorWithin]
dsimp only [taylorCoeffWithin]
simp
#align taylor_within_zero_eval taylor_within_zero_eval
@[simp]
theorem taylorWithinEval_self (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithinEval f n s x₀ x₀ = f x₀ := by
induction' n with k hk
· exact taylor_within_zero_eval _ _ _ _
simp [hk]
#align taylor_within_eval_self taylorWithinEval_self
theorem taylor_within_apply (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f n s x₀ x =
∑ k ∈ Finset.range (n + 1), ((k ! : ℝ)⁻¹ * (x - x₀) ^ k) • iteratedDerivWithin k f s x₀ := by
induction' n with k hk
· simp
rw [taylorWithinEval_succ, Finset.sum_range_succ, hk]
simp [Nat.factorial]
#align taylor_within_apply taylor_within_apply
| Mathlib/Analysis/Calculus/Taylor.lean | 125 | 136 | theorem continuousOn_taylorWithinEval {f : ℝ → E} {x : ℝ} {n : ℕ} {s : Set ℝ}
(hs : UniqueDiffOn ℝ s) (hf : ContDiffOn ℝ n f s) :
ContinuousOn (fun t => taylorWithinEval f n s t x) s := by |
simp_rw [taylor_within_apply]
refine continuousOn_finset_sum (Finset.range (n + 1)) fun i hi => ?_
refine (continuousOn_const.mul ((continuousOn_const.sub continuousOn_id).pow _)).smul ?_
rw [contDiffOn_iff_continuousOn_differentiableOn_deriv hs] at hf
cases' hf with hf_left
specialize hf_left i
simp only [Finset.mem_range] at hi
refine hf_left ?_
simp only [WithTop.coe_le_coe, Nat.cast_le, Nat.lt_succ_iff.mp hi]
| 2,153 |
import Mathlib.Algebra.Polynomial.Module.Basic
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.IteratedDeriv.Defs
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.taylor from "leanprover-community/mathlib"@"3a69562db5a458db8322b190ec8d9a8bbd8a5b14"
open scoped Interval Topology Nat
open Set
variable {𝕜 E F : Type*}
variable [NormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable def taylorCoeffWithin (f : ℝ → E) (k : ℕ) (s : Set ℝ) (x₀ : ℝ) : E :=
(k ! : ℝ)⁻¹ • iteratedDerivWithin k f s x₀
#align taylor_coeff_within taylorCoeffWithin
noncomputable def taylorWithin (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) : PolynomialModule ℝ E :=
(Finset.range (n + 1)).sum fun k =>
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ k (taylorCoeffWithin f k s x₀))
#align taylor_within taylorWithin
noncomputable def taylorWithinEval (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) : E :=
PolynomialModule.eval x (taylorWithin f n s x₀)
#align taylor_within_eval taylorWithinEval
theorem taylorWithin_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithin f (n + 1) s x₀ = taylorWithin f n s x₀ +
PolynomialModule.comp (Polynomial.X - Polynomial.C x₀)
(PolynomialModule.single ℝ (n + 1) (taylorCoeffWithin f (n + 1) s x₀)) := by
dsimp only [taylorWithin]
rw [Finset.sum_range_succ]
#align taylor_within_succ taylorWithin_succ
@[simp]
theorem taylorWithinEval_succ (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f (n + 1) s x₀ x = taylorWithinEval f n s x₀ x +
(((n + 1 : ℝ) * n !)⁻¹ * (x - x₀) ^ (n + 1)) • iteratedDerivWithin (n + 1) f s x₀ := by
simp_rw [taylorWithinEval, taylorWithin_succ, LinearMap.map_add, PolynomialModule.comp_eval]
congr
simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C,
PolynomialModule.eval_single, mul_inv_rev]
dsimp only [taylorCoeffWithin]
rw [← mul_smul, mul_comm, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one,
mul_inv_rev]
#align taylor_within_eval_succ taylorWithinEval_succ
@[simp]
theorem taylor_within_zero_eval (f : ℝ → E) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f 0 s x₀ x = f x₀ := by
dsimp only [taylorWithinEval]
dsimp only [taylorWithin]
dsimp only [taylorCoeffWithin]
simp
#align taylor_within_zero_eval taylor_within_zero_eval
@[simp]
theorem taylorWithinEval_self (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ : ℝ) :
taylorWithinEval f n s x₀ x₀ = f x₀ := by
induction' n with k hk
· exact taylor_within_zero_eval _ _ _ _
simp [hk]
#align taylor_within_eval_self taylorWithinEval_self
theorem taylor_within_apply (f : ℝ → E) (n : ℕ) (s : Set ℝ) (x₀ x : ℝ) :
taylorWithinEval f n s x₀ x =
∑ k ∈ Finset.range (n + 1), ((k ! : ℝ)⁻¹ * (x - x₀) ^ k) • iteratedDerivWithin k f s x₀ := by
induction' n with k hk
· simp
rw [taylorWithinEval_succ, Finset.sum_range_succ, hk]
simp [Nat.factorial]
#align taylor_within_apply taylor_within_apply
theorem continuousOn_taylorWithinEval {f : ℝ → E} {x : ℝ} {n : ℕ} {s : Set ℝ}
(hs : UniqueDiffOn ℝ s) (hf : ContDiffOn ℝ n f s) :
ContinuousOn (fun t => taylorWithinEval f n s t x) s := by
simp_rw [taylor_within_apply]
refine continuousOn_finset_sum (Finset.range (n + 1)) fun i hi => ?_
refine (continuousOn_const.mul ((continuousOn_const.sub continuousOn_id).pow _)).smul ?_
rw [contDiffOn_iff_continuousOn_differentiableOn_deriv hs] at hf
cases' hf with hf_left
specialize hf_left i
simp only [Finset.mem_range] at hi
refine hf_left ?_
simp only [WithTop.coe_le_coe, Nat.cast_le, Nat.lt_succ_iff.mp hi]
#align continuous_on_taylor_within_eval continuousOn_taylorWithinEval
| Mathlib/Analysis/Calculus/Taylor.lean | 141 | 146 | theorem monomial_has_deriv_aux (t x : ℝ) (n : ℕ) :
HasDerivAt (fun y => (x - y) ^ (n + 1)) (-(n + 1) * (x - t) ^ n) t := by |
simp_rw [sub_eq_neg_add]
rw [← neg_one_mul, mul_comm (-1 : ℝ), mul_assoc, mul_comm (-1 : ℝ), ← mul_assoc]
convert HasDerivAt.pow (n + 1) ((hasDerivAt_id t).neg.add_const x)
simp only [Nat.cast_add, Nat.cast_one]
| 2,153 |
import Mathlib.Algebra.Polynomial.DenomsClearable
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Data.Real.Irrational
import Mathlib.Topology.Algebra.Polynomial
#align_import number_theory.liouville.basic from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
def Liouville (x : ℝ) :=
∀ n : ℕ, ∃ a b : ℤ, 1 < b ∧ x ≠ a / b ∧ |x - a / b| < 1 / (b : ℝ) ^ n
#align liouville Liouville
namespace Liouville
protected theorem irrational {x : ℝ} (h : Liouville x) : Irrational x := by
-- By contradiction, `x = a / b`, with `a ∈ ℤ`, `0 < b ∈ ℕ` is a Liouville number,
rintro ⟨⟨a, b, bN0, cop⟩, rfl⟩
-- clear up the mess of constructions of rationals
rw [Rat.cast_mk'] at h
-- Since `a / b` is a Liouville number, there are `p, q ∈ ℤ`, with `q1 : 1 < q`,∈
-- `a0 : a / b ≠ p / q` and `a1 : |a / b - p / q| < 1 / q ^ (b + 1)`
rcases h (b + 1) with ⟨p, q, q1, a0, a1⟩
-- A few useful inequalities
have qR0 : (0 : ℝ) < q := Int.cast_pos.mpr (zero_lt_one.trans q1)
have b0 : (b : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr bN0
have bq0 : (0 : ℝ) < b * q := mul_pos (Nat.cast_pos.mpr bN0.bot_lt) qR0
-- At a1, clear denominators...
replace a1 : |a * q - b * p| * q ^ (b + 1) < b * q := by
rw [div_sub_div _ _ b0 qR0.ne', abs_div, div_lt_div_iff (abs_pos.mpr bq0.ne') (pow_pos qR0 _),
abs_of_pos bq0, one_mul] at a1
exact mod_cast a1
-- At a0, clear denominators...
replace a0 : a * q - ↑b * p ≠ 0 := by
rw [Ne, div_eq_div_iff b0 qR0.ne', mul_comm (p : ℝ), ← sub_eq_zero] at a0
exact mod_cast a0
-- Actually, `q` is a natural number
lift q to ℕ using (zero_lt_one.trans q1).le
-- Looks innocuous, but we now have an integer with non-zero absolute value: this is at
-- least one away from zero. The gain here is what gets the proof going.
have ap : 0 < |a * ↑q - ↑b * p| := abs_pos.mpr a0
-- Actually, the absolute value of an integer is a natural number
-- FIXME: This `lift` call duplicates the hypotheses `a1` and `ap`
lift |a * ↑q - ↑b * p| to ℕ using abs_nonneg (a * ↑q - ↑b * p) with e he
norm_cast at a1 ap q1
-- Recall this is by contradiction: we obtained the inequality `b * q ≤ x * q ^ (b + 1)`, so
-- we are done.
exact not_le.mpr a1 (Nat.mul_lt_mul_pow_succ ap q1).le
#align liouville.irrational Liouville.irrational
open Polynomial Metric Set Real RingHom
open scoped Polynomial
| Mathlib/NumberTheory/Liouville/Basic.lean | 95 | 120 | theorem exists_one_le_pow_mul_dist {Z N R : Type*} [PseudoMetricSpace R] {d : N → ℝ}
{j : Z → N → R} {f : R → R} {α : R} {ε M : ℝ}
-- denominators are positive
(d0 : ∀ a : N, 1 ≤ d a)
(e0 : 0 < ε)
-- function is Lipschitz at α
(B : ∀ ⦃y : R⦄, y ∈ closedBall α ε → dist (f α) (f y) ≤ dist α y * M)
-- clear denominators
(L : ∀ ⦃z : Z⦄, ∀ ⦃a : N⦄, j z a ∈ closedBall α ε → 1 ≤ d a * dist (f α) (f (j z a))) :
∃ A : ℝ, 0 < A ∧ ∀ z : Z, ∀ a : N, 1 ≤ d a * (dist α (j z a) * A) := by |
-- A useful inequality to keep at hand
have me0 : 0 < max (1 / ε) M := lt_max_iff.mpr (Or.inl (one_div_pos.mpr e0))
-- The maximum between `1 / ε` and `M` works
refine ⟨max (1 / ε) M, me0, fun z a => ?_⟩
-- First, let's deal with the easy case in which we are far away from `α`
by_cases dm1 : 1 ≤ dist α (j z a) * max (1 / ε) M
· exact one_le_mul_of_one_le_of_one_le (d0 a) dm1
· -- `j z a = z / (a + 1)`: we prove that this ratio is close to `α`
have : j z a ∈ closedBall α ε := by
refine mem_closedBall'.mp (le_trans ?_ ((one_div_le me0 e0).mpr (le_max_left _ _)))
exact (le_div_iff me0).mpr (not_le.mp dm1).le
-- use the "separation from `1`" (assumption `L`) for numerators,
refine (L this).trans ?_
-- remove a common factor and use the Lipschitz assumption `B`
refine mul_le_mul_of_nonneg_left ((B this).trans ?_) (zero_le_one.trans (d0 a))
exact mul_le_mul_of_nonneg_left (le_max_right _ M) dist_nonneg
| 2,154 |
import Mathlib.Algebra.Polynomial.DenomsClearable
import Mathlib.Analysis.Calculus.MeanValue
import Mathlib.Analysis.Calculus.Deriv.Polynomial
import Mathlib.Data.Real.Irrational
import Mathlib.Topology.Algebra.Polynomial
#align_import number_theory.liouville.basic from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
def Liouville (x : ℝ) :=
∀ n : ℕ, ∃ a b : ℤ, 1 < b ∧ x ≠ a / b ∧ |x - a / b| < 1 / (b : ℝ) ^ n
#align liouville Liouville
namespace Liouville
protected theorem irrational {x : ℝ} (h : Liouville x) : Irrational x := by
-- By contradiction, `x = a / b`, with `a ∈ ℤ`, `0 < b ∈ ℕ` is a Liouville number,
rintro ⟨⟨a, b, bN0, cop⟩, rfl⟩
-- clear up the mess of constructions of rationals
rw [Rat.cast_mk'] at h
-- Since `a / b` is a Liouville number, there are `p, q ∈ ℤ`, with `q1 : 1 < q`,∈
-- `a0 : a / b ≠ p / q` and `a1 : |a / b - p / q| < 1 / q ^ (b + 1)`
rcases h (b + 1) with ⟨p, q, q1, a0, a1⟩
-- A few useful inequalities
have qR0 : (0 : ℝ) < q := Int.cast_pos.mpr (zero_lt_one.trans q1)
have b0 : (b : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr bN0
have bq0 : (0 : ℝ) < b * q := mul_pos (Nat.cast_pos.mpr bN0.bot_lt) qR0
-- At a1, clear denominators...
replace a1 : |a * q - b * p| * q ^ (b + 1) < b * q := by
rw [div_sub_div _ _ b0 qR0.ne', abs_div, div_lt_div_iff (abs_pos.mpr bq0.ne') (pow_pos qR0 _),
abs_of_pos bq0, one_mul] at a1
exact mod_cast a1
-- At a0, clear denominators...
replace a0 : a * q - ↑b * p ≠ 0 := by
rw [Ne, div_eq_div_iff b0 qR0.ne', mul_comm (p : ℝ), ← sub_eq_zero] at a0
exact mod_cast a0
-- Actually, `q` is a natural number
lift q to ℕ using (zero_lt_one.trans q1).le
-- Looks innocuous, but we now have an integer with non-zero absolute value: this is at
-- least one away from zero. The gain here is what gets the proof going.
have ap : 0 < |a * ↑q - ↑b * p| := abs_pos.mpr a0
-- Actually, the absolute value of an integer is a natural number
-- FIXME: This `lift` call duplicates the hypotheses `a1` and `ap`
lift |a * ↑q - ↑b * p| to ℕ using abs_nonneg (a * ↑q - ↑b * p) with e he
norm_cast at a1 ap q1
-- Recall this is by contradiction: we obtained the inequality `b * q ≤ x * q ^ (b + 1)`, so
-- we are done.
exact not_le.mpr a1 (Nat.mul_lt_mul_pow_succ ap q1).le
#align liouville.irrational Liouville.irrational
open Polynomial Metric Set Real RingHom
open scoped Polynomial
theorem exists_one_le_pow_mul_dist {Z N R : Type*} [PseudoMetricSpace R] {d : N → ℝ}
{j : Z → N → R} {f : R → R} {α : R} {ε M : ℝ}
-- denominators are positive
(d0 : ∀ a : N, 1 ≤ d a)
(e0 : 0 < ε)
-- function is Lipschitz at α
(B : ∀ ⦃y : R⦄, y ∈ closedBall α ε → dist (f α) (f y) ≤ dist α y * M)
-- clear denominators
(L : ∀ ⦃z : Z⦄, ∀ ⦃a : N⦄, j z a ∈ closedBall α ε → 1 ≤ d a * dist (f α) (f (j z a))) :
∃ A : ℝ, 0 < A ∧ ∀ z : Z, ∀ a : N, 1 ≤ d a * (dist α (j z a) * A) := by
-- A useful inequality to keep at hand
have me0 : 0 < max (1 / ε) M := lt_max_iff.mpr (Or.inl (one_div_pos.mpr e0))
-- The maximum between `1 / ε` and `M` works
refine ⟨max (1 / ε) M, me0, fun z a => ?_⟩
-- First, let's deal with the easy case in which we are far away from `α`
by_cases dm1 : 1 ≤ dist α (j z a) * max (1 / ε) M
· exact one_le_mul_of_one_le_of_one_le (d0 a) dm1
· -- `j z a = z / (a + 1)`: we prove that this ratio is close to `α`
have : j z a ∈ closedBall α ε := by
refine mem_closedBall'.mp (le_trans ?_ ((one_div_le me0 e0).mpr (le_max_left _ _)))
exact (le_div_iff me0).mpr (not_le.mp dm1).le
-- use the "separation from `1`" (assumption `L`) for numerators,
refine (L this).trans ?_
-- remove a common factor and use the Lipschitz assumption `B`
refine mul_le_mul_of_nonneg_left ((B this).trans ?_) (zero_le_one.trans (d0 a))
exact mul_le_mul_of_nonneg_left (le_max_right _ M) dist_nonneg
#align liouville.exists_one_le_pow_mul_dist Liouville.exists_one_le_pow_mul_dist
| Mathlib/NumberTheory/Liouville/Basic.lean | 123 | 173 | theorem exists_pos_real_of_irrational_root {α : ℝ} (ha : Irrational α) {f : ℤ[X]} (f0 : f ≠ 0)
(fa : eval α (map (algebraMap ℤ ℝ) f) = 0) :
∃ A : ℝ, 0 < A ∧ ∀ a : ℤ, ∀ b : ℕ,
(1 : ℝ) ≤ ((b : ℝ) + 1) ^ f.natDegree * (|α - a / (b + 1)| * A) := by |
-- `fR` is `f` viewed as a polynomial with `ℝ` coefficients.
set fR : ℝ[X] := map (algebraMap ℤ ℝ) f
-- `fR` is non-zero, since `f` is non-zero.
obtain fR0 : fR ≠ 0 := fun fR0 =>
(map_injective (algebraMap ℤ ℝ) fun _ _ A => Int.cast_inj.mp A).ne f0
(fR0.trans (Polynomial.map_zero _).symm)
-- reformulating assumption `fa`: `α` is a root of `fR`.
have ar : α ∈ (fR.roots.toFinset : Set ℝ) :=
Finset.mem_coe.mpr (Multiset.mem_toFinset.mpr ((mem_roots fR0).mpr (IsRoot.def.mpr fa)))
-- Since the polynomial `fR` has finitely many roots, there is a closed interval centered at `α`
-- such that `α` is the only root of `fR` in the interval.
obtain ⟨ζ, z0, U⟩ : ∃ ζ > 0, closedBall α ζ ∩ fR.roots.toFinset = {α} :=
@exists_closedBall_inter_eq_singleton_of_discrete _ _ _ discrete_of_t1_of_finite _ ar
-- Since `fR` is continuous, it is bounded on the interval above.
obtain ⟨xm, -, hM⟩ : ∃ xm : ℝ, xm ∈ Icc (α - ζ) (α + ζ) ∧
IsMaxOn (|fR.derivative.eval ·|) (Icc (α - ζ) (α + ζ)) xm :=
IsCompact.exists_isMaxOn isCompact_Icc
⟨α, (sub_lt_self α z0).le, (lt_add_of_pos_right α z0).le⟩
(continuous_abs.comp fR.derivative.continuous_aeval).continuousOn
-- Use the key lemma `exists_one_le_pow_mul_dist`: we are left to show that ...
refine
@exists_one_le_pow_mul_dist ℤ ℕ ℝ _ _ _ (fun y => fR.eval y) α ζ |fR.derivative.eval xm| ?_ z0
(fun y hy => ?_) fun z a hq => ?_
-- 1: the denominators are positive -- essentially by definition;
· exact fun a => one_le_pow_of_one_le ((le_add_iff_nonneg_left 1).mpr a.cast_nonneg) _
-- 2: the polynomial `fR` is Lipschitz at `α` -- as its derivative continuous;
· rw [mul_comm]
rw [Real.closedBall_eq_Icc] at hy
-- apply the Mean Value Theorem: the bound on the derivative comes from differentiability.
refine
Convex.norm_image_sub_le_of_norm_deriv_le (fun _ _ => fR.differentiableAt)
(fun y h => by rw [fR.deriv]; exact hM h) (convex_Icc _ _) hy (mem_Icc_iff_abs_le.mp ?_)
exact @mem_closedBall_self ℝ _ α ζ (le_of_lt z0)
-- 3: the weird inequality of Liouville type with powers of the denominators.
· show 1 ≤ (a + 1 : ℝ) ^ f.natDegree * |eval α fR - eval ((z : ℝ) / (a + 1)) fR|
rw [fa, zero_sub, abs_neg]
rw [show (a + 1 : ℝ) = ((a + 1 : ℕ) : ℤ) by norm_cast] at hq ⊢
-- key observation: the right-hand side of the inequality is an *integer*. Therefore,
-- if its absolute value is not at least one, then it vanishes. Proceed by contradiction
refine one_le_pow_mul_abs_eval_div (Int.natCast_succ_pos a) fun hy => ?_
-- As the evaluation of the polynomial vanishes, we found a root of `fR` that is rational.
-- We know that `α` is the only root of `fR` in our interval, and `α` is irrational:
-- follow your nose.
refine (irrational_iff_ne_rational α).mp ha z (a + 1) (mem_singleton_iff.mp ?_).symm
refine U.subset ?_
refine ⟨hq, Finset.mem_coe.mp (Multiset.mem_toFinset.mpr ?_)⟩
exact (mem_roots fR0).mpr (IsRoot.def.mpr hy)
| 2,154 |
import Mathlib.NumberTheory.Liouville.Basic
#align_import number_theory.liouville.liouville_number from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
noncomputable section
open scoped Nat
open Real Finset
def liouvilleNumber (m : ℝ) : ℝ :=
∑' i : ℕ, 1 / m ^ i !
#align liouville_number liouvilleNumber
namespace LiouvilleNumber
def partialSum (m : ℝ) (k : ℕ) : ℝ :=
∑ i ∈ range (k + 1), 1 / m ^ i !
#align liouville_number.partial_sum LiouvilleNumber.partialSum
def remainder (m : ℝ) (k : ℕ) : ℝ :=
∑' i, 1 / m ^ (i + (k + 1))!
#align liouville_number.remainder LiouvilleNumber.remainder
protected theorem summable {m : ℝ} (hm : 1 < m) : Summable fun i : ℕ => 1 / m ^ i ! :=
summable_one_div_pow_of_le hm Nat.self_le_factorial
#align liouville_number.summable LiouvilleNumber.summable
| Mathlib/NumberTheory/Liouville/LiouvilleNumber.lean | 84 | 86 | theorem remainder_summable {m : ℝ} (hm : 1 < m) (k : ℕ) :
Summable fun i : ℕ => 1 / m ^ (i + (k + 1))! := by |
convert (summable_nat_add_iff (k + 1)).2 (LiouvilleNumber.summable hm)
| 2,155 |
import Mathlib.NumberTheory.Liouville.Basic
#align_import number_theory.liouville.liouville_number from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
noncomputable section
open scoped Nat
open Real Finset
def liouvilleNumber (m : ℝ) : ℝ :=
∑' i : ℕ, 1 / m ^ i !
#align liouville_number liouvilleNumber
namespace LiouvilleNumber
def partialSum (m : ℝ) (k : ℕ) : ℝ :=
∑ i ∈ range (k + 1), 1 / m ^ i !
#align liouville_number.partial_sum LiouvilleNumber.partialSum
def remainder (m : ℝ) (k : ℕ) : ℝ :=
∑' i, 1 / m ^ (i + (k + 1))!
#align liouville_number.remainder LiouvilleNumber.remainder
protected theorem summable {m : ℝ} (hm : 1 < m) : Summable fun i : ℕ => 1 / m ^ i ! :=
summable_one_div_pow_of_le hm Nat.self_le_factorial
#align liouville_number.summable LiouvilleNumber.summable
theorem remainder_summable {m : ℝ} (hm : 1 < m) (k : ℕ) :
Summable fun i : ℕ => 1 / m ^ (i + (k + 1))! := by
convert (summable_nat_add_iff (k + 1)).2 (LiouvilleNumber.summable hm)
#align liouville_number.remainder_summable LiouvilleNumber.remainder_summable
theorem remainder_pos {m : ℝ} (hm : 1 < m) (k : ℕ) : 0 < remainder m k :=
tsum_pos (remainder_summable hm k) (fun _ => by positivity) 0 (by positivity)
#align liouville_number.remainder_pos LiouvilleNumber.remainder_pos
theorem partialSum_succ (m : ℝ) (n : ℕ) :
partialSum m (n + 1) = partialSum m n + 1 / m ^ (n + 1)! :=
sum_range_succ _ _
#align liouville_number.partial_sum_succ LiouvilleNumber.partialSum_succ
theorem partialSum_add_remainder {m : ℝ} (hm : 1 < m) (k : ℕ) :
partialSum m k + remainder m k = liouvilleNumber m :=
sum_add_tsum_nat_add _ (LiouvilleNumber.summable hm)
#align liouville_number.partial_sum_add_remainder LiouvilleNumber.partialSum_add_remainder
| Mathlib/NumberTheory/Liouville/LiouvilleNumber.lean | 110 | 134 | theorem remainder_lt' (n : ℕ) {m : ℝ} (m1 : 1 < m) :
remainder m n < (1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) :=
-- two useful inequalities
have m0 : 0 < m := zero_lt_one.trans m1
have mi : 1 / m < 1 := (div_lt_one m0).mpr m1
-- to show the strict inequality between these series, we prove that:
calc
(∑' i, 1 / m ^ (i + (n + 1))!) < ∑' i, 1 / m ^ (i + (n + 1)!) :=
-- 1. the second series dominates the first
tsum_lt_tsum (fun b => one_div_pow_le_one_div_pow_of_le m1.le
(b.add_factorial_succ_le_factorial_add_succ n))
-- 2. the term with index `i = 2` of the first series is strictly smaller than
-- the corresponding term of the second series
(one_div_pow_strictAnti m1 (n.add_factorial_succ_lt_factorial_add_succ (i := 2) le_rfl))
-- 3. the first series is summable
(remainder_summable m1 n)
-- 4. the second series is summable, since its terms grow quickly
(summable_one_div_pow_of_le m1 fun j => le_self_add)
-- split the sum in the exponent and massage
_ = ∑' i : ℕ, (1 / m) ^ i * (1 / m ^ (n + 1)!) := by |
simp only [pow_add, one_div, mul_inv, inv_pow]
-- factor the constant `(1 / m ^ (n + 1)!)` out of the series
_ = (∑' i, (1 / m) ^ i) * (1 / m ^ (n + 1)!) := tsum_mul_right
-- the series is the geometric series
_ = (1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) := by rw [tsum_geometric_of_lt_one (by positivity) mi]
| 2,155 |
import Mathlib.NumberTheory.Liouville.Basic
#align_import number_theory.liouville.liouville_number from "leanprover-community/mathlib"@"04e80bb7e8510958cd9aacd32fe2dc147af0b9f1"
noncomputable section
open scoped Nat
open Real Finset
def liouvilleNumber (m : ℝ) : ℝ :=
∑' i : ℕ, 1 / m ^ i !
#align liouville_number liouvilleNumber
namespace LiouvilleNumber
def partialSum (m : ℝ) (k : ℕ) : ℝ :=
∑ i ∈ range (k + 1), 1 / m ^ i !
#align liouville_number.partial_sum LiouvilleNumber.partialSum
def remainder (m : ℝ) (k : ℕ) : ℝ :=
∑' i, 1 / m ^ (i + (k + 1))!
#align liouville_number.remainder LiouvilleNumber.remainder
protected theorem summable {m : ℝ} (hm : 1 < m) : Summable fun i : ℕ => 1 / m ^ i ! :=
summable_one_div_pow_of_le hm Nat.self_le_factorial
#align liouville_number.summable LiouvilleNumber.summable
theorem remainder_summable {m : ℝ} (hm : 1 < m) (k : ℕ) :
Summable fun i : ℕ => 1 / m ^ (i + (k + 1))! := by
convert (summable_nat_add_iff (k + 1)).2 (LiouvilleNumber.summable hm)
#align liouville_number.remainder_summable LiouvilleNumber.remainder_summable
theorem remainder_pos {m : ℝ} (hm : 1 < m) (k : ℕ) : 0 < remainder m k :=
tsum_pos (remainder_summable hm k) (fun _ => by positivity) 0 (by positivity)
#align liouville_number.remainder_pos LiouvilleNumber.remainder_pos
theorem partialSum_succ (m : ℝ) (n : ℕ) :
partialSum m (n + 1) = partialSum m n + 1 / m ^ (n + 1)! :=
sum_range_succ _ _
#align liouville_number.partial_sum_succ LiouvilleNumber.partialSum_succ
theorem partialSum_add_remainder {m : ℝ} (hm : 1 < m) (k : ℕ) :
partialSum m k + remainder m k = liouvilleNumber m :=
sum_add_tsum_nat_add _ (LiouvilleNumber.summable hm)
#align liouville_number.partial_sum_add_remainder LiouvilleNumber.partialSum_add_remainder
theorem remainder_lt' (n : ℕ) {m : ℝ} (m1 : 1 < m) :
remainder m n < (1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) :=
-- two useful inequalities
have m0 : 0 < m := zero_lt_one.trans m1
have mi : 1 / m < 1 := (div_lt_one m0).mpr m1
-- to show the strict inequality between these series, we prove that:
calc
(∑' i, 1 / m ^ (i + (n + 1))!) < ∑' i, 1 / m ^ (i + (n + 1)!) :=
-- 1. the second series dominates the first
tsum_lt_tsum (fun b => one_div_pow_le_one_div_pow_of_le m1.le
(b.add_factorial_succ_le_factorial_add_succ n))
-- 2. the term with index `i = 2` of the first series is strictly smaller than
-- the corresponding term of the second series
(one_div_pow_strictAnti m1 (n.add_factorial_succ_lt_factorial_add_succ (i := 2) le_rfl))
-- 3. the first series is summable
(remainder_summable m1 n)
-- 4. the second series is summable, since its terms grow quickly
(summable_one_div_pow_of_le m1 fun j => le_self_add)
-- split the sum in the exponent and massage
_ = ∑' i : ℕ, (1 / m) ^ i * (1 / m ^ (n + 1)!) := by
simp only [pow_add, one_div, mul_inv, inv_pow]
-- factor the constant `(1 / m ^ (n + 1)!)` out of the series
_ = (∑' i, (1 / m) ^ i) * (1 / m ^ (n + 1)!) := tsum_mul_right
-- the series is the geometric series
_ = (1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) := by rw [tsum_geometric_of_lt_one (by positivity) mi]
#align liouville_number.remainder_lt' LiouvilleNumber.remainder_lt'
| Mathlib/NumberTheory/Liouville/LiouvilleNumber.lean | 137 | 160 | theorem aux_calc (n : ℕ) {m : ℝ} (hm : 2 ≤ m) :
(1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) ≤ 1 / (m ^ n !) ^ n :=
calc
(1 - 1 / m)⁻¹ * (1 / m ^ (n + 1)!) ≤ 2 * (1 / m ^ (n + 1)!) :=
-- the second factors coincide (and are non-negative),
-- the first factors satisfy the inequality `sub_one_div_inv_le_two`
mul_le_mul_of_nonneg_right (sub_one_div_inv_le_two hm) (by positivity)
_ = 2 / m ^ (n + 1)! := mul_one_div 2 _
_ = 2 / m ^ (n ! * (n + 1)) := (congr_arg (2 / ·) (congr_arg (Pow.pow m) (mul_comm _ _)))
_ ≤ 1 / m ^ (n ! * n) := by |
-- [NB: in this block, I do not follow the brace convention for subgoals -- I wait until
-- I solve all extraneous goals at once with `exact pow_pos (zero_lt_two.trans_le hm) _`.]
-- Clear denominators and massage*
apply (div_le_div_iff _ _).mpr
focus
conv_rhs => rw [one_mul, mul_add, pow_add, mul_one, pow_mul, mul_comm, ← pow_mul]
-- the second factors coincide, so we prove the inequality of the first factors*
refine (mul_le_mul_right ?_).mpr ?_
-- solve all the inequalities `0 < m ^ ??`
any_goals exact pow_pos (zero_lt_two.trans_le hm) _
-- `2 ≤ m ^ n!` is a consequence of monotonicity of exponentiation at `2 ≤ m`.
exact _root_.trans (_root_.trans hm (pow_one _).symm.le)
(pow_right_mono (one_le_two.trans hm) n.factorial_pos)
_ = 1 / (m ^ n !) ^ n := congr_arg (1 / ·) (pow_mul m n ! n)
| 2,155 |
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Baire.LocallyCompactRegular
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c"
open scoped Filter
open Filter Set Metric
| Mathlib/NumberTheory/Liouville/Residual.lean | 25 | 31 | theorem setOf_liouville_eq_iInter_iUnion :
{ x | Liouville x } =
⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b),
ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by |
ext x
simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff,
mem_singleton_iff, mem_ball, Real.dist_eq, and_comm]
| 2,156 |
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Baire.LocallyCompactRegular
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c"
open scoped Filter
open Filter Set Metric
theorem setOf_liouville_eq_iInter_iUnion :
{ x | Liouville x } =
⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b),
ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by
ext x
simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff,
mem_singleton_iff, mem_ball, Real.dist_eq, and_comm]
#align set_of_liouville_eq_Inter_Union setOf_liouville_eq_iInter_iUnion
| Mathlib/NumberTheory/Liouville/Residual.lean | 34 | 38 | theorem IsGδ.setOf_liouville : IsGδ { x | Liouville x } := by |
rw [setOf_liouville_eq_iInter_iUnion]
refine .iInter fun n => IsOpen.isGδ ?_
refine isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => ?_
exact isOpen_ball.inter isClosed_singleton.isOpen_compl
| 2,156 |
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Baire.LocallyCompactRegular
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c"
open scoped Filter
open Filter Set Metric
theorem setOf_liouville_eq_iInter_iUnion :
{ x | Liouville x } =
⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b),
ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by
ext x
simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff,
mem_singleton_iff, mem_ball, Real.dist_eq, and_comm]
#align set_of_liouville_eq_Inter_Union setOf_liouville_eq_iInter_iUnion
theorem IsGδ.setOf_liouville : IsGδ { x | Liouville x } := by
rw [setOf_liouville_eq_iInter_iUnion]
refine .iInter fun n => IsOpen.isGδ ?_
refine isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => ?_
exact isOpen_ball.inter isClosed_singleton.isOpen_compl
set_option linter.uppercaseLean3 false in
#align is_Gδ_set_of_liouville IsGδ.setOf_liouville
@[deprecated (since := "2024-02-15")] alias isGδ_setOf_liouville := IsGδ.setOf_liouville
| Mathlib/NumberTheory/Liouville/Residual.lean | 44 | 55 | theorem setOf_liouville_eq_irrational_inter_iInter_iUnion :
{ x | Liouville x } =
{ x | Irrational x } ∩ ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (hb : 1 < b),
ball (a / b) (1 / (b : ℝ) ^ n) := by |
refine Subset.antisymm ?_ ?_
· refine subset_inter (fun x hx => hx.irrational) ?_
rw [setOf_liouville_eq_iInter_iUnion]
exact iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun _hb => diff_subset
· simp only [inter_iInter, inter_iUnion, setOf_liouville_eq_iInter_iUnion]
refine iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun hb => ?_
rw [inter_comm]
exact diff_subset_diff Subset.rfl (singleton_subset_iff.2 ⟨a / b, by norm_cast⟩)
| 2,156 |
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Baire.Lemmas
import Mathlib.Topology.Baire.LocallyCompactRegular
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.residual from "leanprover-community/mathlib"@"32b08ef840dd25ca2e47e035c5da03ce16d2dc3c"
open scoped Filter
open Filter Set Metric
theorem setOf_liouville_eq_iInter_iUnion :
{ x | Liouville x } =
⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (_ : 1 < b),
ball ((a : ℝ) / b) (1 / (b : ℝ) ^ n) \ {(a : ℝ) / b} := by
ext x
simp only [mem_iInter, mem_iUnion, Liouville, mem_setOf_eq, exists_prop, mem_diff,
mem_singleton_iff, mem_ball, Real.dist_eq, and_comm]
#align set_of_liouville_eq_Inter_Union setOf_liouville_eq_iInter_iUnion
theorem IsGδ.setOf_liouville : IsGδ { x | Liouville x } := by
rw [setOf_liouville_eq_iInter_iUnion]
refine .iInter fun n => IsOpen.isGδ ?_
refine isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => ?_
exact isOpen_ball.inter isClosed_singleton.isOpen_compl
set_option linter.uppercaseLean3 false in
#align is_Gδ_set_of_liouville IsGδ.setOf_liouville
@[deprecated (since := "2024-02-15")] alias isGδ_setOf_liouville := IsGδ.setOf_liouville
theorem setOf_liouville_eq_irrational_inter_iInter_iUnion :
{ x | Liouville x } =
{ x | Irrational x } ∩ ⋂ n : ℕ, ⋃ (a : ℤ) (b : ℤ) (hb : 1 < b),
ball (a / b) (1 / (b : ℝ) ^ n) := by
refine Subset.antisymm ?_ ?_
· refine subset_inter (fun x hx => hx.irrational) ?_
rw [setOf_liouville_eq_iInter_iUnion]
exact iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun _hb => diff_subset
· simp only [inter_iInter, inter_iUnion, setOf_liouville_eq_iInter_iUnion]
refine iInter_mono fun n => iUnion₂_mono fun a b => iUnion_mono fun hb => ?_
rw [inter_comm]
exact diff_subset_diff Subset.rfl (singleton_subset_iff.2 ⟨a / b, by norm_cast⟩)
#align set_of_liouville_eq_irrational_inter_Inter_Union setOf_liouville_eq_irrational_inter_iInter_iUnion
| Mathlib/NumberTheory/Liouville/Residual.lean | 59 | 72 | theorem eventually_residual_liouville : ∀ᶠ x in residual ℝ, Liouville x := by |
rw [Filter.Eventually, setOf_liouville_eq_irrational_inter_iInter_iUnion]
refine eventually_residual_irrational.and ?_
refine residual_of_dense_Gδ ?_ (Rat.denseEmbedding_coe_real.dense.mono ?_)
· exact .iInter fun n => IsOpen.isGδ <|
isOpen_iUnion fun a => isOpen_iUnion fun b => isOpen_iUnion fun _hb => isOpen_ball
· rintro _ ⟨r, rfl⟩
simp only [mem_iInter, mem_iUnion]
refine fun n => ⟨r.num * 2, r.den * 2, ?_, ?_⟩
· have := Int.ofNat_le.2 r.pos; rw [Int.ofNat_one] at this; omega
· convert @mem_ball_self ℝ _ (r : ℝ) _ _
· push_cast; norm_cast; simp [Rat.divInt_mul_right (two_ne_zero), Rat.mkRat_self]
· refine one_div_pos.2 (pow_pos (Int.cast_pos.2 ?_) _)
exact mul_pos (Int.natCast_pos.2 r.pos) zero_lt_two
| 2,156 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 54 | 66 | theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by |
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
| 2,157 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 76 | 85 | theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by |
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
| 2,157 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
#align liouville_with.exists_pos LiouvilleWith.exists_pos
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 89 | 94 | theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by |
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩
refine ⟨m, hne, hlt.trans_le <| ?_⟩
gcongr
exact_mod_cast hn
| 2,157 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
#align liouville_with.exists_pos LiouvilleWith.exists_pos
theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩
refine ⟨m, hne, hlt.trans_le <| ?_⟩
gcongr
exact_mod_cast hn
#align liouville_with.mono LiouvilleWith.mono
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 99 | 110 | theorem frequently_lt_rpow_neg (h : LiouvilleWith p x) (hlt : q < p) :
∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < n ^ (-q) := by |
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
have : ∀ᶠ n : ℕ in atTop, C < n ^ (p - q) := by
simpa only [(· ∘ ·), neg_sub, one_div] using
((tendsto_rpow_atTop (sub_pos.2 hlt)).comp tendsto_natCast_atTop_atTop).eventually
(eventually_gt_atTop C)
refine (this.and_frequently hC).mono ?_
rintro n ⟨hnC, hn, m, hne, hlt⟩
replace hn : (0 : ℝ) < n := Nat.cast_pos.2 hn
refine ⟨m, hne, hlt.trans <| (div_lt_iff <| rpow_pos_of_pos hn _).2 ?_⟩
rwa [mul_comm, ← rpow_add hn, ← sub_eq_add_neg]
| 2,157 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
#align liouville_with.exists_pos LiouvilleWith.exists_pos
theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩
refine ⟨m, hne, hlt.trans_le <| ?_⟩
gcongr
exact_mod_cast hn
#align liouville_with.mono LiouvilleWith.mono
theorem frequently_lt_rpow_neg (h : LiouvilleWith p x) (hlt : q < p) :
∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < n ^ (-q) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
have : ∀ᶠ n : ℕ in atTop, C < n ^ (p - q) := by
simpa only [(· ∘ ·), neg_sub, one_div] using
((tendsto_rpow_atTop (sub_pos.2 hlt)).comp tendsto_natCast_atTop_atTop).eventually
(eventually_gt_atTop C)
refine (this.and_frequently hC).mono ?_
rintro n ⟨hnC, hn, m, hne, hlt⟩
replace hn : (0 : ℝ) < n := Nat.cast_pos.2 hn
refine ⟨m, hne, hlt.trans <| (div_lt_iff <| rpow_pos_of_pos hn _).2 ?_⟩
rwa [mul_comm, ← rpow_add hn, ← sub_eq_add_neg]
#align liouville_with.frequently_lt_rpow_neg LiouvilleWith.frequently_lt_rpow_neg
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 114 | 128 | theorem mul_rat (h : LiouvilleWith p x) (hr : r ≠ 0) : LiouvilleWith p (x * r) := by |
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
refine ⟨r.den ^ p * (|r| * C), (tendsto_id.nsmul_atTop r.pos).frequently (hC.mono ?_)⟩
rintro n ⟨_hn, m, hne, hlt⟩
have A : (↑(r.num * m) : ℝ) / ↑(r.den • id n) = m / n * r := by
simp [← div_mul_div_comm, ← r.cast_def, mul_comm]
refine ⟨r.num * m, ?_, ?_⟩
· rw [A]; simp [hne, hr]
· rw [A, ← sub_mul, abs_mul]
simp only [smul_eq_mul, id, Nat.cast_mul]
calc _ < C / ↑n ^ p * |↑r| := by gcongr
_ = ↑r.den ^ p * (↑|r| * C) / (↑r.den * ↑n) ^ p := ?_
rw [mul_rpow, mul_div_mul_left, mul_comm, mul_div_assoc]
· simp only [Rat.cast_abs, le_refl]
all_goals positivity
| 2,157 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
#align liouville_with.exists_pos LiouvilleWith.exists_pos
theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩
refine ⟨m, hne, hlt.trans_le <| ?_⟩
gcongr
exact_mod_cast hn
#align liouville_with.mono LiouvilleWith.mono
theorem frequently_lt_rpow_neg (h : LiouvilleWith p x) (hlt : q < p) :
∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < n ^ (-q) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
have : ∀ᶠ n : ℕ in atTop, C < n ^ (p - q) := by
simpa only [(· ∘ ·), neg_sub, one_div] using
((tendsto_rpow_atTop (sub_pos.2 hlt)).comp tendsto_natCast_atTop_atTop).eventually
(eventually_gt_atTop C)
refine (this.and_frequently hC).mono ?_
rintro n ⟨hnC, hn, m, hne, hlt⟩
replace hn : (0 : ℝ) < n := Nat.cast_pos.2 hn
refine ⟨m, hne, hlt.trans <| (div_lt_iff <| rpow_pos_of_pos hn _).2 ?_⟩
rwa [mul_comm, ← rpow_add hn, ← sub_eq_add_neg]
#align liouville_with.frequently_lt_rpow_neg LiouvilleWith.frequently_lt_rpow_neg
theorem mul_rat (h : LiouvilleWith p x) (hr : r ≠ 0) : LiouvilleWith p (x * r) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
refine ⟨r.den ^ p * (|r| * C), (tendsto_id.nsmul_atTop r.pos).frequently (hC.mono ?_)⟩
rintro n ⟨_hn, m, hne, hlt⟩
have A : (↑(r.num * m) : ℝ) / ↑(r.den • id n) = m / n * r := by
simp [← div_mul_div_comm, ← r.cast_def, mul_comm]
refine ⟨r.num * m, ?_, ?_⟩
· rw [A]; simp [hne, hr]
· rw [A, ← sub_mul, abs_mul]
simp only [smul_eq_mul, id, Nat.cast_mul]
calc _ < C / ↑n ^ p * |↑r| := by gcongr
_ = ↑r.den ^ p * (↑|r| * C) / (↑r.den * ↑n) ^ p := ?_
rw [mul_rpow, mul_div_mul_left, mul_comm, mul_div_assoc]
· simp only [Rat.cast_abs, le_refl]
all_goals positivity
#align liouville_with.mul_rat LiouvilleWith.mul_rat
theorem mul_rat_iff (hr : r ≠ 0) : LiouvilleWith p (x * r) ↔ LiouvilleWith p x :=
⟨fun h => by
simpa only [mul_assoc, ← Rat.cast_mul, mul_inv_cancel hr, Rat.cast_one, mul_one] using
h.mul_rat (inv_ne_zero hr),
fun h => h.mul_rat hr⟩
#align liouville_with.mul_rat_iff LiouvilleWith.mul_rat_iff
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 142 | 143 | theorem rat_mul_iff (hr : r ≠ 0) : LiouvilleWith p (r * x) ↔ LiouvilleWith p x := by |
rw [mul_comm, mul_rat_iff hr]
| 2,157 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
#align liouville_with.exists_pos LiouvilleWith.exists_pos
theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩
refine ⟨m, hne, hlt.trans_le <| ?_⟩
gcongr
exact_mod_cast hn
#align liouville_with.mono LiouvilleWith.mono
theorem frequently_lt_rpow_neg (h : LiouvilleWith p x) (hlt : q < p) :
∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < n ^ (-q) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
have : ∀ᶠ n : ℕ in atTop, C < n ^ (p - q) := by
simpa only [(· ∘ ·), neg_sub, one_div] using
((tendsto_rpow_atTop (sub_pos.2 hlt)).comp tendsto_natCast_atTop_atTop).eventually
(eventually_gt_atTop C)
refine (this.and_frequently hC).mono ?_
rintro n ⟨hnC, hn, m, hne, hlt⟩
replace hn : (0 : ℝ) < n := Nat.cast_pos.2 hn
refine ⟨m, hne, hlt.trans <| (div_lt_iff <| rpow_pos_of_pos hn _).2 ?_⟩
rwa [mul_comm, ← rpow_add hn, ← sub_eq_add_neg]
#align liouville_with.frequently_lt_rpow_neg LiouvilleWith.frequently_lt_rpow_neg
theorem mul_rat (h : LiouvilleWith p x) (hr : r ≠ 0) : LiouvilleWith p (x * r) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
refine ⟨r.den ^ p * (|r| * C), (tendsto_id.nsmul_atTop r.pos).frequently (hC.mono ?_)⟩
rintro n ⟨_hn, m, hne, hlt⟩
have A : (↑(r.num * m) : ℝ) / ↑(r.den • id n) = m / n * r := by
simp [← div_mul_div_comm, ← r.cast_def, mul_comm]
refine ⟨r.num * m, ?_, ?_⟩
· rw [A]; simp [hne, hr]
· rw [A, ← sub_mul, abs_mul]
simp only [smul_eq_mul, id, Nat.cast_mul]
calc _ < C / ↑n ^ p * |↑r| := by gcongr
_ = ↑r.den ^ p * (↑|r| * C) / (↑r.den * ↑n) ^ p := ?_
rw [mul_rpow, mul_div_mul_left, mul_comm, mul_div_assoc]
· simp only [Rat.cast_abs, le_refl]
all_goals positivity
#align liouville_with.mul_rat LiouvilleWith.mul_rat
theorem mul_rat_iff (hr : r ≠ 0) : LiouvilleWith p (x * r) ↔ LiouvilleWith p x :=
⟨fun h => by
simpa only [mul_assoc, ← Rat.cast_mul, mul_inv_cancel hr, Rat.cast_one, mul_one] using
h.mul_rat (inv_ne_zero hr),
fun h => h.mul_rat hr⟩
#align liouville_with.mul_rat_iff LiouvilleWith.mul_rat_iff
theorem rat_mul_iff (hr : r ≠ 0) : LiouvilleWith p (r * x) ↔ LiouvilleWith p x := by
rw [mul_comm, mul_rat_iff hr]
#align liouville_with.rat_mul_iff LiouvilleWith.rat_mul_iff
theorem rat_mul (h : LiouvilleWith p x) (hr : r ≠ 0) : LiouvilleWith p (r * x) :=
(rat_mul_iff hr).2 h
#align liouville_with.rat_mul LiouvilleWith.rat_mul
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 150 | 151 | theorem mul_int_iff (hm : m ≠ 0) : LiouvilleWith p (x * m) ↔ LiouvilleWith p x := by |
rw [← Rat.cast_intCast, mul_rat_iff (Int.cast_ne_zero.2 hm)]
| 2,157 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace Liouville
variable {x : ℝ}
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 341 | 364 | theorem frequently_exists_num (hx : Liouville x) (n : ℕ) :
∃ᶠ b : ℕ in atTop, ∃ a : ℤ, x ≠ a / b ∧ |x - a / b| < 1 / (b : ℝ) ^ n := by |
refine Classical.not_not.1 fun H => ?_
simp only [Liouville, not_forall, not_exists, not_frequently, not_and, not_lt,
eventually_atTop] at H
rcases H with ⟨N, hN⟩
have : ∀ b > (1 : ℕ), ∀ᶠ m : ℕ in atTop, ∀ a : ℤ, 1 / (b : ℝ) ^ m ≤ |x - a / b| := by
intro b hb
replace hb : (1 : ℝ) < b := Nat.one_lt_cast.2 hb
have H : Tendsto (fun m => 1 / (b : ℝ) ^ m : ℕ → ℝ) atTop (𝓝 0) := by
simp only [one_div]
exact tendsto_inv_atTop_zero.comp (tendsto_pow_atTop_atTop_of_one_lt hb)
refine (H.eventually (hx.irrational.eventually_forall_le_dist_cast_div b)).mono ?_
exact fun m hm a => hm a
have : ∀ᶠ m : ℕ in atTop, ∀ b < N, 1 < b → ∀ a : ℤ, 1 / (b : ℝ) ^ m ≤ |x - a / b| :=
(finite_lt_nat N).eventually_all.2 fun b _hb => eventually_imp_distrib_left.2 (this b)
rcases (this.and (eventually_ge_atTop n)).exists with ⟨m, hm, hnm⟩
rcases hx m with ⟨a, b, hb, hne, hlt⟩
lift b to ℕ using zero_le_one.trans hb.le; norm_cast at hb; push_cast at hne hlt
rcases le_or_lt N b with h | h
· refine (hN b h a hne).not_lt (hlt.trans_le ?_)
gcongr
exact_mod_cast hb.le
· exact (hm b h hb _).not_lt hlt
| 2,157 |
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Filter Set Metric ContinuousLinearMap
open scoped Topology
attribute [local mono] Set.prod_mono
| Mathlib/Analysis/Calculus/FDeriv/Extend.lean | 37 | 106 | theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x : E} {f' : E →L[ℝ] F}
(f_diff : DifferentiableOn ℝ f s) (s_conv : Convex ℝ s) (s_open : IsOpen s)
(f_cont : ∀ y ∈ closure s, ContinuousWithinAt f s y)
(h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) :
HasFDerivWithinAt f f' (closure s) x := by |
classical
-- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
-- statement is empty otherwise
by_cases hx : x ∉ closure s
· rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx
push_neg at hx
rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, Asymptotics.isLittleO_iff]
/- One needs to show that `‖f y - f x - f' (y - x)‖ ≤ ε ‖y - x‖` for `y` close to `x` in
`closure s`, where `ε` is an arbitrary positive constant. By continuity of the functions, it
suffices to prove this for nearby points inside `s`. In a neighborhood of `x`, the derivative
of `f` is arbitrarily close to `f'` by assumption. The mean value inequality completes the
proof. -/
intro ε ε_pos
obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by
simpa [dist_zero_right] using tendsto_nhdsWithin_nhds.1 h ε ε_pos
set B := ball x δ
suffices ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖ from
mem_nhdsWithin_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
suffices
∀ p : E × E,
p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ by
rw [closure_prod_eq] at this
intro y y_in
apply this ⟨x, y⟩
have : B ∩ closure s ⊆ closure (B ∩ s) := isOpen_ball.inter_closure
exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩
have key : ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) →
‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ := by
rintro ⟨u, v⟩ ⟨u_in, v_in⟩
have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv
have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono inter_subset_right
have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε := by
intro z z_in
have h := hδ z
have : fderivWithin ℝ f (B ∩ s) z = fderiv ℝ f z := by
have op : IsOpen (B ∩ s) := isOpen_ball.inter s_open
rw [DifferentiableAt.fderivWithin _ (op.uniqueDiffOn z z_in)]
exact (diff z z_in).differentiableAt (IsOpen.mem_nhds op z_in)
rw [← this] at h
exact le_of_lt (h z_in.2 z_in.1)
simpa using conv.norm_image_sub_le_of_norm_fderivWithin_le' diff bound u_in v_in
rintro ⟨u, v⟩ uv_in
have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - ⇑f') s y := by
intro y y_in
exact Tendsto.sub (f_cont y y_in) f'.cont.continuousWithinAt
refine ContinuousWithinAt.closure_le uv_in ?_ ?_ key
all_goals
-- common start for both continuity proofs
have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right
obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by
simpa [closure_prod_eq] using closure_mono this uv_in
apply ContinuousWithinAt.mono _ this
simp only [ContinuousWithinAt]
· rw [nhdsWithin_prod_eq]
have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
simp only [this]
exact
Tendsto.comp continuous_norm.continuousAt
((Tendsto.comp (f_cont' v v_in) tendsto_snd).sub <|
Tendsto.comp (f_cont' u u_in) tendsto_fst)
· apply tendsto_nhdsWithin_of_tendsto_nhds
rw [nhds_prod_eq]
exact
tendsto_const_nhds.mul
(Tendsto.comp continuous_norm.continuousAt <| tendsto_snd.sub tendsto_fst)
| 2,158 |
import Mathlib.Analysis.Calculus.MeanValue
#align_import analysis.calculus.extend_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Filter Set Metric ContinuousLinearMap
open scoped Topology
attribute [local mono] Set.prod_mono
theorem has_fderiv_at_boundary_of_tendsto_fderiv {f : E → F} {s : Set E} {x : E} {f' : E →L[ℝ] F}
(f_diff : DifferentiableOn ℝ f s) (s_conv : Convex ℝ s) (s_open : IsOpen s)
(f_cont : ∀ y ∈ closure s, ContinuousWithinAt f s y)
(h : Tendsto (fun y => fderiv ℝ f y) (𝓝[s] x) (𝓝 f')) :
HasFDerivWithinAt f f' (closure s) x := by
classical
-- one can assume without loss of generality that `x` belongs to the closure of `s`, as the
-- statement is empty otherwise
by_cases hx : x ∉ closure s
· rw [← closure_closure] at hx; exact hasFDerivWithinAt_of_nmem_closure hx
push_neg at hx
rw [HasFDerivWithinAt, hasFDerivAtFilter_iff_isLittleO, Asymptotics.isLittleO_iff]
intro ε ε_pos
obtain ⟨δ, δ_pos, hδ⟩ : ∃ δ > 0, ∀ y ∈ s, dist y x < δ → ‖fderiv ℝ f y - f'‖ < ε := by
simpa [dist_zero_right] using tendsto_nhdsWithin_nhds.1 h ε ε_pos
set B := ball x δ
suffices ∀ y ∈ B ∩ closure s, ‖f y - f x - (f' y - f' x)‖ ≤ ε * ‖y - x‖ from
mem_nhdsWithin_iff.2 ⟨δ, δ_pos, fun y hy => by simpa using this y hy⟩
suffices
∀ p : E × E,
p ∈ closure ((B ∩ s) ×ˢ (B ∩ s)) → ‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ by
rw [closure_prod_eq] at this
intro y y_in
apply this ⟨x, y⟩
have : B ∩ closure s ⊆ closure (B ∩ s) := isOpen_ball.inter_closure
exact ⟨this ⟨mem_ball_self δ_pos, hx⟩, this y_in⟩
have key : ∀ p : E × E, p ∈ (B ∩ s) ×ˢ (B ∩ s) →
‖f p.2 - f p.1 - (f' p.2 - f' p.1)‖ ≤ ε * ‖p.2 - p.1‖ := by
rintro ⟨u, v⟩ ⟨u_in, v_in⟩
have conv : Convex ℝ (B ∩ s) := (convex_ball _ _).inter s_conv
have diff : DifferentiableOn ℝ f (B ∩ s) := f_diff.mono inter_subset_right
have bound : ∀ z ∈ B ∩ s, ‖fderivWithin ℝ f (B ∩ s) z - f'‖ ≤ ε := by
intro z z_in
have h := hδ z
have : fderivWithin ℝ f (B ∩ s) z = fderiv ℝ f z := by
have op : IsOpen (B ∩ s) := isOpen_ball.inter s_open
rw [DifferentiableAt.fderivWithin _ (op.uniqueDiffOn z z_in)]
exact (diff z z_in).differentiableAt (IsOpen.mem_nhds op z_in)
rw [← this] at h
exact le_of_lt (h z_in.2 z_in.1)
simpa using conv.norm_image_sub_le_of_norm_fderivWithin_le' diff bound u_in v_in
rintro ⟨u, v⟩ uv_in
have f_cont' : ∀ y ∈ closure s, ContinuousWithinAt (f - ⇑f') s y := by
intro y y_in
exact Tendsto.sub (f_cont y y_in) f'.cont.continuousWithinAt
refine ContinuousWithinAt.closure_le uv_in ?_ ?_ key
all_goals
-- common start for both continuity proofs
have : (B ∩ s) ×ˢ (B ∩ s) ⊆ s ×ˢ s := by mono <;> exact inter_subset_right
obtain ⟨u_in, v_in⟩ : u ∈ closure s ∧ v ∈ closure s := by
simpa [closure_prod_eq] using closure_mono this uv_in
apply ContinuousWithinAt.mono _ this
simp only [ContinuousWithinAt]
· rw [nhdsWithin_prod_eq]
have : ∀ u v, f v - f u - (f' v - f' u) = f v - f' v - (f u - f' u) := by intros; abel
simp only [this]
exact
Tendsto.comp continuous_norm.continuousAt
((Tendsto.comp (f_cont' v v_in) tendsto_snd).sub <|
Tendsto.comp (f_cont' u u_in) tendsto_fst)
· apply tendsto_nhdsWithin_of_tendsto_nhds
rw [nhds_prod_eq]
exact
tendsto_const_nhds.mul
(Tendsto.comp continuous_norm.continuousAt <| tendsto_snd.sub tendsto_fst)
#align has_fderiv_at_boundary_of_tendsto_fderiv has_fderiv_at_boundary_of_tendsto_fderiv
| Mathlib/Analysis/Calculus/FDeriv/Extend.lean | 111 | 140 | theorem has_deriv_at_interval_left_endpoint_of_tendsto_deriv {s : Set ℝ} {e : E} {a : ℝ} {f : ℝ → E}
(f_diff : DifferentiableOn ℝ f s) (f_lim : ContinuousWithinAt f s a) (hs : s ∈ 𝓝[>] a)
(f_lim' : Tendsto (fun x => deriv f x) (𝓝[>] a) (𝓝 e)) : HasDerivWithinAt f e (Ici a) a := by |
/- This is a specialization of `has_fderiv_at_boundary_of_tendsto_fderiv`. To be in the setting of
this theorem, we need to work on an open interval with closure contained in `s ∪ {a}`, that we
call `t = (a, b)`. Then, we check all the assumptions of this theorem and we apply it. -/
obtain ⟨b, ab : a < b, sab : Ioc a b ⊆ s⟩ := mem_nhdsWithin_Ioi_iff_exists_Ioc_subset.1 hs
let t := Ioo a b
have ts : t ⊆ s := Subset.trans Ioo_subset_Ioc_self sab
have t_diff : DifferentiableOn ℝ f t := f_diff.mono ts
have t_conv : Convex ℝ t := convex_Ioo a b
have t_open : IsOpen t := isOpen_Ioo
have t_closure : closure t = Icc a b := closure_Ioo ab.ne
have t_cont : ∀ y ∈ closure t, ContinuousWithinAt f t y := by
rw [t_closure]
intro y hy
by_cases h : y = a
· rw [h]; exact f_lim.mono ts
· have : y ∈ s := sab ⟨lt_of_le_of_ne hy.1 (Ne.symm h), hy.2⟩
exact (f_diff.continuousOn y this).mono ts
have t_diff' : Tendsto (fun x => fderiv ℝ f x) (𝓝[t] a) (𝓝 (smulRight (1 : ℝ →L[ℝ] ℝ) e)) := by
simp only [deriv_fderiv.symm]
exact Tendsto.comp
(isBoundedBilinearMap_smulRight : IsBoundedBilinearMap ℝ _).continuous_right.continuousAt
(tendsto_nhdsWithin_mono_left Ioo_subset_Ioi_self f_lim')
-- now we can apply `has_fderiv_at_boundary_of_differentiable`
have : HasDerivWithinAt f e (Icc a b) a := by
rw [hasDerivWithinAt_iff_hasFDerivWithinAt, ← t_closure]
exact has_fderiv_at_boundary_of_tendsto_fderiv t_diff t_conv t_open t_cont t_diff'
exact this.mono_of_mem (Icc_mem_nhdsWithin_Ici <| left_mem_Ico.2 ab)
| 2,158 |
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv
import Mathlib.Analysis.Calculus.FDeriv.Extend
import Mathlib.Analysis.Calculus.Deriv.Prod
import Mathlib.Analysis.SpecialFunctions.Log.Deriv
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.pow.deriv from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
noncomputable section
open scoped Classical Real Topology NNReal ENNReal Filter
open Filter
namespace Complex
| Mathlib/Analysis/SpecialFunctions/Pow/Deriv.lean | 31 | 42 | theorem hasStrictFDerivAt_cpow {p : ℂ × ℂ} (hp : p.1 ∈ slitPlane) :
HasStrictFDerivAt (fun x : ℂ × ℂ => x.1 ^ x.2)
((p.2 * p.1 ^ (p.2 - 1)) • ContinuousLinearMap.fst ℂ ℂ ℂ +
(p.1 ^ p.2 * log p.1) • ContinuousLinearMap.snd ℂ ℂ ℂ) p := by |
have A : p.1 ≠ 0 := slitPlane_ne_zero hp
have : (fun x : ℂ × ℂ => x.1 ^ x.2) =ᶠ[𝓝 p] fun x => exp (log x.1 * x.2) :=
((isOpen_ne.preimage continuous_fst).eventually_mem A).mono fun p hp =>
cpow_def_of_ne_zero hp _
rw [cpow_sub _ _ A, cpow_one, mul_div_left_comm, mul_smul, mul_smul]
refine HasStrictFDerivAt.congr_of_eventuallyEq ?_ this.symm
simpa only [cpow_def_of_ne_zero A, div_eq_mul_inv, mul_smul, add_comm, smul_add] using
((hasStrictFDerivAt_fst.clog hp).mul hasStrictFDerivAt_snd).cexp
| 2,159 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.