Documentation

ReflectiveSubsystems.WitnessMixture

The floored mixture on the witness's own trajectory ([Inevitability] §6) #

This module claims the assembly only. Both halves already exist and neither is re-proved here: the agnostic event bound for the floored mixture is ReflectiveSubsystems/FlooredMixture.lean's (floorErrorTimes_card_mul_le_missCount, where the Littlestone–Warmuth attribution lives), and the noisy window chain with its recursion is ReflectiveSubsystems/NoisyWindowChain.lean's, embedded as a substrate in ReflectiveSubsystems/LearningWitness.lean. What is new is that the two meet at the miss indicator.

The meeting point #

The learning witness runs the k single-literal predictors over a length-k window: candidate i reads window coordinate i — windowAt k ξ t i = obs k ξ (t + i) — and predicts the complement of what it reads, singleLiteral i w = !(w i); the symbol it is predicting is the one just past the window, obs k ξ (t + k). Candidate 0 is the chain's own rule. The chain's recursion obs_add says o_{t+k} = ¬o_t ⊕ ξ_{t+k}, so candidate 0's prediction ¬o_t differs from the realized symbol exactly when the noise bit fires: witMiss_zero is that identity, and missCount_witMiss_zero promotes it to an equality of counts — the true rule's miss count is the noise count, not merely bounded by it.

The floored mixture riding that trajectory therefore inherits its error budget with the noise priced in. witness_floorErrorTimes_card_mul_le is the pathwise capstone: for every noise stream, under the budget gate alone, card · θ ≤ 4(k−1) + 2k · noiseCount. No probability enters it. witness_integral_floorErrorTimes_le then averages it under the witness's own Bernoulli(η) noise law, giving 4(k−1) + 2kηn.

The reading [Inevitability] §6 takes from this is that on the learning branch the damage budget is a rate — slope 2kη/θ in the run length — where the emergence branch's, holding a candidate that never misses, stays lifetime-free. The rate is not slack: the miss-count term's coefficient is bracketed from below by the sharpness families of FlooredMixture, and the true rule really does miss at the noise rate.

Main results #

Scope #

This is a process-level composition: the mixture reads the observation stream, and the noise is law-level external randomness. No skew-product embedding of the noisy base is attempted, and the mixing base with its invariant measure stays unformalized — [Inevitability] §8's recorded boundary. The bound's miss-count coefficient is the 2C that FlooredMixture proves, not the [θ, 2θ] its sharpness pair brackets; that gap is inherited, not opened here.

The drift-bound composition carries its own boundary. Its co-leadership hypothesis is not something the noise stream supplies at a general restart point — witness_singleNoiseBit_not_coleader fixes an instance where it fails — and it is discharged for free only at the run's own start.

The miss indicator and the noise count #

How often the noise bit driving the step into time t + k has fired, over the first n steps. This is the witness's noise stream read at the chain's own offset.

