Documentation

ReflectiveSubsystems.ParityLearner

Parities over a finite-state learner #

[Discovery] §3.4 prices the count of a finite-state learner over a hypothesis class H : Fin C → X → Bool on a domain, a point x giving the learner the vector fun c => H c x (Proposition 3.20). This file takes the class of the parities on the cube: the domain X = Fin n → Bool, the 2 ^ n hypotheses the parities y, labelling the point a by ⊕ᵢ (a i && y i), indexed through one fixed equivalence parityIndex.

Main results #

A probability is a ratio of cardinalities of finite sets, written additively; no measure theory enters.

The dot product of two points of the cube. The parity of the number of coordinates at which both are true, the dot product in the Boolean ring that Cslib.BitString.hadamardCode tabulates: parityDot a y = hadamardCode y a.

Equations
Instances For

    The indexing of the parities. The 2 ^ n points of the cube as the first 2 ^ n numbers, a point read as a number written in binary.

    Equations
    Instances For
      def ReflectiveSubsystems.parityClass (n : ℕ) (c : Fin (2 ^ n)) (a : Fin n → Bool) :

      The class of the parities. The parity y, indexed by c through parityIndex, labels the point a by the dot product of a and y.

      Equations
      Instances For
        def ReflectiveSubsystems.parityPoint {n : ℕ} (v : Fin (2 ^ n) → Bool) :
        Fin n → Bool

        The point a vector of the class's predictions belongs to. The vector fun c => parityClass n c a of the point a has at the index of the i-th unit parity the coordinate a i, so the point is read back from its vector.

        Equations
        Instances For
          def ReflectiveSubsystems.parityExt {n t : ℕ} (x : Fin t → Fin n → Bool) :
          ℕ → Fin n → Bool

          A sample extended to a stream. The first t points a sample gives, then a fixed default point, the one with every coordinate false; a learner's state at time t reads the first t points only.

          Equations
          Instances For
            def ReflectiveSubsystems.parityRun {n : ℕ} {S : Type} (start : S) (tr : S → (Fin n → Bool) → Bool → S) (xs : ℕ → Fin n → Bool) (k : Fin (2 ^ n)) :
            ℕ → S

            The run of a streaming algorithm over the parities. The state after reading, in order, the points of the stream xs with the labels the parity indexed by k gives them.

            Equations
            Instances For

              The elimination learner over the parities. Its states are n rows, each a point with a bit, a row (0, false) being empty. It predicts at the point a the label of the first parity satisfying every row (false when none does), and at a miss at a with outcome b writes (a, b) into the first empty row, nothing when none is empty; at a hit it stays. It reads the point a from the vector of the class's predictions with parityPoint.

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

                The elimination learner as an online learner #

                theorem ReflectiveSubsystems.FiniteLearner.parityElimination_missCount_le (n : ℕ) (xs : ℕ → Fin n → Bool) (k : Fin (2 ^ n)) (N : ℕ) :
                (parityElimination n).missCount (fun (t : ℕ) (c : Fin (2 ^ n)) => parityClass n c (xs t)) (fun (t : ℕ) => parityClass n k (xs t)) N ≤ n

                The elimination learner misses at most n times. On every stream of points and for every parity, the count of the elimination learner to every horizon is at most n: each miss fills a row and halves the set of parities satisfying the rows, and a set that has halved n times is the realizer alone.

                The elimination learner has 2 ^ (n * (n + 1)) states: n rows, each a point of the cube and a bit.

                The reduction #

                theorem ReflectiveSubsystems.FiniteLearner.exists_decoder_of_parity_missCount_le {n : ℕ} (L : FiniteLearner (2 ^ n)) (M m : ℕ) (hm : 0 < m) (hM : ∀ (xs : ℕ → Fin n → Bool) (k : Fin (2 ^ n)) (N : ℕ), L.missCount (fun (t : ℕ) (c : Fin (2 ^ n)) => parityClass n c (xs t)) (fun (t : ℕ) => parityClass n k (xs t)) N ≤ M) :
                ∃ t < m, ∃ (dec : L.S → Fin (2 ^ n)), m * {p : Fin (2 ^ n) × (Fin t → Fin n → Bool) | dec (L.state (fun (s : ℕ) (c : Fin (2 ^ n)) => parityClass n c (parityExt p.2 s)) (fun (s : ℕ) => parityClass n p.1 (parityExt p.2 s)) t) ≠ p.1}.card ≤ 4 * M * (2 ^ n * (2 ^ n) ^ t)

                A learner whose count is bounded on every stream recovers the parity. Over the parities, if the count of L is at most M on every stream of points and every parity, then for every m > 0 there are a step t < m and a decoder from the states to the parities such that, over the pairs of a parity and a sample of t points, the decoder fails on the state L reaches after the sample, with the parity's labels, for at most 4 * M / m of the pairs: the count of failures, times m, is at most 4 * M times the number of pairs. The states, the pairs and the sample's extension to a stream by a default point are as in parityExt. The count bound is that of [Discovery] §3.4 Proposition 3.20's setting, over the class parityClass n.

                theorem ReflectiveSubsystems.FiniteLearner.exists_decoder_of_parity_missCount_le_nonvacuous (n : ℕ) :
                (∀ (xs : ℕ → Fin n → Bool) (k : Fin (2 ^ n)) (N : ℕ), (parityElimination n).missCount (fun (t : ℕ) (c : Fin (2 ^ n)) => parityClass n c (xs t)) (fun (t : ℕ) => parityClass n k (xs t)) N ≤ n) ∧ ∃ t < 1, ∃ (dec : (parityElimination n).S → Fin (2 ^ n)), 1 * {p : Fin (2 ^ n) × (Fin t → Fin n → Bool) | dec ((parityElimination n).state (fun (s : ℕ) (c : Fin (2 ^ n)) => parityClass n c (parityExt p.2 s)) (fun (s : ℕ) => parityClass n p.1 (parityExt p.2 s)) t) ≠ p.1}.card ≤ 4 * n * (2 ^ n * (2 ^ n) ^ t)

                The hypotheses of the reduction hold together. At every n, the elimination learner meets the count bound with M = n on every stream (parityElimination_missCount_le), and for the sample size m = 1 the reduction gives its decoder, at the step t = 0.

                Raz's time-space lower bound for parity learning, in counting form (an assumption). Raz, "Fast Learning Requires Good Memory: A Time-Space Lower Bound for Parity Learning" (arXiv:1602.05161), Theorem 1, p. 4: for every c < 1/20 there is α > 0 such that any algorithm that reads t ≤ 2 ^ (α * n) samples (a, ⟨a, y⟩), a and y uniform over the cube of dimension n, and has at most c * n ^ 2 bits of memory, recovers y with probability O (2 ^ (-α * n)), the constant of the O being K. Here a probability is a ratio of the numbers of pairs (y, sample) and the memory a finite type of at most 2 ^ (c * n ^ 2) states: for every n ≥ n₀, every t ≤ 2 ^ (α * n), every such state type with a start state, a transition reading a point and its label, and an output, the pairs at which the output after the t labelled points is the parity number at most K * 2 ^ (-(α * n)) times the number of all pairs. It is assumed, not proved, in every statement that takes it as a hypothesis.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem ReflectiveSubsystems.FiniteLearner.parity_floor_le_missCount {c α K : ℝ} {n₀ : ℕ} (hRaz : RazParityBound c α K n₀) (hα : 0 < α) :
                  ∃ (n₁ : ℕ), ∀ (n : ℕ), n₁ ≤ n → ∀ (L : FiniteLearner (2 ^ n)), ↑(Fintype.card L.S) ≤ 2 ^ (c * ↑n ^ 2) → ∀ (M : ℕ), (∀ (xs : ℕ → Fin n → Bool) (k : Fin (2 ^ n)) (N : ℕ), L.missCount (fun (t : ℕ) (j : Fin (2 ^ n)) => parityClass n j (xs t)) (fun (t : ℕ) => parityClass n k (xs t)) N ≤ M) → ⌊2 ^ (α * ↑n)⌋₊ ≤ 8 * M

                  A few-state learner over the parities misses many times, given Raz's bound. If the time-space lower bound for parity learning holds in the form RazParityBound c α K n₀ with α > 0, then from some dimension n₁ on, every learner over the 2 ^ n parities with at most 2 ^ (c * n ^ 2) states whose count is at most M on every stream of points and every parity has ⌊2 ^ (α * n)⌋₊ ≤ 8 * M: the reduction exists_decoder_of_parity_missCount_le turns it, at the sample size m = ⌊2 ^ (α * n)⌋₊, into a streaming algorithm with that many states that recovers the parity except with probability 4 * M / m, and the bound limits the algorithms with at most m samples to K * 2 ^ (-(α * n)). The statement is conditional on RazParityBound, an assumed bound that is not proved here.