Documentation

ReflectiveSubsystems.SQAlgorithm

The prequential-MDL-with-SQ-pruning algorithm as a Lean object ([SQ] §4 / App A, FV-K) #

Provenance: [SQ], §4 Theorem 4.1 + proof sketch (a)–(c) and Appendix A "The adaptation". The algorithm carries a posterior over deterministic candidate rules; at each step it (Bayes-)filters candidates inconsistent with the observed symbol, and on scheduled queries it prunes every candidate whose predicted statistic deviates from the oracle answer by more than 2τ. FV-K makes THIS algorithm a genuine Lean object and proves the identification theorems that tie the standing FV artifacts to it — closing the ledger's outstanding identifications:

This file is Finset-level: the object is a family of Finset ι operations (Bayes consistency filter + SQ pruning), with NO filtration/measurability content. The measure-theoretic inputs enter only as the (already-proved) FV-E/FV-I/FV-H artifacts it cites.

Constants (matched to FV-A4 SQVersionSpace.lean exactly) #

Schedule encoding #

sched : ℕ → Finset Q, with sched t the query set active by step t; the per-step alive set is alive … t ω = sqPrune stat oracleAns τ (sched t) (consistent pred cands t ω) — sq-prune (over the queries scheduled by t) of the time-t Bayes-consistent set.

What this DOES establish #

What this does NOT establish (out of scope here; no overclaiming) #

def ReflectiveSubsystems.consistent {X : Type u_1} [DecidableEq X] {ι : Type u_2} (pred : ι → (s : ℕ) → (Fin s → X) → X) (cands : Finset ι) (t : ℕ) (ω : ℕ → X) :

Bayes consistency filter (§4 sketch (a)): the candidates whose deterministic rule predicts every observed symbol up to time t.

