Entropy, box counts, and cost exponents for the sharp-tail analysis
DefinitionThreeSumSharpTail_AnalysisDefines (so ), the old preprocessing saving , the sharp saving , the query exponent , and the encoding exponent . For natural numbers , defines ; later lemmas restrict to , and . These are auxiliary analytic quantities, not a replacement for the campaign's shared word-RAM or 3SUM definitions. Real logarithms and division are total in Lean; intended domains are supplied by theorem hypotheses.
import Mathlib set_option autoImplicit false set_option relaxedAutoImplicit false namespace ThreeSumSharpTail noncomputable def entropy (x : ℝ) : ℝ := -x * Real.log x - (1 - x) * Real.log (1 - x) noncomputable def oldSaving (c θ : ℝ) : ℝ := θ * Real.log ((c - 1) / 9) / Real.log 4 noncomputable def sharpSaving (c θ : ℝ) : ℝ := (c * entropy (1 / c) - c * entropy ((1 - θ) / c) - θ * Real.log 9) / Real.log 4 noncomputable def queryExponent (θ : ℝ) : ℝ := (entropy θ + θ * Real.log 9) / Real.log 4 noncomputable def encodingExponent (c : ℝ) : ℝ := (c * Real.log 10 - c * entropy (1 / c) / 2 - (c - 1) * Real.log 3) / Real.log 4 def boxCount (c m d : ℕ) : ℕ := Nat.choose (c * m) (m - d) * 9 ^ (c * m - m + d) end ThreeSumSharpTail
Read-back
What the Lean code literally says, in plain math · gpt-6
For every real number , define . Here and throughout these definitions, is the total real logarithm: it is the natural logarithm on positive arguments, is at , and equals on negative arguments. Thus is defined on all real numbers, not only , and .
For arbitrary real numbers and , define . No restriction on either argument is imposed.
For arbitrary real numbers and , define , where . Real division is total, with division by equal to , so this formula also defines .
For every real number , define , where ; there is no interval restriction on .
For every real number , define , where and division by zero is zero. In particular, is included and gives .
For all natural numbers , including zero and without assuming or , define . The subtractions inside the original natural-number expression are truncated at zero, and the exponent subtracts before adding . The binomial coefficient is zero when its lower argument exceeds its upper argument. Consequently , and if the lower binomial argument is , so ; these values are part of the definition even outside a tail range.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.