|
| 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 linearly ordered commutative ring. |
| 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*} [CommRing R] [LinearOrder R] [IsStrictOrderedRing R] {u b c : ℕ → R} |
| 41 | + |
| 42 | +/-- Discrete Grönwall inequality, product form: if `u (n+1) ≤ c n * u n + b n` and `1 ≤ 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₀, 1 ≤ 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 := zero_le_one.trans (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 | + have hprod_le_exp : ∏ i ∈ Ico n₀ n, (1 + c i) ≤ exp (∑ i ∈ Ico n₀ n, c i) := by |
| 78 | + rw [exp_sum] |
| 79 | + exact Finset.prod_le_prod (fun i hi ↦ by linarith [hc i (mem_Ico.mp hi).1]) |
| 80 | + (fun i _ ↦ by linarith [add_one_le_exp (c i)]) |
| 81 | + calc u n |
| 82 | + _ ≤ u n₀ * ∏ i ∈ Ico n₀ n, (1 + c i) + |
| 83 | + ∑ k ∈ Ico n₀ n, b k * ∏ i ∈ Ico (k + 1) n, (1 + c i) := |
| 84 | + discrete_gronwall_prod_general hu (by grind) hn |
| 85 | + _ ≤ u n₀ * ∏ i ∈ Ico n₀ n, (1 + c i) + |
| 86 | + ∑ k ∈ Ico n₀ n, b k * ∏ i ∈ Ico n₀ n, (1 + c i) := |
| 87 | + add_le_add le_rfl <| sum_le_sum fun j hj ↦ mul_le_mul_of_nonneg_left |
| 88 | + (prod_le_prod_of_subset_of_one_le |
| 89 | + (Ico_subset_Ico_left (by have := mem_Ico.mp hj; omega)) |
| 90 | + (fun i hi ↦ by |
| 91 | + have := mem_Ico.mp hj; have := mem_Ico.mp hi; linarith [hc i (by omega)]) |
| 92 | + (fun i hi _ ↦ by linarith [hc i (mem_Ico.mp hi).1])) |
| 93 | + (hb j (mem_Ico.mp hj).1) |
| 94 | + _ = (u n₀ + ∑ k ∈ Ico n₀ n, b k) * ∏ i ∈ Ico n₀ n, (1 + c i) := by rw [add_mul, sum_mul] |
| 95 | + _ ≤ (u n₀ + ∑ k ∈ Ico n₀ n, b k) * exp (∑ i ∈ Ico n₀ n, c i) := |
| 96 | + mul_le_mul_of_nonneg_left hprod_le_exp (add_nonneg hun₀ (sum_nonneg <| by grind)) |
| 97 | + |
| 98 | +/-- Discrete Grönwall inequality, uniform bound: a single bound holding for all `n ∈ [n₀, n₁)`. -/ |
| 99 | +theorem discrete_gronwall_Ico {n₀ n₁ : ℕ} (hun₀ : 0 ≤ u n₀) |
| 100 | + (hu : ∀ n ≥ n₀, u (n + 1) ≤ (1 + c n) * u n + b n) |
| 101 | + (hc : ∀ n ≥ n₀, 0 ≤ c n) (hb : ∀ n ≥ n₀, 0 ≤ b n) ⦃n : ℕ⦄ (hn : n ∈ Ico n₀ n₁) : |
| 102 | + u n ≤ (u n₀ + ∑ k ∈ Ico n₀ n₁, b k) * exp (∑ i ∈ Ico n₀ n₁, c i) := by |
| 103 | + have : 0 ≤ ∑ k ∈ Ico n₀ n₁, b k := sum_nonneg <| by grind |
| 104 | + exact (discrete_gronwall hun₀ hu hc hb (mem_Ico.mp hn).1).trans (by gcongr <;> grind) |
0 commit comments