Exact digit counts and further occurrence-counting inequalities #
The append, take, drop, and flatten bounds extend the occurrence-counting API.
The exact periodic count and digitEquiv relate integer intervals to digit
strings. Exact counts distinguish the head position, where a positive integer
cannot start with zero, from interior positions; their sum gives a closed
formula for occurrences inside a complete cohort of equal-length numbers.
These results are exported by the project entry module as reusable infrastructure.
The normality proof itself needs only the lower bounds in DigitCount.
Sanity bridge to List.count: single-letter blocks are List.count.
Append sandwich, upper bound: at most min w.length a.length
occurrences straddle the seam (they must start within w.length − 1
slots of the end of a, and there are only a.length interior start
slots).
The seam bound with the word length as an upper bound.
The whole-list window contributes to the count.
Cutting at n loses at most w.length (seam) occurrences.
Exact interval ↔ digit-string counting #
Superseded on the main path by the lower-bound-only layer in
DigitCount.lean; see the module docstring above.
Exact periodic counting: over an interval whose endpoints are multiples
of p * q, the value n / p % q hits a fixed d < q exactly p times
per period p * q. Only the lower bound le_card_Ico_filter_div_mod
(proved directly in DigitCount.lean) feeds champernowne_normal.
Round-trip 1: reading the digits of n back yields n.
Together with the converse, this gives digitEquiv.
m-digit numbers ≃ length-m digit strings with nonzero head.
Forward map bigDigits b; inverse Nat.ofDigits b ∘ List.reverse.
The normality proof uses only lower-bound cardinality consequences.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Block w with nonzero head occurs
b^(m-k) + (m-k)·(b-1)·b^(m-k-1) times inside the digit strings of all
m-digit numbers (k := w.length).