Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 7697ec6

Browse files
committed
feat(analysis/special_function/integrals): integral of x ^ r, r : ℝ, and x ^ n, n : ℤ (#10650)
Also generalize `has_deriv_at.div_const` etc.
1 parent 779517b commit 7697ec6

File tree

3 files changed

+58
-21
lines changed

3 files changed

+58
-21
lines changed

src/analysis/calculus/deriv.lean

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,8 @@ end inverse
14861486
section division
14871487
/-! ### Derivative of `x ↦ c x / d x` -/
14881488

1489-
variables {c d : 𝕜 → 𝕜} {c' d' : 𝕜}
1489+
variables {𝕜' : Type*} [nondiscrete_normed_field 𝕜'] [normed_algebra 𝕜 𝕜']
1490+
{c d : 𝕜 → 𝕜'} {c' d' : 𝕜'}
14901491

14911492
lemma has_deriv_within_at.div
14921493
(hc : has_deriv_within_at c c' s x) (hd : has_deriv_within_at d d' s x) (hx : d x ≠ 0) :
@@ -1545,28 +1546,40 @@ lemma deriv_within_div
15451546
deriv (λx, c x / d x) x = ((deriv c x) * d x - c x * (deriv d x)) / (d x)^2 :=
15461547
((hc.has_deriv_at).div (hd.has_deriv_at) hx).deriv
15471548

1548-
lemma differentiable_within_at.div_const (hc : differentiable_within_at 𝕜 c s x) {d : 𝕜} :
1549+
lemma has_deriv_at.div_const (hc : has_deriv_at c c' x) (d : 𝕜') :
1550+
has_deriv_at (λ x, c x / d) (c' / d) x :=
1551+
by simpa only [div_eq_mul_inv] using hc.mul_const d⁻¹
1552+
1553+
lemma has_deriv_within_at.div_const (hc : has_deriv_within_at c c' s x) (d : 𝕜') :
1554+
has_deriv_within_at (λ x, c x / d) (c' / d) s x :=
1555+
by simpa only [div_eq_mul_inv] using hc.mul_const d⁻¹
1556+
1557+
lemma has_strict_deriv_at.div_const (hc : has_strict_deriv_at c c' x) (d : 𝕜') :
1558+
has_strict_deriv_at (λ x, c x / d) (c' / d) x :=
1559+
by simpa only [div_eq_mul_inv] using hc.mul_const d⁻¹
1560+
1561+
lemma differentiable_within_at.div_const (hc : differentiable_within_at 𝕜 c s x) {d : 𝕜'} :
15491562
differentiable_within_at 𝕜 (λx, c x / d) s x :=
1550-
by simp [div_eq_inv_mul, differentiable_within_at.const_mul, hc]
1563+
(hc.has_deriv_within_at.div_const _).differentiable_within_at
15511564

1552-
@[simp] lemma differentiable_at.div_const (hc : differentiable_at 𝕜 c x) {d : 𝕜} :
1565+
@[simp] lemma differentiable_at.div_const (hc : differentiable_at 𝕜 c x) {d : 𝕜'} :
15531566
differentiable_at 𝕜 (λ x, c x / d) x :=
1554-
by simpa only [div_eq_mul_inv] using (hc.has_deriv_at.mul_const d⁻¹).differentiable_at
1567+
(hc.has_deriv_at.div_const _).differentiable_at
15551568

1556-
lemma differentiable_on.div_const (hc : differentiable_on 𝕜 c s) {d : 𝕜} :
1569+
lemma differentiable_on.div_const (hc : differentiable_on 𝕜 c s) {d : 𝕜'} :
15571570
differentiable_on 𝕜 (λx, c x / d) s :=
1558-
by simp [div_eq_inv_mul, differentiable_on.const_mul, hc]
1571+
λ x hx, (hc x hx).div_const
15591572

1560-
@[simp] lemma differentiable.div_const (hc : differentiable 𝕜 c) {d : 𝕜} :
1573+
@[simp] lemma differentiable.div_const (hc : differentiable 𝕜 c) {d : 𝕜'} :
15611574
differentiable 𝕜 (λx, c x / d) :=
1562-
by simp [div_eq_inv_mul, differentiable.const_mul, hc]
1575+
λ x, (hc x).div_const
15631576

1564-
lemma deriv_within_div_const (hc : differentiable_within_at 𝕜 c s x) {d : 𝕜}
1577+
lemma deriv_within_div_const (hc : differentiable_within_at 𝕜 c s x) {d : 𝕜'}
15651578
(hxs : unique_diff_within_at 𝕜 s x) :
15661579
deriv_within (λx, c x / d) s x = (deriv_within c s x) / d :=
15671580
by simp [div_eq_inv_mul, deriv_within_const_mul, hc, hxs]
15681581

1569-
@[simp] lemma deriv_div_const (d : 𝕜) :
1582+
@[simp] lemma deriv_div_const (d : 𝕜') :
15701583
deriv (λx, c x / d) x = (deriv c x) / d :=
15711584
by simp only [div_eq_mul_inv, deriv_mul_const_field]
15721585

src/analysis/special_functions/integrals.lean

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ variables {f : ℝ → ℝ} {μ ν : measure ℝ} [is_locally_finite_measure μ]
4444
lemma interval_integrable_pow : interval_integrable (λ x, x^n) μ a b :=
4545
(continuous_pow n).interval_integrable a b
4646

47+
lemma interval_integrable_zpow {n : ℤ} (h : 0 ≤ n ∨ (0 : ℝ) ∉ [a, b]) :
48+
interval_integrable (λ x, x ^ n) μ a b :=
49+
(continuous_on_id.zpow n $ λ x hx, h.symm.imp (ne_of_mem_of_not_mem hx) id).interval_integrable
50+
51+
lemma interval_integrable_rpow {r : ℝ} (h : 0 ≤ r ∨ (0 : ℝ) ∉ [a, b]) :
52+
interval_integrable (λ x, x ^ r) μ a b :=
53+
(continuous_on_id.rpow_const $ λ x hx, h.symm.imp (ne_of_mem_of_not_mem hx) id).interval_integrable
54+
4755
@[simp]
4856
lemma interval_integrable_id : interval_integrable (λ x, x) μ a b :=
4957
continuous_id.interval_integrable a b
@@ -164,17 +172,33 @@ open interval_integral
164172

165173
/-! ### Integrals of simple functions -/
166174

167-
@[simp]
168-
lemma integral_pow : ∫ x in a..b, x ^ n = (b ^ (n + 1) - a ^ (n + 1)) / (n + 1) :=
175+
lemma integral_rpow {r : ℝ} (h : 0 ≤ r ∨ r ≠ -1 ∧ (0 : ℝ) ∉ [a, b]) :
176+
∫ x in a..b, x ^ r = (b ^ (r + 1) - a ^ (r + 1)) / (r + 1) :=
169177
begin
170-
have hderiv : deriv (λ x : ℝ, x ^ (n + 1) / (n + 1)) = λ x, x ^ n,
171-
{ ext,
172-
have hne : (n + 1 : ℝ) ≠ 0 := by exact_mod_cast succ_ne_zero n,
173-
simp [mul_div_assoc, mul_div_cancel' _ hne] },
174-
rw integral_deriv_eq_sub' _ hderiv;
175-
norm_num [div_sub_div_same, continuous_on_pow],
178+
suffices : ∀ x ∈ [a, b], has_deriv_at (λ x : ℝ, x ^ (r + 1) / (r + 1)) (x ^ r) x,
179+
{ rw sub_div,
180+
exact integral_eq_sub_of_has_deriv_at this (interval_integrable_rpow (h.imp_right and.right)) },
181+
intros x hx,
182+
have hx' : x ≠ 01 ≤ r + 1,
183+
from h.symm.imp (λ h, ne_of_mem_of_not_mem hx h.2) (le_add_iff_nonneg_left _).2,
184+
convert (real.has_deriv_at_rpow_const hx').div_const (r + 1),
185+
rw [add_sub_cancel, mul_div_cancel_left],
186+
rw [ne.def, ← eq_neg_iff_add_eq_zero],
187+
rintro rfl,
188+
apply (@zero_lt_one ℝ _ _).not_le,
189+
simpa using h
176190
end
177191

192+
lemma integral_zpow {n : ℤ} (h : 0 ≤ n ∨ n ≠ -1 ∧ (0 : ℝ) ∉ [a, b]) :
193+
∫ x in a..b, x ^ n = (b ^ (n + 1) - a ^ (n + 1)) / (n + 1) :=
194+
begin
195+
replace h : 0 ≤ (n : ℝ) ∨ (n : ℝ) ≠ -1 ∧ (0 : ℝ) ∉ [a, b], by exact_mod_cast h,
196+
exact_mod_cast integral_rpow h
197+
end
198+
199+
@[simp] lemma integral_pow : ∫ x in a..b, x ^ n = (b ^ (n + 1) - a ^ (n + 1)) / (n + 1) :=
200+
by simpa using integral_zpow (or.inl (int.coe_nat_nonneg n))
201+
178202
/-- Integral of `|x - a| ^ n` over `Ι a b`. This integral appears in the proof of the
179203
Picard-Lindelöf/Cauchy-Lipschitz theorem. -/
180204
lemma integral_pow_abs_sub_interval_oc :

src/analysis/special_functions/pow.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,11 @@ by simpa using rpow_add_nat hx y 1
470470
lemma rpow_sub_one {x : ℝ} (hx : x ≠ 0) (y : ℝ) : x ^ (y - 1) = x ^ y / x :=
471471
by simpa using rpow_sub_nat hx y 1
472472

473-
@[simp] lemma rpow_int_cast (x : ℝ) (n : ℤ) : x ^ (n : ℝ) = x ^ n :=
473+
@[simp, norm_cast] lemma rpow_int_cast (x : ℝ) (n : ℤ) : x ^ (n : ℝ) = x ^ n :=
474474
by simp only [rpow_def, ← complex.of_real_zpow, complex.cpow_int_cast,
475475
complex.of_real_int_cast, complex.of_real_re]
476476

477-
@[simp] lemma rpow_nat_cast (x : ℝ) (n : ℕ) : x ^ (n : ℝ) = x ^ n :=
477+
@[simp, norm_cast] lemma rpow_nat_cast (x : ℝ) (n : ℕ) : x ^ (n : ℝ) = x ^ n :=
478478
rpow_int_cast x n
479479

480480
lemma rpow_neg_one (x : ℝ) : x ^ (-1 : ℝ) = x⁻¹ :=

0 commit comments

Comments
 (0)