Random typing produces a power law in rank (Li's model)
ProvedZipfLaw.monkey_typing_power_lawConsider a monkey typing on a keyboard with letter keys, each pressed with the same probability , and a space bar pressed with probability . The probability that the word following a space is exactly the string of letters is . List all nonempty words in order of non-increasing probability, (ties in any order). Then the probability of the word of rank obeys a power law in : with there are constants such that for all
Formalization Note. Ranks are -indexed in Lean: the rank order is a bijection along which is non-increasing, and the bound is stated with .
import Mathlib import Definitions.Def_ZipfLaw_Defs
namespace ZipfLaw
theorem monkey_typing_power_law (m : ℕ) (hm : 2 ≤ m) (q : ℝ) (hq : 0 < q) (hmq : (m : ℝ) * q < 1)
(e : ℕ → List (Fin m)) (he_inj : Function.Injective e)
(he_range : Set.range e = {w | w ≠ []})
(he_sorted : Antitone (fun r => monkeyWordProb m q (e r))) :
∃ C₁ C₂ : ℝ, 0 < C₁ ∧ 0 < C₂ ∧ ∀ r : ℕ,
C₁ * ((r : ℝ) + 1) ^ (-Real.logb m (1 / q)) ≤ monkeyWordProb m q (e r) ∧
monkeyWordProb m q (e r) ≤ C₂ * ((r : ℝ) + 1) ^ (-Real.logb m (1 / q)) := by sorry
end ZipfLawRead-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) - non-blind, same agent as the drafter
Non-blind read-back — not independent testimony. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted the Lean statement, with full knowledge of the source article and of the intended meaning. It is not a blind audit by an independent reader, and no reviewer should treat it as one. Please compare it against the Lean code yourself.
Let be a natural number, a real with and . Let be a function from to finite lists over an -letter alphabet which is injective, whose image is exactly the set of nonempty lists, and such that is antitone (non-increasing in ). Then there exist reals and such that for every natural :
with and real powers.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.