Documentation

ReflectiveSubsystems.ParityWalk

The two-state parity walk and its sign-weighted Azuma bound #

The parity walk is the two-state chain x ↦ ¬x ⊕ ξ driven by independent noise bits ξ. It is the smallest genuinely dependent stationary source: the uniform law on Bool is stationary for it, and consecutive states are perfectly anti-correlated up to the noise rate.

This module supplies the analytic engine a single-orbit Hoeffding bound for such a chain needs. The engine is one theorem:

hasSubgaussianMGF_signedSum — if ξ is an independent family of noise bits whose character zeta ∘ ξ has a common mean m from index d on, and σ u is any Bool-valued observable of the strict past ξ 0, …, ξ (u + d - 1), then ∑_{u < n} χ(σ u) · (ζ(ξ (u+d)) − m) has a sub-Gaussian moment-generating function with parameter n — the same parameter an i.i.d. sum of [−1,1]-valued centred variables gets.

The point is the sign weighting: the multiplier χ(σ u) ∈ {±1} may depend arbitrarily on the past, so a dependent chain's Birkhoff sum falls into this shape whenever the chain's character obeys a multiplicative recursion at some lag. The proof is Hoeffding's lemma applied one step at a time, with the past factored out by independence — no conditional expectations, no filtration, and no general dependent-process concentration.

The second half of the module cashes the recursion in. lagSum_telescope rewrites the Birkhoff sum of the character as one signed sum plus a boundary term, and the denominator that appears there is 1 − m with m ≤ 0 — not the spectral gap 1 + m. That is the whole point of the alternating sign: the summands cancel in pairs, so the boundary term stays O(lag) and the constant that comes out carries no dependence on the noise rate.

Main results #

The character of (Bool, xor) #

The nontrivial character of the group (Bool, xor), valued in {±1} ⊆ ℝ.

