Chapter 05 — The Riemann Integral

Proofs omitted. Hover over highlighted terms to see their Lean types.

Reading sections

5.1 — The Riemann Integral

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

Definition 5.1.1: A partition P of [a, b] is a finite increasing list x₀, x₁, …, xₙ with x₀ = a and xₙ = b. Write Δxᵢ = xᵢ - xᵢ₋₁. For a bounded function f : [a, b] → ℝ, set mᵢ = inf {f x | x_{i-1} ≤ x ≤ xᵢ} and Mᵢ = sup {f x | x_{i-1} ≤ x ≤ xᵢ}, and define the lower Darboux sum L(P, f) = ∑ mᵢ Δxᵢ and the upper Darboux sum U(P, f) = ∑ Mᵢ Δxᵢ.

open scoped BigOperators structure IntervalPartition (a b : ℝ) where n : ℕ points : Fin (n + 1) → ℝ mono : StrictMono points left_eq : points 0 = a right_eq : points ⟨n, Nat.lt_succ_self _⟩ = b

Lean source

The mesh length Δxᵢ = xᵢ - xᵢ₋₁ for the i-th subinterval.

open scoped BigOperators variable {a b : ℝ} def IntervalPartition.delta (P : IntervalPartition a b) (i : Fin P.n) : ℝ := P.points i.succ - P.points (Fin.castSucc i)

Lean source

The infimum of f on the i-th closed subinterval.

open scoped BigOperators variable {a b : ℝ} noncomputable def lowerTag (f : ℝ → ℝ) (P : IntervalPartition a b) (i : Fin P.n) : ℝ := sInf (f '' Set.Icc (P.points (Fin.castSucc i)) (P.points i.succ))

Lean source

The supremum of f on the i-th closed subinterval.

open scoped BigOperators variable {a b : ℝ} noncomputable def upperTag (f : ℝ → ℝ) (P : IntervalPartition a b) (i : Fin P.n) : ℝ := sSup (f '' Set.Icc (P.points (Fin.castSucc i)) (P.points i.succ))

Lean source

Lower Darboux sum L(P, f) = ∑ mᵢ Δxᵢ.

open scoped BigOperators variable {a b : ℝ} noncomputable def lowerDarbouxSum (f : ℝ → ℝ) (P : IntervalPartition a b) : ℝ := ∑ i : Fin P.n, lowerTag f P i * P.delta i

Lean source

Upper Darboux sum U(P, f) = ∑ Mᵢ Δxᵢ.

open scoped BigOperators variable {a b : ℝ} noncomputable def upperDarbouxSum (f : ℝ → ℝ) (P : IntervalPartition a b) : ℝ := ∑ i : Fin P.n, upperTag f P i * P.delta i

Lean source

Proposition 5.1.2: If f : [a, b] → ℝ is bounded with m ≤ f x ≤ M on [a, b], then for every partition P of [a, b] we have m * (b - a) ≤ L(P, f) ≤ U(P, f) ≤ M * (b - a).

open scoped BigOperators variable {a b : ℝ} lemma lower_upper_sum_bounds {f : ℝ → ℝ} {a b m M : ℝ} (hmin : ∀ x ∈ Set.Icc a b, m ≤ f x) (hmax : ∀ x ∈ Set.Icc a b, f x ≤ M) (P : IntervalPartition a b) : m * (b - a) ≤ lowerDarbouxSum f P ∧ lowerDarbouxSum f P ≤ upperDarbouxSum f P ∧ upperDarbouxSum f P ≤ M * (b - a)

Lean source

Definition 5.1.3: The lower Darboux integral ∫̲_a^b f is the supremum of all lower Darboux sums over partitions of [a, b]; the upper Darboux integral ∫̅_a^b f is the infimum of all upper Darboux sums over partitions of [a, b]. We also write these without an explicit integration variable.

open scoped BigOperators variable {a b : ℝ} noncomputable def lowerDarbouxIntegral (f : ℝ → ℝ) (a b : ℝ) : ℝ := sSup (Set.range (fun P : IntervalPartition a b => lowerDarbouxSum f P))

Lean source

See lowerDarbouxIntegral for the description of the lower and upper Darboux integrals.

open scoped BigOperators variable {a b : ℝ} noncomputable def upperDarbouxIntegral (f : ℝ → ℝ) (a b : ℝ) : ℝ := sInf (Set.range (fun P : IntervalPartition a b => upperDarbouxSum f P))

Lean source

The subset of real numbers consisting of rational points.

open scoped BigOperators variable {a b : ℝ} def realRationals : Set ℝ := Set.range fun q : ℚ => (q : ℝ)

Lean source

Example 5.1.4: The Dirichlet function f : [0, 1] → ℝ with f x = 1 on the rationals and f x = 0 otherwise satisfies ∫̲₀¹ f = 0 and ∫̅₀¹ f = 1.

open scoped BigOperators variable {a b : ℝ} noncomputable def dirichletFunction (x : ℝ) : ℝ

Lean source

The Dirichlet function only takes values in [0, 1].

open scoped BigOperators variable {a b : ℝ} lemma dirichletFunction_bounds (x : ℝ) : 0 ≤ dirichletFunction x ∧ dirichletFunction x ≤ 1

Lean source

open scoped BigOperators variable {a b : ℝ} lemma dirichlet_subinterval_has_rat_irr (P : IntervalPartition 0 1) (i : Fin P.n) : (∃ x ∈ Set.Icc (P.points (Fin.castSucc i)) (P.points i.succ), x ∈ realRationals) ∧ (∃ x ∈ Set.Icc (P.points (Fin.castSucc i)) (P.points i.succ), x ∉ realRationals)

Lean source

open scoped BigOperators variable {a b : ℝ} lemma dirichlet_tags_eq (P : IntervalPartition 0 1) (i : Fin P.n) : lowerTag dirichletFunction P i = 0 ∧ upperTag dirichletFunction P i = 1

Lean source

open scoped BigOperators variable {a b : ℝ} lemma intervalPartition_sum_delta (P : IntervalPartition 0 1) : (∑ i : Fin P.n, P.delta i) = 1

Lean source

open scoped BigOperators variable {a b : ℝ} lemma dirichlet_darboux_sums (P : IntervalPartition 0 1) : lowerDarbouxSum dirichletFunction P = 0 ∧ upperDarbouxSum dirichletFunction P = 1

Lean source

open scoped BigOperators variable {a b : ℝ} def unitIntervalPartition : IntervalPartition 0 1

Lean source

See dirichletFunction. The lower Darboux integral over [0, 1] is zero.

open scoped BigOperators variable {a b : ℝ} lemma dirichletFunction_lower_integral : lowerDarbouxIntegral dirichletFunction 0 1 = 0

Lean source

See dirichletFunction. The upper Darboux integral over [0, 1] is one.

open scoped BigOperators variable {a b : ℝ} lemma dirichletFunction_upper_integral : upperDarbouxIntegral dirichletFunction 0 1 = 1

Lean source

Definition 5.1.6: A partition P̃ of [a, b] is a refinement of a partition P if, viewed as sets of partition points, P ⊆ P̃.

open scoped BigOperators variable {a b : ℝ} def IntervalPartition.IsRefinement (P Q : IntervalPartition a b) : Prop := Set.range P.points ⊆ Set.range Q.points

Lean source

Proposition 5.1.7: For a bounded function f : [a, b] → ℝ, if P̃ is a refinement of a partition P of [a, b], then L(P, f) ≤ L(P̃, f) and U(P̃, f) ≤ U(P, f).

open scoped BigOperators variable {a b : ℝ} lemma lower_upper_sum_refinement {f : ℝ → ℝ} {a b : ℝ} (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) {P Q : IntervalPartition a b} (hPQ : IntervalPartition.IsRefinement P Q) : lowerDarbouxSum f P ≤ lowerDarbouxSum f Q ∧ upperDarbouxSum f Q ≤ upperDarbouxSum f P

Lean source

A partition exists whenever the interval is nonempty.

open scoped BigOperators variable {a b : ℝ} lemma intervalPartition_nonempty {a b : ℝ} (hab : a ≤ b) : Nonempty (IntervalPartition a b)

Lean source

Two partitions admit a common refinement given by the union of their points.

open scoped BigOperators variable {a b : ℝ} lemma intervalPartition_common_refinement {a b : ℝ} (P1 P2 : IntervalPartition a b) : ∃ Q : IntervalPartition a b, IntervalPartition.IsRefinement P1 Q ∧ IntervalPartition.IsRefinement P2 Q

Lean source

A boundedness witness from a two-sided bound on [a, b].

open scoped BigOperators variable {a b : ℝ} lemma bounded_of_between {f : ℝ → ℝ} {a b m M : ℝ} (hmin : ∀ x ∈ Set.Icc a b, m ≤ f x) (hmax : ∀ x ∈ Set.Icc a b, f x ≤ M) : ∃ B : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ B

Lean source

Any lower sum is bounded above by any upper sum.

open scoped BigOperators variable {a b : ℝ} lemma lower_sum_le_upper_sum_any {f : ℝ → ℝ} {a b m M : ℝ} (hmin : ∀ x ∈ Set.Icc a b, m ≤ f x) (hmax : ∀ x ∈ Set.Icc a b, f x ≤ M) (P1 P2 : IntervalPartition a b) : lowerDarbouxSum f P1 ≤ upperDarbouxSum f P2

Lean source

Proposition 5.1.8: If a bounded function f : [a, b] → ℝ satisfies m ≤ f x ≤ M on [a, b], then the lower and upper Darboux integrals obey m * (b - a) ≤ ∫̲_a^b f ≤ ∫̅_a^b f ≤ M * (b - a).

