Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(measure_theory/interval_integral): FTC-2 #4945

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b20be0a
ftc-2
benjamindavidson Nov 8, 2020
26c22fe
ftc-2
benjamindavidson Nov 8, 2020
5dfee89
chore(data/finset/basic): use `has_coe_t` for coercion of `finset` to…
urkud Nov 8, 2020
f81be76
feat(data/set/intervals/basic): collection of lemmas of the form I??_…
benjamindavidson Nov 8, 2020
81b3324
chore(data/finset/basic): trivial simp lemmas (#4950)
urkud Nov 8, 2020
e43624f
Merge branch 'ftc2' of https://github.com/leanprover-community/mathli…
benjamindavidson Nov 9, 2020
e7ea8b4
Merge branch 'master' of https://github.com/leanprover-community/math…
benjamindavidson Nov 9, 2020
b52285e
lint (test)
benjamindavidson Nov 9, 2020
f9d3bb6
ftc-2
benjamindavidson Nov 8, 2020
201a55e
lint (test)
benjamindavidson Nov 9, 2020
bff5fc9
Merge branch 'ftc2' of https://github.com/leanprover-community/mathli…
benjamindavidson Nov 11, 2020
74bf6d1
Merge branch 'master' into ftc2
urkud Nov 22, 2020
85418fc
Fix some statements (not proofs)
urkud Nov 22, 2020
b4beb3f
Fixed eq_of_right_deriv_eq, eq_of_deriv_eq
benjamindavidson Dec 9, 2020
3dfa1d2
completed has_deriv_within_at_right_integrable
benjamindavidson Dec 14, 2020
f960c75
Merge branch 'master' into ftc2
urkud Dec 19, 2020
71147d1
Drop an unused lemma
urkud Dec 19, 2020
03cc5d2
Fix, golf, move
urkud Dec 19, 2020
81b0706
Fix
urkud Dec 19, 2020
ad49e91
Merge branch 'master' into ftc2
urkud Dec 22, 2020
b0e822b
Fix
urkud Dec 22, 2020
687fe77
docstrings
benjamindavidson Dec 25, 2020
6df448d
Merge branch 'master' into ftc2
urkud Dec 26, 2020
14e3474
Merge branch 'ftc2' of git://github.com/leanprover-community/mathlib …
urkud Dec 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/analysis/calculus/mean_value.lean
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,57 @@ theorem norm_image_sub_le_of_norm_deriv_le_segment_01 {C : ℝ}
by simpa only [sub_zero, mul_one]
using norm_image_sub_le_of_norm_deriv_le_segment hf bound 1 (right_mem_Icc.2 zero_le_one)

theorem constant_of_has_deriv_right_zero (hcont : continuous_on f (Icc a b))
(hderiv : ∀ x ∈ Ico a b, has_deriv_within_at f 0 (Ici x) x) :
∀ x ∈ Icc a b, f x = f a :=
by simpa only [zero_mul, norm_le_zero_iff, sub_eq_zero] using
λ x hx, norm_image_sub_le_of_norm_deriv_right_le_segment
hcont hderiv (λ y hy, by rw norm_le_zero_iff) x hx

theorem constant_of_deriv_within_zero (hdiff : differentiable_on ℝ f (Icc a b))
(hderiv : ∀ x ∈ Ico a b, deriv_within f (Icc a b) x = 0) :
∀ x ∈ Icc a b, f x = f a :=
begin
have H : ∀ x ∈ Ico a b, ∥deriv_within f (Icc a b) x∥ ≤ 0 :=
by simpa only [norm_le_zero_iff] using λ x hx, hderiv x hx,
simpa only [zero_mul, norm_le_zero_iff, sub_eq_zero] using
λ x hx, norm_image_sub_le_of_norm_deriv_le_segment hdiff H x hx,
end

variables {f' g : ℝ → E}

/-- If two continuous functions on `[a, b]` have the same right derivative and are equal at `a`,
then they are equal everywhere on `[a, b]`. -/
theorem eq_of_has_deriv_right_eq
(derivf : ∀ x ∈ Ico a b, has_deriv_within_at f (f' x) (Ici x) x)
(derivg : ∀ x ∈ Ico a b, has_deriv_within_at g (f' x) (Ici x) x)
(fcont : continuous_on f (Icc a b)) (gcont : continuous_on g (Icc a b))
(hi : f a = g a) :
∀ y ∈ Icc a b, f y = g y :=
begin
simp only [← @sub_eq_zero _ _ (f _)] at hi ⊢,
exact hi ▸ constant_of_has_deriv_right_zero (fcont.sub gcont)
(λ y hy, by simpa only [sub_self] using (derivf y hy).sub (derivg y hy)),
end

/-- If two differentiable functions on `[a, b]` have the same derivative within `[a, b]` everywhere
on `[a, b)` and are equal at `a`, then they are equal everywhere on `[a, b]`. -/
theorem eq_of_deriv_within_eq (fdiff : differentiable_on ℝ f (Icc a b))
(gdiff : differentiable_on ℝ g (Icc a b))
(hderiv : eq_on (deriv_within f (Icc a b)) (deriv_within g (Icc a b)) (Ico a b))
(hi : f a = g a) :
∀ y ∈ Icc a b, f y = g y :=
begin
have A : ∀ y ∈ Ico a b, has_deriv_within_at f (deriv_within f (Icc a b) y) (Ici y) y :=
λ y hy, (fdiff y (mem_Icc_of_Ico hy)).has_deriv_within_at.nhds_within
(Icc_mem_nhds_within_Ici hy),
have B : ∀ y ∈ Ico a b, has_deriv_within_at g (deriv_within g (Icc a b) y) (Ici y) y :=
λ y hy, (gdiff y (mem_Icc_of_Ico hy)).has_deriv_within_at.nhds_within
(Icc_mem_nhds_within_Ici hy),
exact eq_of_has_deriv_right_eq A (λ y hy, (hderiv hy).symm ▸ B y hy) fdiff.continuous_on
gdiff.continuous_on hi
end

end

/-! ### Vector-valued functions `f : E → F` -/
Expand Down
97 changes: 94 additions & 3 deletions src/measure_theory/interval_integral.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Author: Yury G. Kudryashov
-/
import measure_theory.set_integral
import measure_theory.lebesgue_measure
import analysis.calculus.deriv
import analysis.calculus.fderiv_measurable
import analysis.calculus.mean_value

/-!
# Integral over an interval
Expand Down Expand Up @@ -203,10 +204,14 @@ begin
all_goals
{ refine measure_theory.integrable_on.mono_set _ Ioc_subset_Icc_self,
refine continuous_on.integrable_on_compact compact_Icc hum (hu.mono _) },
{ exact Icc_subset_interval },
{ exact Icc_subset_interval' }
exacts [Icc_subset_interval, Icc_subset_interval']
end

lemma continuous_on.interval_integrable_of_Icc {u : ℝ → E} {a b : ℝ} (h : a ≤ b)
(hu : continuous_on u (Icc a b)) (hum : measurable u) :
interval_integrable u μ a b :=
continuous_on.interval_integrable ((interval_of_le h).symm ▸ hu) hum

/-- A continuous function on `ℝ` is `interval_integrable` with respect to any locally finite measure
`ν` on ℝ. -/
lemma continuous.interval_integrable [borel_space E] {u : ℝ → E} (hu : continuous u) (a b : ℝ) :
Expand Down Expand Up @@ -1214,4 +1219,90 @@ lemma deriv_within_integral_left (hf : interval_integrable f volume a b)
deriv_within (λ u, ∫ x in u..b, f x) s a = -f a :=
(integral_has_deriv_within_at_left hf ha).deriv_within hs


/-~ ### Theorems pertaining to FTC-2. -/

variables {f' : ℝ → E}

/-- The integral of a continuous function is differentiable on a real set `s`. -/
theorem differentiable_on_integral_of_continuous {s : set ℝ}
(hintg : ∀ x ∈ s, interval_integrable f volume a x) (hcont : continuous f) :
differentiable_on ℝ (λ u, ∫ x in a..u, f x) s :=
λ y hy, (integral_has_deriv_at_right (hintg y hy)
hcont.continuous_at).differentiable_at.differentiable_within_at

/-- The integral of a continuous function is continuous on a real set `s`. This is true even
without the assumption of continuity, but a proof of that fact does not yet exist in mathlib. -/
theorem continuous_on_integral_of_continuous {s : set ℝ}
(hintg : ∀ x ∈ s, interval_integrable f volume a x) (hcont : continuous f) :
continuous_on (λ u, ∫ x in a..u, f x) s :=
(differentiable_on_integral_of_continuous hintg hcont).continuous_on

/-- Fundamental theorem of calculus-2: If `f : ℝ → E` is continuous on `[a, b]` and has a right
derivative at `f' x` for all `x` in `[a, b)`, and `f'` is continuous on `[a, b]` and measurable,
then `∫ y in a..b, f' y` equals `f b - f a`. -/
theorem integral_eq_sub_of_has_deriv_right_of_le (hab : a ≤ b) (hcont : continuous_on f (Icc a b))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why of_le in the name?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this form assumes a ≤ b. Should we move le somewhere else?

(hderiv : ∀ x ∈ Ico a b, has_deriv_within_at f (f' x) (Ici x) x)
(hcont' : continuous_on f' (Icc a b)) (hmeas' : measurable f') :
∫ y in a..b, f' y = f b - f a :=
begin
refine eq_sub_of_add_eq (eq_of_has_deriv_right_eq (λ y hy, _) hderiv
(λ y hy, _) hcont (by simp) _ (right_mem_Icc.2 hab)),
{ refine (integral_has_deriv_within_at_right _ _).add_const _,
{ refine (hcont'.mono _).interval_integrable hmeas',
simp [hy.1, Icc_subset_Icc_right hy.2.le] },
{ exact (hcont' _ (mem_Icc_of_Ico hy)).mono_of_mem (Icc_mem_nhds_within_Ioi hy) } },
{ -- TODO: prove that integral of any integrable function is continuous, and use here
letI : tendsto_Ixx_class Ioc (𝓟 (Icc a b)) (𝓟 (Ioc a b)) :=
tendsto_Ixx_class_principal.2 (λ x hx y hy, Ioc_subset_Ioc hx.1 hy.2),
haveI : is_measurably_generated (𝓝[Ioc a b] y) :=
is_measurable_Ioc.nhds_within_is_measurably_generated y,
letI : FTC_filter y (𝓝[Icc a b] y) (𝓝[Ioc a b] y) := ⟨pure_le_nhds_within hy, inf_le_left⟩,
refine (integral_has_deriv_within_at_right _ _).continuous_within_at.add
continuous_within_at_const,
{ exact (hcont'.mono $ Icc_subset_Icc_right hy.2).interval_integrable_of_Icc hy.1 hmeas' },
{ exact (hcont' y hy).mono Ioc_subset_Icc_self } }
end

/-- Fundamental theorem of calculus-2: If `f : ℝ → E` is continuous on `[a, b]` (where `a ≤ b`) and
has a right derivative at `f' x` for all `x` in `[a, b)`, and `f'` is continuous on `[a, b]` and
measurable, then `∫ y in a..b, f' y` equals `f b - f a`. -/
theorem integral_eq_sub_of_has_deriv_right (hcont : continuous_on f (interval a b))
(hderiv : ∀ x ∈ Ico (min a b) (max a b), has_deriv_within_at f (f' x) (Ici x) x)
(hcont' : continuous_on f' (interval a b)) (hmeas' : measurable f') :
∫ y in a..b, f' y = f b - f a :=
begin
cases le_total a b with hab hab,
{ simp only [interval_of_le, min_eq_left, max_eq_right, hab] at hcont hcont' hderiv,
exact integral_eq_sub_of_has_deriv_right_of_le hab hcont hderiv hcont' hmeas' },
{ simp only [interval_of_ge, min_eq_right, max_eq_left, hab] at hcont hcont' hderiv,
rw [integral_symm, integral_eq_sub_of_has_deriv_right_of_le hab hcont hderiv hcont' hmeas',
neg_sub] }
end

/-- Fundamental theorem of calculus-2: If `f : ℝ → E` is continuous on `[a, b]` and has a derivative
at `f' x` for all `x` in `[a, b)`, and `f'` is continuous on `[a, b]` and measurable, then
`∫ y in a..b, f' y` equals `f b - f a`. -/
theorem integral_eq_sub_of_has_deriv_at' (hcont : continuous_on f (interval a b))
(hderiv : ∀ x ∈ Ico (min a b) (max a b), has_deriv_at f (f' x) x)
(hcont' : continuous_on f' (interval a b)) (hmeas' : measurable f') :
∫ y in a..b, f' y = f b - f a :=
integral_eq_sub_of_has_deriv_right hcont (λ x hx, (hderiv x hx).has_deriv_within_at) hcont' hmeas'

/-- Fundamental theorem of calculus-2: If `f : ℝ → E` has a derivative at `f' x` for all `x` in
`[a, b)` and `f'` is continuous on `[a, b]` and measurable, then `∫ y in a..b, f' y` equals
`f b - f a`. -/
theorem integral_eq_sub_of_has_deriv_at (hderiv : ∀ x ∈ interval a b, has_deriv_at f (f' x) x)
(hcont' : continuous_on f' (interval a b)) (hmeas' : measurable f') :
∫ y in a..b, f' y = f b - f a :=
integral_eq_sub_of_has_deriv_at' (λ x hx, (hderiv x hx).continuous_at.continuous_within_at)
(λ x hx, hderiv _ (mem_Icc_of_Ico hx)) hcont' hmeas'

/-- Fundamental theorem of calculus-2: If `f : ℝ → E` is differentiable at every `x` in `[a, b]` and
its derivative is continuous on `[a, b]`, then `∫ y in a..b, deriv f y` equals `f b - f a`. -/
theorem integral_deriv_eq_sub (hderiv : ∀ x ∈ interval a b, differentiable_at ℝ f x)
(hcont' : continuous_on (deriv f) (interval a b)) :
∫ y in a..b, deriv f y = f b - f a :=
integral_eq_sub_of_has_deriv_at (λ x hx, (hderiv x hx).has_deriv_at) hcont' (measurable_deriv f)

end interval_integral