diff --git a/research/p104-controller-income-bound/PROOF.md b/research/p104-controller-income-bound/PROOF.md new file mode 100644 index 0000000000..3715020d22 --- /dev/null +++ b/research/p104-controller-income-bound/PROOF.md @@ -0,0 +1,107 @@ +# Proof: twisted outputs are at most paid odd shears minus one + +## Setting + +One central port. The caller word of `research/p104-productive-controller/caller.py` acts on `n = 32` banks +(16 pairs). A bank holds an element of `R = K[Q, Q⁻¹] ⊗ K[D_0, …, D_32]`, `K = ℚ`; the banks start as the rows of +the constant right boundary matrix (invertible), and the constant left boundary matrix is applied at the end. The +alphabet is replayed literally: + +| event | action on the rows | kind | +|---|---|---| +| `ADD y x c` | `y += c·x`, `c ∈ K` | free | +| `SWAP`, `SIGNED_SWAP` | exchange two rows, one sign | free | +| `Q_POWER r ±2` | `r *= Q^{±2}` | free (even central powers are translations) | +| `IDLE pair S` | both rows of the pair `*= ∏_{s∈S} D_s` | free in this count (its rank-`8|S|` price is a lift, cancelled by the target rank) | +| `LOCAL s pair back` | `y += Q^{-1}·x` (or `x += −Q·y` backward), then both rows `*= D_s` | **paid odd shear** (one full call) | +| `QUERY_SHEAR s pair back` | `y += Q^{-1}·x` (or `x += −Q·y`) | **paid odd shear** (one rank-one request per port) | + +Write every row as `a + Q·b` with `a, b ∈ R_even = K[Q^{±2}] ⊗ K[D]`; `a` is the **even part**. Let `E` be the +`n × n` matrix over `R_even` whose rows are the even parts, and `rank E` its rank over the fraction field of +`R_even`. + +## Lemma + +1. Every free event is an invertible row operation of `(E | odd parts)` with coefficients in `R_even` (constants, + `Q^{±2}`, monomials in `D`); it preserves `rank E`. +2. A paid shear `y += Q^{±1}·x` changes exactly one row of `E`: `E_y += Q^{±1}·(odd part of x)`, which lies in + `R_even`. So `rank E` changes by at most one. +3. Before the first paid shear every odd part is zero (the right boundary is constant), so the first paid shear + does not change `E` at all. +4. The outputs are the rows of `L·M_final`, `L` the constant left boundary. The even part of `L·M_final` is + `L·E_final`, so an output `ℓ_i·M_final` that is an odd monomial `Q^{±1}·D^{S_i}·e_i` (every declared diagonal + output) puts the row `ℓ_i` of `L` in the left kernel of `E_final`. + +**Theorem.** With `s` paid shears and `n_odd` outputs that are odd (zero even part), + + n_odd ≤ n − rank E_final ≤ n − (n − (s − 1)) = s − 1 . + +Proof: `rank E` starts at `n` (invertible right boundary), stays `n` through free events and the first paid +shear, drops by at most one at each of the other `s − 1` paid shears, so `rank E_final ≥ n − (s − 1)`. For the +other inequality let `T` be the set of twisted outputs and `L_T` the matching rows of `L`. By (4), `L_T·E_final = 0`. +The outputs `Q^{±1}D^{S_i}e_i`, `i ∈ T`, are linearly independent, so `rank L_T ≥ rank(L_T·M_final) = n_odd`, and +the left kernel of `E_final` has dimension at least `n_odd`: `rank E_final ≤ n − n_odd`. This does not need `L` +to be invertible (on the three literal controllers it is; the verifier records its rank, 32). ∎ + +(The first version of this file read the zero rows off `M_final` instead of `L·M_final`; the left-kernel step +above is the repair given in the independent audit +[PR #6120](https://github.com/CrocSwap/integer-mult-bounds/pull/6120), PROOF.md A1.) + +The verifier evaluates the same argument after the ring homomorphism `D_s → 1`, `Q² → θ` (`θ = 7/3`, `11/5`): +items 1–4 hold verbatim in the image, so the per-event rank trace is a complete check on the given word. + +## Consequence for the complete invoice + +Let a caller use `n_thick` full calls and `n_thin` thin shears, all on one pair each, and let every one of its +`n_out` outputs be an odd monomial with stage set `S_i` (target rank `1 + d·|S_i|`, `d = 8`). Every stage that +appears in an output was paid once as a lift of that content (`d` per bank per full call or per idle stage). +This follows from the determinant, stage by stage (audit PR #6120, A2): scalar `ADD`, swaps and shears have +determinant `±1`, `Q_POWER` multiplies it by `Q^{±2}`, and a lift of one row by `D_s` multiplies it by `D_s`, so +`det(L·M_final) = c·Q^{2k}·∏_s D_s^{ℓ_s}` with `c ∈ K^×` and `ℓ_s` the number of row-lifts at stage `s`; the +diagonal `diag(Q^{q_i}D^{S_i})` has determinant `∏_i Q^{q_i}·∏_s D_s^{#{i : s ∈ S_i}}`, and `K[Q^{±1}, D]` is a +UFD, hence `#{i : s ∈ S_i} = ℓ_s` for every `s` and `Σ_i |S_i| = Σ_s ℓ_s`. The argument needs the outputs to form +the full monomial diagonal (the cost model of `caller.py` accepts only that); the verifier checks both identities +stage by stage on the three controllers (`Σ_s ℓ_s = 194`, `Σ_i q_i` = net `Q_POWER` = 0). Therefore + + income per port = Σ_i (1 + d|S_i|) − d·(lifts) − n_thin = n_out − n_thin ≤ (n_thick + n_thin − 1) − n_thin = n_thick − 1 . + +The three retained p16 controllers have `n_out = 32`, `n_thin = 15`, `n_thick = 18`: income `17 = 18 − 1`, the +bound with equality (checked from the literal words in `RESULT.json`). + +With `v` ports and a local word that loses `c` units of rank mass per full call outside the main lifts (the owned +centre: `c = 56` on the PR5907 word, `64` on #4610), the complete rank-mass surplus is + + M = v·(income) − n_thick·c ≤ n_thick·(v − c) − v , + +equal to `18·48 − 104 = 760` on PR5907. Each additional thick call can add at most `v − c` units of surplus, and +no change of the caller graph inside this alphabet (path or not, any prefix/suffix idle law, any pairing of thin +shears) can add more. The remaining complex-side levers are therefore the centre `c`, the fragmentation of the +local word (which enters the moment, not the mass; see `research/fragmentation-ceiling`), and the moment cost of +the target ranks that grows with `n_thick` (which is why `p = 16` is optimal for the retained local profile, +PR5554). + +## Relation to the binary theorem + +`research/productive-controller-basis-search/GLOBAL-PROOF.md` (Cinna Davis), Theorem B, proves the count +`queries ≥ 2p + 1` for `2p` independent monomial outputs over `F₂[Q]/(Q² − 1)` with constant binary boundaries +and without idle work, by the rank of `n` rank-one nilpotents summing to the identity. The lemma above is the same +count in the retained complex alphabet: `K = ℚ`, `Q` a Laurent variable with `Q² ≠ 1`, free idle markers, outputs +counted one by one (so partially twisted words are covered), and it is read off the even-part rank rather than +the derivative at `Q = 1`. The pruning remark of that package's `PROOF.md` ("a query changes the even part from +`E` to `E + NO`, so its rank can fall by at most one") is the step (2) of the lemma; here it is made the whole +argument, with the first-shear refinement (3) that gives the `− 1`. + +## Scope + +The alphabet is the literal one of the retained callers (constant boundaries, `Q_POWER ∈ {±2}`, one-pair shears +with coefficient `Q^{-1}` or `−Q`). Outside it the bound can fail, but touching several banks is not by itself an +escape. Writing a paid job as `M ← A·M`, `A = A_e + Q·A_o`, Sylvester's inequality bounds its drop of `rank E` by +`(n − rank A_e) + rank A_o`, and by `n − rank A_e` while no odd content exists yet (audit PR #6120, PROOF.md A4, +with exact controls). So a paid job that writes one row, `y ← u·y + Σ_j f_j·x_j` with `u` even and nonzero, obeys +the bound including the `− 1`, for any number of source banks and any Laurent `f_j`. The known escapes are: a job +that writes several rows (for example the three Whitehead shears of one pair taken as one paid job, which drops +`rank E` by two from a constant entry); a paid odd +one-bank translation `y ← Q^{±1}·y` (it twists one output even as the first paid job); and a boundary that already +carries odd `Q` content (step 3 fails; with a general entry the bound is `n_odd ≤ (n − rank E_entry) + s`). None +of these is in the literal alphabet. The bound is on rank mass; it says nothing new about the moment at `t < 1`, where +PR5554's convexity argument and the fragmentation ceiling apply. diff --git a/research/p104-controller-income-bound/README.md b/research/p104-controller-income-bound/README.md new file mode 100644 index 0000000000..10bb443a50 --- /dev/null +++ b/research/p104-controller-income-bound/README.md @@ -0,0 +1,95 @@ +# Controller income is capped at thick calls minus one + +**Scoped negative result; no new κ.** In the Laurent caller alphabet of the retained p16 controllers +([`research/p104-productive-controller/caller.py`](../p104-productive-controller/caller.py)), the outputs earn +their rank mass because the central axis `Q` enters each target for free (target `1 + 8|S|` against lifts `8|S|`), +and the caller pays one rank-one request per port for each thin shear. This package proves that **no caller word +in that alphabet can twist more outputs than it has paid odd shears, minus one**, so the controller's rank-mass +income per port is at most the number of full calls minus one. The three retained controllers reach exactly that +bound (17 = 18 − 1). + +**Prior work.** Theorem B of Cinna Davis's +[`research/productive-controller-basis-search/GLOBAL-PROOF.md`](../productive-controller-basis-search/GLOBAL-PROOF.md) +already proves that a successful controller with `2p` independent monomial outputs needs at least `2p + 1` +query-bearing calls, over `F₂[Q]/(Q² − 1)` with constant binary boundaries and no idle work, and its +[`PROOF.md`](../productive-controller-basis-search/PROOF.md) uses "a query changes the even part by one row" as a +search pruning rule; that package states explicitly that the binary theorem is not asserted for complex words. This +package is the complex-side counterpart: the same even-part count in the literal rational Laurent alphabet of the +retained callers (`Q² ≠ 1`, idle stage markers, any number of outputs twisted), stated as a bound on the income of +the complete invoice rather than on the call count, and checked on the literal controllers. It also answers, for +the rank mass, the first open question of that package: additional queries beyond `2p + 1` cannot raise the +controller's income, because every paid shear, thick or thin, buys at most one twisted output. + +Base: canonical main `721c03822c421b7f7fcbb2598993b947c4d88419`. Inputs pinned in [SOURCES.json](SOURCES.json). + +## The argument + +Split every bank's content into its even and odd parts in `Q`. Free operations (scalar `ADD`, swaps, `Q^{±2}`, +stage markers) are invertible row operations over the even subring and keep the rank of the even-part matrix; a paid +odd shear (`LOCAL` or `QUERY_SHEAR`) changes one row of it, so the rank drops by at most one, and the very first paid +shear cannot change it because no odd part exists yet. Every declared output is an odd monomial, so its row of the +constant left boundary lies in the left kernel of the final even-part matrix; these rows are independent, so the +final even rank is at most `n − twisted` (no invertibility of the left boundary is needed). Hence +`twisted outputs ≤ paid shears − 1`. Full statement and the invoice consequence in [PROOF.md](PROOF.md); the +left-kernel step and the stage-by-stage determinant proof of the lift cancellation are the repairs given by the +independent audit [PR #6120](https://github.com/CrocSwap/integer-mult-bounds/pull/6120) (A1, A2). + +| Controller | Events | Paid shears (thick + thin) | Even-rank trace | Twisted outputs | Income per port | +|---|---:|---:|---|---:|---:| +| PR5398 direct (`kappa-backward-controller-20261023`) | 162 | 33 (18 + 15) | 32, 32, 31, …, 0 | 32 | 17 | +| Joint-helper lattice source (`joint-helper-lattice`) | 154 | 33 (18 + 15) | 32, 32, 31, …, 0 | 32 | 17 | +| p104 productive, all-forward (`p104-productive-controller`) | 218 | 33 (18 + 15) | 32, 32, 31, …, 0 | 32 | 17 | + +Income per port is computed from the literal word: sum of target ranks `1 + 8|S_i|` over the 32 declared outputs +(1,584) minus every paid lift (8 per bank per full call and per idle stage, 1,552) minus the 15 thin requests. + +Consequence for the complete rank-mass surplus with `v` ports and a local word losing `c` units per full call in its +owned centre: `M = v·income − calls·c ≤ calls·(v − c) − v`, which is `18·48 − 104 = 760` on the +[PR #5907](https://github.com/CrocSwap/integer-mult-bounds/pull/5907) word. Changing the caller graph (path or +not, any idle law, any pairing of the thin shears) cannot raise it with 18 full calls; the open complex-side levers +are the centre, the fragmentation of the local word ([`research/fragmentation-ceiling`](../fragmentation-ceiling/README.md)) +and the moment cost of longer callers ([PR #5554](https://github.com/CrocSwap/integer-mult-bounds/pull/5554)). +Outside the alphabet the bound can fail: a paid job that writes several rows, a paid odd one-bank translation +`Q^{±1}`, or a boundary that already carries odd `Q` content. A paid job that writes one row with a nonzero even +self-coefficient obeys it for any number of source banks (per-job bound `(n − rank A_e) + rank A_o`, audit PR #6120 +A4; see [PROOF.md](PROOF.md), Scope). + +## Verification + +```sh +python3.12 -B research/p104-controller-income-bound/verify.py +``` + +Under a second, standard library only ([incomebound.py](incomebound.py)). It authenticates the pinned inputs; +replays one port of each controller from its right boundary to its left boundary with the literal rational +coefficients, tracking the exact rank over ℚ of the even part after `D_s → 1`, `Q² → 7/3` and `11/5`, and checks +that free events keep it, every paid shear changes it by at most one, the first leaves it unchanged, the trace is +32, 32, 31, …, 0 and all 32 declared outputs are odd monomials; computes the per-port income from the literal +word and checks the lift cancellation stage by stage (outputs containing `D_s` = row-lifts at `s`, 194 in all) and +records the rank of the left boundary; runs the controls (the two-bank Whitehead word with three odd shears reaches `diag(Q, Q⁻¹)` with trace +2, 2, 1, 0 and its two-shear prefix does not; dropping the last thin shear of the p104 controller leaves a positive +even rank and the declared diagonal is rejected; a free `Q^{±1}` is rejected by the alphabet); and compares +[RESULT.json](RESULT.json) in full. Final marker: `PASS_P104_CONTROLLER_INCOME_BOUND`. + +## Credits and scope + +Controllers by Cinna Davis (p16/a7 lattice), Ali Romman (PR5398 wrapper, PR5544 all-forward caller) and the +P104 lineage; Cinna Davis's `productive-controller-basis-search` for the binary `2p + 1` theorem and the even-part +pruning idea this package lifts to the rational Laurent alphabet; JosieElliston's independent audit +(PR #6120) for the left-kernel and determinant repairs and the corrected escape list; PR5405/PR5554 (zxv) for the path-family ceilings this bound complements; `fragmentation-ceiling` +for the moment side. The bound is on rank mass inside the literal alphabet; it makes no claim about the moment at +`t < 1`, about other primitives, or about any selected result. Prepared for Matarener with Claude (Anthropic), +via Claude Code. Apache-2.0. + +## Open next questions + +1. Does the bound extend to callers whose paid primitives are not odd central shears of one pair, for example a + paid rank-r Gaussian touching several banks or several ports at once? Such a primitive could twist more than + one output per paid job; with a paid odd one-bank translation and an odd boundary it is one of the ways to + raise the controller income above thick calls minus one (PR #6120 A4 gives the per-job bound). First step: + state the primitive as a physical job in `research/p104-productive-controller/caller.py` terms and extend the + even-part tracker with its action; the bound becomes twisted ≤ Σ over paid jobs of their even-rank change. +2. Is the bound attained with more thick calls, and does the resulting invoice ever beat p = 16? Income grows by + (ports − centre) per thick call, but the target ranks 1 + 8(p+2) and the idle chunks grow too; PR5554 covers + path controllers, and the local invoice of PR5907 peaks at p = 16 (p = 20: 0.003117). First step: price + M = calls × (v − c) − v against the log-moment growth for a non-path caller once one is constructed. diff --git a/research/p104-controller-income-bound/RESULT.json b/research/p104-controller-income-bound/RESULT.json new file mode 100644 index 0000000000..1173942804 --- /dev/null +++ b/research/p104-controller-income-bound/RESULT.json @@ -0,0 +1,509 @@ +{ + "controllers": { + "joint_helper_lattice": { + "events": 154, + "income": { + "idle_stage_mass": 158, + "income": 17, + "left_boundary_rank": 32, + "locals": 18, + "net_q_power": 0, + "output_stage_count_equals_lifts": true, + "outputs": 32, + "outputs_minus_thin": 17, + "paid_lifts": 1552, + "row_lifts_per_stage": [ + 16, + 16, + 0, + 14, + 0, + 12, + 0, + 10, + 0, + 8, + 0, + 6, + 0, + 4, + 0, + 2, + 0, + 4, + 0, + 6, + 0, + 8, + 0, + 10, + 0, + 12, + 0, + 14, + 0, + 16, + 0, + 18, + 18 + ], + "row_lifts_total": 194, + "stages": 33, + "targets_rank_sum": 1584, + "thin": 15 + }, + "path": "research/joint-helper-lattice/CONTROLLER.json", + "receipts": { + "11/5": { + "banks": 32, + "bound_satisfied": true, + "even_rank_trace": [ + 32, + 32, + 31, + 30, + 29, + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1, + 0 + ], + "even_zero_outputs": 32, + "final_even_rank": 0, + "idle_stage_mass_per_port": 158, + "paid_shears": 33, + "theta": "11/5", + "thick": 18, + "thin": 15, + "twisted_outputs": 32 + }, + "7/3": { + "banks": 32, + "bound_satisfied": true, + "even_rank_trace": [ + 32, + 32, + 31, + 30, + 29, + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1, + 0 + ], + "even_zero_outputs": 32, + "final_even_rank": 0, + "idle_stage_mass_per_port": 158, + "paid_shears": 33, + "theta": "7/3", + "thick": 18, + "thin": 15, + "twisted_outputs": 32 + } + } + }, + "p104_productive": { + "events": 218, + "income": { + "idle_stage_mass": 158, + "income": 17, + "left_boundary_rank": 32, + "locals": 18, + "net_q_power": 0, + "output_stage_count_equals_lifts": true, + "outputs": 32, + "outputs_minus_thin": 17, + "paid_lifts": 1552, + "row_lifts_per_stage": [ + 16, + 16, + 0, + 14, + 0, + 12, + 0, + 10, + 0, + 8, + 0, + 6, + 0, + 4, + 0, + 2, + 0, + 4, + 0, + 6, + 0, + 8, + 0, + 10, + 0, + 12, + 0, + 14, + 0, + 16, + 0, + 18, + 18 + ], + "row_lifts_total": 194, + "stages": 33, + "targets_rank_sum": 1584, + "thin": 15 + }, + "path": "research/p104-productive-controller/CONTROLLER.json", + "receipts": { + "11/5": { + "banks": 32, + "bound_satisfied": true, + "even_rank_trace": [ + 32, + 32, + 31, + 30, + 29, + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1, + 0 + ], + "even_zero_outputs": 32, + "final_even_rank": 0, + "idle_stage_mass_per_port": 158, + "paid_shears": 33, + "theta": "11/5", + "thick": 18, + "thin": 15, + "twisted_outputs": 32 + }, + "7/3": { + "banks": 32, + "bound_satisfied": true, + "even_rank_trace": [ + 32, + 32, + 31, + 30, + 29, + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1, + 0 + ], + "even_zero_outputs": 32, + "final_even_rank": 0, + "idle_stage_mass_per_port": 158, + "paid_shears": 33, + "theta": "7/3", + "thick": 18, + "thin": 15, + "twisted_outputs": 32 + } + } + }, + "pr5398_direct": { + "events": 162, + "income": { + "idle_stage_mass": 158, + "income": 17, + "left_boundary_rank": 32, + "locals": 18, + "net_q_power": 0, + "output_stage_count_equals_lifts": true, + "outputs": 32, + "outputs_minus_thin": 17, + "paid_lifts": 1552, + "row_lifts_per_stage": [ + 16, + 16, + 0, + 14, + 0, + 12, + 0, + 10, + 0, + 8, + 0, + 6, + 0, + 4, + 0, + 2, + 0, + 4, + 0, + 6, + 0, + 8, + 0, + 10, + 0, + 12, + 0, + 14, + 0, + 16, + 0, + 18, + 18 + ], + "row_lifts_total": 194, + "stages": 33, + "targets_rank_sum": 1584, + "thin": 15 + }, + "path": "research/kappa-backward-controller-20261023/CONTROLLER.json", + "receipts": { + "11/5": { + "banks": 32, + "bound_satisfied": true, + "even_rank_trace": [ + 32, + 32, + 31, + 30, + 29, + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1, + 0 + ], + "even_zero_outputs": 32, + "final_even_rank": 0, + "idle_stage_mass_per_port": 158, + "paid_shears": 33, + "theta": "11/5", + "thick": 18, + "thin": 15, + "twisted_outputs": 32 + }, + "7/3": { + "banks": 32, + "bound_satisfied": true, + "even_rank_trace": [ + 32, + 32, + 31, + 30, + 29, + 28, + 27, + 26, + 25, + 24, + 23, + 22, + 21, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1, + 0 + ], + "even_zero_outputs": 32, + "final_even_rank": 0, + "idle_stage_mass_per_port": 158, + "paid_shears": 33, + "theta": "7/3", + "thick": 18, + "thin": 15, + "twisted_outputs": 32 + } + } + } + }, + "controls": { + "drop_last_thin_shear": { + "even_zero_outputs": 16, + "final_even_rank": 2, + "paid_shears": 32, + "rejection": "declared diagonal output 1", + "removed_event_index": 155 + }, + "free_odd_power_rejected": "only even central powers are free", + "whitehead_three_shears": { + "even_zero": 2, + "final": [ + [ + "(1, 1, ())" + ], + [ + "(0, -1, ())" + ] + ], + "trace": [ + 2, + 2, + 1, + 0 + ], + "twisted": 2 + }, + "whitehead_two_shears": { + "even_zero": 1, + "trace": [ + 2, + 2, + 1 + ] + } + }, + "summary": { + "attained_by": "all three p16 controllers (32 <= 33 - 1)", + "bound": "twisted outputs <= paid odd shears - 1", + "income_bound_per_port": "thick calls - 1", + "income_per_port": 17, + "mass_surplus_formula": "M = v*income - calls*centre <= calls*(v - centre) - v", + "pr5907": { + "M": 760, + "calls": 18, + "centre": 56, + "v": 104 + } + } +} diff --git a/research/p104-controller-income-bound/SOURCES.json b/research/p104-controller-income-bound/SOURCES.json new file mode 100644 index 0000000000..4f457405d4 --- /dev/null +++ b/research/p104-controller-income-bound/SOURCES.json @@ -0,0 +1,72 @@ +{ + "base_commit": "721c03822c421b7f7fcbb2598993b947c4d88419", + "files": [ + { + "git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a", + "path": "certificates/selected-result.json", + "sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa", + "usage": "provenance" + }, + { + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "path": "docs/research/agent-task-catalog.json", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81", + "usage": "provenance" + }, + { + "git_blob": "49a2f0675819f9deeea27ed77be2c2b6ff2e87e5", + "path": "research/joint-helper-lattice/CONTROLLER.json", + "sha256": "1f5d6aa267e4e66048818714b5d3b5eae17a58abe91d15deeaa34574f7391a5f", + "usage": "input" + }, + { + "git_blob": "01775a36ae1238350bf8cd859b04cb8c4589873b", + "path": "research/kappa-backward-controller-20261023/CONTROLLER.json", + "sha256": "60cc512b39cdb9ea2c2ac6c6634c8d3f9627d96ace08ffa659a9d9472444122b", + "usage": "input" + }, + { + "git_blob": "cc539db709cf7a6c42872c4380902736ad453af3", + "path": "research/p104-productive-controller/CONTROLLER.json", + "sha256": "a84f6bbd547379597464e56c420cc665f96bc43a9a1351eed4b7cd0fce3cc4b9", + "usage": "input" + }, + { + "git_blob": "6ac5e735691555ecafe2afbcff71edd923178113", + "path": "research/p104-productive-controller/caller.py", + "sha256": "300d40043953e4f6aecfde8f2d1004b8ad6dc5a79ec3c7666c9908c2466c91c8", + "usage": "input" + }, + { + "git_blob": "aed6dbad186b12dee182344bdeebdeb5afe7945e", + "path": "research/kappa-architecture-frontier/README.md", + "sha256": "7ff067f5d0d3857d0312cf473f7149f5a8ce52fd4362665de0fc4196cd2824cc", + "usage": "provenance" + }, + { + "git_blob": "c4033090d7cd35d9c80744922c587ae115b1de8a", + "path": "research/fragmentation-ceiling/PROOF.md", + "sha256": "28be45a551ed8491be1ebb8c64acba2834aaa402452cb02e3c71c83e49232264", + "usage": "provenance" + }, + { + "git_blob": "74b67e22e6c063193a83825207cdec19a8fef7a4", + "path": "research/productive-controller-basis-search/GLOBAL-PROOF.md", + "sha256": "adc377b13924701bf5b0b50b091d8b69c90195d50ce0f6808f7fb4c7e0b16457", + "usage": "provenance" + }, + { + "git_blob": "6b207b71c01517a7bb32510010907a962d02a8bb", + "path": "research/productive-controller-basis-search/PROOF.md", + "sha256": "15ddb5c14b89eccab8c79ca49d9d6cafe2403ae5dd17bc1483b4e6221c2a8d57", + "usage": "provenance" + }, + { + "git_blob": "ac925519332bbeb6fd580c79264273deb9d3662f", + "path": "research/p104-thin-query-port-floor/README.md", + "sha256": "f446640b2502c2e16ff85dd1a302b79b969885dcc203eb1c9ad08ab8501b8fc1", + "usage": "provenance" + } + ], + "schema_version": 1 +} diff --git a/research/p104-controller-income-bound/TASK.json b/research/p104-controller-income-bound/TASK.json new file mode 100644 index 0000000000..565256acb9 --- /dev/null +++ b/research/p104-controller-income-bound/TASK.json @@ -0,0 +1,90 @@ +{ + "actual_scope": "Controller income bound for Laurent p16 callers: with free scalar ADD/swap/even central powers/stage markers and paid odd shears (LOCAL, QUERY_SHEAR), the number of outputs that end as odd central monomials is at most the number of paid shears minus one; hence the controller's mass surplus per port (target ranks minus paid lifts minus thin requests) is at most the number of thick calls minus one, attained by the three retained p16 controllers (17 = 18 - 1).", + "ai_assistance": "Prepared with Claude (Anthropic) via Claude Code.", + "author": "Matarener", + "base_commit": "721c03822c421b7f7fcbb2598993b947c4d88419", + "bottleneck_link": "On the PR5907 word the complete rank-mass surplus is 760 = 104 x 17 - 18 x 56: 17 per port from the controller, 56 per full call lost in the owned centre. The bound says the 17 cannot grow with 18 thick calls; the surplus formula M = calls x (ports - centre) - ports then makes the centre and the fragmentation of the local word the only remaining complex-side levers (fragmentation-ceiling, PR5554).", + "budget_minutes": 180, + "evidence": "research/p104-controller-income-bound/RESULT.json", + "open_questions": [ + { + "blocked_by": "A new physical primitive, not this package.", + "first_step": "State the primitive as a physical job in research/p104-productive-controller/caller.py terms and extend the even-part tracker with its action; the bound becomes twisted <= sum over paid jobs of their even-rank change.", + "question": "Does the bound extend to callers whose paid primitives are not odd central shears of one pair, for example a paid rank-r Gaussian touching several banks or several ports at once?", + "why_it_matters": "Such a primitive could twist more than one output per paid job. It is one of the ways to raise the controller income above thick calls minus one; the others are a paid odd one-bank translation Q^{+-1} and a boundary that already carries odd Q content, while a paid job writing one row with a nonzero even self-coefficient obeys the bound for any number of source banks (independent audit, PR #6120, PROOF.md A4)." + }, + { + "blocked_by": "A non-path caller word.", + "first_step": "Price M = calls x (v - c) - v against the log-moment growth for a non-path caller once one is constructed.", + "question": "Is the bound attained with more thick calls, and does the resulting invoice ever beat p = 16?", + "why_it_matters": "Income grows by (ports - centre) per thick call, but the target ranks 1 + 8(p+2) and idle chunks grow too; PR5554 covers path controllers, and the local invoice of PR5907 peaks at p = 16 (p = 20: 0.003117)." + } + ], + "original_card": { + "acceptance_gate": "A source-bound arbitrary-input identity and legal producer/consumer boundary with the complete paid and productive target invoice, including restoration, ownership, native alignment and extra charges. Price under the actual current model; historical ceiling.py assumptions must be established before use. A favorable optimistic relaxation keeps a route open but is not a completed supplier. A scoped local result remains useful; expansion requires the family-level budget gate.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "existing_checks": [ + { + "evidence": "research/qq16-caller-install/README.md", + "remaining": "Complete matched physical protocol bill, or changed source-compatible demand/circuit; no affordable supplier yet.", + "scope": "PR #4166: author-checked installed producer/service/return/bridge connection; native-component comparison loses.", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "0b082d22a0e9a442d264ab0633e35ef26c790630", + "status": "author-checked" + }, + { + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "status": "reviewed" + } + ], + "first_experiment": "Choose an exact caller and a new demand/interface hypothesis. Read the scoped #5617/#5631/#5649/#5747 and #5720/#5745 objections before rebuilding an excluded schedule. Compare the complete matched source/consumer protocols including all retained helper outputs. For an active-mode injection, first check #5745: its canonical delivery claim repays the eight removed centre jobs. Audit that exact claim or change its channel/feedback hypothesis; do not repeat the same free-injection search. Stop if the full favorable budget fails or the required restored output is unobservable.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "id": "joint-query-controller", + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "overlap_terms": [ + "query demand", + "active mode", + "5720", + "5745", + "5747", + "caller" + ], + "question": "Can a changed query demand or caller remove real work while satisfying native chronology and restoration?", + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ] + }, + "outcome": "completed", + "priority_revision": 8, + "schema_version": 1, + "scope_change_reason": "The card asks whether a changed query demand or caller can remove real work. The retained p16 controllers earn one unit of rank mass per output (the central Q axis enters each target for free) and pay one rank-one request per thin shear; a caller with the same 18 full calls but fewer thin shears, or more twisted outputs per shear, would raise the complete surplus. The even-part rank argument shows that no word in the controller alphabet can twist more outputs than paid shears minus one, so income minus thin requests never exceeds thick calls minus one. This closes the question for every caller graph in the alphabet, not only the path family of PR5405/PR5554.", + "scope_status": "refined", + "stop_rule": "Stop when the even-rank trace is 32,32,31,...,0 on all three retained controllers for two central-square values, all 32 declared outputs are odd monomials, the literal per-port income equals 17 = outputs - thin = thick - 1 on all three, and the controls (two-bank Whitehead word with three shears passes and its two-shear prefix fails; one thin shear fewer leaves a positive even rank; a free odd power is rejected) pass.", + "task_id": "joint-query-controller" +} diff --git a/research/p104-controller-income-bound/VERIFY.json b/research/p104-controller-income-bound/VERIFY.json new file mode 100644 index 0000000000..b404fc5ec3 --- /dev/null +++ b/research/p104-controller-income-bound/VERIFY.json @@ -0,0 +1,23 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/joint-helper-lattice/CONTROLLER.json", + "research/kappa-backward-controller-20261023/CONTROLLER.json", + "research/p104-productive-controller/CONTROLLER.json", + "research/p104-productive-controller/caller.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Authenticate pinned inputs; replay one central port of the three retained p16 controllers (right boundary rows, literal rational coefficients, left boundary at the end) tracking the exact rank over Q of the even-Q part after markers -> 1 and Q^2 -> 7/3 and 11/5: free operations keep it, each of the 33 paid shears changes it by at most one, the first leaves it at 32, the trace is 32,32,31,...,0 and all 32 declared diagonal outputs are odd monomials (bound 32 <= 33 - 1 attained); per-port income from the literal word = 17 = outputs - thin = thick - 1; controls: Whitehead three-shear word passes with trace 2,2,1,0 and its two-shear prefix leaves an even part, one thin shear fewer leaves a positive even rank and the declared diagonal is rejected, a free odd central power is rejected; RESULT.json compared in full." + } + ] +} \ No newline at end of file diff --git a/research/p104-controller-income-bound/incomebound.py b/research/p104-controller-income-bound/incomebound.py new file mode 100644 index 0000000000..46e07665fd --- /dev/null +++ b/research/p104-controller-income-bound/incomebound.py @@ -0,0 +1,203 @@ +"""Even-part rank tracker for Laurent controllers: paid odd shears versus twisted outputs. Apache-2.0. + +Prepared for Matarener with Claude (Anthropic), via Claude Code. Python 3.12, standard library only. + +Model (one central port). Bank i starts with the formal symbol b_i. Contents are elements of +R = K[Q, Q^-1] (x) K[stage markers]; a term is keyed by (bank, Q-exponent, stage tuple). The controller alphabet +(research/p104-productive-controller/caller.py) is replayed with the literal rational coefficients: + + free : ADD with a scalar, SWAP, SIGNED_SWAP, Q_POWER +-2, IDLE (multiplies both banks of a pair by stage markers), + the stage marker of a LOCAL; + paid : the odd shear of a LOCAL (y += Q^{-1} x, or x += -Q y backward) and of a QUERY_SHEAR. + +Even part E of a bank = its terms with even Q-exponent, odd part O = the others. Each free operation is an +invertible row operation of the matrix whose rows are the banks; it maps the even parts among themselves (even Q +powers and markers are even), so it preserves rank E. A paid shear adds Q^{+-1} x to y: E_y += Q^{+-1} O_x, a +change of one row, so rank E drops by at most one; before the first paid shear every O_x is zero, so the first +paid shear does not change rank E at all. The outputs are the rows of L.M (L the constant left boundary); a +twisted output row l_i.M has zero even part, so l_i lies in the left kernel of E, and the twisted outputs being +independent monomials, these l_i are independent (L need not be invertible). Hence with s paid shears and n_odd +twisted outputs, + + n_odd <= 32 - rank E_final <= s - 1 . + +The tracker evaluates rank over K after the homomorphism markers -> 1, Q^2 -> theta (nonzero scalar); the three +properties above (free operations preserve rank, a paid shear changes one row, twisted rows vanish) hold verbatim +in this image, so the per-event rank trace is a complete check of the argument on the given word. +""" +from fractions import Fraction as Q +import json + + +def need(ok, why): + if not ok: + raise ValueError(why) + + +def plus(dst, src, c): + for k, v in src.items(): + x = dst.get(k, 0) + c * v + if x: + dst[k] = x + else: + dst.pop(k, None) + + +def shiftq(vec, dq): + return {(b, q + dq, m): v for (b, q, m), v in vec.items()} + + +def shiftm(vec, stages): + out = {} + for (b, q, m), v in vec.items(): + key = (b, q, tuple(sorted(set(m) | set(stages)))) + out[key] = out.get(key, 0) + v + return {k: v for k, v in out.items() if v} + + +def even_coords(vec, theta): + """K-coordinates of the even part after markers -> 1, Q^2 -> theta: key = bank.""" + out = {} + for (b, q, m), v in vec.items(): + if q % 2 == 0: + out[b] = out.get(b, 0) + v * theta ** (q // 2) + return {k: v for k, v in out.items() if v} + + +def rank(rows): + """Rank over K of a list of sparse vectors (dict key -> Fraction).""" + basis = [] + for v in rows: + v = dict(v) + for key, row in basis: + if key in v: + c = v[key] + for k2, x in row.items(): + y = v.get(k2, 0) - c * x + if y: + v[k2] = y + else: + v.pop(k2, None) + if v: + key = min(v) + c = 1 / v[key] + basis.append((key, {k: x * c for k, x in v.items()})) + return len(basis) + + +def is_odd_monomial(vec): + """True if the content is a single term with odd Q-exponent.""" + return len(vec) == 1 and next(iter(vec))[1] % 2 == 1 + + +def trace(events, banks_n, theta, boundaries=None, diagonal=None): + """Replay one port. Returns the receipt: per paid-shear rank of the even part, counts and the final test. + + boundaries: the controller's constant right/left matrices; the banks start as the rows of the right matrix and + the left matrix is applied at the end (both free), after which every row must be the declared odd monomial.""" + theta = Q(theta) + need(theta != 0, 'nonzero central square') + if boundaries is None: + banks = [{(i, 0, ()): Q(1)} for i in range(banks_n)] + else: + banks = [{(j, 0, ()): Q(x) for j, x in enumerate(row) if Q(x)} for row in boundaries['right']] + E = lambda: rank([even_coords(b, theta) for b in banks]) + r0 = E() + need(r0 == banks_n, 'initial even rank') + ranks, paid, thick, thin = [r0], 0, 0, 0 + idle_stage_mass = 0 + for e in events: + op = e[0] + if op in ('LOCAL', 'QUERY_SHEAR'): + _, stage, pair, back = e + x, y = 2 * pair, 2 * pair + 1 + if back: + x, y = y, x + shear = shiftq(banks[x], 1 if back else -1) + plus(banks[y], shear, Q(-1 if back else 1)) + paid += 1 + if op == 'LOCAL': + thick += 1 + for r in (x, y): + banks[r] = shiftm(banks[r], [stage]) + else: + thin += 1 + r = E() + need(ranks[-1] - 1 <= r <= ranks[-1], 'a paid shear changes the even rank by at most one') + if paid == 1: + need(r == r0, 'the first paid shear leaves the even rank unchanged') + ranks.append(r) + elif op == 'Q_POWER': + need(e[2] in (-2, 2), 'only even central powers are free') + banks[e[1]] = shiftq(banks[e[1]], e[2]) + elif op == 'IDLE': + for r in (2 * e[1], 2 * e[1] + 1): + banks[r] = shiftm(banks[r], e[2]) + idle_stage_mass += 2 * len(e[2]) + elif op == 'ADD': + plus(banks[e[1]], banks[e[2]], Q(e[3])) + elif op in ('SWAP', 'SIGNED_SWAP'): + a, b = banks[e[1]], banks[e[2]] + banks[e[1]], banks[e[2]] = b, ({k: -v for k, v in a.items()} if op == 'SIGNED_SWAP' else a) + else: + raise ValueError('controller opcode ' + op) + if op not in ('LOCAL', 'QUERY_SHEAR'): + need(E() == ranks[-1], 'free operations preserve the even rank') + even_zero = [i for i, b in enumerate(banks) if not even_coords(b, theta)] + if boundaries is not None: + out = [] + for row in boundaries['left']: + v = {} + for j, x in enumerate(row): + if Q(x): + plus(v, banks[j], Q(x)) + out.append(v) + banks = out + need(E() == ranks[-1], 'the left boundary preserves the even rank') + odd = [i for i, b in enumerate(banks) if is_odd_monomial(b)] + if diagonal is not None: + for i, b in enumerate(banks): + (bank, qexp, stages), c = next(iter(b.items())) + need(len(b) == 1 and c == 1 and bank == i and qexp == diagonal[i][0] + and stages == tuple(s for s, yes in enumerate(diagonal[i][1:]) if yes), 'declared diagonal output %d' % i) + return {'theta': str(theta), 'banks': banks_n, 'paid_shears': paid, 'thick': thick, 'thin': thin, + 'even_rank_trace': ranks, 'final_even_rank': ranks[-1], 'twisted_outputs': len(odd), + 'even_zero_outputs': len(even_zero), 'bound_satisfied': len(odd) <= paid - 1, + 'idle_stage_mass_per_port': idle_stage_mass, 'final_banks': [sorted(str(k) for k in b) for b in banks]} + + +def income(word, fresh=8): + """Controller mass surplus per port from the literal word: targets 1 + fresh*|S| minus every paid lift and + thin request. Lifts: fresh per bank per LOCAL (two banks) and per idle stage (two banks).""" + targets = sum(1 + fresh * sum(t[1:]) for t in word['diagonal']) + locals_ = sum(1 for e in word['physical_events'] if e[0] == 'LOCAL') + thin = sum(1 for e in word['physical_events'] if e[0] == 'QUERY_SHEAR') + idle = sum(2 * len(e[2]) for e in word['physical_events'] if e[0] == 'IDLE') + lifts = fresh * (2 * locals_ + idle) + # Lift cancellation, stage by stage (the determinant argument of PROOF.md): every row-lift by D_s multiplies + # det by D_s and nothing else carries markers, so #{outputs containing s} must equal the row-lifts at s; + # likewise sum of output Q-exponents = net Q_POWER exponent (shears have determinant 1). + nstages = len(word['diagonal'][0]) - 1 + row_lifts = [0] * nstages + net_q = 0 + for e in word['physical_events']: + if e[0] == 'LOCAL': + row_lifts[e[1]] += 2 + elif e[0] == 'IDLE': + for s in e[2]: + row_lifts[s] += 2 + elif e[0] == 'Q_POWER': + net_q += e[2] + output_stages = [sum(t[1 + s] for t in word['diagonal']) for s in range(nstages)] + need(output_stages == row_lifts, 'every output stage is paid exactly once as a lift (stage by stage)') + need(sum(t[0] for t in word['diagonal']) == net_q, 'sum of output Q-exponents equals the net Q_POWER exponent') + left_rank = rank([{j: Q(x) for j, x in enumerate(row) if Q(x)} for row in word['boundaries']['left']]) + return {'targets_rank_sum': targets, 'outputs': len(word['diagonal']), 'locals': locals_, 'thin': thin, + 'idle_stage_mass': idle, 'paid_lifts': lifts, 'income': targets - lifts - thin, + 'outputs_minus_thin': len(word['diagonal']) - thin, 'stages': nstages, + 'row_lifts_per_stage': row_lifts, 'row_lifts_total': sum(row_lifts), + 'output_stage_count_equals_lifts': True, 'net_q_power': net_q, 'left_boundary_rank': left_rank} + + +def read(path): + return json.loads(open(path).read()) diff --git a/research/p104-controller-income-bound/verify.py b/research/p104-controller-income-bound/verify.py new file mode 100644 index 0000000000..d2f47de353 --- /dev/null +++ b/research/p104-controller-income-bound/verify.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +"""Verify the controller income bound: twisted outputs <= paid odd shears - 1. Apache-2.0. + +Prepared for Matarener with Claude (Anthropic), via Claude Code. Python 3.12, standard library only. +Checks: (0) pinned inputs; (1) on the three retained p16 controllers (PR5398 direct controller, the joint-helper +lattice source and the p104 productive all-forward controller) the even-part rank trace is 32, 32, 31, ..., 0 over +the 33 paid shears for two values of the central square: free operations never change it, every paid shear changes +it by at most one, the first paid shear leaves it unchanged, and all 32 declared diagonal outputs are odd monomials, +so the bound 32 <= 33 - 1 is attained with equality; (2) the per-port controller income computed from the literal +word (target ranks minus paid lifts and thin requests) equals outputs minus thin requests = 17 = thick calls - 1 +on all three, with the lift cancellation checked stage by stage (#outputs containing D_s = row-lifts at s, 194 in +all; sum of output Q-exponents = net Q_POWER) and the rank of the left boundary recorded; (3) controls: the two-bank Whitehead word with three odd shears reaches diag(Q, Q^-1) with trace +2, 2, 1, 0; its two-shear prefix leaves one bank with an even part (no diagonal); dropping the last QUERY_SHEAR of the p104 +controller leaves a positive even rank and non-twisted outputs; a word that applies Q^{+-1} for free is rejected by the +alphabet; (4) RESULT.json equals the recomputed receipt. +""" +from copy import deepcopy +from fractions import Fraction as Q +from hashlib import sha256 +from pathlib import Path +import importlib.util, json, sys, time + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +CONTROLLERS = { + 'pr5398_direct': 'research/kappa-backward-controller-20261023/CONTROLLER.json', + 'joint_helper_lattice': 'research/joint-helper-lattice/CONTROLLER.json', + 'p104_productive': 'research/p104-productive-controller/CONTROLLER.json', +} +THETAS = ['7/3', '11/5'] + + +def need(ok, why): + if not ok: + raise ValueError(why) + + +def load(name, path): + spec = importlib.util.spec_from_file_location(name, path) + mod = importlib.util.module_from_spec(spec); sys.modules[name] = mod; spec.loader.exec_module(mod) + return mod + + +def expect_failure(fn, text): + try: + fn() + except ValueError as ex: + need(text in str(ex), 'expected rejection "%s", got "%s"' % (text, ex)) + return str(ex) + raise ValueError('control accepted: ' + text) + + +def main(): + t0 = time.time() + B = load('p104_income_bound', HERE/'incomebound.py') + pins = json.loads((HERE/'SOURCES.json').read_text()) + for row in pins['files']: + if row['usage'] == 'input': + need(sha256((ROOT/row['path']).read_bytes()).hexdigest() == row['sha256'], 'source pin ' + row['path']) + print('pins ok', flush=True) + result = {'controllers': {}, 'controls': {}} + for name, rel in CONTROLLERS.items(): + word = B.read(ROOT/rel) + n = 2 * word['pairs'] + receipts = {} + for theta in THETAS: + r = B.trace(word['physical_events'], n, Q(theta), word['boundaries'], word['diagonal']) + r.pop('final_banks') + need(r['paid_shears'] == 33 and r['thick'] == 18 and r['thin'] == 15, name + ': 18 thick and 15 thin shears') + need(r['even_rank_trace'] == [32, 32] + list(range(31, -1, -1)), name + ' theta ' + theta + ': rank trace 32,32,31,...,0') + need(r['twisted_outputs'] == 32 and r['even_zero_outputs'] == 32, name + ': all 32 outputs twisted') + need(r['bound_satisfied'] and r['twisted_outputs'] == r['paid_shears'] - 1, name + ': bound attained with equality') + receipts[theta] = r + inc = B.income(word) + need(inc['income'] == inc['outputs_minus_thin'] == 17 == receipts[THETAS[0]]['thick'] - 1, name + ': income 17 = thick - 1') + need(inc['row_lifts_total'] == 194 and inc['left_boundary_rank'] == n, name + ': 194 row-lifts, invertible left boundary') + result['controllers'][name] = {'path': rel, 'events': len(word['physical_events']), 'receipts': receipts, 'income': inc} + print(name, 'events', len(word['physical_events']), 'paid shears', receipts[THETAS[0]]['paid_shears'], + 'twisted', receipts[THETAS[0]]['twisted_outputs'], 'income/port', inc['income'], flush=True) + # controls + # (a) Whitehead word on one pair: y += Q^-1 x ; x += -Q y ; y += Q^-1 x (forward, backward, forward LOCAL-free + # thin shears), then free ops; the even parts vanish after three shears, not after two + white = [['QUERY_SHEAR', 0, 0, False], ['QUERY_SHEAR', 1, 0, True], ['QUERY_SHEAR', 2, 0, False]] + r = B.trace(white, 2, Q(THETAS[0])) + need(r['even_rank_trace'] == [2, 2, 1, 0] and r['even_zero_outputs'] == 2 and r['bound_satisfied'], 'Whitehead three shears') + result['controls']['whitehead_three_shears'] = {'trace': r['even_rank_trace'], 'twisted': r['twisted_outputs'], + 'even_zero': r['even_zero_outputs'], 'final': r['final_banks']} + r2 = B.trace(white[:2], 2, Q(THETAS[0])) + need(r2['even_rank_trace'] == [2, 2, 1] and r2['even_zero_outputs'] == 1, 'two shears leave an even part') + result['controls']['whitehead_two_shears'] = {'trace': r2['even_rank_trace'], 'even_zero': r2['even_zero_outputs']} + # (b) drop the last thin shear of the p104 controller: rank 1 remains and the declared diagonal fails + word = B.read(ROOT/CONTROLLERS['p104_productive']) + cut = deepcopy(word) + last = max(i for i, e in enumerate(cut['physical_events']) if e[0] == 'QUERY_SHEAR') + cut['physical_events'].pop(last) + msg = expect_failure(lambda: B.trace(cut['physical_events'], 32, Q(THETAS[0]), cut['boundaries'], cut['diagonal']), 'declared diagonal output') + r3 = B.trace(cut['physical_events'], 32, Q(THETAS[0]), cut['boundaries']) + need(r3['paid_shears'] == 32 and r3['final_even_rank'] >= 1 and r3['even_zero_outputs'] <= 31, 'one shear fewer leaves a positive even rank') + result['controls']['drop_last_thin_shear'] = {'removed_event_index': last, 'paid_shears': 32, 'final_even_rank': r3['final_even_rank'], + 'even_zero_outputs': r3['even_zero_outputs'], 'rejection': msg} + # (c) a free odd central power is outside the alphabet + bad = deepcopy(word) + bad['physical_events'].insert(0, ['Q_POWER', 0, 1]) + msg = expect_failure(lambda: B.trace(bad['physical_events'], 32, Q(THETAS[0]), bad['boundaries'], bad['diagonal']), 'only even central powers are free') + result['controls']['free_odd_power_rejected'] = msg + print('controls ok', flush=True) + result['summary'] = {'bound': 'twisted outputs <= paid odd shears - 1', 'attained_by': 'all three p16 controllers (32 <= 33 - 1)', + 'income_per_port': 17, 'income_bound_per_port': 'thick calls - 1', + 'mass_surplus_formula': 'M = v*income - calls*centre <= calls*(v - centre) - v', + 'pr5907': {'v': 104, 'calls': 18, 'centre': 56, 'M': 18 * 48 - 104}} + if '--write' in sys.argv: + (HERE/'RESULT.json').write_text(json.dumps(result, indent=1, sort_keys=True) + '\n') + need(json.loads((HERE/'RESULT.json').read_text()) == result, 'RESULT.json equals the recomputed receipt') + print('PASS_P104_CONTROLLER_INCOME_BOUND %.1fs' % (time.time() - t0)) + + +if __name__ == '__main__': + main()