open scoped BigOperators variable {a b : ℝ} lemma lower_upper_integral_bounds {f : ℝ → ℝ} {a b m M : ℝ} (hab : a ≤ b) (hmin : ∀ x ∈ Set.Icc a b, m ≤ f x) (hmax : ∀ x ∈ Set.Icc a b, f x ≤ M) : m * (b - a) ≤ lowerDarbouxIntegral f a b ∧ lowerDarbouxIntegral f a b ≤ upperDarbouxIntegral f a b ∧ upperDarbouxIntegral f a b ≤ M * (b - a)

Lean source

Definition 5.1.9: A bounded function f : [a, b] → ℝ is Riemann integrable if the lower and upper Darboux integrals coincide. The collection of such functions on [a, b] is denoted ℛ([a, b]), and when f is Riemann integrable its integral ∫_a^b f is the common value of the lower and upper integrals.

open scoped BigOperators variable {a b : ℝ} def RiemannIntegrableOn (f : ℝ → ℝ) (a b : ℝ) : Prop := (∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) ∧ lowerDarbouxIntegral f a b = upperDarbouxIntegral f a b

Lean source

The set ℛ([a, b]) of Riemann integrable functions on [a, b].

open scoped BigOperators variable {a b : ℝ} def riemannIntegrableFunctions (a b : ℝ) : Set (ℝ → ℝ) := {f | RiemannIntegrableOn f a b}

Lean source

The Riemann integral of an integrable function is the common value of the lower and upper Darboux integrals.

open scoped BigOperators variable {a b : ℝ} noncomputable def riemannIntegral (f : ℝ → ℝ) (a b : ℝ) (hf : RiemannIntegrableOn f a b) : ℝ

Lean source

Proposition 5.1.10: If f : [a, b] → ℝ is Riemann integrable and bounded between m and M on [a, b], then the integral is bounded by m * (b - a) and M * (b - a).

open scoped BigOperators variable {a b : ℝ} lemma riemannIntegral_bounds {f : ℝ → ℝ} {a b m M : ℝ} (hab : a ≤ b) (hf : RiemannIntegrableOn f a b) (hmin : ∀ x ∈ Set.Icc a b, m ≤ f x) (hmax : ∀ x ∈ Set.Icc a b, f x ≤ M) : m * (b - a) ≤ riemannIntegral f a b hf ∧ riemannIntegral f a b hf ≤ M * (b - a)

Lean source

Example 5.1.11: A constant function f x = c is Riemann integrable on [a, b], and its integral is c * (b - a).

open scoped BigOperators variable {a b : ℝ} lemma constant_function_riemannIntegral (c a b : ℝ) (hab : a ≤ b) : ∃ hf : RiemannIntegrableOn (fun _ : ℝ => c) a b, riemannIntegral (fun _ : ℝ => c) a b hf = c * (b - a)

Lean source

Example 5.1.12: The step function on [0, 2] given by f x = 1 for x < 1, f 1 = 1 / 2, and f x = 0 for x > 1 is Riemann integrable with integral ∫_0^2 f = 1.

open scoped BigOperators variable {a b : ℝ} noncomputable def stepFunctionExample (x : ℝ) : ℝ := if x < 1 then 1 else if x = 1 then (1 : ℝ) / 2 else 0

Lean source

The step function only takes values in [0, 1].

open scoped BigOperators variable {a b : ℝ} lemma stepFunctionExample_bounds (x : ℝ) : 0 ≤ stepFunctionExample x ∧ stepFunctionExample x ≤ 1

Lean source

A partition adapted to the step function with points 0, 1-ε, 1+ε, 2.

open scoped BigOperators variable {a b : ℝ} noncomputable def stepPartition (ε : ℝ) (hε : 0 < ε ∧ ε < 1) : IntervalPartition 0 2

Lean source

open scoped BigOperators variable {a b : ℝ} lemma stepPartition_sums {ε : ℝ} (hε : 0 < ε ∧ ε < 1) : lowerDarbouxSum stepFunctionExample (stepPartition ε hε) = 1 - ε ∧ upperDarbouxSum stepFunctionExample (stepPartition ε hε) = 1 + ε

Lean source

See stepFunctionExample. The function is Riemann integrable on [0, 2] and its integral equals 1.

open scoped BigOperators variable {a b : ℝ} lemma stepFunctionExample_riemannIntegral : ∃ hf : RiemannIntegrableOn stepFunctionExample 0 2, riemannIntegral stepFunctionExample 0 2 hf = 1

Lean source

Proposition 5.1.13: A bounded function f : [a, b] → ℝ is Riemann integrable if for every ε > 0 there exists a partition P of [a, b] with U(P, f) - L(P, f) < ε.

open scoped BigOperators variable {a b : ℝ} lemma riemannIntegrable_of_upper_lower_gap {f : ℝ → ℝ} {a b : ℝ} (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) (hgap : ∀ ε > 0, ∃ P : IntervalPartition a b, upperDarbouxSum f P - lowerDarbouxSum f P < ε) : RiemannIntegrableOn f a b

Lean source

Example 5.1.14: For every b > 0 the function x ↦ 1 / (1 + x) is Riemann integrable on [0, b].

open scoped BigOperators variable {a b : ℝ} lemma reciprocal_integrable_on_interval {b : ℝ} (hb : 0 < b) : RiemannIntegrableOn (fun x : ℝ => 1 / (1 + x)) 0 b

5.2 — Properties of the Integral — Part 1

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

A three-point partition of [a, c] with an interior point b.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma intervalPartition_three_points {a b c : ℝ} (hab : a < b) (hbc : b < c) : ∃ P : IntervalPartition a c, b ∈ Set.range P.points

Lean source

Any partition of [a, c] admits a refinement that includes b.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma intervalPartition_refine_with_point {a b c : ℝ} (hab : a < b) (hbc : b < c) (P : IntervalPartition a c) : ∃ Q : IntervalPartition a c, IntervalPartition.IsRefinement P Q ∧ b ∈ Set.range Q.points

Lean source

A uniform partition of [a, b] with mesh smaller than δ.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma intervalPartition_small_delta {a b δ : ℝ} (hab : a < b) (hδ : 0 < δ) : ∃ P : IntervalPartition a b, ∀ i : Fin P.n, P.delta i < δ

Lean source

