# Codebook - The codebook experiment: a catalog of atoms in three classes, greedy matching pursuit under a minimum-description-length score on four bit images of side 243, and the bits each class buys, with `zlib` beside it as the control. The honest quantity is bits saved against `zlib`, never compression achieved. - Class K, Kronecker tiles: all 16 base-2 plane designs at level 1 and their Kronecker squares, and the 101 nonempty square-group orbits of the 511 nonempty base-3 plane codes at level 1 and level 2, so `2 x 2`, `4 x 4`, `3 x 3` and `9 x 9`. A code is the cell bitmask of [core](../../../notes/core.md), bit `base*(i mod base) + (j mod base)`, and the base-2 carpet rendered at side 3 is base-3 code 495. - Class M, magic designs: the two-letter words over the tile-source letters `carpet 7, net 14, htree 3, vtree 5, void 9` of [magic](../../../notes/magic.md) at side pairs `(3,5)`, `(5,3)`, `(3,7)`, `(7,3)`, so `15 x 15` and `21 x 21`, `magic(3,5)` among them. `magic(3,5,7)` has side 105 and does not fit a `32 x 32` window, so the three-letter words are out by the size rule. - Class L, life frames: eight named rules of [automata](../../../notes/automata.md) on a wrapped `16 x 16` grid, from one centre cell and seven seeded random grids, generations 1 to 6. - The three families are de-duplicated as one catalog before anything is counted: 718 atoms built, 25 duplicates and 26 dead frames dropped, 667 kept. - The corpora: the tree's own render `bang dim 2, code 7` at level 5; the first 7382 bytes of `research/README.md` unpacked MSB first and reshaped square; uniform bits from a printed seed; and a bilevel natural-image proxy, the radial gradient `1 - r` ordered-dithered by the `4 x 4` Bayer matrix. The text row's bit counts follow whatever bytes that file currently holds; its verdict, that nothing is placed, does not. - The score, in bits: a placement of an atom of `n` cells with `d` mismatches costs `log2(A) + log2(P) + log2(n+1) + log2(C(n,d))`, where `A` is the catalog size and `P` the legal positions for that atom, and replaces the `n` raw bits of its window. The uncovered plane is coded raw or enumeratively, `log2(U+1) + log2(C(U,u))`, whichever is shorter, plus one flag bit; the placement count costs `log2(N+1)`; the encoder emits either the pursuit or the placement-free description, whichever is shorter, plus one mode bit. The code is decodable as written and its bit counts are real-valued, an idealised arithmetic code. - The pursuit: placements never overlap, the mismatch count of every atom at every position comes from one FFT correlation plus an integral image, and the greedy takes candidates in descending saving per cell. The saving per placement key is run beside it and printed, because it is strictly worse. - Every corpus asserts its reconstruction: the atoms, their mismatch masks and the uncovered bits rebuild the corpus cell for cell. The FFT mismatch count is checked against a direct window comparison on 800 sampled placements. The saving decomposes exactly as atom bits minus header plus residual credit. - The identification half runs the rearrangement of Van Loan and Pitsianis: a matrix cut into `p x q` blocks becomes the `pq` by `p'q'` matrix of vectorised blocks, `R(B (x) C) = vec(B) vec(C)'`, so the nearest Kronecker product is the rank-one SVD of `R` and the singular values are the data's Kronecker spectrum. The study reads the code off the thresholded rank-one factor at four splits, peels a five-letter magic word, and sweeps a bit-flip rate against the recovered code. - A block-mean detector is run beside it as an independent baseline, because its failure point is a closed form in the fill law and not a measurement. ## RUN - `uv run python research/lab/py/codebook/codebook.py` - Domain: 667 atoms at catalog depth 2 and 970 at depth 5, four corpora of `243 x 243 = 59049` bits, up to 3453145 scored candidate placements per corpus, and 51 noise levels at 40 seeds each; about thirty seconds, prints only, writes nothing. ## WITNESSES - information.md the object: the rearrangement `R` at split `base^level`, the identity `R(B (x) C) = vec(B) vec(C)^T`, and `sigma_1 = ||A||_F` on a render of one design. - information.md identification: `sigma_1 = 181.0193` with `sigma_2/sigma_1` of `9.938e-16, 3.215e-15, 1.387e-16, 6.608e-16` at splits `3, 9, 27, 81` on the level-5 carpet, the factors the carpet at levels `1, 2, 3, 4` outside and `4, 3, 2, 1` inside, the code `495` at the `3 x 3` split. - information.md identification: the peel of `carpet(3), void(3), net(3), htree(3), vtree(3)` at side 243 into `495, 341, 186, 455, 365`, with `sigma_2/sigma_1` of `5.1e-16, 7.1e-16, 1.6e-16, 7.9e-17`. - information.md identification: the noise dial over 51 rates at 40 seeds each, the rank-one factor 40/40 to `p = 0.30`, 12/40 at `0.31`, 0/40 from `0.32`, the block mean 40/40 to `0.26`, 39 at `0.27`, 25 at `0.28`, 0 from `0.29`. - information.md identification: the block-mean closed form `f/(1 + 2f) = 0.277638` at `f = (8/9)^4 = 0.624295`, derived from the fill law and not from the sweep. - information.md identification: `sigma_2/sigma_1` of `0.0000, 0.1524, 0.2205, 0.2738, 0.3087, 0.3242` at `p = 0.00, 0.10, 0.20, 0.30, 0.40, 0.50`, the recovered code `495` through the first four and `511` at the last two. - information.md the codebook: 718 atoms built, 25 duplicates and 26 dead frames dropped, 667 kept, split `15, 101, 15, 101` Kronecker, `50, 50` magic, `335` life. - information.md the codebook: the cell floor, `log2(667) = 9.3815` and `log2(59049) = 15.8496`, no atom below 31 cells ever placed, 131 of the 667 dead by arithmetic. - information.md the codebook: the four-corpus table, ones `32768, 26434, 29658, 15330`, `zlib` `9256, 27232, 59096, 6304`, codebook `26468, 58607, 59067, 37521`, so `-17212, -31375, +29, -31217`, with deflate expanding the random stream by 47 bits. - information.md the codebook: the tree render at 569 placements, 51864 of 59049 cells covered, a placement-free 58559, `K/M/L = 26536, 0, 5755` of 32292 atom bits, `bang dim 2, base 3, code 495` at 432 placements for 21387 bits, `bang dim 2, base 3, code 7` at 72 for 3565 and `bang dim 2, base 3, code 511` at 32 for 1584, and `rule birth [1 3 5 7], survive [1 3 5 7], wrap` at density `8/256` for 5755. - information.md the codebook: the halftone's 188 placements at `K/M/L = 1171, 2147, 16246`, its five life frames running density `0.0312` to `0.0977`. - information.md the codebook: the two greedy keys, 569 placements for a 32581 saving at `26536, 0, 5755` against 137 for 16435 at `1980, 5994, 5755`. - information.md the codebook: the depth ladder, atoms `667, 768, 869, 970` at `log2 A` `9.3815, 9.5850, 9.7632, 9.9218`, codebook bits `26468, 7418, 2305, 44`, against `zlib` `-17212, +1838, +6951, +9212`, placements `569, 125, 33, 1`, the random control at `-18` and zero placements throughout. - information.md where the numbers live: up to 3453145 candidate placements scoring positive on one corpus, the FFT mismatch count against a direct window comparison on 800 sampled placements with no failures, and an exact reconstruction asserted on every corpus.