Equations
Instances For
    def ReflectiveSubsystems.witMiss (k : ℕ) (ξ : ℕ → Bool) :
    ℕ → Fin k → Bool

    The witness's miss indicator, pathwise in the noise stream: candidate i predicts the complement of window coordinate i — the window at time t being obs k ξ (t + ·) — and the symbol it is predicting is obs k ξ (t + k), the one just past the window.

    Equations
    Instances For
      theorem ReflectiveSubsystems.witMiss_eq_not_xor (k : ℕ) (ξ : ℕ → Bool) (t : ℕ) (i : Fin k) :
      witMiss k ξ t i = !(obs k ξ (t + ↑i) ^^ obs k ξ (t + k))

      The miss indicator's normal form: a candidate misses exactly when its window coordinate and the realized symbol agree — its prediction being that coordinate's complement.

      theorem ReflectiveSubsystems.witMiss_zero {k : ℕ} [NeZero k] (ξ : ℕ → Bool) (t : ℕ) :
      witMiss k ξ t 0 = ξ (t + k)

      The identity the assembly turns on. Candidate 0 is the chain's own rule, and its miss at time t is the noise bit written into the step it is predicting.

      One unfolding of the chain's recursion obs_add: the realized symbol is ¬o_t ⊕ ξ_{t+k} and the prediction is ¬o_t, so the two differ precisely when ξ_{t+k} fires.

      theorem ReflectiveSubsystems.missCount_witMiss_zero {k : ℕ} [NeZero k] (ξ : ℕ → Bool) (n : ℕ) :
      missCount (witMiss k ξ) 0 n = noiseCount ξ k n

      The count form. The true rule's miss count over the first n steps is the noise count — an equality, not a bound, which is what lets the tracking bound be read as a noise rate.

      The pathwise capstone #

      theorem ReflectiveSubsystems.witness_floorErrorTimes_card_mul_le {k : ℕ} [NeZero k] (ξ : ℕ → Bool) (b : ℕ) (θ : ℚ) (hbudget : 2 * (↑k - 1) ≤ θ * 2 ^ b) (n : ℕ) :
      ↑(floorErrorTimes (witMiss k ξ) b θ n).card * θ ≤ 4 * (↑k - 1) + 2 * ↑k * ↑(noiseCount ξ k n)

      The floored mixture on the witness's own trajectory, pathwise.

      FlooredMixture.floorErrorTimes_card_mul_le_missCount read at C = k, i₀ = 0, with missCount_witMiss_zero rewriting the reference candidate's miss count into the noise count. For every noise stream, under the budget gate alone, the mixture's error times are bounded by a lifetime-free anchor 4(k−1) plus 2k per noise bit.

      No probability enters: this is a statement about each trajectory separately, and the noise stream is an arbitrary function. What the composition buys [Inevitability] §6 is that the hypothesis the unbounded-run guarantee needs is one the noisy witness supplies — its true rule's misses are counted rather than forbidden — where realizability was one it refuted.

      Non-vacuity: when the tracking bound beats the trivial one #

      The pathwise capstone bounds the error count by (4(k−1) + 2k·noiseCount)/θ, but every count over a horizon n is already at most n; the bound says something only where its own right-hand side, divided by θ, falls strictly below n. [Inevitability] §6 reads that boundary as η < θ/(2k): the guard below states the strict side, the statement after it the failing side, so the hypothesis is shown load-bearing rather than decorative.

      theorem ReflectiveSubsystems.witness_floorErrorTimes_card_lt {k : ℕ} [NeZero k] (ξ : ℕ → Bool) (b : ℕ) (θ : ℚ) (hθ : 0 < θ) (hbudget : 2 * (↑k - 1) ≤ θ * 2 ^ b) (n : ℕ) (hgap : 4 * (↑k - 1) + 2 * ↑k * ↑(noiseCount ξ k n) < θ * ↑n) :
      (floorErrorTimes (witMiss k ξ) b θ n).card < n

      The guard: a strict gap between the pathwise bound and θ·n forces the error count strictly below the horizon — the tracking bound beats the trivial card ≤ n bound outright.

      theorem ReflectiveSubsystems.witness_floorErrorTimes_bound_ge_n_of_le {k : ℕ} (ξ : ℕ → Bool) (θ : ℚ) (hθ : 0 < θ) (n : ℕ) (hgap : θ * ↑n ≤ 4 * (↑k - 1) + 2 * ↑k * ↑(noiseCount ξ k n)) :
      ↑n ≤ (4 * (↑k - 1) + 2 * ↑k * ↑(noiseCount ξ k n)) / θ

      The complementary vacuity. Below the gate — θ·n ≤ 4(k−1) + 2k·noiseCount — the bound's own right-hand side, divided by θ, is at least the horizon n: it permits every step to be a error time, exactly what the trivial card ≤ n bound already says, so witness_floorErrorTimes_card_lt's hypothesis is reachable and its failure is not vacuous either. Arithmetic only, on the numbers θ, n and noiseCount, no system involved.

      theorem ReflectiveSubsystems.witness_floorErrorTimes_card_lt_of_rate {k : ℕ} [NeZero k] (ξ : ℕ → Bool) (b : ℕ) (θ : ℚ) (hθ : 0 < θ) (hbudget : 2 * (↑k - 1) ≤ θ * 2 ^ b) (n : ℕ) (hgap : 2 * ↑k * ↑(noiseCount ξ k n) < θ * ↑n - 4 * (↑k - 1)) :
      (floorErrorTimes (witMiss k ξ) b θ n).card < n

      The rate form. Since the noise count never exceeds the horizon, the guard already fires once noiseCount's own coefficient clears the gap — the "slope 2kη/θ below one" reading [Inevitability] §6 states the bound in.

      The drift bound on the witness's own trajectory ([Inevitability] §7) #

      FlooredMixture.toDist_wRun_sub_bayesFrom_le compares the floored run not with exact Bayes from the beginning but with exact Bayes restarted at a running co-leader that misses at no step of the window, and it asks nothing about the run before the restart point. Composed with witMiss_zero the miss-freedom hypothesis becomes a statement about the noise stream: the reference candidate misses at no step of [s, t) exactly when the noise bit has not fired there.

      Co-leadership is a different matter. It is not supplied by the witness in general: the exponent ceiling caps how far ahead the true rule's own running total can get, so one noise bit can hand a competitor the whole budget outright, at a restart point well inside the run. witness_singleNoiseBit_not_coleader proves this for a fixed instance — the construction fails the hypothesis, not merely the general theorem's proof.

      At the run's own start, s = 0, co-leadership holds for free: every candidate starts at exponent 0, leaving the noise-free prefix as the composition's only remaining hypothesis. That is witness_toDist_wRun_sub_bayesRun_le, the one form of the composition that carries nothing beyond the noise stream itself.

      theorem ReflectiveSubsystems.witness_toDist_wRun_sub_bayesFrom_le {k : ℕ} [NeZero k] (ξ : ℕ → Bool) (b : ℕ) {s t : ℕ} (hst : s ≤ t) (hlead : ∀ (j : Fin k), expRun (witMiss k ξ) b s j ≤ expRun (witMiss k ξ) b s 0) (hnoise : ∀ (u : ℕ), s ≤ u → u < t → ξ (u + k) = false) :
      ∑ i : Fin k, |toDist (wRun (2 ^ b) (missFit (witMiss k ξ)) t).raw i - toDist (bayesFrom (witMiss k ξ) b s t) i| ≤ 2 * (↑k - 1) / 2 ^ b

      The drift bound on the witness's own trajectory, composed at a restart point.

      FlooredMixture.toDist_wRun_sub_bayesFrom_le read at iL = 0, with witMiss_zero rewriting the reference candidate's miss-freedom hypothesis into a statement about the noise stream alone: no noise bit fires in [s, t). The running-co-leader hypothesis is carried unchanged — the witness does not discharge it, and witness_singleNoiseBit_not_coleader shows a fixed instance where it fails. Under both, the floored run's reading at t stays within 2(k−1)/2^b of exact Bayes restarted at s from the floored run's own state there.

      theorem ReflectiveSubsystems.witness_toDist_wRun_sub_bayesRun_le {k : ℕ} [NeZero k] (ξ : ℕ → Bool) (b t : ℕ) (hnoise : ∀ u < t, ξ (u + k) = false) :
      ∑ i : Fin k, |toDist (wRun (2 ^ b) (missFit (witMiss k ξ)) t).raw i - toDist (bayesRun (missFit (witMiss k ξ)) t) i| ≤ 2 * (↑k - 1) / 2 ^ b

      The start-of-run corollary: the one form that carries nothing beyond the noise stream.

      expRun (witMiss k ξ) b 0 is identically zero, so at s = 0 every candidate starts as a running co-leader and the composition above's other hypothesis discharges outright. The floored run's reading at t then stays within 2(k−1)/2^b of exact Bayes run from the start, provided only that the noise stream has not fired anywhere in [0, t).

      The guard: co-leadership is not free at a general restart point #

      The pathwise capstone above needs no hypothesis on the other candidates, but the drift bound's co-leader hypothesis is a real constraint on the witness, not a bookkeeping formality. The instance below fixes k = 2, b = 1 and a noise stream firing at one position, and shows the running co-leader condition failing at the step right after the reference candidate's own miss: one noise bit is enough to hand the whole exponent budget to the other candidate.

      A noise stream firing once, at position 3. Read against the length-2 window: both candidates hit at time 0 and at time 1, but the reference candidate's own miss at time 1 (its window reads the fired bit) leaves it at exponent 0 a step later, while the other candidate — who read past the noise bit and kept hitting — holds the ceiling.

      Equations
      Instances For

        Co-leadership fails at the step after the reference candidate's own miss. At s = 2 the exponent vector is (0, 1): the reference candidate the composition above always reads as iL is no longer a co-leader, so its hypothesis is not something the witness supplies — it is refuted by this fixed instance, not merely absent from what is proved.

        Measurability: the error count is a cylinder function #

        Everything below is plumbing for the expectation corollary. The floored run's whole state at time t is expRun at t, which reads the miss indicator strictly before t; so the error count over the first n steps depends on the noise stream only through the finitely many Bools witMiss k ω s i with s < n. Factoring through that finite tuple makes measurability immediate, the tuple space being discrete.

        theorem ReflectiveSubsystems.measurable_witMiss {k : ℕ} [NeZero k] (t : ℕ) (i : Fin k) :
        Measurable fun (ω : ℕ → Bool) => witMiss k ω t i

        Each miss bit is measurable in the noise stream: it reads two observations, each a parity walk over finitely many noise coordinates.

        theorem ReflectiveSubsystems.measurable_floorErrorCount {k : ℕ} [NeZero k] (b : ℕ) (θ : ℚ) (n : ℕ) :
        Measurable fun (ω : ℕ → Bool) => ↑(floorErrorTimes (witMiss k ω) b θ n).card

        The error count is measurable in the noise stream — it is a cylinder function of the first n miss vectors, and the tuple space carrying them is discrete.

        The expectation corollary #

        theorem ReflectiveSubsystems.integral_noiseCount (p : ↑unitInterval) (k n : ℕ) :
        ∫ (ω : ℕ → Bool), ↑(noiseCount ω k n) ∂noiseLaw p = ↑p * ↑n

        The noise count's mean is ηn under the witness's own Bernoulli(η) shift: n coordinate indicators, each of mean η, by linearity.

        theorem ReflectiveSubsystems.witness_integral_floorErrorTimes_le {k : ℕ} [NeZero k] (p : ↑unitInterval) (b : ℕ) (θ : ℚ) (hbudget : 2 * (↑k - 1) ≤ θ * 2 ^ b) (n : ℕ) :
        ∫ (ω : ℕ → Bool), ↑(floorErrorTimes (witMiss k ω) b θ n).card * ↑θ ∂noiseLaw p ≤ 4 * (↑k - 1) + 2 * ↑k * ↑p * ↑n

        The floored mixture on the witness's own trajectory, in expectation.

        The pathwise capstone averaged under ReflectiveSubsystems.noiseLaw, the Bernoulli(η) shift that makes the witness's whole hypothesis block inhabited. The integrand is a cylinder function of finitely many noise coordinates, hence measurable and bounded; the right-hand side is integral_noiseCount's ηn carried through by linearity.

        This is the damage budget as a rate: 4(k−1) is the lifetime-free anchor the emergence branch also gets, and 2kηn is what the learning branch pays for a true rule that misses at the noise rate — slope 2kη/θ in the run length once divided through by the threshold.