Restrict lower/upper Darboux integrals to partitions containing a point.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma darbouxIntegral_restrict_to_partitions_with_point {a b c : ℝ} {f : ℝ → ℝ} (hab : a < b) (hbc : b < c) (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a c, |f x| ≤ M) : lowerDarbouxIntegral f a c = sSup (Set.range (fun P : {P : IntervalPartition a c // b ∈ Set.range P.points} => lowerDarbouxSum f P.1)) ∧ upperDarbouxIntegral f a c = sInf (Set.range (fun P : {P : IntervalPartition a c // b ∈ Set.range P.points} => upperDarbouxSum f P.1))

Lean source

Split a partition that contains b into left/right partitions.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma intervalPartition_split_at_point {a b c : ℝ} {f : ℝ → ℝ} (P : IntervalPartition a c) (hb : b ∈ Set.range P.points) : ∃ P1 : IntervalPartition a b, ∃ P2 : IntervalPartition b c, lowerDarbouxSum f P = lowerDarbouxSum f P1 + lowerDarbouxSum f P2 ∧ upperDarbouxSum f P = upperDarbouxSum f P1 + upperDarbouxSum f P2

Lean source

Append a left/right partition into a partition of [a, c].

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma intervalPartition_append {a b c : ℝ} {f : ℝ → ℝ} (P1 : IntervalPartition a b) (P2 : IntervalPartition b c) : ∃ P : IntervalPartition a c, b ∈ Set.range P.points ∧ lowerDarbouxSum f P = lowerDarbouxSum f P1 + lowerDarbouxSum f P2 ∧ upperDarbouxSum f P = upperDarbouxSum f P1 + upperDarbouxSum f P2

5.2 — Properties of the Integral — Part 2

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

Lemma 5.2.1: If a < b < c and f : [a, c] → ℝ is bounded, then the lower and upper Darboux integrals over [a, c] split as the sums of the integrals over [a, b] and [b, c]. That is, ∫̲_a^c f = ∫̲_a^b f + ∫̲_b^c f and ∫̅_a^c f = ∫̅_a^b f + ∫̅_b^c f.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma darbouxIntegral_add {a b c : ℝ} {f : ℝ → ℝ} (hab : a < b) (hbc : b < c) (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a c, |f x| ≤ M) : lowerDarbouxIntegral f a c = lowerDarbouxIntegral f a b + lowerDarbouxIntegral f b c ∧ upperDarbouxIntegral f a c = upperDarbouxIntegral f a b + upperDarbouxIntegral f b c

Lean source

Proposition 5.2.2: For a < b < c, a function f : [a, c] → ℝ is Riemann integrable exactly when it is Riemann integrable on both [a, b] and [b, c]. If f is integrable on [a, c], then the integral splits as ∫_a^c f = ∫_a^b f + ∫_b^c f.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegrableOn_interval_split {a b c : ℝ} {f : ℝ → ℝ} (hab : a < b) (hbc : b < c) : RiemannIntegrableOn f a c ↔ RiemannIntegrableOn f a b ∧ RiemannIntegrableOn f b c

Lean source

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_split {a b c : ℝ} {f : ℝ → ℝ} (hab : a < b) (hbc : b < c) (hf : RiemannIntegrableOn f a c) : ∃ hf_ab : RiemannIntegrableOn f a b, ∃ hf_bc : RiemannIntegrableOn f b c, riemannIntegral f a c hf = riemannIntegral f a b hf_ab + riemannIntegral f b c hf_bc

Lean source

Corollary 5.2.3: If f ∈ ℛ([a, b]) and [c, d] ⊆ [a, b], then the restriction of f to [c, d] belongs to ℛ([c, d]).

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegrableOn_subinterval {a b c d : ℝ} {f : ℝ → ℝ} (hf : RiemannIntegrableOn f a b) (hac : a ≤ c) (hcd : c ≤ d) (hdb : d ≤ b) : RiemannIntegrableOn f c d

5.2 — Properties of the Integral — Part 3

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

Proposition 5.2.4 (Linearity): Let f and g be Riemann integrable on the closed interval [a, b] and let α : ℝ. * (i) The scalar multiple α • f belongs to ℛ([a, b]) and ∫_a^b α • f = α * ∫_a^b f. * (ii) The sum f + g belongs to ℛ([a, b]) and ∫_a^b (f + g) = ∫_a^b f + ∫_a^b g.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_linearity {a b α : ℝ} {f g : ℝ → ℝ} (hf : RiemannIntegrableOn f a b) (hg : RiemannIntegrableOn g a b) : (∃ hαf : RiemannIntegrableOn (fun x => α * f x) a b, riemannIntegral (fun x => α * f x) a b hαf = α * riemannIntegral f a b hf) ∧ ∃ hfg : RiemannIntegrableOn (fun x => f x + g x) a b, riemannIntegral (fun x => f x + g x) a b hfg = riemannIntegral f a b hf + riemannIntegral g a b hg

Lean source

Proposition 5.2.5: Let bounded functions f, g : [a, b] → ℝ. Then the upper Darboux integral of their sum is at most the sum of their upper Darboux integrals, and the lower Darboux integral of their sum is at least the sum of their lower Darboux integrals.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma darbouxIntegral_add_le_add {a b : ℝ} {f g : ℝ → ℝ} (hbound_f : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) (hbound_g : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |g x| ≤ M) : upperDarbouxIntegral (fun x => f x + g x) a b ≤ upperDarbouxIntegral f a b + upperDarbouxIntegral g a b ∧ lowerDarbouxIntegral (fun x => f x + g x) a b ≥ lowerDarbouxIntegral f a b + lowerDarbouxIntegral g a b

Lean source

Proposition 5.2.6 (Monotonicity): If bounded functions f, g : [a, b] → ℝ satisfy f x ≤ g x on [a, b], then their lower and upper Darboux integrals obey ∫̲_a^b f ≤ ∫̲_a^b g and ∫̅_a^b f ≤ ∫̅_a^b g. Moreover, if f and g are Riemann integrable on [a, b], then ∫_a^b f ≤ ∫_a^b g.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma darbouxIntegral_monotone {a b : ℝ} {f g : ℝ → ℝ} (hbound_f : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) (hbound_g : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |g x| ≤ M) (hmono : ∀ x ∈ Set.Icc a b, f x ≤ g x) : lowerDarbouxIntegral f a b ≤ lowerDarbouxIntegral g a b ∧ upperDarbouxIntegral f a b ≤ upperDarbouxIntegral g a b

Lean source

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_monotone {a b : ℝ} {f g : ℝ → ℝ} (hmono : ∀ x ∈ Set.Icc a b, f x ≤ g x) (hf : RiemannIntegrableOn f a b) (hg : RiemannIntegrableOn g a b) : riemannIntegral f a b hf ≤ riemannIntegral g a b hg

5.2 — Properties of the Integral — Part 4

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

Lemma 5.2.7: A continuous function on a closed bounded interval [a, b] belongs to ℛ([a, b]), i.e., it is Riemann integrable on that interval.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma continuousOn_riemannIntegrableOn {a b : ℝ} {f : ℝ → ℝ} (hcont : ContinuousOn f (Set.Icc a b)) : RiemannIntegrableOn f a b

Lean source

Lemma 5.2.8: Let f : [a, b] → ℝ be bounded, and suppose sequences aₙ, bₙ satisfy a < aₙ < bₙ < b for all n with aₙ → a and bₙ → b. If f ∈ ℛ([aₙ, bₙ]) for every n, then f ∈ ℛ([a, b]) and ∫_a^b f = lim_{n → ∞} ∫_{aₙ}^{bₙ} f.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_tendsto_of_nested_intervals {a b : ℝ} {f : ℝ → ℝ} (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) {a_seq b_seq : ℕ → ℝ} (h_between : ∀ n, a < a_seq n ∧ a_seq n < b_seq n ∧ b_seq n < b) (ha : Tendsto a_seq atTop (𝓝 a)) (hb : Tendsto b_seq atTop (𝓝 b)) (hf_seq : ∀ n, RiemannIntegrableOn f (a_seq n) (b_seq n)) : ∃ hf_ab : RiemannIntegrableOn f a b, Tendsto (fun n => riemannIntegral f (a_seq n) (b_seq n) (hf_seq n)) atTop (𝓝 (riemannIntegral f a b hf_ab))

Lean source

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma continuousOn_Icc_of_continuousAt {a b : ℝ} {f : ℝ → ℝ} (hcont : ∀ x ∈ Set.Icc a b, ContinuousAt f x) : ContinuousOn f (Set.Icc a b)

Lean source

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegrableOn_of_continuousAt_Ioo {a b : ℝ} {f : ℝ → ℝ} (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) (hcont : ∀ x ∈ Set.Ioo a b, ContinuousAt f x) : RiemannIntegrableOn f a b

Lean source

Theorem 5.2.9: A bounded function on [a, b] with only finitely many discontinuities belongs to ℛ([a, b]), i.e., it is Riemann integrable.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise theorem riemannIntegrableOn_of_finite_discontinuities {a b : ℝ} {f : ℝ → ℝ} (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) (hfinite : ({x | x ∈ Set.Icc a b ∧ ¬ ContinuousAt f x}).Finite) : RiemannIntegrableOn f a b

Lean source

If two functions agree on Set.Icc a b, they are simultaneously Riemann integrable and have the same integral.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_congr_on_Icc {a b : ℝ} {f g : ℝ → ℝ} (hfg : ∀ x ∈ Set.Icc a b, g x = f x) (hf : RiemannIntegrableOn f a b) : ∃ hg : RiemannIntegrableOn g a b, riemannIntegral g a b hg = riemannIntegral f a b hf

5.2 — Properties of the Integral — Part 5

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma bounded_of_eq_off_finite {a b : ℝ} {f g : ℝ → ℝ} {S : Set ℝ} (hbound : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |f x| ≤ M) (hfin : S.Finite) (hfg : ∀ x ∈ Set.Icc a b \ S, g x = f x) : ∃ M : ℝ, ∀ x ∈ Set.Icc a b, |g x| ≤ M

Lean source

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_eq_zero_of_eq_zero_on_Icc {a b : ℝ} {h : ℝ → ℝ} (hab : a ≤ b) (hzero : ∀ x ∈ Set.Icc a b, h x = 0) : ∃ hh : RiemannIntegrableOn h a b, riemannIntegral h a b hh = 0

Lean source

Each subinterval of a partition lies in the ambient interval.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma intervalPartition_subinterval_subset {a b : ℝ} (P : IntervalPartition a b) (i : Fin P.n) : Set.Icc (P.points (Fin.castSucc i)) (P.points i.succ) ⊆ Set.Icc a b

Lean source

Upper tag bound on a bounded interval.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upperTag_le_of_bound {a b : ℝ} {h : ℝ → ℝ} {M : ℝ} (P : IntervalPartition a b) (i : Fin P.n) (hmax : ∀ x ∈ Set.Icc a b, h x ≤ M) : upperTag h P i ≤ M

Lean source

Lower tag bound on a bounded interval.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma lowerTag_ge_of_bound {a b : ℝ} {h : ℝ → ℝ} {M : ℝ} (P : IntervalPartition a b) (i : Fin P.n) (hmin : ∀ x ∈ Set.Icc a b, -M ≤ h x) : -M ≤ lowerTag h P i

Lean source

Tag gap bound when h is bounded by ±M on [a, b].

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma tag_gap_le_two_M {a b : ℝ} {h : ℝ → ℝ} {M : ℝ} {P : IntervalPartition a b} (hmin : ∀ x ∈ Set.Icc a b, -M ≤ h x) (hmax : ∀ x ∈ Set.Icc a b, h x ≤ M) (i : Fin P.n) : upperTag h P i - lowerTag h P i ≤ 2 * M

Lean source

Sum over Fin n when n = 2.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma sum_fin_two_eq {n : ℕ} (h : n = 2) (f : Fin n → ℝ) : (∑ i : Fin n, f i) = f ⟨0, by simp [h]⟩ + f ⟨1, by simp [h]⟩

Lean source

Two-step gap bound when the right subinterval contributes zero.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_two_steps_right_zero {a b : ℝ} {h : ℝ → ℝ} {M δ : ℝ} (P : IntervalPartition a b) (hP : P.n = 2) (hzero : upperTag h P ⟨1, by simp [hP]⟩ = 0 ∧ lowerTag h P ⟨1, by simp [hP]⟩ = 0) (htag0 : upperTag h P ⟨0, by simp [hP]⟩ - lowerTag h P ⟨0, by simp [hP]⟩ ≤ 2 * M) (hdelta0 : P.delta ⟨0, by simp [hP]⟩ = δ) : upperDarbouxSum h P - lowerDarbouxSum h P ≤ 2 * M * δ

Lean source

Two-step gap bound when the left subinterval contributes zero.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_two_steps_left_zero {a b : ℝ} {h : ℝ → ℝ} {M δ : ℝ} (P : IntervalPartition a b) (hP : P.n = 2) (hzero : upperTag h P ⟨0, by simp [hP]⟩ = 0 ∧ lowerTag h P ⟨0, by simp [hP]⟩ = 0) (htag1 : upperTag h P ⟨1, by simp [hP]⟩ - lowerTag h P ⟨1, by simp [hP]⟩ ≤ 2 * M) (hdelta1 : P.delta ⟨1, by simp [hP]⟩ = δ) : upperDarbouxSum h P - lowerDarbouxSum h P ≤ 2 * M * δ

Lean source

Convert a 2 * M * δ gap bound into an ε-bound.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma gap_lt_of_le_twoM_delta {α M δ ε : ℝ} (hMpos : 0 < M) (hδ_le : δ ≤ ε / (4 * M)) (hgap : α ≤ 2 * M * δ) (hε : 0 < ε) : α < ε

Lean source

Convert a 4 * M * δ gap bound into an ε-bound.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma gap_lt_of_le_fourM_delta {α M δ ε : ℝ} (hMpos : 0 < M) (hδ_le : δ ≤ ε / (8 * M)) (hgap : α ≤ 4 * M * δ) (hε : 0 < ε) : α < ε

5.2 — Properties of the Integral — Part 6

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

On a degenerate interval, the upper/lower Darboux gap is zero.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_degenerate_interval {a : ℝ} {h : ℝ → ℝ} : ∀ ε > 0, ∃ P : IntervalPartition a a, upperDarbouxSum h P - lowerDarbouxSum h P < ε

Lean source

Gap estimate when the exceptional point is the left endpoint.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_left_endpoint {a b c : ℝ} {h : ℝ → ℝ} {M : ℝ} (hc : c ∈ Set.Icc a b) (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) (hM : ∀ x ∈ Set.Icc a b, |h x| ≤ M) (hhc : h c ≠ 0) (hca : c = a) (hlt : a < b) : ∀ ε > 0, ∃ P : IntervalPartition a b, upperDarbouxSum h P - lowerDarbouxSum h P < ε

Lean source

Gap estimate when the exceptional point is the right endpoint.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_right_endpoint {a b c : ℝ} {h : ℝ → ℝ} {M : ℝ} (hc : c ∈ Set.Icc a b) (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) (hM : ∀ x ∈ Set.Icc a b, |h x| ≤ M) (hhc : h c ≠ 0) (hcb : c = b) (hlt : a < b) : ∀ ε > 0, ∃ P : IntervalPartition a b, upperDarbouxSum h P - lowerDarbouxSum h P < ε

Lean source

If h vanishes on a subinterval, its upper/lower tags are zero.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_tag_zero_of_eq_zero {a b : ℝ} {h : ℝ → ℝ} (P : IntervalPartition a b) (i : Fin P.n) (hzero : ∀ x ∈ Set.Icc (P.points (Fin.castSucc i)) (P.points i.succ), h x = 0) : upperTag h P i = 0 ∧ lowerTag h P i = 0

Lean source

Choose a small δ for the middle-case split.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_middle_delta {a b c M ε : ℝ} (hMpos : 0 < M) (hca' : a < c) (hcb' : c < b) (hε : 0 < ε) : ∃ δ > 0, δ ≤ ε / (8 * M) ∧ a < c - δ ∧ c - δ < c ∧ c < c + δ ∧ c + δ < b

Lean source

h vanishes on the left subinterval in the middle-case split.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_middle_zero_left {a b c δ : ℝ} {h : ℝ → ℝ} (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) (hright_lt : c - δ < c) (hcb' : c < b) : ∀ x ∈ Set.Icc a (c - δ), h x = 0

Lean source

h vanishes on the right subinterval in the middle-case split.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_middle_zero_right {a b c δ : ℝ} {h : ℝ → ℝ} (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) (hca' : a < c) (hmid_lt : c < c + δ) : ∀ x ∈ Set.Icc (c + δ) b, h x = 0

Lean source

Append two partitions and combine 2 * M * δ gap bounds.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_append_gap {a b c : ℝ} {h : ℝ → ℝ} {M δ : ℝ} (P1 : IntervalPartition a c) (P2 : IntervalPartition c b) (hgap1 : upperDarbouxSum h P1 - lowerDarbouxSum h P1 ≤ 2 * M * δ) (hgap2 : upperDarbouxSum h P2 - lowerDarbouxSum h P2 ≤ 2 * M * δ) : ∃ P : IntervalPartition a b, upperDarbouxSum h P - lowerDarbouxSum h P ≤ 4 * M * δ

Lean source

Gap estimate when the exceptional point lies strictly inside (a, b).

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_middle {a b c : ℝ} {h : ℝ → ℝ} {M : ℝ} (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) (hM : ∀ x ∈ Set.Icc a b, |h x| ≤ M) (hhc : h c ≠ 0) (hca' : a < c) (hcb' : c < b) : ∀ ε > 0, ∃ P : IntervalPartition a b, upperDarbouxSum h P - lowerDarbouxSum h P < ε

Lean source

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma upper_lower_gap_of_eq_zero_off_singleton {a b : ℝ} {h : ℝ → ℝ} {c : ℝ} {M : ℝ} (hc : c ∈ Set.Icc a b) (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) (hM : ∀ x ∈ Set.Icc a b, |h x| ≤ M) (hhc : h c ≠ 0) : ∀ ε > 0, ∃ P : IntervalPartition a b, upperDarbouxSum h P - lowerDarbouxSum h P < ε

Lean source

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma lower_upper_sum_sign_of_eq_zero_off_singleton {a b : ℝ} {h : ℝ → ℝ} {c : ℝ} {M : ℝ} (hM : ∀ x ∈ Set.Icc a b, |h x| ≤ M) (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) : ∀ P : IntervalPartition a b, lowerDarbouxSum h P ≤ 0 ∧ 0 ≤ upperDarbouxSum h P

Lean source

Changing a single point on [a, b] does not affect the Riemann integral.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_eq_zero_of_eq_zero_off_singleton {a b : ℝ} {h : ℝ → ℝ} {c : ℝ} (hc : c ∈ Set.Icc a b) (hz : ∀ x ∈ Set.Icc a b \ {c}, h x = 0) : ∃ hh : RiemannIntegrableOn h a b, riemannIntegral h a b hh = 0

Lean source

Changing a single point on [a, b] does not affect the Riemann integral.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma riemannIntegral_eq_of_eq_off_singleton {a b : ℝ} {f g : ℝ → ℝ} {c : ℝ} (hc : c ∈ Set.Icc a b) (hf : RiemannIntegrableOn f a b) (hfg : ∀ x ∈ Set.Icc a b \ {c}, g x = f x) : ∃ hg : RiemannIntegrableOn g a b, riemannIntegral g a b hg = riemannIntegral f a b hf

Lean source

Proposition 5.2.10: If f : [a, b] → ℝ is Riemann integrable and g agrees with f on [a, b] except on a finite set S, then g is Riemann integrable and the integrals of f and g over [a, b] coincide.

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise theorem riemannIntegral_eq_of_eq_off_finite {a b : ℝ} {f g : ℝ → ℝ} {S : Set ℝ} (hf : RiemannIntegrableOn f a b) (hfin : S.Finite) (hfg : ∀ x ∈ Set.Icc a b \ S, g x = f x) : ∃ hg : RiemannIntegrableOn g a b, riemannIntegral g a b hg = riemannIntegral f a b hf

Lean source

Proposition 5.2.11: A monotone function f : [a, b] → ℝ belongs to ℛ([a, b]), i.e., it is Riemann integrable on the closed interval [a, b].

open Filter Topology open scoped Matrix open scoped BigOperators open scoped Pointwise lemma monotoneOn_riemannIntegrableOn {a b : ℝ} {f : ℝ → ℝ} (hmono : MonotoneOn f (Set.Icc a b)) : RiemannIntegrableOn f a b

5.3 — Fundamental Theorem of Calculus

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

Theorem 5.3.1 (Fundamental theorem of calculus, first form). If F is continuous on [a, b], differentiable on (a, b) with derivative f, and f is Riemann integrable on [a, b], then ∫_{a}^{b} f = F b - F a.

open MeasureTheory open scoped Topology theorem intervalIntegral_deriv_eq_sub {a b : ℝ} {F f : ℝ → ℝ} (hab : a ≤ b) (hcont : ContinuousOn F (Set.Icc a b)) (hderiv : ∀ x ∈ Set.Ioo a b, HasDerivAt F (f x) x) (hinteg : IntervalIntegrable f volume a b) : ∫ x in a..b, f x = F b - F a

Lean source

Example 5.3.2: By the fundamental theorem of calculus, ∫_0^1 x^2 \\, dx = 1 / 3 using the antiderivative x ↦ x^3 / 3.

open MeasureTheory open scoped Topology lemma integral_square_unit_interval : ∫ x in (0 : ℝ)..1, x^2 = (1 : ℝ) / 3

Lean source

Theorem 5.3.3 (Fundamental theorem of calculus, second form). If f is Riemann integrable on [a, b] and F x = ∫_{a}^{x} f, then F is continuous on [a, b], and whenever f is continuous at c ∈ (a, b) the function F is differentiable at c with derivative F' c = f c.

open MeasureTheory open scoped Topology theorem fundamental_theorem_of_calculus_second {a b : ℝ} {f : ℝ → ℝ} (hinteg : IntervalIntegrable f volume a b) : ContinuousOn (fun x => ∫ t in a..x, f t) (Set.Icc a b) ∧ ∀ {c}, c ∈ Set.Ioo a b → ContinuousAt f c → HasDerivAt (fun x => ∫ t in a..x, f t) (f c) c

Lean source

Theorem 5.3.5 (Change of variables). If g : [a,b] → ℝ is continuously differentiable and maps [a,b] into [c,d], and f : [c,d] → ℝ is continuous, then ∫_{a}^{b} f (g x) * g' x = ∫_{g a}^{g b} f.

open MeasureTheory open scoped Topology theorem intervalIntegral_change_of_variables {a b c d : ℝ} {f g : ℝ → ℝ} (hab : a ≤ b) (hg_diff : ContDiffOn ℝ 1 g (Set.Icc a b)) (hf_cont : ContinuousOn f (Set.Icc c d)) (hg_maps : Set.MapsTo g (Set.Icc a b) (Set.Icc c d)) : ∫ x in a..b, f (g x) * deriv g x = ∫ s in g a..g b, f s

Lean source

Example 5.3.6: Using the substitution g(x) = x^2 and that the derivative of sin is cos, ∫_0^{√π} x * cos (x^2) = 0.

open MeasureTheory open scoped Topology lemma integral_mul_cos_square_root_pi : ∫ x in (0 : ℝ)..Real.sqrt Real.pi, x * Real.cos (x^2) = 0

Lean source

Example 5.3.7: The naive substitution g x = log |x| for ∫_{-1}^{1} (log |x|) / x fails because the integrand is unbounded and not continuous at 0, so the integral over [-1,1] is not well-defined as a Riemann (Lebesgue) integral.

open MeasureTheory open scoped Topology lemma not_integrable_log_abs_div_x_on_neg_one_one : ¬ MeasureTheory.IntegrableOn (fun x : ℝ => Real.log (|x|) / x) (Set.Icc (-1 : ℝ) 1)

5.4 — The Logarithm and the Exponential

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

Proposition 5.4.1. There exists a unique function L : (0,∞) → ℝ such that (i) L 1 = 0; (ii) L is differentiable with derivative 1/x; (iii) L is strictly increasing, bijective, and L x → -∞ as x → 0⁺ while L x → ∞ as x → ∞; (iv) L (x*y) = L x + L y for x,y > 0; (v) for rational q and x > 0, L (x^q) = q * L x.

open Set Filter def LogAxioms (L : ℝ → ℝ) : Prop := L 1 = 0 ∧ (∀ x > 0, HasDerivAt L (1 / x) x) ∧ StrictMonoOn L (Set.Ioi 0) ∧ Function.Surjective (fun x : Set.Ioi (0 : ℝ) => L x) ∧ Tendsto L (nhdsWithin 0 (Set.Ioi 0)) atBot ∧ Tendsto L atTop atTop ∧ (∀ {x y}, 0 < x → 0 < y → L (x * y) = L x + L y) ∧ (∀ {q : ℚ} {x}, 0 < x → L (Real.rpow x q) = (q : ℝ) * L x)

Lean source

\log from mathlib satisfies the axioms characterizing the logarithm.

open Set Filter lemma log_satisfies_LogAxioms : LogAxioms Real.log

Lean source

open Set Filter lemma logAxioms_eq_log_on_pos {L : ℝ → ℝ} (hL : LogAxioms L) {x : ℝ} (hx : 0 < x) : L x = Real.log x

Lean source

open Set Filter lemma logAxioms_unique_on_pos {L₁ L₂ : ℝ → ℝ} (hL₁ : LogAxioms L₁) (hL₂ : LogAxioms L₂) {x : ℝ} (hx : 0 < x) : L₁ x = L₂ x

Lean source

There exists a function (0,∞) → ℝ satisfying the logarithm axioms, unique on (0,∞).

open Set Filter theorem exists_unique_log_function : ∃ L : ℝ → ℝ, LogAxioms L ∧ ∀ L', LogAxioms L' → ∀ {x}, 0 < x → L' x = L x

Lean source

Proposition 5.4.2. There exists a unique function E : ℝ → (0,∞) such that (i) E 0 = 1; (ii) E is differentiable with derivative E x; (iii) E is strictly increasing, bijective onto (0,∞), E x → 0 as x → -∞, and E x → ∞ as x → ∞; (iv) E (x + y) = E x * E y; (v) for rational q, E (q * x) = (E x)^q.

open Set Filter def ExpAxioms (E : ℝ → ℝ) : Prop := E 0 = 1 ∧ (∀ x, HasDerivAt E (E x) x) ∧ StrictMono E ∧ (∀ y, 0 < y → ∃ x, E x = y) ∧ Tendsto E atBot (nhds 0) ∧ Tendsto E atTop atTop ∧ (∀ x y, E (x + y) = E x * E y) ∧ (∀ (q : ℚ) (x : ℝ), E (q * x) = Real.rpow (E x) q)

Lean source

Real.exp satisfies the axioms characterizing the exponential.

open Set Filter lemma exp_satisfies_ExpAxioms : ExpAxioms Real.exp

Lean source

There exists a unique function ℝ → (0,∞) satisfying the exponential axioms.

open Set Filter theorem exists_unique_exp_function : ∃! E : ℝ → ℝ, ExpAxioms E

Lean source

Proposition 5.4.3. Let x, y ∈ ℝ. (i) exp (x*y) = (exp x)^y. (ii) If x > 0, then ln (x^y) = y * ln x.

open Set Filter lemma exp_mul_rpow (x y : ℝ) : Real.exp (x * y) = (Real.exp x) ^ y

Lean source

See Proposition 5.4.3 (ii). If x > 0, then ln (x^y) = y * ln x.

open Set Filter lemma log_rpow_pos (x y : ℝ) (hx : 0 < x) : Real.log (x ^ y) = y * Real.log x

5.5 — Improper Integrals

Lean authors: Zichen Wang, Zaiwen Wen.

Source header

Definition 5.5.1. For a function f : [a, b) → ℝ that is Riemann integrable on every [a, c] with c < b, we define ∫ a^b f as the limit lim_{c → b⁻} ∫ a^c f when it exists. For f : [a, ∞) → ℝ, integrable on every [a, c], we define ∫ a^∞ f as lim_{c → ∞} ∫ a^c f. The improper integral converges if the relevant limit exists and diverges otherwise. The analogous definitions for a left-hand endpoint are similar.

open Set Filter Real open BigOperators open scoped BigOperators def ImproperIntegralRight (f : ℝ → ℝ) (a b l : ℝ) : Prop := (∀ c, c < b → MeasureTheory.IntegrableOn f (Set.Icc a c)) ∧ Tendsto (fun c : ℝ => ∫ x in a..c, f x) (nhdsWithin b (Set.Iio b)) (nhds l)

Lean source

Improper integral over [a, ∞) converging to l.

open Set Filter Real open BigOperators open scoped BigOperators def ImproperIntegralAtTop (f : ℝ → ℝ) (a l : ℝ) : Prop := (∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) ∧ Tendsto (fun c : ℝ => ∫ x in a..c, f x) atTop (nhds l)

Lean source

Convergence of an improper integral on [a, b).

open Set Filter Real open BigOperators open scoped BigOperators def ImproperIntegralRightConverges (f : ℝ → ℝ) (a b : ℝ) : Prop := ∃ l, ImproperIntegralRight f a b l

Lean source

Convergence of an improper integral on [a, ∞).

open Set Filter Real open BigOperators open scoped BigOperators def ImproperIntegralAtTopConverges (f : ℝ → ℝ) (a : ℝ) : Prop := ∃ l, ImproperIntegralAtTop f a l

Lean source

Proposition 5.5.2 (p-test for integrals). The improper integral ∫₁^∞ x^{-p} converges to 1 / (p - 1) for p > 1 and diverges for 0 < p ≤ 1. The improper integral ∫₀^1 x^{-p} converges to 1 / (1 - p) for 0 < p < 1 and diverges for p ≥ 1.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_p_test (p : ℝ) : (p > 1 → ImproperIntegralAtTop (fun x : ℝ => 1 / x ^ p) 1 (1 / (p - 1))) ∧ (0 < p → p ≤ 1 → ¬ ImproperIntegralAtTopConverges (fun x : ℝ => 1 / x ^ p) 1) ∧ (0 < p → p < 1 → Tendsto (fun c : ℝ => ∫ x in c..(1 : ℝ), 1 / x ^ p) (nhdsWithin 0 (Set.Ioi 0)) (nhds (1 / (1 - p)))) ∧ (p ≥ 1 → ¬ ∃ l : ℝ, Tendsto (fun c : ℝ => ∫ x in c..(1 : ℝ), 1 / x ^ p) (nhdsWithin 0 (Set.Ioi 0)) (nhds l))

Lean source

Proposition 5.5.3. If f : [a, ∞) → ℝ is Riemann integrable on every [a, c] with c > a, then for any b > a the improper integral ∫ b^∞ f converges if and only if ∫ a^∞ f converges, and in the convergent case ∫ a^∞ f = ∫ a..b, f + ∫ b^∞ f.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_tail_convergence {f : ℝ → ℝ} {a b : ℝ} (hb : b > a) (hInt : ∀ c > a, MeasureTheory.IntegrableOn f (Set.Icc a c)) : ImproperIntegralAtTopConverges f b ↔ ImproperIntegralAtTopConverges f a

Lean source

Proposition 5.5.3 (value identity). Under the same hypotheses as improperIntegral_tail_convergence, if the improper integrals from a and from b both converge, then the value from a splits as the sum of the integral over [a, b] and the improper integral from b to ∞.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_tail_value {f : ℝ → ℝ} {a b l₁ l₂ : ℝ} (hb : b > a) (hInt : ∀ c > a, MeasureTheory.IntegrableOn f (Set.Icc a c)) (ha : ImproperIntegralAtTop f a l₁) (hbConv : ImproperIntegralAtTop f b l₂) : l₁ = (∫ x in a..b, f x) + l₂

Lean source

Proposition 5.5.4. Let f : [a, ∞) → ℝ be nonnegative and Riemann integrable on every interval [a, b] with b > a. (i) If the improper integral ∫ a^∞ f converges to l, then l = sup {∫ a..x, f x | x ≥ a}. (ii) For any sequence xₙ → ∞, the improper integral converges if and only if lim_{n → ∞} ∫ a^{xₙ} f exists, and in that case the two limits agree.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_nonneg_sup_and_seq {f : ℝ → ℝ} {a l : ℝ} (hInt : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hpos : ∀ x, a ≤ x → 0 ≤ f x) (hconv : ImproperIntegralAtTop f a l) : l = sSup ((fun t : ℝ => ∫ x in a..t, f x) '' {t : ℝ | a ≤ t}) ∧ ∀ x : ℕ → ℝ, Tendsto x atTop atTop → (ImproperIntegralAtTop f a l ↔ Tendsto (fun n => ∫ t in a..x n, f t) atTop (nhds l))

Lean source

Proposition 5.5.5 (comparison test for improper integrals). Let f g : [a, ∞) → ℝ be Riemann integrable on every [a, b] with b > a and assume |f x| ≤ g x for all x ≥ a. (i) If ∫ a^∞ g converges, then ∫ a^∞ f converges and |∫ a^∞ f| ≤ ∫ a^∞ g. (ii) If ∫ a^∞ f diverges, then ∫ a^∞ g diverges.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_comparison {a : ℝ} {f g : ℝ → ℝ} (hIntf : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hIntg : ∀ c, MeasureTheory.IntegrableOn g (Set.Icc a c)) (hbound : ∀ x, a ≤ x → |f x| ≤ g x) : (∀ {lg : ℝ}, ImproperIntegralAtTop g a lg → ∃ lf : ℝ, ImproperIntegralAtTop f a lf ∧ |lf| ≤ lg) ∧ (¬ ImproperIntegralAtTopConverges f a → ¬ ImproperIntegralAtTopConverges g a)

Lean source

Example 5.5.6. The improper integral ∫₀^∞ (sin (x^2) * (x + 2)) / (x^3 + 1) converges, for instance by comparing its tail to 3 / x^2 on [1, ∞) and using the tail test.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_sin_sq_over_cubic_converges : ImproperIntegralAtTopConverges (fun x : ℝ => (Real.sin (x ^ 2) * (x + 2)) / (x ^ 3 + 1)) 0

Lean source

Example 5.5.7. The improper integral ∫₂^∞ 2 / (x^2 - 1) converges (in fact to log 3), but writing 2 / (x^2 - 1) = 1 / (x - 1) - 1 / (x + 1) does not allow splitting the improper integral, since both pieces diverge separately.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_partial_fraction_counterexample : ImproperIntegralAtTop (fun x : ℝ => 2 / (x ^ 2 - 1)) 2 (Real.log (3 : ℝ)) ∧ ¬ ImproperIntegralAtTopConverges (fun x : ℝ => 1 / (x - 1)) 2 ∧ ¬ ImproperIntegralAtTopConverges (fun x : ℝ => 1 / (x + 1)) 2

Lean source

Definition 5.5.8. For a function f : (a, b) → ℝ that is Riemann integrable on every closed subinterval [c, d] with a < c < d < b, the improper integral ∫ a^b f is defined as the iterated limit lim_{c → a⁺} lim_{d → b⁻} ∫_{c}^{d} f when this limit exists.

open Set Filter Real open BigOperators open scoped BigOperators def ImproperIntegralOpenInterval (f : ℝ → ℝ) (a b l : ℝ) : Prop := (∀ ⦃c d⦄, a < c → c < d → d < b → MeasureTheory.IntegrableOn f (Set.Icc c d)) ∧ Tendsto (fun p : ℝ × ℝ => ∫ x in p.1..p.2, f x) (nhdsWithin a (Set.Ioi a) ×ˢ nhdsWithin b (Set.Iio b)) (nhds l)

Lean source

Definition 5.5.8 (whole line). If f : ℝ → ℝ is Riemann integrable on every bounded interval [a, b], then the improper integral ∫_{-∞}^{∞} f is defined as lim_{c → -∞} lim_{d → ∞} ∫_{c}^{d} f, when this limit exists.

open Set Filter Real open BigOperators open scoped BigOperators def ImproperIntegralRealLine (f : ℝ → ℝ) (l : ℝ) : Prop := (∀ a b : ℝ, MeasureTheory.IntegrableOn f (Set.Icc a b)) ∧ Tendsto (fun p : ℝ × ℝ => ∫ x in p.1..p.2, f x) (Filter.atBot ×ˢ Filter.atTop) (nhds l)

Lean source

Example 5.5.9. The improper integral of 1 / (1 + x^2) over the entire real line converges and has value π, computed via the antiderivative x ↦ arctan x and the limits at ±∞.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_real_line_inv_one_plus_sq : ImproperIntegralRealLine (fun x : ℝ => 1 / (1 + x ^ 2)) Real.pi

Lean source

Proposition 5.5.10. If f : ℝ → ℝ is Riemann integrable on every bounded interval [a, b], then the iterated limits lim_{a → -∞} lim_{b → ∞} ∫_{a}^{b} f and lim_{b → ∞} lim_{a → -∞} ∫_{a}^{b} f converge together and have the same value. If either iterated limit exists, then the improper integral over the whole line converges to the same value and agrees with the limit of the symmetric integrals ∫_{-a}^{a} f as a → ∞.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_iterated_limits_symm {f : ℝ → ℝ} (hInt : ∀ a b : ℝ, MeasureTheory.IntegrableOn f (Set.Icc a b)) : ((∃ g l, (∀ a, Tendsto (fun b : ℝ => ∫ x in a..b, f x) atTop (nhds (g a))) ∧ Tendsto g atBot (nhds l)) ↔ (∃ h l, (∀ b, Tendsto (fun a : ℝ => ∫ x in a..b, f x) atBot (nhds (h b))) ∧ Tendsto h atTop (nhds l))) ∧ (∀ g h l₁ l₂, (∀ a, Tendsto (fun b : ℝ => ∫ x in a..b, f x) atTop (nhds (g a))) → Tendsto g atBot (nhds l₁) → (∀ b, Tendsto (fun a : ℝ => ∫ x in a..b, f x) atBot (nhds (h b))) → Tendsto h atTop (nhds l₂) → l₁ = l₂) ∧ ((∃ g l, (∀ a, Tendsto (fun b : ℝ => ∫ x in a..b, f x) atTop (nhds (g a))) ∧ Tendsto g atBot (nhds l)) → ∃ l, ImproperIntegralRealLine f l ∧ Tendsto (fun a : ℝ => ∫ x in (-a)..a, f x) atTop (nhds l))

Lean source

Example 5.5.11. For the function f(x) = x / |x| with f(0) = 0, integrable on every bounded interval, the improper integral over the whole line does not converge because for any fixed a < 0 the limit lim_{b → ∞} ∫_{a}^{b} f diverges. However, the symmetric partial integrals ∫_{-a}^{a} f are all zero for a > 0, so lim_{a → ∞} ∫_{-a}^{a} f = 0.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_sign_diverges_but_symmetric_zero : (∀ a : ℝ, a < 0 → ¬ ImproperIntegralAtTopConverges (fun x : ℝ => if x = 0 then 0 else x / |x|) a) ∧ Tendsto (fun a : ℝ => ∫ x in (-a)..a, (if x = 0 then 0 else x / |x|)) atTop (nhds 0)

Lean source

Example 5.5.12. The sinc function is defined by sinc x = sin x / x for x ≠ 0 and sinc 0 = 1. Its improper integral over the whole real line converges to π, while the improper integral of its absolute value diverges.

open Set Filter Real open BigOperators open scoped BigOperators noncomputable def sinc (x : ℝ) : ℝ := if x = 0 then 1 else Real.sin x / x

Lean source

Tail bound for the sinc primitive on positive intervals.

open Set Filter Real open BigOperators open scoped BigOperators lemma sinc_tail_bound {s t : ℝ} (hs : (1 : ℝ) ≤ s) (hst : s ≤ t) :

Lean source

The primitive t ↦ ∫_0^t sinc has a finite limit at +∞.

open Set Filter Real open BigOperators open scoped BigOperators lemma sinc_primitive_tendsto_atTop_exists : ∃ L : ℝ, Tendsto (fun t : ℝ => ∫ x in (0 : ℝ)..t, _root_.sinc x) atTop (nhds L)

Lean source

Integral representation sinc x = ∫_0^1 cos (t x) dt.

open Set Filter Real open BigOperators open scoped BigOperators lemma sinc_eq_integral_cos_mul (x : ℝ) : _root_.sinc x = ∫ t in (0 : ℝ)..1, Real.cos (t * x)

Lean source

open Set Filter Real open BigOperators open scoped BigOperators noncomputable def muA (a : ℝ) : MeasureTheory.Measure ℝ := (MeasureTheory.volume.restrict (Set.Ioi (0 : ℝ))).withDensity (fun x : ℝ => ENNReal.ofReal (Real.exp (-a * x)))

Lean source

open Set Filter Real open BigOperators open scoped BigOperators lemma charFun_muA (a t : ℝ) (ha : 0 < a) : MeasureTheory.charFun (muA a) t = (1 : ℂ) / (a - t * Complex.I)

Lean source

open Set Filter Real open BigOperators open scoped BigOperators lemma damped_sinc_integral_eq_arctan (a : ℝ) (ha : 0 < a) : (∫ x in Set.Ioi (0 : ℝ), Real.exp (-a * x) * Real.sinc x) = Real.arctan (a⁻¹)

Lean source

open Set Filter Real open BigOperators open scoped BigOperators lemma integrableOn_exp_mul_comp_of_tendsto (F : ℝ → ℝ) (hFcont : Continuous F) {L : ℝ} (hL : Tendsto F atTop (nhds L)) (a : ℝ) (ha : 0 ≤ a) : MeasureTheory.IntegrableOn (fun x : ℝ => Real.exp (-x) * F (a * x)) (Set.Ioi (0 : ℝ))

Lean source

open Set Filter Real open BigOperators open scoped BigOperators lemma abel_weighted_tendsto_of_tendsto (F : ℝ → ℝ) (L : ℝ) (hFcont : Continuous F) (hL : Tendsto F atTop (nhds L)) : Tendsto (fun n : ℕ => ∫ x in Set.Ioi (0 : ℝ), Real.exp (-x) * F (((n : ℝ) + 1) * x)) atTop (nhds L)

Lean source

open Set Filter Real open BigOperators open scoped BigOperators lemma weighted_primitive_eval (F : ℝ → ℝ) (hF0 : F 0 = 0) (hFderiv : ∀ x : ℝ, HasDerivAt F (Real.sinc x) x) {L : ℝ} (hL : Tendsto F atTop (nhds L)) (n : ℕ) : (∫ x in Set.Ioi (0 : ℝ), Real.exp (-x) * F (((n : ℝ) + 1) * x)) = Real.arctan ((n : ℝ) + 1)

Lean source

Example 5.5.12. The improper integral of the sinc function over the real line converges and equals π, but the integral of its absolute value diverges, so the convergence is not absolute.

open Set Filter Real open BigOperators open scoped BigOperators theorem improperIntegral_sinc_conditional : ImproperIntegralRealLine _root_.sinc Real.pi ∧ ¬ ∃ l : ℝ, ImproperIntegralRealLine (fun x : ℝ => |_root_.sinc x|) l

Lean source

Proposition 5.5.13 (integral test for series). If f : [k, ∞) → ℝ is nonnegative and decreasing for some integer k, then the series ∑_{n = k}^{∞} f n converges if and only if the improper integral ∫ k^∞ f converges. In the convergent case, ∫ k^∞ f ≤ ∑_{n = k}^{∞} f n ≤ f k + ∫ k^∞ f.

open Set Filter Real open BigOperators open scoped BigOperators theorem integral_test_for_series {f : ℝ → ℝ} {k : ℕ} (hmono : AntitoneOn f (Set.Ici (k : ℝ))) (hpos : ∀ x, (k : ℝ) ≤ x → 0 ≤ f x) (hInt : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc (k : ℝ) c)) : (Summable (fun n : ℕ => f (n + k)) ↔ ImproperIntegralAtTopConverges f k) ∧ (∀ {l}, ImproperIntegralAtTop f k l → Summable (fun n : ℕ => f (n + k)) → l ≤ tsum (fun n : ℕ => f (n + k)) ∧ tsum (fun n : ℕ => f (n + k)) ≤ f k + l)

Lean source

Telescoping sum for successive differences.

open Set Filter Real open BigOperators open scoped BigOperators lemma sum_range_sub_telescope (u : ℕ → ℝ) : ∀ N, (Finset.sum (Finset.range N) fun n => u n - u (n + 1)) = u 0 - u N

Lean source

For m ≥ 1, the term 1 / m^2 dominates the telescoping difference 1 / m - 1 / (m + 1).

open Set Filter Real open BigOperators open scoped BigOperators lemma inv_sq_ge_sub_inv_succ {m : ℕ} (hm : 1 ≤ m) : (1 : ℝ) / (m : ℝ) ^ 2 ≥ 1 / (m : ℝ) - 1 / (m.succ : ℝ)

Lean source

For m ≥ 1, the next term 1 / (m + 1)^2 is bounded above by the same telescoping difference 1 / m - 1 / (m + 1).

open Set Filter Real open BigOperators open scoped BigOperators lemma inv_sq_succ_le_sub_inv {m : ℕ} (hm : 1 ≤ m) : (1 : ℝ) / (m.succ : ℝ) ^ 2 ≤ 1 / (m : ℝ) - 1 / (m.succ : ℝ)

Lean source

open Set Filter Real open BigOperators open scoped BigOperators lemma tail_bounds_one_div_nat_sq {k : ℕ} (hk : 1 ≤ k) : 1 / (k : ℝ) ≤ tsum (fun n : ℕ => (1 : ℝ) / ((n + k : ℕ) : ℝ) ^ 2) ∧ tsum (fun n : ℕ => (1 : ℝ) / ((n + k : ℕ) : ℝ) ^ 2) ≤ 1 / (k : ℝ) ^ 2 + 1 / (k : ℝ)

Lean source

Example 5.5.14. Using the integral test with f x = 1 / x^2 gives explicit bounds on the Basel series. For any integer k ≥ 1, `∑_{n=1}^{k-1} 1 / n^2 + 1 / k ≤ ∑_{n=1}^{∞} 1 / n^2 ≤ ∑_{n=1}^{k-1} 1 / n^2 + 1 / k + 1 / k^2. Numerically, taking k = 10` shows the sum lies between 1.6397… and 1.6497…, while the exact value is π^2 / 6 ≈ 1.6449….

open Set Filter Real open BigOperators open scoped BigOperators theorem series_one_div_nat_sq_bounds {k : ℕ} (hk : 1 ≤ k) : Summable (fun n : ℕ => (1 : ℝ) / (n.succ : ℝ) ^ 2) ∧ ((Finset.sum (Finset.range (k - 1)) (fun n : ℕ => (1 : ℝ) / (n.succ : ℝ) ^ 2) + 1 / (k : ℝ) ≤ tsum (fun n : ℕ => (1 : ℝ) / (n.succ : ℝ) ^ 2)) ∧ (tsum (fun n : ℕ => (1 : ℝ) / (n.succ : ℝ) ^ 2) ≤ Finset.sum (Finset.range (k - 1)) (fun n : ℕ => (1 : ℝ) / (n.succ : ℝ) ^ 2) + 1 / (k : ℝ) + 1 / ((k : ℝ) ^ 2)))

Lean source

Helper: x ↦ 1 / x^p is integrable on any interval [1, c].

open Set Filter Real open BigOperators open scoped BigOperators lemma integrableOn_Icc_one_div_rpow (p c : ℝ) : MeasureTheory.IntegrableOn (fun x : ℝ => 1 / x ^ p) (Set.Icc (1 : ℝ) c)

Lean source

Helper: explicit interval integral for x ↦ 1 / x^p on positive bounds.

open Set Filter Real open BigOperators open scoped BigOperators lemma improperIntegral_p_test_integral_formula {a b p : ℝ} (ha : 0 < a) (hb : 0 < b) (hp : p ≠ 1) : ∫ x in a..b, 1 / x ^ p = (b ^ (1 - p) - a ^ (1 - p)) / (1 - p)

Lean source

Helper: extend local integrability on (a, ∞) to all right endpoints.

open Set Filter Real open BigOperators open scoped BigOperators lemma integrableOn_Icc_all {f : ℝ → ℝ} {a b : ℝ} (hb : b > a) (hInt : ∀ c > a, MeasureTheory.IntegrableOn f (Set.Icc a c)) : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)

Lean source

Helper: for large c, the interval integral from a to c splits at b.

open Set Filter Real open BigOperators open scoped BigOperators lemma eventually_eq_integral_split {f : ℝ → ℝ} {a b : ℝ} (hb : b > a) (hInt : ∀ c > a, MeasureTheory.IntegrableOn f (Set.Icc a c)) : (fun c : ℝ => ∫ x in a..c, f x) =ᶠ[atTop] fun c => (∫ x in a..b, f x) + ∫ x in b..c, f x

Lean source

Helper: convergence of the tail from b implies convergence from a.

open Set Filter Real open BigOperators open scoped BigOperators lemma improperIntegralAtTop_of_tail {f : ℝ → ℝ} {a b l : ℝ} (hb : b > a) (hInt : ∀ c > a, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hbConv : ImproperIntegralAtTop f b l) : ImproperIntegralAtTop f a ((∫ x in a..b, f x) + l)

Lean source

Helper: convergence from a implies convergence of the tail from b.

open Set Filter Real open BigOperators open scoped BigOperators lemma improperIntegralAtTop_tail_of {f : ℝ → ℝ} {a b l : ℝ} (hb : b > a) (hInt : ∀ c > a, MeasureTheory.IntegrableOn f (Set.Icc a c)) (ha : ImproperIntegralAtTop f a l) : ImproperIntegralAtTop f b (l - ∫ x in a..b, f x)

Lean source

Helper: partial integrals are monotone in the upper bound for nonnegative f.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegral_mono_upper {f : ℝ → ℝ} {a s t : ℝ} (hInt : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hpos : ∀ x, a ≤ x → 0 ≤ f x) (has : a ≤ s) (hst : s ≤ t) : ∫ x in a..s, f x ≤ ∫ x in a..t, f x

Lean source

Helper: t ↦ ∫ a..max t a f is monotone.

open Set Filter Real open BigOperators open scoped BigOperators lemma monotone_integral_max {f : ℝ → ℝ} {a : ℝ} (hInt : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hpos : ∀ x, a ≤ x → 0 ≤ f x) : Monotone (fun t : ℝ => ∫ x in a..max t a, f x)

Lean source

Helper: max-truncated partial integrals tend to the improper integral value.

open Set Filter Real open BigOperators open scoped BigOperators lemma tendsto_integral_max {f : ℝ → ℝ} {a l : ℝ} (hconv : ImproperIntegralAtTop f a l) : Tendsto (fun t : ℝ => ∫ x in a..max t a, f x) atTop (nhds l)

Lean source

Helper: range of the max-truncated integral matches the image over t ≥ a.

open Set Filter Real open BigOperators open scoped BigOperators lemma range_integral_max_eq_image {f : ℝ → ℝ} {a : ℝ} : Set.range (fun t : ℝ => ∫ x in a..max t a, f x) = (fun t : ℝ => ∫ x in a..t, f x) '' {t : ℝ | a ≤ t}

Lean source

Helper: composing with a sequence tending to ∞ preserves the limit.

open Set Filter Real open BigOperators open scoped BigOperators lemma tendsto_integral_comp_seq {f : ℝ → ℝ} {a l : ℝ} {x : ℕ → ℝ} (hconv : ImproperIntegralAtTop f a l) (hx : Tendsto x atTop atTop) : Tendsto (fun n => ∫ t in a..x n, f t) atTop (nhds l)

Lean source

Helper: comparison bound implies g is nonnegative on [a, ∞).

open Set Filter Real open BigOperators open scoped BigOperators lemma comparison_nonneg_g {a : ℝ} {f g : ℝ → ℝ} (hbound : ∀ x, a ≤ x → |f x| ≤ g x) : ∀ x, a ≤ x → 0 ≤ g x

Lean source

Helper: difference of partial integrals is the tail integral.

open Set Filter Real open BigOperators open scoped BigOperators lemma integral_diff_eq_interval {a b c : ℝ} {f : ℝ → ℝ} (hIntf : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hb : a ≤ b) (hbc : b ≤ c) : (∫ x in a..c, f x) - (∫ x in a..b, f x) = ∫ x in b..c, f x

Lean source

Helper: domination by g bounds absolute interval integrals.

open Set Filter Real open BigOperators open scoped BigOperators lemma abs_integral_le_of_bound {a : ℝ} {f g : ℝ → ℝ} (hIntg : ∀ c, MeasureTheory.IntegrableOn g (Set.Icc a c)) (hbound : ∀ x, a ≤ x → |f x| ≤ g x) : ∀ {c}, a ≤ c → |∫ x in a..c, f x| ≤ ∫ x in a..c, g x

Lean source

Helper: difference of partial integrals is controlled by g.

open Set Filter Real open BigOperators open scoped BigOperators lemma abs_integral_diff_le {a : ℝ} {f g : ℝ → ℝ} (hIntf : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hIntg : ∀ c, MeasureTheory.IntegrableOn g (Set.Icc a c)) (hbound : ∀ x, a ≤ x → |f x| ≤ g x) : ∀ {b c}, a ≤ b → b ≤ c →

Lean source

Helper: dominated partial integrals form a Cauchy filter.

open Set Filter Real open BigOperators open scoped BigOperators lemma cauchy_partial_integrals_of_comparison {a : ℝ} {f g : ℝ → ℝ} {lg : ℝ} (hIntf : ∀ c, MeasureTheory.IntegrableOn f (Set.Icc a c)) (hIntg : ∀ c, MeasureTheory.IntegrableOn g (Set.Icc a c)) (hbound : ∀ x, a ≤ x → |f x| ≤ g x) (hconv : ImproperIntegralAtTop g a lg) : Cauchy (Filter.map (fun c : ℝ => ∫ x in a..c, f x) atTop)

Lean source

Helper: pass eventual absolute bounds to the limit.

open Set Filter Real open BigOperators open scoped BigOperators lemma limit_abs_le {F G : ℝ → ℝ} {lf lg : ℝ} (hF : Tendsto F atTop (nhds lf)) (hG : Tendsto G atTop (nhds lg)) (hbound : ∀ᶠ x in atTop, |F x| ≤ G x) :

Lean source

Helper: local integrability of the oscillatory integrand on [a, c] with 0 ≤ a.

open Set Filter Real open BigOperators open scoped BigOperators lemma integrableOn_sin_sq_over_cubic_Icc {a c : ℝ} (ha : 0 ≤ a) : MeasureTheory.IntegrableOn (fun x : ℝ => (Real.sin (x ^ 2) * (x + 2)) / (x ^ 3 + 1)) (Set.Icc a c)

Lean source

Helper: tail bound for the oscillatory integrand on [1, ∞).

open Set Filter Real open BigOperators open scoped BigOperators lemma bound_sin_sq_over_cubic {x : ℝ} (hx : 1 ≤ x) :

Lean source

Helper: the improper integral of 3 / x^2 from 1 equals 3.

open Set Filter Real open BigOperators open scoped BigOperators lemma improperIntegralAtTop_three_over_x_sq : ImproperIntegralAtTop (fun x : ℝ => 3 / x ^ 2) 1 3

Lean source

Helper: shifting by a constant preserves divergence to +∞.

open Set Filter Real open BigOperators open scoped BigOperators lemma tendsto_add_const_atTop (k : ℝ) : Tendsto (fun x : ℝ => x + k) atTop atTop

Lean source

Helper: integrate 1 / (x - 1) on (2, c) via a shift.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegral_one_div_sub {c : ℝ} (hc : 2 < c) : ∫ x in 2..c, 1 / (x - 1) = Real.log (c - 1)

Lean source

Helper: integrate 1 / (x + 1) on (2, c) via a shift.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegral_one_div_add {c : ℝ} (hc : 2 < c) : ∫ x in 2..c, 1 / (x + 1) = Real.log (c + 1) - Real.log 3

Lean source

Helper: interval integrability of 1 / (x - 1) on [2, c] for c > 2.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegrable_one_div_sub {c : ℝ} (hc : 2 < c) : IntervalIntegrable (fun x : ℝ => 1 / (x - 1)) MeasureTheory.volume 2 c

Lean source

Helper: interval integrability of 1 / (x + 1) on [2, c] for c > 2.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegrable_one_div_add {c : ℝ} (hc : 2 < c) : IntervalIntegrable (fun x : ℝ => 1 / (x + 1)) MeasureTheory.volume 2 c

Lean source

Helper: evaluate the partial fractions integral on (2, c).

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegral_two_over_x_sq_sub_one {c : ℝ} (hc : 2 < c) : ∫ x in 2..c, 2 / (x ^ 2 - 1) = Real.log (c - 1) - Real.log (c + 1) + Real.log 3

Lean source

Helper: log (c - 1) - log (c + 1) tends to 0 as c → ∞.

open Set Filter Real open BigOperators open scoped BigOperators lemma tendsto_log_sub_log_zero : Tendsto (fun c : ℝ => Real.log (c - 1) - Real.log (c + 1)) atTop (nhds 0)

Lean source

Helper: the shifted reciprocal integrals diverge at ∞.

open Set Filter Real open BigOperators open scoped BigOperators lemma divergence_shifted_one_div : ¬ ImproperIntegralAtTopConverges (fun x : ℝ => 1 / (x - 1)) 2 ∧ ¬ ImproperIntegralAtTopConverges (fun x : ℝ => 1 / (x + 1)) 2

Lean source

Helper: integrability of 2 / (x^2 - 1) on [2, c].

open Set Filter Real open BigOperators open scoped BigOperators lemma integrableOn_two_over_x_sq_sub_one_Icc (c : ℝ) : MeasureTheory.IntegrableOn (fun x : ℝ => 2 / (x ^ 2 - 1)) (Set.Icc 2 c)

Lean source

Helper: integrability of x ↦ 1 / (1 + x^2) on any closed interval.

open Set Filter Real open BigOperators open scoped BigOperators lemma integrableOn_inv_one_plus_sq_Icc (a b : ℝ) : MeasureTheory.IntegrableOn (fun x : ℝ => 1 / (1 + x ^ 2)) (Set.Icc a b)

Lean source

Helper: interval integral of 1 / (1 + x^2) via arctan.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegral_inv_one_add_sq_eq_arctan (a b : ℝ) : (∫ x in a..b, 1 / (1 + x ^ 2)) = arctan b - arctan a

Lean source

Helper: arctan difference tends to π on (-∞, ∞).

open Set Filter Real open BigOperators open scoped BigOperators lemma tendsto_arctan_diff_atBot_atTop : Tendsto (fun p : ℝ × ℝ => arctan p.2 - arctan p.1) (Filter.atBot ×ˢ Filter.atTop) (nhds (π : ℝ))

Lean source

Helper: integrability on all closed intervals implies interval integrability.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegrable_of_integrableOn_Icc {f : ℝ → ℝ} (hInt : ∀ a b : ℝ, MeasureTheory.IntegrableOn f (Set.Icc a b)) (a b : ℝ) : IntervalIntegrable f MeasureTheory.volume a b

Lean source

Helper: express an interval integral via the basepoint 0.

open Set Filter Real open BigOperators open scoped BigOperators lemma intervalIntegral_eq_sub_base {f : ℝ → ℝ} (hInt : ∀ a b : ℝ, MeasureTheory.IntegrableOn f (Set.Icc a b)) (a b : ℝ) : (∫ x in a..b, f x) = (∫ x in 0..b, f x) - (∫ x in 0..a, f x)

Lean source

Helper: convergence of base integrals at -∞ gives left partial limits.

open Set Filter Real open BigOperators open scoped BigOperators lemma tendsto_intervalIntegral_atBot_of_base {f : ℝ → ℝ} (hInt : ∀ a b : ℝ, MeasureTheory.IntegrableOn f (Set.Icc a b)) {Lminus : ℝ} (hbot : Tendsto (fun t : ℝ => ∫ x in 0..t, f x) atBot (nhds Lminus)) (b : ℝ) : Tendsto (fun a : ℝ => ∫ x in a..b, f x) atBot (nhds ((∫ x in 0..b, f x) - Lminus))

Lean source

Helper: base limits at ±∞ yield the two-variable limit.

open Set Filter Real open BigOperators open scoped BigOperators lemma tendsto_intervalIntegral_atBot_atTop_of_base {f : ℝ → ℝ} (hInt : ∀ a b : ℝ, MeasureTheory.IntegrableOn f (Set.Icc a b)) {Lminus Lplus : ℝ} (hbot : Tendsto (fun t : ℝ => ∫ x in 0..t, f x) atBot (nhds Lminus)) (htop : Tendsto (fun t : ℝ => ∫ x in 0..t, f x) atTop (nhds Lplus)) : Tendsto (fun p : ℝ × ℝ => ∫ x in p.1..p.2, f x) (Filter.atBot ×ˢ Filter.atTop) (nhds (Lplus - Lminus))