|
| 1 | +/- |
| 2 | +Copyright (c) 2026 Dennj Osele. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Dennj Osele |
| 5 | +-/ |
| 6 | +module |
| 7 | + |
| 8 | +public import Mathlib.Analysis.SpecialFunctions.ExpDeriv |
| 9 | + |
| 10 | +/-! |
| 11 | +# Discrete Grönwall inequality |
| 12 | +
|
| 13 | +Various forms of the discrete Grönwall inequality, bounding solutions to recurrence |
| 14 | +inequalities `u (n+1) ≤ c n * u n + b n` and `u (n+1) ≤ (1 + c n) * u n + b n`. |
| 15 | +
|
| 16 | +## Main results |
| 17 | +
|
| 18 | +* `discrete_gronwall_prod_general`: product form, over any ordered commutative semiring. |
| 19 | +* `discrete_gronwall`: classical exponential bound for the `(1 + c)` form, over `ℝ`. |
| 20 | +* `discrete_gronwall_Ico`: uniform bound over an interval, over `ℝ`. |
| 21 | +
|
| 22 | +## References |
| 23 | +
|
| 24 | +* [T. H. Grönwall, *Note on the derivatives with respect to a parameter of the solutions of a |
| 25 | + system of differential equations*][Gronwall_1919] |
| 26 | +
|
| 27 | +## See also |
| 28 | +
|
| 29 | +* `Mathlib.Analysis.ODE.Gronwall` for the continuous Grönwall inequality for ODEs. |
| 30 | +-/ |
| 31 | + |
| 32 | +@[expose] public section |
| 33 | + |
| 34 | +open Real Finset |
| 35 | + |
| 36 | +section General |
| 37 | + |
| 38 | +/-! ### Generalized product form -/ |
| 39 | + |
| 40 | +variable {R : Type*} [CommSemiring R] [PartialOrder R] [IsOrderedRing R] {u b c : ℕ → R} |
| 41 | + |
| 42 | +/-- Discrete Grönwall inequality, product form: if `u (n+1) ≤ c n * u n + b n` and `0 ≤ c n` |
| 43 | +then `u n ≤ u n₀ * ∏ c i + ∑ b k * ∏ c i` over the appropriate ranges. -/ |
| 44 | +theorem discrete_gronwall_prod_general {n₀ : ℕ} (hu : ∀ n ≥ n₀, u (n + 1) ≤ c n * u n + b n) |
| 45 | + (hc : ∀ n ≥ n₀, 0 ≤ c n) ⦃n : ℕ⦄ (hn : n₀ ≤ n) : |
| 46 | + u n ≤ u n₀ * ∏ i ∈ Ico n₀ n, c i + |
| 47 | + ∑ k ∈ Ico n₀ n, b k * ∏ i ∈ Ico (k + 1) n, c i := by |
| 48 | + induction n, hn using Nat.le_induction with |
| 49 | + | base => simp |
| 50 | + | succ k hk ih => |
| 51 | + have hck : 0 ≤ c k := hc k hk |
| 52 | + have heq : c k * ∑ j ∈ Ico n₀ k, b j * ∏ i ∈ Ico (j + 1) k, c i + b k = |
| 53 | + ∑ j ∈ Ico n₀ (k + 1), b j * ∏ i ∈ Ico (j + 1) (k + 1), c i := by |
| 54 | + rw [sum_Ico_succ_top hk, mul_sum, Ico_self, prod_empty, mul_one] |
| 55 | + refine congr_arg (· + b k) (sum_congr rfl fun j hj ↦ ?_) |
| 56 | + rw [prod_Ico_succ_top (by have := mem_Ico.mp hj; omega)]; ring |
| 57 | + calc u (k + 1) |
| 58 | + _ ≤ c k * u k + b k := hu k hk |
| 59 | + _ ≤ c k * (u n₀ * ∏ i ∈ Ico n₀ k, c i + |
| 60 | + ∑ j ∈ Ico n₀ k, b j * ∏ i ∈ Ico (j + 1) k, c i) + b k := by gcongr |
| 61 | + _ = u n₀ * ∏ i ∈ Ico n₀ (k + 1), c i + |
| 62 | + ∑ j ∈ Ico n₀ (k + 1), b j * ∏ i ∈ Ico (j + 1) (k + 1), c i := by |
| 63 | + rw [← heq, ← prod_Ico_mul_eq_prod_Ico_add_one hk]; ring |
| 64 | + |
| 65 | +end General |
| 66 | + |
| 67 | +/-! ### Real-valued exponential form -/ |
| 68 | + |
| 69 | +variable {u b c : ℕ → ℝ} |
| 70 | + |
| 71 | +/-- Discrete Grönwall inequality, exponential form: if `u (n+1) ≤ (1 + c n) * u n + b n` with |
| 72 | +`b`, `c`, and `u n₀` non-negative, then `u n ≤ (u n₀ + ∑ b k) * exp (∑ c i)`. -/ |
| 73 | +theorem discrete_gronwall {n₀ : ℕ} (hun₀ : 0 ≤ u n₀) |
| 74 | + (hu : ∀ n ≥ n₀, u (n + 1) ≤ (1 + c n) * u n + b n) (hc : ∀ n ≥ n₀, 0 ≤ c n) |
| 75 | + (hb : ∀ n ≥ n₀, 0 ≤ b n) ⦃n : ℕ⦄ (hn : n₀ ≤ n) : |
| 76 | + u n ≤ (u n₀ + ∑ k ∈ Ico n₀ n, b k) * exp (∑ i ∈ Ico n₀ n, c i) := by |
| 77 | + calc u n |
| 78 | + _ ≤ u n₀ * ∏ i ∈ Ico n₀ n, (1 + c i) + |
| 79 | + ∑ k ∈ Ico n₀ n, b k * ∏ i ∈ Ico (k + 1) n, (1 + c i) := |
| 80 | + discrete_gronwall_prod_general hu (by grind) hn |
| 81 | + _ ≤ u n₀ * ∏ i ∈ Ico n₀ n, (1 + c i) + |
| 82 | + ∑ k ∈ Ico n₀ n, b k * ∏ i ∈ Ico n₀ n, (1 + c i) := by |
| 83 | + gcongr <;> grind |
| 84 | + _ = (u n₀ + ∑ k ∈ Ico n₀ n, b k) * ∏ i ∈ Ico n₀ n, (1 + c i) := by rw [add_mul, sum_mul] |
| 85 | + _ ≤ (u n₀ + ∑ k ∈ Ico n₀ n, b k) * exp (∑ i ∈ Ico n₀ n, c i) := by |
| 86 | + gcongr <;> try exact add_nonneg hun₀ <| sum_nonneg <| by grind |
| 87 | + simpa [exp_sum] using prod_le_prod (by grind) (by grind [add_one_le_exp]) |
| 88 | + |
| 89 | +/-- Discrete Grönwall inequality, uniform bound: a single bound holding for all `n ∈ [n₀, n₁)`. -/ |
| 90 | +theorem discrete_gronwall_Ico {n₀ n₁ : ℕ} (hun₀ : 0 ≤ u n₀) |
| 91 | + (hu : ∀ n ≥ n₀, u (n + 1) ≤ (1 + c n) * u n + b n) |
| 92 | + (hc : ∀ n ≥ n₀, 0 ≤ c n) (hb : ∀ n ≥ n₀, 0 ≤ b n) ⦃n : ℕ⦄ (hn : n ∈ Ico n₀ n₁) : |
| 93 | + u n ≤ (u n₀ + ∑ k ∈ Ico n₀ n₁, b k) * exp (∑ i ∈ Ico n₀ n₁, c i) := by |
| 94 | + have : 0 ≤ ∑ k ∈ Ico n₀ n₁, b k := sum_nonneg <| by grind |
| 95 | + exact (discrete_gronwall hun₀ hu hc hb (mem_Ico.mp hn).1).trans (by gcongr <;> grind) |
0 commit comments