Documentation

ReflectiveSubsystems.FiniteLearner

Finite-state learners: the error count is bounded exactly when the states number the candidates #

[Discovery] §3 Proposition 3.5 is the valve of one architecture: at the floored mixture the error count is bounded over every realizable task exactly when the floor condition holds. This file states the valve over every deterministic finite-state learner reading the candidates' predictions, with the capacity counted as the number of states: a learner has a bounded count on every realizable stream only if it has at least as many states as candidates, and that many states suffice.

The model #

A learner over C candidates (FiniteLearner C) is a finite type of states with a start state, a prediction pred from the state and the vector of the candidates' predictions, and a transition step on the outcome. A stream is a sequence of prediction vectors v with a sequence of outcomes y; it is realizable (FiniteLearner.Realizable) when some candidate p has v t p = y t at every t. The run (FiniteLearner.state) is the state sequence from the start, and the count to horizon n (FiniteLearner.missCount) is the number of t < n at which the prediction pred (state t) (v t) differs from y t. A state dictates a candidate (FiniteLearner.Dictates) when its prediction is that candidate's at every vector.

Main results #

The count and the states trade as follows ([Discovery] §3 Proposition 3.9): at exactly C states the least bound on the count over every realizable stream is C - 1, and each head, covering one trio of candidates, lowers the bound by one at the price of one more state. Among learners whose states each read at most four candidates the trio chain's bound is the least one at C + t states, for 3 * t ≤ C (FiniteLearner.exists_readsAtMost_missCount_le_iff); over every learner, the count is priced exactly at C and at C + 1 states (FiniteLearner.exists_card_succ_missCount_le_iff), and at no more states here.

The class is of bit predictors reading a vector of bits; the floored mixture of Proposition 3.5 is a mass predictor, and no statement here relates the two.

A deterministic finite-state learner over C candidates. A finite type of states with a start state, a prediction from the state and the vector of the candidates' predictions, and a transition from the state, that vector and the outcome.

  • S : Type

    The type of states.

  • fin : Fintype self.S

    The states are finitely many.

  • start : self.S

    The state a run starts in.

  • pred : self.S → (Fin C → Bool) → Bool

    The prediction of a state on the vector of the candidates' predictions.

  • step : self.S → (Fin C → Bool) → Bool → self.S

    The transition on the vector of the candidates' predictions and the outcome.

