diff --git a/research/p104-6030-independent-audit/NEW-MAPS.json b/research/p104-6030-independent-audit/NEW-MAPS.json new file mode 100644 index 0000000000..6d27c8e7b4 --- /dev/null +++ b/research/p104-6030-independent-audit/NEW-MAPS.json @@ -0,0 +1 @@ +{"schema":"p104-6030-new-dense-maps/1","maps":[[["helper",3,189,0],8,"065ffe910bec1d3b661770aeb45d3f331fcf85f2f237b562288bab13d77d82ea"],[["helper",76,394,0],2,"0ebdac8dae67b1e89622c4c0ffde56835a6ccef46d4b64e8e3d947f70dab4c11"],[["helper",749,127,0],6,"7a5100f1e66d3fd47e1eb9ee69a69dde29ba76b95b1173440285636dfce10c14"],[["move",3,189,0],8,"065ffe910bec1d3b661770aeb45d3f331fcf85f2f237b562288bab13d77d82ea"],[["move",3,714,0],4,"07c471517840c82c5b5778f77cae7765829c6927aa8e9d2ed059938d944885aa"],[["move",595,637,0],2,"2d540100a251ff983e5ccf9d96f8215a389c70759923a0813673efeb35bc126b"],[["move",714,127,0],5,"0b207429a4ef9b8992645a564cf9e8ed433ac6acfda523be0acda7e6e40e0c50"]]} diff --git a/research/p104-6030-independent-audit/README.md b/research/p104-6030-independent-audit/README.md new file mode 100644 index 0000000000..4cbb9d789e --- /dev/null +++ b/research/p104-6030-independent-audit/README.md @@ -0,0 +1,95 @@ +# Independent replay, delta, invoice, native and funding audit of PR6030 + +**Result (scoped corroborating audit, no new κ).** An independent check of +[PR #6030](https://github.com/CrocSwap/integer-mult-bounds/pull/6030) (DreamingOfClouds, helper 470's frame-593 rung +removal, conditional κ 0.003125804) finds no error. On canonical main, an own exact replay, an exact structural +PR #5907 → PR #6030 delta, an own invoice recount, a fresh dense all-column native check with absolute phase of +**every** operator in the PR6030 inventory and an own decimal funding engine all reproduce the author's claims. +That includes the raw crossing (0.00312581155791, 0.00312581155792). The per-LOCAL margin change is H1 + H3 − H4, +the same as PR #5907's gain over PR #5827. + +**Relation to the admission audit.** This work started from `a2b4b039`, where the maintainer +[repair review](../../docs/research/pr-intake-evidence/pr6030-repair/REVIEW.md) left an independent check of the +changed word open. While it ran, the maintainer admitted PR6030 at `721c0382`, after an independent application +audit (`docs/research/pr-intake-evidence/pr6030-audit/PROOF-REVIEW.md`). That audit also uses Matarener's +interpreter and dense inventory code. So this package is a second execution of largely the same checks, not new +coverage, and it changes no decision. It adds three things. First, `--full` recomputes the dense digest of all 3,163 +operators. The admission review checks only the 7 new tasks densely and says it "is not a fresh independent dense +replay of every unchanged predecessor map". Second, an itinerary-level delta: exactly six register itineraries +change, and every other MOVE is unchanged as a multiset. Third, five tamper controls on the PR6030 word. + +Base: canonical main `721c03822c421b7f7fcbb2598993b947c4d88419` (the work ran at `a2b4b039`; no input changed between the two). This contains PR #6030's package +(`research/p104-helper470-twin-rung-removal`, construction head `772dd10a`, with the maintainer portability repair +`746ee5e1`) and PR #5907's (`research/p104-helper468-rung-removal`). Live inputs are pinned in +[SOURCES.json](SOURCES.json). + +## What is checked + +The replay, invoice, dense-comparison and funding functions are copied unchanged from Matarener's +[PR5827/PR5907 audit](../p104-unread-rung-independent-audit/README.md) (PR #5960). Its digests for 3,156 of the 3,163 PR6030 +native operators are reused. Nothing is imported from the PR6030 package except its data files and, in layer 0 +only, its `construct.py`. The PR #5827 verifier chain, which the author ran, is not used anywhere. + +| Layer | Check | Result | +|---|---|---| +| 0. Sources | PR6030's `inputs/pr5907-WORD.json.gz` and `inputs/pr5827-source.tar` against canonical main's PR5907 word and PR5907's pinned archive; PR6030 `construct.py` applied to canonical PR5907 word with `EDIT.json.gz` | pinned word and archive byte-identical; own serialization of the regenerated word equals the decompressed shipped payload byte for byte | +| 1. Own replay | PR5907 and PR6030 words: strict span nesting of every MOVE, common chart of every ADD/COPY/SCALE, dyadic coefficients, owned INIT/CLEAR lifetimes, all 799 endpoint rows (identity on public registers plus X into Y for the 104 live ports), helper initial span strictly inside final span | PASS on both: 770 public, 29 owned fields, 31 lifetimes, peak 13; paid and helper histograms equal each author's `local` block | +| | PR5907 → PR6030 delta (structure) | all fields except `program`, `initial`, `final` unchanged; exactly the three declared boundary changes (initial 713: 3→76, 736: 424→749; final 115: 105→189); exactly the six declared itineraries change (registers 115, 127, 470, 704, 713, 736, as listed in the PR6030 README); INIT, CLEAR, COPY and every other MOVE unchanged as multisets; paid delta −2H1 + H2 − 2H3 + H4 + H6 − H7 + H8, helper delta −H1 + H2 − H3 + H6 − H7 + H8 (helper ranks 115: 1→8, 713: 3→2, 736: 7→6); 22,803 events ≤ 26,000. The rewritten ADD and SCALE events (ADD 21,706 → 18,404, SCALE 753 → 861) are not compared with a declared edit; they are checked only through their exact effect in the replay above, which is what the endpoint identity needs | +| | tamper controls | flipped ADD sign (helper 268), dropped ADD (helper 470), non-dyadic SCALE, restored final chart of 115 and a reinstated frame-593 MOVE for 470 are each rejected | +| 2. Invoice | own recount from the 51 physical caller events (18 LOCAL, 15 QUERY_SHEAR, 15 IDLE, diagonal terms) and separately from the closed formula in PR5827 PROOF.md | equal to each author `complete_cost`: 66,852 / 13,444 (PR5907) and 66,834 / 13,444 (PR6030); rank-mass surplus 760 | +| 3. Dense native | PR5548's credited exact Gaussian-dyadic interpreter compares the lowered recipe with the literal frame circuit on all 512 columns: exact equality, norm, support size 2^rank | PR6030 inventory: 3,163 operators (2,886 distinct MOVE maps, 69 distinct helper pairs, 208 main adapters). The 2,922 distinct signed maps and 1,124 helper normalizers equal the author's `native` block. The 7 maps new in PR6030 are computed here (helper 3→189, 76→394, 749→127; MOVE 3→189, 3→714, 595→637, 714→127) and pinned in [NEW-MAPS.json](NEW-MAPS.json). Every other map equals the predecessor's FULL-CHECK digest. A phase-only fault and a flipped child sign on the new map 3→189 are rejected | +| 4. Own funding | 80-digit decimal ln/exp with 10⁻⁷⁰ relative padding, bisection on a 10⁻¹⁴ grid | raw crossings of PR5907 and PR6030 equal the author intervals; tested saving .0031258090 positive; tail ratios α < 1 − 10⁻¹², γ, δ < 125/128; margin derivative negative on [0, .0034], so the crossing is unique there; claim gain 261/500000000 | + +The gain over PR5907 per LOCAL call is H1 + H3 − H4 in the moment margin, with H_r = r^t and t = 1 − κ. It is +positive for every t in (0, 1), because (1/4)^t + (3/4)^t decreases in t and equals 1 at t = 1. + +## Reproduce + +Python 3.12, standard library only, from the repository root: + +```sh +python3.12 -B research/p104-6030-independent-audit/verify.py +``` + +The default run is serial and takes about one minute (61 s on Python 3.12, Apple M-series; it also passes on 3.10, 3.11, 3.13 and 3.14). It checks layers 0, 1, 2 and 4 completely. For layer 3 it +computes all 7 new maps and a fixed subset of the old ones: every helper pair, every 8th main adapter and every +64th MOVE map, each matched against the predecessor's FULL-CHECK.json. The complete PR6030 inventory runs with + +```sh +python3.12 -B research/p104-6030-independent-audit/verify.py --full --jobs 8 +``` + +in about 4 minutes on eight cores (4 min 14 s, Python 3.12). It recomputes all 3,163 digests. The marker is `PASS_P104_6030_INDEPENDENT_AUDIT`. + +## Scope and limits + +This audits the finite 9-qubit local word and its complete invoice. The five inherited framework assumptions remain: +native_all_columns for the uniform word, owned_erasure, compiler, precision_tape and analytic_recovery. The physical +caller (`research/p104-productive-controller`) is recounted, not re-derived. That changing a helper's initial or +final chart (here 713, 736 and 115) is a free boundary choice is inherited from the P104 line; PR5907 used the same +freedom. The compiler threshold and the 54 strict and 4 functional outer conditions are checked only by the +author's chain. The maintainer ran that chain in full on macOS and hosted Linux; it is not rerun here. The layer 1 +to 4 code is shared with the predecessor audit, so it is not independent of that audit, only of the PR6030 author. +This is an agent check, not human or proof-kernel acceptance. It changes no decision: the selected record was already PR6030 at `721c0382`. + +## Open next questions + +- Can the outer conditions and the compiler threshold be recomputed by code that does not descend from PR5827's + `pricing.py`? This package and its predecessor check them only through the authors' chain. The admission review + records that all 54 strict and 4 functional predicates pass, but does not say which code computes them. First step: write each named margin + in `complete_cost.outer` as an exact rational at κ = 781451/250000000 from its source document. Blocked on finding + the formula source for each margin. +- Does the uniform compiler preserve the checked finite native maps at every recursion level? This is blocked by + the inherited native_all_columns premise. + +## Credit + +DreamingOfClouds (PR6030 and PR5907 edits and packaging). Ali Romman (PR5827 word, verifier and lineage, with +OpenAI Codex assistance), Mason Hale (PR5811) and the lineage back to Pierre-Loic Doulcet (PR5565). Matarener +(PR5960, the PR5827/PR5907 independent audit, whose verifier functions and FULL-CHECK digests this package reuses). +Chris R / Clear1nsight (PR5548 dense interpreter, imported unchanged). Douglas Colkitt with OpenAI Codex +(the PR6030 portability repair and primary replay). The P104 native, Clifford, controller, compiler and analytic +contributors are credited in the cited packages. + +Prepared for JosieElliston with Claude Opus 5.5 (Anthropic), via Claude Code, in an unattended donated session. +Apache-2.0. diff --git a/research/p104-6030-independent-audit/RESULT.json b/research/p104-6030-independent-audit/RESULT.json new file mode 100644 index 0000000000..6377773c28 --- /dev/null +++ b/research/p104-6030-independent-audit/RESULT.json @@ -0,0 +1,367 @@ +{ + "layer0_sources": { + "pinned_pr5907_payload_equal_canonical": true, + "pr5827_archive_equal_pr5907_pin": true, + "pr6030_regenerated_word_equal": true + }, + "layer1_replay": { + "5907": { + "endpoint_rows": 799, + "events": 25998, + "helper_count": 562, + "helpers": { + "1": 15, + "2": 7, + "3": 5, + "4": 107, + "5": 14, + "6": 1, + "7": 10, + "8": 18, + "9": 385 + }, + "ops": { + "ADD": 21706, + "CLEAR": 31, + "COPY": 23, + "INIT": 31, + "MOVE": 3454, + "SCALE": 753 + }, + "owned_fields": 29, + "owned_lifetimes": 31, + "paid": { + "1": 2221, + "2": 456, + "3": 498, + "4": 99, + "5": 163, + "6": 10, + "7": 7 + }, + "paid_rank_mass": 5947, + "peak_owned": 13, + "public": 770 + }, + "6030": { + "endpoint_rows": 799, + "events": 22803, + "helper_count": 562, + "helpers": { + "1": 14, + "2": 8, + "3": 4, + "4": 107, + "5": 14, + "6": 2, + "7": 9, + "8": 19, + "9": 385 + }, + "ops": { + "ADD": 18404, + "CLEAR": 31, + "COPY": 23, + "INIT": 31, + "MOVE": 3453, + "SCALE": 861 + }, + "owned_fields": 29, + "owned_lifetimes": 31, + "paid": { + "1": 2219, + "2": 457, + "3": 496, + "4": 100, + "5": 163, + "6": 11, + "7": 6, + "8": 1 + }, + "paid_rank_mass": 5952, + "peak_owned": 13, + "public": 770 + }, + "delta_5907_6030": { + "boundary_changes": { + "final": { + "115": [ + 105, + 189 + ] + }, + "initial": { + "713": [ + 3, + 76 + ], + "736": [ + 424, + 749 + ] + } + }, + "changed_helper_ranks": { + "115": [ + 1, + 8 + ], + "713": [ + 3, + 2 + ], + "736": [ + 7, + 6 + ] + }, + "events": [ + 25998, + 22803 + ], + "helper_delta": { + "1": -1, + "2": 1, + "3": -1, + "6": 1, + "7": -1, + "8": 1 + }, + "itineraries": { + "115": [ + [ + 3, + 105 + ], + [ + 3, + 189 + ] + ], + "127": [ + [ + 3, + 602, + 637, + 643, + 646, + 649, + 141 + ], + [ + 3, + 595, + 637, + 643, + 646, + 649, + 141 + ] + ], + "470": [ + [ + 3, + 593, + 714, + 875, + 1001, + 131, + 127 + ], + [ + 3, + 714, + 875, + 1001, + 131, + 127 + ] + ], + "704": [ + [ + 3, + 593, + 612, + 127 + ], + [ + 3, + 593, + 714, + 127 + ] + ], + "713": [ + [ + 3, + 394 + ], + [ + 76, + 394 + ] + ], + "736": [ + [ + 424, + 127 + ], + [ + 749, + 127 + ] + ] + }, + "margin_delta_per_local": { + "1": 1, + "3": 1, + "4": -1 + }, + "ops_delta": { + "ADD": -3302, + "MOVE": -1, + "SCALE": 108 + }, + "paid_delta": { + "1": -2, + "2": 1, + "3": -2, + "4": 1, + "6": 1, + "7": -1, + "8": 1 + }, + "registers_with_changed_event_sequence": 777 + }, + "tamper_controls": { + "drop_add_into_helper470": "rejected: endpoint row 116", + "flip_add_sign_helper268": "rejected: endpoint row 112", + "restore_final_115_chart": "rejected: public and owned exits", + "retarget_helper470_move_to_593": "rejected: destination chart at 14389", + "scale_by_one_third": "rejected: dyadic coefficient at 2" + } + }, + "layer2_invoice": { + "5907": { + "max_paid_rank": 72, + "max_target_rank": 145, + "paid_calls": 66852, + "productive_fields": 13444, + "rank_mass_surplus": 760 + }, + "6030": { + "max_paid_rank": 72, + "max_target_rank": 145, + "paid_calls": 66834, + "productive_fields": 13444, + "rank_mass_surplus": 760 + } + }, + "layer3_dense": { + "control_map": [ + 3, + 189 + ], + "controls": { + "phase_only_fault": "rejected", + "wrong_child_sign": "rejected" + }, + "covered_by_predecessor_full_check": 3156, + "distinct_helper_pairs": 69, + "distinct_moves": 2886, + "distinct_signed_maps": 2922, + "new_in_pr6030": [ + [ + "helper", + 3, + 189, + 0, + 8 + ], + [ + "helper", + 76, + 394, + 0, + 2 + ], + [ + "helper", + 749, + 127, + 0, + 6 + ], + [ + "move", + 3, + 189, + 0, + 8 + ], + [ + "move", + 3, + 714, + 0, + 4 + ], + [ + "move", + 595, + 637, + 0, + 2 + ], + [ + "move", + 714, + 127, + 0, + 5 + ] + ], + "new_maps_sha256": "72f37f483e3a4b3b54e7d54719df3da190e4a3158ce471987430e74f98fdb5de", + "predecessor_full_check_sha256": "ad761f5f798a0fbbbb2620e8d8bb4ff3c606ccc86eb64a2c53188ffd24781e8d", + "tasks": 3163 + }, + "layer4_funding": { + "5907": { + "alpha": "0.99999999787209550886", + "claim": "1562641/500000000", + "delta": "0.95098476241487807261", + "derivative_upper": "-234348.96015517985862", + "equals_author": true, + "gamma": "0.97555768949964175020", + "raw_crossing": [ + "78132227471/25000000000000", + "62505781977/20000000000000" + ], + "raw_crossing_decimal": [ + "0.00312528909884", + "0.00312528909885" + ], + "tested": "3125287/1000000000", + "tested_sign": "positive" + }, + "6030": { + "alpha": "0.99999999740808018176", + "claim": "781451/250000000", + "delta": "0.95062864224216952441", + "derivative_upper": "-234306.96640174399061", + "equals_author": true, + "gamma": "0.97556235104746729785", + "raw_crossing": [ + "312581155791/100000000000000", + "19536322237/6250000000000" + ], + "raw_crossing_decimal": [ + "0.00312581155791", + "0.00312581155792" + ], + "tested": "3125809/1000000000", + "tested_sign": "positive" + }, + "claim_gain_6030_over_5907": "261/500000000" + } +} diff --git a/research/p104-6030-independent-audit/SOURCES.json b/research/p104-6030-independent-audit/SOURCES.json new file mode 100644 index 0000000000..ded4bdba2d --- /dev/null +++ b/research/p104-6030-independent-audit/SOURCES.json @@ -0,0 +1,126 @@ +{ + "schema_version": 1, + "base_commit": "721c03822c421b7f7fcbb2598993b947c4d88419", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a", + "sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "research/p104-helper468-rung-removal/WORD.json.gz", + "usage": "input", + "git_blob": "7ffe7b500b02b9d0de49a85ec53e36004f1a411f", + "sha256": "b69a9cb3a26d4f40aa7ad14f814b188fe16a782999f6f56292538e447d67b284" + }, + { + "path": "research/p104-helper468-rung-removal/RESULT.json", + "usage": "input", + "git_blob": "21a900ef8a49eab504cedc5f171a01efaa8a5be1", + "sha256": "577c39f6c9b017a543692e85ac6f497974f561eb197e0e3fad4b50baa72e5f3d" + }, + { + "path": "research/p104-helper468-rung-removal/inputs/pr5827-source.tar", + "usage": "input", + "git_blob": "1e10936044959f81a4c5fcd5bdb7b9e4c060ec8e", + "sha256": "7af5908a4d83e83e28f59523fd7494841f669b7295311cfdbc3027fa65c5826d" + }, + { + "path": "research/p104-helper470-twin-rung-removal/WORD.json.gz", + "usage": "input", + "git_blob": "22f9ab02d1b73ea0aa4b07ce445a14cc2602c760", + "sha256": "7834725d9e34ee846a9ccc615221ea81e0201613938afa185d2eda0c9a6c232f" + }, + { + "path": "research/p104-helper470-twin-rung-removal/RESULT.json", + "usage": "input", + "git_blob": "e4a03118d585fb80c9ac932281b528ac394ccc5f", + "sha256": "84fcbe2a0b64307b5703c363408042bdd91555b0419509aa50daa43b3b1924ad" + }, + { + "path": "research/p104-helper470-twin-rung-removal/EDIT.json.gz", + "usage": "input", + "git_blob": "7f2119f2b37644ce750a9c03d31514275513fdfb", + "sha256": "89c5166d3368cd0f949930c88a134d984b4f75217b1e6bb1f57829a639726350" + }, + { + "path": "research/p104-helper470-twin-rung-removal/EXPECT.json", + "usage": "input", + "git_blob": "0e7201cef95465bb92ede7da07c46438e2357226", + "sha256": "1300b39981c7e1a6edafe677f8d606b5be51a658c3516bd70467800674991338" + }, + { + "path": "research/p104-helper470-twin-rung-removal/construct.py", + "usage": "input", + "git_blob": "dbdbf0e7dd4c0c31e5075a48a7f395633cb82840", + "sha256": "1a417a5a858bd6dfac9d74a1f95c7aecc27b51e3eedf0954593004948935f6b6" + }, + { + "path": "research/p104-helper470-twin-rung-removal/sources.py", + "usage": "input", + "git_blob": "227794adce372f98ef10eeb22858ee4e5b7046de", + "sha256": "ebc01917c2e856e7a1712118d5b7f9e841af174751bb0c56aefb1cbb210d7787" + }, + { + "path": "research/p104-helper470-twin-rung-removal/SOURCES.json", + "usage": "input", + "git_blob": "5042494d12f4feca59c0ccb156b44dbe75e5a342", + "sha256": "efa21202fd0d220df5607f34540e7dd592c694f5d3793704e3fbf760854c775d" + }, + { + "path": "research/p104-helper470-twin-rung-removal/inputs/pr5907-WORD.json.gz", + "usage": "input", + "git_blob": "7ffe7b500b02b9d0de49a85ec53e36004f1a411f", + "sha256": "b69a9cb3a26d4f40aa7ad14f814b188fe16a782999f6f56292538e447d67b284" + }, + { + "path": "research/p104-helper470-twin-rung-removal/inputs/pr5827-source.tar", + "usage": "input", + "git_blob": "1e10936044959f81a4c5fcd5bdb7b9e4c060ec8e", + "sha256": "7af5908a4d83e83e28f59523fd7494841f669b7295311cfdbc3027fa65c5826d" + }, + { + "path": "research/p104-unread-rung-independent-audit/FULL-CHECK.json", + "usage": "input", + "git_blob": "1fb0ac3f21a425b945f718ebf65885c00794e319", + "sha256": "ad761f5f798a0fbbbb2620e8d8bb4ff3c606ccc86eb64a2c53188ffd24781e8d" + }, + { + "path": "research/p104-unread-rung-independent-audit/verify.py", + "usage": "input", + "git_blob": "05f1fd16367cbd87b6422a69804daa0ed93630fc", + "sha256": "66c9fd157cba8abe62fb9ce63f59322c39976ad38f8d4c3c4aefb71b7448d5ae" + }, + { + "path": "research/p104-productive-controller/CONTROLLER.json", + "usage": "input", + "git_blob": "cc539db709cf7a6c42872c4380902736ad453af3", + "sha256": "a84f6bbd547379597464e56c420cc665f96bc43a9a1351eed4b7cd0fce3cc4b9" + }, + { + "path": "research/p104-native-channel/vendor/clifford_exact.py", + "usage": "input", + "git_blob": "166841a037f069249f6f7f6dedb89248812f59e2", + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + { + "path": "research/p104-native-channel/vendor/native_verify.py", + "usage": "input", + "git_blob": "2c209dfa9cfade3bc20ac5fc9d876b433a147f8c", + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38" + }, + { + "path": "research/p104-contact-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/check.py", + "usage": "input", + "git_blob": "e7e663bebaf13f44c95fb8eb118b472cf377e137", + "sha256": "43fd40847a0853c0ac511d58ce77ef822a5c6dd1b25f662f01cefaa3196a2f7d" + } + ] +} diff --git a/research/p104-6030-independent-audit/TASK.json b/research/p104-6030-independent-audit/TASK.json new file mode 100644 index 0000000000..9593898e79 --- /dev/null +++ b/research/p104-6030-independent-audit/TASK.json @@ -0,0 +1,97 @@ +{ + "schema_version": 1, + "task_id": "supplier-boundary-audit", + "priority_revision": 8, + "base_commit": "721c03822c421b7f7fcbb2598993b947c4d88419", + "original_card": { + "id": "supplier-boundary-audit", + "question": "Does one changed supplier have complete source-bound native, caller, ordinary and outer admission coverage?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "Pin the current sources and one obligation; the historical owner audit is an example, not evidence of a current bug.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose one latest uncovered candidate and build a delta coverage map against the selected review. For P104, #5717 changes owned-lifetime assumptions and #5719 covers exact #5713 causal premises; neither automatically transfers to #5718. For BIT, #5679/#5708 need component admission and compatible outer use. Check controls and exact source identity before reuse; stop with one resolved gap or explicit remaining obligation. A heavy full replay requires a separate serial resource budget.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "supplier admission", + "5717", + "5719", + "5708", + "owned lifetime" + ], + "existing_checks": [ + { + "scope": "PR #4088: author-checked local words, native receipts, owner/phase fill and exact moment.", + "evidence": "research/staged544-mixed-fourth-entry/README.md", + "remaining": "Rebind and validate ordinary/outer admission with all four providers; full mixed release not established.", + "status": "author-checked", + "source_commit": "72d7efc181edb21806a878f174847c96dd410ab0", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #3801: successor scatter-boundary decision package.", + "evidence": "research/scatter-boundary-decision/README.md", + "remaining": "Consult its exact acceptance scope before any new exporter audit; not proof of a selected failure.", + "status": "author-checked", + "source_commit": "911f8800ba7a4b03603ef62c5ffc6240e53cb5fd", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Independent audit of PR6030 (DreamingOfClouds, helper 470 frame-593 rung removal, conditional kappa 0.003125804) on canonical main: source binding and regeneration, own exact replay of the PR5907 and PR6030 words with all 799 endpoint rows, the exact PR5907->PR6030 delta, own invoice recount from the physical caller, dense all-column absolute-phase check of every native map of the PR6030 inventory (new maps computed here, old maps against the predecessor FULL-CHECK and recomputed in --full), and an own decimal funding engine.", + "scope_change_reason": "Delta coverage of the latest P104 candidate, as the card first_experiment asks; the PR6030 maintainer repair review leaves an independent assessment of the changed word open. Extends Matarener's PR5827/PR5907 audit to the next word in the same line; no new construction or kappa.", + "bottleneck_link": "PR6030 is the newest conditional P104 word (kappa 0.003125804). At this package base its independent word check was open; the maintainer admitted it at 721c0382 during this session, so this package is corroborating evidence (fresh full dense replay, itinerary-level delta, tamper controls).", + "budget_minutes": 60, + "stop_rule": "Stop when all layers pass or one fails with a concrete counterexample; no search for new itineraries.", + "outcome": "completed", + "evidence": "research/p104-6030-independent-audit/RESULT.json", + "author": "JosieElliston (session run by Claude)", + "ai_assistance": "Prepared with Claude Opus 5.5 (Anthropic) via Claude Code, in an unattended session donated by JosieElliston.", + "open_questions": [ + { + "question": "Can the 54 strict and 4 functional outer conditions and the compiler threshold be recomputed by code that does not descend from PR5827 pricing.py?", + "why_it_matters": "This audit, like its predecessor, checks those only through the authors' chain.", + "first_step": "Write the outer inequalities from their source documents as exact rationals at kappa 781451/250000000 and compare with complete_cost.outer.", + "blocked_by": "Locating the formula source for each named margin" + }, + { + "question": "Does the uniform compiler preserve the finite native maps checked here at every recursion level?", + "why_it_matters": "Only the fixed 9-qubit local word is checked.", + "first_step": "Bind the uniform-compiler contract to the FULL-CHECK.json and NEW-MAPS.json digests.", + "blocked_by": "Inherited native_all_columns premise" + } + ] +} diff --git a/research/p104-6030-independent-audit/VERIFY.json b/research/p104-6030-independent-audit/VERIFY.json new file mode 100644 index 0000000000..241268b842 --- /dev/null +++ b/research/p104-6030-independent-audit/VERIFY.json @@ -0,0 +1,37 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-helper468-rung-removal/WORD.json.gz", + "research/p104-helper468-rung-removal/RESULT.json", + "research/p104-helper468-rung-removal/inputs/pr5827-source.tar", + "research/p104-helper470-twin-rung-removal/WORD.json.gz", + "research/p104-helper470-twin-rung-removal/RESULT.json", + "research/p104-helper470-twin-rung-removal/EDIT.json.gz", + "research/p104-helper470-twin-rung-removal/EXPECT.json", + "research/p104-helper470-twin-rung-removal/construct.py", + "research/p104-helper470-twin-rung-removal/sources.py", + "research/p104-helper470-twin-rung-removal/SOURCES.json", + "research/p104-helper470-twin-rung-removal/inputs/pr5907-WORD.json.gz", + "research/p104-helper470-twin-rung-removal/inputs/pr5827-source.tar", + "research/p104-unread-rung-independent-audit/FULL-CHECK.json", + "research/p104-unread-rung-independent-audit/verify.py", + "research/p104-productive-controller/CONTROLLER.json", + "research/p104-native-channel/vendor/clifford_exact.py", + "research/p104-native-channel/vendor/native_verify.py", + "research/p104-contact-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/check.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 600, + "checks": "Serial bounded replay: authenticated inputs; PR6030 pinned PR5907 word and PR5827 archive equal canonical main/PR5907 pins and the regenerated PR6030 word equals the shipped payload; own exact replay of the PR5907 and PR6030 words with all 799 endpoint rows and helper nesting; exact PR5907->PR6030 delta (three boundary charts, six itineraries, INIT/CLEAR/COPY and other MOVE multisets, paid and helper rank deltas); own invoice recount equals both complete_cost entries; own decimal crossings equal both author intervals with tail ratios and uniqueness; dense all-column absolute-phase check of every native map new in PR6030 plus a fixed subset of old maps against the predecessor FULL-CHECK, with phase-only and sign fault controls; result equals RESULT.json." + } + ] +} diff --git a/research/p104-6030-independent-audit/verify.py b/research/p104-6030-independent-audit/verify.py new file mode 100644 index 0000000000..2ee7c56a1f --- /dev/null +++ b/research/p104-6030-independent-audit/verify.py @@ -0,0 +1,517 @@ +#!/usr/bin/env python3 +"""Independent replay, delta, invoice, dense native and funding audit of PR6030. Apache-2.0. + +PR6030 (DreamingOfClouds) removes helper 470's frame-593 rung from PR5907's P104 word. Python 3.12, standard +library only. The replay, invoice, dense-comparison and funding code is Matarener's PR5827/PR5907 audit +(research/p104-unread-rung-independent-audit/verify.py, prepared with Claude), copied here function for function +and applied to the PR5907 -> PR6030 pair. Nothing is imported from the PR6030 package except its data files +and, in layer 0 only, its construct.py. +Layers (canonical main contains both packages): + 0. sources: PR6030's pinned PR5907 word equals canonical main's PR5907 word, its PR5827 archive equals the one + pinned in PR5907, and PR6030's construct.py regenerates the shipped word payload; + 1. own exact replay of the PR5907 and PR6030 words (strict MOVE nesting, common charts, dyadic coefficients, + owned lifetimes, all 799 endpoint rows, helper nesting) and the exact delta: unchanged fields, the three + boundary changes, the six changed itineraries, INIT/CLEAR/COPY and every other MOVE unchanged as multisets, + paid and helper rank deltas; + 2. own invoice recount from the physical caller events and the closed formula, against complete_cost; + 3. dense all-column absolute-phase comparison of every native operator in the PR6030 inventory that is not in + the predecessor's FULL-CHECK.json, plus a fixed subset of the old ones matched against those digests; + --full [--jobs N] recomputes the whole PR6030 inventory; + 4. own 80-digit decimal interval engine: raw crossing, tested saving, tail ratios, uniqueness. +""" +from collections import Counter +from decimal import Decimal, getcontext +from fractions import Fraction as Q +from hashlib import sha256 +from multiprocessing import Pool +from pathlib import Path +import gzip, importlib.util, io, json, sys, tarfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +P07 = ROOT/'research/p104-helper468-rung-removal' +P30 = ROOT/'research/p104-helper470-twin-rung-removal' +PRED = ROOT/'research/p104-unread-rung-independent-audit' +CONTROLLER = ROOT/'research/p104-productive-controller/CONTROLLER.json' +CLIFFORD = ROOT/'research/p104-native-channel/vendor/clifford_exact.py' +LITERAL = ROOT/'research/p104-native-channel/vendor/native_verify.py' +DENSE = ROOT/'research/p104-contact-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/check.py' + + +def log(kind, **data): + print(kind, json.dumps(data, sort_keys=True, default=str)[:300], flush=True) + + +def need(ok, why): + if not ok: + raise ValueError(why) + + +def read(path): + raw = Path(path).read_bytes() + return json.loads(gzip.decompress(raw) if str(path).endswith('.gz') else raw) + + +def authenticate(): + for row in read(HERE/'SOURCES.json')['files']: + if row['usage'] == 'input': + need(sha256((ROOT/row['path']).read_bytes()).hexdigest() == row['sha256'], 'source pin '+row['path']) + + +# ---------------------------------------------------------------- layer 0 +def layer0(): + pinned = (P30/'inputs/pr5907-WORD.json.gz').read_bytes() + canon = (P07/'WORD.json.gz').read_bytes() + need(gzip.decompress(pinned) == gzip.decompress(canon), 'PR6030 pinned PR5907 word equals canonical main payload') + need((P30/'inputs/pr5827-source.tar').read_bytes() == (P07/'inputs/pr5827-source.tar').read_bytes(), + 'PR6030 PR5827 archive equals the one pinned in PR5907') + spec = importlib.util.spec_from_file_location('a6030_construct', P30/'construct.py') + K = importlib.util.module_from_spec(spec); spec.loader.exec_module(K) + rebuilt = K.construct(read(P07/'WORD.json.gz'), read(P30/'EDIT.json.gz')) + # own serialization of the regenerated word, compared byte for byte with the decompressed shipped payload + own = (json.dumps(rebuilt, sort_keys=True, indent=2)+'\n').encode() + need(own == gzip.decompress((P30/'WORD.json.gz').read_bytes()), 'regenerated PR6030 word equals the shipped payload bytes') + out = {'pinned_pr5907_payload_equal_canonical': pinned == canon or 'payload_only', + 'pr5827_archive_equal_pr5907_pin': True, 'pr6030_regenerated_word_equal': True} + log('L0', **out) + return out + + +# ---------------------------------------------------------------- layer 1: own replay +def span(basis): + s = {0} + for v in basis: + need(type(v) is int and 0 < v < 512 and v not in s, 'independent binary basis') + s |= {x ^ v for x in s} + return frozenset(s) + + +def replay(w, name): + S = [span(f) for f in w['frames']] + n, m = w['public'], w['owned_fields'] + live = set(w['live']) + cur = list(w['initial'])+[None]*m + rows = [{r: Q(1)} for r in range(n+m)] + owned, paid, peak, lifetimes = set(), Counter(), 0, 0 + ops = Counter() + for i, e in enumerate(w['program']): + op, r = e[0], e[1] + ops[op] += 1 + need(0 <= r < n+m, 'role index at %d' % i) + if op == 'MOVE': + a, b, private = e[2], e[3], e[4] + need(cur[r] == a and (r in owned) == private, 'transport source/ownership at %d' % i) + need(S[b] < S[a] if private else S[a] < S[b], 'strict nesting at %d' % i) + paid[abs(len(w['frames'][b])-len(w['frames'][a]))] += 1 + cur[r] = b + elif op == 'INIT': + need(r >= n and r not in owned, 'owned init at %d' % i) + owned.add(r); lifetimes += 1 + peak = max(peak, len(owned)) + rows[r], cur[r] = {}, e[2] + elif op == 'CLEAR': + need(r in owned and cur[r] == e[2], 'owned erasure at %d' % i) + owned.discard(r) + rows[r], cur[r] = {}, None + else: + q, f = Q(e[-2]), e[-1] + need(q != 0 and cur[r] == f, 'destination chart at %d' % i) + d = q.denominator + need(d & (d-1) == 0, 'dyadic coefficient at %d' % i) + if op == 'SCALE': + rows[r] = {k: q*v for k, v in rows[r].items()} + else: + s = e[2] + need(s != r and 0 <= s < n+m and cur[s] == f, 'common chart at %d' % i) + if op == 'COPY': + need(r in owned and not rows[r], 'COPY into cleared owned field at %d' % i) + rows[r] = {k: q*v for k, v in rows[s].items()} + else: + need(op == 'ADD', 'opcode at %d' % i) + t = dict(rows[r]) + for k, v in rows[s].items(): + t[k] = t.get(k, 0)+q*v + rows[r] = {k: v for k, v in t.items() if v} + need(not owned and cur[:n] == w['final'], 'public and owned exits') + for r in range(n+m): + expected = {r: Q(1)} if r < n else {} + if r-112 in live: + expected[r-112] = Q(1) + need(rows[r] == expected, 'endpoint row %d' % r) + main = live | {r+112 for r in live} + helpers = Counter() + for r in range(n): + if r in main: + continue + a, b = w['initial'][r], w['final'][r] + need(S[a] < S[b], 'helper %d initial span strictly inside final span' % r) + helpers[len(w['frames'][b])-len(w['frames'][a])] += 1 + out = {'events': len(w['program']), 'ops': dict(ops), 'public': n, 'owned_fields': m, 'owned_lifetimes': lifetimes, + 'peak_owned': peak, 'paid': {str(k): v for k, v in sorted(paid.items())}, + 'helpers': {str(k): v for k, v in sorted(helpers.items())}, 'helper_count': sum(helpers.values()), + 'endpoint_rows': n+m, 'paid_rank_mass': sum(k*v for k, v in paid.items())} + log('L1_replay', word=name, **out) + return paid, helpers, S, out + + +def diff(a, b): + c = Counter(a); c.subtract(b) + return {str(k): v for k, v in sorted(c.items()) if v} + + +def itineraries(w): + n = w['public'] + it = {r: [w['initial'][r] if r < n else None] for r in range(n+w['owned_fields'])} + for e in w['program']: + if e[0] == 'MOVE': + it[e[1]].append(e[3]) + elif e[0] == 'INIT': + it[e[1]].append(['INIT', e[2]]) + return it + + +ITINERARIES = { # PR6030 README, "The edit" + '115': [[3, 105], [3, 189]], + '127': [[3, 602, 637, 643, 646, 649, 141], [3, 595, 637, 643, 646, 649, 141]], + '470': [[3, 593, 714, 875, 1001, 131, 127], [3, 714, 875, 1001, 131, 127]], + '704': [[3, 593, 612, 127], [3, 593, 714, 127]], + '713': [[3, 394], [76, 394]], + '736': [[424, 127], [749, 127]], +} + + +def layer1(words): + res = {} + rp = {k: replay(w, k) for k, w in words.items()} + for k in rp: + res[k] = rp[k][3] + w0, w1 = words['5907'], words['6030'] + need(w0.keys() == w1.keys(), 'same word fields') + need(all(w0[k] == w1[k] for k in w0 if k not in ('program', 'initial', 'final')), 'frames, ports, live and sizes unchanged') + bchg = {k: {str(r): [w0[k][r], w1[k][r]] for r in range(w0['public']) if w0[k][r] != w1[k][r]} for k in ('initial', 'final')} + need(bchg == {'initial': {'713': [3, 76], '736': [424, 749]}, 'final': {'115': [105, 189]}}, + 'PR6030 boundary changes exactly as declared: %s' % bchg) + i0, i1 = itineraries(w0), itineraries(w1) + changed = {str(r): [i0[r], i1[r]] for r in i0 if i0[r] != i1[r]} + need(changed == ITINERARIES, 'exactly the six declared itineraries change: %s' % changed) + ms = lambda w, keep: Counter(json.dumps(e) for e in w['program'] if keep(e)) + for op in ('INIT', 'CLEAR', 'COPY'): + need(ms(w0, lambda e: e[0] == op) == ms(w1, lambda e: e[0] == op), op+' events unchanged as a multiset') + other = lambda e: e[0] == 'MOVE' and str(e[1]) not in ITINERARIES + need(ms(w0, other) == ms(w1, other), 'every MOVE outside the six itineraries unchanged as a multiset') + d, h = diff(rp['6030'][0], rp['5907'][0]), diff(rp['6030'][1], rp['5907'][1]) + expect = read(P30/'EXPECT.json') + need(d == expect['paid_delta'] and h == expect['helper_delta'], 'PR6030 deltas %s %s' % (d, h)) + margin = Counter({int(k): v for k, v in h.items()}); margin.subtract({int(k): v for k, v in d.items()}) + need(+margin == Counter({1: 1, 3: 1}) and -margin == Counter({4: 1}), 'per-LOCAL margin change is H1 + H3 - H4: %s' % margin) + ranks = {r: [len(w0['frames'][w0['final'][r]])-len(w0['frames'][w0['initial'][r]]), + len(w1['frames'][w1['final'][r]])-len(w1['frames'][w1['initial'][r]])] for r in (115, 713, 736)} + need(len(w1['program']) == expect['events'] <= 26000, 'event count and cap') + o = res['6030'] + need([o['public'], o['owned_fields'], o['owned_lifetimes'], o['peak_owned']] == expect['inventory'], 'storage inventory') + for k, P in (('5907', P07), ('6030', P30)): # own replay statistics against each author's RESULT local block + a, o = read(P/'RESULT.json')['local'], res[k] + need([a['paid'], a['helpers'], a['paid_rank_mass'], a['public_inputs'], a['owned_fields'], a['owned_lifetimes'], a['peak_owned_fields']] == + [o['paid'], o['helpers'], o['paid_rank_mass'], o['public'], o['owned_fields'], o['owned_lifetimes'], o['peak_owned']], + 'own replay statistics equal author local block '+k) + # registers whose event sequence (any opcode) differs, for the record + seq = lambda w: {r: [json.dumps(e) for e in w['program'] if e[1] == r or (e[0] in ('ADD', 'COPY') and e[2] == r)] for r in range(w['public']+w['owned_fields'])} + s0, s1 = seq(w0), seq(w1) + res['delta_5907_6030'] = {'boundary_changes': bchg, 'itineraries': changed, 'paid_delta': d, 'helper_delta': h, + 'margin_delta_per_local': {str(k): v for k, v in sorted(margin.items()) if v}, + 'changed_helper_ranks': {str(k): v for k, v in ranks.items()}, + 'ops_delta': diff(Counter(e[0] for e in w1['program']), Counter(e[0] for e in w0['program'])), + 'events': [len(w0['program']), len(w1['program'])], + 'registers_with_changed_event_sequence': sum(s0[r] != s1[r] for r in s0)} + log('L1_delta_6030', **res['delta_5907_6030']) + return res, rp + + +# ---------------------------------------------------------------- layer 2: invoice +def invoice(paid_local, helpers_local): + c = read(CONTROLLER) + ev = Counter(e[0] for e in c['physical_events']) + need(ev['LOCAL'] == 18 and ev['QUERY_SHEAR'] == 15 and ev['IDLE'] == 15, 'caller census') + need(all(e[3] is False for e in c['physical_events'] if e[0] == 'LOCAL'), 'forward local calls') + P, T = Counter(), Counter() + for e in c['physical_events']: + if e[0] == 'LOCAL': + P.update(paid_local); T.update(helpers_local) + elif e[0] == 'QUERY_SHEAR': + P[1] += 104 + elif e[0] == 'IDLE': + P[8*len(e[2])] += 208 + for term in c['diagonal']: + T[1+8*sum(term[1:])] += 104 + # closed formula of PR5827 PROOF.md, computed separately + P2 = Counter({r: 18*v for r, v in paid_local.items()}); T2 = Counter({r: 18*v for r, v in helpers_local.items()}) + P2[1] += 1560; T2[145] += 208 + for L in (7, 8): + for j in range(1, L+1): + P2[8*(j+1)] += 208; T2[1+8*(j+1)] += 208 + need((+P, +T) == (+P2, +T2), 'event invoice equals closed formula') + return P, T + + +def layer2(rp, results): + out = {} + for k in ('5907', '6030'): + P, T = invoice(rp[k][0], rp[k][1]) + cost = results[k]['complete_cost'] + AP = Counter({int(r): v for r, v in cost['paid'].items()}); AT = Counter({int(r): v for r, v in cost['targets'].items()}) + need((+P, +T) == (+AP, +AT), 'own invoice equals author complete_cost for '+k) + surplus = sum(r*v for r, v in T.items())-sum(r*v for r, v in P.items()) + out[k] = {'paid_calls': sum(P.values()), 'productive_fields': sum(T.values()), 'rank_mass_surplus': surplus, + 'max_paid_rank': max(P), 'max_target_rank': max(T)} + log('L2_invoice', word=k, **out[k]) + e = read(P30/'EXPECT.json') + need([out['6030'][x] for x in ('paid_calls', 'productive_fields', 'rank_mass_surplus')] == + [e['paid_calls'], e['productive_fields'], e['rank_mass_surplus']], 'PR6030 headline invoice') + return out + + +# ---------------------------------------------------------------- layer 4: funding +def layer4(results): + getcontext().prec = 80 + pad = Decimal(10)**-70 + out = {} + for k in ('5907', '6030'): + cost = results[k]['complete_cost'] + + def margin(kap): + t, lo, hi = 1-kap, Decimal(0), Decimal(0) + for r, n in cost['targets'].items(): + v = (t*Decimal(int(r)).ln()).exp(); lo += n*v*(1-pad); hi += n*v*(1+pad) + for r, n in cost['paid'].items(): + v = (t*Decimal(int(r)).ln()).exp(); lo -= n*v*(1+pad); hi -= n*v*(1-pad) + return lo, hi + lo, hi, grid = 0, 10**12, 10**14 + while hi-lo > 1: + m = (lo+hi)//2 + if margin(Decimal(m)/grid)[0] > 0: + lo = m + else: + hi = m + need(margin(Decimal(lo)/grid)[0] > 0 and margin(Decimal(hi)/grid)[1] < 0, 'strict crossing '+k) + author = [Q(x) for x in cost['raw_root_interval']] + need([Q(lo, grid), Q(hi, grid)] == author, 'crossing equals author interval '+k) + claim, tested = Q(cost['kappa']), Q(cost['strictification']['tested']) + sgn = lambda x: 'positive' if margin(Decimal(x.numerator)/Decimal(x.denominator))[0] > 0 else 'negative/undecided' + need(claim < tested < Q(lo, grid) and sgn(tested) == 'positive', 'claim < tested < crossing, tested positive '+k) + out[k] = {'raw_crossing': [str(Q(lo, grid)), str(Q(hi, grid))], 'raw_crossing_decimal': [str(Decimal(lo)/grid), str(Decimal(hi)/grid)], + 'claim': str(claim), 'tested': str(tested), 'tested_sign': sgn(tested), 'equals_author': True} + log('L4_funding', word=k, **out[k]) + # charged tail ratios of the strictification at the tested saving, recomputed in decimal + for k in ('5907', '6030'): + cost = results[k]['complete_cost'] + st = cost['strictification'] + tested, u, c, b = Decimal(str(Q(st['tested']).numerator))/Decimal(Q(st['tested']).denominator), Decimal(1)/7, 16, 17 + need(Q(st['tail_offset']) == Q(1, 7) and int(st['cutoff']) == c and int(st['floor']) == b, 'strictification constants '+k) + pw = lambda r, x: (x*Decimal(int(r)).ln()).exp() + t = 1-tested + MT = sum(n*pw(r, t) for r, n in cost['targets'].items()) + MP = sum(n*pw(r, t) for r, n in cost['paid'].items()) + MPu = sum(n*pw(r, t+u) for r, n in cost['paid'].items()) + alpha, gamma = MP/MT, MPu/(pw(c, u)*MT) + delta = sum(cost['targets'].values())*b/(pw(c, tested)*MT) + lim = Decimal(125)/128 + need(alpha < 1-Decimal(10)**-12 and gamma < lim and delta < lim, 'tail ratios '+k) + # uniqueness of the raw crossing on [0, .0034]: d/dk margin < 0 there (bound each term at its worst end) + dmax = Decimal(0) + for side, sgn in (('targets', -1), ('paid', 1)): + for r, n in cost[side].items(): + lr = Decimal(int(r)).ln() + worst = pw(r, 1-Decimal('0.0034')) if sgn < 0 else pw(r, Decimal(1)) + dmax += sgn*n*lr*worst + need(dmax < 0, 'raw margin strictly decreasing on [0,.0034] '+k) + out[k].update(alpha=str(alpha)[:22], gamma=str(gamma)[:22], delta=str(delta)[:22], derivative_upper=str(dmax)[:22]) + log('L4_tails', word=k, alpha=str(alpha)[:22], gamma=str(gamma)[:22], delta=str(delta)[:22], derivative_upper=str(dmax)[:22]) + g = Q(results['6030']['complete_cost']['kappa'])-Q(results['5907']['complete_cost']['kappa']) + out['claim_gain_6030_over_5907'] = str(g) + log('L4_gain', gain=str(g), gain_float=float(g)) + return out + + +# ---------------------------------------------------------------- layer 3: dense native +_M = {} + + +def _load(name, path): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +def _init(frames): + _M['C'] = _load('a6030_clifford', CLIFFORD) + _M['V'] = _load('a6030_literal', LITERAL) + _M['D'] = _load('a6030_dense', DENSE) + _M['F'] = frames + + +def compare(actual, expected, rank): + D = _M['D'] + a, b = D.compile_circuit(actual), D.compile_circuit(expected) + h = sha256() + for column in range(512): + left, right = D.dense_column(a, column), D.dense_column(b, column) + need(left == right, 'exact complex column %d' % column) + re, im, d = left + need(sum(v*v for v in re)+sum(v*v for v in im) == 1 << (2*d), 'exact column norm') + need(sum(bool(x or y) for x, y in zip(re, im)) == 1 << rank, 'measured child rank') + h.update(json.dumps([column, d, re, im], separators=(',', ':')).encode()) + return h.hexdigest() + + +def dense_task(task): + C, V, F = _M['C'], _M['V'], _M['F'] + kind, a, b, q = task + if kind in ('move', 'helper'): + rec, _ = C.lower_child(C.canonical_frame(9, tuple(F[a])).adjoint().then(C.canonical_frame(9, tuple(F[b])))) + rank = abs(len(F[a])-len(F[b])) + need(rec['rank'] == rank, 'lowered rank') + out = [list(task), rank, compare(V.recipe(rec), V.adjoint(V.frame(F[a], 9))+V.frame(F[b], 9), rank)] + else: + if kind == 'main_in': + op, expected = C.cgate(9, q, 1).adjoint().then(C.canonical_frame(9, tuple(F[a]))), V.adjoint((('C', q, 1),))+V.frame(F[a], 9) + else: + op, expected = C.canonical_frame(9, tuple(F[a])).adjoint().then(C.cgate(9, q, -1).then(C.fourier(9))), V.adjoint(V.frame(F[a], 9))+(('C', q, -1),)+V.fourier(9) + rec, _ = C.lower_child(op) + need(rec['rank'] == 0, 'intrinsic adapter is monomial') + out = [list(task), 0, compare(V.recipe(rec), expected, 0)] + return out + + +def inventory(w): + live = set(w['live']) + main = live | {r+112 for r in live} + moves = {(e[2], e[3]) for e in w['program'] if e[0] == 'MOVE'} + helpers = {(w['initial'][r], w['final'][r]) for r in range(w['public']) if r not in main} + tasks = {('move', a, b, 0) for a, b in moves} | {('helper', a, b, 0) for a, b in helpers} + tasks |= {('main_in', w['initial'][r], 0, q) for r, q in zip(w['live'], w['ports'])} + tasks |= {('main_out', w['final'][r+112], 0, q) for r, q in zip(w['live'], w['ports'])} + return tasks, len(moves), len(helpers) + + +def layer3(words, full, jobs): + need(words['6030']['frames'] == words['5907']['frames'], 'shared frame table') + tasks, nmoves, nhelpers = inventory(words['6030']) + old, _, _ = inventory(words['5907']) + tasks = sorted(tasks) + reference = {json.dumps(d[0]): d for d in read(PRED/'FULL-CHECK.json')['maps']} + new = sorted(t for t in tasks if json.dumps(list(t)) not in reference) + need(set(new) == set(tasks)-old and not set(new) & old, 'every map outside FULL-CHECK is new in PR6030') + covered = [t for t in tasks if json.dumps(list(t)) in reference] + moves = [t for t in covered if t[0] == 'move'] + adapters = [t for t in covered if t[0] in ('main_in', 'main_out')] + chosen = tasks if full else sorted(set(new) | {t for t in covered if t[0] == 'helper'} | set(adapters[::8]) | set(moves[::64])) + if jobs > 1: + with Pool(jobs, initializer=_init, initargs=(words['6030']['frames'],)) as pool: + done = pool.map(dense_task, chosen, chunksize=4) + else: + _init(words['6030']['frames']) + done = [dense_task(t) for t in chosen] + done = [json.loads(json.dumps(d)) for d in done] + fresh = {json.dumps(d[0]): d for d in done if json.dumps(d[0]) not in reference} + need(sorted(fresh) == sorted(json.dumps(list(t)) for t in new), 'every new map computed') + for d in done: + k = json.dumps(d[0]) + if k in reference: + need(reference[k] == d, 'matrix digest equals predecessor FULL-CHECK for '+k) + newmaps = HERE/'NEW-MAPS.json' + if newmaps.exists() and '--write' not in sys.argv: + need(read(newmaps)['maps'] == sorted(fresh.values()), 'new-map digests equal NEW-MAPS.json') + # rejection controls on a new map + _init(words['6030']['frames']) + C, V, D, F = _M['C'], _M['V'], _M['D'], _M['F'] + nm = [t for t in new if t[0] in ('move', 'helper') and abs(len(F[t[1]])-len(F[t[2]])) > 0] + _, a, b, _ = nm[0] + rec, _ = C.lower_child(C.canonical_frame(9, tuple(F[a])).adjoint().then(C.canonical_frame(9, tuple(F[b])))) + actual, expected = V.recipe(rec), V.adjoint(V.frame(F[a], 9))+V.frame(F[b], 9) + fault = actual+(('phase', 1),) + need(V.tableau(fault) == V.tableau(actual) and D.first_difference(fault, expected) is not None, 'phase-only fault rejected densely') + flipped = list(actual) + i = next(i for i, g in enumerate(flipped) if g[0] == 'C') + flipped[i] = ('C', flipped[i][1], -flipped[i][2]) + need(D.first_difference(tuple(flipped), expected) is not None, 'wrong child sign rejected') + signed = len({(t[1], t[2]) for t in tasks if t[0] in ('move', 'helper')}) + an = read(P30/'RESULT.json')['native'] + w = words['6030'] + need([signed, 2*(w['public']-2*len(w['live'])), 2*len(w['live'])] == [an['distinct_maps'], an['helper_normalizers'], an['main_adapters']], + 'distinct signed maps, helper normalizers and main adapters equal the author native block') + out = {'tasks': len(tasks), 'distinct_moves': nmoves, 'distinct_helper_pairs': nhelpers, 'distinct_signed_maps': signed, + 'covered_by_predecessor_full_check': len(covered), 'new_in_pr6030': [d[0]+[d[1]] for d in sorted(fresh.values())], + 'control_map': [a, b], 'controls': {'phase_only_fault': 'rejected', 'wrong_child_sign': 'rejected'}, + 'predecessor_full_check_sha256': sha256((PRED/'FULL-CHECK.json').read_bytes()).hexdigest()} + log('L3_dense', checked=len(done), of=len(tasks), new=len(new), full=full) + return out, sorted(fresh.values()) + + +def tamper_controls(words): + """Each mutated PR6030 word must be rejected by the own replay or the declared delta.""" + from copy import deepcopy + w0, w1 = words['5907'], words['6030'] + + def first(w, op, r): + return next(i for i, e in enumerate(w['program']) if e[0] == op and e[1] == r) + + def flip(w): + e = w['program'][first(w, 'ADD', 268)]; e[-2] = str(-Q(e[-2])) + + def drop(w): + del w['program'][first(w, 'ADD', 470)] + + def third(w): + e = next(x for x in w['program'] if x[0] == 'SCALE'); e[-2] = str(Q(e[-2])/3) + + def restore(w): + w['final'][115] = 105 + + def rung(w): # put back helper 470's frame-593 rung by retargeting its first MOVE + e = w['program'][first(w, 'MOVE', 470)]; e[3] = 593 + out, quiet = {}, globals()['log'] + globals()['log'] = lambda *a, **k: None + try: + for name, mut in (('flip_add_sign_helper268', flip), ('drop_add_into_helper470', drop), ('scale_by_one_third', third), + ('restore_final_115_chart', restore), ('retarget_helper470_move_to_593', rung)): + w = deepcopy(w1); mut(w) + try: + layer1({'5907': w0, '6030': w}); out[name] = 'ACCEPTED' + except ValueError as e: + out[name] = 'rejected: '+str(e).split(':')[0] + finally: + globals()['log'] = quiet + need(all(v.startswith('rejected') for v in out.values()), 'tamper controls %s' % out) + log('L1_controls', **out) + return out + + +def main(): + full = '--full' in sys.argv + jobs = int(sys.argv[sys.argv.index('--jobs')+1]) if '--jobs' in sys.argv else 1 + authenticate() + words = {'5907': read(P07/'WORD.json.gz'), '6030': read(P30/'WORD.json.gz')} + results = {'5907': read(P07/'RESULT.json'), '6030': read(P30/'RESULT.json')} + out = {'layer0_sources': layer0()} + out['layer1_replay'], rp = layer1(words) + out['layer1_replay']['tamper_controls'] = tamper_controls(words) + out['layer2_invoice'] = layer2(rp, results) + out['layer4_funding'] = layer4(results) + out['layer3_dense'], fresh = layer3(words, full, jobs) + if '--write' in sys.argv: + (HERE/'NEW-MAPS.json').write_text(json.dumps({'schema': 'p104-6030-new-dense-maps/1', 'maps': fresh}, separators=(',', ':'))+'\n') + out['layer3_dense']['new_maps_sha256'] = sha256((HERE/'NEW-MAPS.json').read_bytes()).hexdigest() + out['mode'] = 'full' if full else 'subset' + out = json.loads(json.dumps(out, sort_keys=True, default=str)) + out.pop('mode') + if '--write' in sys.argv: + (HERE/'RESULT.json').write_text(json.dumps(out, indent=1, sort_keys=True)+'\n') + else: + need(out == read(HERE/'RESULT.json'), 'complete result equals RESULT.json') + print('PASS_P104_6030_INDEPENDENT_AUDIT', 'full' if full else 'subset') + + +if __name__ == '__main__': + main()