Documentation

ReflectiveSubsystems.CappedPool

A learner that caps the members of its pool by age #

[Discovery] §3.4 Proposition 3.18. A learner over C candidates (Learner) with integers b ≥ 2 and m ≥ 1. A state holds the first candidate q not yet admitted and a pool of admitted candidates, a member c having the age q - c; the pool has at most b members and, for every j, at most b / 2 ^ (j + 1) members of age above m * 2 ^ j (CappedPoolCapped). At an outcome the pool keeps the members that predicted it, and the learner then admits q, q + 1, … for as long as the pool has fewer than b members, q < C, and the admission leaves a pool that meets the caps. A state with q < C and fewer than b members is blocked at the least j at which more than b / 2 ^ (j + 1) members have age at least m * 2 ^ j, and those members, the voters, predict by their majority, true on a tie; at every other state the pool votes. On every realizable stream the learner misses at most `⌊(C - 1) / ⌈(c₀ + 1) / 2⌉⌋ + ∑ i < ⌊log₂ b⌋, (⌊C / (m * 2 ^ i)⌋ - 1) * cᵢ / ⌈(cᵢ₊₁ + 1) / 2⌉

The learner is Learner.cappedPoolLearner, its transition Learner.cappedPoolStep, with the refill taken in closed form: it admits the greatest number k ≤ min (b - |W|) (C - q) of candidates at which the pool W, kept at the outcome, together with the candidates q, …, q + k - 1 meets the caps at the pointer q + k (Learner.cappedPoolAdmitCount).

Main results #

A state of the capped-pool learner. next is the first candidate not yet admitted and pool the admitted candidates still kept; the member c of the pool at the pointer next has the age next - c.

  • next : ℕ

    The first candidate not yet admitted.

  • pool : Finset (Fin C)

    The pool: the admitted candidates still kept.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      The caps on a pool W at the pointer n: at most b members and, for every j, at most b / 2 ^ (j + 1) of age above m * 2 ^ j, that is, members c with c + m * 2 ^ j < n.

      Equations
      Instances For
        theorem ReflectiveSubsystems.Learner.cappedPoolCapped_iff_range {C : ℕ} (b m n : ℕ) (W : Finset (Fin C)) :
        CappedPoolCapped b m n W ↔ W.card ≤ b ∧ ∀ j ∈ Finset.range (b + 1), {c ∈ W | ↑c + m * 2 ^ j < n}.card ≤ b / 2 ^ (j + 1)

        The caps are decided by the levels j ≤ b: from j = ⌊log₂ b⌋ on the cap is 0 and the members of age above m * 2 ^ j shrink as j grows.

        @[instance_reducible]
        Equations
        theorem ReflectiveSubsystems.Learner.cappedPool_exists_blocked_iff_range {C : ℕ} (b m n : ℕ) (W : Finset (Fin C)) :
        (∃ (j : ℕ), b / 2 ^ (j + 1) < {c ∈ W | ↑c + m * 2 ^ j ≤ n}.card) ↔ ∃ j ∈ Finset.range (b + 1), b / 2 ^ (j + 1) < {c ∈ W | ↑c + m * 2 ^ j ≤ n}.card

        Some level has more than its cap of members of age at least m * 2 ^ j exactly when some level j ≤ b does, the cap being 0 from j = ⌊log₂ b⌋ on.

        @[instance_reducible]
        instance ReflectiveSubsystems.Learner.instDecidableExistsLtNatHDivHPowOfNatHAddCardFinFilterLeValHMul {C : ℕ} (b m n : ℕ) (W : Finset (Fin C)) :
        Decidable (∃ (j : ℕ), b / 2 ^ (j + 1) < {c ∈ W | ↑c + m * 2 ^ j ≤ n}.card)
        Equations
        • One or more equations did not get rendered due to their size.

        The number of candidates admitted at a refill, for the first candidate n not yet admitted and the set W of members the pool keeps: the greatest k ≤ min (b - |W|) (C - n) at which W, together with the candidates numbered n to n + k - 1, meets the caps at the pointer n + k.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          The transition of the capped-pool learner. With W the members of the pool that gave the outcome y at the vector v, the pool becomes W together with the candidates admitted at the refill (cappedPoolAdmitCount of them, from next).

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            The voters of a state. At a state with a candidate left and fewer than b members, the members of age at least m * 2 ^ j for the least j at which more than b / 2 ^ (j + 1) of the members have that age; at every other state the whole pool.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              The prediction of a state: the majority of its voters, true on a tie.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[reducible]

                The capped-pool learner over C candidates with parameters b and m. A state is a CappedPoolState. The start is the pool of the candidates the first refill admits, ∅ kept. It predicts the majority of the voters (CappedPoolState.predict) and moves by cappedPoolStep.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem ReflectiveSubsystems.Learner.cappedPoolLearner_missCount_le {C b m : ℕ} (hb : 2 ≤ b) (hm : 1 ≤ m) {v : ℕ → Fin C → Bool} {y : ℕ → Bool} (hr : FiniteLearner.Realizable v y) (n : ℕ) :
                  (cappedPoolLearner C b m).missCount v y n ≤ (C - 1) / ((b / 2 + 2) / 2) + ∑ i ∈ Finset.range (Nat.log 2 b), (C / (m * 2 ^ i) - 1) * (b / 2 ^ (i + 1)) / ((b / 2 ^ (i + 2) + 2) / 2) + Nat.log 2 b

                  The count of the capped-pool learner. Over every realizable stream and at every horizon n, the learner has missed at most `⌊(C - 1) / ⌈(c₀ + 1) / 2⌉⌋ + ∑ i < ⌊log₂ b⌋, (⌊C / (m * 2 ^ i)⌋ - 1) * cᵢ / ⌈(cᵢ₊₁ + 1) / 2⌉

                  • ⌊log₂ b⌋times, withcⱼ = ⌊b / 2 ^ (j + 1)⌋and⌈(c + 1) / 2⌉written(c + 2) / 2. The candidate that realizes the stream is never removed from the pool, and a miss removes at least half of the voters. A miss at a full pool or blocked at level 0removes at least `⌈(c₀ + 1) / 2⌉candidates, so there are at most⌊(C - 1) / ⌈(c₀ + 1) / 2⌉⌋of them. A miss blocked at leveli + 1removes at least⌈(cᵢ₊₁ + 1) / 2⌉voters, which are mature at the scale `L = m * 2 ^ i, and the members that are ever mature number at most cᵢfor each value of `q / L - 1, so those misses number at most the i-th term. After the last admission every miss at least halves the pool, at most ⌊log₂ b⌋` misses. [Discovery] §3.4 Proposition 3.18(i).

                  The set holding the states of the capped-pool learner: the states with the first candidate not yet admitted at most C, every member of the pool below it, and the caps met (mem_cappedPoolStates).

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Membership in the set holding the states of the capped-pool learner.

                    The number of sets of ages that meet the caps: the sets of ages in [1, m * b] with at most b members and, for every j, at most b / 2 ^ (j + 1) above m * 2 ^ j.

                    Equations
                    Instances For

                      The set holding the states of the capped-pool learner has at most (C + 1) * P states, P the number of sets of ages that meet the caps (cappedPoolProfiles): at a fixed first candidate not yet admitted, a pool is determined by its set of ages. [Discovery] §3.4 Proposition 3.18(i).

                      The start of the capped-pool learner lies in the set of states. [Discovery] §3.4 Proposition 3.18(i).

                      Every transition of the capped-pool learner carries the set of states into itself, at every vector and outcome: a refill admits the greatest number of candidates the caps and the bounds allow. [Discovery] §3.4 Proposition 3.18(i).

                      theorem ReflectiveSubsystems.Learner.exists_finiteLearner_card_le_cappedPool_missCount_le {C b m : ℕ} (hb : 2 ≤ b) (hm : 1 ≤ m) :
                      ∃ (L : FiniteLearner C), Fintype.card L.S ≤ (C + 1) * cappedPoolProfiles b m ∧ ∀ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), FiniteLearner.Realizable v y → ∀ (n : ℕ), L.missCount v y n ≤ (C - 1) / ((b / 2 + 2) / 2) + ∑ i ∈ Finset.range (Nat.log 2 b), (C / (m * 2 ^ i) - 1) * (b / 2 ^ (i + 1)) / ((b / 2 ^ (i + 2) + 2) / 2) + Nat.log 2 b

                      The assembly of the capped-pool learner as a finite-state learner, its states those of cappedPoolStates and its count that of cappedPoolLearner_missCount_le. [Discovery] §3.4 Proposition 3.18(i).

                      theorem ReflectiveSubsystems.Learner.cappedPoolLearner_missCount_le_nonvacuous :
                      ∃ (C : ℕ) (b : ℕ) (m : ℕ), 2 ≤ b ∧ 1 ≤ m ∧ (C - 1) / ((b / 2 + 2) / 2) + ∑ i ∈ Finset.range (Nat.log 2 b), (C / (m * 2 ^ i) - 1) * (b / 2 ^ (i + 1)) / ((b / 2 ^ (i + 2) + 2) / 2) + Nat.log 2 b < C - 1

                      The count of the capped-pool learner is below C - 1 for some parameters meeting its hypotheses. At 100 candidates, b = 16 and m = 16 the bound is 19 + 17 + 4 = 40 < 99, so the count improves on the count C - 1 of a learner with a state for each candidate. [Discovery] §3.4 Proposition 3.18(i).

                      theorem ReflectiveSubsystems.Learner.cappedPoolLearner_missCount_le_self {C b : ℕ} (hb : 2 ≤ b) {v : ℕ → Fin C → Bool} {y : ℕ → Bool} (hr : FiniteLearner.Realizable v y) (n : ℕ) :
                      b * (cappedPoolLearner C b b).missCount v y n ≤ 12 * C + b * Nat.log 2 b

                      The count of the capped-pool learner at m = b, written without division by b: b times the number of misses is at most 12 * C + b * ⌊log₂ b⌋, that is, the learner misses at most 12 C / b + ⌊log₂ b⌋ times. [Discovery] §3.4 Proposition 3.18(ii).