Instances For

    A realizable stream. Prediction vectors v and outcomes y are realizable when some candidate p predicts the outcome at every time.

    Equations
    Instances For
      def ReflectiveSubsystems.FiniteLearner.state {C : ℕ} (L : FiniteLearner C) (v : ℕ → Fin C → Bool) (y : ℕ → Bool) :
      ℕ → L.S

      The run. The state sequence from the start: the transition applied, at each time, to the current state, that time's prediction vector and that time's outcome.

      Equations
      Instances For
        def ReflectiveSubsystems.FiniteLearner.missCount {C : ℕ} (L : FiniteLearner C) (v : ℕ → Fin C → Bool) (y : ℕ → Bool) (n : ℕ) :

        The count. The number of times t < n at which the learner's prediction, from its state at time t and that time's prediction vector, differs from the outcome.

        Equations
        Instances For

          A bounded count. One bound on the count to every horizon, over every realizable stream.

          Equations
          Instances For

            A state dictates a candidate when its prediction is that candidate's at every vector.

            Equations
            Instances For
              theorem ReflectiveSubsystems.FiniteLearner.dictates_unique {C : ℕ} {L : FiniteLearner C} {s : L.S} {p q : Fin C} (hp : L.Dictates s p) (hq : L.Dictates s q) :
              p = q

              A state dictates at most one candidate. At two distinct candidates the vector set at the first and clear at the second separates their values.

              theorem ReflectiveSubsystems.FiniteLearner.exists_adversary {C : ℕ} {L : FiniteLearner C} {p : Fin C} (hp : ∀ (s : L.S), ¬L.Dictates s p) :
              ∃ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y ∧ ∀ (n : ℕ), L.missCount v y n = n

              The adversary. Against a candidate no state dictates there is a realizable stream on which the learner misses at every step: along the run, at each state a vector on which the state disagrees with the candidate, and the candidate's own value as the outcome. It is the instance of DualHelly.exists_stream_mistakes_eq at the learner read as an online learner of the vectors, the hypotheses its states' predictions and the concept class the candidates' coordinates.

              The necessity. A learner whose count is bounded on every realizable stream has at least as many states as candidates: every candidate has a state dictating it, and a state dictates at most one candidate, so choosing one dictating state per candidate is injective into the states.

              The index learner. On C states, standing on a candidate: it predicts that candidate's value, stays while that candidate is right and moves to the next candidate, up to the last, when that candidate is wrong.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem ReflectiveSubsystems.FiniteLearner.indexLearner_missCount_le {C : ℕ} {hC : 0 < C} {v : ℕ → Fin C → Bool} {y : ℕ → Bool} (hr : Realizable v y) (n : ℕ) :
                (indexLearner C hC).missCount v y n ≤ C - 1

                The index learner's sufficiency. On every realizable stream the index learner's count, to every horizon, is at most C - 1: along the run the state's index never falls, rises by one at each miss and never passes the index of a candidate that never misses, since the learner standing on that candidate does not miss.

                The index learner has a bounded count.

                The bound is attained. A learner with a bounded count exists, with exactly as many states as the necessity requires: the index learner at two candidates has a bounded count and two states.

                def ReflectiveSubsystems.FiniteLearner.padded (C : ℕ) (hC : 0 < C) (S : ℕ) (hS : C ≤ S) :

                The index learner on more states. The index learner on the first C of S states, the others never reached: states from C on predict false and stay where they are.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem ReflectiveSubsystems.FiniteLearner.padded_card (C : ℕ) (hC : 0 < C) (S : ℕ) (hS : C ≤ S) :
                  Fintype.card (padded C hC S hS).S = S

                  The padded learner has exactly the stated number of states.

                  theorem ReflectiveSubsystems.FiniteLearner.padded_boundedCount (C : ℕ) (hC : 0 < C) (S : ℕ) (hS : C ≤ S) :
                  (padded C hC S hS).BoundedCount

                  The padded index learner has a bounded count. Its run is the index learner's run carried into the first C states, with the same predictions, so it has the same count.

                  The valve. With C > 0 candidates, a deterministic finite-state learner with exactly S states and a count bounded on every realizable stream exists if and only if C ≤ S. The forward direction is the necessity; the converse is the padded index learner.

                  theorem ReflectiveSubsystems.FiniteLearner.indexLearner_missCount_unbounded_of_not_realizable (C : ℕ) (hC : 0 < C) :
                  (¬Realizable (fun (x : ℕ) (x_1 : Fin C) => false) fun (x : ℕ) => true) ∧ ∀ (n : ℕ), (indexLearner C hC).missCount (fun (x : ℕ) (x_1 : Fin C) => false) (fun (x : ℕ) => true) n = n

                  Realizability is load-bearing. On the constant stream whose vectors are all false and whose outcomes are all true, which no candidate fits, the index learner misses at every step, so no bound of the form C - 1 holds off the realizable streams.

                  The majority learner on three candidates. Three states, cycled by the transition, predicting the majority of the three candidates' predictions whatever the state.

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

                    The majority learner has three states, as many as candidates.

                    The states must dictate, not merely be many. The majority learner has as many states as candidates (card_majority) and no bounded count: no state dictates the first candidate, since the vector with the first candidate true and the others false has majority false.

                    theorem ReflectiveSubsystems.FiniteLearner.exists_missCount_ge_of_card_le {C : ℕ} (hC : 0 < C) {L : FiniteLearner C} (hcard : Fintype.card L.S ≤ C) :
                    ∃ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y ∧ ∃ (n : ℕ), C - 1 ≤ L.missCount v y n

                    The exact count at C states: the lower bound ([Discovery] §3 Proposition 3.9). At 0 < C candidates a learner with at most C states has, over some realizable stream, a count of at least C - 1 at some horizon. When its count is not bounded this is immediate. When it is bounded, the necessity makes the choice of one dictating state per candidate a bijection onto the states, so every state dictates a candidate; the stream then sets, at each of the first C - 1 steps, every candidate true except the one the current state dictates, with outcome true, so the learner misses at each of those steps, while some candidate is never set false.

                    theorem ReflectiveSubsystems.FiniteLearner.exists_missCount_le_iff {C : ℕ} (hC : 0 < C) (M : ℕ) :
                    (∃ (L : FiniteLearner C), Fintype.card L.S = C ∧ ∀ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y → ∀ (n : ℕ), L.missCount v y n ≤ M) ↔ C - 1 ≤ M

                    The exact count at C states ([Discovery] §3 Proposition 3.9). With C > 0 candidates and a bound M, a learner with exactly C states whose count is at most M on every realizable stream, at every horizon, exists if and only if C - 1 ≤ M. The forward direction is the lower bound at C states; the converse is the index learner, which has C states and count at most C - 1 (indexLearner_missCount_le).

                    The lower bound is attained. A learner with at most C states and a bounded count exists, so the lower bound's hypothesis Fintype.card L.S ≤ C is met at once with a bounded count: the index learner at two candidates.

                    def ReflectiveSubsystems.FiniteLearner.trioChain (C t : ℕ) (hC : 0 < C) (ht : 3 * t ≤ C) :

                    The trio chain ([Discovery] §3 Proposition 3.9). A learner on t + C states whose candidates fall into blocks: for each i < t the trio of candidates 3 * i, 3 * i + 1, 3 * i + 2, and then each candidate p with 3 * t ≤ p a block of its own. The states are the heads, one per trio, and the dictators, one per candidate. The entry of a block is the head of a trio and the dictator of a single candidate. The head of a trio predicts the majority of the trio's three predictions and stays while right; when wrong it moves to the dictator of a member of the trio whose prediction was the outcome if there is one, and to the entry of the next block otherwise. A dictator predicts its candidate's value and stays while right; when wrong, a dictator of a trio's member moves to the entry of the block after that trio, and a dictator of a single candidate moves to the next candidate, up to the last, as the index learner does. It starts at the first block's entry, so at t = 0 it is the index learner.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem ReflectiveSubsystems.FiniteLearner.trioChain_card (C t : ℕ) (hC : 0 < C) (ht : 3 * t ≤ C) :
                      Fintype.card (trioChain C t hC ht).S = C + t

                      The trio chain has t + C states, the heads and the dictators.

                      theorem ReflectiveSubsystems.FiniteLearner.trioChain_missCount_le {C t : ℕ} {hC : 0 < C} {ht : 3 * t ≤ C} {v : ℕ → Fin C → Bool} {y : ℕ → Bool} (hr : Realizable v y) (n : ℕ) :
                      (trioChain C t hC ht).missCount v y n ≤ C - 1 - t

                      The trio chain's count ([Discovery] §3 Proposition 3.9). On every realizable stream the trio chain's count, to every horizon, is at most C - 1 - t: along the run the state's position rises by at least one at each miss and the state never passes a candidate that never misses, so the position is at most that of the dictator of that candidate, which is 2 * i + 1 ≤ 2 * t - 1 for a member of trio i and r - t for a single candidate r.

                      theorem ReflectiveSubsystems.FiniteLearner.exists_card_eq_missCount_le {C : ℕ} (hC : 0 < C) {t : ℕ} (ht : 3 * t ≤ C) :
                      ∃ (L : FiniteLearner C), Fintype.card L.S = C + t ∧ ∀ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y → ∀ (n : ℕ), L.missCount v y n ≤ C - 1 - t

                      The count against the number of states ([Discovery] §3 Proposition 3.9). For 3 * t ≤ C a learner with exactly C + t states whose count is at most C - 1 - t on every realizable stream, at every horizon, exists: the trio chain. At t = 0 it is the index learner on C states, so with the lower bound at C states the least count at C + t states is at most C - 1 - t and at t = 0 equal to C - 1.

                      The bound is attained. At three candidates and one trio, the trio chain's count C - 1 - t is reached: on a realizable stream, candidate 2 predicts the outcome throughout while the head's majority at time 0 is wrong, so the count to horizon one is one.

                      A learner whose states each read at most k candidates. For every state there is a set of at most k candidates such that two prediction vectors agreeing on that set get the same prediction from the state. The transitions are unrestricted; only the prediction is local.

                      Equations
                      Instances For
                        theorem ReflectiveSubsystems.FiniteLearner.exists_missCount_ge_of_readsAtMost {C : ℕ} (hC : 0 < C) {L : FiniteLearner C} (hL : L.ReadsAtMost 4) :
                        ∃ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y ∧ ∃ (n : ℕ), 2 * C ≤ L.missCount v y n + Fintype.card L.S + 1

                        The lower bound among learners whose states each read at most four candidates ([Discovery] §3 Proposition 3.9). At 0 < C candidates, a learner whose states each read at most four candidates has, over some realizable stream, at some horizon, a count m with 2 * C ≤ m + S + 1, where S is its number of states; that is, a count of at least 2 * C - 1 - S, stated additively so that no truncated subtraction enters. The transitions are unrestricted.

                        The adversary keeps a set of candidates consistent with the outcomes so far, at first all of them. A state is live for the set when it is right at every vector on which the set agrees with the outcome, and free otherwise; a free state has a miss that removes no candidate. For a live state reading at most four candidates there is a miss removing one candidate or two, found by moving the indicator vector of a subset of the state's candidates one member at a time from the all-false vector, at which the state is right, to the vector at which it predicts true. A miss removing one candidate leaves the state free for the smaller set, and one removing two leaves it and the two dictators of the removed candidates free, so the live states fall by one or by three, while an absent dictator lets the adversary force a miss at every step. The set shrinks by one candidate for a drop of one live state and by two for a drop of three, so with |A| candidates left the adversary forces n misses with 2 * |A| ≤ n + (live states) + 1, and the live states number at most S.

                        What is not claimed: the bound over every learner. The argument stops at a state predicting the majority of five live candidates, at which every miss removes three.

                        theorem ReflectiveSubsystems.FiniteLearner.trioChain_readsAtMost (C t : ℕ) (hC : 0 < C) (ht : 3 * t ≤ C) :
                        (trioChain C t hC ht).ReadsAtMost 3

                        The trio chain's states each read at most three candidates ([Discovery] §3 Proposition 3.9): a head reads the three members of its trio, a dictator its one candidate.

                        theorem ReflectiveSubsystems.FiniteLearner.exists_readsAtMost_missCount_le_iff {C : ℕ} (hC : 0 < C) {t : ℕ} (ht : 3 * t ≤ C) (M : ℕ) :
                        (∃ (L : FiniteLearner C), Fintype.card L.S = C + t ∧ L.ReadsAtMost 4 ∧ ∀ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y → ∀ (n : ℕ), L.missCount v y n ≤ M) ↔ C - 1 - t ≤ M

                        The trio chain is exact among learners whose states each read at most four candidates ([Discovery] §3 Proposition 3.9). For 0 < C candidates and 3 * t ≤ C, a learner with exactly C + t states, each reading at most four candidates, whose count is at most M on every realizable stream at every horizon, exists if and only if C - 1 - t ≤ M. The forward direction is the lower bound exists_missCount_ge_of_readsAtMost, 2 * C ≤ M + (C + t) + 1; the converse is the trio chain, which has C + t states (trioChain_card), reads at most three candidates at each (trioChain_readsAtMost) and has count at most C - 1 - t (trioChain_missCount_le).

                        Both statements apply to one learner. At three candidates the trio chain with one trio has four states, each reading at most three candidates and so at most four, and a count at most one on every realizable stream; its count is one on a realizable stream (trioChain_missCount_le_nonvacuous), which is the lower bound 2 * 3 - 1 - 4 = 1 of exists_missCount_ge_of_readsAtMost attained. It is the case C = 3, t = 1, M = 1 of exists_readsAtMost_missCount_le_iff.

                        theorem ReflectiveSubsystems.FiniteLearner.exists_missCount_ge_of_card_le_succ {C : ℕ} (hC : 0 < C) {L : FiniteLearner C} (hcard : Fintype.card L.S ≤ C + 1) :
                        ∃ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y ∧ ∃ (n : ℕ), C ≤ L.missCount v y n + 2

                        One state past C buys one miss ([Discovery] §3 Proposition 3.10). At 0 < C candidates, a learner with at most C + 1 states has, over some realizable stream, a count m with C ≤ m + 2 at some horizon, that is, a count of at least C - 2, stated additively so that no truncated subtraction enters. At most C states is the lower bound at C states (exists_missCount_ge_of_card_le), and an unbounded count is immediate. A bounded count gives an injective choice of a dictating state for each candidate, so with C + 1 states exactly one state h dictates no candidate. The adversary keeps the set of candidates that have agreed with every outcome so far. At a dictator of a live candidate it presents the vector false at that candidate alone, with outcome true, a miss removing that candidate. At a state free for the set it takes a miss removing nothing. At h, with m live candidates, a miss that splits the set into two parts, chosen so that the walk of the dictators from the state the learner moves to never meets the dictators of all of either part, leaves a part the following m - 3 misses do not exhaust: m - 2 misses in all. The transitions are unrestricted and the predictions need not be local.

                        theorem ReflectiveSubsystems.FiniteLearner.exists_card_succ_missCount_le_iff {C : ℕ} (hC : 3 ≤ C) (M : ℕ) :
                        (∃ (L : FiniteLearner C), Fintype.card L.S = C + 1 ∧ ∀ (v : ℕ → Fin C → Bool) (y : ℕ → Bool), Realizable v y → ∀ (n : ℕ), L.missCount v y n ≤ M) ↔ C - 2 ≤ M

                        The exact count at C + 1 states ([Discovery] §3 Proposition 3.10). With 3 ≤ C candidates and a bound M, a learner with exactly C + 1 states whose count is at most M on every realizable stream, at every horizon, exists if and only if C - 2 ≤ M. The forward direction is the lower bound at C + 1 states (exists_missCount_ge_of_card_le_succ); the converse is the trio chain with one trio, which has C + 1 states (trioChain_card) and count at most C - 1 - 1 (trioChain_missCount_le).

                        A learner beyond the four-local class meets the bound. At five candidates, a learner with six states and a bounded count that does not read at most four candidates per state: its head predicts the majority of all five candidates, so no four of them determine its prediction, and the lower bound at one state past the candidates (exists_missCount_ge_of_card_le_succ) applies to it though the lower bound among learners reading at most four candidates (exists_missCount_ge_of_readsAtMost) does not.