diff --git a/research/lever-mixed-targets-2979/.gitattributes b/research/lever-mixed-targets-2979/.gitattributes new file mode 100644 index 000000000..382c51165 --- /dev/null +++ b/research/lever-mixed-targets-2979/.gitattributes @@ -0,0 +1,2 @@ +# Keep the package bytes exact: the repository default normalizes text, and verify.py and SOURCES.json record hashes. +* -text diff --git a/research/lever-mixed-targets-2979/NOTICE b/research/lever-mixed-targets-2979/NOTICE new file mode 100644 index 000000000..3368fe125 --- /dev/null +++ b/research/lever-mixed-targets-2979/NOTICE @@ -0,0 +1,33 @@ +research/lever-mixed-targets-2979 +Copyright 2026 Jacob Sussman. Licensed under the Apache License, Version 2.0 (the repository's LICENSE). + +The new files were written by AI agents (Claude) under my direction. No person outside this project has +reviewed them. + +Read in place, not copied: the ten files of PR #2979 (Marius-Paul Dumitrean, research/rank7-joint-endframes, +Apache-2.0) listed in SOURCES.json. Their notices remain in force. + +Copied into this package: +- network/Gates.lean: unmodified copy of lean/complex588/Work/Bridge401/Gates.lean of Ryan Shea's repository + https://github.com/shea256/fourier-transform-below-nlogn, commit 52394849c7ecf3412d39b925d75fc7fdb98994d8, + Apache-2.0 (sha256 077bcf0362a06cdf222477ae8fb68a1c556aa740119df50520efaa6705715d3f). Its header credits + Dugongue (#401), Lydakis (#275), jacklightChen (#377), DaysSky (#363) and me. +- network/XHost/HStage.lean, HCert.lean, HostK.lean: my files, from my repository + https://github.com/jacobalansussman/wht-power-saving-lean (Apache-2.0). +- tools/*.py: my files, from the same repository (tools/README.md says what each one comes from and whose + work it implements). +- controls/t74/: data derived by my programs from the files of PR #1839 (Jeremy Kothe; its PLAN, DISPATCH and + owner table) and from my earlier lowering of #1839's two words; the same files are in my repository. + +The second instance (PR #3945, Dugongue, research/staged544-terminal-gap-fill) is not copied; instances/3945.json +records the sha256 of the files its replay reads. + +- fills/3945H/FILL.json.gz: a table of hosts for the words of PR #3945 (Dugongue, Apache-2.0), made from #3945's + own files by the allocation programs that #3945 uses (Erwan Secousses / ChaloupeMusic, PR #3815), run by me with + one added condition (every block that can be a head stays empty). The same file is in my repository + (package/leverB/fill/FILL.json.gz). instances/3945H.json records its sha256 and those of #3945's files. +- fills/2979Fc/FILL.json.gz and PROFILE.json: a table of hosts and its paid profile for the words of PR #2979 + (Marius-Paul Dumitrean, Apache-2.0), made by me from a class solution of my own mixed-integer program and a + placement with the construction of PR #3815 (Erwan Secousses / ChaloupeMusic) run on #2979's files in a + tolerant mode (README section 9). The same files are in my repository + (research/record-track/data/a-fc/design/). instances/2979Fc.json records their sha256. diff --git a/research/lever-mixed-targets-2979/PROOF.md b/research/lever-mixed-targets-2979/PROOF.md new file mode 100644 index 000000000..a1475f7dd --- /dev/null +++ b/research/lever-mixed-targets-2979/PROOF.md @@ -0,0 +1,78 @@ +# Theorem 1G: a recursion with jobs of several sizes + +Status of each part, in words: +- the theorem below is **argued by hand** in a simple model of jobs (this file), and its numerical checks were run by + computer on small rules; +- the recursion that the DFT proof actually uses, with the two job sizes of this package, is **proved in Lean** inside + OpenAI's machine model, in the repository named in README section 5; +- whether the community's outer step for integer multiplication accepts such a recursion is **open**. + +## 1. The model of jobs + +A job of size s is a transform on s address bits of a register; its cost is counted in passes per entry. A *rule* +(a word, read as a recursion) has targets W_k for k in K: in one round a unit at column c consumes W_k jobs of size +k c for each k (W = sum W_k arrays, m = max K the full job, k_min = min K the smallest job). It pays P rounds j, in +word order, of ranks r_j >= 1 (n_r rounds of rank r, r_max = max r_j), each round being one job of size r_j c, plus F +free passes. A job a + b may be split into a and b, and a plain job of size s costs s. + +The balance τ in (0, 1) is the root of + + sum_j r_j^τ = sum_k W_k k^τ. + +With the single target {73: W} this is the community's moment equation, and b = 1 - τ is its complex root. For the +lever on #2979: K = {73, 49}, W_73 = 50,218, W_49 = 16,086, and the paid ranks are those of README section 2. + +**Separation hypothesis (S):** r_max < k_min, that is, every paid block is smaller than every job. On #2979 with the +half cut, r_max = 48 < 49 = k_min. With the full cut (job 25) the other rank-48 blocks would break (S) unless they are +split, which is why the half cut is the one used. + +## 2. The theorem + +**Theorem 1G.** Under (S), T(n) <= C n^τ (ln n)^κ for all n >= 3, with κ = ceil(ln(2/η) / ln(1/θ)), +θ = ln r_max / ln k_min < 1, η a constant of the rule, and C depending only on the rule. So T(n) = O(n^(τ+δ)) for every +δ > 0: every saving below 1 - τ is reached with a fixed constant. + +The proof builds a **dilated lockstep tree** of classes of units: + +- **Lemma B (exact balance).** Index classes by sequences of rounds. Round j of a class feeds exactly one child + class, and at every point the child's demand equals the parent's supply, both jobs of the same integer size (a + product of ranks; no rounding of sizes). This uses (S). +- **Lemma C (sources only at the top).** Every job that is not produced inside the tree is a source of size in + (L/m, L], cut from the top job. +- **Lemma D (exits).** Jobs leave the tree only at the last generation, with sizes at most r_max (L/m)^θ, so ln e <= + θ ln L; they are done by fresh top calls, which costs the (ln n)^κ factor. +- **Lemma E (number of units).** The number of units is at most a constant times the sources' weight, with no log + factor. +- **Lemma F (order).** Processing class by class, round by round, is a straight-line program with no deadlock: a + round j + 1 is issued only after every unit that consumed a round-j job has finished. + +The induction then closes with the top split (Lemma A: the exact condition for closing the induction with leftovers). +The numerical checks on three small separated rules and a rank-1 control found every class exactly fed, all sources +in (L/m, L], the exits' weight equal to the sources', and the largest exit within the bound of Lemma D, at L up to +10^7 (up to 1.6e10 classes counted with multiplicity). + +Exact O(n^τ) with no log factor is **not** proved for grouped paid blocks; rules that break (S) are **open**. + +## 3. What the mixed recursion needs that the community's uniform recursion does not have + +The community's recursion is one call per job: a call of size s slices its own batch into W arrays of rank m at +column s/m, and each paid block is an independent recursive call; no call ever needs a job of another size. Theorem +1G needs: + +1. **Several sizes at once.** A unit at column c takes rank-73 arrays of size 73c and rank-49 arrays of size 49c in a + fixed ratio (50,218 : 16,086 for #2979). They come from different producers' outputs, never from one call's batch. +2. **Fractional portions.** Classes are fractional portions of batches: a portion step in the cost model, and dyadic + rounding with enough batch bits (the number of classes is polynomial in n). +3. **A class tree in lockstep.** Round j of every unit in a class is issued together, and the child class consumes + exactly those outputs plus top sources; a careless order deadlocks. +4. **A top split.** The top job is cut into portions of sizes in (n/m, n] plus rests, done recursively. +5. **Exit calls.** Jobs of size at most r_max (n/m)^θ are completed by fresh top calls. So the Lean statement uses a + rational exponent strictly inside the root, with an existential constant: the figure N/10^10 sits below the root + (README section 2), and the Lean rate fact is stated two hundredths of a grid step further inside. +6. **Words for the smaller job.** The word with each head cut must be correct for the job of 49 axes on the head's + array and the full job everywhere else. In Lean this is the head lemma: removing half of a head leaves a program + that does exactly the smaller job on that array. +7. **Hypothesis (S).** #2979 with the half cut meets it: 48 < 49. +8. **The heads.** Each cut block must be a literal head: the first non-identity operation on its own array, acting on + that array alone, with nothing hosted there before. `verify.py` counts them in my lowering and my network; the Lean + proof checks the same property for the blocks it cuts. diff --git a/research/lever-mixed-targets-2979/README.md b/research/lever-mixed-targets-2979/README.md new file mode 100644 index 000000000..13e51e064 --- /dev/null +++ b/research/lever-mixed-targets-2979/README.md @@ -0,0 +1,342 @@ +# The recursion lever on the community's words: b = 1.7887046e-3 on #2979's words with the full cut (checked by computer), DFT bounds up to 1.7806935e-3 proved in Lean (complex side only, no new κ) + +Jacob Sussman. Apache-2.0 ([NOTICE](NOTICE)). Built with AI agents (Claude); see *Credit* below. + +## 1. What this is + +Marius-Paul Dumitrean's #2979 (`research/rank7-joint-endframes`, on main) prices its words at a complex-side root of +b = 1.7290339826e-3. This package changes nothing in those words or their packing, and in its registered +instance 2979 nothing in their allocation; the headline A-fc (section 9) carries a re-solved allocation (table of +hosts) for the same words. It changes the +**recursion** that turns a word into a running time, and with that change the same words give + +| | figure | status | +|---|---|---| +| #2979 as it is on main (one job size, 73 axes) | 1.7290339826e-3 | the community's own checks; reproduced here to 24 digits | +| **#2979 with the lever (jobs of 73 and 49 axes)** | **1.7556473153e-3** | the registered check: price, heads and rate inequality checked by computer here; the DFT bound at 1.7556473e-3 is proved in Lean (section 5) | +| the same lever on Dugongue's #3945 | 1.7501109246e-3 | checked by computer with the same programs (section 6); proved in Lean at 1.7501109e-3 | +| **the lever on #3945 with every head kept** (#3945's words and price, a re-solved table of hosts) | **1.7581520168e-3** | checked by computer with the same programs and the table this package carries (section 7); the DFT bound at **1.7581520e-3** is proved in Lean (section 5) | +| **the full cut on #3945 with every head kept** (the same table; heads removed, job 25 on their arrays; the other rank-48 blocks split 24 + 24) | **1.7806935406e-3** | checked by computer with the same programs (section 8); the DFT bound at **1.7806935e-3** is proved in Lean (section 5), the highest of the five | +| the lever on #2979 with every head kept | 1.7564708e-3 | proved in Lean at 1.7564707e-3 (section 7); not replayed in this package | +| **the full cut on #2979's words with a re-solved table (A-fc)** (#2979's words, order and dispatch unchanged; a new table of hosts carried here, with its own paid profile; heads removed, job 25 on their arrays) | **1.7887045643e-3** | **the headline of this package**: checked by computer here, as registered commands (section 9); **not proved in Lean**. Its own figure with no lever is 1.6897030e-3, below #2979's, so the community's admission rejects it at its strict-gain steps (section 9) | + +The highest figure here, A-fc's 1.7887046e-3, is checked by computer and not proved in Lean; the highest figure proved +in Lean is the full cut on #3945 with every head kept, 1.7806935e-3. The figure is a saving for the **discrete Fourier transform** in OpenAI's exact-arithmetic machine model, the model +of OpenAI's "Exact Fourier transforms below n log n" (openai/math, family 130): the program computes the DFT of every +length n in O(n (log n)^(1-s)) operations with s = 1.7806935e-3. It is the same kind of number as the community's +complex side b, so the comparison above is b against b. It is not a κ for integer multiplication: whether the outer +step accepts a recursion with two job sizes is open (section 4), and no κ is claimed. + +## 2. The idea in one paragraph, and the numbers + +The community's recursion gives every array of a unit a full job of 73 axes. In #2979's unit, 16,086 of the 28,190 +rank-48 blocks per round are **literal heads**: each is the first non-identity operation on its own array, acting on +that array alone, with no helper hosted there before it. On such an array the unit can take a smaller job instead. +I cut each head by 24 of its 48 axes, so that its array takes a job of 49 axes and the head pays a block of rank 24; +every other array keeps the full job of 73. The recursion must then feed the word with jobs of two sizes in a fixed +ratio (66,304 arrays per round: 50,218 full jobs and 16,086 cut jobs). Theorem 1G ([PROOF.md](PROOF.md)) shows that +such a *mixed-target recursion* runs at the speed its balance predicts, provided every paid block is smaller than every +job (here 48 < 49). Its balance is the root b of + + sum_r n_r (r/73)^(1-b) = 50,218 + 16,086 (49/73)^(1-b), + +with the paid blocks n_r = {1: 1,645,680, 2: 470,196, 3: 159,468, 4: 71,928, 5: 13,716, 8: 5,328, 24: 16,086, +48: 12,104} per round. Cutting only half of each head (not all of it) is what keeps every paid block below the +smaller job here. I call this step *the lever*. Cutting the whole head (a job of 25 axes) needs every other paid block +below 25 as well: on #3945 with every head kept, splitting each remaining rank-48 block into two blocks of 24 on the +same role does that, and that *full cut* is the highest figure proved in Lean here (section 8). On #2979's words a +table of hosts re-solved for the full cut (A-fc) has no rank-48 block other than its 16,576 heads, so nothing needs +to be split, and the full cut prices at 1.7887045643e-3 (section 9, checked by computer, not proved in Lean). + +## 3. The registered check + + python3 -B research/lever-mixed-targets-2979/verify.py --part main # about 50 s on a laptop + python3 -B research/lever-mixed-targets-2979/verify.py --part controls # about 5 s + python3 -B research/lever-mixed-targets-2979/verify.py --instance 2979Fc --part main # A-fc, section 9 + python3 -B research/lever-mixed-targets-2979/verify.py --instance 2979Fc --part controls + +The last two run the same checks on the headline A-fc (section 9). Standard library only; it reads #2979's ten files on main (pinned in `SOURCES.json`, declared in `VERIFY.json`) and +writes only to a temporary folder. What it checks, in order: + +1. **Pins.** Every input and every data file of this package equals its recorded sha256; the stated local profile, + widths, zero buffers and complex root are read from #2979's `CLAIM.json` and `allocation/PROVIDERS.json`. +2. **My conversion of both words** (gauge44 and extra). `tools/transport.py` rebuilds the community's native + canonical form from the borrowed word (the PR does not ship one) and replays it exactly on all 632 columns, in + both orientations. `tools/lower_w.py` lowers it to my certificate format: frames nested at every climb, warps + carried by their maps, residual widths equal to #2979's widths helper by helper, the block histogram equal to + the local profile, the whole program replayed to the community's endpoint (91 zero buffers back at zero), and + seven wrong versions of each word rejected. For #3945 the same transport reproduces the community's own native + canonical words exactly (equal content hashes), which is how it was validated. +3. **The head test** (`tools/g0_staged.py`) in my network: the step order of my nine-stage hosted network, read as + data from its Lean source (`network/`; nothing is compiled), run on #2979's ORDER, DISPATCH, PLAN, TEMPLATE and all + 271,728 FILL rows. Every role lies in a window of my network, no bin exceeds its rank, every role is used once + per call, and the global paid profile equals `allocation/PROFILE.json` digit for digit. It finds **16,086 literal + heads** (8,064 in child 8, 8,022 in child 10) and 12,104 other rank-48 blocks (children 12 and 13) that are + neither heads nor tails. Its controls: moving gate A4 before its climb leaves no heads; deleting gate C2 turns + the 12,104 other blocks into tails. +4. **The price** (`tools/price_ours.py`, with `pricer.py`, an exact re-implementation of the community's moment + engine, and `mixed.py`): the uniform root of my profile equals #2979's `complex_lower` to all 24 digits; the half + cut gives 1.7556473153e-3; the full cut is priced as a what-if only. +5. **The rate certificate** (`tools/rate_cert.py`): on the half-cut profile derived from the measured heads (not + typed in), exact rational enclosures prove the inequality of section 2 at the figure 17,556,473/10^10 and + refute it one grid step higher. The derived profile equals the histogram of the Lean rate module. +6. **Controls** (second command): the head test on the earlier T74 circuit (`controls/t74`, from Jeremy Kothe's + #1839) finds the 11,010 heads (6,150 + 4,860) of the first head test; the figure is refused with a single head, + with one head fewer (16,085), for a profile that is not separated, and one grid step above. + +## 4. What changes from the community's model, and what does not + +- **Changed: the recursion.** The community's recursion is one call per job, and every paid block is an independent + call of the same job size; the ceiling tool assumes this. The mixed-target recursion needs several job sizes at + once, fractional portions of batches, a tree of classes run in lockstep, a top split and exit calls + ([PROOF.md](PROOF.md) section 3). As the card `complex-new-helper-inventory` allows when the coverage law changes, + Theorem 1G is given as the replacement bound, and the incumbent ceiling is not applied. +- **Unchanged: the words, the packing, the endpoint.** No gate moves; no axis moves between children. The cut changes + the job taken by an array whose first operation is the head; the rest of the word is the same. The allocation is + #2979's own in the registered instance 2979 and #3945's own in instance 3945; the instances 3945H and 3945F and the + headline A-fc (2979Fc) each carry a re-solved table of hosts (sections 7 and 9), checked as a table by the + community's own programs. +- **Not checked here: the community's eight-stream operator model.** The heads and the cut are checked in my + lowering and my network (and, for the DFT, proved in Lean, section 5), not in the community's exact operator + replay. The idle-axis moves retracted on 18 and 19 October changed that operator; this package does not exchange + idle blocks, but the check in that model has not been run (open question 2). +- **κ.** None is claimed. For orientation only: b = 1.7556e-3 is above the selected bit side c = 1.7334270e-3 + (#589), so if the outer step accepted this supplier the bit side would bind, at κ = 1.7334270e-3 in the newer + convention or 1.7304275e-3 in the older one. The halving guard m^2 > 2R^2 of the outer recipe, read per array, holds + for the half cut (on a head array the remaining paid block has 24 axes and 49^2 > 2 * 24^2; argued, not checked) + but fails for the full cut, the headline included (25^2 = 625 < 2 * 23^2 = 1,058; < 1,152 on #3945), so the outer + recipe as written does not take the full cut; one more reason no κ is claimed. + +## 5. The Lean proofs (outside this repository) + +The DFT bounds are proved in Lean 4 in my public repository +[jacobalansussman/wht-power-saving-lean](https://github.com/jacobalansussman/wht-power-saving-lean), commit +`563b4e6e913625637f36ba7869bf5fcd0dd4975a`, one package per instance: `package/leverF` (the full cut on #3945 with every head kept, the +highest), `package/leverB` (#3945 with every head kept, 1.7581520e-3), `package/leverA` (#2979 with every head kept, +1.7564707e-3), `package/lever2979` (#2979, 1.7556473e-3) and `package/lever` (#3945, 1.7501109e-3). For the highest, +the statement is OpenAI's `UniformFourier` statement with only the exponent (1 - 17806935/10^10) and the names changed +(statement file sha256 `2e32984d9d6a269b19d2fabafc9085360284d352d4bdccf90e4dff5786061f35`); the theorems are +`OAI.PowerSaving.transform_mainL3945F` and `OAI.PowerSaving.convolution_mainL3945F`, with only the axioms `propext`, +`Classical.choice` and `Quot.sound`. The other four are the same statement at their own exponents. The same statement one +grid step stronger is refused. The official comparator, with the Lean kernel and nanoda, accepts it against OpenAI's statement at this exponent and rejects the statement one step stronger. It is prepared for the Lean leaderboard +bigospeedrun.com/exact-dft, whose robot re-checks it independently: a pull request with it is meant to be opened alongside this package, and I will add its link and the robot's receipt as a comment once it is open. + +This repository cannot pin bytes outside its own Git history, so the link is by content: every program in `tools/` +(`*.py`) and every file under `network/` of this package equals, byte for byte, a file of that commit (`SOURCES.json` lists the pairs of +paths), and the Lean rate modules `Rate2979`, `Rate3945H` and `Rate3945F` there state the inequality of section 2 for +the profiles recorded in `instances/2979.json`, `instances/3945H.json` and `instances/3945F.json`. Lean is not run by +this check. + +## 6. The second instance: #3945 + +The same programs on Dugongue's #3945 (`research/staged544-terminal-gap-fill`, head `91f81d13`, archived on main on 20 October 2026 with the same files): +57,312 literal heads (28,672 + 28,640), the global profile equal to #3945's, the uniform root equal to its stated +root to 24 digits, and a half-cut price of **1.7501109246e-3**, certified at 17,501,109/10^10. It is not a registered +check here: when this package was made, #3945's files were on an open pull request. Its folder on main is the +default source of the instance, so it replays from the repository root with + + python3 -B research/lever-mixed-targets-2979/verify.py --instance 3945 + +(about 3 minutes; every input is checked against `instances/3945.json`; on a checkout of #3945's head, add +`--source `). The DFT bound at 1.7501109e-3 on #3945 is +proved in Lean too, in the same repository (`package/lever`). On #3945's published table the lever gives less than +on #2979's, from a unit five times the size (360 replicas against 74); with every head kept it gives more than on either published table +(section 7), and the full cut on that table gives the most (section 8). + +## 7. Every head kept: #3945 with a re-solved table of hosts + +The community's programs that decide where helper storage goes (the table of hosts, `owner/FILL.json.gz`) put each +empty rank-48 block either where it is a head or where it never is, at the same price, as their solvers happened to: +on #3945, 57,312 of the 80,640 blocks of children 8 and 10 end up as heads. I re-ran the community's own allocation +programs (Erwan Secousses' / ChaloupeMusic's, from #3815, as #3945 uses them) with one added condition, that every +block that can be a head stays empty. The result, `fills/3945H/FILL.json.gz`, keeps #3945's words, order, dispatch, +plan, template and global profile (`PROFILE.json` is unchanged), so the circuit's own price stays #3945's +1.7306632365e-3; #3945's complete stated verification (`owner/verify.py` and `admission/full_replay.py`) passes on +it from scratch, with all 119 of its controls rejected (checked by computer, the community's own programs). Then +**80,640** blocks are heads (40,320 in child 8, 40,320 in child 10), and the half cut prices at **1.7581520168e-3**: + + python3 -B research/lever-mixed-targets-2979/verify.py --instance 3945H + +(about 6 minutes; the same checks as section 3 on #3945's files and this package's table: 80,640 literal heads, +57,312 other rank-48 blocks, the global profile equal to #3945's, the uniform root equal to its stated root to 24 +digits, and the rate certificate at 17,581,520/10^10, refused one step higher). The DFT bound at 1.7581520e-3 is +proved in Lean (section 5). The commands that made the table are in the Lean repository, `package/leverB/fill/`. +On #2979 the same condition gives 16,576 heads instead of 16,086 and 1.7564708e-3 (proved in Lean at 1.7564707e-3, +one grid step lower, because the Lean rate enclosure stops just short of the rounded price); its table and the +community's complete replay of #2979 on it are in `package/leverA/fill/` of the Lean repository. + +## 8. The full cut on #3945 with every head kept + +On the same table, each of the 80,640 heads can be removed entirely instead of halved: its array then takes a job of +73 - 48 = 25 axes. The recursion needs every paid block smaller than every job, so the other 57,312 rank-48 blocks of +the unit (children 12 and 13, whole idle bins that host no role) are each split into two blocks of rank 24 on the same +role. A block of rank 24 + 24 is the product of its first 24 and its last 24 directions, so the split changes no +output; it only makes the recursion pay two blocks of 24 where it paid one of 48. Every paid block then has rank at +most 24 < 25. The balance becomes + + sum_r n_r (r/73)^(1-b) = 241,920 + 80,640 (25/73)^(1-b), + +with n_r = {1: 8,041,680, 2: 2,306,880, 3: 729,648, 4: 353,160, 5: 69,120, 8: 25,920, 24: 114,624} per unit, and its +root is **1.7806935406e-3**, 1.28 % above the half cut on the same table and 2.89 % above #3945's own figure. On #3945's +published table the full cut does not pay (1.7307680e-3, break-even 57,262 heads against 57,312); with every head +kept it does. + + python3 -B research/lever-mixed-targets-2979/verify.py --instance 3945F + +(about 3 minutes; the same checks as section 7, then the full-cut price, the profile derived from +the measured heads equal to the Lean rate module `Rate3945F`, the rate certificate at 17,806,935/10^10, refused one +step higher, and as controls the figure refused with a single head, with one head fewer, and without the split.) The +DFT bound at 1.7806935e-3 is proved in Lean (section 5, `package/leverF`); in Lean the split is a general identity +(a block of rank a + b is the product of two blocks of ranks a and b), with no hypothesis on the block. + +## 9. The headline: the full cut on #2979's words with a re-solved table (A-fc) + +**Status: checked by computer, not proved in Lean.** #2979's words, order, dispatch, plan and template are unchanged +and read in place from main; only the table of hosts is new (`fills/2979Fc/FILL.json.gz`, with its paid profile +`fills/2979Fc/PROFILE.json`). I re-solved it for the full cut: a class solution of a mixed-integer program on +#3815's Hall model, then a literal placement with #3815's own reverse-time placement (Erwan Secousses' / +ChaloupeMusic's `construction/build_fill.py`) run in a tolerant mode: a role with no planned slot left at its call +goes to the cheapest spare place, a bin open at that call that is not a head bin, not yet used at that call, and has +room in its final capacity. **Nine roles were placed that way** (8 of width 6 at call 553 and 1 of width 4 at call 0), +and 8 planned width-6 slots stayed idle. These are exactly the window, same-call and capacity rules that the +community's owner engine enforces. However the table was made, it is checked as a table: it passes #2979's unmodified +owner engine (PR2839, `allocation/vendor/independent_owners.py`, 271,728 roles, T = 74), and that engine rejects all +seven of its corruption controls. + + python3 -B research/lever-mixed-targets-2979/verify.py --instance 2979Fc --part main + python3 -B research/lever-mixed-targets-2979/verify.py --instance 2979Fc --part controls + +(the same checks as section 3, on #2979's files and this package's table: **16,576 literal heads** (8,288 in child 8, +8,288 in child 10) and **no other rank-48 block**, the global profile equal to `fills/2979Fc/PROFILE.json`, the +uniform root equal to the community's own root for this table to 24 digits, then the full-cut price, the full-cut +profile derived from the measured heads, and the rate certificate at 17,887,045/10^10, refused one step higher; as +controls, the figure is refused with a single head, with one head fewer, and with the heads kept as blocks of 48 +while their arrays take the job of 25.) Every head is removed, its array takes a job of 73 - 48 = 25 axes, and every +paid block has rank at most 23 < 25, so the recursion is separated. The balance is + + sum_r n_r (r/73)^(1-b) = 49,728 + 16,576 (25/73)^(1-b), + +with n_r = {1: 1,630,639, 2: 470,196, 3: 154,512, 4: 71,928, 5: 11,988, 6: 5, 7: 3, 8: 5,328, 17: 8, 19: 1, 23: 25,905} +per round, and its root is **b = 1.7887045643e-3** (three routes, exact rational enclosures on a 1e-24 grid, 60-digit +arithmetic and an independent 70-digit interval program, agree to 3e-60). + +**Why the community's admission rejects it.** The table's own figure with no lever (the uniform root of its paid +profile, as the community's exact moment auditor computes it) is **1.6897030e-3**, below #2979's 1.7290340e-3: this +table pays off only with the full cut. The community's checks of #2979's line, run unmodified on a fresh clone at the +base, reject it at every step that compares that lower figure with a higher one, by design, and nowhere else: + +| check of #2979's line (unmodified) | A-fc | +|---|---| +| `verify.py` (three-stage local replay of the words, 86 controls) | pass | +| `check_allocation.py`: pins, words, PROVIDERS, the PR2839 owner engine, the physical count 66,813, its 5 rejection controls | pass | +| `check_allocation.py`: the exact moment auditor (`tools/audit_allocation_moment.py`): rank mass, root bracket, exact bisection | pass, root 1.6897030e-3 | +| `check_allocation.py`: the auditor's strict-gain step (`audit_allocation_moment.py` line 65) | **rejected**: `strict frontier improvement and lower endpoint` | +| `check_cap.py`: cap certificate, rank mass, local profile paid, root at most the cap | pass | +| `check_cap.py`: `recorded gap` (line 68) | **rejected**: this is a near-optimality bound on #2979's own claim (the root within 1e-6 of the cap 1.7290358e-3), not literally a strict-gain check; A-fc's gap is 3.93e-5, the same lower figure measured against the cap | +| complete replay (`reproduce.py`): exports, fresh retained bootstrap, the native stages, owners, parent lift, rebind, discovery (7 steps), outer ledger (63 positive checks), independent check | pass | +| complete admission (`admit_extension.py` line 388) | **rejected**: `candidate must strictly improve full exact pinned frontier headline before full release` | +| the release stage, run past that step by my own driver: its `verify.py` (139 strict controls rejected) and outer checks | pass; then **rejected** at its strict-gain list over earlier packages, at `ledger kappa does not exceed PR2269` | + +The same harness passed #2979's published table and design A completely (positive controls). + +**Why the community's moment engine cannot price this figure.** The community's moment engine asserts the halving +constraint m^2 > 2 r_max^2. For the uniform model of this table it holds (73^2 = 5,329 > 2 * 48^2 = 4,608; its largest rank is the +48 of the 16,576 heads), and that is the 1.6897030e-3 above. With the cut arrays' job of 25 it fails +(25^2 = 625 < 2 * 23^2 = 1,058; after the cut the largest paid rank is 23), so the community's engine +cannot price A-fc's model with two job sizes at all. The figure 1.7887046e-3 comes from my own pricing under +Theorem 1G (`tools/price_ours.py`, `tools/mixed.py`, `tools/rate_cert.py`), which has no such condition: the full cut on +#3945 with every head kept, with 25^2 = 625 < 2 * 24^2 = 1,152, is proved in Lean the same way (section 8). + +**What is proved in Lean and what is not.** Proved in Lean, in the Lean repository of section 5: Theorem 1G, the +recursion with jobs of two sizes (`Eng.engine_seam_final`), and the general theorem of the full cut +(`cut_heads_full` in `Work/Mixed/Bridge/CoreF`), as used for the full cut on #3945 with every head kept at +1.7806935e-3. **Not in Lean: A-fc's own instance**, that is, its heads-first certificate, the cut fact on +#2979's words, and the rate fact at 17,887,045/10^10. Its heads-first certificate and the rate fact are checked by +computer (this section's commands); the cut fact on #2979's words is argued by hand from the template it shares with +#3945's (where it is proved in Lean), not checked. + +**What is claimed.** b, the complex side only, for the DFT in OpenAI's model, checked by computer. No κ: even if the +outer step accepted this supplier, κ would be capped by the selected bit side, about 1.7334e-3 (#589). The figure is +above every complex-side construction claimed on the hub by others; some research notes there print higher ceilings, +targets or hypothetical ledgers, which are not constructions. + +## Open next questions + +The structured list with first steps is `open_questions` in [TASK.json](TASK.json); in short: + +1. **The outer step with two job sizes.** Does the outer theorem accept a complex supplier whose recursion uses jobs + of 73 and 49 axes (the half cut), or of 73 and 25 axes (the full cut, the headline)? First step: write the mixed recursion as a supplier interface in the outer theorem's terms and + list the changed hypotheses (PROOF.md section 3). +2. **The cut in the community's operator model.** First step: replay the cut of a sample of heads with #3187's exact + eight-stream operator replay, with a control that a wrong cut changes the operator. +3. **A-fc in Lean.** The full cut on #2979's words is checked by computer with the re-solved table A-fc (section 9, + 1.7887046e-3), and proved in Lean on #3945 with every head kept (section 8). First step: build A-fc's instance in + Lean the way the full cut on #3945 was built (its heads-first certificate, the cut fact on #2979's words, the rate + module at 17,887,045/10^10). +4. **More heads.** Keeping every head that the table of hosts allows is done (section 7). Still open: whether some + of the remaining 'neither' blocks (children 12 and 13) can become heads by moving the first touch of their array. + First step: for each, find that touch before its climb and test whether it can be moved after it. +5. **Newer words** (for example #4088). First step: write `instances/.json` and run the head test. +6. **The log factor of Theorem 1G.** First step: search small separated rules for a flow whose exits carry less + than the sources (PROOF.md, remark after Theorem 1G). + +## Credit + +- **The words, allocation and checks this package reads** are Marius-Paul Dumitrean's #2979 (with substantial AI + assistance, Anthropic Claude via Claude Code), on Jeremy Kothe's #2957 / #2948 / #2966 rewrites, Mason Hale's #2917, + Jeremy Diviney's #2908, Dugongue's #2969, #2863 and #2839, Yiyang Lu's #2857 / #2848, RossRichardson's #2918, + Jeremy Kothe's #2894 / #2833, Tekalign's owner checker, icekylinx's auditor, themilkman216's integrality + observation and Gareth Davidson's #1995 / #2013, as #2979's NOTICE and CREDITS.md name them. +- **The borrowed helpers and their warps** that #2979 uses are Cinna Davis's (1337isnot1337, #2226), with Jeremy + Kothe's width exchange (#2312); the T74 layout underneath grows from the work of Rohan Arun, Marius-Paul Dumitrean, + Jeremy Kothe, LeverRank, Thomas DiFiore, Jeremy Diviney, Chafik Boukhalfa (chafreaky) and Vlado Vojdanovski. + The T74 control data come from Jeremy Kothe's #1839. +- **The headline's table** (`fills/2979Fc/`) was placed with the construction of Erwan Secousses (ChaloupeMusic, + #3815), its Hall model and reverse-time placement, run in a tolerant mode of mine, on #2979's own files. +- **The second instance** is Dugongue's #3945 (with substantial OpenAI Codex assistance, as its NOTICE says) and the + line of circuits it ends, as its NOTICE names them: dataisfire's #3734, zxv's #3682 and #3638, Ross Richardson's + #3605, Erwan Secousses' (ChaloupeMusic's) #3815, hexapode's #3802 and #3875, Dugongue's #3857 and #3929, and the + earlier line under them. I read and re-ran the checks of #3945 by others, among them Chris R's (Clear1nsight's) + audits #3969, #3988, #3994 and #4016. The table + with every head kept (`fills/3945H/`) was made with the allocation programs of Erwan Secousses (ChaloupeMusic, + #3815) that #3945 uses, from #3945's own files. +- **The moment engine** that `tools/pricer.py` re-implements is the community's + (`research/native-complex-moment552`, `research/gauge44-frames-x`). +- **The Lean route** rests on Ryan Shea's conversion pipeline, generators and Lean tree, Nil Mamano's gauged Lean + extension and Fourier chain templates, and OpenAI's model and statement. `network/Gates.lean` is a file of Ryan + Shea's tree; its header credits Dugongue (#401), Lydakis (#275), jacklightChen (#377) and DaysSky (#363). +- **New here** (mine): the lever (the head test, the half cut, the full cut with the split, the mixed-target + recursion and Theorem 1G), the tables with every head kept (the added condition), the table A-fc (its class solution and the tolerant placement), + my transport and lowering of these words, the rate + certificate, and the Lean proofs of section 5. The new files were + written by AI agents (Claude) under my direction; the Lean proof is checked by Lean's kernel, and no person outside + this project has reviewed this package. + +## Files + +| path | what | +|---|---| +| `verify.py` | the registered check (both parts) and the replays of the other instances | +| `instances/2979.json`, `instances/3945.json`, `instances/3945H.json`, `instances/3945F.json` | each instance's input paths and sha256, the stated values, and the recorded results (`3945F`: the full cut on the table of `3945H`) | +| `fills/3945H/FILL.json.gz` | the table of hosts of #3945 with every head kept (section 7) | +| `instances/2979Fc.json`, `fills/2979Fc/FILL.json.gz`, `fills/2979Fc/PROFILE.json` | the headline A-fc: its instance, its table of hosts and that table's paid profile (section 9) | +| `tools/` | `transport.py`, `lower_w.py` (my conversion), `g0_staged.py` (head test), `pricer.py`, `mixed.py`, `lever_price.py`, `price_ours.py` (price), `rate_cert.py` (rate certificate); [tools/README.md](tools/README.md) says where each comes from | +| `network/` | the Lean source of my nine-stage hosted network, read as data by the head test | +| `controls/t74/` | the T74 regression data | +| `PROOF.md` | Theorem 1G and what the mixed recursion needs | +| `RESULT.json` | the result in machine-readable form (no κ field) | +| `TASK.json`, `SOURCES.json`, `VERIFY.json`, `NOTICE`, `.gitattributes` | package metadata | + +## Sources + +- #2979: `research/rank7-joint-endframes` on main, head be191346391661f4d35fc0d1508d0a6029572576; the ten inputs + with their Git blobs and sha256 in `SOURCES.json`. #3945: head 91f81d131252db704f945891da1ea54e29d46b8b. The + table with every head kept: `fills/3945H/FILL.json.gz`, sha256 + 9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3. The headline's table (A-fc): + `fills/2979Fc/FILL.json.gz`, sha256 7fc766c6c3e1561cee60b258138a918020b96d85ea782a2b01ad0ee035fd082e; the programs + that made it are in the Lean repository, `research/record-track/programs/a-fc/`, with the class solution and the + re-create commands in `research/record-track/data/a-fc/`. The community's checks of section 9 were run on a fresh + clone at the base on 20 October 2026. +- The package's base commit is `SOURCES.json` `base_commit`. Hub figures as their authors state them, read on + 20 October 2026, 03:00 EDT. +- The Lean repository: commit `563b4e6e913625637f36ba7869bf5fcd0dd4975a`; leaderboard submission a pull request to bigospeedrun/verifier adding submissions/dft/jacobalansussman-lever-3945-full-cut. diff --git a/research/lever-mixed-targets-2979/RESULT.json b/research/lever-mixed-targets-2979/RESULT.json new file mode 100644 index 000000000..b3a8b54f9 --- /dev/null +++ b/research/lever-mixed-targets-2979/RESULT.json @@ -0,0 +1,185 @@ +{ + "schema": "lever-mixed-targets/1", + "what": "The recursion lever on community words: the DFT saving of the half cut (each literal rank-48 head cut by 24 of its 48 axes, job 49 on its array, every other array the full job 73), in OpenAI's exact-arithmetic machine model for the DFT; registered on PR #2979's words (on main), replayed on PR #3945's words and on #3945 with every head kept, and, on that table, the FULL cut (each head removed, job 25 on its array, every other rank-48 block split 24 + 24). Complex side only; no kappa is claimed. Headline: on #2979's words with a table of hosts re-solved for the full cut (A-fc, instance 2979Fc), the full cut prices at b = 1.7887045643e-3, checked by computer, not proved in Lean.", + "headline": { + "instance": "2979Fc", + "what": "A-fc: #2979's words, order, dispatch, plan and template unchanged (the price changes with the table: its own uniform figure is 1.6897030e-3), with a table of hosts re-solved for the full cut (fills/2979Fc/FILL.json.gz, a class solution of a mixed-integer program on #3815's Hall model, placed with #3815's reverse-time placement in a tolerant mode: 9 roles placed in spare bins open at their call, 8 planned width-6 slots left idle); each of the 16,576 literal heads removed (job 73 - 48 = 25 on its array); no other rank-48 block, so nothing is split; every paid block has rank at most 23 < 25", + "figure": "1.7887045e-3", + "figure_rounded": "1.7887046e-3", + "dft_numerator": 17887045, + "dft_denominator": 10000000000, + "uniform_b_of_the_table": "1.6897030111e-03", + "uniform_b_note": "the table's own figure with no lever, as the community's exact moment auditor computes it; below #2979's 1.7290339826e-03, so the community's admission rejects this table at its strict-gain steps (README section 9)", + "half_cut_b": "1.7159005029e-03", + "full_cut_b": "1.7887045643e-03", + "heads": 16576, + "other_rank48": 0, + "full_cut_profile": { + "1": 1630639, + "2": 470196, + "3": 154512, + "4": 71928, + "5": 11988, + "6": 5, + "7": 3, + "8": 5328, + "17": 8, + "19": 1, + "23": 25905 + }, + "jobs": { + "73": 49728, + "25": 16576 + }, + "largest_paid_block": 23, + "table_of_hosts_sha256": "7fc766c6c3e1561cee60b258138a918020b96d85ea782a2b01ad0ee035fd082e", + "community_checks_on_this_table": "every check of #2979's line passes except the strict-gain steps (check_allocation.py moment auditor, admit_extension.py line 388, the release's strict-gain list at PR2269) and check_cap.py's recorded gap (a near-optimality bound on #2979's own claim); run unmodified on a fresh clone at the base (README section 9)", + "community_moment_engine": "cannot price this two-target model: its halving constraint m^2 > 2 r_max^2 holds for the uniform model (5,329 > 2 * 48^2 = 4,608) and fails for the job of 25 (625 < 2 * 23^2 = 1,058); the figure comes from this package's pricing under Theorem 1G", + "registered_here": true, + "lean_status": "not proved in Lean. Proved in Lean (Lean repository): Theorem 1G (Eng.engine_seam_final) and the general full-cut theorem (cut_heads_full, Work/Mixed/Bridge/CoreF). Not in Lean: this table's instance. Its heads-first certificate and the rate fact 17887045/10^10 are checked by computer; the cut fact on #2979's words is argued by hand from the template it shares with #3945 (where it is proved in Lean), not checked", + "half_cut_note": "the half cut (job 49) on this table is below #2979's own half cut 1.7556473153e-03; the table is made for the full cut" + }, + "first_instance": { + "instance": "2979", + "figure": "1.7556473e-3", + "dft_numerator": 17556473, + "dft_denominator": 10000000000, + "uniform_b_of_the_word": "1.7290339826e-03", + "half_cut_b": "1.7556473153e-03", + "heads": 16086, + "other_rank48": 12104, + "job_sizes": { + "full": 73, + "cut": 49 + }, + "largest_paid_block": 48, + "note": "the first registered instance (#2979's published table); the headline is A-fc (headline), the highest Lean-checked bound is highest_lean_bound" + }, + "highest_lean_bound": { + "instance": "3945F", + "figure": "1.7806935e-3", + "dft_numerator": 17806935, + "dft_denominator": 10000000000 + }, + "second_instance": { + "instance": "3945", + "author": "Dugongue", + "figure": "1.7501109e-3", + "dft_numerator": 17501109, + "uniform_b_of_the_word": "1.7306632365e-03", + "half_cut_b": "1.7501109246e-03", + "heads": 57312, + "registered_here": false, + "why": "its files were on an open pull request when this package was made (archived on main on 20 October 2026 with the same files); README section 6 gives the replay", + "lean_status": "proved in Lean (package/lever of the Lean repository)" + }, + "third_instance": { + "instance": "3945H", + "what": "#3945 with every head kept: #3945's words, order, dispatch, plan, template and price, with the table of hosts fills/3945H/FILL.json.gz (the community's allocation programs with one added condition)", + "figure": "1.7581520e-3", + "dft_numerator": 17581520, + "uniform_b_of_the_word": "1.7306632365e-03", + "half_cut_b": "1.7581520168e-03", + "heads": 80640, + "other_rank48": 57312, + "table_of_hosts_sha256": "9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3", + "community_complete_verification_on_this_table": "passes (owner/verify.py, admission/full_replay.py; 119 of 119 controls rejected), checked by computer", + "registered_here": false, + "why": "its files were on an open pull request when this package was made (archived on main on 20 October 2026 with the same files); README section 7 gives the replay", + "lean_status": "proved in Lean (package/leverB of the Lean repository)" + }, + "fourth_instance": { + "instance": "3945F", + "what": "the full cut on #3945 with every head kept: the table of the third instance; each of the 80,640 literal heads removed (job 73 - 48 = 25 on its array) and each of the other 57,312 rank-48 blocks split into two blocks of rank 24 on the same role (an exact identity); every paid block then has rank at most 24 < 25", + "figure": "1.7806935e-3", + "dft_numerator": 17806935, + "uniform_b_of_the_word": "1.7306632365e-03", + "half_cut_b": "1.7581520168e-03", + "full_cut_b": "1.7806935406e-03", + "heads": 80640, + "other_rank48_split": 57312, + "full_cut_profile": { + "1": 8041680, + "2": 2306880, + "3": 729648, + "4": 353160, + "5": 69120, + "8": 25920, + "24": 114624 + }, + "jobs": { + "73": 241920, + "25": 80640 + }, + "table_of_hosts_sha256": "9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3", + "registered_here": false, + "why": "its files were on an open pull request when this package was made (archived on main on 20 October 2026 with the same files); README section 8 gives the replay", + "lean_status": "proved in Lean (package/leverF of the Lean repository)" + }, + "other_lean_bounds": { + "3945 with every head kept (half cut)": "1.7581520e-3 (package/leverB)", + "2979": "1.7556473e-3 (package/lever2979)", + "2979 with every head kept": "1.7564707e-3 (package/leverA; its price 1.7564708e-3)", + "3945": "1.7501109e-3 (package/lever)" + }, + "what_if_not_claimed": { + "full_cut_b_2979": "1.7744822149e-03", + "full_cut_b_2979_every_head_kept": "1.7797095e-03", + "note": "the full cut on #2979 (heads cut fully, job 25; the other rank-48 blocks split 24 + 24), on #2979's table and on the table with every head kept; priced only, not built in Lean, not claimed. The full cut on #3945 with every head kept is built (fourth_instance). The full cut on #2979's words with a re-solved table (A-fc) is the headline (checked by computer, not proved in Lean)." + }, + "status": { + "headline_A-fc_price_heads_and_rate_certificate": "checked by computer (verify.py --instance 2979Fc, both parts); not proved in Lean", + "price_heads_and_rate_certificate_other_instances": "checked by computer (verify.py, both parts, and --instance 3945 / 3945H / 3945F)", + "dft_bound": "proved in Lean up to 1.7806935e-3 (instance 3945F; lean section below); the headline's 1.7887045e-3 is not proved in Lean", + "kappa": "not claimed", + "outer_step_with_two_job_sizes": "open" + }, + "lean": { + "repository": "https://github.com/jacobalansussman/wht-power-saving-lean", + "commit": "563b4e6e913625637f36ba7869bf5fcd0dd4975a", + "solution_module": "Work.FourierL3945F.Main", + "theorems": [ + "OAI.PowerSaving.transform_mainL3945F", + "OAI.PowerSaving.convolution_mainL3945F" + ], + "statement": "OpenAI's UniformFourier statement (openai/math, family 130, commit fd4aeeb2ee4fc729c18d98444fed42fd0529eeeb), only the exponent and the names changed", + "statement_file_sha256": "2e32984d9d6a269b19d2fabafc9085360284d352d4bdccf90e4dff5786061f35", + "axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "one_step_stronger_refused": "refused by Compare.lean and by the official comparator at 1 - 17806936/10^10", + "official_comparator": "accepted (Lean kernel and nanoda); one step stronger rejected", + "leaderboard": "prepared as a pull request to bigospeedrun/verifier, meant to be opened alongside this package; link and receipt to follow as a comment once it is open", + "rate_modules": { + "2979": "Work/Mixed/Rate2979.lean", + "3945": "Work/Mixed/Rate3945.lean", + "3945H": "Work/Mixed/Rate3945H.lean", + "3945F": "Work/Mixed/Rate3945F.lean" + } + }, + "instances": { + "2979": "instances/2979.json", + "3945": "instances/3945.json", + "3945H": "instances/3945H.json", + "3945F": "instances/3945F.json", + "2979Fc": "instances/2979Fc.json" + }, + "package_data_sha256": { + "network/Gates.lean": "077bcf0362a06cdf222477ae8fb68a1c556aa740119df50520efaa6705715d3f", + "network/XHost/HCert.lean": "68c0bee5f71a75869f5fabfa98ce5c5f22c2a09bfecf837b5a2688eefbd70a23", + "network/XHost/HStage.lean": "fb59e998e31b7fb5501ff79f98072dd09f8283f51e65f5c6b7d36a5365ab577a", + "network/XHost/HostK.lean": "595a84d2ca7c46e8f14c2481d602a0d1c07d6c918547d9fc65f8f041ab5b1eeb", + "controls/t74/FILL.json.gz": "3bdcbb685677bebb0c4e16c58888e4c7e31b145d525f589e63ed07906aed7085", + "controls/t74/PROFILE.json": "a77801295540df04326c701c3b1ed9198cd17343db4a2f6070932b664b8961c4", + "controls/t74/extra.gcert1b.json.gz": "6aa87f1513dab2581f9e8a211d935f44e2d585512426346fdd1182a9457a03a7", + "controls/t74/gauge44.gcert1b.json.gz": "3dd245e81edac391a143361c43e42023bd0b288a4bf2a91352913bdfabc55476", + "controls/t74/inputs/DISPATCH.json": "ff91d189be8ad2d083ef74e4d411e67d39c5fb0d15278dff126df39ae12baa0a", + "controls/t74/inputs/ORDER.json": "b98452454a86bb6ea61e65bf2079d534bd8487ce6b288d04f41528c566da203d", + "controls/t74/inputs/PLAN.json.gz": "bb18714735a2e239fc59d2d92ac3716e32c5046be6b708add33662fe2aa73aff", + "fills/3945H/FILL.json.gz": "9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3", + "fills/2979Fc/FILL.json.gz": "7fc766c6c3e1561cee60b258138a918020b96d85ea782a2b01ad0ee035fd082e", + "fills/2979Fc/PROFILE.json": "5df7941120150492c64e62dc3362095eff3dfac9facff041ebb5c25b2e78f75e" + } +} diff --git a/research/lever-mixed-targets-2979/SOURCES.json b/research/lever-mixed-targets-2979/SOURCES.json new file mode 100644 index 000000000..13cf6fc07 --- /dev/null +++ b/research/lever-mixed-targets-2979/SOURCES.json @@ -0,0 +1,108 @@ +{ + "schema_version": 1, + "base_commit": "12fa8c5c844be21bfefb38a19503fbd867a11244", + "upstream_repository": "https://github.com/CrocSwap/integer-mult-bounds", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "64bfc5af6709ed9811171e0a2108f05e1219cb65", + "sha256": "352a6184713b8843d96fd2c2071eb7aeaa655906b7c51d45ad444912666c8a96" + }, + { + "path": "research/rank7-joint-endframes/data/WORD-base.json.gz", + "usage": "input", + "git_blob": "d9aa96a93fea5f7395e7783aef0bc117c0a0ae89", + "sha256": "abaf67bfcb257528658c906b612f57025617592bd7889828f92b97a5f4f4300d" + }, + { + "path": "research/rank7-joint-endframes/data/WORD-extra.json.gz", + "usage": "input", + "git_blob": "74f6cb64595c21f7726ae77e69437868620bdcee", + "sha256": "e0eaf64c4d5d324693d43889bce1b9e53e8da00402105c8c978fd102f208bed7" + }, + { + "path": "research/rank7-joint-endframes/allocation/FILL.json.gz", + "usage": "input", + "git_blob": "8d4fd644d60ba2c98106dc770803b647afdf0963", + "sha256": "c2136be9434cda511a1a8a44d98f9f72ea5376830a8426674253b4ee351c4c39" + }, + { + "path": "research/rank7-joint-endframes/allocation/ORDER.json", + "usage": "input", + "git_blob": "7409c4df1092241729739596c7648bda504e6aad", + "sha256": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1" + }, + { + "path": "research/rank7-joint-endframes/allocation/DISPATCH.json", + "usage": "input", + "git_blob": "9544fee4e6ee1f202cee22bfaeaf229ee3b2515e", + "sha256": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c" + }, + { + "path": "research/rank7-joint-endframes/allocation/PROFILE.json", + "usage": "input", + "git_blob": "46a83eeda67ab67cccbffe8b7ad8e44368b40ea7", + "sha256": "94a819747f3ced41f1544ada0036c983fc0c92847b9644380f877a06cd7931cf" + }, + { + "path": "research/rank7-joint-endframes/allocation/PROVIDERS.json", + "usage": "input", + "git_blob": "e1d99e12cfa3ac8375984d85c0b040dc36ea1312", + "sha256": "f2edb7922f3029a5d607437e737775ff3371bca49ebab62e5e2495d16d3bf573" + }, + { + "path": "research/rank7-joint-endframes/allocation/vendor/PLAN.json.gz", + "usage": "input", + "git_blob": "7a1db55a4d53ee99280be4f3ab7d29f7b2033adf", + "sha256": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e" + }, + { + "path": "research/rank7-joint-endframes/allocation/vendor/TEMPLATE.json.gz", + "usage": "input", + "git_blob": "114808c32b1799da53524bdc25cea67efb60009e", + "sha256": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e" + }, + { + "path": "research/rank7-joint-endframes/CLAIM.json", + "usage": "input", + "git_blob": "8ec2ce4e440c0b584ee982c551e526a011c9324c", + "sha256": "436e0d297cbdf195445d3697d496ac675e95210b79e70ce602a6a6667a4c6ce9" + } + ], + "inputs_note": "The ten input rows are PR #2979's files (Marius-Paul Dumitrean, research/rank7-joint-endframes, merged on main at head be191346391661f4d35fc0d1508d0a6029572576). They are read in place; nothing of #2979 is copied into this package.", + "external_sources": [ + { + "what": "the Lean proofs of the DFT bounds and the published copies of this package's programs and network files", + "repository": "https://github.com/jacobalansussman/wht-power-saving-lean", + "commit": "563b4e6e913625637f36ba7869bf5fcd0dd4975a", + "byte_equality": "every program in tools/ (*.py), every file under network/ and both files under fills/2979Fc/ of this package equals, byte for byte, a file of that commit (the pairs of paths are listed in 'paths'); this cannot be pinned here because that commit is not a Git object of this repository", + "paths": "tools/transport.py = tools/lever-hub/transport.py; tools/lower_w.py = tools/lever-hub/lower_w.py; tools/rate_cert.py = tools/lever-hub/rate_cert.py; tools/g0_staged.py = tools/lever/g0_staged.py; tools/pricer.py = tools/lever/pricer.py; tools/mixed.py = tools/lever/mixed.py; tools/lever_price.py = tools/lever/lever_price.py; tools/price_ours.py = tools/lever/price_ours.py; network/Gates.lean = tools/lever-hub/network/Gates.lean; network/XHost/HCert.lean = tools/lever-hub/network/XHost/HCert.lean; network/XHost/HStage.lean = tools/lever-hub/network/XHost/HStage.lean; network/XHost/HostK.lean = tools/lever-hub/network/XHost/HostK.lean; fills/3945H/FILL.json.gz = package/leverB/fill/FILL.json.gz; fills/2979Fc/FILL.json.gz = research/record-track/data/a-fc/design/FILL.json.gz; fills/2979Fc/PROFILE.json = research/record-track/data/a-fc/design/PROFILE.json" + }, + { + "what": "network/Gates.lean", + "repository": "https://github.com/shea256/fourier-transform-below-nlogn", + "commit": "52394849c7ecf3412d39b925d75fc7fdb98994d8", + "path": "lean/complex588/Work/Bridge401/Gates.lean", + "sha256": "077bcf0362a06cdf222477ae8fb68a1c556aa740119df50520efaa6705715d3f" + }, + { + "what": "the second instance, PR #3945 (Dugongue, research/staged544-terminal-gap-fill), archived on main on 20 October 2026 with the same files as its head (merge commit 0a2d65f22afd532ce3d17cdf229d98fbed910d59)", + "head": "91f81d131252db704f945891da1ea54e29d46b8b", + "pinned_in": "instances/3945.json (sha256 of each input file)" + }, + { + "what": "the third instance, PR #3945 with every head kept: #3945's files (the head above) with this package's table of hosts fills/3945H/FILL.json.gz, made by the allocation programs that #3945 uses (Erwan Secousses / ChaloupeMusic, #3815) with one added condition; the commands that made it are in the Lean repository's package/leverB/fill/", + "head": "91f81d131252db704f945891da1ea54e29d46b8b", + "pinned_in": "instances/3945H.json (sha256 of each input file and of the table of hosts)", + "table_of_hosts_sha256": "9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3" + }, + { + "what": "the fourth instance, the full cut on PR #3945 with every head kept: #3945's files (the head above) with the same table of hosts fills/3945H/FILL.json.gz; nothing new is read", + "head": "91f81d131252db704f945891da1ea54e29d46b8b", + "pinned_in": "instances/3945F.json (sha256 of each input file and of the table of hosts)", + "table_of_hosts_sha256": "9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3" + } + ], + "source_boundary": "Only this new package is submitted. No file outside research/lever-mixed-targets-2979 changes." +} diff --git a/research/lever-mixed-targets-2979/TASK.json b/research/lever-mixed-targets-2979/TASK.json new file mode 100644 index 000000000..b5e674393 --- /dev/null +++ b/research/lever-mixed-targets-2979/TASK.json @@ -0,0 +1,96 @@ +{ + "schema_version": 1, + "task_id": "complex-new-helper-inventory", + "priority_revision": 7, + "base_commit": "12fa8c5c844be21bfefb38a19503fbd867a11244", + "original_card": { + "id": "complex-new-helper-inventory", + "question": "Can a new local cost interface change the deficit-to-recursive-cost ratio beyond current packing?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/heterogeneous-owner-assembly/README.md", + "certificates/selected-result.json", + "research/selected-k8-unrestricted-ends/README.md" + ], + "methods": [ + "Propose a changed helper inventory and derive an optimistic exact moment.", + "Design a small completed instance and independently verify its endpoint and rank bill." + ], + "acceptance_gate": "A new physically realizable contract outside the frozen catalogue whose per-call profile, screened with ceiling.ceiling(), beats the selected word's packing ceiling; a lower cap does not establish identical circuitry or order attainable optima, and is insufficient to pass the stronger-budget target under this model. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin.", + "bottleneck_link": "Packing of the selected word is capped at +0.87% (ceiling model); only a lower local excess spend or a changed coverage law raises the cap.", + "allowed_variations": [ + "Narrow to one changed boundary or helper type with explicit counts.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Mixing only providers already inside the pinned catalogue.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "helper inventory", + "heterogeneous-owner", + "mutable leaver" + ] + }, + "scope_status": "changed", + "actual_scope": "On PR #2979's words (Marius-Paul Dumitrean; unchanged, read in place from main) and, in the registered instance 2979, its allocation: the recursion lever. In #2979's unit, 16,086 of the 28,190 rank-48 blocks (8,064 in child 8, 8,022 in child 10) are literal heads in my lowering and my network: each is the first non-identity operation on its own array, on that array alone, with nothing hosted there before. Cutting each head by 24 of its 48 axes lets its array take a job of 49 axes instead of 73, and a recursion that feeds a word with jobs of two sizes in a fixed ratio (the mixed-target recursion, Theorem 1G of PROOF.md) prices the word at b = 1.7556473153e-3 for the DFT, against #2979's uniform 1.7290339826e-3. The registered check re-derives the heads, the profile and the price from #2979's files and certifies the rate inequality exactly; the DFT bound itself is proved in Lean outside this repository (README section 5). The same check on PR #3945 (second instance, not registered here because its files were on an open pull request when this package was made; archived on main on 20 October 2026 with the same files) gives 57,312 heads and 1.7501109246e-3. On #3945's words with a table of hosts re-solved so that every head is kept (fills/3945H/FILL.json.gz, made by #3815's allocation programs with one added condition; #3945's own complete verification passes on it), instance 3945H gives 80,640 heads and a half-cut price of 1.7581520168e-3, and instance 3945F, the full cut on the same table (the heads removed, job 25 on their arrays; the other 57,312 rank-48 blocks split 24 + 24, so every paid block has rank at most 24 < 25), gives 1.7806935406e-3; the DFT bounds at 1.7581520e-3 and 1.7806935e-3 are proved in Lean outside this repository (README sections 5, 7 and 8). Neither is registered, for the same reason as the second instance. Headline (registered, verify.py --instance 2979Fc, both parts): #2979's words, order and dispatch with a table of hosts re-solved for the full cut (A-fc, fills/2979Fc/); removing its 16,576 literal heads (job 25 on their arrays; no other rank-48 block, so every paid block has rank at most 23 < 25) prices it at b = 1.7887045643e-3, certified at 17887045/10^10; checked by computer, not proved in Lean. Its own uniform figure, 1.6897030e-3, is below #2979's, so the hub's admission rejects it at its strict-gain steps (README section 9).", + "scope_change_reason": "The card asks whether a changed local cost interface beats the current packing within the hub's model. This package does not change the word, the inventory or the packing: it changes the recursion, which is the coverage law. The hub's recursion gives every array the same job; the mixed-target recursion gives the head arrays a job of 49 axes and every other array the full 73. The card's own allowed variation covers this case ('If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope'). The replacement bound is Theorem 1G (PROOF.md), whose hypothesis is that every paid block is smaller than every job (48 < 49); the incumbent ceiling tool assumes uniform jobs and is not applied. The figure is a complex-side b for the DFT in OpenAI's exact-arithmetic machine model; whether the hub's outer step for integer multiplication accepts a supplier with two job sizes is open, so no kappa is claimed.", + "bottleneck_link": "The complex side binds (current priorities); the lever adds +1.539 % to #2979's complex root without changing a single gate of its words, and its size grows with the number of literal heads (break-even 1 head for the half cut). On #2979 the half cut lifts b from 1.7290339826e-3 to 1.7556473153e-3, above the selected bit side c = 1.7334270e-3, so if the hub's outer step accepted it the bit side would bind. With a table of hosts re-solved for the full cut on the same words (the headline A-fc, checked by computer, not proved in Lean), b is 1.7887045643e-3, +3.451 % over #2979's root; the highest figure proved in Lean is the full cut on #3945 with every head kept, 1.7806935e-3.", + "budget_minutes": 300, + "stop_rule": "Publish only if the head count in my lowering equals the count from the community's own allocation, the global profile equals PROFILE.json digit for digit, the uniform root reproduces #2979's stated root to 24 digits, the half-cut figure is strictly above every complex-side construction claimed on the hub by others, and the DFT bound at that figure is proved in Lean with the standard axioms and refused one grid step higher. For the headline A-fc the same on its own table and paid profile (the head count from my lowering and from the table, the global profile equal to fills/2979Fc/PROFILE.json, the uniform root equal to the community's root for this table to 24 digits, the full-cut figure strictly above every complex-side construction claimed on the hub by others, its rate certificate at 17887045/10^10 refused one grid step higher), except that its DFT bound is not proved in Lean, which the package states.", + "outcome": "completed", + "evidence": "verify.py --part main (standard library): pins; my transport and lowering of both #2979 words (exact replays, residual widths helper by helper, 7 rejected mutants each, recorded content hashes); the head test in my network on all 271,728 FILL rows (16,086 heads, 12,104 other rank-48 blocks, global profile = PROFILE.json, two network controls); the price (uniform root = CLAIM.json complex_lower to 24 digits, half cut 1.7556473153e-3, full cut 1.7744822149e-3 as a what-if); the exact rational rate certificate at 17556473/10^10, refuted at 17556474/10^10. verify.py --part controls: the T74 regression (11,010 heads) and four price controls. Outside this repository (README section 5): the Lean proofs of OpenAI's DFT statement with the exponent 1 - 17556473/10^10 (this instance) and, for the instances below, 1 - 17581520/10^10 (3945H) and 1 - 17806935/10^10 (3945F); the leaderboard's own re-check is of the last one. Second instance: verify.py --instance 3945 on #3945's head files (57,312 heads, 1.7501109246e-3, all controls pass). Headline: verify.py --instance 2979Fc --part main and --part controls (registered): the table and its paid profile pinned by sha256 (fills/2979Fc/FILL.json.gz and PROFILE.json, recorded in instances/2979Fc.json), 16,576 literal heads (8,288 + 8,288) and no other rank-48 block, the global profile equal to fills/2979Fc/PROFILE.json, the uniform root equal to the community's root for this table (1.6897030111e-3) to 24 digits, the full-cut price 1.7887045643e-3, the full-cut profile derived from the measured heads, and the exact rational rate certificate at 17887045/10^10, refused at 17887046/10^10; controls: the figure refused with a single head, with one head fewer, and with the heads kept as blocks of 48 while their arrays take the job of 25. Not in Lean (README section 9). Third and fourth instances: verify.py --instance 3945H (the table pinned by sha256, 80,640 heads, 57,312 other rank-48 blocks, the global profile equal to #3945's, the uniform root equal to its stated root to 24 digits, half cut 1.7581520168e-3, the rate certificate at 17581520/10^10, refused one step higher) and verify.py --instance 3945F (the full cut on the same table, 1.7806935406e-3, the profile derived from the measured heads equal to the Lean rate module Rate3945F, the rate certificate at 17806935/10^10, refused one step higher; controls: the figure refused with a single head, with one head fewer and without the split).", + "author": "Jacob Sussman", + "ai_assistance": "Substantial AI assistance: the programs, checks, Lean files and texts were written by AI agents (Anthropic Claude) under my direction. The Lean proof is checked by Lean's kernel; no independent human review of this package is claimed.", + "open_questions": [ + { + "question": "Does the hub's outer step for integer multiplication accept a complex supplier whose recursion uses two job sizes (73 and 49 axes for the half cut, 73 and 25 for the full cut of the headline) in a fixed ratio?", + "why_it_matters": "Only then does the complex-side b of this package become a supplier for kappa; until then it is a DFT result in OpenAI's model, compared with the hub's complex side b against b.", + "first_step": "Write the mixed-target recursion as a supplier interface in the terms of the outer theorem the hub uses (its recursion, its halving guard m^2 > 2R^2, its portion and rounding steps) and list which hypotheses change; PROOF.md section 3 lists what the mixed recursion needs that the uniform one lacks.", + "blocked_by": "A precise statement of the outer theorem's supplier hypotheses for a uniform supplier." + }, + { + "question": "Is the half cut of the 16,086 heads correct in the hub's own exact eight-stream operator model, not only in my lowering?", + "why_it_matters": "The refuted idle-axis moves of 18-19 Oct changed the exact operator while keeping the profile; reviewers will want the cut checked in the hub's own operator model.", + "first_step": "Replay the cut of a sample of heads (one per child and replica class) with #3187's exact eight-stream operator replay, as #4046 did for the idle-axis moves, with a control that a wrong cut (24 axes taken from a non-head block) changes the operator.", + "blocked_by": "None." + }, + { + "question": "Can the full cut on #2979's words (the headline A-fc, checked by computer at 1.7887045643e-3) be proved in Lean?", + "why_it_matters": "A-fc is the highest figure here but rests on a computer check of its own instance; the full cut is proved in Lean only on #3945 with every head kept (instance 3945F, 1.7806935e-3). Theorem 1G and the general full-cut theorem are in Lean already.", + "first_step": "Build A-fc's instance in Lean the way instance 3945F was built: its heads-first certificate on fills/2979Fc/FILL.json.gz, the cut fact on #2979's words, and a rate module at 17887045/10^10 with the profile of instances/2979Fc.json.", + "blocked_by": "None." + }, + { + "question": "Beyond keeping every head that the table of hosts allows (done: #3945 with every head kept, README section 7), can more of the rank-48 blocks become literal heads?", + "why_it_matters": "The half-cut price rises with every head; on #2979, 12,104 rank-48 blocks (children 12 and 13) are neither heads nor tails, and on #3945 with every head kept 57,312 are.", + "first_step": "From the head test's examples (g0 output, 'neither' class), list for each such block the first non-identity touch of its array before its climb, and test whether that touch can be moved after the climb without changing the word's operator.", + "blocked_by": "None." + }, + { + "question": "Does the lever carry over to the newest staged words (for example #4088 at 1.7309791e-3)?", + "why_it_matters": "The lever is independent of the word; a word with a higher uniform b and as many heads would give a higher DFT figure.", + "first_step": "Write instances/.json for the word (its file paths and sha256) and run verify.py --instance ; the expected head count is not known in advance, so start with the head test alone.", + "blocked_by": "none: #4088 and the other staged words of that line were archived on main on 20 October 2026; their files can be read there." + }, + { + "question": "Is the factor (log n)^kappa of Theorem 1G real for grouped paid blocks, or does the mixed recursion reach O(n^tau) exactly?", + "why_it_matters": "The DFT figure is unaffected (any saving below the root is reached), but an exact bound would simplify the supplier interface.", + "first_step": "Search small separated rules for a flow with Phi(exits) <= (eta - beta) Phi(sources) (PROOF.md, remark after Theorem 1G).", + "blocked_by": "None." + } + ] +} diff --git a/research/lever-mixed-targets-2979/VERIFY.json b/research/lever-mixed-targets-2979/VERIFY.json new file mode 100644 index 000000000..9239c2ab1 --- /dev/null +++ b/research/lever-mixed-targets-2979/VERIFY.json @@ -0,0 +1,68 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/rank7-joint-endframes/data/WORD-base.json.gz", + "research/rank7-joint-endframes/data/WORD-extra.json.gz", + "research/rank7-joint-endframes/allocation/FILL.json.gz", + "research/rank7-joint-endframes/allocation/ORDER.json", + "research/rank7-joint-endframes/allocation/DISPATCH.json", + "research/rank7-joint-endframes/allocation/PROFILE.json", + "research/rank7-joint-endframes/allocation/PROVIDERS.json", + "research/rank7-joint-endframes/allocation/vendor/PLAN.json.gz", + "research/rank7-joint-endframes/allocation/vendor/TEMPLATE.json.gz", + "research/rank7-joint-endframes/CLAIM.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py", + "--part", + "main" + ], + "timeout_seconds": 360, + "checks": "Pins of the ten #2979 inputs and of this package's data; my conversion of both #2979 words (transport to the native canonical form with exact replay on all 632 columns in both orientations, lowering to gcert/1w and 1b with frames, warps, residual widths helper by helper, local profile, full replay to the endpoint, 7 rejected mutants per word, recorded content hashes; stated local profile, widths and zero buffers from CLAIM.json and PROVIDERS.json); the head test in my nine-stage network on #2979's ORDER, DISPATCH, PLAN, TEMPLATE and 271,728 FILL rows (windows, bin ranks, one use per role, global profile = PROFILE.json, 16,086 literal rank-48 heads = 8,064 + 8,022, 12,104 other rank-48 blocks, and its two network controls); the price (uniform root = CLAIM.json complex_lower to 24 digits; half cut 1.7556473153e-3; full cut as a what-if); the exact rational rate certificate of the mixed-target recursion on the half-cut profile derived from the measured heads, at 17556473/10^10 and refuted at 17556474/10^10, with the derived profile equal to the Lean rate module's." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py", + "--part", + "controls" + ], + "timeout_seconds": 120, + "checks": "Regression of the head test on the earlier T74 circuit (11,010 heads = 6,150 + 4,860, remainders {48: 22,748}, global profile); price controls: the figure is refused with a single head and with one head fewer (16,085), a profile that is not separated is refused, and one grid step above the figure is refused." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py", + "--instance", + "2979Fc", + "--part", + "main" + ], + "timeout_seconds": 480, + "checks": "The headline A-fc: the same checks as --part main on #2979's ten inputs, with this package's table of hosts fills/2979Fc/FILL.json.gz and its paid profile (pinned): 16,576 literal rank-48 heads = 8,288 + 8,288, no other rank-48 block, global profile = fills/2979Fc/PROFILE.json, uniform root = the community's root for this table (1.6897030111e-3) to 24 digits, the full-cut price 1.7887045643e-3 (heads removed, job 25, every paid block of rank <= 23), the full-cut profile derived from the measured heads, and the exact rational rate certificate at 17887045/10^10, refuted at 17887046/10^10." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py", + "--instance", + "2979Fc", + "--part", + "controls" + ], + "timeout_seconds": 180, + "checks": "The headline A-fc, controls: the T74 regression; the figure is refused with a single head, with one head fewer (16,575), with the heads kept as blocks of 48 while their arrays take the job of 25 (not separated), and one grid step above." + } + ] +} diff --git a/research/lever-mixed-targets-2979/controls/t74/FILL.json.gz b/research/lever-mixed-targets-2979/controls/t74/FILL.json.gz new file mode 100644 index 000000000..681655461 Binary files /dev/null and b/research/lever-mixed-targets-2979/controls/t74/FILL.json.gz differ diff --git a/research/lever-mixed-targets-2979/controls/t74/PROFILE.json b/research/lever-mixed-targets-2979/controls/t74/PROFILE.json new file mode 100644 index 000000000..02e76e162 --- /dev/null +++ b/research/lever-mixed-targets-2979/controls/t74/PROFILE.json @@ -0,0 +1 @@ +{"1": 1560432, "2": 336336, "3": 278724, "4": 84912, "5": 54612, "8": 5328, "48": 22748} \ No newline at end of file diff --git a/research/lever-mixed-targets-2979/controls/t74/extra.gcert1b.json.gz b/research/lever-mixed-targets-2979/controls/t74/extra.gcert1b.json.gz new file mode 100644 index 000000000..a16ad2c22 Binary files /dev/null and b/research/lever-mixed-targets-2979/controls/t74/extra.gcert1b.json.gz differ diff --git a/research/lever-mixed-targets-2979/controls/t74/gauge44.gcert1b.json.gz b/research/lever-mixed-targets-2979/controls/t74/gauge44.gcert1b.json.gz new file mode 100644 index 000000000..1c20e4f34 Binary files /dev/null and b/research/lever-mixed-targets-2979/controls/t74/gauge44.gcert1b.json.gz differ diff --git a/research/lever-mixed-targets-2979/controls/t74/inputs/DISPATCH.json b/research/lever-mixed-targets-2979/controls/t74/inputs/DISPATCH.json new file mode 100644 index 000000000..a8472f973 --- /dev/null +++ b/research/lever-mixed-targets-2979/controls/t74/inputs/DISPATCH.json @@ -0,0 +1 @@ +[[0, 0, "extra"], [0, 37, "extra"], [0, 1, "extra"], [0, 38, "extra"], [0, 2, "extra"], [0, 39, "extra"], [0, 3, "extra"], [0, 40, "extra"], [0, 4, "extra"], [0, 41, "extra"], [1, 0, "extra"], [1, 37, "extra"], [0, 5, "extra"], [0, 42, "extra"], [1, 1, "extra"], [1, 38, "extra"], [0, 6, "extra"], [0, 43, "extra"], [1, 2, "extra"], [1, 39, "extra"], [0, 7, "extra"], [0, 44, "extra"], [1, 3, "extra"], [1, 40, "extra"], [0, 8, "extra"], [0, 45, "extra"], [1, 4, "extra"], [1, 41, "extra"], [0, 9, "extra"], [0, 46, "extra"], [2, 0, "extra"], [2, 37, "extra"], [1, 5, "extra"], [1, 42, "extra"], [0, 10, "extra"], [0, 47, "extra"], [2, 1, "extra"], [2, 38, "extra"], [1, 6, "extra"], [1, 43, "extra"], [0, 11, "extra"], [0, 48, "extra"], [2, 2, "extra"], [2, 39, "extra"], [1, 7, "extra"], [1, 44, "extra"], [0, 12, "extra"], [0, 49, "extra"], [2, 3, "extra"], [2, 40, "extra"], [1, 8, "extra"], [1, 45, "extra"], [0, 13, "extra"], [0, 50, "extra"], [2, 4, "extra"], [2, 41, "extra"], [1, 9, "extra"], [1, 46, "extra"], [3, 0, "extra"], [3, 37, "extra"], [0, 14, "extra"], [0, 51, "extra"], [2, 5, "extra"], [2, 42, "extra"], [1, 10, "extra"], [1, 47, "extra"], [3, 1, "extra"], [3, 38, "extra"], [0, 15, "extra"], [0, 52, "extra"], [2, 6, "extra"], [2, 43, "extra"], [1, 11, "extra"], [1, 48, "extra"], [3, 2, "extra"], [3, 39, "extra"], [0, 16, "extra"], [0, 53, "extra"], [2, 7, "extra"], [2, 44, "extra"], [1, 12, "extra"], [1, 49, "extra"], [3, 3, "extra"], [3, 40, "extra"], [0, 17, "extra"], [0, 54, "extra"], [2, 8, "extra"], [2, 45, "extra"], [1, 13, "extra"], [1, 50, "extra"], [3, 4, "extra"], [3, 41, "extra"], [0, 18, "extra"], [0, 55, "extra"], [2, 9, "extra"], [2, 46, "extra"], [4, 0, "extra"], [4, 37, "extra"], [1, 14, "extra"], [1, 51, "extra"], [3, 5, "extra"], [3, 42, "extra"], [0, 19, "extra"], [0, 56, "extra"], [2, 10, "extra"], [2, 47, "extra"], [4, 1, "extra"], [4, 38, "extra"], [1, 15, "extra"], [1, 52, "extra"], [3, 6, "extra"], [3, 43, "extra"], [0, 20, "extra"], [0, 57, "extra"], [2, 11, "extra"], [2, 48, "extra"], [4, 2, "extra"], [4, 39, "extra"], [1, 16, "extra"], [1, 53, "extra"], [3, 7, "extra"], [3, 44, "extra"], [0, 21, "extra"], [0, 58, "extra"], [2, 12, "extra"], [2, 49, "extra"], [4, 3, "extra"], [4, 40, "extra"], [1, 17, "extra"], [1, 54, "extra"], [3, 8, "extra"], [3, 45, "extra"], [0, 22, "extra"], [0, 59, "extra"], [2, 13, "extra"], [2, 50, "extra"], [4, 4, "extra"], [4, 41, "extra"], [1, 18, "extra"], [1, 55, "extra"], [3, 9, "extra"], [3, 46, "extra"], [0, 23, "extra"], [0, 60, "extra"], [5, 0, "extra"], [5, 37, "extra"], [2, 14, "extra"], [2, 51, "extra"], [4, 5, "extra"], [4, 42, "extra"], [1, 19, "extra"], [1, 56, "extra"], [3, 10, "extra"], [3, 47, "extra"], [0, 24, "extra"], [0, 61, "extra"], [5, 1, "extra"], [5, 38, "extra"], [2, 15, "extra"], [2, 52, "extra"], [4, 6, "extra"], [4, 43, "extra"], [1, 20, "extra"], [1, 57, "extra"], [3, 11, "extra"], [3, 48, "extra"], [0, 25, "extra"], [0, 62, "extra"], [5, 2, "extra"], [5, 39, "extra"], [2, 16, "extra"], [2, 53, "extra"], [4, 7, "extra"], [4, 44, "extra"], [1, 21, "extra"], [1, 58, "extra"], [3, 12, "extra"], [3, 49, "extra"], [0, 26, "extra"], [0, 63, "extra"], [5, 3, "extra"], [5, 40, "extra"], [2, 17, "extra"], [2, 54, "extra"], [4, 8, "extra"], [4, 45, "extra"], [1, 22, "extra"], [1, 59, "extra"], [3, 13, "extra"], [3, 50, "extra"], [0, 27, "extra"], [0, 64, "extra"], [5, 4, "extra"], [5, 41, "extra"], [2, 18, "extra"], [2, 55, "extra"], [4, 9, "extra"], [4, 46, "extra"], [1, 23, "extra"], [1, 60, "extra"], [6, 0, "extra"], [6, 37, "extra"], [3, 14, "extra"], [3, 51, "extra"], [0, 28, "extra"], [0, 65, "extra"], [5, 5, "extra"], [5, 42, "extra"], [2, 19, "extra"], [2, 56, "extra"], [4, 10, "extra"], [4, 47, "extra"], [1, 24, "extra"], [1, 61, "extra"], [6, 1, "extra"], [6, 38, "extra"], [3, 15, "extra"], [3, 52, "extra"], [0, 29, "extra"], [0, 66, "extra"], [5, 6, "extra"], [5, 43, "extra"], [2, 20, "extra"], [2, 57, "extra"], [4, 11, "extra"], [4, 48, "extra"], [1, 25, "extra"], [1, 62, "extra"], [6, 2, "extra"], [6, 39, "extra"], [3, 16, "extra"], [3, 53, "extra"], [0, 30, "extra"], [0, 67, "extra"], [5, 7, "extra"], [5, 44, "extra"], [2, 21, "extra"], [2, 58, "extra"], [4, 12, "extra"], [4, 49, "extra"], [1, 26, "extra"], [1, 63, "extra"], [6, 3, "extra"], [6, 40, "extra"], [3, 17, "extra"], [3, 54, "extra"], [0, 31, "extra"], [0, 68, "extra"], [5, 8, "extra"], [5, 45, "extra"], [2, 22, "extra"], [2, 59, "extra"], [4, 13, "extra"], [4, 50, "extra"], [1, 27, "extra"], [1, 64, "extra"], [6, 4, "extra"], [6, 41, "extra"], [3, 18, "extra"], [3, 55, "extra"], [0, 32, "extra"], [0, 69, "extra"], [5, 9, "extra"], [5, 46, "extra"], [2, 23, "extra"], [2, 60, "extra"], [7, 0, "extra"], [7, 37, "extra"], [4, 14, "extra"], [4, 51, "extra"], [1, 28, "extra"], [1, 65, "extra"], [6, 5, "extra"], [6, 42, "extra"], [3, 19, "extra"], [3, 56, "extra"], [0, 33, "extra"], [0, 70, "extra"], [5, 10, "extra"], [5, 47, "extra"], [2, 24, "extra"], [2, 61, "extra"], [7, 1, "extra"], [7, 38, "extra"], [4, 15, "extra"], [4, 52, "extra"], [1, 29, "extra"], [1, 66, "extra"], [6, 6, "extra"], [6, 43, "extra"], [3, 20, "extra"], [3, 57, "extra"], [0, 34, "extra"], [0, 71, "extra"], [5, 11, "extra"], [5, 48, "extra"], [2, 25, "extra"], [2, 62, "extra"], [7, 2, "extra"], [7, 39, "extra"], [4, 16, "extra"], [4, 53, "extra"], [1, 30, "extra"], [1, 67, "extra"], [6, 7, "extra"], [6, 44, "extra"], [3, 21, "extra"], [3, 58, "extra"], [0, 35, "extra"], [0, 72, "extra"], [5, 12, "extra"], [5, 49, "extra"], [2, 26, "extra"], [2, 63, "extra"], [7, 3, "extra"], [7, 40, "extra"], [4, 17, "extra"], [4, 54, "extra"], [1, 31, "extra"], [1, 68, "extra"], [6, 8, "extra"], [6, 45, "extra"], [3, 22, "extra"], [3, 59, "extra"], [0, 36, "extra"], [0, 73, "extra"], [5, 13, "extra"], [5, 50, "extra"], [2, 27, "extra"], [2, 64, "extra"], [7, 4, "extra"], [7, 41, "extra"], [4, 18, "extra"], [4, 55, "extra"], [1, 32, "extra"], [1, 69, "extra"], [6, 9, "extra"], [6, 46, "extra"], [3, 23, "extra"], [3, 60, "extra"], [8, 0, "extra"], [8, 37, "extra"], [5, 14, "extra"], [5, 51, "extra"], [2, 28, "extra"], [2, 65, "extra"], [7, 5, "extra"], [7, 42, "extra"], [4, 19, "extra"], [4, 56, "extra"], [1, 33, "extra"], [1, 70, "extra"], [6, 10, "extra"], [6, 47, "extra"], [3, 24, "extra"], [3, 61, "extra"], [8, 1, "extra"], [8, 38, "extra"], [5, 15, "extra"], [5, 52, "extra"], [2, 29, "extra"], [2, 66, "extra"], [7, 6, "extra"], [7, 43, "extra"], [4, 20, "extra"], [4, 57, "extra"], [1, 34, "extra"], [1, 71, "extra"], [6, 11, "extra"], [6, 48, "extra"], [3, 25, "extra"], [3, 62, "extra"], [8, 2, "extra"], [8, 39, "extra"], [5, 16, "extra"], [5, 53, "extra"], [2, 30, "extra"], [2, 67, "extra"], [7, 7, "extra"], [7, 44, "extra"], [4, 21, "extra"], [4, 58, "extra"], [1, 35, "extra"], [1, 72, "extra"], [6, 12, "extra"], [6, 49, "extra"], [3, 26, "extra"], [3, 63, "extra"], [8, 3, "extra"], [8, 40, "extra"], [5, 17, "extra"], [5, 54, "extra"], [2, 31, "extra"], [2, 68, "extra"], [7, 8, "extra"], [7, 45, "extra"], [4, 22, "extra"], [4, 59, "extra"], [1, 36, "extra"], [1, 73, "extra"], [6, 13, "extra"], [6, 50, "extra"], [3, 27, "extra"], [3, 64, "extra"], [8, 4, "extra"], [8, 41, "extra"], [5, 18, "extra"], [5, 55, "extra"], [2, 32, "extra"], [2, 69, "extra"], [7, 9, "extra"], [7, 46, "extra"], [4, 23, "extra"], [4, 60, "extra"], [6, 14, "extra"], [6, 51, "extra"], [3, 28, "extra"], [3, 65, "gauge44"], [8, 5, "gauge44"], [8, 42, "gauge44"], [5, 19, "gauge44"], [5, 56, "gauge44"], [2, 33, "gauge44"], [2, 70, "gauge44"], [7, 10, "gauge44"], [7, 47, "gauge44"], [4, 24, "gauge44"], [4, 61, "gauge44"], [6, 15, "gauge44"], [6, 52, "gauge44"], [3, 29, "gauge44"], [3, 66, "gauge44"], [8, 6, "gauge44"], [8, 43, "gauge44"], [5, 20, "gauge44"], [5, 57, "gauge44"], [2, 34, "gauge44"], [2, 71, "gauge44"], [7, 11, "gauge44"], [7, 48, "gauge44"], [4, 25, "gauge44"], [4, 62, "gauge44"], [6, 16, "gauge44"], [6, 53, "gauge44"], [3, 30, "gauge44"], [3, 67, "gauge44"], [8, 7, "gauge44"], [8, 44, "gauge44"], [5, 21, "gauge44"], [5, 58, "gauge44"], [2, 35, "gauge44"], [2, 72, "gauge44"], [7, 12, "gauge44"], [7, 49, "gauge44"], [4, 26, "gauge44"], [4, 63, "gauge44"], [6, 17, "gauge44"], [6, 54, "gauge44"], [3, 31, "gauge44"], [3, 68, "gauge44"], [8, 8, "gauge44"], [8, 45, "gauge44"], [5, 22, "gauge44"], [5, 59, "gauge44"], [2, 36, "gauge44"], [2, 73, "gauge44"], [7, 13, "gauge44"], [7, 50, "gauge44"], [4, 27, "gauge44"], [4, 64, "gauge44"], [6, 18, "gauge44"], [6, 55, "gauge44"], [3, 32, "gauge44"], [3, 69, "gauge44"], [8, 9, "gauge44"], [8, 46, "gauge44"], [5, 23, "gauge44"], [5, 60, "gauge44"], [7, 14, "gauge44"], [7, 51, "gauge44"], [4, 28, "gauge44"], [4, 65, "gauge44"], [6, 19, "gauge44"], [6, 56, "gauge44"], [3, 33, "gauge44"], [3, 70, "gauge44"], [8, 10, "gauge44"], [8, 47, "gauge44"], [5, 24, "gauge44"], [5, 61, "gauge44"], [7, 15, "gauge44"], [7, 52, "gauge44"], [4, 29, "gauge44"], [4, 66, "gauge44"], [6, 20, "gauge44"], [6, 57, "gauge44"], [3, 34, "gauge44"], [3, 71, "gauge44"], [8, 11, "gauge44"], [8, 48, "gauge44"], [5, 25, "gauge44"], [5, 62, "gauge44"], [7, 16, "gauge44"], [7, 53, "gauge44"], [4, 30, "gauge44"], [4, 67, "gauge44"], [6, 21, "gauge44"], [6, 58, "gauge44"], [3, 35, "gauge44"], [3, 72, "gauge44"], [8, 12, "gauge44"], [8, 49, "gauge44"], [5, 26, "gauge44"], [5, 63, "gauge44"], [7, 17, "gauge44"], [7, 54, "gauge44"], [4, 31, "gauge44"], [4, 68, "gauge44"], [6, 22, "gauge44"], [6, 59, "gauge44"], [3, 36, "gauge44"], [3, 73, "gauge44"], [8, 13, "gauge44"], [8, 50, "gauge44"], [5, 27, "gauge44"], [5, 64, "gauge44"], [7, 18, "gauge44"], [7, 55, "gauge44"], [4, 32, "gauge44"], [4, 69, "gauge44"], [6, 23, "gauge44"], [6, 60, "gauge44"], [8, 14, "gauge44"], [8, 51, "gauge44"], [5, 28, "gauge44"], [5, 65, "gauge44"], [7, 19, "gauge44"], [7, 56, "gauge44"], [4, 33, "gauge44"], [4, 70, "gauge44"], [6, 24, "gauge44"], [6, 61, "gauge44"], [8, 15, "gauge44"], [8, 52, "gauge44"], [5, 29, "gauge44"], [5, 66, "gauge44"], [7, 20, "gauge44"], [7, 57, "gauge44"], [4, 34, "gauge44"], [4, 71, "gauge44"], [6, 25, "gauge44"], [6, 62, "gauge44"], [8, 16, "gauge44"], [8, 53, "gauge44"], [5, 30, "gauge44"], [5, 67, "gauge44"], [7, 21, "gauge44"], [7, 58, "gauge44"], [4, 35, "gauge44"], [4, 72, "gauge44"], [6, 26, "gauge44"], [6, 63, "gauge44"], [8, 17, "gauge44"], [8, 54, "gauge44"], [5, 31, "gauge44"], [5, 68, "gauge44"], [7, 22, "gauge44"], [7, 59, "gauge44"], [4, 36, "gauge44"], [4, 73, "gauge44"], [6, 27, "gauge44"], [6, 64, "gauge44"], [8, 18, "gauge44"], [8, 55, "gauge44"], [5, 32, "gauge44"], [5, 69, "gauge44"], [7, 23, "gauge44"], [7, 60, "gauge44"], [6, 28, "gauge44"], [6, 65, "gauge44"], [8, 19, "gauge44"], [8, 56, "gauge44"], [5, 33, "gauge44"], [5, 70, "gauge44"], [7, 24, "gauge44"], [7, 61, "gauge44"], [6, 29, "gauge44"], [6, 66, "gauge44"], [8, 20, "gauge44"], [8, 57, "gauge44"], [5, 34, "gauge44"], [5, 71, "gauge44"], [7, 25, "gauge44"], [7, 62, "gauge44"], [6, 30, "gauge44"], [6, 67, "gauge44"], [8, 21, "gauge44"], [8, 58, "gauge44"], [5, 35, "gauge44"], [5, 72, "gauge44"], [7, 26, "gauge44"], [7, 63, "gauge44"], [6, 31, "gauge44"], [6, 68, "gauge44"], [8, 22, "gauge44"], [8, 59, "gauge44"], [5, 36, "gauge44"], [5, 73, "gauge44"], [7, 27, "gauge44"], [7, 64, "gauge44"], [6, 32, "gauge44"], [6, 69, "gauge44"], [8, 23, "gauge44"], [8, 60, "gauge44"], [7, 28, "gauge44"], [7, 65, "gauge44"], [6, 33, "gauge44"], [6, 70, "gauge44"], [8, 24, "gauge44"], [8, 61, "gauge44"], [7, 29, "gauge44"], [7, 66, "gauge44"], [6, 34, "gauge44"], [6, 71, "gauge44"], [8, 25, "gauge44"], [8, 62, "gauge44"], [7, 30, "gauge44"], [7, 67, "gauge44"], [6, 35, "gauge44"], [6, 72, "gauge44"], [8, 26, "gauge44"], [8, 63, "gauge44"], [7, 31, "gauge44"], [7, 68, "gauge44"], [6, 36, "gauge44"], [6, 73, "gauge44"], [8, 27, "gauge44"], [8, 64, "gauge44"], [7, 32, "gauge44"], [7, 69, "gauge44"], [8, 28, "gauge44"], [8, 65, "gauge44"], [7, 33, "gauge44"], [7, 70, "gauge44"], [8, 29, "gauge44"], [8, 66, "gauge44"], [7, 34, "gauge44"], [7, 71, "gauge44"], [8, 30, "gauge44"], [8, 67, "gauge44"], [7, 35, "gauge44"], [7, 72, "gauge44"], [8, 31, "gauge44"], [8, 68, "gauge44"], [7, 36, "gauge44"], [7, 73, "gauge44"], [8, 32, "gauge44"], [8, 69, "gauge44"], [8, 33, "gauge44"], [8, 70, "gauge44"], [8, 34, "gauge44"], [8, 71, "gauge44"], [8, 35, "gauge44"], [8, 72, "gauge44"], [8, 36, "gauge44"], [8, 73, "gauge44"]] \ No newline at end of file diff --git a/research/lever-mixed-targets-2979/controls/t74/inputs/ORDER.json b/research/lever-mixed-targets-2979/controls/t74/inputs/ORDER.json new file mode 100644 index 000000000..a32de8bc3 --- /dev/null +++ b/research/lever-mixed-targets-2979/controls/t74/inputs/ORDER.json @@ -0,0 +1 @@ +[[0, 0], [0, 37], [0, 1], [0, 38], [0, 2], [0, 39], [0, 3], [0, 40], [0, 4], [0, 41], [1, 0], [1, 37], [0, 5], [0, 42], [1, 1], [1, 38], [0, 6], [0, 43], [1, 2], [1, 39], [0, 7], [0, 44], [1, 3], [1, 40], [0, 8], [0, 45], [1, 4], [1, 41], [0, 9], [0, 46], [2, 0], [2, 37], [1, 5], [1, 42], [0, 10], [0, 47], [2, 1], [2, 38], [1, 6], [1, 43], [0, 11], [0, 48], [2, 2], [2, 39], [1, 7], [1, 44], [0, 12], [0, 49], [2, 3], [2, 40], [1, 8], [1, 45], [0, 13], [0, 50], [2, 4], [2, 41], [1, 9], [1, 46], [3, 0], [3, 37], [0, 14], [0, 51], [2, 5], [2, 42], [1, 10], [1, 47], [3, 1], [3, 38], [0, 15], [0, 52], [2, 6], [2, 43], [1, 11], [1, 48], [3, 2], [3, 39], [0, 16], [0, 53], [2, 7], [2, 44], [1, 12], [1, 49], [3, 3], [3, 40], [0, 17], [0, 54], [2, 8], [2, 45], [1, 13], [1, 50], [3, 4], [3, 41], [0, 18], [0, 55], [2, 9], [2, 46], [4, 0], [4, 37], [1, 14], [1, 51], [3, 5], [3, 42], [0, 19], [0, 56], [2, 10], [2, 47], [4, 1], [4, 38], [1, 15], [1, 52], [3, 6], [3, 43], [0, 20], [0, 57], [2, 11], [2, 48], [4, 2], [4, 39], [1, 16], [1, 53], [3, 7], [3, 44], [0, 21], [0, 58], [2, 12], [2, 49], [4, 3], [4, 40], [1, 17], [1, 54], [3, 8], [3, 45], [0, 22], [0, 59], [2, 13], [2, 50], [4, 4], [4, 41], [1, 18], [1, 55], [3, 9], [3, 46], [0, 23], [0, 60], [5, 0], [5, 37], [2, 14], [2, 51], [4, 5], [4, 42], [1, 19], [1, 56], [3, 10], [3, 47], [0, 24], [0, 61], [5, 1], [5, 38], [2, 15], [2, 52], [4, 6], [4, 43], [1, 20], [1, 57], [3, 11], [3, 48], [0, 25], [0, 62], [5, 2], [5, 39], [2, 16], [2, 53], [4, 7], [4, 44], [1, 21], [1, 58], [3, 12], [3, 49], [0, 26], [0, 63], [5, 3], [5, 40], [2, 17], [2, 54], [4, 8], [4, 45], [1, 22], [1, 59], [3, 13], [3, 50], [0, 27], [0, 64], [5, 4], [5, 41], [2, 18], [2, 55], [4, 9], [4, 46], [1, 23], [1, 60], [6, 0], [6, 37], [3, 14], [3, 51], [0, 28], [0, 65], [5, 5], [5, 42], [2, 19], [2, 56], [4, 10], [4, 47], [1, 24], [1, 61], [6, 1], [6, 38], [3, 15], [3, 52], [0, 29], [0, 66], [5, 6], [5, 43], [2, 20], [2, 57], [4, 11], [4, 48], [1, 25], [1, 62], [6, 2], [6, 39], [3, 16], [3, 53], [0, 30], [0, 67], [5, 7], [5, 44], [2, 21], [2, 58], [4, 12], [4, 49], [1, 26], [1, 63], [6, 3], [6, 40], [3, 17], [3, 54], [0, 31], [0, 68], [5, 8], [5, 45], [2, 22], [2, 59], [4, 13], [4, 50], [1, 27], [1, 64], [6, 4], [6, 41], [3, 18], [3, 55], [0, 32], [0, 69], [5, 9], [5, 46], [2, 23], [2, 60], [7, 0], [7, 37], [4, 14], [4, 51], [1, 28], [1, 65], [6, 5], [6, 42], [3, 19], [3, 56], [0, 33], [0, 70], [5, 10], [5, 47], [2, 24], [2, 61], [7, 1], [7, 38], [4, 15], [4, 52], [1, 29], [1, 66], [6, 6], [6, 43], [3, 20], [3, 57], [0, 34], [0, 71], [5, 11], [5, 48], [2, 25], [2, 62], [7, 2], [7, 39], [4, 16], [4, 53], [1, 30], [1, 67], [6, 7], [6, 44], [3, 21], [3, 58], [0, 35], [0, 72], [5, 12], [5, 49], [2, 26], [2, 63], [7, 3], [7, 40], [4, 17], [4, 54], [1, 31], [1, 68], [6, 8], [6, 45], [3, 22], [3, 59], [0, 36], [0, 73], [5, 13], [5, 50], [2, 27], [2, 64], [7, 4], [7, 41], [4, 18], [4, 55], [1, 32], [1, 69], [6, 9], [6, 46], [3, 23], [3, 60], [8, 0], [8, 37], [5, 14], [5, 51], [2, 28], [2, 65], [7, 5], [7, 42], [4, 19], [4, 56], [1, 33], [1, 70], [6, 10], [6, 47], [3, 24], [3, 61], [8, 1], [8, 38], [5, 15], [5, 52], [2, 29], [2, 66], [7, 6], [7, 43], [4, 20], [4, 57], [1, 34], [1, 71], [6, 11], [6, 48], [3, 25], [3, 62], [8, 2], [8, 39], [5, 16], [5, 53], [2, 30], [2, 67], [7, 7], [7, 44], [4, 21], [4, 58], [1, 35], [1, 72], [6, 12], [6, 49], [3, 26], [3, 63], [8, 3], [8, 40], [5, 17], [5, 54], [2, 31], [2, 68], [7, 8], [7, 45], [4, 22], [4, 59], [1, 36], [1, 73], [6, 13], [6, 50], [3, 27], [3, 64], [8, 4], [8, 41], [5, 18], [5, 55], [2, 32], [2, 69], [7, 9], [7, 46], [4, 23], [4, 60], [6, 14], [6, 51], [3, 28], [3, 65], [8, 5], [8, 42], [5, 19], [5, 56], [2, 33], [2, 70], [7, 10], [7, 47], [4, 24], [4, 61], [6, 15], [6, 52], [3, 29], [3, 66], [8, 6], [8, 43], [5, 20], [5, 57], [2, 34], [2, 71], [7, 11], [7, 48], [4, 25], [4, 62], [6, 16], [6, 53], [3, 30], [3, 67], [8, 7], [8, 44], [5, 21], [5, 58], [2, 35], [2, 72], [7, 12], [7, 49], [4, 26], [4, 63], [6, 17], [6, 54], [3, 31], [3, 68], [8, 8], [8, 45], [5, 22], [5, 59], [2, 36], [2, 73], [7, 13], [7, 50], [4, 27], [4, 64], [6, 18], [6, 55], [3, 32], [3, 69], [8, 9], [8, 46], [5, 23], [5, 60], [7, 14], [7, 51], [4, 28], [4, 65], [6, 19], [6, 56], [3, 33], [3, 70], [8, 10], [8, 47], [5, 24], [5, 61], [7, 15], [7, 52], [4, 29], [4, 66], [6, 20], [6, 57], [3, 34], [3, 71], [8, 11], [8, 48], [5, 25], [5, 62], [7, 16], [7, 53], [4, 30], [4, 67], [6, 21], [6, 58], [3, 35], [3, 72], [8, 12], [8, 49], [5, 26], [5, 63], [7, 17], [7, 54], [4, 31], [4, 68], [6, 22], [6, 59], [3, 36], [3, 73], [8, 13], [8, 50], [5, 27], [5, 64], [7, 18], [7, 55], [4, 32], [4, 69], [6, 23], [6, 60], [8, 14], [8, 51], [5, 28], [5, 65], [7, 19], [7, 56], [4, 33], [4, 70], [6, 24], [6, 61], [8, 15], [8, 52], [5, 29], [5, 66], [7, 20], [7, 57], [4, 34], [4, 71], [6, 25], [6, 62], [8, 16], [8, 53], [5, 30], [5, 67], [7, 21], [7, 58], [4, 35], [4, 72], [6, 26], [6, 63], [8, 17], [8, 54], [5, 31], [5, 68], [7, 22], [7, 59], [4, 36], [4, 73], [6, 27], [6, 64], [8, 18], [8, 55], [5, 32], [5, 69], [7, 23], [7, 60], [6, 28], [6, 65], [8, 19], [8, 56], [5, 33], [5, 70], [7, 24], [7, 61], [6, 29], [6, 66], [8, 20], [8, 57], [5, 34], [5, 71], [7, 25], [7, 62], [6, 30], [6, 67], [8, 21], [8, 58], [5, 35], [5, 72], [7, 26], [7, 63], [6, 31], [6, 68], [8, 22], [8, 59], [5, 36], [5, 73], [7, 27], [7, 64], [6, 32], [6, 69], [8, 23], [8, 60], [7, 28], [7, 65], [6, 33], [6, 70], [8, 24], [8, 61], [7, 29], [7, 66], [6, 34], [6, 71], [8, 25], [8, 62], [7, 30], [7, 67], [6, 35], [6, 72], [8, 26], [8, 63], [7, 31], [7, 68], [6, 36], [6, 73], [8, 27], [8, 64], [7, 32], [7, 69], [8, 28], [8, 65], [7, 33], [7, 70], [8, 29], [8, 66], [7, 34], [7, 71], [8, 30], [8, 67], [7, 35], [7, 72], [8, 31], [8, 68], [7, 36], [7, 73], [8, 32], [8, 69], [8, 33], [8, 70], [8, 34], [8, 71], [8, 35], [8, 72], [8, 36], [8, 73]] \ No newline at end of file diff --git a/research/lever-mixed-targets-2979/controls/t74/inputs/PLAN.json.gz b/research/lever-mixed-targets-2979/controls/t74/inputs/PLAN.json.gz new file mode 100644 index 000000000..93f08eb4e Binary files /dev/null and b/research/lever-mixed-targets-2979/controls/t74/inputs/PLAN.json.gz differ diff --git a/research/lever-mixed-targets-2979/fills/2979Fc/FILL.json.gz b/research/lever-mixed-targets-2979/fills/2979Fc/FILL.json.gz new file mode 100644 index 000000000..bd7deb496 Binary files /dev/null and b/research/lever-mixed-targets-2979/fills/2979Fc/FILL.json.gz differ diff --git a/research/lever-mixed-targets-2979/fills/2979Fc/PROFILE.json b/research/lever-mixed-targets-2979/fills/2979Fc/PROFILE.json new file mode 100644 index 000000000..b5acfd3cf --- /dev/null +++ b/research/lever-mixed-targets-2979/fills/2979Fc/PROFILE.json @@ -0,0 +1,14 @@ +{ + "1": 1630639, + "2": 470196, + "3": 154512, + "4": 71928, + "5": 11988, + "6": 5, + "7": 3, + "8": 5328, + "17": 8, + "19": 1, + "23": 25905, + "48": 16576 +} \ No newline at end of file diff --git a/research/lever-mixed-targets-2979/fills/3945H/FILL.json.gz b/research/lever-mixed-targets-2979/fills/3945H/FILL.json.gz new file mode 100644 index 000000000..427bc7637 Binary files /dev/null and b/research/lever-mixed-targets-2979/fills/3945H/FILL.json.gz differ diff --git a/research/lever-mixed-targets-2979/instances/2979.json b/research/lever-mixed-targets-2979/instances/2979.json new file mode 100644 index 000000000..ac9d49a5d --- /dev/null +++ b/research/lever-mixed-targets-2979/instances/2979.json @@ -0,0 +1,133 @@ +{ + "id": "2979", + "pr": 2979, + "author": "Marius-Paul Dumitrean (mdumitrean)", + "on_main": true, + "head": "be191346391661f4d35fc0d1508d0a6029572576", + "source_default": "research/rank7-joint-endframes", + "files": { + "word_base": "data/WORD-base.json.gz", + "word_extra": "data/WORD-extra.json.gz", + "fill": "allocation/FILL.json.gz", + "order": "allocation/ORDER.json", + "dispatch": "allocation/DISPATCH.json", + "plan": "allocation/vendor/PLAN.json.gz", + "template": "allocation/vendor/TEMPLATE.json.gz", + "profile": "allocation/PROFILE.json" + }, + "inputs_sha256": { + "data/WORD-base.json.gz": "abaf67bfcb257528658c906b612f57025617592bd7889828f92b97a5f4f4300d", + "data/WORD-extra.json.gz": "e0eaf64c4d5d324693d43889bce1b9e53e8da00402105c8c978fd102f208bed7", + "allocation/FILL.json.gz": "c2136be9434cda511a1a8a44d98f9f72ea5376830a8426674253b4ee351c4c39", + "allocation/ORDER.json": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "allocation/DISPATCH.json": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c", + "allocation/PROFILE.json": "94a819747f3ced41f1544ada0036c983fc0c92847b9644380f877a06cd7931cf", + "allocation/PROVIDERS.json": "f2edb7922f3029a5d607437e737775ff3371bca49ebab62e5e2495d16d3bf573", + "allocation/vendor/PLAN.json.gz": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "allocation/vendor/TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "CLAIM.json": "436e0d297cbdf195445d3697d496ac675e95210b79e70ce602a6a6667a4c6ce9" + }, + "stated": { + "complex_lower": "1729033982646513517717/1000000000000000000000000", + "local_profile": { + "1": 2445, + "2": 706, + "3": 232, + "4": 108, + "5": 18, + "8": 8 + }, + "width_inventory": { + "4": 26, + "5": 2, + "6": 16, + "7": 52, + "8": 99, + "9": 213 + }, + "zero_buffers": 91, + "sources": [ + { + "what": "complex_lower", + "file": "CLAIM.json", + "key": "complex_lower" + }, + { + "what": "local_profile", + "file": "CLAIM.json", + "key": "local_profile" + }, + { + "what": "local_profile", + "file": "allocation/PROVIDERS.json", + "key": "gauge44.actual_paid_profile" + }, + { + "what": "local_profile", + "file": "allocation/PROVIDERS.json", + "key": "extra.actual_paid_profile" + }, + { + "what": "width_inventory", + "file": "CLAIM.json", + "key": "width_inventory" + }, + { + "what": "zero_buffers", + "file": "CLAIM.json", + "key": "zero_buffers" + } + ] + }, + "lowering": { + "R": 408, + "warps": 72, + "tadds": 36, + "base": { + "canonical_content_sha256": "852d09f08b83b760055aaa525632b75f4a8497a816405edbc325670222db63b4", + "gcert1w_content_sha256": "c03055bfeda8058849ec6cf82ff9c1e2b47366485ec17b1e17a943e9e94e2760", + "gcert1b_content_sha256": "db40b7dea1da2922d96b8a675c0eda2c0efdd4794c51a086c249f5b747898ccb" + }, + "extra": { + "canonical_content_sha256": "202d3bfa43c5449eb0531816dc0dbd116b22ae1bf6cede550d82c49eb3bb1b22", + "gcert1w_content_sha256": "43f4b3f09a62aa2181c196f1413fc28856e0e850440531e9932666652e84331a", + "gcert1b_content_sha256": "3edb0a402baab54a13440b33efffc478d7aeadc3e7065e8e31b808a10084148d" + } + }, + "fill": { + "rows": 271728, + "roles_per_call": 408, + "calls": 666, + "replicas": 74 + }, + "heads": { + "total": 16086, + "child8": 8064, + "child10": 8022, + "other_rank48": 12104 + }, + "price": { + "half_cut": "1.7556473153e-03", + "full_cut_what_if": "1.7744822149e-03" + }, + "rate": { + "N": 17556473, + "module": "Work/Mixed/Rate2979.lean", + "profile": { + "children": { + "1": 1645680, + "2": 470196, + "3": 159468, + "4": 71928, + "5": 13716, + "8": 5328, + "24": 16086, + "48": 12104 + }, + "W": 66304, + "H": 16086, + "kc": 49, + "m": 73 + } + } +} diff --git a/research/lever-mixed-targets-2979/instances/2979Fc.json b/research/lever-mixed-targets-2979/instances/2979Fc.json new file mode 100644 index 000000000..b5f1797b0 --- /dev/null +++ b/research/lever-mixed-targets-2979/instances/2979Fc.json @@ -0,0 +1,139 @@ +{ + "id": "2979Fc", + "pr": 2979, + "author": "Marius-Paul Dumitrean (mdumitrean)", + "on_main": true, + "head": "be191346391661f4d35fc0d1508d0a6029572576", + "source_default": "research/rank7-joint-endframes", + "files": { + "word_base": "data/WORD-base.json.gz", + "word_extra": "data/WORD-extra.json.gz", + "fill": "allocation/FILL.json.gz", + "order": "allocation/ORDER.json", + "dispatch": "allocation/DISPATCH.json", + "plan": "allocation/vendor/PLAN.json.gz", + "template": "allocation/vendor/TEMPLATE.json.gz", + "profile": "allocation/PROFILE.json" + }, + "inputs_sha256": { + "data/WORD-base.json.gz": "abaf67bfcb257528658c906b612f57025617592bd7889828f92b97a5f4f4300d", + "data/WORD-extra.json.gz": "e0eaf64c4d5d324693d43889bce1b9e53e8da00402105c8c978fd102f208bed7", + "allocation/FILL.json.gz": "c2136be9434cda511a1a8a44d98f9f72ea5376830a8426674253b4ee351c4c39", + "allocation/ORDER.json": "519d1d5dbb997a219fcfcad34c0b03e7838bef24199784d7e964fa10090f66e1", + "allocation/DISPATCH.json": "65e435bd68e97243c003677271b88485a29d4d0fae2dff1354100404a145e74c", + "allocation/PROFILE.json": "94a819747f3ced41f1544ada0036c983fc0c92847b9644380f877a06cd7931cf", + "allocation/PROVIDERS.json": "f2edb7922f3029a5d607437e737775ff3371bca49ebab62e5e2495d16d3bf573", + "allocation/vendor/PLAN.json.gz": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "allocation/vendor/TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "CLAIM.json": "436e0d297cbdf195445d3697d496ac675e95210b79e70ce602a6a6667a4c6ce9" + }, + "stated": { + "complex_lower": "1689703011137435213783/1000000000000000000000000", + "local_profile": { + "1": 2445, + "2": 706, + "3": 232, + "4": 108, + "5": 18, + "8": 8 + }, + "width_inventory": { + "4": 26, + "5": 2, + "6": 16, + "7": 52, + "8": 99, + "9": 213 + }, + "zero_buffers": 91, + "sources": [ + { + "what": "local_profile", + "file": "CLAIM.json", + "key": "local_profile" + }, + { + "what": "local_profile", + "file": "allocation/PROVIDERS.json", + "key": "gauge44.actual_paid_profile" + }, + { + "what": "local_profile", + "file": "allocation/PROVIDERS.json", + "key": "extra.actual_paid_profile" + }, + { + "what": "width_inventory", + "file": "CLAIM.json", + "key": "width_inventory" + }, + { + "what": "zero_buffers", + "file": "CLAIM.json", + "key": "zero_buffers" + } + ], + "complex_lower_note": "the uniform root of this table's paid profile (no lever) as the community's own discovery assembly prints it for this table (complex_lower 0.001689703011137435213783, run unmodified on a fresh clone at the base); not in #2979's files, because the table is new" + }, + "lowering": { + "R": 408, + "warps": 72, + "tadds": 36, + "base": { + "canonical_content_sha256": "852d09f08b83b760055aaa525632b75f4a8497a816405edbc325670222db63b4", + "gcert1w_content_sha256": "c03055bfeda8058849ec6cf82ff9c1e2b47366485ec17b1e17a943e9e94e2760", + "gcert1b_content_sha256": "db40b7dea1da2922d96b8a675c0eda2c0efdd4794c51a086c249f5b747898ccb" + }, + "extra": { + "canonical_content_sha256": "202d3bfa43c5449eb0531816dc0dbd116b22ae1bf6cede550d82c49eb3bb1b22", + "gcert1w_content_sha256": "43f4b3f09a62aa2181c196f1413fc28856e0e850440531e9932666652e84331a", + "gcert1b_content_sha256": "3edb0a402baab54a13440b33efffc478d7aeadc3e7065e8e31b808a10084148d" + } + }, + "fill": { + "rows": 271728, + "roles_per_call": 408, + "calls": 666, + "replicas": 74 + }, + "heads": { + "total": 16576, + "child8": 8288, + "child10": 8288, + "other_rank48": 0 + }, + "price": { + "half_cut": "1.7159005029e-03", + "full_cut": "1.7887045643e-03" + }, + "rate": { + "N": 17887045, + "module": null, + "cut": "full", + "profile": { + "children": { + "1": 1630639, + "2": 470196, + "3": 154512, + "4": 71928, + "5": 11988, + "6": 5, + "7": 3, + "8": 5328, + "17": 8, + "19": 1, + "23": 25905 + }, + "W": 66304, + "H": 16576, + "kc": 25, + "m": 73 + } + }, + "what": "A-fc: #2979's words, order, dispatch, plan and template unchanged (the price changes with the table: its own uniform figure is 1.6897030e-3), with a re-solved table of hosts (fills/2979Fc/FILL.json.gz and its paid profile fills/2979Fc/PROFILE.json), FULL cut: each of the 16,576 literal heads removed (job 73 - 48 = 25 on its array); this table has no other rank-48 block, so nothing is split; every paid block then has rank at most 23 < 25. Checked by computer, not proved in Lean.", + "fill_in_package": "fills/2979Fc/FILL.json.gz", + "fill_in_package_sha256": "7fc766c6c3e1561cee60b258138a918020b96d85ea782a2b01ad0ee035fd082e", + "profile_in_package": "fills/2979Fc/PROFILE.json", + "profile_in_package_sha256": "5df7941120150492c64e62dc3362095eff3dfac9facff041ebb5c25b2e78f75e", + "lean_status": "not proved in Lean: Theorem 1G and the general theorem of the full cut are proved in Lean (Lean repository, package/leverF); this table's own instance is not: its heads-first certificate and the rate fact at 17887045/10^10 are checked by computer, and the cut fact on #2979's words is argued by hand from the template it shares with #3945 (where it is proved in Lean), not checked" +} diff --git a/research/lever-mixed-targets-2979/instances/3945.json b/research/lever-mixed-targets-2979/instances/3945.json new file mode 100644 index 000000000..c71df9033 --- /dev/null +++ b/research/lever-mixed-targets-2979/instances/3945.json @@ -0,0 +1,111 @@ +{ + "id": "3945", + "pr": 3945, + "author": "Dugongue", + "on_main": true, + "head": "91f81d131252db704f945891da1ea54e29d46b8b", + "source_default": "research/staged544-terminal-gap-fill", + "files": { + "word_base": "owner/inputs/WORD-base.json.gz", + "word_extra": "owner/inputs/WORD-extra.json.gz", + "fill": "owner/FILL.json.gz", + "order": "owner/inputs/ORDER.json", + "dispatch": "owner/inputs/DISPATCH.json", + "plan": "owner/inputs/PLAN.json.gz", + "template": "owner/inputs/TEMPLATE.json.gz", + "profile": "owner/PROFILE.json" + }, + "inputs_sha256": { + "owner/inputs/WORD-base.json.gz": "08e6c96fbe3dfec96cb8451b3867ef8c1a214109ecd1e5af7fcc28e0f05728d0", + "owner/inputs/WORD-extra.json.gz": "d83c2ec9cecc0ad092d34ea4080b28a4fd7199579356b6d5a8fc6cd53ff93299", + "owner/FILL.json.gz": "430233230c9194a52bda171afd21713351fdd02e0054230012109e44047c4c55", + "owner/inputs/ORDER.json": "743e74b538432e2b2045e754b0de9c18f36fc5039fdb8eb542177a898ec78e44", + "owner/inputs/DISPATCH.json": "5d6fa711d704a1b498e5fe066ea821c4fa0217463702e82a7ce5be9da4023e8a", + "owner/inputs/PLAN.json.gz": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "owner/inputs/TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "owner/PROFILE.json": "64b85c791a331e79ddc18f047b672240c008900b8c004d37cf6d925067373228", + "RESULT.json": "d4f56e344b4bc18ad99734089b1f1222db95df8dc9274c9915e655c576bf324d" + }, + "stated": { + "complex_lower": "0.001730663236534549309146", + "local_profile": { + "1": 2482, + "2": 712, + "3": 218, + "4": 109, + "5": 20, + "8": 8 + }, + "width_inventory": { + "5": 28, + "6": 18, + "7": 53, + "8": 96, + "9": 213 + }, + "zero_buffers": 91, + "sources": [ + { + "what": "complex_lower", + "file": "RESULT.json", + "key": "root_lower" + }, + { + "what": "local_profile", + "file": "RESULT.json", + "key": "local_profile" + } + ] + }, + "lowering": { + "R": 408, + "warps": 72, + "tadds": 36, + "base": { + "canonical_content_sha256": "938f0924e78233bd3c21990efb3860874825bc522d6bfaaffc7d82d2a608bc43", + "gcert1w_content_sha256": "80a5447a5ad5bcd5677830b208b4b0858d2f8876694d132debff3c4b8989c200", + "gcert1b_content_sha256": "dd23a7cbcf2defdfbab73b2c6512db3e9f40b6557f895484ba530c9a4b2dfe46" + }, + "extra": { + "canonical_content_sha256": "6df1ec686b7ea39225a7bc2d87639876ef65772f2d8852f40b4ebb979efd6e5a", + "gcert1w_content_sha256": "0023e2065f55529c7675ff01c5355159a0b0a06126c4309df46ef8646c9c9a04", + "gcert1b_content_sha256": "dc63201e36bfb5f361d686ac5e4024c12b810d4b109c79c4e9f4cf3273b4349c" + } + }, + "fill": { + "rows": 1321920, + "roles_per_call": 408, + "calls": 3240, + "replicas": 360 + }, + "heads": { + "total": 57312, + "child8": 28672, + "child10": 28640, + "other_rank48": 80640 + }, + "price": { + "half_cut": "1.7501109246e-03", + "full_cut_what_if": "1.7307679642e-03" + }, + "rate": { + "N": 17501109, + "module": "Work/Mixed/Rate3945.lean", + "profile": { + "children": { + "1": 8041680, + "2": 2306880, + "3": 729648, + "4": 353160, + "5": 69120, + "8": 25920, + "24": 57312, + "48": 80640 + }, + "W": 322560, + "H": 57312, + "kc": 49, + "m": 73 + } + } +} diff --git a/research/lever-mixed-targets-2979/instances/3945F.json b/research/lever-mixed-targets-2979/instances/3945F.json new file mode 100644 index 000000000..ff6a91b71 --- /dev/null +++ b/research/lever-mixed-targets-2979/instances/3945F.json @@ -0,0 +1,114 @@ +{ + "id": "3945F", + "pr": 3945, + "author": "Dugongue", + "on_main": true, + "head": "91f81d131252db704f945891da1ea54e29d46b8b", + "source_default": "research/staged544-terminal-gap-fill", + "files": { + "word_base": "owner/inputs/WORD-base.json.gz", + "word_extra": "owner/inputs/WORD-extra.json.gz", + "fill": "owner/FILL.json.gz", + "order": "owner/inputs/ORDER.json", + "dispatch": "owner/inputs/DISPATCH.json", + "plan": "owner/inputs/PLAN.json.gz", + "template": "owner/inputs/TEMPLATE.json.gz", + "profile": "owner/PROFILE.json" + }, + "inputs_sha256": { + "owner/inputs/WORD-base.json.gz": "08e6c96fbe3dfec96cb8451b3867ef8c1a214109ecd1e5af7fcc28e0f05728d0", + "owner/inputs/WORD-extra.json.gz": "d83c2ec9cecc0ad092d34ea4080b28a4fd7199579356b6d5a8fc6cd53ff93299", + "owner/FILL.json.gz": "430233230c9194a52bda171afd21713351fdd02e0054230012109e44047c4c55", + "owner/inputs/ORDER.json": "743e74b538432e2b2045e754b0de9c18f36fc5039fdb8eb542177a898ec78e44", + "owner/inputs/DISPATCH.json": "5d6fa711d704a1b498e5fe066ea821c4fa0217463702e82a7ce5be9da4023e8a", + "owner/inputs/PLAN.json.gz": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "owner/inputs/TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "owner/PROFILE.json": "64b85c791a331e79ddc18f047b672240c008900b8c004d37cf6d925067373228", + "RESULT.json": "d4f56e344b4bc18ad99734089b1f1222db95df8dc9274c9915e655c576bf324d" + }, + "stated": { + "complex_lower": "0.001730663236534549309146", + "local_profile": { + "1": 2482, + "2": 712, + "3": 218, + "4": 109, + "5": 20, + "8": 8 + }, + "width_inventory": { + "5": 28, + "6": 18, + "7": 53, + "8": 96, + "9": 213 + }, + "zero_buffers": 91, + "sources": [ + { + "what": "complex_lower", + "file": "RESULT.json", + "key": "root_lower" + }, + { + "what": "local_profile", + "file": "RESULT.json", + "key": "local_profile" + } + ] + }, + "lowering": { + "R": 408, + "warps": 72, + "tadds": 36, + "base": { + "canonical_content_sha256": "938f0924e78233bd3c21990efb3860874825bc522d6bfaaffc7d82d2a608bc43", + "gcert1w_content_sha256": "80a5447a5ad5bcd5677830b208b4b0858d2f8876694d132debff3c4b8989c200", + "gcert1b_content_sha256": "dd23a7cbcf2defdfbab73b2c6512db3e9f40b6557f895484ba530c9a4b2dfe46" + }, + "extra": { + "canonical_content_sha256": "6df1ec686b7ea39225a7bc2d87639876ef65772f2d8852f40b4ebb979efd6e5a", + "gcert1w_content_sha256": "0023e2065f55529c7675ff01c5355159a0b0a06126c4309df46ef8646c9c9a04", + "gcert1b_content_sha256": "dc63201e36bfb5f361d686ac5e4024c12b810d4b109c79c4e9f4cf3273b4349c" + } + }, + "fill": { + "rows": 1321920, + "roles_per_call": 408, + "calls": 3240, + "replicas": 360 + }, + "heads": { + "total": 80640, + "child8": 40320, + "child10": 40320, + "other_rank48": 57312 + }, + "price": { + "half_cut": "1.7581520168e-03", + "full_cut": "1.7806935406e-03" + }, + "rate": { + "N": 17806935, + "module": "Work/Mixed/Rate3945F.lean", + "cut": "full", + "profile": { + "children": { + "1": 8041680, + "2": 2306880, + "3": 729648, + "4": 353160, + "5": 69120, + "8": 25920, + "24": 114624 + }, + "W": 322560, + "H": 80640, + "kc": 25, + "m": 73 + } + }, + "what": "#3945 with every head kept, FULL cut (design F): the table of hosts of instance 3945H (fills/3945H/FILL.json.gz) with every literal head removed (job 73 - 48 = 25 on its array) and every other rank-48 block split into two blocks of rank 24 on the same role; #3945's words, order, dispatch, plan, template and price unchanged", + "fill_in_package": "fills/3945H/FILL.json.gz", + "fill_in_package_sha256": "9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3" +} diff --git a/research/lever-mixed-targets-2979/instances/3945H.json b/research/lever-mixed-targets-2979/instances/3945H.json new file mode 100644 index 000000000..e05e4a843 --- /dev/null +++ b/research/lever-mixed-targets-2979/instances/3945H.json @@ -0,0 +1,114 @@ +{ + "id": "3945H", + "pr": 3945, + "author": "Dugongue", + "on_main": true, + "head": "91f81d131252db704f945891da1ea54e29d46b8b", + "source_default": "research/staged544-terminal-gap-fill", + "files": { + "word_base": "owner/inputs/WORD-base.json.gz", + "word_extra": "owner/inputs/WORD-extra.json.gz", + "fill": "owner/FILL.json.gz", + "order": "owner/inputs/ORDER.json", + "dispatch": "owner/inputs/DISPATCH.json", + "plan": "owner/inputs/PLAN.json.gz", + "template": "owner/inputs/TEMPLATE.json.gz", + "profile": "owner/PROFILE.json" + }, + "inputs_sha256": { + "owner/inputs/WORD-base.json.gz": "08e6c96fbe3dfec96cb8451b3867ef8c1a214109ecd1e5af7fcc28e0f05728d0", + "owner/inputs/WORD-extra.json.gz": "d83c2ec9cecc0ad092d34ea4080b28a4fd7199579356b6d5a8fc6cd53ff93299", + "owner/FILL.json.gz": "430233230c9194a52bda171afd21713351fdd02e0054230012109e44047c4c55", + "owner/inputs/ORDER.json": "743e74b538432e2b2045e754b0de9c18f36fc5039fdb8eb542177a898ec78e44", + "owner/inputs/DISPATCH.json": "5d6fa711d704a1b498e5fe066ea821c4fa0217463702e82a7ce5be9da4023e8a", + "owner/inputs/PLAN.json.gz": "d566cfb87b71639d4138e1f89b543e2dd6a7772070226a2a14c799a6835bf21e", + "owner/inputs/TEMPLATE.json.gz": "21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e", + "owner/PROFILE.json": "64b85c791a331e79ddc18f047b672240c008900b8c004d37cf6d925067373228", + "RESULT.json": "d4f56e344b4bc18ad99734089b1f1222db95df8dc9274c9915e655c576bf324d" + }, + "stated": { + "complex_lower": "0.001730663236534549309146", + "local_profile": { + "1": 2482, + "2": 712, + "3": 218, + "4": 109, + "5": 20, + "8": 8 + }, + "width_inventory": { + "5": 28, + "6": 18, + "7": 53, + "8": 96, + "9": 213 + }, + "zero_buffers": 91, + "sources": [ + { + "what": "complex_lower", + "file": "RESULT.json", + "key": "root_lower" + }, + { + "what": "local_profile", + "file": "RESULT.json", + "key": "local_profile" + } + ] + }, + "lowering": { + "R": 408, + "warps": 72, + "tadds": 36, + "base": { + "canonical_content_sha256": "938f0924e78233bd3c21990efb3860874825bc522d6bfaaffc7d82d2a608bc43", + "gcert1w_content_sha256": "80a5447a5ad5bcd5677830b208b4b0858d2f8876694d132debff3c4b8989c200", + "gcert1b_content_sha256": "dd23a7cbcf2defdfbab73b2c6512db3e9f40b6557f895484ba530c9a4b2dfe46" + }, + "extra": { + "canonical_content_sha256": "6df1ec686b7ea39225a7bc2d87639876ef65772f2d8852f40b4ebb979efd6e5a", + "gcert1w_content_sha256": "0023e2065f55529c7675ff01c5355159a0b0a06126c4309df46ef8646c9c9a04", + "gcert1b_content_sha256": "dc63201e36bfb5f361d686ac5e4024c12b810d4b109c79c4e9f4cf3273b4349c" + } + }, + "fill": { + "rows": 1321920, + "roles_per_call": 408, + "calls": 3240, + "replicas": 360 + }, + "heads": { + "total": 80640, + "child8": 40320, + "child10": 40320, + "other_rank48": 57312 + }, + "price": { + "half_cut": "1.7581520168e-03", + "full_cut_what_if": "1.7806935406e-03" + }, + "rate": { + "N": 17581520, + "module": "Work/Mixed/Rate3945H.lean", + "profile": { + "children": { + "1": 8041680, + "2": 2306880, + "3": 729648, + "4": 353160, + "5": 69120, + "8": 25920, + "24": 80640, + "48": 57312 + }, + "W": 322560, + "H": 80640, + "kc": 49, + "m": 73 + } + }, + "what": "#3945 with every head kept (design B): #3945's words, order, dispatch, plan, template and price, with the table of hosts fills/3945H/FILL.json.gz, made by the community's own allocation programs with one added condition, that every block that can be a head stays empty", + "fill_in_package": "fills/3945H/FILL.json.gz", + "fill_in_package_sha256": "9c06677d66b04436b02ec8d88036327bdc8fb12e6fd4f71a1b9c7e915c10c2d3" +} diff --git a/research/lever-mixed-targets-2979/network/Gates.lean b/research/lever-mixed-targets-2979/network/Gates.lean new file mode 100644 index 000000000..14f02e1cb --- /dev/null +++ b/research/lever-mixed-targets-2979/network/Gates.lean @@ -0,0 +1,174 @@ +import Work.Bridge401.Roles +import Work.Bridge377.Sweep + +/-! +# (key: bridge-401) The scalar chain of one run of the compressed nine-stage word, and the exchange + +Credits: the entrance gauges and the residual banks are Dugongue's (CrocSwap/integer-mult-bounds PR #401); the bank +patterns are Lydakis's (#275); the compressed nine-stage layout is jacklightChen's (#377); the bridged word B_K is +DaysSky's (#363); B_2, the engine, the stage geometry and the E8 unit are Jacob Sussman's (wht-power-saving-lean, +Apache-2.0). Written by w-newsums/gen401/gen401.py (from gen377.py). + +The gate layers of B_4 (DaysSky) between twins at equal frames, on the data of the run (`q = 2 .. 4`): + after stage 2q-3 X(q-1) += X(q), Y(q) -= Y(q-1) + after stage 2q-2 Y(q) += Y(q-1), X(q-1) -= X(q) + at the end, q = 4 .. 2: Y(q-1) -= Y(q), X(q) += X(q-1) +Result of a run on its replica: `X_p = -y_p`, `Y_p = x_p` (`chainQ_eq`), banks unchanged. The run maps +`liftRun4 ρ chainQ` keep the other replicas and the banks (`liftRun4_fix`, `liftRun4_fixB`) and read only replica `ρ` +and the banks (`liftRun4_loc`). The signed exchange `brec401` on all replicas. No `sorry`. +-/ + +set_option linter.unusedSectionVars false +set_option linter.unusedVariables false +namespace OAI +namespace PowerSaving +namespace GX +open Binary Matrix Finset RAM SS CB RF BR GF +noncomputable section + +section Gates +variable {Γ T Sl C : Type} {nb : ℕ} + +def pABQ_2 : BRun4 Γ T nb C → BRun4 Γ T nb C := + mkR4 (fun g t => rqX2 (g,t)) (fun g t => rqY1 (g,t)) (fun g t => rqX2 (g,t)) (fun g t => rqY1 (g,t)) (fun g t => rqX3 (g,t)) (fun g t => rqY3 (g,t)) (fun g t => rqX4 (g,t)) (fun g t => rqY4 (g,t)) (fun g b => rqS (g,b)) (fun g c => rqC (g,c)) +def kAQ_2 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) +def kBQ_2 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => -1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) +def pCQ_2 : BRun4 Γ T nb C → BRun4 Γ T nb C := + mkR4 (fun g t => rqX1 (g,t)) (fun g t => rqY2 (g,t)) (fun g t => rqX1 (g,t)) (fun g t => rqY2 (g,t)) (fun g t => rqX3 (g,t)) (fun g t => rqY3 (g,t)) (fun g t => rqX4 (g,t)) (fun g t => rqY4 (g,t)) (fun g b => rqS (g,b)) (fun g c => rqC (g,c)) +def kCQ_2 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) + +def pABQ_3 : BRun4 Γ T nb C → BRun4 Γ T nb C := + mkR4 (fun g t => rqX1 (g,t)) (fun g t => rqY1 (g,t)) (fun g t => rqX3 (g,t)) (fun g t => rqY2 (g,t)) (fun g t => rqX3 (g,t)) (fun g t => rqY2 (g,t)) (fun g t => rqX4 (g,t)) (fun g t => rqY4 (g,t)) (fun g b => rqS (g,b)) (fun g c => rqC (g,c)) +def kAQ_3 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) +def kBQ_3 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) +def pCQ_3 : BRun4 Γ T nb C → BRun4 Γ T nb C := + mkR4 (fun g t => rqX1 (g,t)) (fun g t => rqY1 (g,t)) (fun g t => rqX2 (g,t)) (fun g t => rqY3 (g,t)) (fun g t => rqX2 (g,t)) (fun g t => rqY3 (g,t)) (fun g t => rqX4 (g,t)) (fun g t => rqY4 (g,t)) (fun g b => rqS (g,b)) (fun g c => rqC (g,c)) +def kCQ_3 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) + +def pABQ_4 : BRun4 Γ T nb C → BRun4 Γ T nb C := + mkR4 (fun g t => rqX1 (g,t)) (fun g t => rqY1 (g,t)) (fun g t => rqX2 (g,t)) (fun g t => rqY2 (g,t)) (fun g t => rqX4 (g,t)) (fun g t => rqY3 (g,t)) (fun g t => rqX4 (g,t)) (fun g t => rqY3 (g,t)) (fun g b => rqS (g,b)) (fun g c => rqC (g,c)) +def kAQ_4 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 0) (fun _ _ => 0) +def kBQ_4 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) +def pCQ_4 : BRun4 Γ T nb C → BRun4 Γ T nb C := + mkR4 (fun g t => rqX1 (g,t)) (fun g t => rqY1 (g,t)) (fun g t => rqX2 (g,t)) (fun g t => rqY2 (g,t)) (fun g t => rqX3 (g,t)) (fun g t => rqY4 (g,t)) (fun g t => rqX3 (g,t)) (fun g t => rqY4 (g,t)) (fun g b => rqS (g,b)) (fun g c => rqC (g,c)) +def kCQ_4 : BRun4 Γ T nb C → ℚ := + mkR4 (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => -1) (fun _ _ => 1) (fun _ _ => 0) (fun _ _ => 0) (fun _ _ => 0) + +/-- scalar map of a gate layer. -/ +def gscQ (p : BRun4 Γ T nb C → BRun4 Γ T nb C) (k : BRun4 Γ T nb C → ℚ) + (x : BRun4 Γ T nb C → ℂ) : BRun4 Γ T nb C → ℂ := fun i => x i + (k i : ℂ) * x (p i) + +/-- the scalar map of one run before the exchange. -/ +def chainQ (us : Fin 9 → Sl → Fin nb) : (BRun4 Γ T nb C → ℂ) → (BRun4 Γ T nb C → ℂ) := + gscQ pCQ_2 kCQ_2 ∘ (gscQ pCQ_3 kCQ_3 ∘ (gscQ pCQ_4 kCQ_4 ∘ (id ∘ (liftQ8 (us 8) GF ∘ (id ∘ (liftQ7 (us 7) GB ∘ (id ∘ (gscQ pABQ_4 kBQ_4 ∘ (id ∘ (liftQ6 (us 6) GF ∘ (id ∘ (gscQ pABQ_4 kAQ_4 ∘ (id ∘ (liftQ5 (us 5) GB ∘ (id ∘ (gscQ pABQ_3 kBQ_3 ∘ (id ∘ (liftQ4 (us 4) GF ∘ (id ∘ (gscQ pABQ_3 kAQ_3 ∘ (id ∘ (liftQ3 (us 3) GB ∘ (id ∘ (gscQ pABQ_2 kBQ_2 ∘ (id ∘ (liftQ2 (us 2) GF ∘ (id ∘ (gscQ pABQ_2 kAQ_2 ∘ (id ∘ (liftQ1 (us 1) GB ∘ (id ∘ (liftQ0 (us 0) GF ∘ (id))))))))))))))))))))))))))))))))) + +/-- **The scalar identity of a run**: `X_p = -y_p`, `Y_p = x_p` on every pair of its replica, banks unchanged. -/ +lemma chainQ_eq (us : Fin 9 → Sl → Fin nb) (x : BRun4 Γ T nb C → ℂ) (l : BRunL4 Γ T nb) : + chainQ us x (Sum.inl l) = mkR4 (fun g t => -x (rqY1 (g,t))) (fun g t => x (rqX1 (g,t))) (fun g t => -x (rqY2 (g,t))) (fun g t => x (rqX2 (g,t))) (fun g t => -x (rqY3 (g,t))) (fun g t => x (rqX3 (g,t))) (fun g t => -x (rqY4 (g,t))) (fun g t => x (rqX4 (g,t))) (fun g b => x (rqS (g,b))) (fun g c => x (rqC (g,c))) (Sum.inl l) := by + rcases l with (((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩) + all_goals + simp only [chainQ, Function.comp_apply, id_eq, gscQ, liftQ0, liftQ1, liftQ2, liftQ3, liftQ4, liftQ5, liftQ6, liftQ7, liftQ8, GF, GB, mkR4, mkD4, mkS, pABQ_2, kAQ_2, kBQ_2, pCQ_2, kCQ_2, pABQ_3, kAQ_3, kBQ_3, pCQ_3, kCQ_3, pABQ_4, kAQ_4, kBQ_4, pCQ_4, kCQ_4, posQ0, posQ1, posQ2, posQ3, posQ4, posQ5, posQ6, posQ7, posQ8, rqX1, rqY1, rqX2, rqY2, rqX3, rqY3, rqX4, rqY4, dqX1, dqY1, dqX2, dqY2, dqX3, dqY3, dqX4, dqY4, rqS, rqC, jX, jY, jS, jC] + first + | (push_cast; ring) + | (push_cast; done) + | ring + +/-- run `ρ` keeps every other replica and the banks. -/ +lemma liftRun4_fix (use : Fin 8 → Fin 9 → Sl → Fin nb) (i ρ : Fin 8) (hi : i ≠ ρ) (x : BRole401 Γ T nb C → ℂ) + (s : BRole401 Γ T nb C) (hs : inA4 ρ s) : liftRun4 i (chainQ (use i)) x s = x s := by + rcases s with ((⟨ρ',d⟩|⟨g,b⟩)|⟨g,c⟩) + · have hs' : ρ' = ρ := hs + exact if_neg (fun e => hi (e.symm.trans hs')) + · show chainQ (use i) (x ∘ runPos4 i) (Sum.inl (Sum.inr (g, b))) = _ + rw [chainQ_eq] + rfl + · exact hs.elim + +/-- every run keeps the banks. -/ +lemma liftRun4_fixB (use : Fin 8 → Fin 9 → Sl → Fin nb) (i : Fin 8) (x : BRole401 Γ T nb C → ℂ) + (s : BRole401 Γ T nb C) (hs : isBk4 s) : liftRun4 i (chainQ (use i)) x s = x s := by + rcases s with ((⟨ρ',d⟩|⟨g,b⟩)|⟨g,c⟩) + · exact hs.elim + · show chainQ (use i) (x ∘ runPos4 i) (Sum.inl (Sum.inr (g, b))) = _ + rw [chainQ_eq] + rfl + · exact hs.elim + +/-- run `ρ` on its replica reads only its replica and the banks. -/ +lemma liftRun4_loc (use : Fin 8 → Fin 9 → Sl → Fin nb) (ρ : Fin 8) (d : BDat4 Γ T) (x x' : BRole401 Γ T nb C → ℂ) + (hxx : ∀ s, inA4 ρ s → x s = x' s) : + liftRun4 ρ (chainQ (use ρ)) x (Sum.inl (Sum.inl (ρ, d))) + = liftRun4 ρ (chainQ (use ρ)) x' (Sum.inl (Sum.inl (ρ, d))) := by + rw [liftRun4_self, liftRun4_self, chainQ_eq, chainQ_eq] + rcases d with ((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩)) + · show -x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inr ((g,t)))))))) = -x' (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inr ((g,t)))))))) + rw [hxx (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inr ((g,t)))))))) rfl] + · show x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inl ((g,t)))))))) = x' (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inl ((g,t)))))))) + exact hxx (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inl ((g,t)))))))) rfl + · show -x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inr ((g,t)))))))) = -x' (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inr ((g,t)))))))) + rw [hxx (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inr ((g,t)))))))) rfl] + · show x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inl ((g,t)))))))) = x' (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inl ((g,t)))))))) + exact hxx (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inl ((g,t)))))))) rfl + · show -x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inr ((g,t))))))) = -x' (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inr ((g,t))))))) + rw [hxx (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inr ((g,t))))))) rfl] + · show x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inl ((g,t))))))) = x' (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inl ((g,t))))))) + exact hxx (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inl ((g,t))))))) rfl + · show -x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inr ((g,t)))))) = -x' (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inr ((g,t)))))) + rw [hxx (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inr ((g,t)))))) rfl] + · show x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inl ((g,t)))))) = x' (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inl ((g,t)))))) + exact hxx (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inl ((g,t)))))) rfl + +/-- **The sweep of the 8 runs on replica `ρ`** is run `ρ` on it. -/ +lemma sweep_data4 (use : Fin 8 → Fin 9 → Sl → Fin nb) (ρ : Fin 8) (d : BDat4 Γ T) (x : BRole401 Γ T nb C → ℂ) : + sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (Γ := Γ) (T := T) (C := C) (use i))) x + (Sum.inl (Sum.inl (ρ, d))) + = chainQ (use ρ) (x ∘ runPos4 ρ) (Sum.inl (Sum.inl d)) := + (sweepMap_local (inA4 ρ) (Sum.inl (Sum.inl (ρ, d))) rfl (fun i : Fin 8 => liftRun4 i (chainQ (use i))) ρ + (fun i hi x s hs => liftRun4_fix use i ρ hi x s hs) (fun x x' hxx => liftRun4_loc use ρ d x x' hxx) x).trans + (liftRun4_self ρ (chainQ (use ρ)) x d) + +/-- the sweep keeps the banks. -/ +lemma sweep_bank4 (use : Fin 8 → Fin 9 → Sl → Fin nb) (g : Γ) (b : Fin nb) (x : BRole401 Γ T nb C → ℂ) : + sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (Γ := Γ) (T := T) (C := C) (use i))) x + (Sum.inl (Sum.inr (g, b))) = x (Sum.inl (Sum.inr (g, b))) := + sweepMap_fix isBk4 (fun i : Fin 8 => liftRun4 i (chainQ (use i))) (fun i x s hs => liftRun4_fixB use i x s hs) x + (Sum.inl (Sum.inr (g, b))) trivial + +/-- the signed exchange `X_p := Y_p`, `Y_p := -X_p` on every pair of every replica. -/ +def bpull401 : BRole401 Γ T nb C → BRole401 Γ T nb C := + mk401 (fun ρ => mkD4 (fun g t => Sum.inl (Sum.inl (ρ, dqY1 (g,t)))) (fun g t => Sum.inl (Sum.inl (ρ, dqX1 (g,t)))) (fun g t => Sum.inl (Sum.inl (ρ, dqY2 (g,t)))) (fun g t => Sum.inl (Sum.inl (ρ, dqX2 (g,t)))) (fun g t => Sum.inl (Sum.inl (ρ, dqY3 (g,t)))) (fun g t => Sum.inl (Sum.inl (ρ, dqX3 (g,t)))) (fun g t => Sum.inl (Sum.inl (ρ, dqY4 (g,t)))) (fun g t => Sum.inl (Sum.inl (ρ, dqX4 (g,t))))) (fun g b => Sum.inl (Sum.inr (g, b))) (fun g c => Sum.inr (g, c)) + +def bsgn401 : BRole401 Γ T nb C → ℚ := + mk401 (fun _ => mkD4 (fun _ _ => 1) (fun _ _ => -1) (fun _ _ => 1) (fun _ _ => -1) (fun _ _ => 1) (fun _ _ => -1) (fun _ _ => 1) (fun _ _ => -1)) (fun _ _ => 1) (fun _ _ => 1) + +variable [Fintype Γ] [DecidableEq Γ] [Fintype T] [DecidableEq T] + [Fintype Sl] [DecidableEq Sl] [Fintype C] [DecidableEq C] + +def brec401 : Matrix (BRole401 Γ T nb C) (BRole401 Γ T nb C) ℚ := + fun i j => if j = bpull401 i then bsgn401 i else 0 + +lemma actPoint_brec401 (x : BRole401 Γ T nb C → ℂ) (i : BRole401 Γ T nb C) : + actPoint brec401 x i = (bsgn401 i : ℂ) * x (bpull401 i) := by + unfold actPoint + rw [sum_eq_single (bpull401 i)] + · simp [brec401] + · intro j _ hj; simp [brec401, hj] + · simp + +end Gates +end +end GX +end PowerSaving +end OAI + +#print axioms OAI.PowerSaving.GX.chainQ_eq +#print axioms OAI.PowerSaving.GX.sweep_data4 +#print axioms OAI.PowerSaving.GX.sweep_bank4 diff --git a/research/lever-mixed-targets-2979/network/XHost/HCert.lean b/research/lever-mixed-targets-2979/network/XHost/HCert.lean new file mode 100644 index 000000000..99f4ee6b4 --- /dev/null +++ b/research/lever-mixed-targets-2979/network/XHost/HCert.lean @@ -0,0 +1,230 @@ +import Work.XHost.HStage + +/-! +# (key: bridge-host) The certificate of the HOSTED nine-stage word + +Copy of Work/Bridge401/GNetCert.lean (Ryan Shea's complex588 tree; written by Nil Mamano's gen401.py) for `GHost401`: +the scalar map of a run is Shea's `chainQ` of the bank map `bk` (a hosted stage has the scalar map of a banked one), so +the sweep, the exchange and the scalar identity are Shea's, word for word. Written by h-L3-build/gen/gen_hnet.py, +prepared with assistance from Claude. No `sorry`. +-/ + +set_option linter.unusedSectionVars false +set_option linter.unusedVariables false +namespace OAI +namespace PowerSaving +namespace XHost +open Binary Matrix Finset RAM SS CB RF BR GF GX +noncomputable section + +section Net +variable {H T Sl C α Γ : Type} [Fintype H] [DecidableEq H] [Fintype T] [DecidableEq T] + [Fintype Sl] [DecidableEq Sl] [Fintype C] [DecidableEq C] [Fintype α] [DecidableEq α] + [Fintype Γ] [DecidableEq Γ] +variable {nb : ℕ} (N : GHost401 H T Sl C α Γ nb) + +/-- the whole run `ρ` before the exchange, on the roles of a run. -/ +lemma GHost401.run (ρ : Fin 8) : + GRoute (N.S0 ρ) (N.S25 ρ) (chainQ (N.bk ρ)) (fun φ => (Fintype.card Γ : ℝ) * N.runUnit φ) := by + have R := ((((((((((((((((((((((((((((((((((N.adapt0 ρ)).trans (N.stage0 ρ)).trans (N.adapt1 ρ)).trans (N.stage1 ρ)).trans ((N.climbA2 ρ))).trans (GRoute.ofX (N.gateA2 ρ))).trans (N.adapt2 ρ)).trans (N.stage2 ρ)).trans ((N.climbB2 ρ))).trans (GRoute.ofX (N.gateB2 ρ))).trans (N.adapt3 ρ)).trans (N.stage3 ρ)).trans ((N.climbA3 ρ))).trans (GRoute.ofX (N.gateA3 ρ))).trans (N.adapt4 ρ)).trans (N.stage4 ρ)).trans ((N.climbB3 ρ))).trans (GRoute.ofX (N.gateB3 ρ))).trans (N.adapt5 ρ)).trans (N.stage5 ρ)).trans ((N.climbA4 ρ))).trans (GRoute.ofX (N.gateA4 ρ))).trans (N.adapt6 ρ)).trans (N.stage6 ρ)).trans ((N.climbB4 ρ))).trans (GRoute.ofX (N.gateB4 ρ))).trans (N.adapt7 ρ)).trans (N.stage7 ρ)).trans (N.adapt8 ρ)).trans (N.stage8 ρ)).trans ((N.fin ρ))).trans (GRoute.ofX (N.gateC4 ρ))).trans (GRoute.ofX (N.gateC3 ρ))).trans (GRoute.ofX (N.gateC2 ρ)) + refine R.cast (fun φ => ?_) + simp only [GHost401.runUnit] + ring + +/-- run `ρ` on all roles: the other replicas wait (before their run at `InitD`, after it at `FinD`). -/ +lemma GHost401.runFull (ρ : Fin 8) : + GRoute (N.Sfull ρ.castSucc) (N.Sfull ρ.succ) (liftRun4 ρ (chainQ (N.bk ρ))) + (fun φ => (Fintype.card Γ : ℝ) * N.runUnit φ) := by + refine GRoute.lift (emRun4 ρ) (h := chainQ (N.bk ρ)) ?_ (fun x => ?_) (fun x i hi => ?_) (fun i hi => ?_) + · have e1 : N.Sfull ρ.castSucc ∘ (emRun4 ρ) = N.S0 ρ := by + funext r + rcases r with ((d|⟨g,b⟩)|⟨g,c⟩) + · exact if_neg (lt_irrefl _) + · rfl + · rfl + have e2 : N.Sfull ρ.succ ∘ (emRun4 ρ) = N.S25 ρ := by + funext r + rcases r with ((d|⟨g,b⟩)|⟨g,c⟩) + · exact if_pos (Nat.lt_succ_self _) + · have e : 9 * ρ.succ.val = 9 * ρ.val + 9 := by + rw [Fin.val_succ] + ring + show N.Zb (9 * ρ.succ.val) g b = N.Zb (9 * ρ.val + 9) g b + rw [e] + · rfl + rw [e1, e2] + exact N.run ρ + · funext r + rcases r with ((d|⟨g,b⟩)|⟨g,c⟩) + · exact if_pos rfl + · rfl + · rfl + · rcases i with ((⟨ρ',d⟩|⟨g,b⟩)|⟨g,c⟩) + · by_cases e : ρ' = ρ + · subst e + exact absurd ((cover_iff _ _).mpr ⟨Sum.inl (Sum.inl d), rfl⟩) hi + · exact if_neg e + · exact absurd ((cover_iff _ _).mpr ⟨Sum.inl (Sum.inr (g, b)), rfl⟩) hi + · exact absurd ((cover_iff _ _).mpr ⟨Sum.inr (g, c), rfl⟩) hi + · rcases i with ((⟨ρ',d⟩|⟨g,b⟩)|⟨g,c⟩) + · by_cases e : ρ' = ρ + · subst e + exact absurd ((cover_iff _ _).mpr ⟨Sum.inl (Sum.inl d), rfl⟩) hi + · have e' : ρ'.val ≠ ρ.val := fun h => e (Fin.ext h) + show (if ρ'.val < ρ.castSucc.val then N.FinD d else N.InitD d) + = (if ρ'.val < ρ.succ.val then N.FinD d else N.InitD d) + simp only [Fin.val_castSucc, Fin.val_succ] + split_ifs <;> first | rfl | (exfalso; omega) + · exact absurd ((cover_iff _ _).mpr ⟨Sum.inl (Sum.inr (g, b)), rfl⟩) hi + · exact absurd ((cover_iff _ _).mpr ⟨Sum.inr (g, c), rfl⟩) hi + +/-- **the 8 runs one after the other.** -/ +lemma GHost401.sweep : + GRoute (N.Sfull 0) (N.Sfull (Fin.last 8)) (sweepMap (fun ρ : Fin 8 => liftRun4 ρ (chainQ (N.bk ρ)))) + (fun φ => ((8 : ℕ) : ℝ) * ((Fintype.card Γ : ℝ) * N.runUnit φ)) := + GRoute.sweep_const 8 N.Sfull _ (fun _ φ => (Fintype.card Γ : ℝ) * N.runUnit φ) _ (fun _ _ => rfl) + (fun ρ => N.runFull ρ) + +/-- **the padding blocks**: ONE block of rank `pad b` per bank. -/ +lemma GHost401.padR : + GRoute (N.Sfull (Fin.last 8)) N.Sfin id + (fun φ => (Fintype.card Γ : ℝ) * ∑ b, bcost φ (N.pad b)) := by + have H1 := GRoute.reach_all (N.Sfull (Fin.last 8)) N.Sfin + (mk401 (fun _ _ _ => 0) (fun _ b φ => bcost φ (N.pad b)) (fun _ _ _ => 0)) (by + rintro ((⟨ρ',d⟩|⟨g,b⟩)|⟨g,c⟩) + · have e : N.Sfull (Fin.last 8) (Sum.inl (Sum.inl (ρ', d))) = N.FinD d := if_pos ρ'.isLt + show GReach (N.Sfull (Fin.last 8) (Sum.inl (Sum.inl (ρ', d)))) (N.FinD d) (fun _ => 0) + rw [e] + exact GReach.refl _ + · exact N.bpad g b + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mk401_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mk401] + simp only [sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, Finset.sum_const_zero] + +/-- the free shifts at the end. -/ +def GHost401.corr : BRole401 Γ T nb C → Space α := + mk401 (fun _ => mkD4 (fun _ _ => 0) (fun g t => N.u g t) (fun _ _ => 0) (fun g t => N.u g t) (fun _ _ => 0) (fun g t => N.u g t) (fun _ _ => 0) (fun g t => N.u g t)) (fun _ _ => 0) (fun _ _ => 0) + +def GHost401.Sz : BRole401 Γ T nb C → CMat α := fun r => shift (N.corr r) * N.Sfin r + +/-- **The scratch certificate of the nine-stage word with entrance gauges and residual banks (PR #401)**, in whole +blocks, with its exact price for every price list. -/ +theorem ghost_certificate : + GCert α (Sum.inl : BLive401 Γ T nb → BRole401 Γ T nb C) + (fun φ => (Fintype.card Γ : ℝ) * N.unit φ) := by + have R1 := N.sweep.trans N.padR + have R2 : GRoute N.Sfin N.Sz id (fun _ => 0) := GRoute.shifts N.hm N.Sfin N.corr + have R3 : GRoute N.Sz (fun r => N.Sz (bpull401 r)) (actPoint brec401) (fun _ => 0) := + GRoute.gate brec401 N.Sz _ (fun i j h => by + have hj : j = bpull401 i := by + by_contra hne + exact h (by simp [brec401, hne]) + rw [hj]) + have Rt := ((R1.trans R2).trans R3).cast (c' := fun φ => (Fintype.card Γ : ℝ) * N.unit φ) + (fun φ => by simp only [GHost401.unit]; push_cast; ring) + have h0 : ∀ (ρ' : Fin 8) (d : BDat4 Γ T), N.Sfull 0 (Sum.inl (Sum.inl (ρ', d))) = N.InitD d := + fun ρ' d => by simp [GHost401.Sfull, mk401] + have hS : ∀ r, ∃ M, N.Sfull 0 r * M = 1 := by + rintro ((⟨ρ',d⟩|⟨g,b⟩)|⟨g,c⟩) + · rw [h0] + rcases d with ((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩)) + · exact N.inv0 g t + · refine ⟨1, ?_⟩ + show (N.G0 g).Xm.Φ 0 * 1 = 1 + rw [N.z0, Matrix.mul_one] + · exact N.inv0 g t + · refine ⟨1, ?_⟩ + show (N.G0 g).Xm.Φ 0 * 1 = 1 + rw [N.z0, Matrix.mul_one] + · exact N.inv0 g t + · refine ⟨1, ?_⟩ + show (N.G0 g).Xm.Φ 0 * 1 = 1 + rw [N.z0, Matrix.mul_one] + · exact N.inv0 g t + · refine ⟨1, ?_⟩ + show (N.G0 g).Xm.Φ 0 * 1 = 1 + rw [N.z0, Matrix.mul_one] + · refine ⟨1, ?_⟩ + show N.Zb 0 g b * 1 = 1 + rw [N.z0b, Matrix.mul_one] + · exact ⟨1, Matrix.mul_one _⟩ + have hT : ∀ l : BLive401 Γ T nb, N.Sz (bpull401 (Sum.inl l)) = kernel α * N.Sfull 0 (Sum.inl l) := by + rintro (⟨ρ', d⟩|⟨g,b⟩) + · rw [h0] + rcases d with ((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩)) + · show shift (N.u g t) * N.YF g t = kernel α * (N.G0 g).Xm.Φ (tt (N.I.tv t)) + exact (N.term g t).symm + · show shift (0 : Space α) * kernel α = kernel α * (N.G0 g).Xm.Φ 0 + rw [shift_zero, Matrix.one_mul, N.z0, Matrix.mul_one] + · show shift (N.u g t) * N.YF g t = kernel α * (N.G0 g).Xm.Φ (tt (N.I.tv t)) + exact (N.term g t).symm + · show shift (0 : Space α) * kernel α = kernel α * (N.G0 g).Xm.Φ 0 + rw [shift_zero, Matrix.one_mul, N.z0, Matrix.mul_one] + · show shift (N.u g t) * N.YF g t = kernel α * (N.G0 g).Xm.Φ (tt (N.I.tv t)) + exact (N.term g t).symm + · show shift (0 : Space α) * kernel α = kernel α * (N.G0 g).Xm.Φ 0 + rw [shift_zero, Matrix.one_mul, N.z0, Matrix.mul_one] + · show shift (N.u g t) * N.YF g t = kernel α * (N.G0 g).Xm.Φ (tt (N.I.tv t)) + exact (N.term g t).symm + · show shift (0 : Space α) * kernel α = kernel α * (N.G0 g).Xm.Φ 0 + rw [shift_zero, Matrix.one_mul, N.z0, Matrix.mul_one] + · show shift (0 : Space α) * kernel α = kernel α * N.Zb 0 g b + rw [shift_zero, Matrix.one_mul, N.z0b, Matrix.mul_one] + have hg : ∀ x : BRole401 Γ T nb C → ℂ, + (∀ s, (∀ l : BLive401 Γ T nb, (Sum.inl l : BRole401 Γ T nb C) ≠ s) → x s = 0) → + ∀ l : BLive401 Γ T nb, + (actPoint brec401 ∘ (id ∘ (id ∘ sweepMap (fun ρ : Fin 8 => liftRun4 ρ (chainQ (N.bk ρ)))))) x (Sum.inl l) + = x (Sum.inl l) := by + intro x _ l + rw [Function.comp_apply, Function.comp_apply, Function.comp_apply, id_eq, id_eq, actPoint_brec401] + rcases l with (⟨ρ, d⟩|⟨g,b⟩) + · rcases d with ((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩)) + · show ((1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inr ((g,t)))))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((1:ℚ):ℂ) * x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inl ((g,t)))))))) = x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inl ((g,t)))))))) + first | (push_cast; ring) | simp + · show ((-1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inl ((g,t)))))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((-1:ℚ):ℂ) * (-x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inr ((g,t))))))))) = x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inl (Sum.inr ((g,t)))))))) + first | (push_cast; ring) | simp + · show ((1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inr ((g,t)))))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((1:ℚ):ℂ) * x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inl ((g,t)))))))) = x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inl ((g,t)))))))) + first | (push_cast; ring) | simp + · show ((-1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inl ((g,t)))))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((-1:ℚ):ℂ) * (-x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inr ((g,t))))))))) = x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inl (Sum.inr (Sum.inr ((g,t)))))))) + first | (push_cast; ring) | simp + · show ((1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inr ((g,t))))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((1:ℚ):ℂ) * x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inl ((g,t))))))) = x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inl ((g,t))))))) + first | (push_cast; ring) | simp + · show ((-1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inl ((g,t))))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((-1:ℚ):ℂ) * (-x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inr ((g,t)))))))) = x (Sum.inl (Sum.inl (ρ, Sum.inl (Sum.inr (Sum.inr ((g,t))))))) + first | (push_cast; ring) | simp + · show ((1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inr ((g,t)))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((1:ℚ):ℂ) * x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inl ((g,t)))))) = x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inl ((g,t)))))) + first | (push_cast; ring) | simp + · show ((-1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inl ((g,t)))))) = _ + rw [sweep_data4 N.bk, chainQ_eq] + show ((-1:ℚ):ℂ) * (-x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inr ((g,t))))))) = x (Sum.inl (Sum.inl (ρ, Sum.inr (Sum.inr ((g,t)))))) + first | (push_cast; ring) | simp + · show ((1:ℚ):ℂ) * sweepMap (fun i : Fin 8 => liftRun4 i (chainQ (N.bk i))) x (Sum.inl (Sum.inr (g, b))) = _ + rw [sweep_bank4 N.bk] + first | (push_cast; ring) | simp + exact gcert_of_groute (Sum.inl : BLive401 Γ T nb → BRole401 Γ T nb C) (N.Sfull 0) + (fun r => N.Sz (bpull401 r)) _ _ Rt hS hg hT + +end Net +end +end XHost +end PowerSaving +end OAI + +#print axioms OAI.PowerSaving.XHost.GHost401.run +#print axioms OAI.PowerSaving.XHost.GHost401.runFull +#print axioms OAI.PowerSaving.XHost.ghost_certificate diff --git a/research/lever-mixed-targets-2979/network/XHost/HStage.lean b/research/lever-mixed-targets-2979/network/XHost/HStage.lean new file mode 100644 index 000000000..fc15ca658 --- /dev/null +++ b/research/lever-mixed-targets-2979/network/XHost/HStage.lean @@ -0,0 +1,1103 @@ +import Work.XHost.HDef + +/-! +# (key: bridge-host) The steps of one run of the HOSTED nine-stage word + +Copy of Work/Bridge401/GNetStage.lean (Shea's complex588 tree; written by Nil Mamano's gen401.py) with same-run hosting: +the adapters also move every host of a window (`hHP`), a stage puts its slots on banks or hosts (`ghliftQ`), the +idle climbs are the remaining climbs of the host chains (`hHE`), and the finals of pairs 1-3 are those of F1-F3. +The gate layers are Shea's, word for word. Written by h-L3-build/gen/gen_hnet.py, prepared with assistance from +Claude. No `sorry`. +-/ + +set_option linter.unusedSectionVars false +set_option linter.unusedVariables false +set_option linter.unusedSimpArgs false +set_option maxHeartbeats 4000000 +namespace OAI +namespace PowerSaving +namespace XHost +open Binary Matrix Finset RAM SS CB RF BR GF GX +noncomputable section + +section Net +variable {H T Sl C α Γ : Type} [Fintype H] [DecidableEq H] [Fintype T] [DecidableEq T] + [Fintype Sl] [DecidableEq Sl] [Fintype C] [DecidableEq C] [Fintype α] [DecidableEq α] + [Fintype Γ] [DecidableEq Γ] +variable {nb : ℕ} (N : GHost401 H T Sl C α Γ nb) + +/-- the free adapters before stage 0 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt0 (ρ : Fin 8) : + GRoute (N.S0 ρ) (N.S1 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S0 ρ) (N.S1 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach ((N.G0 g).Xm.Φ (tt (N.I.tv t))) (N.Hp 0 0 g (false, t)) (fun _ => 0) + rw [← (N.hH0_A2 g t).1] + exact N.hHP_A2_0 g (false, t) + · show GReach ((N.G0 g).Xm.Φ 0) (N.Hp 0 0 g (true, t)) (fun _ => 0) + rw [← (N.hH0_A2 g t).2] + exact N.hHP_A2_0 g (true, t) + · show GReach ((N.G0 g).Xm.Φ (tt (N.I.tv t))) (N.Hp 2 0 g (false, t)) (fun _ => 0) + rw [← (N.hH0_A3 g t).1] + exact N.hHP_A3_0 g (false, t) + · show GReach ((N.G0 g).Xm.Φ 0) (N.Hp 2 0 g (true, t)) (fun _ => 0) + rw [← (N.hH0_A3 g t).2] + exact N.hHP_A3_0 g (true, t) + · show GReach ((N.G0 g).Xm.Φ (tt (N.I.tv t))) (N.Hp 4 0 g (false, t)) (fun _ => 0) + rw [← (N.hH0_A4 g t).1] + exact N.hHP_A4_0 g (false, t) + · show GReach ((N.G0 g).Xm.Φ 0) (N.Hp 4 0 g (true, t)) (fun _ => 0) + rw [← (N.hH0_A4 g t).2] + exact N.hHP_A4_0 g (true, t) + · exact N.hP0 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 0 of run `ρ` (pair 1): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage0 (ρ : Fin 8) : + GRoute (N.S1 ρ) (N.S2 ρ) (liftQ0 (Γ := Γ) (T := T) (C := C) (N.bk ρ 0) GF) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn0 g q * N.S1 ρ (slotR (N.hostAt 0) (N.bk ρ 0) g q) = N.S2 ρ (slotR (N.hostAt 0) (N.bk ρ 0) g q) := by + intro g q + rcases hq : N.hostAt 0 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ0 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 0 q c (s, t) hq + fin_cases c + · cases s <;> exact N.hHZ_A2_0 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A3_0 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A4_0 g q _ hq + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + have h := gistageE_fwd N.I (bid Γ T) N.G0 N.N0 N.Wn0 N.hN0 N.hW0 + (fun g q => N.S1 ρ (slotR (N.hostAt 0) (N.bk ρ 0) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv (bid Γ T) (fun d => (N.G0 d).Xm) + (fun g q => N.S1 ρ (slotR (N.hostAt 0) (N.bk ρ 0) g q)) (cOne Γ C α)) + (mkS N.xi1 N.yi1 (fun g q => N.S2 ρ (slotR (N.hostAt 0) (N.bk ρ 0) g q)) (cOne Γ C α)) GF + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv (bid Γ T) (fun d => (N.G0 d).Xm) + (fun g q => N.Wn0 g q * N.S1 ρ (slotR (N.hostAt 0) (N.bk ρ 0) g q)) (cOne Γ C α) + = mkS N.xi1 N.yi1 (fun g q => N.S2 ρ (slotR (N.hostAt 0) (N.bk ρ 0) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · exact N.x01 g t + · exact N.y01 g t + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ0 (N.hostAt 0) (N.bk ρ 0) (N.hok ρ 0) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GF_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hHZn_A2_0 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A2_0 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A3_0 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A3_0 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_0 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_0 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hZn0 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the free adapters before stage 1 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt1 (ρ : Fin 8) : + GRoute (N.S2 ρ) (N.S3 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S2 ρ) (N.S3 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · exact N.hHP_A2_1 g (false, t) + · exact N.hHP_A2_1 g (true, t) + · exact N.hHP_A3_1 g (false, t) + · exact N.hHP_A3_1 g (true, t) + · exact N.hHP_A4_1 g (false, t) + · exact N.hHP_A4_1 g (true, t) + · exact N.hP1 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 1 of run `ρ` (pair 1): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage1 (ρ : Fin 8) : + GRoute (N.S3 ρ) (N.S4 ρ) (liftQ1 (Γ := Γ) (T := T) (C := C) (N.bk ρ 1) GB) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn1 g q * N.S3 ρ (slotR (N.hostAt 1) (N.bk ρ 1) g q) = N.S4 ρ (slotR (N.hostAt 1) (N.bk ρ 1) g q) := by + intro g q + rcases hq : N.hostAt 1 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ1 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 1 q c (s, t) hq + fin_cases c + · cases s <;> exact N.hHZ_A2_1 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A3_1 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A4_1 g q _ hq + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + have h := gistageE_bwd N.I N.r1 N.G1 N.N1 N.Wn1 N.hN1 N.hW1 + (fun g q => N.S3 ρ (slotR (N.hostAt 1) (N.bk ρ 1) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r1 (fun d => (N.G1 d).Xm) + (fun g q => N.S3 ρ (slotR (N.hostAt 1) (N.bk ρ 1) g q)) (cOne Γ C α)) + (mkS N.xi2 N.yi2 (fun g q => N.S4 ρ (slotR (N.hostAt 1) (N.bk ρ 1) g q)) (cOne Γ C α)) GB + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r1 (fun d => (N.G1 d).Xm) + (fun g q => N.Wn1 g q * N.S3 ρ (slotR (N.hostAt 1) (N.bk ρ 1) g q)) (cOne Γ C α) + = mkS N.xi2 N.yi2 (fun g q => N.S4 ρ (slotR (N.hostAt 1) (N.bk ρ 1) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · exact N.x12 g t + · exact N.y12 g t + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ1 (N.hostAt 1) (N.bk ρ 1) (N.hok ρ 1) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GB_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hHZn_A2_1 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A2_1 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A3_1 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A3_1 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_1 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_1 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hZn1 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the remaining climb of the host chains A2 (pair 2): ONE block of rank `hrem 0 j` per role. -/ +lemma GHost401.climbA2 (ρ : Fin 8) : + GRoute (N.S4 ρ) (N.S5 ρ) id (fun φ => (Fintype.card Γ : ℝ) * N.hcost 0 φ) := by + have H1 := GRoute.reach_all (N.S4 ρ) (N.S5 ρ) + (mkR4 (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ t φ => bcost φ (N.hrem 0 (false, t))) (fun _ t φ => bcost φ (N.hrem 0 (true, t))) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0)) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach (N.Hb 0 2 g (false, t)) ((N.G2 (N.r2 t g)).Xm.Φ (tt (N.I.tv t))) (fun φ => bcost φ (N.hrem 0 (false, t))) + rw [← N.x12 g t] + exact (N.hHE_A2 g t).1 + · show GReach (N.Hb 0 2 g (true, t)) ((N.G2 (N.r2 t g)).Xm.Φ 0) (fun φ => bcost φ (N.hrem 0 (true, t))) + rw [← N.y12 g t] + exact (N.hHE_A2 g t).2 + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mkR4_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mkR4] + simp only [GHost401.hcost, sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, + Finset.sum_add_distrib, Finset.sum_const_zero, smul_zero] + ring + +/-- gate layer A2 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateA2 (ρ : Fin 8) : XRoute (N.S5 ρ) (N.S5 ρ) (gscQ pABQ_2 kAQ_2) (fun _ => 0) := by + refine gateP pABQ_2 kAQ_2 (N.S5 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- the free adapters before stage 2 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt2 (ρ : Fin 8) : + GRoute (N.S5 ρ) (N.S6 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S5 ρ) (N.S6 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach ((N.G2 (N.r2 t g)).Xm.Φ (tt (N.I.tv t))) (N.Hp 1 2 g (false, t)) (fun _ => 0) + rw [← (N.hH0_B2 g t).1] + exact N.hHP_B2_2 g (false, t) + · show GReach ((N.G2 (N.r2 t g)).Xm.Φ 0) (N.Hp 1 2 g (true, t)) (fun _ => 0) + rw [← (N.hH0_B2 g t).2] + exact N.hHP_B2_2 g (true, t) + · exact N.hHP_A3_2 g (false, t) + · exact N.hHP_A3_2 g (true, t) + · exact N.hHP_A4_2 g (false, t) + · exact N.hHP_A4_2 g (true, t) + · exact N.hP2 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 2 of run `ρ` (pair 1): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage2 (ρ : Fin 8) : + GRoute (N.S6 ρ) (N.S7 ρ) (liftQ2 (Γ := Γ) (T := T) (C := C) (N.bk ρ 2) GF) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn2 g q * N.S6 ρ (slotR (N.hostAt 2) (N.bk ρ 2) g q) = N.S7 ρ (slotR (N.hostAt 2) (N.bk ρ 2) g q) := by + intro g q + rcases hq : N.hostAt 2 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ2 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 2 q c (s, t) hq + fin_cases c + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_B2_2 g q _ hq + · cases s <;> exact N.hHZ_A3_2 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A4_2 g q _ hq + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + have h := gistageE_fwd N.I N.r2 N.G2 N.N2 N.Wn2 N.hN2 N.hW2 + (fun g q => N.S6 ρ (slotR (N.hostAt 2) (N.bk ρ 2) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r2 (fun d => (N.G2 d).Xm) + (fun g q => N.S6 ρ (slotR (N.hostAt 2) (N.bk ρ 2) g q)) (cOne Γ C α)) + (mkS N.xo2 N.yo2 (fun g q => N.S7 ρ (slotR (N.hostAt 2) (N.bk ρ 2) g q)) (cOne Γ C α)) GF + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r2 (fun d => (N.G2 d).Xm) + (fun g q => N.Wn2 g q * N.S6 ρ (slotR (N.hostAt 2) (N.bk ρ 2) g q)) (cOne Γ C α) + = mkS N.xo2 N.yo2 (fun g q => N.S7 ρ (slotR (N.hostAt 2) (N.bk ρ 2) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · rfl + · rfl + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ2 (N.hostAt 2) (N.bk ρ 2) (N.hok ρ 2) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GF_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hHZn_B2_2 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_B2_2 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A3_2 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A3_2 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_2 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_2 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hZn2 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the remaining climb of the host chains B2 (pair 2): ONE block of rank `hrem 1 j` per role. -/ +lemma GHost401.climbB2 (ρ : Fin 8) : + GRoute (N.S7 ρ) (N.S8 ρ) id (fun φ => (Fintype.card Γ : ℝ) * N.hcost 1 φ) := by + have H1 := GRoute.reach_all (N.S7 ρ) (N.S8 ρ) + (mkR4 (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ t φ => bcost φ (N.hrem 1 (false, t))) (fun _ t φ => bcost φ (N.hrem 1 (true, t))) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0)) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach (N.Hb 1 3 g (false, t)) ((N.G3 (N.r3 t g)).Xm.Φ (tt (N.I.tv t))) (fun φ => bcost φ (N.hrem 1 (false, t))) + rw [← N.x23 g t] + exact (N.hHE_B2 g t).1 + · show GReach (N.Hb 1 3 g (true, t)) ((N.G3 (N.r3 t g)).Xm.Φ 0) (fun φ => bcost φ (N.hrem 1 (true, t))) + rw [← N.y23 g t] + exact (N.hHE_B2 g t).2 + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mkR4_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mkR4] + simp only [GHost401.hcost, sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, + Finset.sum_add_distrib, Finset.sum_const_zero, smul_zero] + ring + +/-- gate layer B2 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateB2 (ρ : Fin 8) : XRoute (N.S8 ρ) (N.S8 ρ) (gscQ pABQ_2 kBQ_2) (fun _ => 0) := by + refine gateP pABQ_2 kBQ_2 (N.S8 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact N.x23 g t + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (N.y23 g t).symm + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- the free adapters before stage 3 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt3 (ρ : Fin 8) : + GRoute (N.S8 ρ) (N.S9 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S8 ρ) (N.S9 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · show GReach ((N.G2 (N.r2 t g)).Xm.Φ 1) (N.Hp 6 3 g (false, t)) (fun _ => 0) + rw [← (N.hH0_F1 g t).1] + exact N.hHP_F1_3 g (false, t) + · show GReach ((N.G2 (N.r2 t g)).Xm.Φ (1 + tt (N.I.tv t))) (N.Hp 6 3 g (true, t)) (fun _ => 0) + rw [← (N.hH0_F1 g t).2] + exact N.hHP_F1_3 g (true, t) + · exact GReach.refl _ + · exact GReach.refl _ + · exact N.hHP_A3_3 g (false, t) + · exact N.hHP_A3_3 g (true, t) + · exact N.hHP_A4_3 g (false, t) + · exact N.hHP_A4_3 g (true, t) + · exact N.hP3 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 3 of run `ρ` (pair 2): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage3 (ρ : Fin 8) : + GRoute (N.S9 ρ) (N.S10 ρ) (liftQ3 (Γ := Γ) (T := T) (C := C) (N.bk ρ 3) GB) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn3 g q * N.S9 ρ (slotR (N.hostAt 3) (N.bk ρ 3) g q) = N.S10 ρ (slotR (N.hostAt 3) (N.bk ρ 3) g q) := by + intro g q + rcases hq : N.hostAt 3 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ3 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 3 q c (s, t) hq + fin_cases c + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A3_3 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A4_3 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_F1_3 g q _ hq + · exact absurd hw (by decide) + · exact absurd hw (by decide) + have h := gistageE_bwd N.I N.r3 N.G3 N.N3 N.Wn3 N.hN3 N.hW3 + (fun g q => N.S9 ρ (slotR (N.hostAt 3) (N.bk ρ 3) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r3 (fun d => (N.G3 d).Xm) + (fun g q => N.S9 ρ (slotR (N.hostAt 3) (N.bk ρ 3) g q)) (cOne Γ C α)) + (mkS N.xi4 N.yi4 (fun g q => N.S10 ρ (slotR (N.hostAt 3) (N.bk ρ 3) g q)) (cOne Γ C α)) GB + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r3 (fun d => (N.G3 d).Xm) + (fun g q => N.Wn3 g q * N.S9 ρ (slotR (N.hostAt 3) (N.bk ρ 3) g q)) (cOne Γ C α) + = mkS N.xi4 N.yi4 (fun g q => N.S10 ρ (slotR (N.hostAt 3) (N.bk ρ 3) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · exact N.x34 g t + · exact N.y34 g t + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ3 (N.hostAt 3) (N.bk ρ 3) (N.hok ρ 3) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GB_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact (N.hHZn_F1_3 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F1_3 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hHZn_A3_3 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A3_3 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_3 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_3 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hZn3 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the remaining climb of the host chains A3 (pair 3): ONE block of rank `hrem 2 j` per role. -/ +lemma GHost401.climbA3 (ρ : Fin 8) : + GRoute (N.S10 ρ) (N.S11 ρ) id (fun φ => (Fintype.card Γ : ℝ) * N.hcost 2 φ) := by + have H1 := GRoute.reach_all (N.S10 ρ) (N.S11 ρ) + (mkR4 (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ t φ => bcost φ (N.hrem 2 (false, t))) (fun _ t φ => bcost φ (N.hrem 2 (true, t))) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0)) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach (N.Hb 2 4 g (false, t)) ((N.G4 (N.r4 t g)).Xm.Φ (tt (N.I.tv t))) (fun φ => bcost φ (N.hrem 2 (false, t))) + rw [← N.x34 g t] + exact (N.hHE_A3 g t).1 + · show GReach (N.Hb 2 4 g (true, t)) ((N.G4 (N.r4 t g)).Xm.Φ 0) (fun φ => bcost φ (N.hrem 2 (true, t))) + rw [← N.y34 g t] + exact (N.hHE_A3 g t).2 + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mkR4_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mkR4] + simp only [GHost401.hcost, sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, + Finset.sum_add_distrib, Finset.sum_const_zero, smul_zero] + ring + +/-- gate layer A3 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateA3 (ρ : Fin 8) : XRoute (N.S11 ρ) (N.S11 ρ) (gscQ pABQ_3 kAQ_3) (fun _ => 0) := by + refine gateP pABQ_3 kAQ_3 (N.S11 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact (hk rfl).elim + · exact (hk rfl).elim + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- the free adapters before stage 4 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt4 (ρ : Fin 8) : + GRoute (N.S11 ρ) (N.S12 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S11 ρ) (N.S12 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact N.hHP_F1_4 g (false, t) + · exact N.hHP_F1_4 g (true, t) + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach ((N.G4 (N.r4 t g)).Xm.Φ (tt (N.I.tv t))) (N.Hp 3 4 g (false, t)) (fun _ => 0) + rw [← (N.hH0_B3 g t).1] + exact N.hHP_B3_4 g (false, t) + · show GReach ((N.G4 (N.r4 t g)).Xm.Φ 0) (N.Hp 3 4 g (true, t)) (fun _ => 0) + rw [← (N.hH0_B3 g t).2] + exact N.hHP_B3_4 g (true, t) + · exact N.hHP_A4_4 g (false, t) + · exact N.hHP_A4_4 g (true, t) + · exact N.hP4 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 4 of run `ρ` (pair 2): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage4 (ρ : Fin 8) : + GRoute (N.S12 ρ) (N.S13 ρ) (liftQ4 (Γ := Γ) (T := T) (C := C) (N.bk ρ 4) GF) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn4 g q * N.S12 ρ (slotR (N.hostAt 4) (N.bk ρ 4) g q) = N.S13 ρ (slotR (N.hostAt 4) (N.bk ρ 4) g q) := by + intro g q + rcases hq : N.hostAt 4 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ4 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 4 q c (s, t) hq + fin_cases c + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_B3_4 g q _ hq + · cases s <;> exact N.hHZ_A4_4 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_F1_4 g q _ hq + · exact absurd hw (by decide) + · exact absurd hw (by decide) + have h := gistageE_fwd N.I N.r4 N.G4 N.N4 N.Wn4 N.hN4 N.hW4 + (fun g q => N.S12 ρ (slotR (N.hostAt 4) (N.bk ρ 4) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r4 (fun d => (N.G4 d).Xm) + (fun g q => N.S12 ρ (slotR (N.hostAt 4) (N.bk ρ 4) g q)) (cOne Γ C α)) + (mkS N.xo4 N.yo4 (fun g q => N.S13 ρ (slotR (N.hostAt 4) (N.bk ρ 4) g q)) (cOne Γ C α)) GF + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r4 (fun d => (N.G4 d).Xm) + (fun g q => N.Wn4 g q * N.S12 ρ (slotR (N.hostAt 4) (N.bk ρ 4) g q)) (cOne Γ C α) + = mkS N.xo4 N.yo4 (fun g q => N.S13 ρ (slotR (N.hostAt 4) (N.bk ρ 4) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · rfl + · rfl + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ4 (N.hostAt 4) (N.bk ρ 4) (N.hok ρ 4) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GF_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact (N.hHZn_F1_4 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F1_4 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hHZn_B3_4 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_B3_4 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_4 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_4 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hZn4 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the remaining climb of the host chains B3 (pair 3): ONE block of rank `hrem 3 j` per role. -/ +lemma GHost401.climbB3 (ρ : Fin 8) : + GRoute (N.S13 ρ) (N.S14 ρ) id (fun φ => (Fintype.card Γ : ℝ) * N.hcost 3 φ) := by + have H1 := GRoute.reach_all (N.S13 ρ) (N.S14 ρ) + (mkR4 (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ t φ => bcost φ (N.hrem 3 (false, t))) (fun _ t φ => bcost φ (N.hrem 3 (true, t))) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0)) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach (N.Hb 3 5 g (false, t)) ((N.G5 (N.r5 t g)).Xm.Φ (tt (N.I.tv t))) (fun φ => bcost φ (N.hrem 3 (false, t))) + rw [← N.x45 g t] + exact (N.hHE_B3 g t).1 + · show GReach (N.Hb 3 5 g (true, t)) ((N.G5 (N.r5 t g)).Xm.Φ 0) (fun φ => bcost φ (N.hrem 3 (true, t))) + rw [← N.y45 g t] + exact (N.hHE_B3 g t).2 + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mkR4_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mkR4] + simp only [GHost401.hcost, sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, + Finset.sum_add_distrib, Finset.sum_const_zero, smul_zero] + ring + +/-- gate layer B3 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateB3 (ρ : Fin 8) : XRoute (N.S14 ρ) (N.S14 ρ) (gscQ pABQ_3 kBQ_3) (fun _ => 0) := by + refine gateP pABQ_3 kBQ_3 (N.S14 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact N.x45 g t + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (N.y45 g t).symm + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- the free adapters before stage 5 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt5 (ρ : Fin 8) : + GRoute (N.S14 ρ) (N.S15 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S14 ρ) (N.S15 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact N.hHP_F1_5 g (false, t) + · exact N.hHP_F1_5 g (true, t) + · show GReach ((N.G4 (N.r4 t g)).Xm.Φ 1) (N.Hp 7 5 g (false, t)) (fun _ => 0) + rw [← (N.hH0_F2 g t).1] + exact N.hHP_F2_5 g (false, t) + · show GReach ((N.G4 (N.r4 t g)).Xm.Φ (1 + tt (N.I.tv t))) (N.Hp 7 5 g (true, t)) (fun _ => 0) + rw [← (N.hH0_F2 g t).2] + exact N.hHP_F2_5 g (true, t) + · exact GReach.refl _ + · exact GReach.refl _ + · exact N.hHP_A4_5 g (false, t) + · exact N.hHP_A4_5 g (true, t) + · exact N.hP5 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 5 of run `ρ` (pair 3): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage5 (ρ : Fin 8) : + GRoute (N.S15 ρ) (N.S16 ρ) (liftQ5 (Γ := Γ) (T := T) (C := C) (N.bk ρ 5) GB) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn5 g q * N.S15 ρ (slotR (N.hostAt 5) (N.bk ρ 5) g q) = N.S16 ρ (slotR (N.hostAt 5) (N.bk ρ 5) g q) := by + intro g q + rcases hq : N.hostAt 5 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ5 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 5 q c (s, t) hq + fin_cases c + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_A4_5 g q _ hq + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_F1_5 g q _ hq + · cases s <;> exact N.hHZ_F2_5 g q _ hq + · exact absurd hw (by decide) + have h := gistageE_bwd N.I N.r5 N.G5 N.N5 N.Wn5 N.hN5 N.hW5 + (fun g q => N.S15 ρ (slotR (N.hostAt 5) (N.bk ρ 5) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r5 (fun d => (N.G5 d).Xm) + (fun g q => N.S15 ρ (slotR (N.hostAt 5) (N.bk ρ 5) g q)) (cOne Γ C α)) + (mkS N.xi6 N.yi6 (fun g q => N.S16 ρ (slotR (N.hostAt 5) (N.bk ρ 5) g q)) (cOne Γ C α)) GB + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r5 (fun d => (N.G5 d).Xm) + (fun g q => N.Wn5 g q * N.S15 ρ (slotR (N.hostAt 5) (N.bk ρ 5) g q)) (cOne Γ C α) + = mkS N.xi6 N.yi6 (fun g q => N.S16 ρ (slotR (N.hostAt 5) (N.bk ρ 5) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · exact N.x56 g t + · exact N.y56 g t + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ5 (N.hostAt 5) (N.bk ρ 5) (N.hok ρ 5) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GB_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact (N.hHZn_F1_5 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F1_5 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_5 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_5 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hHZn_A4_5 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_A4_5 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hZn5 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the remaining climb of the host chains A4 (pair 4): ONE block of rank `hrem 4 j` per role. -/ +lemma GHost401.climbA4 (ρ : Fin 8) : + GRoute (N.S16 ρ) (N.S17 ρ) id (fun φ => (Fintype.card Γ : ℝ) * N.hcost 4 φ) := by + have H1 := GRoute.reach_all (N.S16 ρ) (N.S17 ρ) + (mkR4 (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ t φ => bcost φ (N.hrem 4 (false, t))) (fun _ t φ => bcost φ (N.hrem 4 (true, t))) (fun _ _ _ => 0) (fun _ _ _ => 0)) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach (N.Hb 4 6 g (false, t)) ((N.G6 (N.r6 t g)).Xm.Φ (tt (N.I.tv t))) (fun φ => bcost φ (N.hrem 4 (false, t))) + rw [← N.x56 g t] + exact (N.hHE_A4 g t).1 + · show GReach (N.Hb 4 6 g (true, t)) ((N.G6 (N.r6 t g)).Xm.Φ 0) (fun φ => bcost φ (N.hrem 4 (true, t))) + rw [← N.y56 g t] + exact (N.hHE_A4 g t).2 + · exact GReach.refl _ + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mkR4_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mkR4] + simp only [GHost401.hcost, sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, + Finset.sum_add_distrib, Finset.sum_const_zero, smul_zero] + ring + +/-- gate layer A4 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateA4 (ρ : Fin 8) : XRoute (N.S17 ρ) (N.S17 ρ) (gscQ pABQ_4 kAQ_4) (fun _ => 0) := by + refine gateP pABQ_4 kAQ_4 (N.S17 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- the free adapters before stage 6 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt6 (ρ : Fin 8) : + GRoute (N.S17 ρ) (N.S18 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S17 ρ) (N.S18 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact N.hHP_F1_6 g (false, t) + · exact N.hHP_F1_6 g (true, t) + · exact N.hHP_F2_6 g (false, t) + · exact N.hHP_F2_6 g (true, t) + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach ((N.G6 (N.r6 t g)).Xm.Φ (tt (N.I.tv t))) (N.Hp 5 6 g (false, t)) (fun _ => 0) + rw [← (N.hH0_B4 g t).1] + exact N.hHP_B4_6 g (false, t) + · show GReach ((N.G6 (N.r6 t g)).Xm.Φ 0) (N.Hp 5 6 g (true, t)) (fun _ => 0) + rw [← (N.hH0_B4 g t).2] + exact N.hHP_B4_6 g (true, t) + · exact N.hP6 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 6 of run `ρ` (pair 3): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage6 (ρ : Fin 8) : + GRoute (N.S18 ρ) (N.S19 ρ) (liftQ6 (Γ := Γ) (T := T) (C := C) (N.bk ρ 6) GF) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn6 g q * N.S18 ρ (slotR (N.hostAt 6) (N.bk ρ 6) g q) = N.S19 ρ (slotR (N.hostAt 6) (N.bk ρ 6) g q) := by + intro g q + rcases hq : N.hostAt 6 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ6 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 6 q c (s, t) hq + fin_cases c + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_B4_6 g q _ hq + · cases s <;> exact N.hHZ_F1_6 g q _ hq + · cases s <;> exact N.hHZ_F2_6 g q _ hq + · exact absurd hw (by decide) + have h := gistageE_fwd N.I N.r6 N.G6 N.N6 N.Wn6 N.hN6 N.hW6 + (fun g q => N.S18 ρ (slotR (N.hostAt 6) (N.bk ρ 6) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r6 (fun d => (N.G6 d).Xm) + (fun g q => N.S18 ρ (slotR (N.hostAt 6) (N.bk ρ 6) g q)) (cOne Γ C α)) + (mkS N.xo6 N.yo6 (fun g q => N.S19 ρ (slotR (N.hostAt 6) (N.bk ρ 6) g q)) (cOne Γ C α)) GF + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r6 (fun d => (N.G6 d).Xm) + (fun g q => N.Wn6 g q * N.S18 ρ (slotR (N.hostAt 6) (N.bk ρ 6) g q)) (cOne Γ C α) + = mkS N.xo6 N.yo6 (fun g q => N.S19 ρ (slotR (N.hostAt 6) (N.bk ρ 6) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · rfl + · rfl + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ6 (N.hostAt 6) (N.bk ρ 6) (N.hok ρ 6) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GF_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact (N.hHZn_F1_6 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F1_6 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_6 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_6 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hHZn_B4_6 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_B4_6 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hZn6 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the remaining climb of the host chains B4 (pair 4): ONE block of rank `hrem 5 j` per role. -/ +lemma GHost401.climbB4 (ρ : Fin 8) : + GRoute (N.S19 ρ) (N.S20 ρ) id (fun φ => (Fintype.card Γ : ℝ) * N.hcost 5 φ) := by + have H1 := GRoute.reach_all (N.S19 ρ) (N.S20 ρ) + (mkR4 (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ _ _ => 0) (fun _ t φ => bcost φ (N.hrem 5 (false, t))) (fun _ t φ => bcost φ (N.hrem 5 (true, t))) (fun _ _ _ => 0) (fun _ _ _ => 0)) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · exact GReach.refl _ + · show GReach (N.Hb 5 7 g (false, t)) ((N.G7 (N.r7 t g)).Xm.Φ (tt (N.I.tv t))) (fun φ => bcost φ (N.hrem 5 (false, t))) + rw [← N.x67 g t] + exact (N.hHE_B4 g t).1 + · show GReach (N.Hb 5 7 g (true, t)) ((N.G7 (N.r7 t g)).Xm.Φ 0) (fun φ => bcost φ (N.hrem 5 (true, t))) + rw [← N.y67 g t] + exact (N.hHE_B4 g t).2 + · exact GReach.refl _ + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mkR4_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mkR4] + simp only [GHost401.hcost, sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, + Finset.sum_add_distrib, Finset.sum_const_zero, smul_zero] + ring + +/-- gate layer B4 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateB4 (ρ : Fin 8) : XRoute (N.S20 ρ) (N.S20 ρ) (gscQ pABQ_4 kBQ_4) (fun _ => 0) := by + refine gateP pABQ_4 kBQ_4 (N.S20 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact N.x67 g t + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (N.y67 g t).symm + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- the free adapters before stage 7 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt7 (ρ : Fin 8) : + GRoute (N.S20 ρ) (N.S21 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S20 ρ) (N.S21 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact N.hHP_F1_7 g (false, t) + · exact N.hHP_F1_7 g (true, t) + · exact N.hHP_F2_7 g (false, t) + · exact N.hHP_F2_7 g (true, t) + · show GReach ((N.G6 (N.r6 t g)).Xm.Φ 1) (N.Hp 8 7 g (false, t)) (fun _ => 0) + rw [← (N.hH0_F3 g t).1] + exact N.hHP_F3_7 g (false, t) + · show GReach ((N.G6 (N.r6 t g)).Xm.Φ (1 + tt (N.I.tv t))) (N.Hp 8 7 g (true, t)) (fun _ => 0) + rw [← (N.hH0_F3 g t).2] + exact N.hHP_F3_7 g (true, t) + · exact GReach.refl _ + · exact GReach.refl _ + · exact N.hP7 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 7 of run `ρ` (pair 4): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage7 (ρ : Fin 8) : + GRoute (N.S21 ρ) (N.S22 ρ) (liftQ7 (Γ := Γ) (T := T) (C := C) (N.bk ρ 7) GB) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn7 g q * N.S21 ρ (slotR (N.hostAt 7) (N.bk ρ 7) g q) = N.S22 ρ (slotR (N.hostAt 7) (N.bk ρ 7) g q) := by + intro g q + rcases hq : N.hostAt 7 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ7 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 7 q c (s, t) hq + fin_cases c + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_F1_7 g q _ hq + · cases s <;> exact N.hHZ_F2_7 g q _ hq + · cases s <;> exact N.hHZ_F3_7 g q _ hq + have h := gistageE_bwd N.I N.r7 N.G7 N.N7 N.Wn7 N.hN7 N.hW7 + (fun g q => N.S21 ρ (slotR (N.hostAt 7) (N.bk ρ 7) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r7 (fun d => (N.G7 d).Xm) + (fun g q => N.S21 ρ (slotR (N.hostAt 7) (N.bk ρ 7) g q)) (cOne Γ C α)) + (mkS N.xi8 N.yi8 (fun g q => N.S22 ρ (slotR (N.hostAt 7) (N.bk ρ 7) g q)) (cOne Γ C α)) GB + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r7 (fun d => (N.G7 d).Xm) + (fun g q => N.Wn7 g q * N.S21 ρ (slotR (N.hostAt 7) (N.bk ρ 7) g q)) (cOne Γ C α) + = mkS N.xi8 N.yi8 (fun g q => N.S22 ρ (slotR (N.hostAt 7) (N.bk ρ 7) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · exact N.x78 g t + · exact N.y78 g t + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ7 (N.hostAt 7) (N.bk ρ 7) (N.hok ρ 7) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GB_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact (N.hHZn_F1_7 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F1_7 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_7 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_7 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F3_7 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F3_7 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hZn7 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the free adapters before stage 8 of run `ρ`: every bank from `Zb` to `Zp`, every host of a window. -/ +lemma GHost401.adapt8 (ρ : Fin 8) : + GRoute (N.S22 ρ) (N.S23 ρ) id (fun _ => 0) := by + have H1 := GRoute.reach_all (N.S22 ρ) (N.S23 ρ) (fun _ _ => 0) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact N.hHP_F1_8 g (false, t) + · exact N.hHP_F1_8 g (true, t) + · exact N.hHP_F2_8 g (false, t) + · exact N.hHP_F2_8 g (true, t) + · exact N.hHP_F3_8 g (false, t) + · exact N.hHP_F3_8 g (true, t) + · exact GReach.refl _ + · exact GReach.refl _ + · exact N.hP8 ρ g b + · exact GReach.refl _) + exact H1.cast (fun φ => by simp) + +/-- stage 8 of run `ρ` (pair 4): the slot `q` of `g` on its bank or on its host. -/ +lemma GHost401.stage8 (ρ : Fin 8) : + GRoute (N.S23 ρ) (N.S24 ρ) (liftQ8 (Γ := Γ) (T := T) (C := C) (N.bk ρ 8) GF) + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have hUS : ∀ g q, N.Wn8 g q * N.S23 ρ (slotR (N.hostAt 8) (N.bk ρ 8) g q) = N.S24 ρ (slotR (N.hostAt 8) (N.bk ρ 8) g q) := by + intro g q + rcases hq : N.hostAt 8 q with _ | ⟨c, s, t⟩ + · rw [slotR_bank hq] + exact N.hZ8 ρ g q hq + · rw [slotR_host hq] + have hw := N.hostWin 8 q c (s, t) hq + fin_cases c + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · exact absurd hw (by decide) + · cases s <;> exact N.hHZ_F1_8 g q _ hq + · cases s <;> exact N.hHZ_F2_8 g q _ hq + · cases s <;> exact N.hHZ_F3_8 g q _ hq + have h := gistageE_fwd N.I N.r8 N.G8 N.N8 N.Wn8 N.hN8 N.hW8 + (fun g q => N.S23 ρ (slotR (N.hostAt 8) (N.bk ρ 8) g q)) (cOne Γ C α) (cOne Γ C α) + have h' : GRoute (bIn N.I.tv N.r8 (fun d => (N.G8 d).Xm) + (fun g q => N.S23 ρ (slotR (N.hostAt 8) (N.bk ρ 8) g q)) (cOne Γ C α)) + (mkS N.xo8 N.yo8 (fun g q => N.S24 ρ (slotR (N.hostAt 8) (N.bk ρ 8) g q)) (cOne Γ C α)) GF + (fun φ => (Fintype.card Γ : ℝ) * N.I.cost φ) := by + have e : bOut N.I.tv N.r8 (fun d => (N.G8 d).Xm) + (fun g q => N.Wn8 g q * N.S23 ρ (slotR (N.hostAt 8) (N.bk ρ 8) g q)) (cOne Γ C α) + = mkS N.xo8 N.yo8 (fun g q => N.S24 ρ (slotR (N.hostAt 8) (N.bk ρ 8) g q)) (cOne Γ C α) := by + funext r + rcases r with (((⟨g,t⟩|⟨g,t⟩)|⟨g,q⟩)|⟨g,c⟩) + · rfl + · rfl + · exact hUS g q + · rfl + rw [← e] + exact h + refine ghliftQ8 (N.hostAt 8) (N.bk ρ 8) (N.hok ρ 8) h' (fun g t => rfl) (fun g t => rfl) + (fun g t => rfl) (fun g t => rfl) (fun g q => rfl) (fun g q => rfl) (fun g c => rfl) (fun g c => rfl) ?_ + (fun _ _ _ => rfl) GF_loc + intro r hr + rcases r with ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact (N.hHZn_F1_8 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F1_8 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_8 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F2_8 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F3_8 g (false, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact (N.hHZn_F3_8 g (true, t) (fun q hq => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_host hq]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jX (g,t), rfl⟩) hr + · exact absurd ((cover_iff _ _).mpr ⟨jY (g,t), rfl⟩) hr + · exact (N.hZn8 ρ g b (fun q hq hb => hr ((cover_iff _ _).mpr + ⟨jS (g, q), by show slotR _ _ g q = _; rw [slotR_bank hq, hb]; rfl⟩))).symm + · exact absurd ((cover_iff _ _).mpr ⟨jC (g,c), rfl⟩) hr + +/-- the finals of the replica of run `ρ`: the remaining climbs of F1-F3 and pair 4's final block. -/ +lemma GHost401.fin (ρ : Fin 8) : + GRoute (N.S24 ρ) (N.S25 ρ) id (fun φ => (Fintype.card Γ : ℝ) * + (N.hcost 6 φ + N.hcost 7 φ + N.hcost 8 φ + (Fintype.card T : ℝ) * (N.cX4 φ + N.cY4 φ))) := by + have H1 := GRoute.reach_all (N.S24 ρ) (N.S25 ρ) + (mkR4 (fun _ t φ => bcost φ (N.hrem 6 (false, t))) (fun _ t φ => bcost φ (N.hrem 6 (true, t))) (fun _ t φ => bcost φ (N.hrem 7 (false, t))) (fun _ t φ => bcost φ (N.hrem 7 (true, t))) (fun _ t φ => bcost φ (N.hrem 8 (false, t))) (fun _ t φ => bcost φ (N.hrem 8 (true, t))) (fun _ _ => N.cX4) (fun _ _ => N.cY4) (fun _ _ _ => 0) (fun _ _ _ => 0)) (by + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) + · exact (N.hHE_F1 g t).1 + · exact (N.hHE_F1 g t).2 + · exact (N.hHE_F2 g t).1 + · exact (N.hHE_F2 g t).2 + · exact (N.hHE_F3 g t).1 + · exact (N.hHE_F3 g t).2 + · exact GReach.ofX (N.fX4 g t) + · exact GReach.ofX (N.fY4 g t) + · exact GReach.refl _ + · exact GReach.refl _) + refine H1.cast (fun φ => ?_) + simp_rw [mkR4_map (fun c : (ℕ → ℝ) → ℝ => c φ)] + rw [sum_mkR4] + simp only [GHost401.hcost, sum_const, card_univ, nsmul_eq_mul, mul_zero, add_zero, zero_add, + Finset.sum_add_distrib, Finset.sum_const_zero, smul_zero] + ring + +/-- gate layer C4 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateC4 (ρ : Fin 8) : XRoute (N.S25 ρ) (N.S25 ρ) (gscQ pCQ_4 kCQ_4) (fun _ => 0) := by + refine gateP pCQ_4 kCQ_4 (N.S25 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · rfl + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- gate layer C3 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateC3 (ρ : Fin 8) : XRoute (N.S25 ρ) (N.S25 ρ) (gscQ pCQ_3 kCQ_3) (fun _ => 0) := by + refine gateP pCQ_3 kCQ_3 (N.S25 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · rfl + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + +/-- gate layer C2 of run `ρ` (Shea's, word for word): twins have equal frames. -/ +lemma GHost401.gateC2 (ρ : Fin 8) : XRoute (N.S25 ρ) (N.S25 ρ) (gscQ pCQ_2 kCQ_2) (fun _ => 0) := by + refine gateP pCQ_2 kCQ_2 (N.S25 ρ) ?_ + rintro ((((((⟨g,t⟩|⟨g,t⟩)|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|(⟨g,t⟩|⟨g,t⟩))|⟨g,b⟩)|⟨g,c⟩) hk + · exact (hk rfl).elim + · rfl + · rfl + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + · exact (hk rfl).elim + +end Net +end +end XHost +end PowerSaving +end OAI + +#print axioms OAI.PowerSaving.XHost.GHost401.stage0 +#print axioms OAI.PowerSaving.XHost.GHost401.stage1 +#print axioms OAI.PowerSaving.XHost.GHost401.stage2 +#print axioms OAI.PowerSaving.XHost.GHost401.stage3 +#print axioms OAI.PowerSaving.XHost.GHost401.stage4 +#print axioms OAI.PowerSaving.XHost.GHost401.stage5 +#print axioms OAI.PowerSaving.XHost.GHost401.stage6 +#print axioms OAI.PowerSaving.XHost.GHost401.stage7 +#print axioms OAI.PowerSaving.XHost.GHost401.stage8 +#print axioms OAI.PowerSaving.XHost.GHost401.fin diff --git a/research/lever-mixed-targets-2979/network/XHost/HostK.lean b/research/lever-mixed-targets-2979/network/XHost/HostK.lean new file mode 100644 index 000000000..a91a8c88c --- /dev/null +++ b/research/lever-mixed-targets-2979/network/XHost/HostK.lean @@ -0,0 +1,95 @@ +/-! +# XHost.HostK: the host table of a run, checked by the kernel (`hostK`) + +Same-run hosting (h-L3-design, 13 Oct 2026): ONE table for every run (the hosting programme is block-diagonal: run `ρ` +feeds only the idle climbs of replica `ρ`). Row `l` (stage `l`, 9 rows) lists, for every slot `q` (`R` slots), `0` +(not hosted: the slot goes to a bank, schedule `use`) or `i + 1`, the host `i = (c * 2 + side) * nT + t`: window kind +`c` (0..8 = A2 B2 A3 B3 A4 B4 F1 F2 F3, idle climbs of Shea's complex588 network: Work/Bridge401/GNetStage.lean), +side X/Y, class `t < nT`. `rem` = the remainder rank of every host, `res` = the residual `9 - e_q` of every slot. + +`hostK` checks: 9 rows of length `R`; every entry `0` or a host whose window holds the stage, no host twice in a row +(a `Nat` bitset: ONE residual per role per invocation); `rem i ≤ rank (c i)`; residuals `< 10`; and the packed sum +`Σ_l Σ_q res q * 2^(7 (e - 1)) = Σ_i (rank (c i) - rem i) * 2^(7 i)` (digit-wise, every host's load is +`rank - rem`; a digit is at most `9 * 9 < 2^7`). Modelled on Shea's / Mamano's `schedK` (Work/Bridge401/SchedK.lean). +Core Lean only. The soundness lemma (`hostK = true →` the window, injectivity and load facts as Props) is the port of +`schedK_parts` / `digits_unique` and is NOT in this file yet. Prepared with assistance from Claude. +-/ + +namespace OAI +namespace PowerSaving +namespace XHost + +/-- window table: kind `c` holds stage `l`. -/ +def inWin (c l : Nat) : Bool := + match c with + | 0 => l < 2 + | 1 => l == 2 + | 2 => l < 4 + | 3 => l == 4 + | 4 => l < 6 + | 5 => l == 6 + | 6 => 3 ≤ l && l < 9 + | 7 => 5 ≤ l && l < 9 + | 8 => 7 ≤ l && l < 9 + | _ => false + +/-- the rank of the idle climb of kind `c` (`bcost` ranks of GNetDef: 16 8 32 8 48 8 48 32 16). -/ +def rankOf (c : Nat) : Nat := + match c with + | 0 => 16 + | 1 => 8 + | 2 => 32 + | 3 => 8 + | 4 => 48 + | 5 => 8 + | 6 => 48 + | 7 => 32 + | 8 => 16 + | _ => 0 + +/-- one row: entries `0` or a host `e - 1 < 18 nT` whose window holds stage `l`, no host twice. -/ +def hkRow (nT l : Nat) : Nat → List Nat → Bool + | _, [] => true + | seen, e :: es => + (e == 0 || (decide (e ≤ 18 * nT) && inWin ((e - 1) / (2 * nT)) l && !(seen.testBit e))) && + hkRow nT l (if e == 0 then seen else seen ||| (1 <<< e)) es + +/-- all rows, with their stage index. -/ +def hkRows (nT R : Nat) : Nat → List (List Nat) → Bool + | _, [] => true + | l, row :: rows => (row.length == R) && hkRow nT l 0 row && hkRows nT R (l + 1) rows + +/-- the packed hosted residuals of one row. -/ +def hkSum : List Nat → List Nat → Nat + | e :: es, r :: rs => (if e == 0 then 0 else r <<< (7 * (e - 1))) + hkSum es rs + | _, _ => 0 + +/-- the remainders fit. -/ +def hkRem (nT : Nat) : Nat → List Nat → Bool + | _, [] => true + | i, m :: ms => decide (m ≤ rankOf (i / (2 * nT))) && hkRem nT (i + 1) ms + +/-- the packed target loads `rank - rem`. -/ +def hkTgt (nT : Nat) : Nat → List Nat → Nat + | _, [] => 0 + | i, m :: ms => ((rankOf (i / (2 * nT)) - m) <<< (7 * i)) + hkTgt nT (i + 1) ms + +/-- the sum of a list (left fold). -/ +def hkTot : List Nat → Nat + | [] => 0 + | x :: xs => x + hkTot xs + +/-- **The host-table check.** -/ +def hostK (nT R : Nat) (rows : List (List Nat)) (rem res : List Nat) : Bool := + (rows.length == 9) && hkRows nT R 0 rows && (rem.length == 18 * nT) && hkRem nT 0 rem && + (res.length == R) && res.all (fun r => decide (r < 10)) && + (hkTot (rows.map (fun row => hkSum row res)) == hkTgt nT 0 rem) + +/-- the price of the remainders: the histogram of remainder ranks (rank `m ↦` count), as a checked list. -/ +def hkHist (m : Nat) : List Nat → Nat + | [] => 0 + | x :: xs => (if x == m then 1 else 0) + hkHist m xs + +end XHost +end PowerSaving +end OAI diff --git a/research/lever-mixed-targets-2979/tools/README.md b/research/lever-mixed-targets-2979/tools/README.md new file mode 100644 index 000000000..336086b54 --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/README.md @@ -0,0 +1,18 @@ +# The programs + +All are Python 3 with the standard library only. `verify.py` (one folder up) runs them with `python3 -I -B`. + +| program | what it does | where it comes from | +|---|---|---| +| `transport.py` | rebuilds the community's native canonical form of a borrowed word (frame ids, register compaction, zero buffers, warps, twisted additions) and replays it exactly in the free algebra of warps on every input column, in both orientations | my own implementation, written from the documented semantics of the community's `bw_transport.py` (read, never run); the construction it transports is Cinna Davis's anticipatory dirty borrowing (#2226), and the transport stage of the community's native chain is the GK / #433 lineage. On #3945's words it reproduces the community's own canonical words exactly (equal content hashes). | +| `lower_w.py` | lowers a canonical word to my certificate format (gcert/1w, and gcert/1b with `--to-1b`) and checks it: frames, warps, residual widths helper by helper, the local profile, the invoice, the full program replayed to the endpoint, and seven wrong versions rejected (`--mutants`) | mine; it extends my earlier lowering, itself adapted from Ryan Shea's `canonical_to_gcert_probe.py` | +| `g0_staged.py` | the head test: follows every array of a staged unit through my nine-stage hosted network (step order read from the Lean source in `../network/`), with the word's ORDER, DISPATCH, PLAN, TEMPLATE and FILL rows; classifies every remainder block as a literal head, a literal tail or neither | mine | +| `pricer.py` | an exact re-implementation (not a copy) of the community's moment engine: the largest b on the 10^-24 grid with the moment sum below 1, certified by rational enclosures | mine; the engine it re-implements is the community's (`research/native-complex-moment552/engines/moment.py`, `outer.py`; `research/gauge44-frames-x/code/assemble.py`) | +| `mixed.py` | the balance of a recursion with several job sizes, solved with 60-digit decimals | mine | +| `lever_price.py` | the variants of the lever (uniform, half cut, full cut, best separated cut, break-even); on import it also prints a table of the lever on several community words | mine | +| `price_ours.py` | prices the head test's output: the uniform root against the stated root, and the lever variants with the measured head count | mine | +| `rate_cert.py` | the exact rational certificate of the mixed rate inequality at N/10^10, and its refusal at (N+1)/10^10 | mine; the same enclosures as the Lean rate module | + +Changes against the copies that produced the recorded results: absolute import paths replaced by the program's +own folder (`lever_price.py`, `price_ours.py`), and an option `--xhost` added to `g0_staged.py` (the folder of the +network's Lean files). Nothing else differs. The same files are in my public repository (README section 5). diff --git a/research/lever-mixed-targets-2979/tools/g0_staged.py b/research/lever-mixed-targets-2979/tools/g0_staged.py new file mode 100644 index 000000000..46b996db3 --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/g0_staged.py @@ -0,0 +1,310 @@ +#!/usr/bin/env python3 +"""g-heads (wht45/lever, 19 Oct 2026): gate G0 of rl-plan section 6 for a staged544 T360 word (#3945, #3815), in OUR +lowering (not the hub's controller). Adapted from wht43/bound-check/lg-g0/tools/g0_ours.py (T74, PASS); the network +part (parsing OUR hosted nine-stage network from the Lean source, the gate read/write sets from Shea's Gates.lean, +windows, segments, the chronology of every remainder block, the controls) is lg-g0's code unchanged; what changes: + * the per-call words: OUR gcert/1b lowerings (tools/lower_b.py) of the hub's native canonical BORROW words (re-run on + Colab C1 from the PR's own word files), no copies, exit-route residuals; + * the call data: the staged544 package's ORDER (call order, T = 360 replicas), DISPATCH (provider per call), PLAN + (pairs and sides of the 18 children), TEMPLATE (child ranks) and the literal FILL rows + [time, helper, owner_replica, child, port, offset] (1,321,920 roles), all read as DATA; + * width of a role = OUR residual of that helper in that call's provider (checked: the FILL's offsets are exactly the + compact prefix sums of our widths in time order, and no bin overflows its rank). +Questions (G0): (1) which remainder blocks are literal heads in OUR network (first non-identity operation on their +array, on that array alone, nothing hosted in that array before)? (2) remainder profile? (3) call-block ranks <= 8? +(4) does OUR lowering's global profile equal the hub's PROFILE.json digit for digit? +usage: g0_staged.py BC PKG FILL GCERT_BASE GCERT_EXTRA PROFILE OUT.json [--gates Gates.lean] [--label L] + (BC = .../wht43/bound-check; PKG = a staged544 owner dir with inputs/{ORDER,DISPATCH,PLAN.json.gz,TEMPLATE.json.gz}) +""" +import sys, re, json, gzip, hashlib +from collections import Counter, defaultdict + +a = sys.argv[1:] +BC, PKG, FILLP, GB, GE, PROFP, OUT = a[:7] +GATES = a[a.index('--gates') + 1] if '--gates' in a else BC + '/lg-g0/colab/Gates.lean' +LABEL = a[a.index('--label') + 1] if '--label' in a else '' +V = 112 +rd = lambda p: json.loads(gzip.decompress(open(p, 'rb').read())) if p.endswith('.gz') else json.load(open(p)) +sha = lambda p: hashlib.sha256(open(p, 'rb').read()).hexdigest() +res = dict(label=LABEL, inputs={}) + +# ---------------------------------------------------------------- 1. the per-call words (our lowering) +def blocks(c): + """climb histogram of a gcert/1b word (warps free), lower_b.check's accounting""" + v, R = c['v'], c['R']; dim = [len(f) for f in c['frames']] + cur = list(c['start']); H = Counter() + def regs(g): + return [g[2]] if g[0] == 'warp' else [g[2]] + [t for t, _, _ in g[3]] + list(g[4]) + def climb(r, f): + if cur[r] != f: + H[dim[f] - dim[cur[r]]] += 1; cur[r] = f + for ph in ('A', 'B'): + if ph == 'B': + for _, s, f in c['ret']: + assert cur[s] == f; H[dim[f]] += 1 + for g in c[ph]: + if g[0] == 'warp': + assert cur[g[2]] == g[4]; cur[g[2]] = g[1] + else: + for r in regs(g): climb(r, g[1]) + for r in range(2 * v + R): climb(r, c['final'][r]) + return dict(sorted(H.items())) + +words = {} +for prov, p in (('gauge44', GB), ('extra', GE)): + c = rd(p) + assert c['format'] == 'gcert/1b' and c.get('copies') == 0 and c['v'] == V + dim = [len(f) for f in c['frames']] + E = set(c['exits']); v, R, h = c['v'], c['R'], c['h'] + resq = [(dim[c['final'][2 * v + q]] if 2 * v + q in E else h) - dim[c['start'][2 * v + q]] for q in range(R)] + assert resq == c['residuals'] + hist = blocks(c) + words[prov] = dict(R=R, res=resq, hist=hist) + res['inputs'][prov] = dict(gcert=p, gcert_sha256=sha(p), R=R, h=h, block_hist={str(k): x for k, x in hist.items()}, + max_block_rank=max(hist), res_hist={str(k): x for k, x in sorted(Counter(resq).items())}, + res_sum=sum(resq), exits=len(E)) + +# ---------------------------------------------------------------- 2. our network, parsed from the Lean source (lg-g0, unchanged) +XH = a[a.index('--xhost') + 1] if '--xhost' in a else BC + '/h-L3-build/lean/Work/XHost' # release copy: --xhost added +hst = open(XH + '/HStage.lean').read() +hce = open(XH + '/HCert.lean').read() +hk = open(XH + '/HostK.lean').read() +res['inputs']['lean'] = {f: sha(XH + '/' + f) for f in ('HStage.lean', 'HCert.lean', 'HostK.lean')} +runtxt = re.search(r'lemma GHost401\.run \(ρ : Fin 8\) :.*?have R := (.*?)\n', hce, re.S).group(1) +RUN = re.findall(r'N\.(\w+) ρ', runtxt) +steps = {} +for part in re.split(r'\n(?=/-- )', hst): + m = re.search(r'lemma GHost401\.(\w+)', part) + if not m: continue + name = m.group(1) + bul = [l.strip() for l in part.split('\n') if l.strip().startswith('· ')][-10:] + assert len(bul) == 10, name + tch = {} + for comp, l in enumerate(bul[:8], start=1): + if name.startswith('gate'): + k = None if '(hk rfl).elim' in l else 'gate_write' + elif name.startswith('adapt'): + k = None if 'GReach.refl' in l else 'adapter' + mm = re.search(r'hHP_(\w\d)_\d|Hp (\d) \d', l) + if k: k = ('adapter', mm.group(1) or 'kind%s' % mm.group(2)) + elif name.startswith('stage'): + if 'jX' in l or 'jY' in l: k = 'local' + elif 'hHZn_' in l: k = ('hostuse', re.search(r'hHZn_(\w\d)_', l).group(1)) + else: raise SystemExit('stage case ' + l) + elif name.startswith('climb'): + k = None if 'GReach.refl' in l else ('climb', int(re.search(r'hrem (\d)', l).group(1))) + elif name == 'fin': + if 'hHE_' in l: k = ('climb', {'F1': 6, 'F2': 7, 'F3': 8}[re.search(r'hHE_(F\d)', l).group(1)]) + elif 'GReach.ofX' in l: k = 'free_final' + else: k = None if 'GReach.refl' in l else 'unknown' + else: + raise SystemExit('step ' + name) + if k is not None: tch[comp] = k + steps[name] = tch +assert set(RUN) <= set(steps), set(RUN) - set(steps) +gtxt = open(GATES).read() +res['inputs']['Gates.lean'] = dict(path=GATES, sha256=sha(GATES)) +RQ = {'rqX1': 1, 'rqY1': 2, 'rqX2': 3, 'rqY2': 4, 'rqX3': 5, 'rqY3': 6, 'rqX4': 7, 'rqY4': 8} +def gdef(nm): + return re.search(r'def ' + nm + r' : BRun4 Γ T nb C → [^\n]*:=\s*\n\s*mkR4 (.*)\n', gtxt).group(1) +GREAD = {} +for name in RUN: + if not name.startswith('gate'): continue + pn, kn = re.search(r'lemma GHost401\.' + name + r' .*?gscQ (\w+) (\w+)\)', hst).groups() + pp = [RQ.get(x) for x in re.findall(r'=> (rq\w+) \(', gdef(pn))] + kk = [int(x) for x in re.findall(r'=> (-?\d+)\)', gdef(kn))] + assert len(pp) == 10 and len(kk) == 10, (name, pp, kk) + wr = {i + 1 for i in range(8) if kk[i]} + rdd = {pp[i] for i in range(8) if kk[i]} + assert wr == set(steps[name]), (name, wr, steps[name]) + assert not wr & rdd + for c in rdd: steps[name][c] = 'gate_read' + GREAD[name] = dict(p=pn, k=kn, written=sorted(wr), read=sorted(rdd), coeff={str(i + 1): kk[i] for i in range(8) if kk[i]}) +KN = ['A2', 'B2', 'A3', 'B3', 'A4', 'B4', 'F1', 'F2', 'F3'] +for name, t in steps.items(): + for c, k in list(t.items()): + if isinstance(k, tuple) and k[0] == 'adapter' and k[1].startswith('kind'): + t[c] = ('adapter', KN[int(k[1][4:])]) +inwin_src = re.search(r'def inWin \(c l : Nat\) : Bool :=\s*match c with(.*?)\n\n', hk, re.S).group(1) +rank_src = re.search(r'def rankOf \(c : Nat\) : Nat :=\s*match c with(.*?)\n\n', hk, re.S).group(1) +RANK = {int(x): int(y) for x, y in re.findall(r'\| (\d) => (\d+)', rank_src)} +def inWin(c, l): + expr = dict(re.findall(r'\| (\d) => (.*)', inwin_src))[str(c)] + return bool(eval(expr.replace('&&', ' and ').replace('≤', '<='), {'l': l})) +KIND = {} +for name in RUN: + for comp, k in steps[name].items(): + if isinstance(k, tuple) and k[0] == 'climb': + KIND.setdefault(k[1], [name, []])[1].append(comp) +assert sorted(KIND) == list(range(9)) and all(len(c) == 2 for _, c in KIND.values()) +kind_pair = {c: (comps[0] + 1) // 2 for c, (_, comps) in KIND.items()} +res['our_network'] = dict(gates=GREAD, run_order=RUN, + kinds={KN[c]: dict(climb_step=s, comps=comps, pair=kind_pair[c], rank=RANK[c]) for c, (s, comps) in KIND.items()}) +SEG = {} +cur = None +for name in RUN: + if name.startswith('adapt'): cur = int(name[5:]); SEG[cur] = [] + SEG[cur].append(name) +assert sorted(SEG) == list(range(9)) and all(SEG[l][1] == 'stage%d' % l for l in range(9)) +END = [('padR', {}), ('shifts', {2: 'free_shift', 4: 'free_shift', 6: 'free_shift', 8: 'free_shift'}), + ('brec401', {c: 'relabel' for c in range(1, 9)})] +assert 'mkD4 (fun _ _ => 0) (fun g t => N.u g t) (fun _ _ => 0) (fun g t => N.u g t) (fun _ _ => 0) (fun g t => N.u g t) (fun _ _ => 0) (fun g t => N.u g t)' in hce + +# ---------------------------------------------------------------- 3. the staged544 call data +inp = PKG.rstrip('/') + '/inputs/' +order = [tuple(x) for x in rd(inp + 'ORDER.json')] +T = 1 + max(r for _, r in order) +disp = rd(inp + 'DISPATCH.json') +prov = {(s, r): p for s, r, p in disp} +assert len(prov) == len(order) == 9 * T and set(prov.values()) == {'gauge44', 'extra'} +plan = rd(inp + 'PLAN.json.gz'); tmpl = rd(inp + 'TEMPLATE.json.gz') +for f in ('ORDER.json', 'DISPATCH.json', 'PLAN.json.gz', 'TEMPLATE.json.gz'): + res['inputs'][f] = sha(inp + f) +res['inputs']['FILL'] = dict(path=FILLP, sha256=sha(FILLP)) +res['inputs']['PROFILE'] = dict(path=PROFP, sha256=sha(PROFP)) +per = defaultdict(list) +for t, (l, r) in enumerate(order): per[r].append(l) +assert all(x == list(range(9)) for x in per.values()) and len(per) == T +hubpair = {int(k): x for k, x in plan['pairs'].items()} +hubside = {int(k): x for k, x in plan['sides'].items()} +hubrank = {} +for e in tmpl['idle_children']: + hubrank.setdefault(e['child'], set()).add(e['rank']) +assert all(len(s) == 1 for s in hubrank.values()) +hubrank = {ch: s.pop() for ch, s in hubrank.items()} +ch2kind = {} +for ch in hubpair: + ks = [c for c in range(9) if kind_pair[c] == hubpair[ch] + 1 and RANK[c] == hubrank.get(ch)] + assert len(ks) == 1, (ch, ks) + ch2kind[ch] = ks[0] +res['child_to_kind'] = {str(ch): dict(kind=KN[k], hub_pair=hubpair[ch], side=hubside[ch], rank=hubrank[ch]) for ch, k in sorted(ch2kind.items())} + +def build(segs, end): + pos = 0; callpos = {}; stepos = {} + for t, (l, r) in enumerate(order): + for n in segs[l]: + stepos[r, n] = pos + if n == 'stage%d' % l: callpos[t] = pos + pos += 1 + endpos = {} + for n, _ in end: endpos[n] = pos; pos += 1 + return callpos, stepos, endpos + +fill = rd(FILLP) +assert fill['columns'] == ['time', 'helper', 'owner_replica', 'child', 'port', 'offset'] +ROWS = fill['rows']; del fill +HPC = len(ROWS) // len(order) +assert HPC * len(order) == len(ROWS) and all(words[p]['R'] == HPC for p in words) +res['fill'] = dict(rows=len(ROWS), roles_per_call=HPC, calls=len(order), replicas=T) + +def analyse(segs, end, label): + callpos, stepos, endpos = build(segs, end) + load = Counter(); bad = Counter(); onecall = Counter(); win = {} + uses = defaultdict(list) + cross = 0 + for j, (t, hlp, rep, ch, q, off) in enumerate(ROWS): + assert t == j // HPC and hlp == j % HPC + l, rcall = order[t] + c = ch2kind[ch]; hp, sd = hubpair[ch], hubside[ch] + comp = 2 * (hp + 1) - 1 + sd + assert comp in KIND[c][1] + w = words[prov[(l, rcall)]]['res'][hlp] + key = (rep, c, sd, q) + if off != load[key]: bad['offset_not_compact_prefix_of_our_widths'] += 1 + load[key] += w + onecall[(t, key)] += 1 + if rcall != rep: cross += 1 + p = callpos[t] + if (rep, c, comp) not in win: + climb = stepos[rep, KIND[c][0]] + lastown = max([stepos[rep, n] for l2 in range(9) for n in segs[l2] + if stepos[rep, n] < climb and comp in steps[n] + and not (isinstance(steps[n][comp], tuple) and steps[n][comp][0] in ('adapter', 'hostuse') and steps[n][comp][1] == KN[c])], + default=-1) + win[rep, c, comp] = (lastown, climb) + lastown, climb = win[rep, c, comp] + if not (lastown < p < climb): bad['outside_our_window'] += 1 + if rcall == rep and not inWin(c, l): bad['samerun_not_inWin'] += 1 + uses[(rep, comp, q)].append((p, KN[c], t)) + over = [k for k, x in load.items() if x > RANK[k[1]]] + rem = {} + for rep in range(T): + for c in range(9): + for sd in (0, 1): + for q in range(V): + r = RANK[c] - load[(rep, c, sd, q)] + if r: rem[(rep, c, sd, q)] = r + prof = Counter(rem.values()) + cls = Counter(); ex = {} + for (rep, c, sd, q), r in rem.items(): + comp = KIND[c][1][sd] + climb = stepos[rep, KIND[c][0]] + ev = [] + for l2 in range(9): + for n in segs[l2]: + k = steps[n].get(comp) + if k is None or n == KIND[c][0]: continue + p = stepos[rep, n] + if isinstance(k, tuple) and k[0] in ('adapter', 'hostuse'): + kind_used = any(u[1] == k[1] for u in uses[(rep, comp, q)]) + ev.append((p, n + ':' + str(k[0]) + ':' + k[1], not kind_used)) + else: + ev.append((p, n + ':' + (k if isinstance(k, str) else k[0]), k in ('free_final',))) + for p, kname, t in uses[(rep, comp, q)]: + ev.append((p, 'hosted:' + kname, False)) + for n, tch in end: + if comp in tch: ev.append((endpos[n], n + ':' + tch[comp], tch[comp] in ('free_shift', 'relabel'))) + before = [e for e in ev if e[0] < climb and not e[2]] + after = [e for e in ev if e[0] > climb and not e[2]] + k = 'HEAD-literal' if not before else 'TAIL-literal' if not after else 'neither' + hub_child = next(ch for ch, kk in ch2kind.items() if kk == c and hubside[ch] == sd) + cls[(hub_child, KN[c], 'xy'[sd], r, k)] += 1 + exk = (hub_child, r, k) + if exk not in ex: + ex[exk] = dict(replica=rep, port=q, comp=comp, climb_pos=climb, + first_nonidentity_before=[list(map(str, e)) for e in sorted(before)[:3]], + first_nonfree_after=[list(map(str, e)) for e in sorted(after)[:3]], + identity_touches_before=len([e for e in ev if e[0] < climb and e[2]]), + free_touches_after=[e[1] for e in sorted(ev) if e[0] > climb and e[2]]) + tot = Counter(); tot48 = Counter() + for k, n in cls.items(): + tot[k[4]] += n + if k[3] == 48: tot48[k[4]] += n + return dict(label=label, roles=len(ROWS), cross_replica_roles=cross, violations=dict(bad), loads_over_rank=len(over), + one_use_per_call_and_role=max(onecall.values()) == 1, + remainders=len(rem), remainder_profile={str(k): x for k, x in sorted(prof.items())}, + classes=[dict(hub_child=k[0], kind=k[1], side=k[2], remainder=k[3], cls=k[4], count=n) for k, n in sorted(cls.items())], + totals_by_class=dict(sorted(tot.items())), rank48_by_class=dict(sorted(tot48.items())), + heads_rank48_unhosted=tot48.get('HEAD-literal', 0), + examples={f'{x}:{y}:{z}': e for (x, y, z), e in sorted(ex.items())}) + +main = analyse(SEG, END, 'our network, %s order' % LABEL) +res['G0'] = main +seg_n1 = {l: list(s) for l, s in SEG.items()} +seg_n1[5] = ['adapt5', 'stage5', 'gateA4', 'climbA4'] +n1 = analyse(seg_n1, END, 'NEGATIVE: gateA4 moved before climbA4 (the A4 heads must vanish)') +res['control_gateA4_before_climbA4'] = dict(totals_by_class=n1['totals_by_class'], rank48_by_class=n1['rank48_by_class'], violations=n1['violations']) +del n1 +seg_n2 = {l: list(s) for l, s in SEG.items()}; seg_n2[8] = [n for n in seg_n2[8] if n != 'gateC2'] +n2 = analyse(seg_n2, END, 'POSITIVE (tail detector): gate C2 deleted; pair-1 F1 blocks must become tails') +res['control_without_gateC2'] = dict(totals_by_class=n2['totals_by_class'], rank48_by_class=n2['rank48_by_class'], + classes=[x for x in n2['classes'] if x['kind'] == 'F1']) +del n2 + +# ---------------------------------------------------------------- 4. call blocks and the global profile +calls = Counter(prov[(l, r)] for l, r in order) +prof = Counter() +for p, n in calls.items(): + for r, k in words[p]['hist'].items(): prof[r] += n * k +for r, k in main['remainder_profile'].items(): prof[int(r)] += k +hub = {int(k): x for k, x in rd(PROFP).items()} +res['call_blocks'] = dict(calls_per_provider=dict(calls), max_rank_over_both_words=max(max(words[p]['hist']) for p in words), + all_call_blocks_rank_le_8=all(max(words[p]['hist']) <= 8 for p in words), + global_profile=dict(sorted(prof.items())), hub_profile=dict(sorted(hub.items())), + global_profile_equals_hub=dict(sorted(prof.items())) == dict(sorted(hub.items())), + rank_mass=sum(r * k for r, k in prof.items())) +res['ok'] = main['heads_rank48_unhosted'] >= 1 and not main['violations'] and main['loads_over_rank'] == 0 +json.dump(res, open(OUT, 'w'), indent=1, default=str) +print(json.dumps({k: res[k] for k in ('label', 'call_blocks', 'child_to_kind', 'fill', 'ok')}, indent=1)) +print(json.dumps({k: x for k, x in main.items() if k not in ('examples',)}, indent=1)) +print('controls:', json.dumps(res['control_gateA4_before_climbA4']), json.dumps(res['control_without_gateC2'])) diff --git a/research/lever-mixed-targets-2979/tools/lever_price.py b/research/lever-mixed-targets-2979/tools/lever_price.py new file mode 100644 index 000000000..cbb93438e --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/lever_price.py @@ -0,0 +1,103 @@ +# lever-reprice: price the recursion lever (rl-plan's separated variants) on a word given its paid profile, the counted +# literal head blocks (rank 48) and the other idle rank-48 blocks. Same mixed-target root as rl-plan/tools/rescue.py. +# Controls first: T74 (#1839) must reproduce rl-plan's 1.6948358e-3 (full cut), 1.6968621e-3 (half cut), break-even 9,443. +# Run: python3 -I -B tools/lever_price.py +import sys, json +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from mixed import root, add, sep, D + +def variants(name, prof, W, heads, non, net=None, c_bit=None, quiet=False): + """prof: full paid profile (including the idle rank-48 blocks); heads/non: literal heads / other rank-48 idle. + net: optional {rank: count} of HEAD-net(argued) remainders (cut fully in the optional rows).""" + base = dict(prof); base[48] -= heads + non; assert base[48] >= 0 + if not base[48]: del base[48] + I = heads + non + out = {} + def row(key, ch, tg, label): + b = root(ch, tg); s = sep(ch, tg) + out[key] = dict(b=b, separated=s, label=label) + return b + hub = row('uniform', add(base, 48, I), {73: W}, 'uniform (the hub word)') + row('full_cut', add(base, 24, 2 * non), {73: W - heads, 25: heads}, 'heads cut to target 25, other 48s split 24+24') + row('half_cut', add(add(base, 24, heads), 48, non), {73: W - heads, 49: heads}, 'heads cut by 24 axes (target 49), rest paid') + row('unsep_cut', add(base, 48, non), {73: W - heads, 25: heads}, 'heads cut to 25, others kept at 48 (NOT separated)') + row('all_cut', dict(base), {73: W - I, 25: I}, 'all idle 48s cut (structure false)') + # best separated d (rescue.py's sweep) + best = None + for d in range(1, 49): + tgt = 73 - d; ch = dict(base) + if 48 - d: ch = add(ch, 48 - d, heads) + cap = tgt - 1 + if 48 <= cap: ch = add(ch, 48, non) + else: + rest = 48; pieces = [] + while rest: p = min(cap, rest); pieces.append(p); rest -= p + for p in pieces: ch = add(ch, p, non) + tg = {73: W - heads, tgt: heads} + if not sep(ch, tg): continue + b = root(ch, tg) + if best is None or b > best[1]: best = (d, b) + out['best_d'] = dict(d=best[0], b=best[1]) + if net: + # optional [argued]: also cut the net heads fully (each remainder r: target 73-r, block removed), on top of half cut + ch = add(add(base, 24, heads), 48, non); tg = {73: W - heads - sum(net.values()), 49: heads} + for r, n in net.items(): + ch[r] -= n + if not ch[r]: del ch[r] + tg[73 - r] = tg.get(73 - r, 0) + n + row('half_cut_plus_net', ch, tg, 'half cut + net heads (argued) cut fully') + # break-even heads for the full cut (others split 24+24) at fixed total idle I + def full(t): return root(add(base, 24, 2 * (I - t)), {73: W - t, 25: t}) + lo, hi = 0, I + while hi - lo > 1: + mid = (lo + hi) // 2 + if full(mid) > hub: hi = mid + else: lo = mid + out['breakeven_full'] = hi + if not quiet: + print(f'== {name}: W={W}, idle rank-48 = {I}, literal heads = {heads} ({heads / I * 100:.2f} %), others = {non}') + for k in ('uniform', 'full_cut', 'half_cut', 'unsep_cut', 'all_cut', 'half_cut_plus_net'): + if k not in out: continue + r = out[k]; m = r['b'] - hub + print(f" {r['label']:52s} b={r['b']:.10e} {float(m / hub) * 100:+.3f} % ({float(m):+.4e}) separated={r['separated']}") + bd = out['best_d'] + print(f" best separated d = {bd['d']}: b={bd['b']:.10e} ({float((bd['b'] - hub) / hub) * 100:+.3f} %)") + print(f" full-cut break-even: {out['breakeven_full']} heads ({out['breakeven_full'] / I * 100:.2f} % of {I}); have {heads}") + if c_bit is not None: + for k in ('full_cut', 'half_cut'): + b = out[k]['b'] + print(f" kappa with bit c={c_bit}: {k}: min(b, c) = {min(b, D(c_bit)):.10e} (uniform: {min(hub, D(c_bit)):.10e})") + return out + +if __name__ == '__main__': + print('##### controls: T74 (#1839), rl-plan values 1.6948358e-3 / 1.6968621e-3 / break-even 9,443') + T74 = {1: 1560432, 2: 336336, 3: 278724, 4: 84912, 5: 54612, 8: 5328, 48: 22748} + o = variants('T74 #1839', T74, 66304, 11010, 11738) + print('##### #3945 T360 staged544 terminal-gap fill (heads counted by tools/heads_fill.py)') + P3945 = {1: 8041680, 2: 2306880, 3: 729648, 4: 353160, 5: 69120, 8: 25920, 48: 137952} + o = variants('#3945 T360', P3945, 322560, 57312, 80640, net={3: 23328, 5: 4320}, c_bit='0.001733427039589844234749') + +# ---- other words: same parent template (T37 envelope, sha 21297b20; pinned in #3945 owner/SOURCES.json and in +# #3148's SOURCE-PINS.json), so every FULLY idle rank-48 bin of children 8/10 (pair 3) is a literal head and every idle +# bin of 12/13 (pair 0) is not [argued from the schedule; confirmed with 0 exceptions on #3945 by heads_fill.py]. +# Only the idle profile is public in the bodies, so heads lie in [idle48 - 224 T, min(idle48, 224 T)]; on #3945 the +# measured count equals the lower end (pair 0 never hosted). Half-cut prices increase with heads (break-even 1 head). +def bounds_rows(): + WORDS = [ + ('#3148 T740 (merged, archive)', {1: 16376940, 2: 4821840, 3: 1567431, 4: 679320, 5: 147075, 8: 53280, 48: 282569}, 740), + ('#3605 T740 (open; histogram #3659)', {1: 16417896, 2: 4835160, 3: 1540174, 4: 679321, 5: 143992, 6: 3, 8: 53280, 48: 283185}, 740), + ('#3642 T530 (open)', {1: 11747920, 2: 3453480, 3: 1112042, 4: 486540, 5: 103690, 8: 38160, 48: 202828}, 530), + ('#3653 T488 (open)', {1: 10817496, 2: 3179808, 3: 1024434, 4: 447984, 5: 94794, 8: 35136, 48: 186782}, 488), + ('#3682 T360 (open)', {1: 7980120, 2: 2345760, 3: 755730, 4: 330480, 5: 69930, 8: 25920, 48: 137790}, 360), + ('#3815 T360 (open; same idle-48 bins as #3945)', {1: 7989840, 2: 2349000, 3: 749088, 4: 330480, 5: 69120, 8: 25920, 48: 137952}, 360), + ('#3945 T360 (open)', {1: 8041680, 2: 2306880, 3: 729648, 4: 353160, 5: 69120, 8: 25920, 48: 137952}, 360), + ] + print('##### lever on each word, heads at the lower / upper end of the public bound') + print(f"{'word':48s} {'b (hub word)':>15s} {'heads lo..hi':>17s} {'half cut lo':>15s} {'half cut hi':>15s} {'full cut lo':>15s} {'BE full':>8s}") + for name, prof, T in WORDS: + W = 896 * T; I = prof[48]; lo = max(0, I - 224 * T); hi = min(I, 224 * T) + a = variants(name, prof, W, lo, I - lo, quiet=True) + z = variants(name, prof, W, hi, I - hi, quiet=True) + print(f"{name:48s} {a['uniform']['b']:.10e} {lo:7d}..{hi:7d} {a['half_cut']['b']:.10e} {z['half_cut']['b']:.10e} {a['full_cut']['b']:.10e} {a['breakeven_full']:8d}") +bounds_rows() diff --git a/research/lever-mixed-targets-2979/tools/lower_w.py b/research/lever-mixed-targets-2979/tools/lower_w.py new file mode 100644 index 000000000..2a4809f07 --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/lower_w.py @@ -0,0 +1,584 @@ +#!/usr/bin/env python3 +"""p-lower (round wht45/lever, 19 Oct 2026): lower a staged544 BORROW canonical word (CANONICAL-WORD, as written by +our tools/transport.py or the hub's native chain) into gcert/1w (spec: p-lower/FORMAT.md). + +Extends bh-gap/k-lower's lower_x.py (itself adapted from Ryan Shea's canonical_to_gcert_probe.py): units absorb the +hub's scales, centres become retained totals, the cut a scatter table, exit frames are kept, the hub's tail is the +last part of phase B followed by one final climb per register. New here: + * warps: gate ['warp', r, op, f0, f1] (the hub's event shape) in A (24 on x, the lifted-target port) and B (72, + dirty borrowing), and the operator table `warps`; + * no copies of the sources (mutable x, as gcert/1b and the U8X0 route); the zero-frame y-only precondition P is + the first nP gates of A (P touches the 12 lifted targets, so lower_x's P^-1-into-the-scatter is impossible) and + the scatter is the hub's cut with units only; + * the hub's explicit dirt phase, kept as data: D0 = the 36 twisted adds t += c W(s) expanded as warp / add / + unwarp at frame 0; C0 = the compensation (units after P); + * the hub's explicit full-frame cleanup, kept as data: U = zalloc of the 91 private zero buffers (registers + 632..722), the cleanup (72 warps at FULL, Z reads), zfree. +Exact checks (asserted, results in the report): frames nested at every climb, every warp carries its frame by G, +D0/C0 on frame-0 registers, U on FULL registers and zero buffers, block histogram of the main phase (warps free) == +the hub's local profile, invoice identity, units of data registers 1 after B and of every register 1 after U, +the full program in hub order (D0, P, C0, A-rest, scatter, B, U) replayed in the free warp algebra on every input +column ends at the hub endpoint (identity, y_t += x_t, zero buffers 0 at zfree), residuals per helper == the hub +word's widths, and mutants (wrong G column, wrong warp frame, dropped unwarp, tadd coefficient, zero buffer left +dirty) are rejected. + +usage: lower_w.py CANONICAL-WORD.json.gz OUT.gcert1w.json.gz REPORT.json --provider NAME [--word BORROW-WORD] + [--diff-1b GCERT1B.json.gz] [--mutants] + lower_w.py --to-1b IN.gcert1w.json.gz OUT.gcert1b.json.gz (permute warp fields, drop the 1w-only keys) +""" +import sys, json, gzip, hashlib, copy, time +from collections import Counter +from fractions import Fraction as Q + + +def need(ok, msg): + if not ok: + raise AssertionError(msg) + + +def read(p): + raw = open(p, 'rb').read() + return json.loads(gzip.decompress(raw) if raw[:2] == b'\x1f\x8b' else raw) + + +def rref(vs): + rows = [] + for x in vs: + for b in rows: + if x >> (b.bit_length() - 1) & 1: + x ^= b + if x: + p = x.bit_length() - 1 + rows = [b ^ x if b >> p & 1 else b for b in rows] + rows.append(x) + rows.sort(reverse=True) + return rows + + +def inside(a, b): + for x in a: + for y in b: + if x >> (y.bit_length() - 1) & 1: + x ^= y + if x: + return False + return True + + +def apply_G(cols, x): + out, i = 0, 0 + while x: + if x & 1: + out ^= cols[i] + x >>= 1 + i += 1 + return out + + +# ------------------------------------------------------------------ the lowering +def lower(c0, provider): + c = copy.deepcopy(c0) + v, R, h = c['v'], c['R'], c['h'] + n = 2 * v + R + zb = list(c['zero_buffers']) + need(zb == sorted(zb) and all(2 * v <= r < n for r in zb), 'zero buffers') + zreg = {s: n + i for i, s in enumerate(zb)} + nZ = len(zb) + + def reg(r): + if isinstance(r, list): + need(r[0] == 'Z' and r[1] in zreg, ('zero buffer', r)) + return zreg[r[1]] + need(0 <= r < n, ('register', r)) + return r + + pre = c['precondition'] + k = 0 + while k < len(pre) and pre[k][0] == 'tadd': + k += 1 + tadds, P = pre[:k], pre[k:] + need(all(e[0] != 'tadd' for e in P), 'twisted add after the precondition proper') + need(all(e[-1] == 0 and all(v <= r < 2 * v for r in ([e[1], e[2]] if e[0] == 'add' else [e[1]])) for e in P), + 'P is not zero-frame y-only') + for part in ('A', 'cut', 'B', 'tail', 'compensation'): + need(all(e[0] != 'tadd' for e in c[part]), 'twisted add outside the precondition') + need(all(not isinstance(x, list) for e in c[part] for x in e[1:3]), 'zero buffer outside the cleanup') + units = [Q(1)] * (n + nZ) + + def emit(e, out): + kind = e[0] + if kind == 'warp': + _, r, op, f0, f1 = e + out.append(['warp', reg(r), op, f0, f1]) + elif kind == 'scale': + _, r, a, b, f = e + r = reg(r) + q = Q(a, b) + need(q != 0, 'zero scale') + out.append(['out', f, r, [], []]) + units[r] *= q + else: + need(kind == 'add', ('gate kind', kind)) + _, t, s, a, b, f = e + t, s = reg(t), reg(s) + need(t != s, 'add onto itself') + q = Q(a, b) * units[s] / units[t] + out.append(['out', f, s, [[t, q.numerator, q.denominator]], []]) + + D0 = [] + for e in tadds: + _, t, s, ops, a, b, f = e + need(f == 0 and v <= t < 2 * v and s >= 2 * v and all(ops), ('twisted add', e)) + for op in reversed(ops): + emit(['warp', s, op, 0, 0], D0) + emit(['add', t, s, a, b, 0], D0) + for op in ops: + emit(['warp', s, -op, 0, 0], D0) + A = [] + for e in P: + emit(e, A) + nP = len(A) + C0 = [] + for e in c['compensation']: + need(e[0] == 'add' and e[-1] == 0, ('compensation gate', e)) + emit(e, C0) + levels = {int(t): f for t, f in c['target_levels'].items()} + lifted = {v + t for t in levels} + yA = Counter() + for e in c['A']: + regs = [e[1]] + ([e[2]] if e[0] == 'add' else []) + ys = [r for r in regs if v <= r < 2 * v] + if ys: + need(e[0] != 'warp' and all(r in lifted for r in ys) and e[-1] in (0, levels[ys[0] - v]), + ('phase A names a y register that is not a lifted target at its level', e)) + yA[e[0]] += 1 + emit(e, A) + ret = [[k_, r, c['center_frames'][k_]] for k_, r in enumerate(c['centers'])] + for _, r, f in ret: + A.append(['out', f, r, [], []]) + cidx = {r: k_ for k_, r, _ in ret} + S = [[Q(0)] * len(ret) for _ in range(v)] + served = Counter() + for e in c['cut']: + _, t, s, a, b, f = e + need(v <= t < 2 * v and s in cidx and f is None, ('cut', e)) + S[t - v][cidx[s]] += Q(a, b) + served[levels.get(t - v, 0)] += 1 + need(set(served) == {0}, ('a centre serves a lifted target', dict(served))) + table = [] + for t, row in enumerate(S): + out = [] + for k_, val in enumerate(row): + val = val * units[ret[k_][1]] / units[v + t] + if val: + out.append([k_, val.numerator, val.denominator]) + table.append(out) + B = [] + for e in c['B']: + emit(e, B) + nB0 = len(B) + for e in c['tail']: + need(all(not v <= r < 2 * v for r in ([e[1], e[2]] if e[0] == 'add' else [e[1]])), 'tail touches a target') + emit(e, B) + for r, f in enumerate(c['final']): + B.append(['out', f, r, [], []]) + bad = [[i, str(u)] for i, u in enumerate(units[v:2 * v], v) if u != 1] + need(not bad, ('nonunit target after B', bad[:5])) + slot_units_after_B = sum(1 for u in units[2 * v:n] if u != 1) + x_units_after_B = sum(1 for u in units[:v] if u != 1) + U = [['zalloc', z] for z in range(n, n + nZ)] + for e in c['cleanup']: + if e[0] == 'warp': + _, r, op, f0, f1 = e + need(f0 == f1 == 1, 'cleanup warp off FULL') + else: + need(e[-1] == 1, ('cleanup gate off FULL', e)) + emit(e, U) + U += [['zfree', z] for z in range(n, n + nZ)] + need(all(u == 1 for u in units[v:2 * v]), 'nonunit target after U') + units_end = [[i, u.numerator, u.denominator] for i, u in enumerate(units[:n]) if u != 1] + z_units = sum(1 for u in units[n:] if u != 1) # irrelevant: a zero buffer is 0 at zfree in either scale + fr = c['frames'] + dim = [len(f) for f in fr] + E = [r for r in range(2 * v, n) if c['final'][r] != 1] + need(E == zb, 'exits are not the zero-buffer slots') + ext = [[r, f] for r, f in enumerate(c['start']) if r >= 2 * v and f] + residuals = [dim[c['final'][r]] - dim[c['start'][r]] for r in range(2 * v, n)] + cert = dict(format='gcert/1w', provider=provider, h=h, v=v, R=R, nZ=nZ, copies=0, ports=c['ports'], frames=fr, + start=c['start'], final=c['final'], ext=ext, exits=E, residuals=residuals, + levels={str(t): f for t, f in sorted(levels.items())}, nP=nP, A=A, ret=ret, scat={'table': table}, B=B, + D0=D0, C0=C0, U=U, order=['D0', 'A[:nP]', 'C0', 'A[nP:]', 'scat', 'B', 'U'], + tadd=[[e[1], e[2], list(e[3]), e[4], e[5]] for e in tadds], + zero_buffers=[[zreg[s], s] for s in zb], + warps=[dict(op=w['op'], G_columns=w['G_columns'], from_frame=w['from_frame'], to_frame=w['to_frame'], + lender=w['lender'], B_pos=w['B_pos']) for w in c['warps']], + helper_origin=c['helper_origin'], removed=c['removed'], borrow=c['borrow'], + units_end=units_end, + hub_local_profile={str(k_): x for k_, x in sorted((int(a), b) for a, b in c['local_profile'].items())}) + info = dict(nA=len(A), nP=nP, nB_without_tail=nB0, tail=len(c['tail']), nB=len(B), nD0=len(D0), nC0=len(C0), + nU=len(U), phase_A_y_gates=dict(yA), slot_units_not_one_after_B=slot_units_after_B, + x_units_not_one_after_B=x_units_after_B, + units_end_not_one=dict(x=sum(1 for r, _, _ in units_end if r < v), slots=sum(1 for r, _, _ in units_end if r >= 2 * v), + exits=sum(1 for r, _, _ in units_end if r in set(E)), zero_buffers=z_units)) + return cert, info + + +# ------------------------------------------------------------------ checks on a gcert/1w file +def regs_of(g): + if g[0] == 'warp': + return [g[1]] + if g[0] == 'out': + return [g[2]] + [t for t, _, _ in g[3]] + list(g[4]) + if g[0] == 'in': + return [g[2]] + [s for s, _, _ in g[3]] + if g[0] == 'neg': + return [g[2]] + if g[0] in ('zalloc', 'zfree'): + return [g[1]] + raise AssertionError(('gate kind', g[0])) + + +def check_frames(c, table=True): + """frame chains of the whole program (section 5.1 of FORMAT.md) and the price data of the main phase""" + v, R, h, nZ = c['v'], c['R'], c['h'], c['nZ'] + n = 2 * v + R + fr = [tuple(f) for f in c['frames']] + dim = [len(f) for f in fr] + need(fr[0] == () and fr[1] == tuple(1 << i for i in range(h - 1, -1, -1)), 'frames 0 and 1') + need(all(list(f) == rref(list(f)) for f in fr) and len(set(fr)) == len(fr), 'frame table not reduced echelon') + W = {} + for i, w in enumerate(c['warps']): + need(w['op'] == i + 1 and len(rref(w['G_columns'])) == h, ('warp table row', i)) + W[w['op']] = w['G_columns'] + a, b = fr[w['from_frame']], fr[w['to_frame']] + need(not table or tuple(rref([apply_G(w['G_columns'], x) for x in a])) == b, ('table: G does not carry from -> to', w['op'])) + levels = {int(t): f for t, f in c['levels'].items()} + cls = lambda r: 'x' if r < v else 'y' if r < 2 * v else 's' + cur = list(c['start']) + H = {k: Counter() for k in 'xysc'} + steps, wsteps = set(), set() + exts = {r for r, _ in c['ext']} | set(c['exits']) + + def climb(r, f, where): + o = cur[r] + if o != f: + if (o, f) not in steps: + need(dim[o] < dim[f] and inside(fr[o], fr[f]), ('climb not nested', where, r, o, f)) + steps.add((o, f)) + H[cls(r)][dim[f] - dim[o]] += 1 + cur[r] = f + + def warp(g, where): + _, r, op, f0, f1 = g + need(abs(op) in W, ('unknown warp op', where)) + if r >= n: + need(f0 == f1 == 1, ('zero-buffer warp off FULL', where)) + return + need(cur[r] == f0, ('warp frame mismatch', where, g, cur[r])) + if (op, f0, f1) not in wsteps: + a, b = (f0, f1) if op > 0 else (f1, f0) + need(dim[a] == dim[b] and tuple(rref([apply_G(W[abs(op)], x) for x in fr[a]])) == fr[b], + ('warp G does not carry the frame', where, g)) + wsteps.add((op, f0, f1)) + cur[r] = f1 + + def zero_phase(gates, name): + for i, g in enumerate(gates): + if g[0] == 'warp': + need(g[3] == g[4] == 0 and g[1] < n, (name, 'warp not at frame 0', i)) + warp(g, (name, i)) + continue + need(g[0] == 'out' and g[1] == 0, (name, 'gate not at frame 0', i)) + rr = regs_of(g) + need(all(r < n and cur[r] == 0 and r not in exts for r in rr), (name, 'register off frame 0', i)) + zero_phase(c['D0'], 'D0') + nP = c['nP'] + for i, g in enumerate(c['A'][:nP]): + need(g[0] == 'out' and g[1] == 0 and all(v <= r < 2 * v for r in regs_of(g)), ('P', i)) + zero_phase(c['C0'], 'C0') + for i, g in enumerate(c['A']): + rr = regs_of(g) + need(all(0 <= r < n for r in rr) and len(set(rr)) == len(rr), ('A registers', i)) + if g[0] == 'warp': + need(not v <= g[1] < 2 * v, ('A: warp on y', i)) + warp(g, ('A', i)) + continue + for r in rr: + if v <= r < 2 * v and i >= nP: + need(r - v in levels and g[1] in (0, levels[r - v]), ('A: y named off its level', i)) + climb(r, g[1], ('A', i)) + for k, s, f in c['ret']: + need(cls(s) != 'y' and cur[s] == f, 'retained total not at its frame') + H['c'][dim[f]] += 1 + need(all(cur[v + t] == levels.get(t, 0) for t in range(v)), 'a y role is not at its level at the scatter') + for i, g in enumerate(c['B']): + rr = regs_of(g) + need(all(0 <= r < n for r in rr) and len(set(rr)) == len(rr), ('B registers', i)) + if g[0] == 'warp': + warp(g, ('B', i)) + else: + for r in rr: + climb(r, g[1], ('B', i)) + need(cur == c['final'], 'B does not end at the final frames') + live = set() + for i, g in enumerate(c['U']): + if g[0] == 'zalloc': + need(n <= g[1] < n + nZ and g[1] not in live, ('U zalloc', i)); live.add(g[1]); continue + if g[0] == 'zfree': + need(g[1] in live, ('U zfree', i)); live.discard(g[1]); continue + if g[0] == 'warp': + need(g[3] == g[4] == 1 and (g[1] in live or (g[1] < n and cur[g[1]] == 1)), ('U warp', i)) + warp(g, ('U', i)) + continue + need(g[0] == 'out' and g[1] == 1, ('U gate off FULL', i)) + for r in regs_of(g): + need(r in live if r >= n else cur[r] == 1, ('U register not FULL / not a live zero buffer', i, r)) + need(not live, 'zero buffer not freed') + blocks = {k: {str(r): x for r, x in sorted(w.items())} for k, w in H.items()} + tot = Counter() + for w in H.values(): + tot.update(w) + N = sum(r * x for r, x in tot.items()) + cst = sum(dim[f] for _, _, f in c['ret']) + lhs = N + sum(dim[f] for _, f in c['ext']) + rhs = sum(dim[c['final'][r]] for r in range(2 * v, n)) + sum(dim[c['final'][r]] - dim[c['start'][r]] for r in range(v)) \ + + sum(dim[c['final'][v + t]] for t in range(v)) + cst + need(lhs == rhs, ('invoice identity', lhs, rhs)) + return dict(blocks=blocks, hist={str(r): x for r, x in sorted(tot.items())}, N=N, cst=cst, invoice=[lhs, rhs], + frame_steps=len(steps), warp_steps=len(wsteps), max_block_rank=max(tot)) + + +def warp_row(row, op): + out = {} + for (col, word), val in row.items(): + out[col, word[1:] if word and word[0] == -op else (op,) + word] = val + return out + + +def axpy(d, src, q): + for key, u in src.items(): + w = d.get(key, 0) + q * u + if w: + d[key] = w + else: + d.pop(key, None) + + +def run(reg, gates, zcheck=None): + for i, g in enumerate(gates): + k = g[0] + if k == 'warp': + reg[g[1]] = warp_row(reg[g[1]], g[2]) + elif k == 'out': + src = dict(reg[g[2]]) + for t, a, b in g[3]: + axpy(reg[t], src, Q(a, b)) + elif k == 'in': + for s, a, b in g[3]: + axpy(reg[g[2]], reg[s], Q(a, b)) + elif k == 'neg': + reg[g[2]] = {key: -u for key, u in reg[g[2]].items()} + elif k == 'zalloc': + reg[g[1]] = {} + elif k == 'zfree': + need(not reg[g[1]], ('zero buffer not zero at zfree', g[1], i)) + reg[g[1]] = None + else: + raise AssertionError(k) + + +def full_replay(c): + """section 5.3 of FORMAT.md: the whole program in hub order on every input column (free warp algebra)""" + v, R, nZ = c['v'], c['R'], c['nZ'] + n = 2 * v + R + reg = [{(r, ()): Q(1)} for r in range(n)] + [None] * nZ + nP = c['nP'] + run(reg, c['D0']) + run(reg, c['A'][:nP]) + run(reg, c['C0']) + run(reg, c['A'][nP:]) + tot = {k: dict(reg[s]) for k, s, _ in c['ret']} + for t in range(v): + for k, a, b in c['scat']['table'][t]: + axpy(reg[v + t], tot[k], Q(a, b)) + run(reg, c['B']) + run(reg, c['U']) + bad = [] + ue = {r: Q(a, b) for r, a, b in c['units_end']} + for r in range(n): + want = {(r, ()): 1 / ue.get(r, Q(1))} + if v <= r < 2 * v: + want[(r - v, ())] = Q(1) + if reg[r] != want: + bad.append(r) + need(not bad, ('hub endpoint fails on rows', bad[:10])) + need(all(z is None for z in reg[n:]), 'zero buffer not freed') + return dict(endpoint='exact on all %d columns: identity, y_t += x_t, %d zero buffers 0 at zfree' % (n, nZ)) + + +def main_phase_words(c): + """the clean main phase (A, scatter, B) on every input column: warp-worded entries left in x / y rows""" + v, R = c['v'], c['R'] + n = 2 * v + R + reg = [{(r, ()): Q(1)} for r in range(n)] + run(reg, c['A']) + tot = {k: dict(reg[s]) for k, s, _ in c['ret']} + for t in range(v): + for k, a, b in c['scat']['table'][t]: + axpy(reg[v + t], tot[k], Q(a, b)) + run(reg, c['B']) + hid = all({(j, w): u for (j, w), u in reg[v + t].items() if j < v} == {(t, ()): 1} for t in range(v)) + return dict(x_row_entries_with_words=sum(1 for t in range(v) for (_, w) in reg[t] if w), + y_row_entries_with_words=sum(1 for t in range(v) for (_, w) in reg[v + t] if w), + hid_y_from_x_identity=hid) + + +# ------------------------------------------------------------------ gcert/1b view and diff +def to_1b(c): + d = {k: copy.deepcopy(c[k]) for k in ('h', 'v', 'R', 'ports', 'frames', 'start', 'final', 'ext', 'ret', 'scat', + 'exits', 'levels', 'nP', 'helper_origin', 'borrow', 'copies', 'residuals')} + conv = lambda g: ['warp', g[4], g[1], g[2], g[3]] if g[0] == 'warp' else g + d['A'] = [conv(g) for g in c['A']] + d['B'] = [conv(g) for g in c['B']] + d['warps'] = [dict(op=w['op'], G_columns=w['G_columns'], from_frame=w['from_frame'], to_frame=w['to_frame']) + for w in c['warps']] + d['format'] = 'gcert/1b' + return d + + +def diff(a, b): + out = {} + for k in sorted(set(a) | set(b)): + if k not in a or k not in b: + out[k] = 'only in ' + ('ours' if k in a else 'theirs') + elif a[k] != b[k]: + if isinstance(a[k], list) and isinstance(b[k], list): + idx = [i for i in range(min(len(a[k]), len(b[k]))) if a[k][i] != b[k][i]] + out[k] = dict(len=[len(a[k]), len(b[k])], first_diffs=[[i, a[k][i], b[k][i]] for i in idx[:3]], ndiff=len(idx)) + else: + out[k] = 'differs' + return out + + +# ------------------------------------------------------------------ mutants +def mutants(c): + res = {} + + def expect_fail(name, mut, fn): + d = copy.deepcopy(c) + mut(d) + try: + fn(d) + except AssertionError as e: + res[name] = 'rejected: ' + str(e)[:160] + return + raise SystemExit('MUTANT ACCEPTED: ' + name) + + # (1) a wrong G column: take the first B warp; change one column so G stays invertible but no longer carries the frame + wi = next(i for i, g in enumerate(c['B']) if g[0] == 'warp') + op = abs(c['B'][wi][2]) + w = c['warps'][op - 1] + fr = c['frames'] + cols = w['G_columns'] + choice = None + for j in range(9): + for x in range(1, 512): + G2 = list(cols) + G2[j] = x + if len(rref(G2)) == 9 and rref([apply_G(G2, u) for u in fr[w['from_frame']]]) != fr[w['to_frame']]: + choice = (j, x) + break + if choice: + break + j, x = choice + + def m1(d): + d['warps'][op - 1]['G_columns'][j] = x + expect_fail('wrong G column (warp %d, column %d := %d, still invertible)' % (op, j, x), m1, check_frames) + + expect_fail('wrong G column, warp-table check skipped (the gate-level frame check alone)', m1, + lambda d: check_frames(d, table=False)) + # (2) a warp gate with a wrong end frame + def m2(d): + g = d['B'][wi] + g[4] = next(f for f in range(2, len(fr)) if f != g[4] and len(fr[f]) == len(fr[g[4]])) + expect_fail('B warp with a wrong end frame', m2, check_frames) + # (3) a dropped unwarp in U: the scalar endpoint must fail + ui = next(i for i, g in enumerate(c['U']) if g[0] == 'warp') + expect_fail('U unwarp dropped', lambda d: d['U'].pop(ui), full_replay) + # (4) a twisted-add coefficient doubled + di = next(i for i, g in enumerate(c['D0']) if g[0] == 'out') + expect_fail('D0 twisted-add coefficient doubled', lambda d: d['D0'][di][3][0].__setitem__(1, 2 * d['D0'][di][3][0][1]), full_replay) + # (5) a zero buffer left dirty: drop the last gate of U that writes a zero buffer + n = 2 * c['v'] + c['R'] + zi = max(i for i, g in enumerate(c['U']) if g[0] == 'out' and any(t >= n for t, _, _ in g[3])) + expect_fail('U: last write to a zero buffer dropped', lambda d: d['U'].pop(zi), full_replay) + # (6) a twisted add with its warp sign flipped (unwarp before warp) + wi0 = next(i for i, g in enumerate(c['D0']) if g[0] == 'warp') + expect_fail('D0 warp sign flipped', lambda d: d['D0'][wi0].__setitem__(2, -d['D0'][wi0][2]), full_replay) + return res + + +def width_inventory(word, origin): + full = [1 << i for i in range(9)] + w = [len(rref(word['helper_final'].get(str(r), full))) - len(rref(word['start_extra'].get(str(r), []))) for r in origin] + return w + + +def main(a): + if a[0] == '--to-1b': + c = read(a[1]) + payload = json.dumps(to_1b(c), sort_keys=True, separators=(',', ':')).encode() + open(a[2], 'wb').write(gzip.compress(payload, mtime=0)) + print(hashlib.sha256(payload).hexdigest()) + return + t0 = time.monotonic() + wp, outp, repp = a[0], a[1], a[2] + opt = lambda k: a[a.index(k) + 1] if k in a else None + raw = open(wp, 'rb').read() + c0 = read(wp) + rep = dict(canonical=wp, canonical_file_sha256=hashlib.sha256(raw).hexdigest(), + canonical_content_sha256=hashlib.sha256(json.dumps(c0, sort_keys=True, separators=(',', ':')).encode()).hexdigest()) + cert, info = lower(c0, opt('--provider')) + rep['lowering'] = info + chk = check_frames(cert) + cert['N'], cert['cst'], cert['blocks'] = chk['N'], chk['cst'], chk['blocks'] + chk['hist_equals_hub_local_profile'] = chk['hist'] == cert['hub_local_profile'] + need(chk['hist_equals_hub_local_profile'], ('histogram differs from the hub profile', chk['hist'], cert['hub_local_profile'])) + rep['frames_and_price'] = chk + rep['full_replay'] = full_replay(cert) + rep['main_phase_words'] = main_phase_words(cert) + cnt = lambda gs: sum(g[0] == 'warp' for g in gs) + rep['counts'] = dict(R=cert['R'], nZ=cert['nZ'], exits=len(cert['exits']), ext=len(cert['ext']), tadds=len(cert['tadd']), + warp_events=dict(A=cnt(cert['A']), B=cnt(cert['B']), U=cnt(cert['U']), D0=cnt(cert['D0']), + main_and_cleanup=cnt(cert['A']) + cnt(cert['B']) + cnt(cert['U'])), + zero_buffer_incidences=sum(1 for g in cert['U'] if g[0] == 'out' for r in regs_of(g) if r >= 2 * cert['v'] + cert['R']), + residuals_hist={str(k): x for k, x in sorted(Counter(cert['residuals']).items())}) + if opt('--word'): + word = read(opt('--word')) + hw = width_inventory(word, cert['helper_origin']) + rep['width_inventory'] = dict(word=opt('--word'), word_file_sha256=hashlib.sha256(open(opt('--word'), 'rb').read()).hexdigest(), + hist={str(k): x for k, x in sorted(Counter(hw).items())}, + equals_residuals_per_helper=hw == cert['residuals']) + need(hw == cert['residuals'], 'residuals differ from the hub widths') + if '--mutants' in a: + rep['mutants'] = mutants(cert) + payload = json.dumps(cert, sort_keys=True, separators=(',', ':')).encode() + open(outp, 'wb').write(gzip.compress(payload, mtime=0)) + rep['out'] = outp + rep['out_file_sha256'] = hashlib.sha256(open(outp, 'rb').read()).hexdigest() + rep['out_content_sha256'] = hashlib.sha256(payload).hexdigest() + if opt('--diff-1b'): + theirs = read(opt('--diff-1b')) + mine = to_1b(cert) + dd = diff(mine, theirs) + rep['diff_vs_g_heads'] = dict(file=opt('--diff-1b'), equal=not dd, differences=dd, + our_1b_content_sha256=hashlib.sha256(json.dumps(mine, sort_keys=True, separators=(',', ':')).encode()).hexdigest(), + their_content_sha256=hashlib.sha256(json.dumps(theirs, sort_keys=True, separators=(',', ':')).encode()).hexdigest()) + rep['seconds'] = round(time.monotonic() - t0, 2) + json.dump(rep, open(repp, 'w'), indent=1) + print(json.dumps({k: x for k, x in rep.items() if k != 'mutants'}, indent=1)) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/research/lever-mixed-targets-2979/tools/mixed.py b/research/lever-mixed-targets-2979/tools/mixed.py new file mode 100644 index 000000000..c22ba942a --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/mixed.py @@ -0,0 +1,24 @@ +# lever-reprice: mixed-target moment root, the same formula as rl-plan/tools/rescue.py (b = 1 - tau, tau the root of +# sum_children n_r r^tau = sum_arrays k_w^tau), with W and targets passed in. Pure-target {73: W} is the hub's root. +from decimal import Decimal as D, getcontext +getcontext().prec = 60 +_ln = {} +def _l(x): + if x not in _ln: _ln[x] = D(x).ln() + return _ln[x] +def root(children, targets, lo=D('0.97'), hi=D(1), iters=200): + ch = [(D(n), _l(r)) for r, n in children.items() if n] + tg = [(D(n), _l(k)) for k, n in targets.items() if n] + for _ in range(iters): + x = (lo + hi) / 2 + lhs = sum(n * (l * x).exp() for n, l in ch) + rhs = sum(n * (l * x).exp() for n, l in tg) + if lhs > rhs: lo = x + else: hi = x + return 1 - (lo + hi) / 2 +def add(d, r, n): + d = dict(d) + if n: d[r] = d.get(r, 0) + n + return d +def sep(children, targets): + return max(r for r, n in children.items() if n) < min(k for k, n in targets.items() if n) diff --git a/research/lever-mixed-targets-2979/tools/price_ours.py b/research/lever-mixed-targets-2979/tools/price_ours.py new file mode 100644 index 000000000..6e91b5d81 --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/price_ours.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +"""g-heads: price from OUR lowering's G0 output (tools/g0_staged.py JSON): (1) b of OUR global profile by the hub's +moment engine (m-anatomy's exact re-implementation, 1e-24 grid) and by the mixed-target Decimal root, compared with the +hub's stated root digit for digit; (2) the lever (half cut, target 49) with OUR literal head count, through +lever-reprice's variants() (same formula as rl-plan's rescue.py; its T74 controls reproduce rl-plan). +usage: price_ours.py G0.json STATED_ROOT_LOWER [STATED_ROOT_UPPER]""" +import sys, json +import os +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from pricer import price_b, dec +from mixed import root, D +import io, contextlib +with contextlib.redirect_stdout(io.StringIO()): + from lever_price import variants # (its module body prints the controls; silenced here, run separately) +g = json.load(open(sys.argv[1])) +lo = sys.argv[2]; hi = sys.argv[3] if len(sys.argv) > 3 else None +prof = {int(k): v for k, v in g['call_blocks']['global_profile'].items()} +T = g['fill']['replicas']; W = 896 * T +b_eng = dec(price_b(prof, 73, W), 25) +b_mix = root(prof, {73: W}) +heads = g['G0']['heads_rank48_unhosted'] +non = prof[48] - heads +out = dict(label=g['label'], W=W, profile=prof, profile_equals_hub=g['call_blocks']['global_profile_equals_hub'], + b_hub_engine=str(b_eng), b_mixed_root='%.24e' % b_mix, stated_root=[lo, hi], + b_reproduces_stated_lower_digit_for_digit=D(str(b_eng)) == D(lo), + heads=heads, other_rank48=non) +with contextlib.redirect_stdout(io.StringIO()): + v = variants(g['label'], prof, W, heads, non, quiet=True) +hub = v['uniform']['b'] +for k in ('uniform', 'half_cut', 'full_cut'): + out[k] = dict(b='%.10e' % v[k]['b'], over_uniform_pct='%+.3f' % (float((v[k]['b'] - hub) / hub) * 100), separated=v[k]['separated']) +out['breakeven_full_cut_heads'] = v['breakeven_full'] +out['half_cut_breakeven_heads'] = 1 if heads >= 1 else None +print(json.dumps(out, indent=1)) diff --git a/research/lever-mixed-targets-2979/tools/pricer.py b/research/lever-mixed-targets-2979/tools/pricer.py new file mode 100644 index 000000000..6cdb47387 --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/pricer.py @@ -0,0 +1,202 @@ +#!/usr/bin/env python3 +"""m-anatomy pricer: exact re-implementation of the hub's complex-side moment price and kappa assembly. + +Re-implements (does not import) CrocSwap/integer-mult-bounds + research/native-complex-moment552/engines/moment.py (moment, certify; Mercator logs 224 terms, 24-term exp, 224-bit dyadic outward rounding) + research/native-complex-moment552/engines/outer.py (47 strict constraints, 7 margins) + research/gauge44-frames-x/code/assemble.py (outer_witness: s=min(c,(1-beta)b)-1e-27, 7-step bootstrap chain from 384599e-10, + kappa = floor-strict((1-eta) q/(1+q)) on the 1e-18 grid, q = chain[-1](1-2eta)) +b = largest b on the 10^-24 grid with sum_r (r n_r)/(m W) (m/r)^b < 1 (certified by exact rational enclosures at b and b+1e-24) +kappa = assembly(b, c) where c is the bit-side saving (default: PR589's 1733427039589844234749/10^24). + +Usage: + python3 -I pricer.py # #799 control (profile, m=73, W=7168, deficit 2560) + python3 -I pricer.py --profile '{"1":183457,...}' --m 73 --W 7168 [--deficit 2560] [--c 0.0017334...] [--bad] + python3 -I pricer.py --json FILE # FILE has keys profile, m, W, optional deficit, c + python3 -I pricer.py --local-delta '{"1":8,"2":-4,"3":4,"4":-4}' # a per-call change of #799's local word (x72 calls); + the change in residual width (= change in local rank mass, since copies and data climbs are fixed) is moved to or from + the idle remainder at rank 48 (1.5 rank-48 children per width unit per call; a 24 left over is paid as one rank-24 child). + This decomposition (72 x local {1:2548,2:338,3:430,4:194,5:56,8:8} + idle {1:1,3:1,44:1,48:2396}) reproduces #799 and, + with #685's promoted local word {1:2572,2:326,...}, #685's kappa 0.001660339298410333 exactly (check_models.py). + add --fast to skip the exact rational certification (Decimal bisection only; same 24-digit b in practice) + add --nokappa to print b only +As a module: from pricer import price_b, kappa_from, b_fast, CONTROL +""" +import argparse, json, sys +from decimal import Decimal, localcontext, ROUND_FLOOR +from fractions import Fraction as F +from functools import lru_cache + +DYAD = 1 << 224 +def _floor(x): return F(x.numerator*DYAD//x.denominator, DYAD) +def _ceil(x): return -_floor(-x) + +@lru_cache(None) +def log_bounds(x): + """Exact rational enclosure of ln(x), x >= 1 (Mercator series, binary reduction; same scheme as the hub engine).""" + x = F(x); assert x >= 1 + k = 0 + while x >= 2: x /= 2; k += 1 + j = int(x >= F(3, 2)) + if j: x /= F(3, 2) + def mercator(y): + z = y-1; assert 0 <= z <= F(1, 2) + t = z; s = F(0) + for n in range(1, 225): + s += (t if n & 1 else -t)/n + t *= z + return s, s+t/225 + a, b = mercator(x); c, d = mercator(F(3, 2)); e, f = mercator(F(4, 3)) + return _floor(a+(k+j)*c+k*e), _ceil(b+(k+j)*d+k*f) + +def exp_bounds(l, u): + assert 0 <= l <= u < F(1, 10) + def poly(x): + s = t = F(1) + for j in range(1, 25): t = t*x/j; s += t + return s, t + lo, _ = poly(l); hi, last = poly(u) + return _floor(lo), _ceil(hi+last*u/25/(1-u/26)) + +def moment(H, m, W, a, bad=False): + """Exact rational enclosure [lo, hi] of sum_r (r n_r)/(m W) (m/r)^a (+ the inherited bad-residue surcharge if bad).""" + lo = hi = F(0) + for r, n in H.items(): + assert 0 < r < m and n > 0 + l, u = log_bounds(F(m, r)); e, f = exp_bounds(a*l, a*u) + p = F(r*n, m*W); lo += p*e; hi += p*f + if bad: + l, u = log_bounds(F(m)); e, f = exp_bounds(a*l, a*u) + p = F(32*m*sum(H.values()), 10**16*W); lo += p*e; hi += p*f + return _floor(lo), _ceil(hi) + +def b_fast(H, m, W, bad=False, prec=70, iters=210, top='.003'): + """Decimal bisection; returns the 24-digit grid candidate as Fraction (what the hub's certify proposes). + The hub brackets b in [0, 0.003]; price_b retries with a wider bracket [0, 0.02] if the root is above 0.003.""" + with localcontext() as c: + c.prec = prec + terms = [(Decimal(r*n)/Decimal(m*W), (Decimal(m)/Decimal(r)).ln()) for r, n in H.items()] + fb = Decimal(32*m*sum(H.values()))/Decimal(10**16*W) if bad else Decimal(0) + lm = Decimal(m).ln(); lo = Decimal(0); hi = Decimal(top) + for _ in range(iters): + a = (lo+hi)/2 + if sum(p*(a*l).exp() for p, l in terms)+fb*(a*lm).exp() < 1: lo = a + else: hi = a + q = int(((lo+hi)/2*10**24).to_integral_value(rounding=ROUND_FLOOR)) + return F(q, 10**24) + +def b_float(H, m, W): + """Unrounded b as Decimal (prec 60), for exchange rates finer than the 1e-24 grid.""" + with localcontext() as c: + c.prec = 60 + terms = [(Decimal(r*n)/Decimal(m*W), (Decimal(m)/Decimal(r)).ln()) for r, n in H.items()] + lo = Decimal(0); hi = Decimal('.01') + for _ in range(200): + a = (lo+hi)/2 + if sum(p*(a*l).exp() for p, l in terms) < 1: lo = a + else: hi = a + return (lo+hi)/2 + +def price_b(H, m, W, bad=False, certify=True): + H = {int(r): int(n) for r, n in H.items() if int(n)} + assert m*m > 2*max(H)**2, 'halving constraint m^2 > 2 max(r)^2 fails' + b = b_fast(H, m, W, bad) + if b >= F(2999999, 10**9): b = b_fast(H, m, W, bad, iters=240, top='.02') + if certify: + lv = moment(H, m, W, b, bad); hv = moment(H, m, W, b+F(1, 10**24), bad) + assert lv[1] < 1 < hv[0], ('not certified', b, lv, hv) + return b + +# ---- outer assembly (re-implementation of engines/outer.py and assemble.py:outer_witness) ---- +def outer_ok(a, b, kappa, eta, beta, degree_gap=F(10**6)-F(51*20161, 25), lit_gap=1): + tau, sigma = 1-a, 1-b + q = a*(1-2*eta); lp = 1-q; lam = (tau+lp)/2 + c = q+eta/4; eps = (1-eta)/(1+q) + minimum = eps*q; r = (minimum+1-eps)/2; delta = eta/8 + internal = tau+(1-beta)*max(sigma-tau, F(0)); leaf = sigma+beta*(1-sigma) + margins = dict(balanced_prefix=1-eps, coordinate_movement=a, compact_phase_layer=minimum, bulk_exposure=a, + Gaussian_arithmetic=min(1-eps-delta, r-delta), scalar_work=1-eps-delta, dimension=eps) + slacks = dict(bit_positive=a, complex_above_bit=b-a, complex_below_one_over32=F(1, 32)-b, beta_positive=beta, + beta_below_one=1-beta, leaf_saving_above_bit=(1-beta)*b-a, q_positive=q, q_below_internal=1-internal-q, + q_below_leaf=1-leaf-q, c_positive=c, c_below_one=1-c, q_below_reservations=c-q, lambda_above_tau=lam-tau, + lambda_above_sigma=lam-sigma, lambda_above_internal=lam-internal, lambda_prime_above_lambda=lp-lam, + compact_leaf=lp-leaf, compact_reservations=lp-(1-c), lambda_prime_below_one=q, epsilon_positive=eps, + epsilon_below_one=1-eps, guard_width=1-eps, K_geometry=1-eps*(1+c), K_dominates_log=eps*c, record_suffix=1-eps, + phase_local=1-eps-delta, phase_boundary=r-delta, gamma_sublinear=1-eps-r, cell_above_band=eps-(1-r)/2, + prime_interval_packing=1-eps, alpha_positive=r, alpha_below_one=1-r, alpha_below_one_fourth=F(1, 4)-r, + delta_positive=delta, delta_below_one_eighth=F(1, 8)-delta, short_record_fallback=eps-a, + small_field_exposure=1-eps-minimum, artificial_boundary=8-eps+r-delta-minimum, literal_scalar_guard=F(lit_gap), + row_product_gap=degree_gap) + slacks.update({k+'_above_kappa': v-kappa for k, v in margins.items()}) + assert len(slacks) == 47 + bad = [k for k, v in slacks.items() if v <= 0] + return not bad, bad + +def kappa_from(b, c, eta=F(1, 10**24), beta=F(1, 10**24), check=True): + """kappa from complex side b and bit side c, exactly as assemble.py:outer_witness.""" + s = min(c, (1-beta)*b)-F(1, 10**27); assert 0 < s < c and s < (1-beta)*b + chain = [F(384599, 10**10)] + for _ in range(7): + old = chain[-1]; a = (1-s)*s+s*old + assert old < a < s < 1-a + chain.append(a) + q = chain[-1]*(1-2*eta); margin = (1-eta)*q/(1+q); ticks = margin*10**18 + k = F((ticks.numerator-1)//ticks.denominator, 10**18) + if check: + ok, bad = outer_ok(chain[-1], b, k, eta, beta); assert ok, bad + ok2, _ = outer_ok(chain[-1], b, k+F(1, 10**18), eta, beta); assert not ok2, 'next grid point should fail' + return k, s, chain[-1] + +C_PR589 = F(1733427039589844234749, 10**24) +CONTROL = dict(profile={1: 183457, 2: 24336, 3: 30961, 4: 13968, 5: 4032, 8: 576, 44: 1, 48: 2396}, m=73, W=7168, deficit=2560) +B799 = F(1664400278850482327913, 10**24); K799 = F(1661634653669567, 10**18) + +def dec(x, p=40): + with localcontext() as c: + c.prec = p; return str(Decimal(x.numerator)/Decimal(x.denominator)) + +def main(): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument('--json'); ap.add_argument('--profile'); ap.add_argument('--m', type=int); ap.add_argument('--W', type=int) + ap.add_argument('--deficit', type=int); ap.add_argument('--c', help='bit-side saving (decimal or p/q); default PR589') + ap.add_argument('--bad', action='store_true', help='include the inherited bad-residue surcharge (conservative model)') + ap.add_argument('--local-delta', help='per-call change of #799 local paid profile, JSON {rank: count}') + ap.add_argument('--fast', action='store_true'); ap.add_argument('--nokappa', action='store_true') + a = ap.parse_args() + d = dict(CONTROL) + if a.json: d.update(json.load(open(a.json))) + if a.profile: d['profile'] = json.loads(a.profile) + if a.local_delta: + LOC = {1: 2548, 2: 338, 3: 430, 4: 194, 5: 56, 8: 8}; IDLE = {1: 1, 3: 1, 44: 1, 48: 2396} + dl = {int(r): int(n) for r, n in json.loads(a.local_delta).items()} + G = {} + for r in set(LOC) | set(dl): G[r] = 72*(LOC.get(r, 0)+dl.get(r, 0)) + dw = sum(r*n for r, n in dl.items()) # width change per call + moved = -72*dw # idle mass returning to (or taken from) the paid remainder + q, rem = divmod(moved, 48) + for r, n in IDLE.items(): G[r] = G.get(r, 0)+n + G[48] += q + if rem: G[rem] = G.get(rem, 0)+1 + assert all(n >= 0 for n in G.values()), G + d['profile'] = {r: n for r, n in G.items() if n} + if a.m: d['m'] = a.m + if a.W: d['W'] = a.W + if a.deficit is not None: d['deficit'] = a.deficit + elif a.profile or a.m or a.W: d.pop('deficit', None) + H = {int(r): int(n) for r, n in d['profile'].items() if int(n)}; m, W = int(d['m']), int(d['W']) + mass = sum(r*n for r, n in H.items()); D = m*W-mass + if d.get('deficit') is not None: assert D == int(d['deficit']), f'deficit mismatch: m*W-mass = {D}, given {d["deficit"]}' + c = F(a.c) if a.c else (F(d['c']) if 'c' in d else C_PR589) + b = price_b(H, m, W, a.bad, certify=not a.fast) + out = dict(profile=dict(sorted(H.items())), m=m, W=W, rank_mass=mass, deficit=D, calls=sum(H.values()), maxrank=max(H), + b=f'{b.numerator}/{b.denominator}', b_decimal=dec(b), certified=not a.fast, surcharge=a.bad) + if not a.nokappa: + k, s, chain = kappa_from(b, c) + out.update(c=dec(c), binding='complex' if b*(1-F(1, 10**24)) < c else 'bit', kappa=f'{k.numerator}/{k.denominator}', kappa_decimal=dec(k, 20)) + if H == CONTROL['profile'] and m == 73 and W == 7168 and not a.bad and not a.c: + out['control_b_matches_799'] = (b == B799) + if not a.nokappa: out['control_kappa_matches_799'] = (k == K799) + print(json.dumps(out, indent=1)) + +if __name__ == '__main__': + main() diff --git a/research/lever-mixed-targets-2979/tools/rate_cert.py b/research/lever-mixed-targets-2979/tools/rate_cert.py new file mode 100644 index 000000000..63dc93cb0 --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/rate_cert.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python3 +"""Exact rational certificate of the mixed-target rate inequality (Theorem 1G of PROOF.md), and its refusal one grid +step higher. Standard library only (fractions, decimal). + +The inequality, for a word whose paid blocks of one unit have the profile {r: n_r} (children), with W arrays per +unit of which H take the cut job kc and the other W - H the full job m: + + sum_r n_r (r/m)^z <= (W - H) + H (kc/m)^z (R) + +At the DFT figure N/10^10 the Lean rate fact is stated at the slightly smaller exponent +z1 = 1 - (100 N + 2)/10^12 (two hundredths of a grid step stronger); this program checks (R) at z1 with exact +rational enclosures (upper bounds for every child term, a lower bound for the cut-target term), and checks that +(R) is FALSE at the grid exponent 1 - (N + 1)/10^10 (lower bounds for the children, an upper bound for the cut +target). Both enclosures are the ones the Lean module uses: + * exp(x) <= 1 + x + x^2/2 + x^3/6 + (5/96) x^4 for 0 <= x <= 1, and exp(x) >= 1 + x + x^2/2 + x^3/6 for x >= 0; + * rational bounds L of log(m/r), certified by a truncated exponential series: an upper L when + sum_{k= m/r, a lower L when an upper bound of exp(L/2^s) raised to 2^s is <= m/r. +The decimal root (60 digits) is printed for orientation only; the verdict rests on Fractions. + +usage: + rate_cert.py PROFILE.json N exit 0 iff (R) holds at z1(N) AND fails at 1 - (N+1)/10^10 + rate_cert.py PROFILE.json --scan the largest N whose (R) the enclosure proves, and the refusal of N + 1 +PROFILE.json: {"children": {"r": n_r, ...}, "W": W, "H": H, "kc": kc, "m": m}. +Prints one JSON object. +""" +import json, sys +from fractions import Fraction +from decimal import Decimal, getcontext, ROUND_CEILING, ROUND_FLOOR + +getcontext().prec = 80 +K, D1 = 100, 2 # z1 = 1 - (N K + D1)/(10^10 K): the Lean rate fact's exponent +DD = 12 # decimals of the rational log bounds + + +def log_upper(m, r): + """rational L >= log(m/r), with the number of exp-series terms that certify it""" + x = (Decimal(m).ln() - Decimal(r).ln()) * Decimal(10) ** DD + L = Fraction(int(x.to_integral_value(rounding=ROUND_CEILING)) + 1, 10 ** DD) + target = Fraction(m, r) + s, term, n = Fraction(0), Fraction(1), 0 + while s < target: + s += term + n += 1 + term = term * L / n + assert n < 400 + return L, n + + +def log_lower(m, r): + """rational 0 < L <= log(m/r): an upper bound U of exp(L/2^s) with U^(2^s) <= m/r""" + x = (Decimal(m).ln() - Decimal(r).ln()) * Decimal(10) ** DD + L = Fraction(int(x.to_integral_value(rounding=ROUND_FLOOR)) - 1, 10 ** DD) + assert L > 0 + s = 0 + while L / 2 ** s > Fraction(1, 2): + s += 1 + y = L / 2 ** s + target = Fraction(m, r) + n = 2 + while True: + S, term = Fraction(0), Fraction(1) + for i in range(n): + S += term + term = term * y / (i + 1) + fact = 1 + for i in range(2, n + 1): + fact *= i + U = S + y ** n * (n + 1) / (fact * n) + if U ** (2 ** s) <= target: + return L, s, n + n += 1 + assert n < 60 + + +def exp_up(x): + assert 0 <= x <= 1 + return 1 + x + x * x / 2 + x ** 3 / 6 + x ** 4 * Fraction(5, 96) + + +def exp_lo(x): + assert x >= 0 + return 1 + x + x * x / 2 + x ** 3 / 6 + + +def check_profile(p): + ch = {int(r): int(n) for r, n in p['children'].items() if int(n)} + W, H, kc, m = int(p['W']), int(p['H']), int(p['kc']), int(p['m']) + assert 0 < H < W and 1 < kc < m + assert all(1 <= r < kc for r in ch), 'not separated: every paid block must be smaller than every job' + return ch, W, H, kc, m + + +def holds(p, N): + """exact: (R) at z1 = 1 - (N K + D1)/(10^10 K); returns (bool, relative margin)""" + ch, W, H, kc, m = check_profile(p) + eps = Fraction(N * K + D1, 10 ** 10 * K) + lhs = Fraction(0) + for r, n in ch.items(): + L, _ = log_upper(m, r) + lhs += n * Fraction(r, m) * exp_up(eps * L) + Ll, _, _ = log_lower(m, kc) + rhs = (W - H) + H * Fraction(kc, m) * exp_lo(eps * Ll) + return lhs <= rhs, float((rhs - lhs) / W) + + +def fails(p, N1): + """exact: (R) is false at the grid exponent 1 - N1/10^10""" + ch, W, H, kc, m = check_profile(p) + eps = Fraction(N1, 10 ** 10) + lhs = Fraction(0) + for r, n in ch.items(): + L, _, _ = log_lower(m, r) + lhs += n * Fraction(r, m) * exp_lo(eps * L) + Lu, _ = log_upper(m, kc) + rhs = (W - H) + H * Fraction(kc, m) * exp_up(eps * Lu) + return lhs > rhs, float((lhs - rhs) / W) + + +def root(p): + """60-digit decimal root b of (R) (orientation only)""" + ch, W, H, kc, m = check_profile(p) + getcontext().prec = 60 + c = [(Decimal(n), (Decimal(r) / m).ln()) for r, n in ch.items()] + t = [(Decimal(W - H), Decimal(0)), (Decimal(H), (Decimal(kc) / m).ln())] + lo, hi = Decimal('0.97'), Decimal(1) + for _ in range(200): + z = (lo + hi) / 2 + if sum(n * (l * z).exp() for n, l in c) > sum(n * (l * z).exp() for n, l in t): + lo = z + else: + hi = z + getcontext().prec = 80 + return 1 - (lo + hi) / 2 + + +def certify(p, N): + ok, margin = holds(p, N) + no, over = fails(p, N + 1) + return dict(N=N, figure='%.7e' % (N / 1e10), holds_at_N=ok, relative_margin=margin, + fails_at_N_plus_1=no, relative_excess_at_N_plus_1=over, root_decimal=str(root(p))[:40], + PASS=bool(ok and no)) + + +def scan(p): + b = root(p) + N = int(b * 10 ** 10) + while not holds(p, N)[0]: + N -= 1 + while holds(p, N + 1)[0]: + N += 1 + return certify(p, N) + + +def main(): + p = json.load(open(sys.argv[1])) + out = scan(p) if sys.argv[2] == '--scan' else certify(p, int(sys.argv[2])) + print(json.dumps(out, indent=1)) + sys.exit(0 if out['PASS'] else 1) + + +if __name__ == '__main__': + main() diff --git a/research/lever-mixed-targets-2979/tools/transport.py b/research/lever-mixed-targets-2979/tools/transport.py new file mode 100644 index 000000000..990d11df5 --- /dev/null +++ b/research/lever-mixed-targets-2979/tools/transport.py @@ -0,0 +1,400 @@ +#!/usr/bin/env python3 +"""p-lower (round wht45/lever, 19 Oct 2026): OWN transport of a staged544 BORROW-WORD to the hub's native +canonical form (CANONICAL-WORD), written from the documented semantics of the hub's bw_transport.py (read, never +run). The construction is PR2226's anticipatory dirty borrowing (Cinna Davis, @1337isnot1337); the transport stage +of the native chain is the hub's (GK / #433 lineage). This file is our own implementation of the same map: + + * frame ids: frames are reduced-echelon GF(2)^9 bases (pivots descending); ids are given in order of first + appearance, in the hub's order of appearance (ports, start_extra, y hyperplanes, helper_final, the warp table, + precondition, compensation, A, cut, B, restore, cleanup, centre frames, target levels); 0 = bottom, 1 = FULL; + * register compaction: the k removed helpers are dropped, registers renumbered in order (R' = R - k); + * zero buffers: in the cleanup a register n0 + c (n0 = 2v + R) is the private zero buffer of restored helper c, + written ['Z', new id of c]; + * warps: operator table (op = row + 1), warp events inserted into B before the gate at position B_pos (ascending + op among equal positions); A-phase warps kept in place; cleanup warps become ['warp', r, op, 1, 1]; + * initial corrections -> twisted adds ['tadd', t, s, word, num, den, 0] in front of the precondition; + * checks (all asserted): exact replay in the free warp algebra over every input column, both orientations + (forward, inverse-transpose); dyadic primitives; frame chains (nested climbs, warps carry frames by G, zero-frame + phase on frame-0 registers, centres, cleanup at FULL); the paid profile equals the word's report. + +usage: transport.py BORROW-WORD.json[.gz] OUT-CANONICAL.json.gz OUT-AUDIT.json [--no-replay] +""" +import sys, json, gzip, hashlib, time +from collections import Counter +from fractions import Fraction as Q + + +def need(ok, msg): + if not ok: + raise AssertionError(msg) + + +def read_json(path): + raw = open(path, 'rb').read() + return json.loads(gzip.decompress(raw) if raw[:2] == b'\x1f\x8b' else raw), raw + + +# ------------------------------------------------------------------ GF(2)^9 subspaces (own code) +def rref(vectors): + """reduced row echelon basis of the span, as a tuple with pivots (leading bits) descending""" + rows = [] # kept reduced against each other + for x in vectors: + for b in rows: + if x >> (b.bit_length() - 1) & 1: + x ^= b + if x: + p = x.bit_length() - 1 + rows = [b ^ x if b >> p & 1 else b for b in rows] + rows.append(x) + rows.sort(reverse=True) + return tuple(rows) + + +def inside(a, b): + """span(a) <= span(b); b reduced echelon""" + for x in a: + for y in b: + if x >> (y.bit_length() - 1) & 1: + x ^= y + if x: + return False + return True + + +def apply_G(cols, x): + out, i = 0, 0 + while x: + if x & 1: + out ^= cols[i] + x >>= 1 + i += 1 + return out + + +# ------------------------------------------------------------------ free warp algebra +def axpy(dst, src, q): + for key, val in src.items(): + w = dst.get(key, 0) + q * val + if w: + dst[key] = w + else: + dst.pop(key, None) + + +def warp_row(row, op): + out = {} + for (col, word), val in row.items(): + out[col, word[1:] if word and word[0] == -op else (op,) + word] = val + return out + + +def dyadic(q): + d = q.denominator + return d & (d - 1) == 0 + + +def transport(word): + need(word.get('kind') == 'BORROW-WORD', 'not a BORROW-WORD') + rep = word['report'] + v, h, R0 = rep['v'], rep['h'], rep['R'] + need(h == 9 and v == 112, 'sizes') + n0 = 2 * v + R0 + removed = sorted(word['removed']) + rem = set(removed) + need(len(rem) == len(removed) and all(2 * v <= r < n0 for r in removed), 'removed helpers') + kept = [r for r in range(n0) if r not in rem] + new = {r: i for i, r in enumerate(kept)} + n = len(kept) + R = n - 2 * v + need(R == R0 - len(removed), 'compaction') + ports = word['ports'] + need(len(ports) == v == len(set(ports)), 'ports') + FULL = rref([1 << i for i in range(h)]) + frames, fids = [(), FULL], {(): 0, FULL: 1} + + def fid(vs): + b = rref(vs) + if b not in fids: + fids[b] = len(frames) + frames.append(b) + return fids[b] + + def reg(r): # BORROW numbering -> canonical register (int) or ['Z', c] + if isinstance(r, list): + return list(r) + if r >= n0: + return ['Z', new[r - n0]] + return new[r] + + # entrance frames + start = [fid([p]) for p in ports] + [0] * (v + R) + for r, f in word['start_extra'].items(): + r = int(r) + need(2 * v <= r < n0 and r not in rem, 'start_extra register') + start[new[r]] = fid(f) + # final frames: y_t ends at the hyperplane orthogonal to its port + final = [1] * v + [fid([x for x in range(1, 1 << h) if bin(x & p).count('1') % 2 == 0]) for p in ports] + [1] * R + hfinal = {} + for r, f in word['helper_final'].items(): + r = int(r) + need(2 * v <= r < n0 and r not in rem, 'helper_final register') + hfinal[new[r]] = fid(f) + final[new[r]] = hfinal[new[r]] + zero_buffers = sorted(hfinal) + + def conv(e): + e = [list(x) if isinstance(x, list) else x for x in e] + k = e[0] + if k == 'warp': + need(len(e) == 5, 'warp event shape') + return ['warp', reg(e[1]), e[2], fid(e[3]), fid(e[4])] + need(k in ('add', 'scale'), ('gate kind', k)) + e[1] = reg(e[1]) + if k == 'add': + e[2] = reg(e[2]) + e[-1] = None if e[-1] is None else fid(e[-1]) + return e + + # warp operator table + warps = [] + for i, (pos, lender, G, f_from, f_to) in enumerate(word['warps']): + ff = fid(f_from) + ft = fid(f_to) + warps.append({'op': i + 1, 'B_pos': pos, 'lender': new[lender], 'G_columns': list(G), + 'from_frame': ff, 'to_frame': ft}) + tadds = [] + for t in word['initial_corrections']: + q = Q(t['coefficient']) + tadds.append(['tadd', new[t['target']], new[t['source']], list(t['operator_word']), q.numerator, q.denominator, 0]) + precondition = tadds + [conv(e) for e in word['precondition']] + compensation = [conv(e) for e in word['compensation']] + A = [conv(e) for e in word['A']] + cut = [conv(e) for e in word['cut']] + at = {} + for w in warps: + at.setdefault(w['B_pos'], []).append(w) + B = [] + for p in range(len(word['B']) + 1): + for w in sorted(at.get(p, []), key=lambda w: w['op']): + B.append(['warp', w['lender'], w['op'], w['from_frame'], w['to_frame']]) + if p < len(word['B']): + B.append(conv(word['B'][p])) + need(sum(e[0] == 'warp' for e in B) == len(warps), 'every warp placed in B') + tail = [conv(e) for e in word['restore']] + cleanup = [] + full_ends = 0 + for e in word['cleanup']: + if e[0] == 'warp': + need(len(e) == 4 and rref(e[3]) == FULL, 'cleanup warp not [warp, r, op, FULL]') + full_ends += 1 + cleanup.append(['warp', reg(e[1]), e[2], 1, 1]) + else: + cleanup.append(conv(e)) + centers = [new[r] for r in word['centers']] + center_frames = [fid(f) for f in word['center_frames']] + levels = {str(t): fid(f) for t, f in word['target_levels'].items()} + c = dict(h=h, v=v, R=R, ports=ports, frames=[list(f) for f in frames], start=start, final=final, + precondition=precondition, compensation=compensation, A=A, cut=cut, B=B, tail=tail, cleanup=cleanup, + centers=centers, center_frames=center_frames, target_levels=levels, warps=warps, + zero_buffers=zero_buffers, removed=removed, helper_origin=kept[2 * v:], + borrow=dict(k=len(removed), base=word.get('base'), original_helpers=R0)) + info = dict(cleanup_warps_at_full=full_ends) + return c, info + + +def expand_tadd(e): + _, t, s, ops, a, b, f = e + return ([['warp', s, op, 0, 0] for op in reversed(ops)] + [['add', t, s, a, b, 0]] + + [['warp', s, -op, 0, 0] for op in ops]) + + +def program(c): + pre = [] + for e in c['precondition'] + c['compensation']: + pre += expand_tadd(e) if e[0] == 'tadd' else [e] + return [('pre', e) for e in pre] + [('A', e) for e in c['A']] + [('cut', e) for e in c['cut']] + \ + [('B', e) for e in c['B']] + [('tail', e) for e in c['tail']] + [('cleanup', e) for e in c['cleanup']] + + +def key_of(r): + return ('Z', r[1]) if isinstance(r, list) else ('L', r) + + +def replay(c, prog, back): + """exact replay in the free warp algebra; rows over (canonical column, warp word); returns the bad keys""" + v, R = c['v'], c['R'] + n = 2 * v + R + rows = {('L', r): {(r, ()): Q(1)} for r in range(n)} + for z in c['zero_buffers']: + rows[('Z', z)] = {} + for part, e in prog: + if e[0] == 'warp': + k = key_of(e[1]) + rows[k] = warp_row(rows[k], e[2]) + elif e[0] == 'add': + dst, src, a = key_of(e[1]), key_of(e[2]), e[3] + if back: + dst, src, a = src, dst, -a + need(dst != src, 'add onto itself') + axpy(rows[dst], rows[src], Q(a, e[4])) + else: + need(e[0] == 'scale', e[0]) + k = key_of(e[1]) + q = Q(e[3], e[2]) if back else Q(e[2], e[3]) + need(q != 0, 'zero scale') + rows[k] = {j: q * x for j, x in rows[k].items()} + want = {('L', r): {(r, ()): Q(1)} for r in range(n)} + for t in range(v): + if back: + want[('L', t)][(v + t, ())] = Q(-1) + else: + want[('L', v + t)][(t, ())] = Q(1) + for z in c['zero_buffers']: + want[('Z', z)] = {} + return [k for k in want if rows[k] != want[k]] + + +def frame_audit(c, word_profile): + v, R, h = c['v'], c['R'], c['h'] + n = 2 * v + R + fr = [tuple(f) for f in c['frames']] + start, final = c['start'], c['final'] + levels = c['target_levels'] + lv = lambda t: levels.get(str(t), 0) + zb = set(c['zero_buffers']) + wrapped = {r for r in range(2 * v, n) if start[r] != 0 or final[r] != 1} + G = {} + for w in c['warps']: + cols = w['G_columns'] + need(len(rref(cols)) == h, ('G not invertible', w['op'])) + a, b = fr[w['from_frame']], fr[w['to_frame']] + need(len(a) == len(b) and rref([apply_G(cols, x) for x in a]) == b, ('G does not carry from -> to', w['op'])) + G[w['op']] = cols + cur = list(start) + paid, edges, wedges = Counter(), set(), set() + + def climb(r, f): + o = cur[r] + need(inside(fr[o], fr[f]), ('climb not nested', r, o, f)) + if o != f: + paid[len(fr[f]) - len(fr[o])] += 1 + edges.add((o, f)) + cur[r] = f + + def warp(e): + _, r, op, f0, f1 = e + if isinstance(r, list): + need(r[0] == 'Z' and f0 == f1 == 1, 'zero-buffer warp off FULL') + return + need(cur[r] == f0, ('warp frame mismatch', e, cur[r])) + cols = G[abs(op)] + a, b = (f0, f1) if op > 0 else (f1, f0) + need(rref([apply_G(cols, x) for x in fr[a]]) == fr[b], ('warp G does not carry the frame', e)) + cur[r] = f1 + wedges.add((1 if op > 0 else -1, abs(op), f0, f1)) + + lregs = lambda e: [r for r in ([e[1], e[2]] if e[0] == 'add' else [e[1]]) if not isinstance(r, list)] + for e in c['precondition'] + c['compensation']: + if e[0] == 'tadd': + need(start[e[1]] == 0 and start[e[2]] == 0 and e[-1] == 0 and e[2] not in wrapped and all(e[3]), + ('twisted add', e)) + for x in expand_tadd(e): + if x[0] == 'warp': + warp(x) + continue + need(e[-1] == 0 and all(start[r] == 0 for r in lregs(e)), ('zero-frame phase on a nonzero entrance', e)) + for e in c['A']: + if e[0] == 'warp': + warp(e) + else: + for r in lregs(e): + climb(r, e[-1]) + need(all(cur[r] == f for r, f in zip(c['centers'], c['center_frames'])), 'centres not at their frames') + need(all(cur[v + t] == lv(t) for t in range(v)), 'targets not at their levels') + for r, f in zip(c['centers'], c['center_frames']): + served = {lv(e[1] - v) for e in c['cut'] if e[2] == r} + need(len({len(fr[s]) for s in served}) == len(served), 'tie in served levels (order would be ambiguous)') + o = f + for s in sorted(served, key=lambda s: -len(fr[s])): + need(inside(fr[s], fr[o]), 'served level not inside the centre frame') + if s != o: + paid[len(fr[o]) - len(fr[s])] += 1 + edges.add((o, s)) + edges.add((s, o)) + o = s + for e in c['B']: + if e[0] == 'warp': + warp(e) + else: + for r in lregs(e): + climb(r, e[-1]) + for e in c['tail']: + need(e[0] != 'warp', 'warp in the tail') + for r in lregs(e): + climb(r, e[-1]) + for r in range(n): + climb(r, final[r]) + zreads = 0 + for e in c['cleanup']: + if e[0] == 'warp': + warp(e) + continue + for r in ([e[1], e[2]] if e[0] == 'add' else [e[1]]): + if isinstance(r, list): + need(r[0] == 'Z' and r[1] in zb and e[-1] == 1, ('zero buffer', e)) + zreads += 1 + else: + need(final[r] == 1 and e[-1] == 1, ('cleanup on a non-FULL end', e)) + need(all(len(fr[final[r]]) < h for r in zb) and zb == {r for r in range(2 * v, n) if final[r] != 1}, 'zero buffers') + prof = dict(sorted(paid.items())) + need(prof == {int(k): x for k, x in word_profile.items()}, ('paid profile differs from the report', prof)) + return prof, sorted(edges), sorted(wedges), zreads + + +def main(argv): + wp, outp, audp = argv[0], argv[1], argv[2] + t0 = time.monotonic() + word, raw = read_json(wp) + c, info = transport(word) + prog = program(c) + aud = dict(word=wp, word_file_sha256=hashlib.sha256(raw).hexdigest(), + word_content_sha256=hashlib.sha256(gzip.decompress(raw) if raw[:2] == b'\x1f\x8b' else raw).hexdigest()) + if '--no-replay' not in argv: + for back in (False, True): + bad = replay(c, prog, back) + need(not bad, ('free-algebra endpoint', 'inverse-transpose' if back else 'forward', bad[:8])) + aud['free_algebra_replay'] = 'both orientations exact on all %d columns' % (2 * c['v'] + c['R']) + for part, e in prog: + if e[0] == 'add': + need(dyadic(Q(e[3], e[4])), ('non-dyadic add', e)) + elif e[0] == 'scale': + q = Q(e[2], e[3]) + a = abs(q.numerator) + need(dyadic(q) and a & (a - 1) == 0, ('scale not a signed power of two', e)) + prof, edges, wedges, zreads = frame_audit(c, word['report']['local_profile']) + c['local_profile'] = prof + c['edges'] = [list(x) for x in edges] + c['warp_edges'] = [list(x) for x in wedges] + payload = json.dumps(c, sort_keys=True, separators=(',', ':')).encode() + open(outp, 'wb').write(gzip.compress(payload, mtime=0)) + fr = c['frames'] + aud.update(info, canonical=outp, canonical_file_sha256=hashlib.sha256(open(outp, 'rb').read()).hexdigest(), + canonical_content_sha256=hashlib.sha256(payload).hexdigest(), + v=c['v'], R=c['R'], original_helpers=c['borrow']['original_helpers'], removed=c['borrow']['k'], + zero_buffers=len(c['zero_buffers']), zero_buffer_reads=zreads, warps=len(c['warps']), + warp_events=dict(A=sum(e[0] == 'warp' for e in c['A']), B=sum(e[0] == 'warp' for e in c['B']), + cleanup=sum(e[0] == 'warp' for e in c['cleanup']), + tadd_expansion=sum(2 * len(e[3]) for e in c['precondition'] if e[0] == 'tadd')), + tadds=sum(e[0] == 'tadd' for e in c['precondition']), + scalar_operations=sum(e[0] != 'warp' for _, e in prog), local_profile={str(k): x for k, x in prof.items()}, + local_rank_mass=sum(k * x for k, x in prof.items()), frames=len(fr), directed_edges=len(edges), + warp_edge_classes=len(wedges), + widths_hist={str(k): x for k, x in sorted(Counter(len(fr[c['final'][r]]) - len(fr[c['start'][r]]) + for r in range(2 * c['v'], 2 * c['v'] + c['R'])).items())}, + seconds=round(time.monotonic() - t0, 2)) + json.dump(aud, open(audp, 'w'), indent=1) + print(json.dumps(aud, indent=1)) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/research/lever-mixed-targets-2979/verify.py b/research/lever-mixed-targets-2979/verify.py new file mode 100644 index 000000000..0181a1087 --- /dev/null +++ b/research/lever-mixed-targets-2979/verify.py @@ -0,0 +1,304 @@ +#!/usr/bin/env python3 +"""Registered check of research/lever-mixed-targets-2979: the recursion lever priced on a community word. + +Run from the repository root (the hub's runner does this for the registered instance, #2979): + python3 -B research/lever-mixed-targets-2979/verify.py --part main + python3 -B research/lever-mixed-targets-2979/verify.py --part controls +The second instance (#3945, not registered here; archived on main on 20 October 2026 with the same files as its +head) runs the same way, from its folder on main by default, see README.md section 6: + python3 -B research/lever-mixed-targets-2979/verify.py --instance 3945 [--source ] +and so does #3945 with every head kept (design B: the same words and the same price of the circuit, with the table of +hosts that this package carries in fills/3945H/, made by the community's own allocation programs with one added +condition), the instance of the highest Lean-checked bound: + python3 -B research/lever-mixed-targets-2979/verify.py --instance 3945H [--source ] +and so does the FULL cut on the same table (instance 3945F: every head removed, job 25 on its array, and every other +rank-48 block split into two blocks of 24 on the same role), the instance of the highest Lean-checked bound: + python3 -B research/lever-mixed-targets-2979/verify.py --instance 3945F [--source ] +Standard library only. The instance's input files are re-checked by sha256 (instances/.json). Everything is +written to a temporary folder outside the repository and removed at the end (--keep DIR keeps a copy). + +--part main + 1. pins: every input file and every data file of this package equals its recorded sha256; the word's stated + local profile, widths, zero buffers and complex root are read from the community's own files; + 2. my conversion of both words (gauge44 and extra) into the gcert format: tools/transport.py (the community's + native canonical form, rebuilt from the borrowed word, exact replay on all 632 columns in both orientations) + and tools/lower_w.py (frames, warps, residual widths = the word's widths helper by helper, the community's local + profile, the full program replayed to the community's endpoint, 7 wrong versions of each word rejected); the + stated local profile, widths and zero buffers equal what the conversion finds; the content hashes of the + results equal the recorded ones; + 3. the head test (tools/g0_staged.py) in my network (network/: the step order of my Lean network, read from the + Lean source as data; nothing is compiled here) on the word's ORDER, DISPATCH, PLAN, TEMPLATE and FILL rows: + no role outside a window, no bin over its rank, one use per call and role, the global paid profile equal to + the community's PROFILE.json digit for digit, and the number of literal rank-48 heads; and the head test's own + controls (gate A4 moved before its climb: no heads; gate C2 deleted: the other rank-48 blocks become tails); + 4. the price (tools/price_ours.py): the uniform root of my profile equals the community's stated complex root to + all 24 digits; the half cut (each head cut by 24 of its 48 axes, job 49 on its array) and, as a what-if, the + full cut; + 5. the rate certificate (tools/rate_cert.py) on the half-cut profile DERIVED from the measured heads (for a + full-cut instance, "rate": {"cut": "full"}: the full-cut profile, heads removed with job 25 and the other + rank-48 blocks split 24 + 24): exact rational enclosures prove the mixed rate inequality at the figure N/10^10 + and refute it at (N+1)/10^10, and the derived profile equals the histogram of the Lean rate module recorded in + instances/.json. +--part controls + 6. regression: the same head test on the earlier T74 circuit (controls/t74) finds the 11,010 heads (6,150 + + 4,860) of the first head test, and that circuit's global profile; + 7. price controls: with a single head, or with one head fewer, the figure is refused; a profile that is not + separated (job 25 on the head arrays while blocks of 48 stay; for a full-cut instance, the full cut without + the split) is refused; one grid step above is refused. +Prints PASS_LEVER_MIXED_TARGETS__ on success; any failed check stops with FAIL. +""" +import argparse, gzip, hashlib, json, shutil, subprocess, sys, tempfile, time +from fractions import Fraction +from pathlib import Path + +PKG = Path(__file__).resolve().parent +TOOLS = PKG / 'tools' +T37 = '21297b20f1f2dc76eb9dd8124416068c3cb096bab9df17fa4da19bc68dfe082e' + + +def sha(p): + return hashlib.sha256(Path(p).read_bytes()).hexdigest() + + +def content_sha(p): + obj = json.loads(gzip.decompress(Path(p).read_bytes())) + return hashlib.sha256(json.dumps(obj, sort_keys=True, separators=(',', ':')).encode()).hexdigest() + + +def need(ok, what): + if not ok: + raise SystemExit('FAIL: ' + what) + print(' ok ' + what, flush=True) + + +def run(*args, out=None, expect_rc=0): + t = time.time() + r = subprocess.run([sys.executable, '-I', '-B', *map(str, args)], capture_output=True, text=True) + if r.returncode != expect_rc: + sys.stderr.write(r.stdout[-4000:] + r.stderr[-4000:]) + raise SystemExit('FAIL: %s exited %d (expected %d)' % (Path(str(args[0])).name, r.returncode, expect_rc)) + if out: + Path(out).write_text(r.stdout) + print(' (%s %.1f s)' % (Path(str(args[0])).name, time.time() - t), flush=True) + return r.stdout + + +def key(obj, dotted): + for k in dotted.split('.'): + obj = obj[k] + return obj + + +def stage_inputs(src, I, work, name): + """the owner-package layout g0_staged.py reads: /inputs/{ORDER,DISPATCH,PLAN,TEMPLATE}""" + d = work / name / 'inputs' + d.mkdir(parents=True) + for f, k in (('ORDER.json', 'order'), ('DISPATCH.json', 'dispatch'), ('PLAN.json.gz', 'plan'), ('TEMPLATE.json.gz', 'template')): + shutil.copyfile(src / I['files'][k], d / f) + return d.parent + + +def head_test(pkgdir, fill, gb, ge, profile, out, label): + run(TOOLS / 'g0_staged.py', PKG, pkgdir, fill, gb, ge, profile, out, '--label', label, + '--gates', PKG / 'network' / 'Gates.lean', '--xhost', PKG / 'network' / 'XHost') + return json.loads(Path(out).read_text()) + + +def half_cut(profile, W, heads): + ch = {int(r): int(n) for r, n in profile.items()} + other = ch.pop(48) - heads + assert other >= 0 + ch[24] = ch.get(24, 0) + heads + if other: + ch[48] = other + return dict(children={str(r): n for r, n in sorted(ch.items())}, W=W, H=heads, kc=49, m=73) + + +def full_cut(profile, W, heads): + """the full cut: every head removed (job 73 - 48 = 25 on its array), every other rank-48 block split 24 + 24""" + ch = {int(r): int(n) for r, n in profile.items()} + other = ch.pop(48) - heads + assert other >= 0 + if other: + ch[24] = ch.get(24, 0) + 2 * other + return dict(children={str(r): n for r, n in sorted(ch.items())}, W=W, H=heads, kc=25, m=73) + + +def cut_of(I): + return I['rate'].get('cut', 'half') + + +def rate(work, name, prof, N, expect_rc=0): + p = work / ('profile-%s.json' % name) + p.write_text(json.dumps(prof)) + return json.loads(run(TOOLS / 'rate_cert.py', p, N, expect_rc=expect_rc)) + + +def fill_of(I, src): + """the instance's table of hosts: the word's own FILL, or one this package carries (fill_in_package)""" + return PKG / I['fill_in_package'] if I.get('fill_in_package') else src / I['files']['fill'] + + +def profile_of(I, src): + """the paid profile of that table: the word's own PROFILE.json, or one this package carries (profile_in_package)""" + return PKG / I['profile_in_package'] if I.get('profile_in_package') else src / I['files']['profile'] + + +def part_main(I, src, work): + print('1. pins', flush=True) + for rel, h in I['inputs_sha256'].items(): + need(sha(src / rel) == h, 'input %s sha256 %s...' % (rel, h[:12])) + if I.get('fill_in_package'): + need(sha(fill_of(I, src)) == I['fill_in_package_sha256'], + "this package's table of hosts %s sha256 %s..." % (I['fill_in_package'], I['fill_in_package_sha256'][:12])) + if I.get('profile_in_package'): + need(sha(profile_of(I, src)) == I['profile_in_package_sha256'], + "this package's paid profile of that table %s sha256 %s..." % (I['profile_in_package'], I['profile_in_package_sha256'][:12])) + R = json.loads((PKG / 'RESULT.json').read_text()) + for rel, h in R['package_data_sha256'].items(): + need(sha(PKG / rel) == h, 'package file %s sha256 %s...' % (rel, h[:12])) + S = I['stated'] + for c in S['sources']: + need(key(json.loads((src / c['file']).read_text()), c['key']) == S[c['what']], + 'stated %s: %s %s = %s' % (c['what'], c['file'], c['key'], json.dumps(S[c['what']])[:64])) + + print('2. my conversion of the two words', flush=True) + E = I['lowering'] + g1b = {} + for prov, w in (('gauge44', 'base'), ('extra', 'extra')): + word = src / I['files']['word_' + w] + can, aud = work / ('%s.canonical.json.gz' % w), work / ('%s.transport-audit.json' % w) + run(TOOLS / 'transport.py', word, can, aud) + a = json.loads(aud.read_text()) + need(a['free_algebra_replay'].startswith('both orientations exact'), '%s: transport replay exact in both orientations' % w) + need(a['R'] == E['R'] and a['zero_buffers'] == S['zero_buffers'] and a['warps'] == E['warps'] and a['tadds'] == E['tadds'], + '%s: R %d, %d zero buffers (= stated), %d warps, %d twisted additions' % (w, a['R'], a['zero_buffers'], a['warps'], a['tadds'])) + need(a['local_profile'] == S['local_profile'], '%s: local profile = stated %s' % (w, json.dumps(a['local_profile']))) + need(a['widths_hist'] == S['width_inventory'], '%s: width histogram = stated %s' % (w, json.dumps(a['widths_hist']))) + need(content_sha(can) == E[w]['canonical_content_sha256'], '%s: canonical content sha256 as recorded' % w) + g1w, rep = work / ('%s.gcert1w.json.gz' % w), work / ('lower-%s.json' % w) + run(TOOLS / 'lower_w.py', can, g1w, rep, '--provider', prov, '--word', word, '--mutants') + L = json.loads(rep.read_text()) + fp = L['frames_and_price'] + need(fp['hist_equals_hub_local_profile'] and fp['invoice'][0] == fp['invoice'][1] and fp['max_block_rank'] <= 8, + '%s: block histogram = the local profile, invoice %d = %d, blocks of rank <= 8' % (w, fp['invoice'][0], fp['invoice'][1])) + need(L['full_replay']['endpoint'].startswith('exact on all 632 columns'), '%s: full program replayed to the endpoint on all 632 columns' % w) + need(L['width_inventory']['equals_residuals_per_helper'], "%s: residual widths = the word's widths, helper by helper" % w) + need(len(L['mutants']) == 7 and all(v.startswith('rejected') for v in L['mutants'].values()), '%s: 7 of 7 wrong versions rejected' % w) + need(content_sha(g1w) == E[w]['gcert1w_content_sha256'], '%s: gcert/1w content sha256 as recorded' % w) + g1b[w] = work / ('S%s-%s.gcert1b.json.gz' % (I['id'], w)) + run(TOOLS / 'lower_w.py', '--to-1b', g1w, g1b[w]) + need(content_sha(g1b[w]) == E[w]['gcert1b_content_sha256'], '%s: gcert/1b content sha256 as recorded' % w) + + print('3. the head test in my network', flush=True) + pk = stage_inputs(src, I, work, 'pkg') + g = head_test(pk, fill_of(I, src), g1b['base'], g1b['extra'], profile_of(I, src), work / 'g0.json', '#' + I['id']) + m, H = g['G0'], I['heads'] + need(g['fill'] == I['fill'], 'FILL: %(rows)d roles, %(roles_per_call)d per call, %(calls)d calls, %(replicas)d replicas' % g['fill']) + need(not m['violations'] and m['loads_over_rank'] == 0 and m['one_use_per_call_and_role'], + 'every role inside a window of my network, no bin over its rank, one use per call and role') + need(g['call_blocks']['global_profile_equals_hub'], "global paid profile = %s, digit for digit" % ( + "this package's PROFILE.json of that table" if I.get('profile_in_package') else "the community's PROFILE.json")) + need(g['call_blocks']['all_call_blocks_rank_le_8'], 'every block inside a call has rank <= 8') + by = {(c['hub_child'], c['cls']): c['count'] for c in m['classes'] if c['remainder'] == 48} + need(m['heads_rank48_unhosted'] == H['total'] and by.get((8, 'HEAD-literal')) == H['child8'] and by.get((10, 'HEAD-literal')) == H['child10'], + 'literal rank-48 heads: %d (child 8: %s, child 10: %s)' % (m['heads_rank48_unhosted'], by.get((8, 'HEAD-literal')), by.get((10, 'HEAD-literal')))) + need(m['rank48_by_class'].get('neither', 0) == H['other_rank48'], 'other rank-48 blocks (neither heads nor tails): %d' % H['other_rank48']) + n1, n2 = g['control_gateA4_before_climbA4'], g['control_without_gateC2'] + need(n1['rank48_by_class'].get('HEAD-literal', 0) == 0, + 'control: gate A4 moved before its climb -> 0 heads (all %d rank-48 blocks "neither")' % n1['rank48_by_class'].get('neither', 0)) + need(n2['rank48_by_class'].get('TAIL-literal', 0) == H['other_rank48'], + 'control: gate C2 deleted -> the %d other rank-48 blocks become tails' % H['other_rank48']) + + print('4. the price', flush=True) + lo = Fraction(S['complex_lower']) + dec = lambda q: '0.' + str(q.numerator * 10 ** 24 // q.denominator).rjust(24, '0') + P = json.loads(run(TOOLS / 'price_ours.py', work / 'g0.json', dec(lo), dec(lo + Fraction(1, 10 ** 24)), out=work / 'price.json')) + need(P['b_reproduces_stated_lower_digit_for_digit'], 'uniform root of my profile = the stated complex root to 24 digits (%s)' % P['b_hub_engine']) + need(P['half_cut']['separated'] and P['half_cut']['b'] == I['price']['half_cut'], 'half cut (job 49 on the head arrays): b = %s, separated' % P['half_cut']['b']) + if cut_of(I) == 'full': + need(P['full_cut']['separated'] and P['full_cut']['b'] == I['price']['full_cut'], + 'full cut (heads removed, job 25 on the head arrays; the other rank-48 blocks split 24 + 24): b = %s, separated' % P['full_cut']['b']) + else: + need(P['full_cut']['b'] == I['price']['full_cut_what_if'], 'full cut, what-if only: b = %s' % P['full_cut']['b']) + + print('5. the rate certificate', flush=True) + cut = full_cut if cut_of(I) == 'full' else half_cut + prof = cut(g['call_blocks']['global_profile'], P['W'], m['heads_rank48_unhosted']) + need(prof == I['rate']['profile'], 'derived %s-cut profile = %s' % (cut_of(I), ( + 'the histogram of the Lean rate module (%s)' % I['rate']['module']) if I['rate'].get('module') else + 'the recorded histogram (this instance has no Lean rate module: checked by computer, not proved in Lean)')) + c = rate(work, 'half', prof, I['rate']['N']) + need(c['PASS'], 'rate inequality proved at %d/10^10 (relative margin %.3e) and refuted at %d/10^10' % (c['N'], c['relative_margin'], c['N'] + 1)) + + +def part_controls(I, src, work): + print('6. regression: the T74 circuit', flush=True) + t = PKG / 'controls' / 't74' + pk = work / 't74pkg' + shutil.copytree(t / 'inputs', pk / 'inputs') + tpl = src / I['files']['template'] + need(sha(tpl) == T37, 'the T37 template of the instance (sha256 21297b20...) is the one T74 uses') + shutil.copyfile(tpl, pk / 'inputs' / 'TEMPLATE.json.gz') + g = head_test(pk, t / 'FILL.json.gz', t / 'gauge44.gcert1b.json.gz', t / 'extra.gcert1b.json.gz', t / 'PROFILE.json', + work / 'g0-T74.json', 'T74 control') + m = g['G0'] + by = {(c['hub_child'], c['cls']): c['count'] for c in m['classes'] if c['remainder'] == 48} + need(m['heads_rank48_unhosted'] == 11010 and by.get((8, 'HEAD-literal')) == 6150 and by.get((10, 'HEAD-literal')) == 4860, + 'T74: 11,010 heads (6,150 + 4,860), as the first head test found') + need(m['remainder_profile'] == {'48': 22748} and g['call_blocks']['global_profile_equals_hub'] and not m['violations'], + "T74: remainders {48: 22,748}, global profile = that circuit's, no violations") + + print('7. price controls', flush=True) + prof, N = I['rate']['profile'], I['rate']['N'] + uni = {int(r): n for r, n in prof['children'].items()} + if cut_of(I) == 'full': # the uniform profile back: the split halves rejoined, the heads restored + uni[48] = uni.get(48, 0) + uni.pop(24, 0) // 2 + prof['H'] + else: + uni[48] = uni.get(48, 0) + uni.pop(24) + uni = {str(r): n for r, n in sorted(uni.items())} + cut = full_cut if cut_of(I) == 'full' else half_cut + c0 = rate(work, 'one', cut(uni, prof['W'], 1), N, expect_rc=1) + need(not c0['holds_at_N'], 'with a single head the figure is refused') + c1 = rate(work, 'minus1', cut(uni, prof['W'], prof['H'] - 1), N, expect_rc=1) + need(not c1['holds_at_N'], 'with one head fewer (%d) the figure is refused' % (prof['H'] - 1)) + u = work / 'profile-unseparated.json' + if cut_of(I) == 'full': # the full cut without the split: rank-48 blocks stay while the cut job is 25 + uns = {int(r): n for r, n in prof['children'].items()} + k = uns.pop(24, 0) // 2 + uns[48] = k if k else prof['H'] # no split blocks (every rank-48 block a head): the heads stay as blocks of 48 + u.write_text(json.dumps(dict(prof, children={str(r): n for r, n in sorted(uns.items())}))) + else: + u.write_text(json.dumps(dict(prof, kc=25))) + r = subprocess.run([sys.executable, '-I', '-B', str(TOOLS / 'rate_cert.py'), str(u), str(N)], capture_output=True, text=True) + need(r.returncode != 0 and 'not separated' in r.stderr, 'a profile that is not separated (job 25 while blocks of 48 stay) is refused') + c2 = rate(work, 'plus1', prof, N + 1, expect_rc=1) + need(not c2['holds_at_N'], 'one grid step above the figure (%d/10^10) is refused' % (N + 1)) + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('--part', choices=['main', 'controls', 'all'], default='all') + ap.add_argument('--instance', default='2979', help='instances/.json (default 2979, the registered instance)') + ap.add_argument('--source', default=None, help="folder of the word's package files (default: the instance's path on main)") + ap.add_argument('--keep', default=None, help='copy the working folder here at the end (must not exist)') + a = ap.parse_args() + I = json.loads((PKG / 'instances' / (a.instance + '.json')).read_text()) + src = Path(a.source or I['source_default']).resolve() + t0 = time.time() + work = Path(tempfile.mkdtemp(prefix='lever-%s-' % I['id'])) + try: + if a.part in ('main', 'all'): + part_main(I, src, work) + if a.part in ('controls', 'all'): + part_controls(I, src, work) + if a.keep: + shutil.copytree(work, a.keep) + finally: + shutil.rmtree(work, ignore_errors=True) + print('PASS_LEVER_MIXED_TARGETS_%s_%s figure %s heads %d seconds %.0f' % ( + I['id'], a.part.upper(), '%.7e' % (I['rate']['N'] / 1e10), I['heads']['total'], time.time() - t0)) + + +if __name__ == '__main__': + main()