Experimentation.Sequential
The anytime-valid inference substrate for adaptive / sequential experiments, where the treatment-assignment rule evolves with the accumulating data.
Ville 2 core · 2 supporting Ville's inequality gives time-uniform control for nonnegative test supermartingales. ★ IsTestSupermartingale★ ville_inequality
Ville inequality
Ville's inequality gives time-uniform control for nonnegative test supermartingales.
The predicate IsTestSupermartingale packages a nonnegative supermartingale with initial expected
wealth at most one. The theorem supermartingale_maximal_ineq proves the finite-horizon maximal
bound, ville_inequality passes to the event of ever crossing a positive level, and ville_test
specializes the result to the 1/α threshold used by anytime-valid tests.
Given a sample space, a σ-algebra on that space, a real-valued process indexed by nonnegative integer times, a filtration on that σ-algebra, and a measure on that measurable space, a test supermartingale is a supermartingale adapted to that filtration whose value is nonnegative at every time and sample point and whose expected initial value is at most one.
Definition (Lean source)
Ville's inequality (time-uniform maximal inequality). If M is a supermartingale adapted to the filtration ℱ under the finite measure μ, M is everywhere nonnegative, and the level λ is positive, then the probability that M ever reaches λ is at most E[M₀] / λ, the bound taken over the event of reaching the boundary at some finite time.
Formal statement
Proof (Lean source)
2 supporting declarations (lemmas, instances)
-
supermartingale_maximal_ineqtheorem — Finite-horizon supermartingale maximal inequality. For a nonnegative supermartingale M and level λ > 0, the probability that M reaches λ by time n is at most E[M₀] / λ.hypothesesconclusion≤ ofReal (μ[M 0] / lam)Proof (Lean source)
theorem supermartingale_maximal_ineq [IsFiniteMeasure μ] {M : ℕ → Ω → ℝ} (hM : Supermartingale M ℱ μ) (hnonneg : ∀ n, 0 ≤ M n) {lam : ℝ} (hlam : 0 < lam) (n : ℕ) : μ {ω | lam ≤ (range (n + 1)).sup' nonempty_range_add_one (fun k => M k ω)} ≤ ofReal (μ[M 0] / lam) := by classical let τ : Ω → ℕ∞ := fun ω => (hittingBtwn M {y : ℝ | lam ≤ y} (0 : ℕ) n ω : ℕ) let A : Set Ω := {ω | lam ≤ (range (n + 1)).sup' nonempty_range_add_one (fun k => M k ω)} have hAmeas : MeasurableSet A := by exact measurableSet_le measurable_const (Finset.measurable_range_sup'' fun k _ => (hM.1.stronglyMeasurable (i := k)).measurable) have hτstop : IsStoppingTime ℱ τ := by exact hM.stronglyAdapted.adapted.isStoppingTime_hittingBtwn measurableSet_Ici have hτbdd : ∀ ω, τ ω ≤ n := by intro ω simpa [τ] using (show (((hittingBtwn M {y : ℝ | lam ≤ y} (0 : ℕ) n ω : ℕ) : ℕ∞) ≤ (n : ℕ∞)) from by exact WithTop.coe_le_coe.2 (hittingBtwn_le (u := M) (s := {y : ℝ | lam ≤ y}) (n := (0 : ℕ)) (m := n) (ω := ω))) have hτint : Integrable (stoppedValue M τ) μ := integrable_stoppedValue ℕ hτstop hM.2.2 hτbdd have hhit : ∀ ω ∈ A, lam ≤ stoppedValue M τ ω := by intro ω hω simp_rw [A, Set.mem_setOf_eq, Finset.le_sup'_iff, Finset.mem_range, Nat.lt_succ_iff] at hω refine stoppedValue_hittingBtwn_mem ?_ simpa only [Set.mem_setOf_eq, Set.mem_Icc, zero_le, true_and] using hω have hsetLower : lam * (μ A).toReal ≤ ∫ ω in A, stoppedValue M τ ω ∂μ := setIntegral_ge_of_const_le_real hAmeas (measure_ne_top _ _) hhit hτint.integrableOn have hstopped_nonneg : 0 ≤ stoppedValue M τ := by intro ω exact hnonneg _ ω have hset_le_total : ∫ ω in A, stoppedValue M τ ω ∂μ ≤ μ[stoppedValue M τ] := by have hcompl_nonneg : 0 ≤ ∫ ω in Aᶜ, stoppedValue M τ ω ∂μ := setIntegral_nonneg hAmeas.compl fun ω _ => hstopped_nonneg ω have hadd := integral_add_compl hAmeas hτint linarith have hτ_le_M0 : μ[stoppedValue M τ] ≤ μ[M 0] := by have hneg : Submartingale (fun k ω => -M k ω) ℱ μ := hM.neg have hopt : μ[stoppedValue (fun k ω => -M k ω) (fun _ : Ω => ((0 : ℕ) : ℕ∞))] ≤ μ[stoppedValue (fun k ω => -M k ω) τ] := by refine hneg.expected_stoppedValue_mono (isStoppingTime_const ℱ 0) hτstop ?_ hτbdd intro ω simp [τ] have hleft : μ[stoppedValue (fun k ω => -M k ω) (fun _ : Ω => ((0 : ℕ) : ℕ∞))] = - μ[M 0] := by rw [show stoppedValue (fun k ω => -M k ω) (fun _ : Ω => ((0 : ℕ) : ℕ∞)) = fun ω => -M 0 ω by funext ω simp only [stoppedValue] rfl] exact integral_neg (M 0) have hright : μ[stoppedValue (fun k ω => -M k ω) τ] = - μ[stoppedValue M τ] := by rw [show stoppedValue (fun k ω => -M k ω) τ = fun ω => - stoppedValue M τ ω by funext ω simp [stoppedValue]] exact integral_neg (stoppedValue M τ) rw [hleft, hright] at hopt linarith have hmul : lam * (μ A).toReal ≤ μ[M 0] := hsetLower.trans (hset_le_total.trans hτ_le_M0) have hM0_nonneg : 0 ≤ μ[M 0] := integral_nonneg (hnonneg 0) have hdiv_nonneg : 0 ≤ μ[M 0] / lam := div_nonneg hM0_nonneg hlam.le change μ A ≤ ofReal (μ[M 0] / lam) rw [ENNReal.le_ofReal_iff_toReal_le (measure_ne_top _ _) hdiv_nonneg] exact (le_div_iff₀ hlam).2 (by simpa [mul_comm] using hmul) -
ville_testtheorem — Ville's inequality for a test supermartingale: the chance of ever reaching 1/α is at most α.hypothesesconclusionμ {ω | ∃ n, 1 / α ≤ M n ω} ≤ ofReal αProof (Lean source)
theorem ville_test [IsFiniteMeasure μ] {M : ℕ → Ω → ℝ} (hM : IsTestSupermartingale M ℱ μ) {α : ℝ} (hα : 0 < α) : μ {ω | ∃ n, 1 / α ≤ M n ω} ≤ ofReal α := by obtain ⟨hsuper, hnn, hM0⟩ := hM have hlam : (0 : ℝ) < 1 / α := by positivity refine le_trans (ville_inequality hsuper hnn hlam) ?_ apply ENNReal.ofReal_le_ofReal rw [div_div_eq_mul_div, div_one] calc μ[M 0] * α ≤ 1 * α := mul_le_mul_of_nonneg_right hM0 hα.le _ = α := one_mul α
AdaptiveDesign 3 core · 0 supporting Adaptive experiments use assignment probabilities that are predictable from the pre-assignment history: the time-zero propensity is initial-information measurable, and the time-t + 1 propensity is measurable from the inf ★ AdaptiveExperiment★ propensity_pos_of_overlap
Adaptive sequential designs
Adaptive experiments use assignment probabilities that are predictable from the pre-assignment
history: the time-zero propensity is initial-information measurable, and the time-t + 1
propensity is measurable from the information available at time t.
The structure AdaptiveExperiment packages the filtration and predictable propensity process,
while AdaptiveExperiment.HasOverlap records the positivity margin δ ≤ propensity t ω ≤ 1 - δ
needed for inverse-propensity weighting. The lemma propensity_pos_of_overlap extracts strict
positivity from that overlap condition.
An adaptive sequential experiment: a time-indexed information flow ℱ on the outcome space together with a propensity process propensity recording the treatment probability of the unit arriving at each time, subject to three conditions — the process is predictable: the time-0 propensity is measurable with respect to the initial information, and the time-(t+1) propensity depends only on the information available at time t, every propensity is nonnegative, and every propensity is at most one.
Definition (Lean source)
For a measurable outcome space, an adaptive experiment on that space, and a real number serving as an overlap margin, the overlap condition with that margin holds precisely when the margin is strictly positive and at every time and on every outcome history, the experiment's treatment probability lies between the margin and one minus the margin.
Definition (Lean source)
Under overlap with margin δ, every propensity is at least δ, hence strictly positive — so inverse-propensity weights are finite.
Formal statement
Proof (Lean source)
AnytimeValid 6 core · 0 supporting This file turns Ville's inequality for test supermartingales into reusable sequential-inference objects. ★ IsAnytimeValid★ isAnytimeValid_rejectionRegion★ IsConfidenceSequence★ isConfidenceSequence_confSeqOfWealth
Anytime-valid tests and confidence sequences
This file turns Ville's inequality for test supermartingales into reusable sequential-inference
objects. rejectionRegion is the event that wealth ever crosses 1/α, IsAnytimeValid states
level-α type-I error control, and isAnytimeValid_rejectionRegion proves that control from
Ville's inequality. The confidence-sequence side defines IsConfidenceSequence,
confSeqOfWealth, and isConfidenceSequence_confSeqOfWealth, the inverted coverage theorem.
For a sample space and a real-valued wealth process indexed by time and outcome, and a real-valued test level, the sequential-test rejection region is the event that the wealth reaches or exceeds at at least one time, with this quotient understood as zero when .
Definition (Lean source)
For a measurable sample space, an event on that space, a measure on the sample space, and a real-valued test level, the property of being anytime-valid at that level means that the measure of the event is at most .
Definition (Lean source)
Anytime-valid type-I error control. If the wealth process M is a test supermartingale for the filtration ℱ under μ and the level α is positive, then the event that M ever reaches 1/α has probability at most α.
Formal statement
Proof (Lean source)
For a measurable sample space, a time-indexed coverage predicate on that space, a measure on the sample space, and a real-valued level, the property of being a confidence sequence at that level means that the measure of outcomes on which coverage fails at at least one time is at most .
Definition (Lean source)
For a sample space and a real-valued wealth process indexed by time and outcome and a real-valued level, the wealth-inverted coverage predicate holds at a given time and outcome exactly when the wealth at that time is strictly less than , with this quotient understood as zero when .
Definition (Lean source)
Confidence-sequence coverage. If M is a test supermartingale for the filtration ℱ under μ and the level α is positive, then the cover obtained by requiring M's wealth to stay below 1/α fails at some time with probability at most α.