Documentation

Learning.SQOracle

The i.i.d.-ensemble SQ oracle: Hoeffding concentration + sample complexity #

The statistical-query oracle realised on an i.i.d. ensemble of trajectories, with the O(1/√n) query estimate. This file supplies the probabilistic core that SQBounds.truth_survives_pruning takes as the bare hypothesis hemp : |emp − predR| ≤ τ: it DERIVES, by Hoeffding, that the empirical SQ answer concentrates around the true answer, and threads that through to the "truth survives pruning" guarantee.

This is the quantitative complement to SQBounds.truth_survives_pruning: there the 2τ geometry is proved assuming the empirical answer is within τ of the truth's mean; here that very assumption is discharged with an explicit sample complexity n ≥ (2/τ²)·log(2/δ).

Status: PROVED as a probability statement over an i.i.d. ensemble. The single load-bearing import is Mathlib's Hoeffding inequality for sub-Gaussian MGFs (ProbabilityTheory.HasSubgaussianMGF.measure_sum_range_ge_le_of_iIndepFun together with hasSubgaussianMGF_of_mem_Icc).

What this DOES establish #

What this does NOT establish (stays in prose; no overclaiming) #

Hypotheses: standard vs added/strengthened #

noncomputable def SQOracle.empiricalMean {Ω : Type u_1} (Z : ℕ → Ω → ℝ) (n : ℕ) (ω : Ω) :

Empirical SQ answer: the mean of the query-values Z i ω = φ(Xᵢ ω) over the first n ensemble trajectories.