Equations
Instances For
    noncomputable def ReflectiveSubsystems.sqPrune {ι : Type u_2} {Q : Type u_3} (stat : ι → Q → ℝ) (oracleAns : Q → ℝ) (τ : ℝ) (Qs : Finset Q) (S : Finset ι) :

    SQ pruning step (§4 sketch (b) / App A "the SQ handle"): from S, keep only the candidates whose statistic is within 2τ of the oracle answer on every scheduled query φ ∈ Qs.

    Equations
    Instances For
      noncomputable def ReflectiveSubsystems.alive {X : Type u_1} [DecidableEq X] {ι : Type u_2} {Q : Type u_3} (pred : ι → (s : ℕ) → (Fin s → X) → X) (stat : ι → Q → ℝ) (oracleAns : Q → ℝ) (τ : ℝ) (sched : ℕ → Finset Q) (cands : Finset ι) (t : ℕ) (ω : ℕ → X) :

      The per-step alive set: sq-prune (over the queries scheduled by time t, sched t) of the time-t Bayes-consistent set.

      Equations
      Instances For
        noncomputable def ReflectiveSubsystems.prunedAt {X : Type u_1} [DecidableEq X] {ι : Type u_2} {Q : Type u_3} [DecidableEq ι] (pred : ι → (s : ℕ) → (Fin s → X) → X) (stat : ι → Q → ℝ) (oracleAns : Q → ℝ) (τ : ℝ) (sched : ℕ → Finset Q) (cands : Finset ι) (t : ℕ) (ω : ℕ → X) :

        The step-t pruned-away set: candidates alive at t but removed by step t+1.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem ReflectiveSubsystems.alive_mass_eq_Z_det {X : Type u_1} [DecidableEq X] {ι : Type u_2} (pred : ι → (s : ℕ) → (Fin s → X) → X) (cands : Finset ι) (w : ι → ℝ) (t : ℕ) (ω : ℕ → X) :
          ∑ i ∈ consistent pred cands t ω, w i = Z cands w (detFactor pred) t ω

          FV-I identification ("identify g with the algorithm"): the UNpruned Bayes-consistent posterior mass is exactly FV-I's mixture Z cands w (detFactor pred) at time t. From L_det_eq_indicator (each deterministic likelihood is the consistency indicator) and Finset.sum_filter.

          theorem ReflectiveSubsystems.truth_survives {X : Type u_1} [DecidableEq X] {ι : Type u_2} {Q : Type u_3} (pred : ι → (s : ℕ) → (Fin s → X) → X) (stat : ι → Q → ℝ) (oracleAns : Q → ℝ) (τ : ℝ) (hτ : 0 ≤ τ) (sched : ℕ → Finset Q) (cands : Finset ι) (ω : ℕ → X) (iR : ι) (hmem : iR ∈ cands) (hreal : ∀ (s : ℕ), (pred iR s fun (k : Fin s) => ω ↑k) = ω s) (hclose : ∀ (t : ℕ), ∀ φ ∈ sched t, |oracleAns φ - stat iR φ| ≤ τ) (t : ℕ) :
          iR ∈ alive pred stat oracleAns τ sched cands t ω

          App A Claim 1 for the object — the truth survives. A truth index iR ∈ cands that is (a) realizable (pred iR predicts every symbol) and (b) τ-close to every scheduled oracle answer (|oracleAns φ − stat iR φ| ≤ τ, the FV-A4 hemp order, supplied w.h.p. by SQOracle.empirical_isSQOracle) is in alive … t ω for every t. Reuses FV-A4's truth_survives_pruning for the τ ⇒ 2τ step.

          theorem ReflectiveSubsystems.separated_impostor_pruned_alg {X : Type u_1} [DecidableEq X] {ι : Type u_2} {Q : Type u_3} (pred : ι → (s : ℕ) → (Fin s → X) → X) (stat : ι → Q → ℝ) (oracleAns : Q → ℝ) (τ : ℝ) (sched : ℕ → Finset Q) (cands : Finset ι) (t : ℕ) (ω : ℕ → X) (iR j : ι) (φ : Q) (hφ : φ ∈ sched t) (hemp : |oracleAns φ - stat iR φ| ≤ τ) (hsep : 3 * τ < |stat j φ - stat iR φ|) :
          j ∉ alive pred stat oracleAns τ sched cands t ω

          FV-A4 converse for the object — separated impostors are pruned. A candidate j whose statistic is 3τ-separated from the truth iR on some scheduled query φ ∈ sched t, while the oracle is τ-close to the truth there, is NOT in alive … t ω — its deviation exceeds the 2τ threshold (FV-A4's separated_impostor_pruned).

          theorem ReflectiveSubsystems.algorithm_damage_le {X : Type u_1} [DecidableEq X] {ι : Type u_2} {Q : Type u_3} [DecidableEq ι] (pred : ι → (s : ℕ) → (Fin s → X) → X) (stat : ι → Q → ℝ) (oracleAns : Q → ℝ) (τ : ℝ) (sched : ℕ → Finset Q) (cands : Finset ι) (ω : ℕ → X) (n : ℕ) (outs : Finset X) (u : ℕ → ι → ℝ) (p : ℕ → ι → X → ℝ) (hu : ∀ t ∈ Finset.range n, ∀ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω ∪ prunedAt pred stat oracleAns τ sched cands t ω, 0 ≤ u t i) (hp0 : ∀ t ∈ Finset.range n, ∀ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω ∪ prunedAt pred stat oracleAns τ sched cands t ω, ∀ x ∈ outs, 0 ≤ p t i x) (hp1 : ∀ t ∈ Finset.range n, ∀ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω ∪ prunedAt pred stat oracleAns τ sched cands t ω, ∑ x ∈ outs, p t i x = 1) (hV : ∀ t ∈ Finset.range n, 0 < ∑ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω, u t i) :
          ∑ t ∈ Finset.range n, ∑ x ∈ outs, |(∑ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω, u t i * p t i x) / ∑ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω, u t i - (∑ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω ∪ prunedAt pred stat oracleAns τ sched cands t ω, u t i * p t i x) / ∑ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω ∪ prunedAt pred stat oracleAns τ sched cands t ω, u t i| ≤ 2 * ∑ t ∈ Finset.range n, (∑ i ∈ prunedAt pred stat oracleAns τ sched cands t ω, u t i) / ∑ i ∈ alive pred stat oracleAns τ sched cands (t + 1) ω ∪ prunedAt pred stat oracleAns τ sched cands t ω, u t i

          FV-H ε_t identification. FV-H's accumulated one-step predictive damage (ReflectiveSubsystems.accumulated_perturbation_le) instantiated at the algorithm's OWN step families: survivors alive … (t+1) ω and the step-t pruned-away set prunedAt … t ω. The bound's ε_t = (∑ prunedAt … t) / (∑ alive … (t+1) ∪ prunedAt … t) is the algorithm's literal normalized pruned fraction — turning FV-H's abstract accounting into a statement about THE algorithm.

          theorem ReflectiveSubsystems.posterior_concentration_transfer {X : Type u_1} [DecidableEq X] {ι : Type u_2} [Fintype X] [Fintype ι] (pred : ι → (s : ℕ) → (Fin s → X) → X) (w : ι → ℝ) (ω : ℕ → X) (iR : ι) (hw : ∀ (i : ι), 0 ≤ w i) (k : ℕ) (hwR : w iR = 2 ^ (-↑k)) (hsumw : ∑ i : ι, w i ≤ 1) (hreal : ∀ (s : ℕ), (pred iR s fun (k : Fin s) => ω ↑k) = ω s) (δ ε₀ : ℝ) (hδ : 0 < δ) (hε : 0 < ε₀) (n : ℕ) (hsep : ∀ (i : ι), i ≠ iR → ∀ t ∈ Finset.range n, ε₀ ≤ BayesRedundancy.sqHellinger (fun (x : X) => if x = ω t then 1 else 0) fun (x : X) => if (pred i t fun (j : Fin t) => ω ↑j) = x then 1 else 0) (hT : (↑k * Real.log 2 + Real.log (2 / δ)) / (2 * ε₀) ≤ ↑n) :
          1 - δ / 2 ≤ w iR * BayesRedundancy.Lik (fun (i : ι) (s : ℕ) (x : X) => if (pred i s fun (j : Fin s) => ω ↑j) = x then 1 else 0) ω iR n / BayesRedundancy.Pbarₚ (fun (i : ι) (s : ℕ) (x : X) => if (pred i s fun (j : Fin s) => ω ↑j) = x then 1 else 0) w ω n

          (stretch) Unpruned posterior concentration via the algorithm's Dirac pmf. Instantiating Paper II's ReflectiveSubsystems.deterministic_discovery at the algorithm's own deterministic predictor — the Dirac pmf q i s x = 𝟙[pred i s (ω|_{<s}) = x] — gives Theorem-3.1 concentration for the algorithm's UNpruned Bayes posterior: for n ≥ (K(iR)·ln2 + ln(2/δ))/(2ε₀) under per-step separation hsep, the posterior on the true rule iR is ≥ 1 − δ/2. This is the pmf-indexing identification ([Discovery] ↔ the algorithm); composing it with algorithm_damage_le into a full Theorem-4.1(i) statement for the PRUNED algorithm is the assembly residue (see module docstring).

          theorem ReflectiveSubsystems.posterior_mono_of_subset {ι : Type u_2} (v : ι → ℝ) (S S' : Finset ι) (hsub : S' ⊆ S) (iR : ι) (hiR : iR ∈ S') (hnn : ∀ i ∈ S, 0 ≤ v i) (hpos : 0 < v iR) :
          v iR / ∑ i ∈ S, v i ≤ v iR / ∑ i ∈ S', v i

          Posterior monotonicity under restriction (the part-(i) composition principle): for weights v ≥ 0 on S with the truth iR ∈ S' ⊆ S carrying positive weight, restricting the normalizer to S' can only shrink the denominator, so the restricted quotient dominates: v iR / ∑_S v ≤ v iR / ∑_{S'} v. Elementary; the denominator positivity on S' comes from iR ∈ S', v iR > 0.

          theorem ReflectiveSubsystems.Lik_qDirac_eq_L_det {X : Type u_1} [DecidableEq X] {ι : Type u_2} (pred : ι → (s : ℕ) → (Fin s → X) → X) (i : ι) (n : ℕ) (ω : ℕ → X) :
          BayesRedundancy.Lik (fun (i : ι) (s : ℕ) (x : X) => if (pred i s fun (j : Fin s) => ω ↑j) = x then 1 else 0) ω i n = L (detFactor pred) i n ω

          Bridge (FV-I ↔ [Discovery]): the algorithm's Dirac pmf Lik in posterior_concentration_transfer IS FV-I's likelihood L (detFactor pred) — both are ∏_{s<n} 𝟙[pred i s (ω|_{<s}) = ω s], so the identification is definitional (rfl).

          theorem ReflectiveSubsystems.algorithm_discovery {X : Type u_1} [DecidableEq X] {ι : Type u_2} {Q : Type u_3} [Fintype X] [Fintype ι] (pred : ι → (s : ℕ) → (Fin s → X) → X) (stat : ι → Q → ℝ) (oracleAns : Q → ℝ) (τ : ℝ) (hτ : 0 ≤ τ) (sched : ℕ → Finset Q) (w : ι → ℝ) (ω : ℕ → X) (iR : ι) (hw : ∀ (i : ι), 0 ≤ w i) (k : ℕ) (hwR : w iR = 2 ^ (-↑k)) (hsumw : ∑ i : ι, w i ≤ 1) (hreal : ∀ (s : ℕ), (pred iR s fun (k : Fin s) => ω ↑k) = ω s) (hclose : ∀ (t : ℕ), ∀ φ ∈ sched t, |oracleAns φ - stat iR φ| ≤ τ) (δ ε₀ : ℝ) (hδ : 0 < δ) (hε : 0 < ε₀) (n : ℕ) (hsep : ∀ (i : ι), i ≠ iR → ∀ t ∈ Finset.range n, ε₀ ≤ BayesRedundancy.sqHellinger (fun (x : X) => if x = ω t then 1 else 0) fun (x : X) => if (pred i t fun (j : Fin t) => ω ↑j) = x then 1 else 0) (hT : (↑k * Real.log 2 + Real.log (2 / δ)) / (2 * ε₀) ≤ ↑n) :
          1 - δ / 2 ≤ w iR * L (detFactor pred) iR n ω / ∑ i ∈ alive pred stat oracleAns τ sched Finset.univ n ω, w i * L (detFactor pred) i n ω

          Theorem 4.1(i) for the PRUNED algorithm. Under realizability, the 2^{−k} prior, per-step separation hsep, the discovery horizon hT, and the truth's oracle-closeness hclose, the pruned posterior on the true rule iR — the Bayes posterior with the normalizer restricted to the survivor set alive … n — is ≥ 1 − δ/2. Proof: truth_survives puts iR ∈ alive n ⊆ univ; the truth's weight w iR · L iR = w iR > 0 (realizability ⇒ L iR = 1); posterior_mono_of_subset then makes the pruned quotient dominate the unpruned one, which is ≥ 1 − δ/2 by posterior_concentration_transfer (Dirac bridge). The damage bound does NOT enter (see docstring). cands = Finset.univ matches deterministic_discovery's full-Fintype ι normalizer.