This journal is in preparation. Submissions are open as a pilot and the editorial board is being formed. Articles marked Demonstration show the format only.
Journal of Machine-Verified MathematicsPeer-reviewed mathematics with machine-checked proofs, for the age of AI

E424/Tools/T7Aux3.lean

All files · 71 lines · source at the verified commit

1module
2
3public import E424.Tools.T7Aux2
4
5@[expose] public section
6
7/-!
8# Erdős 424: helpers for tool T7 (mean value estimates).
9-/
10
11set_option linter.style.header false
12
13namespace E424
14
15open Finset
16
17/-- Mean value theorem for a function with derivative on `[x, x+1] ⊆ [a, b]`. -/
18lemma mvt_unit {a b : ℝ} {f f' : ℝ → ℝ} (hf : ∀ x ∈ Set.Icc a b, HasDerivAt f (f' x) x)
19 {x : ℝ} (hx : a ≤ x) (hx1 : x + 1 ≤ b) : ∃ ξ ∈ Set.Ioo x (x + 1), f' ξ = f (x + 1) - f x := by
20 have hc : ContinuousOn f (Set.Icc x (x + 1)) := fun t ht =>
21 (hf t ⟨by linarith [ht.1], by linarith [ht.2]⟩).continuousAt.continuousWithinAt
22 obtain ⟨ξ, hξ, h⟩ := exists_hasDerivAt_eq_slope f f' (by linarith : x < x + 1) hc
23 (fun t ht => hf t ⟨by linarith [ht.1], by linarith [ht.2]⟩)
24 exact ⟨ξ, hξ, by rw [h]; simp⟩
25
26/-- Increments `D n = φ(n+1) - φ n` of a function with `λ ≤ φ'' ≤ hλ`. -/
27lemma incr_bounds {a b lam h : ℝ} {φ φ' φ'' : ℝ → ℝ} (hlam : 0 < lam)
28 (hφ : ∀ x ∈ Set.Icc a b, HasDerivAt φ (φ' x) x ∧ HasDerivAt φ' (φ'' x) x ∧
29 lam ≤ φ'' x ∧ φ'' x ≤ h * lam)
30 {n n' : ℕ} (hnn : n ≤ n') (han : a ≤ n) (hnb : (n' : ℝ) + 1 ≤ b) :
31 (φ (n + 1) - φ n ≤ φ (n' + 1) - φ n') ∧
32 lam * ((n' : ℝ) - n - 1) ≤ (φ (n' + 1) - φ n') - (φ (n + 1) - φ n) ∧
33 (φ (n' + 1) - φ n') - (φ (n + 1) - φ n) ≤ h * lam * ((n' : ℝ) - n + 1) := by
34 have hnn' : (n : ℝ) ≤ n' := by exact_mod_cast hnn
35 have hh : 0 ≤ h * lam - lam := by
36 have := (hφ n ⟨han, by linarith⟩).2.2
37 linarith [this.1, this.2]
38 rcases hnn.eq_or_lt with rfl | hlt
39 · simp only [sub_self, zero_add, le_refl, true_and]
40 refine ⟨by nlinarith, by nlinarith⟩
41 have hlt' : (n : ℝ) + 1 ≤ n' := by exact_mod_cast hlt
42 obtain ⟨ξ, hξ, hξe⟩ := mvt_unit (fun x hx => (hφ x hx).1) han (by linarith : (n : ℝ) + 1 ≤ b)
43 obtain ⟨ξ', hξ', hξe'⟩ := mvt_unit (fun x hx => (hφ x hx).1) (by linarith : a ≤ (n' : ℝ)) hnb
44 have hord : ξ < ξ' := by linarith [hξ.2, hξ'.1]
45 have hc : ContinuousOn φ' (Set.Icc ξ ξ') := fun t ht =>
46 (hφ t ⟨by linarith [ht.1, hξ.1], by linarith [ht.2, hξ'.2]⟩).2.1.continuousAt.continuousWithinAt
47 obtain ⟨η, hη, hηe⟩ := exists_hasDerivAt_eq_slope φ' φ'' hord hc
48 (fun t ht => (hφ t ⟨by linarith [ht.1, hξ.1], by linarith [ht.2, hξ'.2]⟩).2.1)
49 have hηb := (hφ η ⟨by linarith [hη.1, hξ.1], by linarith [hη.2, hξ'.2]⟩).2.2
50 have hd : φ' ξ' - φ' ξ = φ'' η * (ξ' - ξ) := by
51 rw [hηe, div_mul_cancel₀ _ (by linarith : ξ' - ξ ≠ 0)]
52 have hpos : 0 < ξ' - ξ := by linarith
53 have hD : (φ (n' + 1) - φ n') - (φ (n + 1) - φ n) = φ'' η * (ξ' - ξ) := by
54 rw [← hξe, ← hξe', hd]
55 rw [hD]
56 refine ⟨?_, ?_, ?_⟩
57 · have : 0 ≤ φ'' η * (ξ' - ξ) := mul_nonneg (by linarith [hηb.1]) hpos.le
58 linarith [hD]
59 · nlinarith [hηb.1, hξ.2, hξ'.1]
60 · nlinarith [hηb.2, hξ.1, hξ'.2]
61
62/-- Unit increments of `G` are bounded by `G1`. -/
63lemma unit_incr_le {a b G1 : ℝ} {G G' : ℝ → ℝ}
64 (hG : ∀ x ∈ Set.Icc a b, HasDerivAt G (G' x) x ∧ |G' x| ≤ G1)
65 {x : ℝ} (hx : a ≤ x) (hx1 : x + 1 ≤ b) : |G (x + 1) - G x| ≤ G1 := by
66 obtain ⟨ξ, hξ, h⟩ := mvt_unit (fun x hx => (hG x hx).1) hx hx1
67 rw [← h]
68 exact (hG ξ ⟨by linarith [hξ.1], by linarith [hξ.2]⟩).2
69
70end E424
71