Equations
Instances For
    theorem SQOracle.sq_oracle_concentration {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure μ] (Z : ℕ → Ω → ℝ) (predZ : ℝ) (n : ℕ) (τ : ℝ) (hmeas : ∀ (i : ℕ), Measurable (Z i)) (hbdd : ∀ (i : ℕ) (ω : Ω), Z i ω ∈ Set.Icc (-1) 1) (hindep : ProbabilityTheory.iIndepFun Z μ) (hmean : ∀ (i : ℕ), ∫ (x : Ω), Z i x ∂μ = predZ) (hn : 1 ≤ n) (hτ : 0 ≤ τ) :
    μ.real {ω : Ω | τ ≤ |empiricalMean Z n ω - predZ|} ≤ 2 * Real.exp (-↑n * τ ^ 2 / 2)

    Hoeffding concentration of the SQ oracle. The empirical mean of n i.i.d. bounded query-values is within τ of the true answer predZ = 𝔼φ except with probability ≤ 2·exp(−nτ²/2).

    theorem SQOracle.sq_oracle_sample_complexity {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure μ] (Z : ℕ → Ω → ℝ) (predZ : ℝ) (n : ℕ) (τ δ : ℝ) (hmeas : ∀ (i : ℕ), Measurable (Z i)) (hbdd : ∀ (i : ℕ) (ω : Ω), Z i ω ∈ Set.Icc (-1) 1) (hindep : ProbabilityTheory.iIndepFun Z μ) (hmean : ∀ (i : ℕ), ∫ (x : Ω), Z i x ∂μ = predZ) (hn1 : 1 ≤ n) (hτ : 0 < τ) (hδ0 : 0 < δ) (_hδ1 : δ ≤ 1) (hn : 2 / τ ^ 2 * Real.log (2 / δ) ≤ ↑n) :
    1 - δ ≤ μ.real {ω : Ω | |empiricalMean Z n ω - predZ| < τ}

    Sample complexity of the SQ oracle. n ≥ (2/τ²)·log(2/δ) i.i.d. ensemble trajectories answer the SQ query to tolerance τ with probability ≥ 1−δ.

    theorem SQOracle.sq_oracle_truth_survives {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure μ] (Z : ℕ → Ω → ℝ) (predZ : ℝ) (n : ℕ) (τ δ : ℝ) (hmeas : ∀ (i : ℕ), Measurable (Z i)) (hbdd : ∀ (i : ℕ) (ω : Ω), Z i ω ∈ Set.Icc (-1) 1) (hindep : ProbabilityTheory.iIndepFun Z μ) (hmean : ∀ (i : ℕ), ∫ (x : Ω), Z i x ∂μ = predZ) (hn1 : 1 ≤ n) (hτ : 0 < τ) (hδ0 : 0 < δ) (hδ1 : δ ≤ 1) (hn : 2 / τ ^ 2 * Real.log (2 / δ) ≤ ↑n) :
    1 - δ ≤ μ.real {ω : Ω | |predZ - empiricalMean Z n ω| ≤ 2 * τ}

    Pruning wiring: the SQ oracle discharges SQBounds.truth_survives_pruning's hypothesis. With n ≥ (2/τ²)·log(2/δ) ensemble trajectories, with probability ≥ 1−δ the truth's predicted statistic predZ is within 2τ of the empirical answer — i.e. it is never pruned by the 2τ-rule.

    The W-attack: window-noise budget 2η ≤ τ #

    The window-sufficiency assumption (W) — "the window determines the next observation under R" — is the determinism of the one-step predictor f_R; it weakens gracefully to the window-noise rate η := μ(o_{t+1} ≠ f_R(w_t)) (the Bayes error of the window predictor under the invariant measure; W is η = 0). noise_gap_integral is the genuine content — a [−1,1]-valued query answer is distorted by at most 2η — and sq_oracle_truth_survives_noisy threads it, with the arithmetic siblings in SQBounds, into the pruning guarantee: the deterministic truth survives the unchanged 2τ-pruning rule with probability ≥ 1−δ exactly when the window-noise budget 2η ≤ τ holds.

    theorem SQOracle.noise_gap_integral {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure μ] (f g : Ω → ℝ) (E : Set Ω) (hf : ∀ (ω : Ω), f ω ∈ Set.Icc (-1) 1) (hg : ∀ (ω : Ω), g ω ∈ Set.Icc (-1) 1) (hfm : Measurable f) (hgm : Measurable g) (hE : MeasurableSet E) (hagree : ∀ ω ∉ E, f ω = g ω) :
    |∫ (ω : Ω), f ω ∂μ - ∫ (ω : Ω), g ω ∂μ| ≤ 2 * μ.real E

    A1 — the window-noise integral gap. Two [−1,1]-valued measurable observables f, g that agree off a measurable event E have integrals differing by at most 2·μ(E). Applied to a [−1,1]-valued SQ query answer, the realized-next-observation value φ(w, o_next) and the deterministic-prediction value φ(w, f_R(w)) agree off the window-noise event E = {o_next ≠ f_R(w)} of mass η := μ(E), so the query answer is distorted by at most 2η. Boundedness on the probability measure discharges integrability; the majorant is the indicator 2·𝟙_E.

    theorem SQOracle.sq_oracle_truth_survives_noisy {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure μ] (Z : ℕ → Ω → ℝ) (predR a : ℝ) (n : ℕ) (τ δ η : ℝ) (hmeas : ∀ (i : ℕ), Measurable (Z i)) (hbdd : ∀ (i : ℕ) (ω : Ω), Z i ω ∈ Set.Icc (-1) 1) (hindep : ProbabilityTheory.iIndepFun Z μ) (hmean : ∀ (i : ℕ), ∫ (x : Ω), Z i x ∂μ = a) (hn1 : 1 ≤ n) (hτ : 0 < τ) (hδ0 : 0 < δ) (hδ1 : δ ≤ 1) (hn : 2 / τ ^ 2 * Real.log (2 / δ) ≤ ↑n) (hη : 0 ≤ η) (hbudget : 2 * η ≤ τ) (hnoise : |a - predR| ≤ 2 * η) :
    1 - δ ≤ μ.real {ω : Ω | |predR - empiricalMean Z n ω| ≤ 2 * τ}

    A3 — pruning wiring under window noise: the SQ oracle survives a 2η ≤ τ budget. Mirror of sq_oracle_truth_survives that keeps the empirical mean's target a = 𝔼φ (the joint window/next-observation answer, on which the time-average concentrates) distinct from the deterministic-prediction truth predR: the two differ by the window-noise gap |a − predR| ≤ 2η (bounded by noise_gap_integral at the call site). With n ≥ (2/τ²)·log(2/δ) ensemble trajectories and window-noise budget 2η ≤ τ, the truth's predicted statistic predR lies within 2τ of the empirical answer with probability ≥ 1−δ — so the 2τ-pruning rule never discards it. At η = 0 (so a = predR) this is exactly sq_oracle_truth_survives.

    Union-bound glue #

    The finite-query union bound that carries the per-query concentration of sq_oracle_concentration to the genuine oracle object SQObjects.IsSQOracle: given a Finset of queries Qs, empirical answers emp : Q → Ω → ℝ, truth tru : Q → ℝ, and a per-query tail bound (the shape of sq_oracle_concentration's conclusion), the empirical answers restricted to Qs satisfy the oracle predicate off an event of measure ≤ |Qs|·δ.

    theorem SQOracle.sq_oracle_uniform_tail {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} {Q : Type u_2} (Qs : Finset Q) (emp : Q → Ω → ℝ) (tru : Q → ℝ) (τ δ : ℝ) (htail : ∀ φ ∈ Qs, μ {ω : Ω | τ < |emp φ ω - tru φ|} ≤ ENNReal.ofReal δ) :
    μ {ω : Ω | ∃ φ ∈ Qs, τ < |emp φ ω - tru φ|} ≤ ↑Qs.card * ENNReal.ofReal δ

    Finite-query union bound. If each query φ ∈ Qs fails the tolerance τ with probability ≤ δ, then SOME query in Qs fails with probability ≤ |Qs|·δ — the union bound over the finite query set (measure_biUnion_finset_le).

    theorem SQOracle.empirical_isSQOracle {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} {Q : Type u_2} (Qs : Finset Q) (emp : Q → Ω → ℝ) (tru : Q → ℝ) (τ δ : ℝ) (htail : ∀ φ ∈ Qs, μ {ω : Ω | τ < |emp φ ω - tru φ|} ≤ ENNReal.ofReal δ) :
    μ {ω : Ω | SQObjects.IsSQOracle (fun (φ : ↥Qs) => emp (↑φ) ω) (fun (φ : ↥Qs) => tru ↑φ) τ}ᶜ ≤ ↑Qs.card * ENNReal.ofReal δ

    Oracle-object glue. Off an event of measure ≤ |Qs|·δ — i.e. with probability ≥ 1 − |Qs|·δ — the empirical answers restricted to Qs satisfy the genuine oracle predicate SQObjects.IsSQOracle (over the subtype ↥Qs). The complement of the good event is exactly the "some query fails" event of sq_oracle_uniform_tail.

    theorem SQOracle.empirical_isSQOracle_of_iid {Ω : Type u_1} [MeasurableSpace Ω] {μ : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure μ] {Q : Type u_2} (Qs : Finset Q) (hQs : Qs.Nonempty) (Zq : Q → ℕ → Ω → ℝ) (tru : Q → ℝ) (τ δ : ℝ) (n : ℕ) (hmeas : ∀ φ ∈ Qs, ∀ (i : ℕ), Measurable (Zq φ i)) (hbdd : ∀ φ ∈ Qs, ∀ (i : ℕ) (ω : Ω), Zq φ i ω ∈ Set.Icc (-1) 1) (hindep : ∀ φ ∈ Qs, ProbabilityTheory.iIndepFun (Zq φ) μ) (hmean : ∀ φ ∈ Qs, ∀ (i : ℕ), ∫ (x : Ω), Zq φ i x ∂μ = tru φ) (hn1 : 1 ≤ n) (hτ : 0 < τ) (hδ0 : 0 < δ) (hn : 2 / τ ^ 2 * Real.log (2 * ↑Qs.card / δ) ≤ ↑n) :
    μ {ω : Ω | SQObjects.IsSQOracle (fun (φ : ↥Qs) => empiricalMean (Zq ↑φ) n ω) (fun (φ : ↥Qs) => tru ↑φ) τ}ᶜ ≤ ENNReal.ofReal δ

    Per-query i.i.d. instantiation. A query-indexed i.i.d. family Zq : Q → ℕ → Ω → ℝ — each query's values i.i.d. in [−1,1] with mean tru φ, per sq_oracle_concentration's hypotheses — DISCHARGES sq_oracle_uniform_tail's per-query tail with δ_φ = 2·exp(−nτ²/2), giving the end-to-end bound: with n ≥ (2/τ²)·log(2·|Qs|/δ) samples per query, the empirical answers fail SQObjects.IsSQOracle on ↥Qs with probability ≤ δ.