# mathlibdocumentation

analysis.sum_integral_comparisons

# 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

theorem antitone_on.integral_le_sum {x₀ : } {a : } {f : } (hf : (set.Icc x₀ (x₀ + a))) :
∫ (x : ) in x₀..x₀ + a, f x (finset.range a).sum (λ (i : ), f (x₀ + i))
theorem antitone_on.integral_le_sum_Ico {a b : } {f : } (hab : a b) (hf : (set.Icc a b)) :
∫ (x : ) in a..b, f x b).sum (λ (x : ), f x)
theorem antitone_on.sum_le_integral {x₀ : } {a : } {f : } (hf : (set.Icc x₀ (x₀ + a))) :
(finset.range a).sum (λ (i : ), f (x₀ + (i + 1))) ∫ (x : ) in x₀..x₀ + a, f x
theorem antitone_on.sum_le_integral_Ico {a b : } {f : } (hab : a b) (hf : (set.Icc a b)) :
b).sum (λ (i : ), f (i + 1)) ∫ (x : ) in a..b, f x
theorem monotone_on.sum_le_integral {x₀ : } {a : } {f : } (hf : (set.Icc x₀ (x₀ + a))) :
(finset.range a).sum (λ (i : ), f (x₀ + i)) ∫ (x : ) in x₀..x₀ + a, f x
theorem monotone_on.sum_le_integral_Ico {a b : } {f : } (hab : a b) (hf : (set.Icc a b)) :
b).sum (λ (x : ), f x) ∫ (x : ) in a..b, f x
theorem monotone_on.integral_le_sum {x₀ : } {a : } {f : } (hf : (set.Icc x₀ (x₀ + a))) :
∫ (x : ) in x₀..x₀ + a, f x (finset.range a).sum (λ (i : ), f (x₀ + (i + 1)))
theorem monotone_on.integral_le_sum_Ico {a b : } {f : } (hab : a b) (hf : (set.Icc a b)) :
∫ (x : ) in a..b, f x b).sum (λ (i : ), f (i + 1))