Documentation

CslibFrontier.Computability.Kolmogorov.MartinLof

Martin-Löf randomness, the Levin–Schnorr theorem, and Solovay tests #

This module develops the general theory of Martin-Löf randomness on infinite binary sequences ℕ → Bool under Cslib.BitString.coinFlips, proving the remaining directions of [LV19] and [SUV17] on top of ChaitinOmega.lean:

Main definitions #

Main results #

References #

Left-c.e. measure of effectively open cylinder unions #

Exact coinFlips measure in ℚ of the finite cylinder union ⋃ w ∈ L, prefixCylinderList w.

The real value of finitePrefixMass L equals the coinFlips-measure of the finite cylinder union ⋃ w ∈ L, prefixCylinderList w.

Every finite cylinder union mass finitePrefixMass L is nonnegative.

Every finite cylinder union mass finitePrefixMass L is at most 1.

Stage-t distinct prefix list enumerated by partial recursive code e.

Uniformly computable monotone rational lower approximant to the coinFlips-measure of the effectively open union ⋃ w ∈ {w | (e.eval (encode w)).Dom}, prefixCylinderList w. Because ℚ has no canonical Mathlib Primcodable instance, uniform computability of the exact dyadic numerator/denominator pair representing (reCoverMass e t : ℝ) is stated in exists_computable_approx_coinFlips_of_rePred.

Each rational approximant reCoverMass e t is nonnegative.

Left-c.e. measure of effectively open cylinder sets: uniformly in a code e, the rational approximants reCoverMass e t converge from below to the coinFlips-measure of ⋃ w ∈ {w | (e.eval (encode w)).Dom}, prefixCylinderList w.

Every approximant reCoverMass e t bounds (Cslib.BitString.coinFlips (⋃ w ∈ {w | (e.eval (encode w)).Dom}, prefixCylinderList w)).toReal from below.

theorem Cslib.Kolmogorov.exists_computable_approx_coinFlips_of_rePred {S : Set (List Bool)} (hS : REPred fun (x : List Bool) => x ∈ S) :
∃ (num : ℕ → ℕ) (den : ℕ → ℕ), Computable num ∧ Computable den ∧ (∀ (t : ℕ), 0 < den t) ∧ (Monotone fun (t : ℕ) => ↑(num t) / ↑(den t)) ∧ Filter.Tendsto (fun (t : ℕ) => ↑(num t) / ↑(den t)) Filter.atTop (nhds (BitString.coinFlips (⋃ w ∈ S, prefixCylinderList w)).toReal)

Every computably enumerable prefix set S : Set (List Bool) has a computable monotone rational sequence converging from below to (coinFlips (⋃ w ∈ S, prefixCylinderList w)).toReal.

Capped effective tests and a universal Martin-Löf test #

A universal Martin-Löf randomness test, combining every effective randomness test i : ℕ with shifted tolerance (m + i + 1) so its level-m union has measure at most 2⁻¹ ^ m.

Universality of universalMartinLofTest: every Martin-Löf test T has a constant index shift d such that level m + d of T is contained in level m of universalMartinLofTest.

An infinite sequence x is Martin-Löf random if and only if it passes universalMartinLofTest.

Full measure of Martin-Löf randomness: coinFlips-almost every infinite binary sequence is Martin-Löf random.

The Levin–Schnorr theorem #

Levin–Schnorr randomness theorem (converse direction) [LV19], [SUV17]: every Martin-Löf random infinite bit sequence x has prefix-free incompressible initial segments n ≤ K(x ↾ n) + c for a uniform constant c.

Levin–Schnorr theorem: an infinite bit sequence x is Martin-Löf random if and only if every initial segment x ↾ n has prefix-free complexity at least n - c for some constant c.

Extended-natural (ℕ∞) form of the Levin–Schnorr theorem.

universalPrefixBits has a partial recursive evaluator.

theorem Cslib.Kolmogorov.isMartinLofRandom_iff_exists_le_ecomplexity_of_optimal {U : DescriptionMethod (List Bool)} (hU_min : U.MinorizesPrefixPartrec) (hU_pf : U.IsPrefixFree) {eval : List Bool →. List Bool} (heval : Partrec eval) (hprod : ∀ (p w : List Bool), U.Produces p w ↔ w ∈ eval p) (x : ℕ → Bool) :
IsMartinLofRandom x ↔ ∃ (c : ℕ), ∀ (n : ℕ), ↑n ≤ U.ecomplexity (List.ofFn fun (i : Fin n) => x ↑i) + ↑c

Machine-invariant Levin–Schnorr theorem: for every prefix-free partial recursive description method U on binary strings that minorizes all prefix-free partial recursive decoders, IsMartinLofRandom x is equivalent to n ≤ K_U(x ↾ n) + O(1).

theorem Cslib.Kolmogorov.isMartinLofRandom_iff_exists_le_complexity_of_optimal {U : DescriptionMethod (List Bool)} (hU_min : U.MinorizesPrefixPartrec) (hU_pf : U.IsPrefixFree) {eval : List Bool →. List Bool} (heval : Partrec eval) (hprod : ∀ (p w : List Bool), U.Produces p w ↔ w ∈ eval p) (x : ℕ → Bool) :
IsMartinLofRandom x ↔ ∃ (c : ℕ), ∀ (n : ℕ), n ≤ U.complexity (List.ofFn fun (i : Fin n) => x ↑i) + c

Natural-number form of the machine-invariant Levin–Schnorr theorem.

Solovay tests and equivalence with Martin-Löf randomness #

A Solovay randomness test [LiVitanyi2019, ShenUspenskyVereshchagin2017]: a computably enumerable collection of binary prefixes whose cylinder measures have finite sum.

A sequence x : ℕ → Bool passes the Solovay test S when it falls into only finitely many cylinders generated by S.cover.

Every Martin-Löf random sequence passes every Solovay test.

Solovay completeness: any sequence x : ℕ → Bool passing every SolovayTest is Martin-Löf random [LiVitanyi2019, ShenUspenskyVereshchagin2017].

Characterization by Solovay tests [LiVitanyi2019, ShenUspenskyVereshchagin2017]: an infinite bit sequence x is Martin-Löf random if and only if it passes every SolovayTest.

Borel's strong law of large numbers for Martin-Löf random sequences #

theorem Cslib.Kolmogorov.tendsto_freq_true_of_isMartinLofRandom {x : ℕ → Bool} (hx : IsMartinLofRandom x) :
Filter.Tendsto (fun (n : ℕ) => ↑(List.count true (List.ofFn fun (i : Fin n) => x ↑i)) / ↑n) Filter.atTop (nhds (1 / 2))

Borel's strong law of large numbers for Martin-Löf randomness [LiVitanyi2019, ShenUspenskyVereshchagin2017]: every Martin-Löf random infinite binary sequence x is simply normal in base 2, with asymptotic frequency 1 / 2 of true bits.

Borel normality of Chaitin's Ω: the binary expansion of chaitinOmega universalPrefix has limiting bit frequency 1 / 2.