Documentation

Complexitylib.Classes.PCP.Internal.AlgLog

A ruler of logarithmic length #

Amplification runs logarithmically many rounds, and the bounded-iteration rule counts rounds by the length of a string. So an algorithm needs to write a string whose length is the logarithm of its input's — the one shrinking step the rest of the development never needed.

The construction folds over the input carrying two counters: a ruler, and a threshold that doubles. Every time the number of bits read reaches the threshold, the ruler gains a mark and the threshold doubles, so the ruler counts the doublings.

Main definitions #

Main results #

How long the ruler is after reading n bits: it gains a mark exactly when the count reaches the next power of two.

Equations
Instances For
    noncomputable def Complexity.logStep (z : List Bool) :

    One step of the ruler fold, on pair (pair W acc) t where acc is pair ruler threshold: on reaching the threshold, add a mark and double.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Complexity.log_lt_rulerLen (n : ℕ) (hn : n ≠ 0) :

      The ruler is at least the binary logarithm.

      theorem Complexity.rulerLen_pos {n : ℕ} (hn : 0 < n) :
      theorem Complexity.rulerLen_le_log (n : ℕ) :
      rulerLen n ≤ Nat.log 2 (2 * n + 1)

      The ruler is at most a logarithm: 2 ^ rulerLen n ≤ 2n + 1.

      theorem Complexity.rulerLen_bigO_log {N : ℕ → ℕ} {A B : ℕ} (hN : ∀ (n : ℕ), N n ≤ A * (n + 1) ^ B) :
      BigO (fun (n : ℕ) => rulerLen (N n)) fun (n : ℕ) => Nat.log 2 n

      A ruler over a polynomially bounded quantity is logarithmic.

      The fold's value after reading a list.

      noncomputable def Complexity.logRuler (z : List Bool) :

      A ruler of logarithmic length.

      Equations
      Instances For

        The ruler is as long as the fold says.