# question-mark - The Stern-Brocot tree and Minkowski's `?` read in the three-slot language of [beneath](../../../notes/beneath.md), `## The question mark`: a base-2 design whose value is a `2 x 2` matrix product, the map that swaps the continued fraction place slot for the dyadic one, and the two dimensions of every run-length rule of the memory dial at `dim 1`, widths `2` to `4`. - `carry` checks `v(2n + b) = v(n) M_b` on `v(n) = (s(n), s(n+1))`, `s` the Stern diatomic sequence, `M_0 = [[1,1],[0,1]]`, `M_1 = [[1,0],[1,1]]`, and the closed form `v(n) = (0,1) M_(d_1) ... M_(d_L)` over the digits of `n` most significant first, both exhaustively below `2^span`; reads `s` against the terms A002487 lists, fetched from the public OEIS mirror on GitHub and skipped when offline; prints `M_0 M_1` and `M_1 M_0`; finds the least pair of words of equal length and weight with different `s`, once on the digits of `n` without a leading zero and once on all `2^L` words of a length, and prints the level-2 cells; and checks the Stern-Brocot row against the Calkin-Wilf row `s(n)/s(n+1)` under bit reversal of the position, depths `0..depth`. - `question` computes `?` on every node of the Farey subtree of `[0,1]` to depth `depth` by the mediant recursion `?((p+p')/(q+q')) = (?(p/q) + ?(p'/q'))/2` and checks, exactly in rationals, the Denjoy formula `?([0; a_1, a_2, ...]) = sum_i (-1)^(i+1) 2^(1 - a_1 - ... - a_i)`, the tent conjugacy `?(F(x)) = T(?(x))`, the branch law `?(1/(a + x)) = 2^(-a)(2 - ?(x))`, and the address law `?(node i of row d) = (2i + 1)/2^(d + 1)`. It then takes every run-length alphabet `A` at widths `2..4`, builds its code, and compares the accepted words of length `level` with the length-`level` prefixes of the binary words `0^(a_1 - 1) 1^(a_2) 0^(a_3) ...` over `A`, printing the leading runs of the surplus. - `table` first runs the controls and stops on failure: the pressure zero of `A = {1,2}` against `0.5312805062772051416`, the same at `24, 32, 48, 56` modes, `A = N` against `1`, and `A = N\{1}` at four tail cuts. Then, per run-length code, it prints the alphabet, the polynomial `P_A`, `rho` from the transfer matrix of the code under the note's own convention, `log_2 rho`, the pressure zero `dim_CF`, and the Holder floor `alpha log_2 rho` with `alpha = log 2 / (2 log phi)`, asserting on every row that `rho` is the largest root of `P_A`, that `P_A` divides the exact characteristic polynomial of the transfer matrix, and that `dim_CF >= alpha log_2 rho`. - `P_A` is `x^m - sum_(a in A) x^(m - a)` for finite `A` with `m = max A`, and `x^(f+1) - 2x^f + (x - 1) sum_(j in F) x^(f - j)` for `A = N \ F` with `f = max F`, the polynomial cleared from `sum_(a in A) rho^(-a) = 1`. - `dim_CF` is the zero of `s -> log lambda(s)`, `lambda(s)` the leading eigenvalue of `L_(A,s) f(x) = sum_(a in A) (a + x)^(-2s) f(1/(a + x))`, collocated on `modes` Chebyshev-Lobatto points of `[0,1]` through barycentric interpolation and found by bisection on `[0, 1]` for finite `A` and on `[0.51, 1.1]` for cofinite `A`. A one-letter alphabet has `lambda(0) = 1` exactly and prints `0` without bisection. For cofinite `A` the sum runs explicitly to `a = cut` and the tail `a > cut` is `sum_(j <= taylor) f^(j)(0)/j! zeta(2s + j, cut + 1 + x)`, `taylor + 1` terms, Hurwitz zeta on the Taylor coefficients of the interpolant at `0`. - `obstruction` counts, per width, the run-length codes, the codes fixed by both the digit flip and reversal, those among them with no alphabet, and how many of those carry `rho > 1`, listing every orphan at widths `2` and `3` and the least live one at width `4`. - `graph` builds, for any `dim 1` code, the graph-directed continued fraction form of [beneath](../../../notes/beneath.md), `### Every rule is a graph-directed continued fraction set`: states the `2^(k-1)` words of `k - 1` digits, an edge `u -a-> v` when `a` copies of the digit opposite to the last digit of `u` close only allowed windows and leave state `v`, the labels `a >= k` folded into one cofinite edge to `b^(k-1)`. It keeps the recurrent states, the states on a cycle, and finds the pressure zero of the matrix operator `(L_s F)_u(x) = sum_(u -a-> v) (a + x)^(-2s) F_v(1/(a + x))` by bisection on the log of its largest real eigenvalue, on `[0, 1]` when every cofinite edge is transient and on `[0.51, 1.1]` otherwise; a graph whose recurrent states each carry one label prints `0`. First it recovers the pressure zero of all `18` run-length codes from the graph form and stops if any gap reaches `1e-12`; then it compares the accepted words of code `11892` at length `level` with the prefixes of the run words over `{1,2}` without the pair `22`, prints that code's recurrent graph, and prints the `19` width-`4` orphans with `rho > 1`, code `11892` first, and the four named codes `7`, `23`, `54`, `127` as parity-constrained continued fraction sets, asserting `dim_CF >= alpha log_2 rho` on every row. - `subleading` continues `L_(A,s)` to complex `s` at `A = {1,2}`, `(a + x)^(-2s) = exp(-2s log(a + x))` on the same collocation, and locates the zeros of `det(1 - L_s)` off the real axis: a scan of `abs(det)` on a grid of the box, Newton with a central-difference derivative from every local minimum, duplicates dropped, and the winding number of `det` around the box asserted equal to the number found. The zero `s_1 = sigma + i tau` of largest real part in `0 <= sigma <= 0.53`, `0.2 <= tau <= 14` at `modes` modes is refined at `60`, `100` and `140` modes, the box is widened to `tau <= 80` at `100` modes, and the verb prints the period `pi/(tau log 2)` in octaves and the amplitude ratio per octave `2^(2(sigma - delta_2))` that a term `Q^(2 s_1)` of the `E_2` count contributes, with the alias `2 tau log 2 - 3 pi` that integer-octave sampling sees. It then imports `census_walk` from `lab/py/ford-horocycle`, walks the `E_2` circles to `2^jmax`, samples `N_2(Q)/Q^(2 delta_2)` at `per` points per octave from `2^jlo`, fits a constant alone and a constant plus the wave of `s_1` with only the constant, amplitude and phase free, prints both residuals, the observed octave exponents minus `2 delta_2` beside the fitted wave's at every octave, asserting agreement within `4e-3`, and a free fit of `sigma` and `tau` on the same points; last it runs the control `A = {1,2,3}` in `0 <= sigma <= 0.71`, `0.2 <= tau <= 80` at `100` modes, the winding number asserted, against the `m = 3` walk to `2^18`. - The transfer matrix is the note's: state `s` the last `k - 1` digits, edge `s -> (2s + c) mod 2^(k-1)` when bit `2s + c` of the code is set, pinned on the four named codes `7`, `23`, `54`, `127` before any row prints. ## RUN - `uv run python mrlyprod/research/lab/py/question-mark/question.py carry`, `0.2` seconds. - `uv run python mrlyprod/research/lab/py/question-mark/question.py question`, `1.8` seconds. - `uv run python mrlyprod/research/lab/py/question-mark/question.py table`, `29` seconds, almost all of it the six cofinite rows and their tail controls. - `uv run python mrlyprod/research/lab/py/question-mark/question.py obstruction`, `0.4` seconds. - `uv run python mrlyprod/research/lab/py/question-mark/question.py graph`, `32` seconds, half of it the six cofinite rows of the control. - `uv run python mrlyprod/research/lab/py/question-mark/question.py subleading`, `59` seconds, `20` of them the `E_2` walk to `2^24` and `15` the control's scan. - `uv run python mrlyprod/research/lab/py/question-mark/question.py all`, `122` seconds. - `--span 16`, `--depth 12`, `--level 14`, `--modes 40`, `--cut 2000`, `--taylor 4`, `--jmax 24`, `--jlo 12` and `--per 16` are the dials. - Prints only, writes nothing, touches the network once, for the A002487 terms, and reads one sibling, `lab/py/ford-horocycle/ford_horocycle.py`, for the census walk. ## WITNESSES - The lines of [beneath](../../../notes/beneath.md), `## The question mark`, and the subleading paragraph of [apollonian](../../../notes/apollonian.md), `## The horocycle`. - `0` mismatches on `v(2n + b) = v(n) M_b` and on the digit product below `2^16`; the `92` listed terms of A002487 agree; `M_0 M_1 = [[2,1],[1,1]]` and `M_1 M_0 = [[1,1],[1,2]]`; `s(5) = 3` and `s(6) = 2` on the words `101` and `110`, the least pair without leading zeros, and `s(3) = 2` against `s(5) = 3` on `011` and `101` with them; level `2` reads `0, 1, 1, 2`; `0` mismatches between the Stern-Brocot row and the bit-reversed Calkin-Wilf row through depth `12`. - `0` mismatches on `8193` Farey nodes to depth `12` for the Denjoy formula, the tent conjugacy, the branch law at `a = 1..5` and the address law. - At width `3`, code `126`, `A = {1,2}`, level `14`: `1220` accepted words, `987` prefixes of `?(E_A)`, `0` missing, `233` surplus, every one with leading run `00`; at code `219`, `A = N\{1}`: `1220`, `610`, `0`, `610`, the surplus exactly the words opening on `1`. - The `A = {1,2}` control reads `0.5312805062772050` against `0.5312805062772051416`, gap `1.1e-16`, and moves by at most `8.9e-16` between `24` and `56` modes; `A = N` reads `1.0000000000000000`; `A = N\{1}` reads `0.84088458641455` at every cut from `500` to `4000`. - The table: `18` codes on `11` alphabets, every row passing the three assertions, the same alphabet at two widths printing the same `dim_CF`. - Orphans: `2` of `4` symmetric codes at width `2`, `3` of `8` at width `3`, `53` of `64` at width `4`, of which `19` carry `rho > 1`, the least being code `11892`, `A = {1,2}` with the pair `22` forbidden, at the supergolden `rho`. - Graph: the graph form recovers the `18` run-length pressure zeros with a largest gap of `8.9e-16`; code `11892` at level `14` has `378` accepted words, `277` prefixes of `?(M)` for `M = {1,2}` without `22`, `0` missing, `101` extra with leading runs `0` and `00`, and a recurrent graph of `6` states and `10` edges with no cofinite edge; the `19` orphan rows and the `4` named rows of the note, `11892` at `0.416817764433`, `48765` at `0.531280506277`, `54699` at `0.785953471982`, code `7` at `0.798858366966`, every row above its Holder floor. - Subleading: one zero of `det(1 - L_s)` at `A = {1,2}` in `0 <= sigma <= 0.53`, `0.2 <= tau <= 14`, `s_1 = 0.457015235231 + 6.958882679527 i`, moving by at most `8.9e-16` from `40` to `140` modes, the eigenvalue nearest `1` there `1.000000000000`; `33` zeros in the box to `tau = 80`, the winding number agreeing, the next two `0.428067039 + 78.156951119 i` and `0.412635450 + 71.206868515 i`; `delta_2 - sigma_1 = 0.074265`, period `0.6513` octaves, ratio `0.9022` per octave, phase advance `3 pi + 0.2223` per octave; on `193` points of `N_2(Q)/Q^(2 delta_2)` from `2^12` to `2^24` the constant fit leaves rms `1.64e-02` and the wave of `s_1` leaves `7.67e-04`, max `4.05e-03`, amplitude `0.131210`; the twelve octave deviations from `j = 12` to `23` are reproduced within `0.0034`, `+0.0475` against `+0.0472` at `j = 15` and `+0.0124` against `+0.0127` at `j = 23`; the free fit reads `sigma = 0.4556`, `tau = 6.9598`; the control `A = {1,2,3}` has `67` zeros in `0 <= sigma <= 0.71`, `0.2 <= tau <= 80`, the winding number agreeing, the largest real part at `0.489705291051 + 45.352143150104 i`, `0.2160` below `delta_3`, factor `0.7413` per octave, and its census leaves rms `3.85e-04` to a constant, `3.83e-04` with the wave.