# Weighted Designs - One exact generator for a weighted design, the refinement equation `phi(x) = sum_f c_f phi(base x - f)` on the `base` grid with `c_f = base^dim w_f`, taken as the measure `mu = sum_f w_f mu . S_f^(-1)`, `S_f(x) = (x + f)/base`. Input is `(base, dim, F, w)` with `F` the filled digits and `w` a probability vector of exact rationals; output is safe-rounded floats. - The object it runs by default is base 3, `dim 2`, cells `(0,0) (2,0) (0,2)`, weights `3/8, 3/8, 1/4`, level 10. Every mass at `level` is an integer over `8^level`. - THE ARITHMETIC CLASS is decided exactly, never fitted: each `w_f` becomes its vector of prime exponents, and the group generated by the `log w_f` is cyclic exactly when that integer matrix has rank 1. Rank 1 prints the span, rank 2 or more prints nonlattice. This is the input to the renewal dichotomy and is computed before any sweep runs. - The rank test holds for positive rational weights and for nothing else: only there does a weight carry a prime-exponent vector, and the criterion rests on the `Q`-linear independence of the logs of the primes, so the exponent lattice and the group generated by the `log w_f` have the same rank. An irrational weight has no such vector and the test does not run on it; the printed header carries the hypothesis and the run asserts every weight is a rational. - THE MASS SIDE is the renewal variable `-log w`. `delta` is the root of `sum_f w_f^s = 1` by bisection, and `N(a)` counts words of mass at least `e^(-a)` by exact multinomial enumeration over the distinct weight values with their multiplicities. The study prints the oscillation of `ln N(a) - delta a` over a window of `ln base` at `a = 20, 40, 60, 80, 100`, and asserts flat against a lattice class and decaying against a nonlattice one, the class having been fixed by the exponent-matrix rank. - THE LENGTH SIDE is the mass-weighted spin ripple: `M(r)` is the mass of cells within radius `r` of the corner fixed point, read as an exact integer shell histogram, detrended by `alpha = -log_base w_0` and folded into 24 bins of `log_base r` over whole periods of `R` in `base^4..base^8`. The drift bar is that fold on the first half of the window against the second, over the bins both halves populate, and a second bar is taken on a whole-period split. The `log base` periodicity residual is printed by decade, and the cross-level identity `M_level(r) = n_0 M_(level-1)(r)` for `r < 2 base^(level-1)` is asserted as exact integer equality. - THE LOCAL DIMENSIONS are `alpha_min = -log_base max_f w_f`, `alpha_max = -log_base min_f w_f` and the information exponent `alpha(1) = -sum_f w_f log_base w_f`. - THE JSR LADDER runs one solver on two rungs. Rung 0 is the designs: `F` inside `{0,...,base-1}^dim` puts `supp phi` in the unit cell, exactly one integer translate meets it, the Daubechies-Lagarias matrices are `1 x 1` with `T_f = [base^dim w_f]`, and `JSR = base^dim max_f w_f` in closed form with `alpha_Holder(phi) = -dim - log_base(max_f w_f)`. Rung 1 is the first overlap at `base 2`, `T_0 = (c_(2i-j-1))`, `T_1 = (c_(2i-j))`, restricted to `sum_i v_i = 0` by an exact change of basis whose defining identity `B C = T B` is asserted entry by entry. - The bracket is a certificate, not a float. All matrix arithmetic runs in `Q(sqrt m)` over exact rationals; spectral radii and spectral norms of the `1 x 1` and `2 x 2` blocks are enclosed by rational bounds through their trace and determinant, the Gripenberg lower end scans words to length 8 and truncates its root down, and the norm upper end scans to length 14 and rounds its root up. The same solver is run on rung 0 and asserted to collapse onto the closed form. - THE CONTROLS are pre-registered and printed with their verdicts: equal weights must reproduce the 0/1 design exactly, log-commensurable weights must keep every ripple, and only an irrational log ratio may move a mass observable. The study asserts that the length ripple survives all three and that exactly one of the three moves the mass side. A mass observable moving under all three would fail here. - THE MULTIFRACTAL SPECTRUM closes the mass side. For equal contraction `1/base` under the open set condition the pressure equation `sum_f w_f^s (1/base)^tau(s) = 1` gives `tau(s) = log_base sum_f w_f^s` in closed form, and `f(alpha) = inf_s (alpha s + tau(s))`. Three things are checked: `tau(0) = log_base |F|` and `tau(1) = 0`; the box partition at `level` carries the moments exactly, `sum_i mu_i^s = (sum_f w_f^s)^level` in exact rational arithmetic at `s = -2..3` and levels 6, 8, 10; and the coarse-grained band `f_level(alpha) = log_base N(alpha)/level` sits under the transform at every level and every achievable `alpha`, which follows in one line from `N_i mu_i^s <= base^(level tau(s))`. - The gap between the band and the transform is the Stirling volume term of the multinomial count. The expectation is Stirling's series, derived independently of the sweep, and the study asserts the band matches it to better than `1e-3` at all three levels while the deficit itself falls with the level. Both endpoints of the band are exact at every level, deficit `0.000000000`. - The whole band at level 10 is printed row by row by the generator, never assembled by hand. - Every printed number is asserted before it prints, and the study exits nonzero on any failure. ## RUN - `uv run python research/lab/py/weighted-designs/weighted.py` - About four seconds; prints only, writes nothing, and holds one level-10 cell list at a time. ## WITNESSES - weights.md What weights move, the class table: the seven rank rows, `1/2,1/2,1/2`, `1/2,1/2,1/4`, `1/3,1/3,1/3` and `1/2,1/4,1/4` at rank 1 with spans `ln 2`, `ln 2`, `ln 3`, `ln 2`, and `1/2,1/2,1/3`, `2/5,2/5,1/5`, `3/8,3/8,1/4` at rank 2. - weights.md What weights move, the class table's last column: every `delta` and every five-point oscillation of `ln N(a) - delta a`, the four flat and the three decaying. - weights.md What weights move, the Dirichlet root: `1.0000000000` at all four probability vectors. - weights.md What weights move, the controls: the three verdicts, length kept under all three and mass moved under exactly one. - weights.md What weights never move, the ripple table: the four swings, drift bars, whole-period bars and fold gaps, the periodicity residual by decade, and the cross-level identity exact on all four. - weights.md The ladder, rung 0: `T_f`, `JSR`, the solver bracket, `alpha_min`, `alpha_max` and `alpha_Holder(phi)` on all four sets. - weights.md The ladder, rung 1: the hat mask at `[0.5000000, 0.5000000]` and D4 at `[0.6830127, 0.7105812]`, hence `alpha` in `[0.4929285, 0.5500157]`. - weights.md The pressure: the `tau(s)` table at `s = -2..3`, the exact moments at levels 6, 8, 10, the deficits `0.176458, 0.147536, 0.127619` at `alpha = 1.077324384`, the Stirling match and the exact endpoints. - The whole coarse-grained band at level 10 is printed row by row by the run and is not carried on the page.