Equations
Instances For

    The parity walk's per-step multiplier ζ = −χ: it is +1 exactly when the noise bit fires. The sign is what distinguishes the parity walk from a lazy random walk — the deterministic complement ¬ contributes the −, and makes consecutive states anti-correlated.

    Equations
    Instances For
      theorem ReflectiveSubsystems.chi_xor (a b : Bool) :
      chi (a ^^ b) = chi a * chi b

      Multiplicativity of the character. This single identity turns the parity walk's Birkhoff sums into products, and products into telescoping sums.

      theorem ReflectiveSubsystems.measurable_xor {Ω : Type u_1} {m : MeasurableSpace Ω} {a b : Ω → Bool} (ha : Measurable a) (hb : Measurable b) :
      Measurable fun (ω : Ω) => a ω ^^ b ω

      xor of two measurable Bool-valued maps is measurable, for an arbitrary σ-algebra on the domain — stated without the ambient instance so that it applies to a sub-σ-algebra such as pastAlg.

      The parity walk #

      One step of the parity walk: x ↦ ¬x ⊕ ξ.

      Equations
      Instances For
        def ReflectiveSubsystems.walk (x₀ : Bool) (ξ : ℕ → Bool) :
        ℕ → Bool

        The parity walk's orbit from x₀ under the noise word ξ: the step into time s+1 reads the noise bit ξ s.

        Equations
        Instances For
          @[simp]
          theorem ReflectiveSubsystems.walk_succ (x₀ : Bool) (ξ : ℕ → Bool) (s : ℕ) :
          walk x₀ ξ (s + 1) = !(walk x₀ ξ s ^^ ξ s)

          The parity of the noise prefix, with each bit complemented — the deterministic part of the walk's drift folded in.

          Equations
          Instances For
            theorem ReflectiveSubsystems.walk_eq_xor_par (x₀ : Bool) (ξ : ℕ → Bool) (s : ℕ) :
            walk x₀ ξ s = (x₀ ^^ par ξ s)

            The walk is its initial state shifted by the noise parity. The two-state chain has no dynamics beyond this: the whole trajectory is one bit of initial condition xor a running parity of complemented noise bits.

            theorem ReflectiveSubsystems.par_add (ξ : ℕ → Bool) (a b : ℕ) :
            par ξ (a + b) = (par ξ a ^^ par (fun (i : ℕ) => ξ (a + i)) b)

            The prefix parity is additive. A noise-parity prefix splits at any point into the parity up to the split and the parity of the shifted tail — the deterministic fact behind why two observations of the same residue class, arbitrarily far apart, differ by only a bounded window of tape bits (ReflectiveSubsystems.obs_xor_obs_add_mul).

            theorem ReflectiveSubsystems.chi_par (ξ : ℕ → Bool) (d : ℕ) :
            chi (par ξ d) = ∏ i ∈ Finset.range d, zeta (ξ i)

            The noise-parity character is a product of noise characters. Each step of the prefix parity complements one more tape bit, and each complement contributes its own noise character — the identity ReflectiveSubsystems.chi_pairObs_lagK is exactly this at d = 1.

            theorem ReflectiveSubsystems.measurable_walk {Ω : Type u_1} {m : MeasurableSpace Ω} {x₀ : Ω → Bool} {ζ : ℕ → Ω → Bool} (hx : Measurable x₀) (s : ℕ) (hζ : ∀ j < s, Measurable (ζ j)) :
            Measurable fun (ω : Ω) => walk (x₀ ω) (fun (j : ℕ) => ζ j ω) s

            A parity-walk orbit is measurable once its initial state and the noise bits it reads are.

            The noise σ-algebra of the strict past #

            @[reducible]
            def ReflectiveSubsystems.noiseAlg {Ω : Type u_1} (ξ : ℕ → Ω → Bool) (t : Set ℕ) :

            The σ-algebra generated by the noise bits indexed by a set t.

            Equations
            Instances For
              @[reducible]
              def ReflectiveSubsystems.pastAlg {Ω : Type u_1} (ξ : ℕ → Ω → Bool) (n : ℕ) :

              The σ-algebra generated by the noise bits ξ 0, …, ξ (n-1) — the strict past at time n.

              Equations
              Instances For
                theorem ReflectiveSubsystems.measurable_noiseAlg_xi {Ω : Type u_1} {ξ : ℕ → Ω → Bool} {t : Set ℕ} {i : ℕ} (hi : i ∈ t) :
                Measurable (ξ i)
                theorem ReflectiveSubsystems.noiseAlg_mono {Ω : Type u_1} (ξ : ℕ → Ω → Bool) {s t : Set ℕ} (h : s ⊆ t) :

                Disjoint blocks #

                The engine below reads one block of noise indices per step rather than one index. pastSet A n is what a step-n multiplier may look at: everything outside every block from n on. With the blocks pairwise disjoint that set contains all the earlier blocks, so the partial sums are measurable for it, while being disjoint from the current block — the two facts the induction needs.

                What a step-n multiplier may read: every index that no block from n on contains.

                Equations
                Instances For
                  theorem ReflectiveSubsystems.pastAlg_le {Ω : Type u_1} [MeasurableSpace Ω] {ξ : ℕ → Ω → Bool} (hmeas : ∀ (i : ℕ), Measurable (ξ i)) (n : ℕ) :
                  theorem ReflectiveSubsystems.noiseAlg_le {Ω : Type u_1} [MeasurableSpace Ω] {ξ : ℕ → Ω → Bool} (hmeas : ∀ (i : ℕ), Measurable (ξ i)) (t : Set ℕ) :
                  theorem ReflectiveSubsystems.measurable_pastAlg_xi {Ω : Type u_1} {ξ : ℕ → Ω → Bool} {i n : ℕ} (hi : i < n) :
                  Measurable (ξ i)
                  theorem ReflectiveSubsystems.indepFun_noiseAlg_compl {Ω : Type u_1} [MeasurableSpace Ω] {P : MeasureTheory.Measure Ω} {ξ : ℕ → Ω → Bool} (hmeas : ∀ (i : ℕ), Measurable (ξ i)) (hindep : ProbabilityTheory.iIndepFun ξ P) (t : Set ℕ) {A : Type u_2} {B : Type u_3} [MeasurableSpace A] [MeasurableSpace B] {F : Ω → A} {G : Ω → B} (hF : Measurable F) (hG : Measurable G) :

                  Disjoint noise sets read independent things. Under mutual independence of the noise bits, anything read off the coordinates in t is independent of anything read off the coordinates outside t. This is the only probabilistic input the rest of the file needs; it comes from Mathlib's indep_biSup_compl, so no filtration or conditional expectation appears anywhere here.

                  The engine: a sub-Gaussian bound for sign-weighted noise sums #

                  noncomputable def ReflectiveSubsystems.blockSignedSum {Ω : Type u_1} (σ : ℕ → Ω → Bool) (Y : ℕ → Ω → ℝ) (ρ : ℝ) (n : ℕ) (ω : Ω) :

                  The sign-weighted partial sum over disjoint noise blocks: the multiplier χ(σ u) is an arbitrary {±1}-valued reading of everything outside the blocks from u on, and the increment Y u − ρ a centred [−1, 1]-valued reading of the block A u alone.

                  Equations
                  Instances For
                    noncomputable def ReflectiveSubsystems.signedSum {Ω : Type u_1} (ξ σ : ℕ → Ω → Bool) (m : ℝ) (d n : ℕ) (ω : Ω) :

                    The sign-weighted partial sum: the multiplier χ(σ u) is an arbitrary {±1}-valued reading of the strict past, the increment ζ(ξ (u+d)) − m a centred noise character.

                    Equations
                    Instances For
                      theorem ReflectiveSubsystems.hasSubgaussianMGF_blockSignedSum {Ω : Type u_1} [MeasurableSpace Ω] {P : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure P] {ξ σ : ℕ → Ω → Bool} {Y : ℕ → Ω → ℝ} {ρ : ℝ} {A : ℕ → Set ℕ} (hmeas : ∀ (i : ℕ), Measurable (ξ i)) (hindep : ProbabilityTheory.iIndepFun ξ P) (hdisj : ∀ (u v : ℕ), u ≠ v → Disjoint (A u) (A v)) (hY : ∀ (u : ℕ), Measurable (Y u)) (hYbdd : ∀ (u : ℕ) (ω : Ω), Y u ω ∈ Set.Icc (-1) 1) (hYmean : ∀ (u : ℕ), ∫ (ω : Ω), Y u ω ∂P = ρ) (hσ : ∀ (u : ℕ), Measurable (σ u)) (n : ℕ) :

                      The engine. A sum of n sign-weighted, centred block increments has a sub-Gaussian moment-generating function with parameter n — the parameter an i.i.d. [−1,1] sum would get — even though the signs may depend arbitrarily on everything the earlier blocks say.

                      At step n the exponential factors as exp(t·Sₙ)·exp(t·χ(σ n)·y); splitting on the two values of σ n writes it as a sum of two products of a past factor and a present factor, independence factors each integral, and the two present factors are the mgfs of ±y, both bounded by exp(t²/2) by Hoeffding's lemma. The two past factors add back up to exp(t·Sₙ), so the induction hypothesis closes the step.

                      Only pairwise independence of a block from its own past is used — no mutual independence of the derived block readings, which is what keeps this reachable without a σ-algebra grouping lemma.

                      theorem ReflectiveSubsystems.hasSubgaussianMGF_signedSum {Ω : Type u_1} [MeasurableSpace Ω] {P : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure P] {ξ σ : ℕ → Ω → Bool} {m : ℝ} {d : ℕ} (hmeas : ∀ (i : ℕ), Measurable (ξ i)) (hindep : ProbabilityTheory.iIndepFun ξ P) (hσ : ∀ (u : ℕ), Measurable (σ u)) (hmean : ∀ (u : ℕ), ∫ (ω : Ω), zeta (ξ (u + d) ω) ∂P = m) (n : ℕ) :

                      The engine, at one fresh noise bit per step. The original shape: the multiplier χ(σ u) reads the strict past at time u + d and the increment is that step's own noise character. It is the block engine at the singleton blocks A u = {u + d}.

                      The two-sided Chernoff bound #

                      theorem ReflectiveSubsystems.measureReal_abs_ge_le {Ω : Type u_1} [MeasurableSpace Ω] {P : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure P] {X : Ω → ℝ} {c : NNReal} (h : ProbabilityTheory.HasSubgaussianMGF X c P) {ε : ℝ} (hε : 0 ≤ ε) :
                      P.real {ω : Ω | ε ≤ |X ω|} ≤ 2 * Real.exp (-ε ^ 2 / (2 * ↑c))

                      Two-sided Chernoff: a sub-Gaussian variable with parameter c leaves [-ε, ε] with probability at most 2·exp(−ε²/(2c)), the shape the SQ-oracle interface consumes.

                      Cashing in the recursion: the telescoping bound #

                      theorem ReflectiveSubsystems.lagSum_telescope_gen (o : ℕ → Bool) (ν : ℕ → ℝ) (K : ℕ) (m : ℝ) (hrec : ∀ (u : ℕ), chi (o u) * ν u = chi (o (u + K))) (N : ℕ) :
                      ∑ u ∈ Finset.range N, chi (o u) * (ν u - m) = ∑ u ∈ Finset.range (N + K), chi (o u) - ∑ u ∈ Finset.range K, chi (o u) - m * ∑ u ∈ Finset.range N, chi (o u)

                      The telescope. For any Bool sequence o whose character obeys a lag-K multiplicative recursion χ(o u)·ν u = χ(o (u+K)) against any multiplier sequence ν, the signed sum of the multipliers is the Birkhoff sum of χ ∘ o weighted by 1 − m, up to two boundary blocks of length K.

                      theorem ReflectiveSubsystems.lagSum_telescope (o ζw : ℕ → Bool) (k : ℕ) (m : ℝ) (hrec : ∀ (u : ℕ), chi (o u) * zeta (ζw (u + k)) = chi (o (u + k))) (N : ℕ) :
                      ∑ u ∈ Finset.range N, chi (o u) * (zeta (ζw (u + k)) - m) = ∑ u ∈ Finset.range (N + k), chi (o u) - ∑ u ∈ Finset.range k, chi (o u) - m * ∑ u ∈ Finset.range N, chi (o u)

                      The telescope at the parity walk's own multiplier, its noise character at lag k.

                      theorem ReflectiveSubsystems.abs_chiSum_le_card (o : ℕ → Bool) (b : ℕ) :
                      |∑ u ∈ Finset.range b, chi (o u)| ≤ ↑b

                      A Birkhoff block of length b has absolute value at most b.

                      theorem ReflectiveSubsystems.abs_chiSum_le_gen (o : ℕ → Bool) (ν : ℕ → ℝ) (K : ℕ) (m : ℝ) (hm : |m| ≤ 1) (hrec : ∀ (u : ℕ), chi (o u) * ν u = chi (o (u + K))) (N : ℕ) :
                      (1 - m) * |∑ u ∈ Finset.range (N + K), chi (o u)| ≤ |∑ u ∈ Finset.range N, chi (o u) * (ν u - m)| + 2 * ↑K

                      The deterministic half of the tail bound. Under a lag-K multiplicative recursion against any multiplier sequence, and for any |m| ≤ 1, the Birkhoff sum of the character through time N + K is controlled by the signed sum up to two boundary blocks of length K — weighted by the gap 1 − m.

                      The weight is the whole story of the constant. At m ≤ 0 — the parity walk's own alternating sign — it is ≥ 1 and therefore helps: no spectral gap is divided by (abs_chiSum_le). At 0 ≤ m < 1 — a persistent multiplier, which is what a cross-class pair character has — it is the gap itself, and dividing by it is where a noise-rate dependence necessarily enters.

                      theorem ReflectiveSubsystems.abs_chiSum_le (o ζw : ℕ → Bool) (k : ℕ) (m : ℝ) (hm0 : -1 ≤ m) (hm : m ≤ 0) (hrec : ∀ (u : ℕ), chi (o u) * zeta (ζw (u + k)) = chi (o (u + k))) (N : ℕ) :
                      |∑ u ∈ Finset.range (N + k), chi (o u)| ≤ |∑ u ∈ Finset.range N, chi (o u) * (zeta (ζw (u + k)) - m)| + 2 * ↑k

                      The deterministic half of the tail bound, at the alternating sign. Under the lag-k recursion and -1 ≤ m ≤ 0, the Birkhoff sum of the character through time N + k exceeds the signed sum by at most 2k.

                      This inequality is where the parity walk's anti-correlation is cashed in. The telescope's denominator is 1 − m ≥ 1, so it helps: no spectral gap is divided by, and the boundary term does not grow with the noise rate.

                      The single-orbit tail #

                      theorem ReflectiveSubsystems.chiSum_tail_gen {Ω : Type u_1} [MeasurableSpace Ω] {P : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure P] {ξ : ℕ → Ω → Bool} {m : ℝ} (hmeas : ∀ (i : ℕ), Measurable (ξ i)) (hindep : ProbabilityTheory.iIndepFun ξ P) {d K : ℕ} (hmean : ∀ (u : ℕ), ∫ (ω : Ω), zeta (ξ (u + d) ω) ∂P = m) (hm0 : -1 ≤ m) (hm : m ≤ 0) (o : ℕ → Ω → Bool) (hom : ∀ (u : ℕ), Measurable (o u)) (hrec : ∀ (u : ℕ) (ω : Ω), chi (o u ω) * zeta (ξ (u + d) ω) = chi (o (u + K) ω)) (N : ℕ) {ε : ℝ} (hε : 0 ≤ ε) :
                      P.real {ω : Ω | ε + 2 * ↑K ≤ |∑ u ∈ Finset.range (N + K), chi (o u ω)|} ≤ 2 * Real.exp (-ε ^ 2 / (2 * ↑N))

                      The single-orbit tail. Let ξ be a mutually independent family of noise bits whose character has common mean m ∈ [−1, 0] from index k on, and let o be any Bool process read off the strict past whose character obeys the lag-k recursion χ(o u)·ζ(ξ (u+k)) = χ(o (u+k)). Then the Birkhoff sum of χ ∘ o through time N + k obeys a genuine exponential tail, with the boundary allowance 2k and the sub-Gaussian parameter N.

                      For k = 1 this is the parity walk x ↦ ¬x ⊕ ξ itself; larger k is the noisy window chain (ReflectiveSubsystems/NoisyWindowChain.lean). Note what does not appear: the noise rate. The bound is uniform over m ∈ [−1, 0], i.e. over every noise level from deterministic alternation to unbiased.

                      The telescope's lag K and the noise offset d are separate parameters: d = K = k is the chain read from time 0, while d = a + k with K = k is the same chain read through a window starting at offset a — whose boundary allowance is still 2k, not 2(a+k). That is what keeps a shifted query's constant free of its own offset.

                      theorem ReflectiveSubsystems.chiSum_tail {Ω : Type u_1} [MeasurableSpace Ω] {P : MeasureTheory.Measure Ω} [MeasureTheory.IsProbabilityMeasure P] {ξ : ℕ → Ω → Bool} {m : ℝ} {k : ℕ} (hmeas : ∀ (i : ℕ), Measurable (ξ i)) (hindep : ProbabilityTheory.iIndepFun ξ P) (hmean : ∀ (u : ℕ), ∫ (ω : Ω), zeta (ξ (u + k) ω) ∂P = m) (hm0 : -1 ≤ m) (hm : m ≤ 0) (o : ℕ → Ω → Bool) (hom : ∀ (u : ℕ), Measurable (o u)) (hrec : ∀ (u : ℕ) (ω : Ω), chi (o u ω) * zeta (ξ (u + k) ω) = chi (o (u + k) ω)) (N : ℕ) {ε : ℝ} (hε : 0 ≤ ε) :
                      P.real {ω : Ω | ε + 2 * ↑k ≤ |∑ u ∈ Finset.range (N + k), chi (o u ω)|} ≤ 2 * Real.exp (-ε ^ 2 / (2 * ↑N))

                      The single-orbit tail at the chain's own lag, read from time 0.

                      Axiom audit #

                      Both capstones are #print axioms-clean on the standard triple, and the guards below make that build-enforced.