Skip to content

Commit fd2720b

Browse files
authored
Merge sharp McDiarmid from dev (PR #5)
Merge sharp McDiarmid from dev (verified, additive)
2 parents 9ed2f72 + 9e07967 commit fd2720b

7 files changed

Lines changed: 677 additions & 27 deletions

File tree

FormalSLT.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import FormalSLT.Concentration.SubGamma.CondJensen
1919
import FormalSLT.Concentration.SubGamma.CondMarkov
2020
import FormalSLT.Concentration.SubGamma.CondVarianceFromSquare
2121
import FormalSLT.Concentration.SubGamma.Extractor
22+
import FormalSLT.Concentration.SharpMcDiarmid
2223

2324
import FormalSLT.Rademacher.FiniteSample
2425
import FormalSLT.Rademacher.FiniteSampleSymmetrization

FormalSLT/Azuma/BoundedIncrementBound.lean

Lines changed: 152 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ Azuma-Hoeffding consumer expected by mathlib's
1515
1616
## Contents (all closed; no `sorry`, no `admit`, no custom `axiom`)
1717
18-
* `exposureMartingale_eq_partialIntegral_ae` bridge identity:
18+
* `exposureMartingale_eq_partialIntegral_ae` bridge identity:
1919
`M_k =ᵐ partialIntegral μ k f`. Direct corollary of
2020
`partialIntegral_eq_condExp_ae`.
21-
* `exposureIncrement_eq_partialIntegral_diff_ae` increment
21+
* `exposureIncrement_eq_partialIntegral_diff_ae` increment
2222
representation: `D_k =ᵐ partialIntegral_{k.succ} - partialIntegral_{k.castSucc}`.
23-
* `splice_succ_eq_update_castSucc` pointwise structural identity:
23+
* `splice_succ_eq_update_castSucc` pointwise structural identity:
2424
`splice k.succ S T = Function.update (splice k.castSucc S T) k (S k)`.
2525
The single-coordinate "reveal" step.
26-
* `abs_partialIntegral_step_le` the bounded-increment range bound:
26+
* `abs_partialIntegral_step_le` the bounded-increment range bound:
2727
for `f : (Fin n → Z) → ℝ` with `HasBoundedDifferences f c`,
2828
`|partialIntegral μ k.succ f S - partialIntegral μ k.castSucc f S| ≤ c k`
2929
pointwise. The analytic input that the conditional Hoeffding lemma
@@ -41,8 +41,8 @@ Azuma-Hoeffding consumer expected by mathlib's
4141
* Filtration index adapter `Fin (n+1) → ℕ` so mathlib's
4242
`Filtration ℕ`-indexed Azuma-Hoeffding can apply.
4343
* McDiarmid concentration / `genGap` specialization (Stage B3).
44-
* High-probability Rademacher generalization bound (Stage C, the initial
45-
public theorem in this lane).
44+
* High-probability Rademacher generalization bound (Stage C, the first
45+
public flagship).
4646
4747
## Constraints respected
4848
@@ -148,6 +148,32 @@ private lemma abs_integrand_diff_le
148148
rw [abs_sub_comm]
149149
exact hbdd (splice k.castSucc S T) k (S k)
150150

151+
/-- If two prefixes agree before coordinate `k`, then the two `k.succ`
152+
spliced integrands differ by at most the bounded-differences width `c k`.
153+
154+
This is the pointwise integrand-level form of the range-width argument
155+
needed for the sharp McDiarmid constant: after conditioning on the prefix
156+
before `k`, changing the free coordinate `k` can move the integrand by at
157+
most `c k`. -/
158+
private lemma abs_integrand_succ_sub_succ_le_of_agree_prefix
159+
{f : (Fin n → Z) → ℝ} {c : Fin n → ℝ}
160+
(hbdd : HasBoundedDifferences f c)
161+
(S S' : Fin n → Z) (k : Fin n) (T : Fin n → Z)
162+
(hprefix : ∀ i : Fin n, (i : ℕ) < (k : ℕ) → S i = S' i) :
163+
|f (splice k.succ S T) - f (splice k.succ S' T)| ≤ c k := by
164+
refine FormalSLT.Azuma.BoundedDifferences.HasBoundedDifferences.sub_le_of_agree_off
165+
hbdd ?_
166+
intro i hi_ne
167+
unfold splice
168+
by_cases hi_succ : (i : ℕ) < (k.succ : ℕ)
169+
· have hi_lt_k : (i : ℕ) < (k : ℕ) := by
170+
rw [Fin.val_succ] at hi_succ
171+
have hne_val : (i : ℕ) ≠ (k : ℕ) := fun h => hi_ne (Fin.ext h)
172+
omega
173+
rw [if_pos hi_succ, if_pos hi_succ]
174+
exact hprefix i hi_lt_k
175+
· rw [if_neg hi_succ, if_neg hi_succ]
176+
151177
/-! Measurability helper for the integrand at fixed `S`.
152178
153179
`T ↦ f(splice k S T)` is strongly measurable as a composition of
@@ -296,4 +322,124 @@ theorem abs_partialIntegral_step_le
296322
rw [abs_zero]
297323
exact hck
298324

325+
/-! ### Pointwise range-width form for the explicit increments
326+
327+
The previous theorem gives a symmetric absolute bound
328+
`|P_{k+1}(S) - P_k(S)| ≤ c k`. For the sharp McDiarmid constant, the
329+
needed geometry is stronger: once the prefix before `k` is fixed, the
330+
explicit increment `P_{k+1} - P_k` has range width at most `c k` as the
331+
`k`th coordinate varies. The following two lemmas isolate that pointwise
332+
partial-integral statement before any conditional-kernel lift. -/
333+
334+
/-- If two samples agree on the prefix before `k`, then their `k.succ`
335+
partial integrals differ by at most the coordinate width `c k`. -/
336+
theorem abs_partialIntegral_succ_sub_succ_le_of_agree_prefix
337+
[IsProbabilityMeasure μ]
338+
{f : (Fin n → Z) → ℝ} {c : Fin n → ℝ}
339+
(hbdd : HasBoundedDifferences f c)
340+
(hf : StronglyMeasurable f)
341+
(k : Fin n) (hck : 0 ≤ c k) (S S' : Fin n → Z)
342+
(hprefix : ∀ i : Fin n, (i : ℕ) < (k : ℕ) → S i = S' i) :
343+
|partialIntegral μ k.succ f S - partialIntegral μ k.succ f S'| ≤ c k := by
344+
set μn : Measure (Fin n → Z) := Measure.pi (fun _ : Fin n => μ) with hμn
345+
by_cases hint :
346+
Integrable (fun T => f (splice k.succ S T)) μn
347+
· have hint' : Integrable (fun T => f (splice k.succ S' T)) μn := by
348+
have h_meas : StronglyMeasurable (fun T => f (splice k.succ S' T)) :=
349+
stronglyMeasurable_splice_partial k.succ hf S'
350+
have hint_norm : Integrable (fun T => ‖f (splice k.succ S T)‖) μn :=
351+
hint.norm
352+
have hint_g : Integrable (fun T => ‖f (splice k.succ S T)‖ + c k) μn :=
353+
hint_norm.add (integrable_const (c k))
354+
refine hint_g.mono' h_meas.aestronglyMeasurable ?_
355+
refine Filter.Eventually.of_forall (fun T => ?_)
356+
have h_diff :
357+
|f (splice k.succ S' T) - f (splice k.succ S T)| ≤ c k := by
358+
rw [abs_sub_comm]
359+
exact abs_integrand_succ_sub_succ_le_of_agree_prefix hbdd S S' k T hprefix
360+
have h_tri : |f (splice k.succ S' T)|
361+
≤ |f (splice k.succ S' T) - f (splice k.succ S T)|
362+
+ |f (splice k.succ S T)| := by
363+
have h_id : f (splice k.succ S' T) - f (splice k.succ S T)
364+
+ f (splice k.succ S T) = f (splice k.succ S' T) := by ring
365+
calc |f (splice k.succ S' T)|
366+
= |(f (splice k.succ S' T) - f (splice k.succ S T))
367+
+ f (splice k.succ S T)| := by rw [h_id]
368+
_ ≤ |f (splice k.succ S' T) - f (splice k.succ S T)|
369+
+ |f (splice k.succ S T)| := abs_add_le _ _
370+
show ‖f (splice k.succ S' T)‖ ≤ ‖f (splice k.succ S T)‖ + c k
371+
rw [Real.norm_eq_abs, Real.norm_eq_abs]
372+
linarith
373+
unfold partialIntegral
374+
rw [show
375+
∫ T, f (splice k.succ S T) ∂μn
376+
- ∫ T, f (splice k.succ S' T) ∂μn
377+
= ∫ T, (f (splice k.succ S T) - f (splice k.succ S' T)) ∂μn from
378+
(integral_sub hint hint').symm]
379+
refine (abs_integral_le_integral_abs).trans ?_
380+
have h_pointwise : ∀ T,
381+
|f (splice k.succ S T) - f (splice k.succ S' T)| ≤ c k :=
382+
fun T => abs_integrand_succ_sub_succ_le_of_agree_prefix hbdd S S' k T hprefix
383+
have h_const : ∫ _T : Fin n → Z, c k ∂μn = c k := by
384+
rw [integral_const]
385+
simp
386+
rw [← h_const]
387+
refine integral_mono_ae ?_ (integrable_const (c k)) ?_
388+
· exact (hint.sub hint').abs
389+
· exact Filter.Eventually.of_forall h_pointwise
390+
· have hint'_neg : ¬ Integrable (fun T => f (splice k.succ S' T)) μn := by
391+
intro hint'
392+
apply hint
393+
have h_meas : StronglyMeasurable (fun T => f (splice k.succ S T)) :=
394+
stronglyMeasurable_splice_partial k.succ hf S
395+
have hint_norm : Integrable (fun T => ‖f (splice k.succ S' T)‖) μn :=
396+
hint'.norm
397+
have hint_g : Integrable (fun T => ‖f (splice k.succ S' T)‖ + c k) μn :=
398+
hint_norm.add (integrable_const (c k))
399+
refine hint_g.mono' h_meas.aestronglyMeasurable ?_
400+
refine Filter.Eventually.of_forall (fun T => ?_)
401+
have h_diff :
402+
|f (splice k.succ S T) - f (splice k.succ S' T)| ≤ c k :=
403+
abs_integrand_succ_sub_succ_le_of_agree_prefix hbdd S S' k T hprefix
404+
have h_tri : |f (splice k.succ S T)|
405+
≤ |f (splice k.succ S T) - f (splice k.succ S' T)|
406+
+ |f (splice k.succ S' T)| := by
407+
have h_id : f (splice k.succ S T) - f (splice k.succ S' T)
408+
+ f (splice k.succ S' T) = f (splice k.succ S T) := by ring
409+
calc |f (splice k.succ S T)|
410+
= |(f (splice k.succ S T) - f (splice k.succ S' T))
411+
+ f (splice k.succ S' T)| := by rw [h_id]
412+
_ ≤ |f (splice k.succ S T) - f (splice k.succ S' T)|
413+
+ |f (splice k.succ S' T)| := abs_add_le _ _
414+
show ‖f (splice k.succ S T)‖ ≤ ‖f (splice k.succ S' T)‖ + c k
415+
rw [Real.norm_eq_abs, Real.norm_eq_abs]
416+
linarith
417+
unfold partialIntegral
418+
rw [integral_undef hint, integral_undef hint'_neg, sub_zero]
419+
rw [abs_zero]
420+
exact hck
421+
422+
/-- Pointwise range-width form for the explicit partial-integral
423+
increment `P_{k+1} - P_k`: fixing the prefix before `k`, the increment's
424+
range as the `k`th coordinate varies has width at most `c k`. -/
425+
theorem abs_partialIntegral_step_sub_step_le_of_agree_prefix
426+
[IsProbabilityMeasure μ]
427+
{f : (Fin n → Z) → ℝ} {c : Fin n → ℝ}
428+
(hbdd : HasBoundedDifferences f c)
429+
(hf : StronglyMeasurable f)
430+
(k : Fin n) (hck : 0 ≤ c k) (S S' : Fin n → Z)
431+
(hprefix : ∀ i : Fin n, (i : ℕ) < (k : ℕ) → S i = S' i) :
432+
|(partialIntegral μ k.succ f S - partialIntegral μ k.castSucc f S)
433+
- (partialIntegral μ k.succ f S' - partialIntegral μ k.castSucc f S')|
434+
≤ c k := by
435+
have h_cast :
436+
partialIntegral μ k.castSucc f S = partialIntegral μ k.castSucc f S' :=
437+
partialIntegral_eq_of_agree_prefix (μ := μ) k.castSucc f S S' hprefix
438+
have h_succ :=
439+
abs_partialIntegral_succ_sub_succ_le_of_agree_prefix (μ := μ)
440+
hbdd hf k hck S S' hprefix
441+
convert h_succ using 1
442+
rw [h_cast]
443+
ring_nf
444+
299445
end FormalSLT.Azuma.ExposureMartingale

0 commit comments

Comments
 (0)