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

Commit 700d477

Browse files
feat(analysis/special_functions/integrals): integral_comp for f : ℝ → ℝ (#7216)
In #7103 I added lemmas to deal with integrals of the form `c • ∫ x in a..b, f (c * x + d)`. However, it came to my attention that, with those lemmas, `simp` can only handle such integrals if they use `•`, not `*`. To solve this problem and enable computation of these integrals by `simp`, I add versions of the aforementioned `integral_comp` lemmas specialized with `f : ℝ → ℝ` and label them with `simp`.
1 parent 721e0b9 commit 700d477

File tree

3 files changed

+61
-18
lines changed

3 files changed

+61
-18
lines changed

src/analysis/special_functions/integrals.lean

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,64 @@ variables {a b : ℝ}
2828

2929
namespace interval_integral
3030
open measure_theory
31-
variables {f : ℝ → ℝ} {μ ν : measure ℝ} [locally_finite_measure μ]
31+
variables {f : ℝ → ℝ} {μ ν : measure ℝ} [locally_finite_measure μ] (c d : ℝ)
3232

3333
@[simp]
34-
lemma integral_const_mul (c : ℝ) : ∫ x in a..b, c * f x = c * ∫ x in a..b, f x :=
34+
lemma integral_const_mul : ∫ x in a..b, c * f x = c * ∫ x in a..b, f x :=
3535
integral_smul c
3636

3737
@[simp]
38-
lemma integral_mul_const (c : ℝ) : ∫ x in a..b, f x * c = (∫ x in a..b, f x) * c :=
38+
lemma integral_mul_const : ∫ x in a..b, f x * c = (∫ x in a..b, f x) * c :=
3939
by simp only [mul_comm, integral_const_mul]
4040

4141
@[simp]
42-
lemma integral_div (c : ℝ) : ∫ x in a..b, f x / c = (∫ x in a..b, f x) / c :=
42+
lemma integral_div : ∫ x in a..b, f x / c = (∫ x in a..b, f x) / c :=
4343
integral_mul_const c⁻¹
4444

45+
@[simp]
46+
lemma mul_integral_comp_mul_right : c * ∫ x in a..b, f (x * c) = ∫ x in a*c..b*c, f x :=
47+
smul_integral_comp_mul_right f c
48+
49+
@[simp]
50+
lemma mul_integral_comp_mul_left : c * ∫ x in a..b, f (c * x) = ∫ x in c*a..c*b, f x :=
51+
smul_integral_comp_mul_left f c
52+
53+
@[simp]
54+
lemma inv_mul_integral_comp_div : c⁻¹ * ∫ x in a..b, f (x / c) = ∫ x in a/c..b/c, f x :=
55+
inv_smul_integral_comp_div f c
56+
57+
@[simp]
58+
lemma mul_integral_comp_mul_add : c * ∫ x in a..b, f (c * x + d) = ∫ x in c*a+d..c*b+d, f x :=
59+
smul_integral_comp_mul_add f c d
60+
61+
@[simp]
62+
lemma mul_integral_comp_add_mul : c * ∫ x in a..b, f (d + c * x) = ∫ x in d+c*a..d+c*b, f x :=
63+
smul_integral_comp_add_mul f c d
64+
65+
@[simp]
66+
lemma inv_mul_integral_comp_div_add : c⁻¹ * ∫ x in a..b, f (x / c + d) = ∫ x in a/c+d..b/c+d, f x :=
67+
inv_smul_integral_comp_div_add f c d
68+
69+
@[simp]
70+
lemma inv_mul_integral_comp_add_div : c⁻¹ * ∫ x in a..b, f (d + x / c) = ∫ x in d+a/c..d+b/c, f x :=
71+
inv_smul_integral_comp_add_div f c d
72+
73+
@[simp]
74+
lemma mul_integral_comp_mul_sub : c * ∫ x in a..b, f (c * x - d) = ∫ x in c*a-d..c*b-d, f x :=
75+
smul_integral_comp_mul_sub f c d
76+
77+
@[simp]
78+
lemma mul_integral_comp_sub_mul : c * ∫ x in a..b, f (d - c * x) = ∫ x in d-c*b..d-c*a, f x :=
79+
smul_integral_comp_sub_mul f c d
80+
81+
@[simp]
82+
lemma inv_mul_integral_comp_div_sub : c⁻¹ * ∫ x in a..b, f (x / c - d) = ∫ x in a/c-d..b/c-d, f x :=
83+
inv_smul_integral_comp_div_sub f c d
84+
85+
@[simp]
86+
lemma inv_mul_integral_comp_sub_div : c⁻¹ * ∫ x in a..b, f (d - x / c) = ∫ x in d-b/c..d-a/c, f x :=
87+
inv_smul_integral_comp_sub_div f c d
88+
4589
@[simp]
4690
lemma interval_integrable_pow (n : ℕ) : interval_integrable (λ x, x^n) μ a b :=
4791
(continuous_pow n).interval_integrable a b

src/measure_theory/interval_integral.lean

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ by { simp only [interval_integral, integral_neg], abel }
355355
∫ x in a..b, f x - g x ∂μ = ∫ x in a..b, f x ∂μ - ∫ x in a..b, g x ∂μ :=
356356
by simpa only [sub_eq_add_neg] using (integral_add hf hg.neg).trans (congr_arg _ integral_neg)
357357

358-
lemma integral_smul (r : ℝ) : ∫ x in a..b, r • f x ∂μ = r • ∫ x in a..b, f x ∂μ :=
358+
@[simp] lemma integral_smul (r : ℝ) : ∫ x in a..b, r • f x ∂μ = r • ∫ x in a..b, f x ∂μ :=
359359
by simp only [interval_integral, integral_smul, smul_sub]
360360

361361
lemma integral_const' (c : E) :
@@ -389,23 +389,23 @@ begin
389389
{ simp [(show 0 < c, from h), mul_div_cancel, hc, abs_of_pos] }
390390
end
391391

392-
@[simp] lemma integral_comp_mul_right' (c) :
392+
@[simp] lemma smul_integral_comp_mul_right (c) :
393393
c • ∫ x in a..b, f (x * c) = ∫ x in a*c..b*c, f x :=
394394
by by_cases hc : c = 0; simp [hc]
395395

396396
@[simp] lemma integral_comp_mul_left (hc : c ≠ 0) :
397397
∫ x in a..b, f (c * x) = c⁻¹ • ∫ x in c*a..c*b, f x :=
398398
by simpa only [mul_comm c] using integral_comp_mul_right f hc
399399

400-
@[simp] lemma integral_comp_mul_left' (c) :
400+
@[simp] lemma smul_integral_comp_mul_left (c) :
401401
c • ∫ x in a..b, f (c * x) = ∫ x in c*a..c*b, f x :=
402402
by by_cases hc : c = 0; simp [hc]
403403

404404
@[simp] lemma integral_comp_div (hc : c ≠ 0) :
405405
∫ x in a..b, f (x / c) = c • ∫ x in a/c..b/c, f x :=
406406
by simpa only [inv_inv'] using integral_comp_mul_right f (inv_ne_zero hc)
407407

408-
@[simp] lemma integral_comp_div' (c) :
408+
@[simp] lemma inv_smul_integral_comp_div (c) :
409409
c⁻¹ • ∫ x in a..b, f (x / c) = ∫ x in a/c..b/c, f x :=
410410
by by_cases hc : c = 0; simp [hc]
411411

@@ -421,39 +421,39 @@ calc ∫ x in a..b, f (x + d)
421421
∫ x in a..b, f (c * x + d) = c⁻¹ • ∫ x in c*a+d..c*b+d, f x :=
422422
by rw [← integral_comp_add_right f d, ← integral_comp_mul_left _ hc]
423423

424-
@[simp] lemma integral_comp_mul_add' (c d) :
424+
@[simp] lemma smul_integral_comp_mul_add (c d) :
425425
c • ∫ x in a..b, f (c * x + d) = ∫ x in c*a+d..c*b+d, f x :=
426426
by by_cases hc : c = 0; simp [hc]
427427

428428
@[simp] lemma integral_comp_add_mul (hc : c ≠ 0) (d) :
429429
∫ x in a..b, f (d + c * x) = c⁻¹ • ∫ x in d+c*a..d+c*b, f x :=
430430
by simpa only [add_comm] using integral_comp_mul_add f hc d
431431

432-
@[simp] lemma integral_comp_add_mul' (c d) :
432+
@[simp] lemma smul_integral_comp_add_mul (c d) :
433433
c • ∫ x in a..b, f (d + c * x) = ∫ x in d+c*a..d+c*b, f x :=
434434
by by_cases hc : c = 0; simp [hc]
435435

436436
@[simp] lemma integral_comp_div_add (hc : c ≠ 0) (d) :
437437
∫ x in a..b, f (x / c + d) = c • ∫ x in a/c+d..b/c+d, f x :=
438438
by simpa only [div_eq_inv_mul, inv_inv'] using integral_comp_mul_add f (inv_ne_zero hc) d
439439

440-
@[simp] lemma integral_comp_div_add' (c d) :
440+
@[simp] lemma inv_smul_integral_comp_div_add (c d) :
441441
c⁻¹ • ∫ x in a..b, f (x / c + d) = ∫ x in a/c+d..b/c+d, f x :=
442442
by by_cases hc : c = 0; simp [hc]
443443

444444
@[simp] lemma integral_comp_add_div (hc : c ≠ 0) (d) :
445445
∫ x in a..b, f (d + x / c) = c • ∫ x in d+a/c..d+b/c, f x :=
446446
by simpa only [div_eq_inv_mul, inv_inv'] using integral_comp_add_mul f (inv_ne_zero hc) d
447447

448-
@[simp] lemma integral_comp_add_div' (c d) :
448+
@[simp] lemma inv_smul_integral_comp_add_div (c d) :
449449
c⁻¹ • ∫ x in a..b, f (d + x / c) = ∫ x in d+a/c..d+b/c, f x :=
450450
by by_cases hc : c = 0; simp [hc]
451451

452452
@[simp] lemma integral_comp_mul_sub (hc : c ≠ 0) (d) :
453453
∫ x in a..b, f (c * x - d) = c⁻¹ • ∫ x in c*a-d..c*b-d, f x :=
454454
by simpa only [sub_eq_add_neg] using integral_comp_mul_add f hc (-d)
455455

456-
@[simp] lemma integral_comp_mul_sub' (c d) :
456+
@[simp] lemma smul_integral_comp_mul_sub (c d) :
457457
c • ∫ x in a..b, f (c * x - d) = ∫ x in c*a-d..c*b-d, f x :=
458458
by by_cases hc : c = 0; simp [hc]
459459

@@ -465,23 +465,23 @@ begin
465465
simp only [inv_neg, smul_neg, neg_neg, neg_smul],
466466
end
467467

468-
@[simp] lemma integral_comp_sub_mul' (c d) :
468+
@[simp] lemma smul_integral_comp_sub_mul (c d) :
469469
c • ∫ x in a..b, f (d - c * x) = ∫ x in d-c*b..d-c*a, f x :=
470470
by by_cases hc : c = 0; simp [hc]
471471

472472
@[simp] lemma integral_comp_div_sub (hc : c ≠ 0) (d) :
473473
∫ x in a..b, f (x / c - d) = c • ∫ x in a/c-d..b/c-d, f x :=
474474
by simpa only [div_eq_inv_mul, inv_inv'] using integral_comp_mul_sub f (inv_ne_zero hc) d
475475

476-
@[simp] lemma integral_comp_div_sub' (c d) :
476+
@[simp] lemma inv_smul_integral_comp_div_sub (c d) :
477477
c⁻¹ • ∫ x in a..b, f (x / c - d) = ∫ x in a/c-d..b/c-d, f x :=
478478
by by_cases hc : c = 0; simp [hc]
479479

480480
@[simp] lemma integral_comp_sub_div (hc : c ≠ 0) (d) :
481481
∫ x in a..b, f (d - x / c) = c • ∫ x in d-b/c..d-a/c, f x :=
482482
by simpa only [div_eq_inv_mul, inv_inv'] using integral_comp_sub_mul f (inv_ne_zero hc) d
483483

484-
@[simp] lemma integral_comp_sub_div' (c d) :
484+
@[simp] lemma inv_smul_integral_comp_sub_div (c d) :
485485
c⁻¹ • ∫ x in a..b, f (d - x / c) = ∫ x in d-b/c..d-a/c, f x :=
486486
by by_cases hc : c = 0; simp [hc]
487487

test/integration.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ example : ∫ x in 0..2, -exp (-x) = exp (-2) - 1 := by norm_num
4646
example : ∫ x in 1..2, exp (5*x - 5) = 1/5 * (exp 5 - 1) := by norm_num
4747
example : ∫ x in 0..π, cos (x/2) = 2 := by norm_num
4848
example : ∫ x in 0..π/4, sin (2*x) = 1/2 := by norm_num [mul_div_comm, mul_one_div]
49-
example (ω φ : ℝ) : ω * ∫ θ in 0..π, sin (ω*θ + φ) = cos φ - cos (ω*π + φ) :=
50-
by { rw ← smul_eq_mul, simp }
49+
example (ω φ : ℝ) : ω * ∫ θ in 0..π, sin (ω*θ + φ) = cos φ - cos (ω*π + φ) := by simp
5150

5251
/- some examples may require a bit of algebraic massaging -/
5352
example {L : ℝ} (h : L ≠ 0) : ∫ x in 0..2/L*π, sin (L/2 * x) = 4 / L :=

0 commit comments

Comments
 (0)