Documentation

ReflectiveSubsystems.WindowPool

A learner that keeps its pool inside a window of admitted candidates #

[Discovery] §3.4 Proposition 3.17. A learner over C candidates (Learner) with integers b ≥ 2 and m ≥ b: its states hold the first candidate q not yet admitted, a pool of at most b admitted candidates inside the window [q - m, q), and a mode, normal or flushing. It predicts the majority of the pool, true on a tie, and at an outcome the pool keeps the members that predicted it. It then admits q, q + 1, … while the pool has fewer than b members, q < C, and the pool is empty or q is less than its least member plus m, and it takes flushing mode when the pool is left with fewer than ⌈b / 2⌉ members and q < C; in flushing mode it admits nothing until the pool is empty, and then refills as in normal mode. On every realizable stream it misses at most ⌊(C - 1) / ⌈b / 4⌉⌋ + (⌊(C - 1) / m⌋ + 1) * ⌊log₂ b⌋ times, and it has at most 2 (C + 1) * ∑ k ≤ b, (m choose k) states; at m = b * ⌈log₂ b⌉ the count is at most 5 (C - 1) / b + ⌊log₂ b⌋.

The learner is Learner.windowPoolLearner, its transition Learner.windowPoolStep, with the refill taken in closed form: the pool keeps the members that predicted the outcome, and when it is not flushing with members left it admits min (b - |W|) (min (C - q) r) candidates, r the least member plus m less q when the kept set W is nonempty and b when it is empty.

Main results #

A state of the window-pool learner. next is the first candidate not yet admitted, pool the admitted candidates still kept and flushing the mode: in flushing mode the learner admits nothing until the pool is empty.

  • flushing : Bool

    Whether the learner is in flushing mode.

  • 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 candidates admitted at a refill. Those among the C candidates numbered from n to n + k - 1.

      Equations
      Instances For

        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 least of b - |W| (the pool has at most b members), C - n (the candidates left) and the room the window leaves, r, which is the least member of W plus m less n when W is nonempty and b when it is empty.

        Equations
        Instances For

          The transition of the window-pool learner. With W the members of the pool that gave the outcome y at the vector v: in flushing mode with W nonempty the pool becomes W and nothing is admitted; otherwise the pool becomes W together with the candidates admitted at the refill (windowPoolAdmitCount of them, from next), and the mode becomes flushing exactly when that pool has fewer than ⌈b / 2⌉ members and a candidate is left to admit.

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

            The prediction of a pool: the majority of its members, true on a tie.

            Equations
            Instances For
              @[reducible]

              The window-pool learner over C candidates with parameters b and m. A state is a WindowPoolState. The start is the pool of the first min b C candidates, with the mode flushing exactly when that pool has fewer than ⌈b / 2⌉ members and a candidate is left. It predicts the majority of the pool (WindowPoolState.predict) and moves by windowPoolStep.

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

                The set holding the states of the window-pool learner: the states with the first candidate not yet admitted at most C, every member of the pool below it and within m of it, and at most b members, in either mode (mem_windowPoolStates).

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem ReflectiveSubsystems.Learner.mem_windowPoolStates {C b m : ℕ} {s : WindowPoolState C} :
                  s ∈ windowPoolStates C b m ↔ s.next ≤ C ∧ (∀ c ∈ s.pool, ↑c < s.next ∧ s.next ≤ ↑c + m) ∧ s.pool.card ≤ b

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

                  The set holding the states of the window-pool learner has at most 2 (C + 1) * ∑ k ≤ b, (m choose k) states. The pool is a subset of at most b of the m indices [next - m, next), next takes C + 1 values and the mode two. [Discovery] §3.4 Proposition 3.17(i).

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

                  theorem ReflectiveSubsystems.Learner.windowPoolLearner_step_mem (C b m : ℕ) (hbm : b ≤ m) (s : WindowPoolState C) :
                  s ∈ windowPoolStates C b m → ∀ (v : Fin C → Bool) (y : Bool), windowPoolStep C b m s v y ∈ windowPoolStates C b m

                  Every transition of the window-pool learner carries the set of states into itself, at every vector and outcome, once b ≤ m: a refill admits at most b - |W| candidates, and it stops at the window. [Discovery] §3.4 Proposition 3.17(i).

                  theorem ReflectiveSubsystems.Learner.windowPoolLearner_missCount_le {C b m : ℕ} (hb : 2 ≤ b) (hbm : b ≤ m) {v : ℕ → Fin C → Bool} {y : ℕ → Bool} (hr : FiniteLearner.Realizable v y) (n : ℕ) :
                  (windowPoolLearner C b m).missCount v y n ≤ (C - 1) / ((b + 3) / 4) + ((C - 1) / m + 1) * Nat.log 2 b

                  The count of the window-pool learner. Over every realizable stream and at every horizon n, the learner has missed at most ⌊(C - 1) / ⌈b / 4⌉⌋ + (⌊(C - 1) / m⌋ + 1) * ⌊log₂ b⌋ times, with ⌈b / 4⌉ written (b + 3) / 4. The candidate that realizes the stream is never removed from the pool; a miss at a pool of at least ⌈b / 2⌉ members removes at least ⌈b / 4⌉ of the admitted candidates, and each of the phases in which the pool is smaller than that, those begun at a flush and the one after the last candidate is admitted, halves the pool at every miss and so holds at most ⌊log₂ b⌋ misses; a flush begins when a refill stops at the window, so the k-th begins at a first unadmitted candidate of at least k * m. [Discovery] §3.4 Proposition 3.17(i).

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

                  The assembly of the window-pool learner as a finite-state learner, its states those of windowPoolStates and its count that of windowPoolLearner_missCount_le. [Discovery] §3.4 Proposition 3.17(i).

                  theorem ReflectiveSubsystems.Learner.windowPoolLearner_missCount_le_clog {C b : ℕ} (hb : 2 ≤ b) {v : ℕ → Fin C → Bool} {y : ℕ → Bool} (hr : FiniteLearner.Realizable v y) (n : ℕ) :
                  b * (windowPoolLearner C b (b * Nat.clog 2 b)).missCount v y n ≤ 5 * (C - 1) + b * Nat.log 2 b

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

                  theorem ReflectiveSubsystems.Learner.windowPoolLearner_missCount_le_nonvacuous :
                  ∃ (C : ℕ) (b : ℕ) (m : ℕ), 2 ≤ b ∧ b ≤ m ∧ (C - 1) / ((b + 3) / 4) + ((C - 1) / m + 1) * Nat.log 2 b < C - 1

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