diff --git a/docs/research/COMPRESSION_HONEST_FINDINGS.md b/docs/research/COMPRESSION_HONEST_FINDINGS.md index d4afc257..d3e1c20a 100644 --- a/docs/research/COMPRESSION_HONEST_FINDINGS.md +++ b/docs/research/COMPRESSION_HONEST_FINDINGS.md @@ -124,6 +124,27 @@ Compressed-sensing bound `k* ≈ d/(2 ln N) = 9`. **An LLM "drops data recoverab the sparse regime** — recoverability is bought entirely by sparsity, not free compression. Past the bound → polysemantic interference → data lost. Dense/random data goes to chance. +### 7. π as a "tape LUT" — pointer-into-π is as big as the data +Idea: store data as the **offset** where it appears in π's digits instead of the data +itself. Measured on **real π** (1,000,000 digits, `pi_tape_lut.py`): the first-occurrence +position of a random k-digit string sits at ~10^k, so the offset needs ~k digits — the +**same size as the data**. + +| k (data digits) | avg 1st-occurrence position | offset digits (log₁₀ pos) | +|---|---|---| +| 1 | 9 | 0.96 | +| 2 | 118 | 2.07 | +| 3 | 983 | 2.99 | +| 4 | 10,007 | 4.00 | +| 5 | 109,256 | 5.04 | + +Slope is exactly 1: the pointer-into-π **is** the data's rank in another base — base +conversion, zero gain. The one genuinely special thing about π is the **BBP formula** +(compute the n-th hex digit without the previous ones, O(n log n), tiny space), so π is a +random-access tape you never store — but random *access* is free while the *address* is +not: BBP makes the shelf free, the call number is still as long as the book. (π-normality +is also only conjectured, so "every string appears" is not proven.) + ## Bottom line Structure (sparsity/redundancy) is the only thing **any** method — polynomial, mass-number, diff --git a/scripts/compression/README.md b/scripts/compression/README.md index efc360cb..a616ad37 100644 --- a/scripts/compression/README.md +++ b/scripts/compression/README.md @@ -13,6 +13,7 @@ straw baselines. Python 3 + numpy only (stdlib `lzma`/`gzip` for baselines). | `frozen_model_compress.py` | conservation law: frozen model + AC, model-column vs tape-column, self-contained vs amortized | | `mass_number_compress.py` | Semantic Mass Number = base conversion (bijection), M1/M2/M3 vs xz | | `superposition_recovery.py` | capstone: compressed-sensing recovery vs sparsity — recoverable ⟺ sparse cliff | +| `pi_tape_lut.py` | π as a tape LUT: offset-into-π (real π digits) is the same size as the data — base conversion | Most default to a local text corpus path; pass a directory as `argv[1]` to point elsewhere. `entropy_full.py`/`ac_roundtrip.py` expect an `enwik8` file diff --git a/scripts/compression/pi_tape_lut.py b/scripts/compression/pi_tape_lut.py new file mode 100644 index 00000000..1190a5f7 --- /dev/null +++ b/scripts/compression/pi_tape_lut.py @@ -0,0 +1,43 @@ +""" +"Use the pi digit sequence as a tape LUT": store data as the OFFSET where it +appears in pi, instead of the data itself. Test on REAL pi digits. + +Claim under test: the offset is ~the same size as the data, so nothing is saved. +Reason: in a normal (random-looking) base-b sequence, an L-symbol string first +appears near position b^L on average, so the offset needs ~L*log2(b) bits = +exactly the data's size. Pointer-into-pi = base conversion = conservation. +""" +import mpmath, random, math + +D = 1_000_000 # decimal digits of pi to use as the tape +mpmath.mp.dps = D + 20 +s = mpmath.nstr(mpmath.mp.pi, D + 10, strip_zeros=False).replace("3.", "", 1).replace(".", "") +s = s[:D] +print(f"pi tape: {len(s)} decimal digits\n") + +random.seed(0) +print(f"{'k (data digits)':>16}{'trials found':>14}{'avg 1st-occ pos':>18}" + f"{'log10(pos)':>12}{'offset digits':>15}") +print("-" * 76) +for k in range(1, 7): + positions = [] + trials = 300 + found = 0 + for _ in range(trials): + target = "".join(random.choice("0123456789") for _ in range(k)) + idx = s.find(target) + if idx >= 0: + positions.append(idx + 1) # 1-based position + found += 1 + if positions: + avg = sum(positions) / len(positions) + off_digits = math.log10(avg) + print(f"{k:>16}{found:>10}/{trials}{avg:>18.0f}{math.log10(avg):>12.2f}" + f"{off_digits:>15.2f}") + else: + print(f"{k:>16}{found:>10}/{trials}{'(none in tape)':>18}") + +print("\nRead-off: 'offset digits' ~= 'k data digits' at every row -> the pointer into") +print("pi is the SAME size as the data it points to. Base conversion, zero gain.") +print("(k=6 needs ~10^6 positions ~ the whole 10^6-digit tape; beyond it you must") +print(" extend pi further, and the offset only grows to match the data exactly.)")