Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
Copyright (c) 2022 Kevin H. Wilson. All rights reserved. | |
Released under Apache 2.0 license as described in the file LICENSE. | |
Authors: Kevin H. Wilson | |
-/ | |
import measure_theory.integral.interval_integral | |
import algebra.order.floor | |
import data.set.function | |
import analysis.special_functions.integrals | |
/-! | |
# Comparing sums and integrals | |
## Summary | |
It is often the case that error terms in analysis can be computed by comparing | |
an infinite sum to the improper integral of an antitone function. This file will eventually enable | |
that. | |
At the moment it contains four lemmas in this direction: `antitone_on.integral_le_sum`, | |
`antitone_on.sum_le_integral` and versions for monotone functions, which can all be paired | |
with a `filter.tendsto` to estimate some errors. | |
`TODO`: Add more lemmas to the API to directly address limiting issues | |
## Main Results | |
* `antitone_on.integral_le_sum`: The integral of an antitone function is at most the sum of its | |
values at integer steps aligning with the left-hand side of the interval | |
* `antitone_on.sum_le_integral`: The sum of an antitone function along integer steps aligning with | |
the right-hand side of the interval is at most the integral of the function along that interval | |
* `monotone_on.integral_le_sum`: The integral of a monotone function is at most the sum of its | |
values at integer steps aligning with the right-hand side of the interval | |
* `monotone_on.sum_le_integral`: The sum of a monotone function along integer steps aligning with | |
the left-hand side of the interval is at most the integral of the function along that interval | |
## Tags | |
analysis, comparison, asymptotics | |
-/ | |
open set measure_theory.measure_space | |
open_locale big_operators | |
variables {xβ : β} {a b : β} {f : β β β} | |
lemma antitone_on.integral_le_sum (hf : antitone_on f (Icc xβ (xβ + a))) : | |
β« x in xβ..(xβ + a), f x β€ β i in finset.range a, f (xβ + i) := | |
begin | |
have hint : β (k : β), k < a β interval_integrable f volume (xβ+k) (xβ + (k + 1 : β)), | |
{ assume k hk, | |
refine (hf.mono _).interval_integrable, | |
rw interval_of_le, | |
{ apply Icc_subset_Icc, | |
{ simp only [le_add_iff_nonneg_right, nat.cast_nonneg] }, | |
{ simp only [add_le_add_iff_left, nat.cast_le, nat.succ_le_of_lt hk] } }, | |
{ simp only [add_le_add_iff_left, nat.cast_le, nat.le_succ] } }, | |
calc | |
β« x in xβ..(xβ + a), f x = β i in finset.range a, β« x in (xβ+i)..(xβ+(i+1 : β)), f x : | |
begin | |
convert (interval_integral.sum_integral_adjacent_intervals hint).symm, | |
simp only [nat.cast_zero, add_zero], | |
end | |
... β€ β i in finset.range a, β« x in (xβ+i)..(xβ+(i+1 : β)), f (xβ + i) : | |
begin | |
apply finset.sum_le_sum (Ξ» i hi, _), | |
have ia : i < a := finset.mem_range.1 hi, | |
refine interval_integral.integral_mono_on (by simp) (hint _ ia) (by simp) (Ξ» x hx, _), | |
apply hf _ _ hx.1, | |
{ simp only [ia.le, mem_Icc, le_add_iff_nonneg_right, nat.cast_nonneg, add_le_add_iff_left, | |
nat.cast_le, and_self] }, | |
{ refine mem_Icc.2 β¨le_trans (by simp) hx.1, le_trans hx.2 _β©, | |
simp only [add_le_add_iff_left, nat.cast_le, nat.succ_le_of_lt ia] }, | |
end | |
... = β i in finset.range a, f (xβ + i) : by simp | |
end | |
lemma antitone_on.integral_le_sum_Ico (hab : a β€ b) (hf : antitone_on f (set.Icc a b)) : | |
β« x in a..b, f x β€ β x in finset.Ico a b, f x := | |
begin | |
rw [(nat.sub_add_cancel hab).symm, nat.cast_add], | |
conv { congr, congr, skip, skip, rw add_comm, skip, skip, congr, congr, rw βzero_add a, }, | |
rw [β finset.sum_Ico_add, nat.Ico_zero_eq_range], | |
conv { to_rhs, congr, skip, funext, rw nat.cast_add, }, | |
apply antitone_on.integral_le_sum, | |
simp only [hf, hab, nat.cast_sub, add_sub_cancel'_right], | |
end | |
lemma antitone_on.sum_le_integral (hf : antitone_on f (Icc xβ (xβ + a))) : | |
β i in finset.range a, f (xβ + (i + 1 : β)) β€ β« x in xβ..(xβ + a), f x := | |
begin | |
have hint : β (k : β), k < a β interval_integrable f volume (xβ+k) (xβ + (k + 1 : β)), | |
{ assume k hk, | |
refine (hf.mono _).interval_integrable, | |
rw interval_of_le, | |
{ apply Icc_subset_Icc, | |
{ simp only [le_add_iff_nonneg_right, nat.cast_nonneg] }, | |
{ simp only [add_le_add_iff_left, nat.cast_le, nat.succ_le_of_lt hk] } }, | |
{ simp only [add_le_add_iff_left, nat.cast_le, nat.le_succ] } }, | |
calc β i in finset.range a, f (xβ + (i + 1 : β)) | |
= β i in finset.range a, β« x in (xβ+i)..(xβ+(i+1:β)), f (xβ + (i + 1 : β)) : by simp | |
... β€ β i in finset.range a, β« x in (xβ+i)..(xβ+(i+1:β)), f x : | |
begin | |
apply finset.sum_le_sum (Ξ» i hi, _), | |
have ia : i + 1 β€ a := finset.mem_range.1 hi, | |
refine interval_integral.integral_mono_on (by simp) (by simp) (hint _ ia) (Ξ» x hx, _), | |
apply hf _ _ hx.2, | |
{ refine mem_Icc.2 β¨le_trans ((le_add_iff_nonneg_right _).2 (nat.cast_nonneg _)) hx.1, | |
le_trans hx.2 _β©, | |
simp only [nat.cast_le, add_le_add_iff_left, ia] }, | |
{ refine mem_Icc.2 β¨(le_add_iff_nonneg_right _).2 (nat.cast_nonneg _), _β©, | |
simp only [add_le_add_iff_left, nat.cast_le, ia] }, | |
end | |
... = β« x in xβ..(xβ + a), f x : | |
begin | |
convert interval_integral.sum_integral_adjacent_intervals hint, | |
simp only [nat.cast_zero, add_zero], | |
end | |
end | |
lemma antitone_on.sum_le_integral_Ico (hab : a β€ b) (hf : antitone_on f (set.Icc a b)) : | |
β i in finset.Ico a b, f (i + 1 : β) β€ β« x in a..b, f x := | |
begin | |
rw [(nat.sub_add_cancel hab).symm, nat.cast_add], | |
conv { congr, congr, congr, rw β zero_add a, skip, skip, skip, rw add_comm, }, | |
rw [β finset.sum_Ico_add, nat.Ico_zero_eq_range], | |
conv { to_lhs, congr, congr, skip, funext, rw [add_assoc, nat.cast_add], }, | |
apply antitone_on.sum_le_integral, | |
simp only [hf, hab, nat.cast_sub, add_sub_cancel'_right], | |
end | |
lemma monotone_on.sum_le_integral (hf : monotone_on f (Icc xβ (xβ + a))) : | |
β i in finset.range a, f (xβ + i) β€ β« x in xβ..(xβ + a), f x := | |
begin | |
rw [β neg_le_neg_iff, β finset.sum_neg_distrib, β interval_integral.integral_neg], | |
exact hf.neg.integral_le_sum, | |
end | |
lemma monotone_on.sum_le_integral_Ico (hab : a β€ b) (hf : monotone_on f (set.Icc a b)) : | |
β x in finset.Ico a b, f x β€ β« x in a..b, f x := | |
begin | |
rw [β neg_le_neg_iff, β finset.sum_neg_distrib, β interval_integral.integral_neg], | |
exact hf.neg.integral_le_sum_Ico hab, | |
end | |
lemma monotone_on.integral_le_sum (hf : monotone_on f (Icc xβ (xβ + a))) : | |
β« x in xβ..(xβ + a), f x β€ β i in finset.range a, f (xβ + (i + 1 : β)) := | |
begin | |
rw [β neg_le_neg_iff, β finset.sum_neg_distrib, β interval_integral.integral_neg], | |
exact hf.neg.sum_le_integral, | |
end | |
lemma monotone_on.integral_le_sum_Ico (hab : a β€ b) (hf : monotone_on f (set.Icc a b)) : | |
β« x in a..b, f x β€ β i in finset.Ico a b, f (i + 1 : β) := | |
begin | |
rw [β neg_le_neg_iff, β finset.sum_neg_distrib, β interval_integral.integral_neg], | |
exact hf.neg.sum_le_integral_Ico hab, | |
end | |