Documentation

CslibFrontier.Probability.DDGTree.Digits

A coin of any bias from fair bits, by comparing with its binary digits #

This module formalizes only the unbounded coin-reading tree (Cslib.Probability.DDGTree) and weighted-series steps after [AB07], Lemma 7.14 (2007 draft numbering, §7.4, printed p. 124 / PDF p. 140). It does not construct a probabilistic Turing machine or bound Turing.MultiTapePTM.expectedTime; the machine-level expected-O(1) running-time statement of Lemma 7.14 remains open under #9192 (and #4711).

Let d : ℕ → Bool be a binary expansion of ρ = ∑ᵢ dᵢ 2^{-(i+1)}. Every ρ ∈ [0, 1] has one; ρ = 1 uses the expansion 0.111⋯. The tree coinOfDigits d reads fair bits b₀ b₁ ⋯ and compares them with d₀ d₁ ⋯. At the first index i with bᵢ ≠ dᵢ it outputs dᵢ, that is, whether the uniform number 0.b₀b₁⋯ lies below ρ. It outputs true with probability exactly ρ (coinOfDigits_generates). It is still running after n flips exactly when the first n bits match, with probability 2⁻ⁿ. Hence it reads exactly 2 fair bits in expectation (expectedFlips_coinOfDigits), independently of ρ.

For any caller-supplied weight function w : ℕ → ℝ≥0∞ charged at flip n + 1, the expected weighted sum along coinOfDigits d is ∑ₙ w n 2⁻ⁿ (expectedCostWith_coinOfDigits), which is finite for every polynomially bounded w : ℕ → ℕ (expectedCostWith_coinOfDigits_lt_top). These are purely analytic series bounds for an arbitrary weight w, not Turing-machine running-time bounds.

Main definitions #

Main results #

References #

Compare fair bits with the digits d, and output the digit at the first disagreement.

The tree that compares fair bits with the binary digits d of a bias and outputs the digit at the first disagreement.

theorem Cslib.Probability.DDGTree.run_coinOfDigits (n : ℕ) (d : ℕ → Bool) :
((coinOfDigits d).run n) none = 2⁻¹ ^ n ∧ ∀ (x : Bool), ((coinOfDigits d).run n) (some x) = ∑ i ∈ Finset.range n, if d i = x then 2⁻¹ ^ (i + 1) else 0

The masses after n fair bits: still comparing with probability 2⁻ⁿ, and having output x with the probability of the first disagreement among the first n digits being at a digit x.

The comparison stops with probability one: it is running after n bits with probability 2⁻ⁿ.

theorem Cslib.Probability.DDGTree.coinOfDigits_generates {d : ℕ → Bool} {ρ : ↑unitInterval} (hd : HasSum (fun (i : ℕ) => if d i = true then 2⁻¹ ^ (i + 1) else 0) ↑ρ) :

Intermediate DDG-tree output-law step (after [AB07], Lemma 7.14; not the full probabilistic Turing-machine theorem, tracked in #9192): if d is a binary expansion of ρ, the digit-comparison tree generates the coin of bias ρ from fair bits.

Analytic weighted-series identity for coinOfDigits (not a Turing-machine running-time bound): for any digit sequence d and any caller-supplied weight w : ℕ → ℝ≥0∞ charged at flip n + 1, the expected weight is ∑ₙ w n 2⁻ⁿ.

Intermediate DDG-tree flip-count step (after [AB07], Lemma 7.14; counts fair coin flips only, not Turing-machine steps, tracked in #9192): the digit-comparison tree reads exactly two fair bits in expectation, for every digit sequence d.

Analytic weighted-series finiteness step (not a Turing-machine running-time bound; the PTM theorem for [AB07], Lemma 7.14 is tracked in #9192): for any digit sequence d and any polynomially bounded weight w : ℕ → ℕ, the geometrically weighted series ∑ₙ w n 2⁻ⁿ is finite.