diff --git a/research/fixed-dimension-bit-coefficients/CHECKPOINT.md b/research/fixed-dimension-bit-coefficients/CHECKPOINT.md new file mode 100644 index 0000000000..67eacc5297 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/CHECKPOINT.md @@ -0,0 +1,67 @@ +# Local recovery trail and author verification checkpoint + +Base: e54523517d0f03e58352e647c403a5af3e525a57. +Branch: research/continuous-20261110-bit-history. +Package: research/fixed-dimension-bit-coefficients. +Initial WIP commit: aaca699b. It was explicitly unverified and not offered for +publication. The later author checkpoint below supersedes its draft status; +no selected result is updated, and independent review is a separate gate. + +Implemented: 17 authenticated specialization sites over the four #6903 +encoded numerical modules; one exclusive four-tape continuation Workspace; +explicit source-arena/record historical bounds; separate small-block modular +oracle and pre-guard demand observer. + +Executed coverage before this checkpoint: + +* N=2,w=1,depth 0: exact coefficient 2; residue/index pending 28/11. +* N=3,w=2,descriptor GUPG: coefficient 8; pending 59/18. +* N=65,w=2,depth 0: coefficient 8; all 4,225 field digits read; pending 16,912/11. +* N=130,w=1,depth 0: coefficient 2; target row 129 crosses the historical + multiplier cap; all 16,900 field digits read; pending 67,612/11. +* Earlier exploratory controls rejected insufficient capacity, a wrong global + field code and a truncated field. A GUPG call repeated four times used the + same four continuation Tape identities and retained erased backing. + +At the initial WIP checkpoint the proof was a draft. Missing then: +the final registered verifier/receipt, full boundary-control suite, complete +package metadata/attribution/overlap report and independent review. The +selected source label generation, root-size map, literal table lowering and +changing-precision physical bank are explicitly outside the proved seam. + +Reproduce one current positive fixture: + + python3 -B research/fixed-dimension-bit-coefficients/check_consumer.py + +Next command after completing the verifier: + + python3 -B scripts/research_package.py --package research/fixed-dimension-bit-coefficients + +The initial scaffold verify.py intentionally exited DRAFT. That scaffold is +now replaced by the actual read-only verifier. + +## Author verification completed after the WIP + +The final registered normal/optimized replay passed fourteen positive cases, +ten runtime controls and the isolated Git-free three-corruption suite. The +typed mathematical receipt digest is +`afd86ba5470b877b6cad58a86fe26a58d98bb7e81129be4f1db47fd1a285a39a`. +Exact executed commands and limitations are in VALIDATION.md. Added tests +include N=44/rank43, a halved Unit, a dead earlier global-code mismatch, +full warm erased slots and normal exclusive Workspace reuse. + +The supported entry is Workspace.open. The untouched legacy selected_offset +wrapper does not pass borrowed stack roles and is outside the contract. +Review clarified the linear current-handle contract: closed/aborted callbacks +cannot be reused after a later open, and no physical stale-generation service +is claimed. This changes the stated scope only; numerical source and receipt +are unchanged. +Scientific proof and implementation are frozen for independent review; only +explicitly reported review fixes should change them. Root coordinates review, +publication and a separate durable recovery-branch snapshot. No push or PR +creation is performed by this worker. + +Next action: integrate the independent review if it passes, rerun affected +registered checks and the committed-byte preflight, then let the root publish +the verified package. In parallel this worker cross-reviews the separate +encoded-balanced-crt-entry package under the root's Wave-2 assignment. diff --git a/research/fixed-dimension-bit-coefficients/NOTICE.md b/research/fixed-dimension-bit-coefficients/NOTICE.md new file mode 100644 index 0000000000..69ea321210 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/NOTICE.md @@ -0,0 +1,31 @@ +# Attribution and inherited scope + +New explicit dimension specialization, fixed continuation Workspace, scoped +source-arena proof, exact checks and package: prepared for @CubeJerry with +substantial OpenAI Codex assistance. New material is Apache-2.0. A source-aware +AI cross-review is separate from the author checks; no independent human or +formal-kernel acceptance is implied. + +Jose Manuel (@jmbarrancoml) supplied the binary word arithmetic, matrix +preparation, records and Good/Pair/Unit evaluator retained through #2697/#2809 +and copied in #6903. This package authenticates and specializes those live +canonical files, preserving their comments. The complete retained source +notice is pinned at +`research/delayed-cover-chronological-fields/numerical/NOTICE.md`; its parent +NOTICE.md is also pinned. Their source527, commdata2338, Ross Richardson, +Douglas Colkitt/OpenAI, and earlier word/hosting credits remain applicable. + +Ross Richardson's #2835 supplies the first-failed-allocation proof method and +the credited primitive effects, following Nick Petalas's #2759/#2770/#2778/ +#2781 and Arham Tahir's #2796 lifetime results. No new sharp N=64 inventory is +claimed. #5404 supplies the distinction between current live arrays and +retained backing. #6896 proves a separate actual recursive N=64 numerical +capacity theorem, and #6879 a source-specific ordinary helper space theorem. + +The chronological field producer is credited to #6903, Ali Romman's #5829 +whole-high geometry, thu-nmrc's #6719 physical recursion and David Arias's +#2776 machine lineage. This package preserves the entire format and original +source labels; it does not claim to have executed its new numerical consumer +inside that producer's literal ready port. The completed current BIT base +remains the query-thinned `.0034` lineage, with its actual source generation +and five foundational assumptions retained. diff --git a/research/fixed-dimension-bit-coefficients/OVERLAP.md b/research/fixed-dimension-bit-coefficients/OVERLAP.md new file mode 100644 index 0000000000..cc3b0712f5 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/OVERLAP.md @@ -0,0 +1,36 @@ +# Scope, overlap and source selection + +Scientific base: e54523517d0f03e58352e647c403a5af3e525a57. The orchestrator +supplied the canonical selected state, live PR snapshots and nonoverlapping +assignment. The first wave's stratified reserve theorem remains a separate +package; this package does not import it as an established selected layout. + +| Predecessor | Established scope retained here | What this package adds | +| --- | --- | --- | +| #6903, delayed-cover-chronological-fields | Generic-N literal field producer; full chronological labels; N=64 numerical join only | Concrete arbitrary-fixed-N specialization of its retained numerical consumer and four-tape reentry contract | +| #2835, selected-coefficient-capacity-prefix | N=64 closed coefficient pending-demand proof, including warm histories and first failed allocation | Source-site conservative N-parametric demand for the new specialization; no sharp old constant claimed | +| #6896, recursive-physical-capacity-prefix | Fixed N=64 source numerical inventory across actual recursive cuts | No whole-recursion replacement; keeps actual varying-precision and all historical caller records outside the local theorem | +| #6879, ordinary-bit-retained-space | Source-bound retained ordinary helper with its local domain | Addresses a concrete coefficient component it leaves open; does not identify that helper with the current `.0034` base | +| #5404, continuation-retained-backing | Separate historical maxima and concrete continuation role obligations | Explicit actual Workspace reuses four tapes; exact full-prefix and stack bills for this specialization | +| selected-binary-control and #2697 source lineage | Encoded arithmetic, matrices, Good/Pair/Unit semantics and index operations at N=64 | Seventeen finite-dimension/interface edits, including the separate 128 finite-multiplier guard | +| #4440/#4470 query-thinned controller lineage | Completed conditional ordinary `.0034` BIT interface | No replacement construction; distinguishes its unspecified huge fixed dimension from the old 64-dimensional implementation | + +Source inspection specifically excludes re-publication of the generic peak +versus history principle, local CLEAR semantics, the raw 54/43 lifetime census, +whole-high V/L child geometry, and the existing N=64 capacity constants. Those +results are credited and used only where their exact interfaces apply. + +The bounded live overlap lookup included PR searches for `"parametric" +"Callback"` (the returned #5164 concerned setup rollback) and +`"N-dimensional" "encoded"` (no matching PR returned). The root also supplied +the current sprint/PR claims. Absence from these queries is not proof of +novelty; the concrete comparison is with the source/domain statements above. +Later merged work must be checked by the publication coordinator before a +remote branch is offered for review. + +The first claim was narrowed from the full `.0034` historical per-tape B₀ +contract: that source-specific mapping is not currently supplied by the +retained implementation. The accepted scope is the concrete dimensional +consumer seam and its source-arena proof, with all label/dispatcher/physical +bank obligations visible. This is partial assumption-directed progress and +does not assert an unconditional multiplication theorem or a changed κ. diff --git a/research/fixed-dimension-bit-coefficients/PR-DESCRIPTION.md b/research/fixed-dimension-bit-coefficients/PR-DESCRIPTION.md new file mode 100644 index 0000000000..5dbe848f26 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/PR-DESCRIPTION.md @@ -0,0 +1,90 @@ +## Why this is needed + +The selected #7000 application reaches a completed `.0034` BIT interface whose +compiler dimension is large and fixed. The chronological whole-high producer +in #6903 already handles arbitrary fixed N, but its actual numerical join is +explicitly N=64. The existing #2835/#6896 capacity theorems also pin that old +dimension. A generic claim that preparation is finite-dimensional does not +supply the matching encoded consumer or its retained physical roles. + +## Exact contribution + +This package authenticates and specializes the four retained encoded +Callback/Fields/Matrices/words modules with 17 explicit edits for each fixed +N≥2. Runtime values remain binary words; all N² high digits and original +global source labels are preserved. One Workspace supplies the same four +continuation tapes on each closed reentry. +Only the current live callback handle is valid; closed/aborted handles are +retired permanently. No stale-handle generation service is claimed. + +The written proof establishes exact Good/Pair/Unit and coefficient semantics, +pending demand of at most `16N²+128` residue and `128` index Words over **all** +entry residents before the first capacity guard, and explicit full-prefix and +separate historical-tape bounds. Every admitted descriptor contracts by at +least `(N−1)/N`. The full local consumer bill is polynomial in w and its actual root +size; absorption by `q^(ceil(e^.004)-1)` is conditional on a proved `root_size≤e` +coupling and the actual number of calls per fibre. + +Base: `e54523517d0f03e58352e647c403a5af3e525a57`. Exact live-source SHA256 and Git +blob pins are in SOURCES.json. No predecessor source or selected record changes. + +## Novelty and credit + +#6903 supplies the generic-N field producer and predecessor module bytes; +#2835 supplies the noncircular prefix method; #5404 supplies the historical +backing distinction. #6879/#6896 remain separate source-specific helper and +recursive results. The new result is the implemented dimensional consumer +and its precise per-call/fixed-arena history contract, not those earlier +general principles or an increased N=64 constant. + +Prepared for @CubeJerry with substantial OpenAI Codex assistance. Credit Jose +Manuel (@jmbarrancoml) for the retained numerical source lineage, Ross +Richardson for #2835, Nick Petalas and Arham Tahir for its lifetime inputs, +and #5829/#6719/#6903's authors for the chronological whole-high interface. +NOTICE.md retains the broader source attribution. + +## Reproduction and failure detection + +```sh +python3 -B scripts/research_package.py --package research/fixed-dimension-bit-coefficients +``` + +Normal and optimized modes compare the complete typed receipt. The exact +oracle uses signed-permutation determinants/cofactors on dense N=2/3 fields +and a closed block formula for the larger dimensions. Cases cover widths +1/2/3, mixed Good/Pair/Unit histories, reversed Pair, inverse offset, leaf +calls, a halved Unit, erased warm backing and repeated reuse of the same Tape +identities. N=44/rank43 crosses the old rank guard; N=65 tests all 4,225 field +digits; N=130 tests all 16,900 and target row 129. + +Controls reject wrong chronological labels, truncated fields, actual capacity +exhaustion, the old 64² reader and rank-42 guard, the separate old 128 multiplier +guard and fresh continuation tape creation. An isolated Git-free mirror rejects source-byte, +typed-receipt and pending-budget corruption. Finite examples corroborate the +written universal proof; they do not exhaust the selected source catalogue. + +## Limitations and κ status + +**No new κ.** All five foundational assumptions and the selected bound remain +conditional. The actual `.0034` catalogue/label generator and root map, +literal finite-table join, arbitrary changing-R/I physical bank and complete +caller stock/history composition remain open. Entry allocated history and +all live residents are charged explicitly. This theorem does not turn one +fixed arena's slot bound into a varying-precision physical bank or erase +other retained ancestor/producer/payload owners from the full source bill. + +The package is a narrowly scoped compiler/ownership enabling lemma. It claims +no formal-kernel or independent human proof, selected cold replay, complete +multiplier implementation, or unconditional asymptotic improvement. + +## Separate review + +A separate worker independently derived semantic and capacity obligations +using rank-two I-J/3 and permutation projectors,14 exact generated-weight, +coefficient and offset calls, and original17-bit labels. Normal and optimized +checks pass10 finite-dimension boundaries, three actual larger constructors, +816 footprint comparisons and12 controls. The four actual continuation tapes +retain complete histories across reentry. The review detects the absence of +stale-handle generation guards and admits only the clarified current-callback +linear-use contract. See independent-review/REVIEW.md for source/proof pins, +independent derivations and limits. No human or proof-kernel acceptance is claimed. diff --git a/research/fixed-dimension-bit-coefficients/PR-TITLE.txt b/research/fixed-dimension-bit-coefficients/PR-TITLE.txt new file mode 100644 index 0000000000..a956ab27a3 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/PR-TITLE.txt @@ -0,0 +1 @@ +Specialize the encoded BIT coefficient evaluator to every fixed dimension and bound its retained continuation backing diff --git a/research/fixed-dimension-bit-coefficients/PROOF.md b/research/fixed-dimension-bit-coefficients/PROOF.md new file mode 100644 index 0000000000..1fa1a6b1f4 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/PROOF.md @@ -0,0 +1,361 @@ +# A dimension-parametric encoded coefficient consumer + +Prepared for @CubeJerry with substantial OpenAI Codex assistance. Apache-2.0. +This is a scoped consumer and source-arena theorem. **No new κ.** The selected +bound and all five foundational assumptions remain conditional. + +## 1. Which missing implication is addressed + +At base `e54523517d0f03e58352e647c403a5af3e525a57`, the application of #7000 +uses the completed `.0034` BIT interface from `query-thinned-controllers`, +not the historical 64-dimensional supplier. That interface has a large fixed +compiler dimension. #6879 bounds an ordinary retained helper but excludes its +coefficient evaluator. #6903 produces chronological whole-high fields for each +fixed dimension N, while its numerical join explicitly supports only N=64. +#2835 proves noncircular numerical capacity for its pinned N=64 consumer; +#6896 likewise has a fixed-dimensional recursive numerical inventory. Neither +statement installs a dimension-matching coefficient consumer for arbitrary N. + +The new contribution is an explicit specialization of the four encoded modules +retained by #6903, a reusable four-tape continuation workspace, and an all-depth +source-arena proof for this particular specialization. It preserves full +N²-digit chronological fields and original source labels. It does not generate +the selected `.0034` catalogue or Program labels, prove their grammar matches +this interface, install a changing-precision physical bank, or complete the +selected dispatcher. Those are separate, source-specific obligations. + +All input bytes and the scientific base are pinned in SOURCES.json. The proof +uses the capacity-prefix calculus of #2835 and the retained-history distinction +of #5404; it does not claim those general principles as new results. + +## 2. Domain and explicit compilation + +Fix N≥2, an odd prime q, and a finite source catalogue before runtime. A label +has Q≥1 bits. Each catalogue member has a distinct label, a rank 1≤r=2" + }, + { + "control": "dimension 1", + "error": "fixed dimension >=2" + }, + { + "control": "dimension -1", + "error": "fixed dimension >=2" + }, + { + "control": "short_capacity", + "control_error": "fixed register inventory", + "index_pending": 4, + "residue_pending": 5 + }, + { + "control": "wrong_field_code", + "control_error": "original global raw-field code", + "index_pending": 15, + "residue_pending": 14 + }, + { + "control": "truncate_field", + "control_error": "encoded word extent", + "index_pending": 17, + "residue_pending": 33 + }, + { + "control": "retained 128 multiplier guard", + "error": "valid encoded run: finite index multiplier" + }, + { + "control": "retained rank-42 guard", + "error": "valid encoded run: actual selected rank" + }, + { + "control": "retained 64-squared reader", + "error": "valid encoded run: complete 64-dimensional raw high field" + }, + { + "control": "fresh continuation role", + "error": "valid encoded run: fresh continuation tape during callback" + } + ], + "implementation_sha256": { + "check_consumer.py": "4c52f31d24435a9ec89c373550c17352b61dcdc006005f843f135888c26a70e5", + "consumer.py": "5ba042c23c2d81f6b0ecb37cfbc954c24b865c05f8007e7666ab638be2856aa8" + }, + "schema": 1, + "source_inputs": { + "docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md": "4501502c2ceb9759b20372435fe4beb51082c5a5e2910c1fd5dbe6edca415055", + "research/continuation-retained-backing/PROOF.md": "00995d2b056eaa943fa0ced9bdfdc030a7c5e93bb1b499e53d4083d99b84cc25", + "research/delayed-cover-chronological-fields/NOTICE.md": "8e06504b1bf140a3f62aa9c1f55064d38c77f965bbd46d740138dd90b31ff55d", + "research/delayed-cover-chronological-fields/PROOF.md": "9571ecdf53f30bafb96d6acfdad2add756f0f900c6d6634fbd0a7f3dceaffd0e", + "research/delayed-cover-chronological-fields/numerical/NOTICE.md": "c446b32b8a621844fb2fbe654810c8122035bdd43fed2132f1137d98cb6f9943", + "research/delayed-cover-chronological-fields/numerical/controller.py": "fa09146991f6c04e6f4b6eb9bf0c8e103e70e90a0e402ff3d69814e6aac8ff8c", + "research/delayed-cover-chronological-fields/numerical/matrices.py": "00b687434039b54529ee092e34f9435cfcd66e0816eb3bd2a6688c73f4e01459", + "research/delayed-cover-chronological-fields/numerical/records.py": "0c9c4b23e998597fb877bb1a29da69ac869b68262abe635b162b4dba9c69b372", + "research/delayed-cover-chronological-fields/numerical/words.py": "5c37f57708ba3131bdcb03139f9dbc29886bee44569c09cbba51b68f75acd7f9", + "research/ordinary-bit-retained-space/PROOF.md": "72f317eacb9db5667941ceda6557bb2b8efde19f451c69d197c736f03f405897", + "research/query-thinned-controllers/PROOF.md": "5ade59641f2ed70d045d6f60e89db7d979b1d1e9967f3acbe5c56eac81312841", + "research/recursive-physical-capacity-prefix/PROOF.md": "805abbee41f6c9a9b1ee5167833533e1604eac7f0526e50d21f42d2df05c134c", + "research/selected-binary-control/PROOF.md": "4461fdbd114a2aec884de9513b2587b7713160b3af57f80680e84c41997b9a21", + "research/selected-coefficient-capacity-prefix/PROOF.md": "cd8d94c1248bf41b511bc776b857a46937372a588af550717c9682ebce98e588", + "research/selected-ordinary-reseed-contract/README.md": "85b7974f3cfac123b888afcd0b1607b8d186528f8803f34b4ae8eeba60f5c718" + } +} diff --git a/research/fixed-dimension-bit-coefficients/SOURCES.json b/research/fixed-dimension-bit-coefficients/SOURCES.json new file mode 100644 index 0000000000..8db72b5c27 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/SOURCES.json @@ -0,0 +1,108 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md", + "usage": "input", + "git_blob": "3dd1af2285e597676725e85ad4f65e7ad326d695", + "sha256": "4501502c2ceb9759b20372435fe4beb51082c5a5e2910c1fd5dbe6edca415055" + }, + { + "path": "research/continuation-retained-backing/PROOF.md", + "usage": "input", + "git_blob": "179f4726a8bad426d2f691490b2c47dda3aebd81", + "sha256": "00995d2b056eaa943fa0ced9bdfdc030a7c5e93bb1b499e53d4083d99b84cc25" + }, + { + "path": "research/delayed-cover-chronological-fields/NOTICE.md", + "usage": "input", + "git_blob": "a931499a8a7d41604eefad646b4f5b6b378412d1", + "sha256": "8e06504b1bf140a3f62aa9c1f55064d38c77f965bbd46d740138dd90b31ff55d" + }, + { + "path": "research/delayed-cover-chronological-fields/PROOF.md", + "usage": "input", + "git_blob": "a564a45ff35314cc2fe23e43274036d84e771d43", + "sha256": "9571ecdf53f30bafb96d6acfdad2add756f0f900c6d6634fbd0a7f3dceaffd0e" + }, + { + "path": "research/delayed-cover-chronological-fields/numerical/NOTICE.md", + "usage": "input", + "git_blob": "ef9f81510db86eaf2f0a7191d85e92a6db30ddc0", + "sha256": "c446b32b8a621844fb2fbe654810c8122035bdd43fed2132f1137d98cb6f9943" + }, + { + "path": "research/delayed-cover-chronological-fields/numerical/controller.py", + "usage": "input", + "git_blob": "c631a9e77fbcccf0e8f448adc22978728aed7b60", + "sha256": "fa09146991f6c04e6f4b6eb9bf0c8e103e70e90a0e402ff3d69814e6aac8ff8c" + }, + { + "path": "research/delayed-cover-chronological-fields/numerical/matrices.py", + "usage": "input", + "git_blob": "5d497353efbb9eeaaf4facd96ab40ffb0f3aa20d", + "sha256": "00b687434039b54529ee092e34f9435cfcd66e0816eb3bd2a6688c73f4e01459" + }, + { + "path": "research/delayed-cover-chronological-fields/numerical/records.py", + "usage": "input", + "git_blob": "4f00467a0ff580954ad2fd0c7380240c753ddef3", + "sha256": "0c9c4b23e998597fb877bb1a29da69ac869b68262abe635b162b4dba9c69b372" + }, + { + "path": "research/delayed-cover-chronological-fields/numerical/words.py", + "usage": "input", + "git_blob": "8d4ba37e2778acb35b34e0719df2caf138fbeb50", + "sha256": "5c37f57708ba3131bdcb03139f9dbc29886bee44569c09cbba51b68f75acd7f9" + }, + { + "path": "research/ordinary-bit-retained-space/PROOF.md", + "usage": "input", + "git_blob": "d8fdae6afe4c84863730bf1be79015861bbb885d", + "sha256": "72f317eacb9db5667941ceda6557bb2b8efde19f451c69d197c736f03f405897" + }, + { + "path": "research/query-thinned-controllers/PROOF.md", + "usage": "input", + "git_blob": "9068f429896112082664455ab00bab083c99d1d8", + "sha256": "5ade59641f2ed70d045d6f60e89db7d979b1d1e9967f3acbe5c56eac81312841" + }, + { + "path": "research/recursive-physical-capacity-prefix/PROOF.md", + "usage": "input", + "git_blob": "ba9671522723c4562c905ca0df42ce19546d7589", + "sha256": "805abbee41f6c9a9b1ee5167833533e1604eac7f0526e50d21f42d2df05c134c" + }, + { + "path": "research/selected-binary-control/PROOF.md", + "usage": "input", + "git_blob": "f0212e1488f27bc9962fbfa394f5d920686950d2", + "sha256": "4461fdbd114a2aec884de9513b2587b7713160b3af57f80680e84c41997b9a21" + }, + { + "path": "research/selected-coefficient-capacity-prefix/PROOF.md", + "usage": "input", + "git_blob": "0b594186b21cc059b4c8589005ce46f8e437f483", + "sha256": "cd8d94c1248bf41b511bc776b857a46937372a588af550717c9682ebce98e588" + }, + { + "path": "research/selected-ordinary-reseed-contract/README.md", + "usage": "input", + "git_blob": "ccc43e1543b22b2cb87f590e960f926ac2e72798", + "sha256": "85b7974f3cfac123b888afcd0b1607b8d186528f8803f34b4ae8eeba60f5c718" + } + ] +} diff --git a/research/fixed-dimension-bit-coefficients/TASK.json b/research/fixed-dimension-bit-coefficients/TASK.json new file mode 100644 index 0000000000..c6091c889d --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/TASK.json @@ -0,0 +1,95 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one of the selected record's five inherited assumptions be proved at its actual caller?", + "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": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "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 assumption ID (native_all_columns, owned_erasure, compiler, precision_tape, analytic_recovery), one quantified implication and exact dependency closure. Check current handoffs, including #5625 row reentry and #5707 root-prefix lowering, without treating their partial scope as the whole theorem. Prove or falsify that implication with a caller-bound argument; stop at the chosen obligation. Finite tests or root digits do not discharge an all-size statement.", + "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": [ + "native_all_columns", + "owned_erasure", + "compiler", + "precision_tape", + "analytic_recovery" + ], + "existing_checks": [ + { + "scope": "PR #4100: proposed unconditional construction and finite checks, without independent acceptance.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Independent proof audit of one caller-bound all-size implication; all other premises remain explicit.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "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": "Specialize the retained encoded BIT Callback/Fields/Matrices consumer to every fixed N>=2, prove exact semantics and pre-guard source-arena demand, and bound the full chronological prefix and four reusable continuation tapes across fixed-context history.", + "scope_change_reason": "The actual selected .0034 BIT base is not the archived dimension64 supplier. Current generic-N chronological field production stops at a matching consumer; a source-bound arbitrary-fixed-N implementation is a narrower feasible lemma than full selected backend admission.", + "bottleneck_link": "Removes the literal N=64 numerical format barrier in the generic-N chronological whole-high port. Supplies a concrete coefficient component toward owned_erasure/compiler/precision_tape while preserving actual source catalogue, label generation, root-size coupling, physical bank and full dispatcher obligations.", + "budget_minutes": 90, + "stop_rule": "At 90 minutes stop expanding the source seam. If fixed-N specialization duplicates an already source-bound arbitrary-N consumer, publish no new theorem. Otherwise freeze the concrete implementation/proof and verify its source, capacity, full-field and history boundaries; no search for kappa or selected catalogue is included.", + "outcome": "partial", + "evidence": "PROOF.md gives three quantified statements; consumer.py implements 17 authenticated source edits and fixed continuation reuse. RESULT.json records exact independent-oracle examples and rejecting controls; test_boundaries.py checks actual corrupted subprocesses.", + "author": "Prepared for @CubeJerry", + "ai_assistance": "Substantial OpenAI Codex assistance in source audit, mathematical derivation, implementation and verification. A separate research agent will cross-review the frozen proof and implementation; no human or formal-kernel review is claimed.", + "open_questions": [ + { + "question": "Does the actual completed .0034 supplier emit this catalogue and chronological Program grammar?", + "why_it_matters": "A format-matching consumer does not establish the selected source-label obligation.", + "first_step": "Derive the exact preparation/low/rank labels and Good/Pair/Unit Program events from the query-thinned controller strictification.", + "blocked_by": "No current-source all-label encoded generator is supplied here." + }, + { + "question": "What is the actual root_size-to-e coupling and coefficient multiplicity per charged fibre?", + "why_it_matters": "These are needed before the explicit h-dependent complete consumer bill is absorbed by q^(ceil(e^.004)-1).", + "first_step": "Pin every actual invocation and prove root_size<=e plus its counted multiplicity.", + "blocked_by": "Selected source generator and dispatcher binding remain separate." + }, + { + "question": "Can the numerical slot and continuation bounds be installed in changing-precision fixed physical banks?", + "why_it_matters": "Per-call source-arena bounds do not establish arbitrary historical physical backing across R/I changes and suspended callers.", + "first_step": "Bind each bank origin and role, then count all entry history, ancestor Programs/Fields, producer copies and restoration.", + "blocked_by": "Actual selected physical bank layout and full caller composition are unproved." + } + ] +} diff --git a/research/fixed-dimension-bit-coefficients/VALIDATION.md b/research/fixed-dimension-bit-coefficients/VALIDATION.md new file mode 100644 index 0000000000..83f67eadc6 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/VALIDATION.md @@ -0,0 +1,63 @@ +# Executed validation and limits + +CPython 3.12.14 on Linux, standard library only, 2026-11-10. +Scientific base: e54523517d0f03e58352e647c403a5af3e525a57. + +Executed from the repository root: + +```sh +python3 -B scripts/research_package.py --package research/fixed-dimension-bit-coefficients --check-only +python3 -B research/fixed-dimension-bit-coefficients/verify.py --write-result +python3 -B scripts/research_package.py --package research/fixed-dimension-bit-coefficients +``` + +The metadata/live-pin gate passed. The final registered run passed fourteen +positive exact cases and ten controls in both normal and optimized modes, +with identical typed receipt digest +`afd86ba5470b877b6cad58a86fe26a58d98bb7e81129be4f1db47fd1a285a39a`. +The final marker was +`PASS_REGISTERED_RESEARCH_PACKAGE research/fixed-dimension-bit-coefficients outcome=partial`. + +The positive suite uses dense N=2/3 fields and a separate signed-permutation +determinant/cofactor oracle, plus the exact two-axis block formula with fixed +middle pivots for large N. It covers Good, Pair in both physical orientations, +Unit and halved Unit, global fields before a reset, inverse offset, actual +leaf calls, repeated fixed-role reentry and warm erased numerical backing. +N=44/rank43, N=65 and N=130 test the three historical finite limits. Actual +pending demand is observed before the allocation guard, and runtime word +decoding and fresh Tape construction are prohibited during every measured +call. Borrowed record bytes/heads, empty stacks and live numerical retirement +are checked on normal return. + +Ten controls reject three invalid dimension inputs, genuine numerical quota +exhaustion, a wrong original label in a dead earlier field, a truncated +materialized field, the old 128 multiplier guard, the old rank-42 guard, the +old 64² reader and fresh continuation tape construction. These controls +exercise runtime guards and instrumentation; they are not an exhaustive +malformed-input theorem. + +The separate boundary suite builds a Git-free mirror of this package and +exactly its fifteen declared scientific source inputs. It passes normal and +optimized replays, then requires failing subprocesses after (1) changing +receipt integer schema 1 to Boolean true, (2) appending a source byte, and +(3) replacing the residue pending allowance by one. These are actual failed +replays, not tests that merely expect a Python exception from the same helper. + +The written proof, not bounded examples, supplies arbitrary finite depth and +dimension. The exact selected `.0034` catalogue/Program mapping, actual root +coupling, literal transition-table lowering, varying-precision physical bank, +all caller/producer/payload histories and the complete supplier remain open. +No selected cold replay, practical huge compiler instance, formal-kernel +verification or independent human review has been run or claimed. + +A separate research worker completed independent review of author commit +edb41e730cf23e82c6a20d57f21434beb769781b. Its rank-two I-J/3 and +permutation-projector oracles cover14 exact calls, original17-bit labels, +complete prefix restoration and fixed-tape reentry. Ten compilation boundary +probes extend through N=65536; three actual constructors cross old limits. +Its source derivation checks pre-guard capacity and all four stack histories. +Normal and optimized checks print PASS_INDEPENDENT_COEFFICIENT_REVIEW 10 14 3 816 12. +The lease control confirms stale abort is not generation-guarded; only the +explicit normal linear-use interface is admitted. Exact code/proof pins and +review artifacts are under independent-review. This separate AI-assisted +review does not alter the author receipt or claim human/kernel acceptance. diff --git a/research/fixed-dimension-bit-coefficients/VERIFY.json b/research/fixed-dimension-bit-coefficients/VERIFY.json new file mode 100644 index 0000000000..47a69875b8 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/VERIFY.json @@ -0,0 +1,74 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "docs/research/pr-intake-evidence/pr7000-application/PROOF-REVIEW.md", + "research/continuation-retained-backing/PROOF.md", + "research/delayed-cover-chronological-fields/NOTICE.md", + "research/delayed-cover-chronological-fields/PROOF.md", + "research/delayed-cover-chronological-fields/numerical/NOTICE.md", + "research/delayed-cover-chronological-fields/numerical/controller.py", + "research/delayed-cover-chronological-fields/numerical/matrices.py", + "research/delayed-cover-chronological-fields/numerical/records.py", + "research/delayed-cover-chronological-fields/numerical/words.py", + "research/ordinary-bit-retained-space/PROOF.md", + "research/query-thinned-controllers/PROOF.md", + "research/recursive-physical-capacity-prefix/PROOF.md", + "research/selected-binary-control/PROOF.md", + "research/selected-coefficient-capacity-prefix/PROOF.md", + "research/selected-ordinary-reseed-contract/README.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact source pins, 17 actual specialization sites, dense determinant/cofactor and sparse block oracles, actual pre-guard demands, full chronological field extents, fixed continuation identities and ten semantic/ownership controls." + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Identical typed receipt with assertions disabled." + }, + { + "argv": [ + "{python}", + "-B", + "{package}/test_boundaries.py" + ], + "timeout_seconds": 600, + "checks": "Git-free normal/optimized mirror plus actual source, typed-receipt and insufficient pending-budget corruption subprocesses." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/independent-review/independent.py" + ], + "timeout_seconds": 120, + "checks": "Separate rank-two semantic oracle,17-bit labels, complete histories/heads, fixed-dimension constructors, source-site capacity audit,816 extent comparisons and12 controls; no author-verifier import." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/independent-review/independent.py" + ], + "timeout_seconds": 120, + "checks": "Separate rank-two semantic oracle,17-bit labels, complete histories/heads, fixed-dimension constructors, source-site capacity audit,816 extent comparisons and12 controls; no author-verifier import." + } + ] +} diff --git a/research/fixed-dimension-bit-coefficients/check_consumer.py b/research/fixed-dimension-bit-coefficients/check_consumer.py new file mode 100644 index 0000000000..e5ba0f9ff1 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/check_consumer.py @@ -0,0 +1,283 @@ +"""Independent small-block algebra and literal encoded-consumer executions. + +Fixture serialization and expected arithmetic are outside the runtime. Runtime +Word.inspect is forbidden, including for N>64. This is not a full B0 dispatcher. +""" +from fractions import Fraction as F +from hashlib import sha256 +import json +from itertools import permutations +from math import gcd +from pathlib import Path +import sys +from types import ModuleType + +HERE = Path(__file__).resolve().parent + + +def load(path): + name = "fixed_dimension_consumer_source" + old = sys.modules.get(name) + module = ModuleType(name) + module.__file__ = str(path) + sys.modules[name] = module + try: + exec(compile(path.read_bytes(),str(path),"exec"),module.__dict__) + finally: + if old is None: + sys.modules.pop(name,None) + else: + sys.modules[name]=old + return module + + +C = load(HERE/"consumer.py") + + +def need(condition, label): + if not condition: + raise ValueError(label) + + +def identity(n): + return [[F(i==j) for j in range(n)] for i in range(n)] + + +def fixtures(n,rank=1): + preparation = identity(n) + preparation[0][n-1] = F(1,2) + template = C.Template(3,rank,tuple(map(tuple,preparation))) + specs = {} + for code,block in enumerate((((1,1),(1,2)),((0,1),(1,1)),((1,2),(1,0)))): + low=[[int(i==j) for j in range(n)] for i in range(n)] + for i,x in enumerate((0,n-1)): + for j,y in enumerate((0,n-1)): + low[x][y]=block[i][j] + # The compiled preparation is unit triangular. The first projector + # pivot is good for the first and third low class, bad for the second. + specs[code]=C.Specification(code,template,tuple(map(tuple,low)),code!=1) + return specs + + +def projector(spec,high,modulus): + """Closed 2x2 adjugate formula on the nontrivial extreme-coordinate block. + + Other coordinates are identity in the header and zero in the rank-one + projector. No source matrix preparation or elimination is imported. + """ + n=len(high) + if n<=3: + need(spec.template.rank==1,'dense fixture oracle rank-one domain') + # The signed-permutation determinant and cofactor inverse are + # independent of the source's row-reduction algorithm. + g=[[(spec.low[i][j]+spec.template.q*high[i][j])%modulus for j in range(n)] for i in range(n)] + s=[[(z.numerator*pow(z.denominator,-1,modulus))%modulus for z in row] + for row in spec.template.preparation] + a=[[sum(g[i][k]*s[k][j] for k in range(n))%modulus for j in range(n)] for i in range(n)] + def det(matrix): + size=len(matrix); total=0 + for p in permutations(range(size)): + inversions=sum(p[i]>p[j] for i in range(size) for j in range(i+1,size)) + term=(-1)**inversions + for i in range(size): term*=matrix[i][p[i]] + total+=term + return total%modulus + invdet=pow(det(a),-1,modulus) + row=[] + for j in range(n): + minor=[[a[x][y] for y in range(1,n)] for x in range(n) if x!=j] + row.append(((-1)**j*det(minor)*invdet)%modulus) + return [[a[i][0]*row[j]%modulus for j in range(n)] for i in range(n)] + axes=(0,n-1) + g=[[ (spec.low[i][j]+spec.template.q*high[i][j])%modulus for j in axes] for i in axes] + s=[[ (z.numerator*pow(z.denominator,-1,modulus))%modulus + for j in axes for z in (spec.template.preparation[i][j],)] for i in axes] + h=[[sum(g[i][k]*s[k][j] for k in range(2))%modulus for j in range(2)] for i in range(2)] + a,b=h[0]; c,d=h[1]; det=(a*d-b*c)%modulus + inv=pow(det,-1,modulus) + block=[[a*d*inv%modulus,-a*b*inv%modulus],[c*d*inv%modulus,-c*b*inv%modulus]] + out=[[0]*n for _ in range(n)] + for k in range(1,spec.template.rank): out[k][k]=1 + for i,x in enumerate(axes): + for j,y in enumerate(axes): out[x][y]=block[i][j] + return out + + +def fallback_diagonal(p,modulus): + """Separate integer row-operation oracle for the fixed residual matrix.""" + n=len(p); d=2*n + a=[[0]*d for _ in range(d)] + for i in range(n): + for j in range(n): + z=(int(i==j)-p[i][j])%modulus + a[i][j]=z; a[d-1-i][d-1-j]=z + a[i][d-1-j]=p[i][j]; a[d-1-i][j]=p[i][j] + perm=list(range(d)) + for j in range(d): + pivot=next(k for k in range(j,d) if gcd(a[k][j],modulus)==1) + a[j],a[pivot]=a[pivot],a[j]; perm[j],perm[pivot]=perm[pivot],perm[j] + inv=pow(a[j][j],-1,modulus) + for i in range(d): + if i!=j: + factor=a[i][j]*inv%modulus + a[i]=[(x-factor*y)%modulus for x,y in zip(a[i],a[j],strict=True)] + need(all(not a[i][j] for i in range(d) for j in range(d) if i!=j),"oracle residual diagonal") + return [a[i][i] for i in range(d)],perm + + +def oracle(n,modulus,root_unit,root_size,events,specs,highs,index,coefficient=False): + sizes=[root_size] + for kind,code,rank,field,reverse,half in events: + f=sizes[-1]//n + sizes.append(rank*f if kind==0 else f//2 if half else f) + def weight(level,coordinate): + if level==0: return root_unit + kind,code,rank,field,reverse,half=events[level-1] + if kind==2: return 1 + f=sizes[level-1]//n + p=projector(specs[code],highs[level-1],modulus) + if kind==0: + pivot=coordinate//f + need(0<=pivot3,'sparse higher-rank oracle domain') + return factor*weight(level-1,coordinate)%modulus + diagonal,perm=fallback_diagonal(p,modulus) + column=f-1-coordinate if reverse else coordinate + def bank(row): + return weight(level-1,row*f+column) if row=n, + bool(half_units and kind=='U'))) + for level,code in enumerate([row[1] for row in events]+([] if leaf else [2])): + high=[[0]*n for _ in range(n)] + if width>1: + if dense: + need(n<=3,'small exact dense oracle') + high=[[(2*x+3*y+level+1)%(q**(width-1)) for y in range(n)] for x in range(n)] + else: + high[n-1][n-1]=(level+1)%q + if code==1: high[0][0]=1 + highs.append(high); fields.append((code,high)) + program=m.records.Program.fixture(i,r,root_size,2,events,code_bits) + raw=m.records.Fields.fixture(i,r,fields,code_bits) + if wrong_field_code: + raw.tape.cells[1]=1-raw.tape.cells[1] + if truncate_field: + # Remove one complete final digit word before the first RECORD_END. + end=raw.tape.cells.index(m.records.RECORD_END) + del raw.tape.cells[end-(residue_bits+1):end] + before=(bytes(program.tape.cells),program.tape.head,bytes(raw.tape.cells),raw.tape.head) + position=i.input(0) + operand=r.input(2) if offset else None + workspace=C.Workspace(m,ring,i) + stack_identities=tuple(id(t) for s in workspace.roles for t in (s.tape,s.reverse)) + start_r,start_i=len(r.live),len(i.live) + entry_r,entry_i=len(r.words),len(i.words) + pending={id(r):start_r,id(i):start_i} + original_zero=m.words.Arena.zero + original_inspect=m.words.Word.inspect + original_tape_init=m.records.Tape.__init__ + def observed_zero(arena): + pending[id(arena)]=max(pending.get(id(arena),0),len(arena.live)+1) + return original_zero(arena) + def forbidden_inspect(_): raise ValueError('runtime word decoding forbidden') + def forbidden_tape_init(_): raise ValueError('fresh continuation tape during callback') + m.words.Arena.zero=observed_zero; m.words.Word.inspect=forbidden_inspect + m.records.Tape.__init__=forbidden_tape_init + if short_capacity: + r.capacity=max(len(r.words),len(r.live))+1 + values=[]; stack_max=[0]*4 + error=None + try: + for _ in range(repeat): + cb=None + try: + cb=workspace.open(program,raw,specs,2,leaf=leaf) + try: + workspace.open(program,raw,specs,2) + except ValueError as exc: + need(str(exc)=='exclusive continuation workspace','exact lease guard') + else: + raise ValueError('concurrent callback lease was accepted') + output=(cb.offset(n-1,position,operand,inverse) if offset else + cb.coefficient(n-1,position,inverse) if coefficient else cb.weight(position)) + cb.close() + value=original_inspect(output); r.free(output); values.append(value) + for j,tape in enumerate((cb.pending.tape,cb.pending.reverse,cb.values.tape,cb.values.reverse)): + stack_max[j]=max(stack_max[j],len(tape.cells)+1) + except ValueError: + if cb is not None: cb.abort() + raise + except ValueError as exc: + error=str(exc) + finally: + m.words.Arena.zero=original_zero; m.words.Word.inspect=original_inspect + m.records.Tape.__init__=original_tape_init + need(pending[id(r)]<=start_r+bound['residue_pending'],'pre-guard residue demand') + need(pending[id(i)]<=start_i+bound['index_pending'],'pre-guard index demand') + if short_capacity or wrong_field_code or truncate_field: + need(error is not None,'invalid runtime control rejected') + return {'control_error':error,'residue_pending':pending[id(r)],'index_pending':pending[id(i)]} + need(error is None,'valid encoded run: '+str(error)) + expected=oracle(n,modulus,2,root_size,events,specs,highs,0,coefficient) + if coefficient and inverse: expected=-expected%modulus + if offset: expected=2*expected%modulus + need(values==[expected]*repeat,'independent full-ring coefficient') + need(before==(bytes(program.tape.cells),program.tape.head,bytes(raw.tape.cells),raw.tape.head), + 'complete borrowed program/field bytes and heads') + need(len(r.live)==start_r and len(i.live)==start_i,'numerical frame closed') + need(not workspace.active and stack_identities==tuple(id(t) for s in workspace.roles for t in (s.tape,s.reverse)), + 'exclusive fixed continuation roles reused') + need(len(program.tape.cells)+1<=bound['program_extent'],'full Program backing') + need(len(raw.tape.cells)+1<=bound['fields_extent'],'full N-squared Fields backing') + need(sum(stack_max)<=bound['four_stack_extents'],'four historical stack extents') + residue_backing=(len(r.words)+1)*(residue_bits+2) + index_backing=(len(i.words)+1)*(index_bits+2) + need(len(r.words)<=max(entry_r,start_r+bound['residue_pending']) and + len(i.words)<=max(entry_i,start_i+bound['index_pending']), + 'allocated slots retain erased history') + i.free(position) + if operand is not None: r.free(operand) + ring.close(); r.free(mod) + need(not r.live and not i.live,'complete numerical retirement') + return {'N':n,'w':width,'kinds':kinds,'repetitions':repeat,'value':expected, + 'rank':rank, + 'half_units':half_units, + 'dense_fields':dense,'warm_history':warm_history,'entry_slots':[entry_r,entry_i], + 'inverse':inverse,'offset':offset,'leaf':leaf, + 'residue_pending':pending[id(r)],'index_pending':pending[id(i)], + 'residue_backing':residue_backing,'index_backing':index_backing, + 'four_stack_backing':stack_max,'program_backing':len(program.tape.cells)+1, + 'fields_backing':len(raw.tape.cells)+1, + 'source_changes':m.edit_count} + + +if __name__=='__main__': + print(json.dumps(run_case(2,2,'GP'),sort_keys=True)) diff --git a/research/fixed-dimension-bit-coefficients/consumer.py b/research/fixed-dimension-bit-coefficients/consumer.py new file mode 100644 index 0000000000..101f057c49 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/consumer.py @@ -0,0 +1,191 @@ +"""Compile one fixed-dimensional instance of the retained encoded consumer. + +Dimension and finite label widths are compile-time constants. Runtime field +digits, coordinates and depths stay in the unchanged binary word machine. +Prepared for CubeJerry with substantial OpenAI Codex assistance. Apache-2.0. +""" +from dataclasses import dataclass +from fractions import Fraction +from hashlib import sha256 +import json +from pathlib import Path +from types import ModuleType, SimpleNamespace +import sys + +PACKAGE = Path(__file__).resolve().parent +ROOT = PACKAGE.parents[1] +SOURCE = "research/delayed-cover-chronological-fields/numerical/" + + +def need(condition, label): + if not condition: + raise ValueError(label) + + +@dataclass(frozen=True) +class Template: + q: int + rank: int + preparation: tuple[tuple[Fraction, ...], ...] + + +@dataclass(frozen=True) +class Specification: + code: int + template: Template + low: tuple[tuple[int, ...], ...] + good: bool + + +def changes(dimension): + """Every specialization site is explicit and checked once against its pin.""" + n = dimension + bits = max(16, (2*n).bit_length()) + return { + "words": [ + ("0 <= constant <= 128", f"0 <= constant <= {2*n}"), + ], + "records": [ + ("FINITE_BITS = 16", f"FINITE_BITS = {bits}"), + ("f = size//64", f"f = size//{n}"), + ("out = [[read_word(self.tape, self.residue_arena) for _ in range(64)] for _ in range(64)]", + f"out = [[read_word(self.tape, self.residue_arena) for _ in range({n})] for _ in range({n})]"), + ("len(high) == 64 and all(len(row) == 64 for row in high)", + f"len(high) == {n} and all(len(row) == {n} for row in high)"), + ], + "matrices": [ + ("0 < rows <= 128 and 0 < columns <= 256", f"0 < rows <= {2*n} and 0 < columns <= {4*n}"), + ("size <= 128 and all(len(row) == size for row in matrix)", + f"size <= {2*n} and all(len(row) == size for row in matrix)"), + ("size <= 64", f"size <= {n}"), + ], + "controller": [ + ("0 < limit <= 128", f"0 < limit <= {2*n}"), + ("for _ in range(8):", f"for _ in range({n.bit_length()+1}):"), + ("self.index.literal(64)", f"self.index.literal({n})"), + ("1 <= rank <= 42", f"1 <= rank < {n}"), + ("field < 127 and reverse == (field >= 64)", + f"field < {2*n-1} and reverse == (field >= {n})"), + ("if row < 64:", f"if row < {n}:"), + ("0 < target_row < 64", f"0 < target_row < {n}"), + ("allow_fallback=False, leaf=False):", + "allow_fallback=False, leaf=False, stack_roles=None):"), + ("self.pending, self.values = Stack(index_arena, self.residue), Stack(index_arena, self.residue)", + "need(stack_roles is not None and len(stack_roles) == 2, 'two borrowed continuation roles')\n" + " self.pending, self.values = stack_roles\n" + " need(all(s.index_arena is index_arena and s.residue_arena is self.residue and s.empty() " + "for s in stack_roles), 'closed matching continuation workspace')"), + ], + } + + +def build(dimension: int): + """Return actual encoded modules specialized before any runtime input. + + This is a source compiler, not a runtime matrix-oracle substitution. + The arithmetic/record/stack algorithms retain their source bytes apart + from the listed static bounds. The two listed interface edits take + the two Stack objects from an exclusive reusable workspace. + """ + need(type(dimension) is int and dimension >= 2, "fixed dimension >=2") + pins = {r["path"]: r["sha256"] for r in json.loads((PACKAGE/"SOURCES.json").read_text())["files"]} + edits = changes(dimension) + originals = {} + transformed = {} + for name in ("words", "records", "matrices", "controller"): + path = SOURCE + name + ".py" + raw = (ROOT/path).read_bytes() + need(sha256(raw).hexdigest() == pins[path], "source drift: " + path) + originals[name] = raw.decode() + text = originals[name] + for old, new in edits.get(name, []): + need(text.count(old) == 1, "specialization site count: " + old) + text = text.replace(old, new, 1) + transformed[name] = text + # Imports in the unchanged source use these four module names. Restore the + # process module registry after compilation so distinct N instances do not + # alias one another or a caller's previously loaded source cohort. + saved = {name: sys.modules.get(name) for name in transformed} + modules = {} + try: + for name, text in transformed.items(): + module = ModuleType(name) + module.__file__ = str(ROOT/(SOURCE+name+".py")) + sys.modules[name] = module + exec(compile(text, module.__file__, "exec"), module.__dict__) + modules[name] = module + finally: + for name, old in saved.items(): + if old is None: + sys.modules.pop(name, None) + else: + sys.modules[name] = old + return SimpleNamespace(dimension=dimension, + finite_bits=max(16,(2*dimension).bit_length()), + edit_count=sum(map(len, edits.values())), + source_hashes={k:sha256(v.encode()).hexdigest() for k,v in originals.items()}, + specialized_hashes={k:sha256(v.encode()).hexdigest() for k,v in transformed.items()}, + **modules) + + +class Workspace: + """One real, exclusive four-tape continuation inventory across callbacks. + + Residue/index contexts are fixed for this workspace. A callback borrows + Program/Fields, and returns these stack roles before a later call reuses + them. Erased historical suffixes remain in the same Tape objects. + """ + def __init__(self, modules, ring, index_arena): + self.modules, self.ring, self.index = modules, ring, index_arena + self.roles = tuple(modules.records.Stack(index_arena,ring.arena) for _ in range(2)) + self.active = False + workspace = self + base = self.modules.controller.Callback + class BoundCallback(base): + def close(self): + need(workspace.active, "live callback lease") + super().close() + workspace.active=False + + def abort(self): + try: + super().abort() + finally: + workspace.active=False + self.callback_type = BoundCallback + + def open(self, program, fields, specifications, current_code, *, allow_fallback=False, leaf=False): + need(not self.active, "exclusive continuation workspace") + need(program.index_arena is self.index and fields.index_arena is self.index and + program.residue_arena is self.ring.arena and fields.residue_arena is self.ring.arena, + "one encoded numerical context") + self.active = True + try: + return self.callback_type(self.ring,self.index,program,fields,specifications,current_code, + allow_fallback=allow_fallback,leaf=leaf,stack_roles=self.roles) + except Exception: + # This flag has no numerical payload and never substitutes for + # the inherited abort/rollback or input-validity contracts. + self.active=False + raise + + +def footprint(dimension, depth, residue_bits, index_bits, code_bits): + """Conservative explicit extents; input entry history is charged separately. + + The numerical bounds are additional pending Word demand over legal entry + residents, before a capacity guard. No successful execution is assumed. + """ + need(type(dimension) is int and dimension >= 2, "fixed dimension") + need(all(type(v) is int and v >= 0 for v in (depth,residue_bits,index_bits,code_bits)), + "integer footprint inputs") + need(residue_bits >= 2 and index_bits >= dimension.bit_length()+1 and code_bits >= 1, + "word/label extent") + n,h,r,i,q = dimension,depth,residue_bits,index_bits,code_bits + f = max(16,(2*n).bit_length()) + t = max(2*i+4,r+3) + return {"residue_pending":16*n*n+128,"index_pending":128, + "program_extent":2*i+r+10+h*(q+5*f+2*i+12), + "fields_extent":(h+1)*(q+n*n*(r+1)+2)+4, + "four_stack_extents":(4*h+12)*t+16, + "finite_label_bits":f} diff --git a/research/fixed-dimension-bit-coefficients/independent-review/RESULT.json b/research/fixed-dimension-bit-coefficients/independent-review/RESULT.json new file mode 100644 index 0000000000..2c77256e14 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/independent-review/RESULT.json @@ -0,0 +1,231 @@ +{ + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "consumer_sha256": "5ba042c23c2d81f6b0ecb37cfbc954c24b865c05f8007e7666ab638be2856aa8", + "dimension_probes": [ + { + "N": 2, + "finite_bits": 16, + "multiplier": 4 + }, + { + "N": 3, + "finite_bits": 16, + "multiplier": 6 + }, + { + "N": 64, + "finite_bits": 16, + "multiplier": 128 + }, + { + "N": 65, + "finite_bits": 16, + "multiplier": 130 + }, + { + "N": 129, + "finite_bits": 16, + "multiplier": 258 + }, + { + "N": 130, + "finite_bits": 16, + "multiplier": 260 + }, + { + "N": 257, + "finite_bits": 16, + "multiplier": 514 + }, + { + "N": 32767, + "finite_bits": 16, + "multiplier": 65534 + }, + { + "N": 32768, + "finite_bits": 17, + "multiplier": 65536 + }, + { + "N": 65536, + "finite_bits": 18, + "multiplier": 131072 + } + ], + "effect_samples": 816, + "input_pins": 15, + "lease_domain": { + "concurrent_open_rejected": true, + "required_contract": "Only the current live callback may act; closed/aborted handles are retired.", + "stale_abort_generation_guarded": false + }, + "negative_control_count": 12, + "negative_controls": [ + { + "N": 130, + "control": "finite index multiplier" + }, + { + "N": 3, + "control": "original global raw-field code" + } + ], + "rank_two": { + "entry_allocated_slots": [ + 283, + 137 + ], + "four_historical_maxima": [ + 45, + 17, + 20, + 10 + ], + "outputs": [ + { + "coordinate": 0, + "inverse": false, + "operand": null, + "operation": "unit", + "target": null, + "value": 1 + }, + { + "coordinate": 1, + "inverse": false, + "operand": null, + "operation": "unit", + "target": null, + "value": 1 + }, + { + "coordinate": 0, + "inverse": false, + "operand": null, + "operation": "weight", + "target": null, + "value": 1 + }, + { + "coordinate": 1, + "inverse": false, + "operand": null, + "operation": "weight", + "target": null, + "value": 1 + }, + { + "coordinate": 2, + "inverse": false, + "operand": null, + "operation": "weight", + "target": null, + "value": 1 + }, + { + "coordinate": 3, + "inverse": false, + "operand": null, + "operation": "weight", + "target": null, + "value": 18 + }, + { + "coordinate": 4, + "inverse": false, + "operand": null, + "operation": "weight", + "target": null, + "value": 18 + }, + { + "coordinate": 5, + "inverse": false, + "operand": null, + "operation": "weight", + "target": null, + "value": 18 + }, + { + "coordinate": 0, + "inverse": false, + "operand": null, + "operation": "coefficient", + "target": 1, + "value": 13 + }, + { + "coordinate": 1, + "inverse": false, + "operand": null, + "operation": "coefficient", + "target": 1, + "value": 9 + }, + { + "coordinate": 0, + "inverse": false, + "operand": null, + "operation": "coefficient", + "target": 2, + "value": 9 + }, + { + "coordinate": 1, + "inverse": false, + "operand": null, + "operation": "coefficient", + "target": 2, + "value": 9 + }, + { + "coordinate": 1, + "inverse": true, + "operand": null, + "operation": "coefficient", + "target": 2, + "value": 16 + }, + { + "coordinate": 1, + "inverse": true, + "operand": 7, + "operation": "coefficient", + "target": 2, + "value": 12 + } + ], + "pending_above_entry": [ + 57, + 17 + ] + }, + "status": "pass", + "syntax_cases": [ + { + "N": 65, + "field": 128, + "fields_cells": 16921, + "kind": 1, + "rank": 64, + "raw_digit_words": 4225 + }, + { + "N": 130, + "field": 0, + "fields_cells": 67621, + "kind": 0, + "rank": 129, + "raw_digit_words": 16900 + }, + { + "N": 257, + "field": 0, + "fields_cells": 264217, + "kind": 2, + "rank": 256, + "raw_digit_words": 66049 + } + ] +} diff --git a/research/fixed-dimension-bit-coefficients/independent-review/REVIEW.md b/research/fixed-dimension-bit-coefficients/independent-review/REVIEW.md new file mode 100644 index 0000000000..0f6eff9474 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/independent-review/REVIEW.md @@ -0,0 +1,213 @@ +# Independent review of the fixed-dimension coefficient consumer + +Prepared for @CubeJerry by a separate OpenAI Codex research agent. +This review concerns the source-arena theorem, not an unconditional multiplication +theorem or a new complete κ. + +## Verdict and pins + +**Pass within the explicit normal, linear-use source interface.** I found no +remaining semantic, prefix-demand or historical-backing defect in the reviewed +consumer. This is an independent mathematical/source review with finite +corroboration, not a formal proof checker or a production-catalogue certification. + +The scientific base is `e54523517d0f03e58352e647c403a5af3e525a57`. The author +freeze reviewed was `e180a8966e273768a20eb71fa98bc097991e9a44` with the +linear-use clarification committed at +`edb41e730cf23e82c6a20d57f21434beb769781b`. The reviewed PROOF.md SHA256 is +`352dfc1c725dfb20319e7cd0075e52a8fd45f21a5aa53547eef91d82fe27d575`. +The code is +`consumer.py`, SHA256 +`5ba042c23c2d81f6b0ecb37cfbc954c24b865c05f8007e7666ab638be2856aa8`. +The independent checker authenticates all 15 `usage: input` entries in +`SOURCES.json` by SHA256 and Git blob ID; provenance-only catalogue entries do +not become portable runtime inputs. + +I read the full proposed proof and compiler/workspace implementation, the four +retained encoded modules, and the cited capacity-prefix and chronological-field +interfaces. In particular, the numerical source is the N=64 cohort retained by +`delayed-cover-chronological-fields`; it is not silently substituted with a +different numerical implementation. + +## Independently derived algebra + +The executable review imports none of the author's `check_consumer.py` algebra +or replay. Its nontrivial numeric family uses N=3, rank 2, q=5, width 2 and +root extent 27 with root unit 2. Let + +\[ +H_G=\begin{pmatrix}1&0&1\\-1&1&1\\0&-1&1\end{pmatrix}, +\qquad +H_B=\begin{pmatrix}0&0&1\\1&0&0\\0&1&0\end{pmatrix}. +\] + +The first two columns of H_G span the kernel of the sum-of-coordinates map, +while its last column is (1,1,1). Therefore its split projector is +P_G=I−J/3, without running matrix inversion or elimination to obtain the oracle. +Its first two leading minors are 2/3 and 1/3, so the Good pivots are 2/3 and +1/2. Modulo 25 these are 9 and 13. The first Good step has f=9, child 18, +and weights 18 on coordinates 0 through 8 and 1 on coordinates 9 through 17. + +For H_B the projector is diag(0,1,1). Its 6-dimensional residual is a +permutation matrix that swaps 1 with 4 and 2 with 3 and fixes 0 and 5. +The retained pivot algorithm therefore returns all diagonal entries 1 and +the same involution. A Pair step with field 4, f=6 and reversal selects +the preceding coordinate 6+(5−j)=11−j and has denominator 1. Its six +weights are consequently exactly + +\[ +(1,1,1,18,18,18) \pmod {25}. +\] + +The current Good shear factor is −P_G[t,0]/P_G[0,0]=1/2=13, for either +nonzero target row. This determines four current coefficients, their sign +inverse and a source-offset multiplication independently of the evaluator. +Two Unit-reset calls independently return 1 while retaining all dead prefixes. + +All 14 calls match these closed formulas. They use original labels 65537 and +131069 in 17-bit fields, full nine-entry raw matrices, and nonzero high digits +representing the −1 entries. Runtime `Word.inspect` and new `Tape` +construction are forbidden during the calls. All borrowed numerical bytes and +heads, full Program/Fields bytes and heads, arena-template heads and erased +historical free backing are checked after normal return. + +The same four continuation tapes serve the entire sequence, including depth +3 followed by depth 2. The observed separate historical extents are +(45,17,20,10), and pre-existing histories of 283 residue slots and 137 index +slots remain reused. The largest observed extra pending demands are 57 +residues and 17 indices. These are corroborating measurements, not the proof +of the universal demand bound. + +## Universal source checks + +### Specialization and exact semantics + +The 17 edits cover the dimension, rank, pair label, raw N²-field and finite +multiplier sites and the two workspace interface sites. The unchanged source +arithmetic does not inspect runtime Word values. Building instances at +N=2,3,64,65,129,130,257,32767,32768,65536 checks that the emitted finite +label width grows beyond 16 bits and that a multiplier of 2N and selector +2N−1 work in their exact fixed ranges. These are finite boundary checks; the +single-occurrence source substitutions give the universal parameter statement. + +The Good evaluator serializes its pivot before descending and frees its +matrix. For Pair, the source pushes the denominator request first, then the +numerator request. LIFO execution leaves the denominator on top when PAIR +pops denominator then numerator. This matches δ_a B_π(a)/B_a. Unit returns +one without rebasing or renumbering source slots. Construction still verifies +all chronological labels and the complete prescribed record prefix. + +The residual-unit argument is valid over the specified local ring: +conjugation by diag(I,J) gives [[I−P,P],[P,I−P]], which squares to I. +After previous unit pivots are eliminated, an invertible remaining block +must have a unit in its first column, or its determinant would vanish modulo +q. The Good/root-unit premises then inductively make every divided weight +a unit. This is a domain proof, not a conclusion from successful allocation. + +### Demand before capacity + +I audited allocator requests directly, including a replacement before its +old Word is freed. Division has three current output/scan words and a fourth +requested replacement. In inverse, the four Euclidean residents plus the +two division results and a four-word modular multiply give peak ten. +Increasing the fixed multiplier label changes its number of iterations but +not its two-result-at-a-time allocation invariant. + +The raw header holds high, partial output and low palette; preparation of +fixed constants may additionally hold high and raw matrices. Its largest +palette phase is 3N²+12. During the subsequent multiply there are high, +raw, basis and partial header, bounded by 4N² plus scalar scratch. During +inverse, high/header plus the augmented matrix total 4N²; the identity-list +entries alias the right half. Thus 4N²+12 is valid for prepare. Good uses +projector, elimination copy and at most N pivots. Pair uses projector and +one 4N² residual. No parent matrix survives a VALUE expansion boundary. + +Allowing 64 more scalar residents, every phase is bounded by +max(4N²+12,2N²+N+12,5N²+12)+64. For N≥2 this is 5N²+76, +below 16N²+128 by 11N²+52. The source has six retained indices; +coefficient/step/seek/division/address phases remain below the stated extra +128-index allowance, including their requested next word. No loop accumulates +one numerical matrix or Word frame per descriptor depth. + +This derivation is valid on a prefix stopping at the first capacity guard: +it uses planned shapes and local live/request effects and does not assume a +successful run. With no free slot, every current allocated slot is live, so +the pending bound contradicts a first inventory failure under the stated +entry capacity. A distinct noncapacity rejection remains possible. + +### Full retained backing and cost + +A VALUE record occupies 2I+4 symbols and a scalar record R+3. The pending +stack has at most 2h+1 records; the value stack at most h+1; each reverse +role has at most one record. Counting a left marker and first blank for +each role gives the stronger simple bound (3h+4)T+8, where +T=max(2I+4,R+3). This bounds the sum of the four historical maxima and +implies the author's (4h+12)T+16. Reentry takes maxima per physical role; +clearing a role does not shrink its allocated backing. + +Direct delimiter counts give Program extent +2I+R+7+h(Q+5b_N+2I+10), and Fields extent +(h+1)(Q+N²(R+1)+2)+2. Both are below the published invoices. All N² +words and complete earlier fields remain charged even after Unit. Numerical +storage includes each permanent template, all entry-allocated slots and all +erased historical slots; it is explicitly a source-array bound rather than +a finite-tape physical-bank theorem. + +The evaluator has at most a binary depth-h VALUE tree. Charging a complete +prefix scan at each node, all encoded arithmetic, preparation and erasure +fits the loose displayed cubic bill. The bound h≤log(n₀)/log(N/(N−1)) +follows directly from each admitted child equation. The claimed exponential +absorption uses the separately required root map n₀≤e and +w=ceil(e^(1/250)); e≤w^250 converts this fixed-N overhead to a polynomial +in w. The selected catalogue, root map and invocation count are not supplied +by the package, so this remains a conditional local implication. + +## Boundary controls and lease scope + +Three actual constructor cases use N=65 with Pair field 128, N=130 with +Good rank 129, and N=257 with Unit rank 256. Their complete fields contain +4225,16900,66049 digits respectively. The test deliberately stops before +dense numerical preparation at these dimensions. + +Twelve numerical/domain controls reject: ten multipliers just outside 2N, +the old <=128 multiplier guard reinserted into the actual N=130 Good +constructor, and a changed original field label in a dead Unit prefix. +The last control confirms that Unit does not bypass chronological label +validation. It does not claim all malformed dead numeric fields are validated; +the theorem separately requires canonical complete input fields. + +Two interface limitations were clarified during review. The supported entry +is `Workspace.open`; the unchanged legacy `controller.selected_offset` does +not pass the newly required borrowed stack roles and is not an installed +entry. Also, `Workspace.active` is an exclusive-use flag, not a generation +token. An isolated control confirms concurrent open is rejected, but a stale +handle's abort is not generation-guarded and can retire a live successor. +Only the current live callback may evaluate/close/abort; a closed or aborted +handle is permanently retired. The normal theorem requires this linear-use +contract and makes no broader exception-safety or hostile-host claim. + +## Reproduction + +After this directory is copied to `independent-review/` inside the package: + +```sh +python3 -I -B research/fixed-dimension-bit-coefficients/independent-review/independent.py +python3 -I -O -B research/fixed-dimension-bit-coefficients/independent-review/independent.py +``` + +Both must print: + +```text +PASS_INDEPENDENT_COEFFICIENT_REVIEW 10 14 3 816 12 +``` + +Use `--package-root PATH` while the review directory is outside the package. +The script is read-only unless `--write-result PATH` is supplied. The 816 +checks compare independently counted record extents and phase inequalities +over a declared finite domain; the symbolic arguments above provide their +universal scope. No heavy author suite was rerun by this reviewer. + +The original predecessor credit and licensing remain with the author package. +All five global assumptions, the actual selected producer/descriptor interface, +changing-width physical banks, host metadata lowering, full caller costs and +the complete accepted multiplication bound remain outside this review's result. diff --git a/research/fixed-dimension-bit-coefficients/independent-review/independent.py b/research/fixed-dimension-bit-coefficients/independent-review/independent.py new file mode 100644 index 0000000000..3c6990d3ad --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/independent-review/independent.py @@ -0,0 +1,369 @@ +#!/usr/bin/env python3 +"""Independent source-relative coefficient-consumer review. + +The mathematical oracle is the closed rank-two pair of projectors I-J/3 +and diag(0,1,1); no author matrix oracle or author replay is imported. +Read-only by default. Copy this directory into the package for portability. +Prepared for @CubeJerry by an independent OpenAI Codex review agent. +""" +import argparse +from fractions import Fraction +from hashlib import sha1, sha256 +import json +from pathlib import Path +import sys +from types import ModuleType + + +def require(ok, why): + if not ok: + raise ValueError(why) + + +def load(path): + name = "independent_coefficient_consumer" + old = sys.modules.get(name) + module = ModuleType(name) + module.__file__ = str(path) + sys.modules[name] = module + try: + exec(compile(path.read_bytes(), str(path), "exec"), module.__dict__) + finally: + if old is None: + sys.modules.pop(name, None) + else: + sys.modules[name] = old + return module + + +def rejected(call, substring): + try: + call() + except ValueError as exc: + require(substring in str(exc), "unexpected rejection: " + str(exc)) + return str(exc) + raise ValueError("negative control accepted: " + substring) + + +def authenticate(package): + root = package.parents[1] + manifest = json.loads((package / "SOURCES.json").read_text()) + require(manifest["base_commit"] == "e54523517d0f03e58352e647c403a5af3e525a57", "review base") + count = 0 + for row in manifest["files"]: + if row["usage"] != "input": + continue + data = (root / row["path"]).read_bytes() + require(sha256(data).hexdigest() == row["sha256"], "input SHA256: " + row["path"]) + blob = b"blob " + str(len(data)).encode() + b"\0" + data + require(sha1(blob).hexdigest() == row["git_blob"], "input Git blob: " + row["path"]) + count += 1 + return count + + +def dimensions(C): + dimensions = (2, 3, 64, 65, 129, 130, 257, 32767, 32768, 65536) + rows = [] + for n in dimensions: + m = C.build(n) + require(m.edit_count == 17, "exact specialization sites") + expected = max(16, (2*n).bit_length()) + require(m.finite_bits == m.records.FINITE_BITS == expected, "fixed label width") + arena = m.words.Arena((2*n).bit_length()+3, 16) + raw = m.words.Unsigned(arena) + one = arena.input(1) + product = raw.times_small(one, 2*n) + require(product.inspect() == 2*n and one.head == product.head == 1, "upper finite multiplier") + arena.free(product) + row = arena.input(2*n-1) + require(m.controller.finite_word(row, 2*n) == 2*n-1 and row.head == 1, + "upper finite selector") + tape = m.records.Tape() + m.records.append_finite(tape, 2*n) + tape.rewind() + require(m.records.read_finite(tape) == 2*n, "finite width encoding crosses 16 bits") + rejected(lambda: raw.times_small(one, 2*n+1), "finite index multiplier") + arena.free_many(one, row) + require(not arena.live, "dimension probe retired") + rows.append({"N": n, "finite_bits": expected, "multiplier": 2*n}) + return rows + + +def rank_two_catalogue(C, modulus): + q, n = 5, 3 + # Columns span sum(x)=0, followed by (1,1,1). Thus P=I-J/3. + good_h = ((1, 0, 1), (-1, 1, 1), (0, -1, 1)) + # First two columns are e_1,e_2; P=diag(0,1,1). + bad_h = ((0, 0, 1), (1, 0, 0), (0, 1, 0)) + preparation = tuple(tuple(Fraction(i == j) for j in range(n)) for i in range(n)) + template = C.Template(q, 2, preparation) + specs, highs = {}, {} + for code, header, good in ((65537, good_h, True), (131069, bad_h, False)): + low = tuple(tuple(x % q for x in row) for row in header) + high = tuple(tuple(((x % modulus) - (x % q)) // q for x in row) for row in header) + specs[code] = C.Specification(code, template, low, good) + highs[code] = high + return specs, highs + + +def independent_expected(kind, coordinate, target=None, inverse=False, operand=None): + # Over Z/25, the Good pivots are 2/3=9 and (1/3)/(2/3)=1/2=13. + # Root unit 2 gives weights 18 on [0,9), 1 on [9,18). + # Pair field 4 has delta=1, pi(4)=1, reversal c=5-j. + # It selects Good coordinate 6+(5-j)=11-j; denominator is one. + weights = (1, 1, 1, 18, 18, 18) + if kind == "unit": + return 1 + if kind == "weight": + return weights[coordinate] + value = (13 * weights[2*target+coordinate] * pow(weights[coordinate], -1, 25)) % 25 + if inverse: + value = -value % 25 + if operand is not None: + value = value * operand % 25 + return value + + +def algebra_and_reentry(C): + n, modulus, root, Q = 3, 25, 27, 17 + m = C.build(n) + R, I = modulus.bit_length()+1, root.bit_length()+1 + bounds = C.footprint(n, 3, R, I, Q) + r = m.words.Arena(R, bounds["residue_pending"]+64) + i = m.words.Arena(I, bounds["index_pending"]+64) + # Entry historical backing deliberately exceeds all future live demand. + for arena, number in ((r, bounds["residue_pending"]+11), + (i, bounds["index_pending"]+9)): + past = [arena.zero() for _ in range(number)] + arena.free_many(*past) + mod = r.input(modulus) + ring = m.words.Ring(mod) + specs, highs = rank_two_catalogue(C, modulus) + workspace = C.Workspace(m, ring, i) + tapes = tuple(t for s in workspace.roles for t in (s.tape, s.reverse)) + tape_ids = tuple(map(id, tapes)) + history = [len(t.cells)+1 for t in tapes] + allocated_entry = (len(r.words), len(i.words)) + good, bad = 65537, 131069 + pair_events = [(0, good, 2, 0, False, False), (1, bad, 2, 4, True, False)] + unit_events = pair_events + [(2, bad, 2, 0, False, False)] + plans = [("unit", j, None, False, None) for j in range(2)] + plans += [("weight", j, None, False, None) for j in range(6)] + plans += [("coefficient", c, t, False, None) for t in (1, 2) for c in (0, 1)] + plans += [("coefficient", 1, 2, True, None), ("coefficient", 1, 2, True, 7)] + outputs, largest_pending = [], [0, 0] + inspect = m.words.Word.inspect + arena_zero, tape_init = m.words.Arena.zero, m.records.Tape.__init__ + for kind, coordinate, target, inverse, operand in plans: + events = unit_events if kind == "unit" else pair_events + internal = kind == "coefficient" + codes = [e[1] for e in events] + ([good] if internal else []) + program = m.records.Program.fixture(i, r, root, 2, events, Q) + fields = m.records.Fields.fixture(i, r, [(code, highs[code]) for code in codes], Q) + position = i.input(coordinate) + source = r.input(operand) if operand is not None else None + entry_live = (len(r.live), len(i.live)) + borrowed = tuple(tuple((slot, bytes(arena.words[slot].cells), arena.words[slot].head) + for slot in sorted(arena.live)) for arena in (r, i)) + frozen = (bytes(program.tape.cells), bytes(fields.tape.cells), + program.tape.head, fields.tape.head, bytes(position.cells), position.head) + source_before = (bytes(source.cells), source.head) if source is not None else None + pending = {id(r): len(r.live), id(i): len(i.live)} + def observed_zero(arena): + pending[id(arena)] = max(pending[id(arena)], len(arena.live)+1) + return arena_zero(arena) + def no_inspection(_): + raise ValueError("review forbids decoding runtime numeric words") + def no_tape(_): + raise ValueError("review forbids fresh continuation tapes") + m.words.Arena.zero = observed_zero + m.words.Word.inspect = no_inspection + m.records.Tape.__init__ = no_tape + cb = None + try: + cb = workspace.open(program, fields, specs, good, leaf=not internal) + if internal: + out = (cb.offset(target, position, source, inverse) if source is not None + else cb.coefficient(target, position, inverse)) + else: + out = cb.weight(position) + cb.close() + except Exception: + if cb is not None and workspace.active: + cb.abort() + raise + finally: + m.words.Arena.zero = arena_zero + m.words.Word.inspect = inspect + m.records.Tape.__init__ = tape_init + expected = independent_expected(kind, coordinate, target, inverse, operand) + value = inspect(out) + require(value == expected, "closed rank-two oracle") + r.free(out) + require(frozen == (bytes(program.tape.cells), bytes(fields.tape.cells), + program.tape.head, fields.tape.head, bytes(position.cells), position.head), + "whole borrowed chronological prefix and coordinate restored") + if source is not None: + require(source_before == (bytes(source.cells), source.head), "borrowed operand restored") + require((len(r.live), len(i.live)) == entry_live and not workspace.active, "normal close") + require(tuple(id(t) for s in workspace.roles for t in (s.tape, s.reverse)) == tape_ids, + "fixed continuation identities") + require(borrowed == tuple(tuple((slot, bytes(arena.words[slot].cells), arena.words[slot].head) + for slot in sorted(arena.live)) for arena in (r, i)), + "all borrowed numerical bytes and heads restored") + for arena in (r, i): + require(arena.template.head == 1, "permanent arena-template head restored") + for word in arena.words: + if word.slot not in arena.live: + require(word.head == 1 and all(c == m.words.BLANK for c in word.cells[1:]), + "entire historical free numerical backing erased") + b = C.footprint(n, len(events), R, I, Q) + require(len(program.tape.cells)+1 <= b["program_extent"], "complete Program extent") + require(len(fields.tape.cells)+1 <= b["fields_extent"], "complete N-squared Fields extent") + for k, arena in enumerate((r, i)): + delta = pending[id(arena)]-entry_live[k] + largest_pending[k] = max(largest_pending[k], delta) + require(delta <= (b["residue_pending"] if k == 0 else b["index_pending"]), "pre-guard demand") + for k, tape in enumerate(tapes): + history[k] = max(history[k], len(tape.cells)+1) + require(tape.head == 1, "closed stack origin") + require(all(cell == m.records.BLANK for cell in tape.cells[1:]), "erased historical stack suffix") + require(sum(history) <= bounds["four_stack_extents"], "sum of four historical maxima") + require((len(r.words), len(i.words)) == allocated_entry, "preexisting larger numerical backing reused") + outputs.append({"operation": kind, "coordinate": coordinate, "target": target, + "inverse": inverse, "operand": operand, "value": value}) + i.free(position) + if source is not None: + r.free(source) + ring.close() + r.free(mod) + require(not r.live and not i.live, "all numerical owners retired") + return {"outputs": outputs, "pending_above_entry": largest_pending, + "four_historical_maxima": history, "entry_allocated_slots": list(allocated_entry)} + + +def syntax_case(C, n, kind, rank, field, *, old_multiplier=False, wrong_label=False): + m = C.build(n) + if old_multiplier: + # The N=64 specialization reinstalls exactly the historical <=128 guard. + m.words.Unsigned.times_small = C.build(64).words.Unsigned.times_small + root, code, Q, q = 2*n, 131069, 17, 3 + r = m.words.Arena(q.bit_length()+1, 64) + i = m.words.Arena(root.bit_length()+1, 64) + modulus = r.input(q) + ring = m.words.Ring(modulus) + identity = tuple(tuple(Fraction(a == b) for b in range(n)) for a in range(n)) + # Only construction/label validation is tested here; no dense matrix + # preparation or selected numerical catalogue is claimed by this case. + low = tuple(tuple(int(a == (b if kind == 0 else (b+1) % n)) + for b in range(n)) for a in range(n)) + spec = C.Specification(code, C.Template(q, rank, identity), low, kind == 0) + events = [(kind, code, rank, field, field >= n if kind == 1 else False, False)] + program = m.records.Program.fixture(i, r, root, 2, events, Q) + fields = m.records.Fields.fixture(i, r, [(code if not wrong_label else code-1, + tuple((0,)*n for _ in range(n)))], Q) + frozen = (bytes(program.tape.cells), bytes(fields.tape.cells)) + workspace = C.Workspace(m, ring, i) + entry_live = (len(r.live), len(i.live)) + if old_multiplier or wrong_label: + substring = "finite index multiplier" if old_multiplier else "original global raw-field code" + error = rejected(lambda: workspace.open(program, fields, {code: spec}, code, + allow_fallback=True, leaf=True), substring) + require(not workspace.active, "reject releases lease") + require((len(r.live), len(i.live)) == entry_live, "constructed rejection retired") + result = {"N": n, "control": error} + else: + cb = workspace.open(program, fields, {code: spec}, code, allow_fallback=True, leaf=True) + require(not cb.prepared_codes, "large boundary case avoids numerical matrix execution") + cb.close() + require(frozen == (bytes(program.tape.cells), bytes(fields.tape.cells)), "large full-prefix preservation") + require(program.tape.head == fields.tape.head == 1, "large record head restoration") + require((len(r.live), len(i.live)) == entry_live, "large constructor closes") + result = {"N": n, "kind": kind, "rank": rank, "field": field, + "raw_digit_words": n*n, "fields_cells": len(fields.tape.cells)+1} + ring.close() + r.free(modulus) + require(not r.live and not i.live, "boundary test retired") + return result + + +def effect_checks(C): + # Independently derived phase bounds. Loops restore their scalar baseline; + # shape allocations are included in full even before the final request. + samples = 0 + for n in tuple(range(2, 65)) + (129, 130, 257, 32768, 65536): + phase = max(4*n*n+12, 2*n*n+n+12, 5*n*n+12) + 64 + require(phase <= 16*n*n+128, "source-site residue effect inequality") + for h in (0, 1, 2, 3, 17, 100): + for r, i in ((3, n.bit_length()+1), (67, n.bit_length()+3)): + q = 17 + b = C.footprint(n, h, r, i, q) + t = max(2*i+4, r+3) + independent_stacks = (3*h+4)*t+8 + require(independent_stacks <= b["four_stack_extents"], "four separate stack maxima") + program = 2*i+r+7+h*(q+5*max(16,(2*n).bit_length())+2*i+10) + fields = (h+1)*(q+n*n*(r+1)+2)+2 + require(program <= b["program_extent"] and fields <= b["fields_extent"], "exact grammar extents") + samples += 1 + return samples + + +def lease_domain(C): + """Demonstrate the exact normal-use guard and its deliberate scope limit. + + The stale-handle probe is outside the theorem's linear-use contract. It + verifies that the documentation must not promise generation-safe handles. + """ + m = C.build(3) + r, i = m.words.Arena(3, 64), m.words.Arena(3, 64) + modulus = r.input(3) + ring = m.words.Ring(modulus) + identity = tuple(tuple(Fraction(a == b) for b in range(3)) for a in range(3)) + spec = C.Specification(0, C.Template(3, 1, identity), + tuple(tuple(int(a == b) for b in range(3)) for a in range(3)), True) + program = m.records.Program.fixture(i, r, 3, 1, [], 1) + fields = m.records.Fields.fixture(i, r, [], 1) + workspace = C.Workspace(m, ring, i) + old = workspace.open(program, fields, {0: spec}, 0, leaf=True) + old.close() + current = workspace.open(program, fields, {0: spec}, 0, leaf=True) + rejected(lambda: workspace.open(program, fields, {0: spec}, 0, leaf=True), + "exclusive continuation workspace") + require(workspace.active and len(i.live) == 6, "successor holds the live lease") + old.abort() # Deliberately invalid client use, isolated from all valid cases. + require(not workspace.active and not i.live and len(r.live) == 2, + "stale abort is not generation-guarded") + del current + ring.close() + r.free(modulus) + return {"concurrent_open_rejected": True, "stale_abort_generation_guarded": False, + "required_contract": "Only the current live callback may act; closed/aborted handles are retired."} + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--package-root", type=Path, default=Path(__file__).resolve().parents[1]) + parser.add_argument("--write-result", type=Path) + args = parser.parse_args() + package = args.package_root.resolve() + inputs = authenticate(package) + C = load(package/"consumer.py") + result = {"status": "pass", "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "input_pins": inputs, "consumer_sha256": sha256((package/"consumer.py").read_bytes()).hexdigest(), + "dimension_probes": dimensions(C), "rank_two": algebra_and_reentry(C), + "syntax_cases": [syntax_case(C, 65, 1, 64, 128), + syntax_case(C, 130, 0, 129, 0), + syntax_case(C, 257, 2, 256, 0)], + "negative_controls": [syntax_case(C, 130, 0, 129, 0, old_multiplier=True), + syntax_case(C, 3, 2, 2, 0, wrong_label=True)], + "effect_samples": effect_checks(C), "lease_domain": lease_domain(C)} + result["negative_control_count"] = len(result["dimension_probes"]) + len(result["negative_controls"]) + if args.write_result: + args.write_result.write_text(json.dumps(result, indent=2, sort_keys=True)+"\n") + print("PASS_INDEPENDENT_COEFFICIENT_REVIEW", len(result["dimension_probes"]), + len(result["rank_two"]["outputs"]), len(result["syntax_cases"]), + result["effect_samples"], result["negative_control_count"]) + + +if __name__ == "__main__": + main() diff --git a/research/fixed-dimension-bit-coefficients/test_boundaries.py b/research/fixed-dimension-bit-coefficients/test_boundaries.py new file mode 100644 index 0000000000..839602ec67 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/test_boundaries.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +"""Real subprocess integrity failures in an isolated source mirror.""" +from pathlib import Path +import json +import shutil +import subprocess +import sys +from tempfile import TemporaryDirectory + +HERE=Path(__file__).resolve().parent +ROOT=HERE.parents[1] + + +def need(condition,label): + if not condition: raise ValueError(label) + + +def invoke(package,*,optimized=False,error=None): + args=[sys.executable,'-B']+(['-O'] if optimized else [])+[str(package/'verify.py')] + result=subprocess.run(args,cwd=package.parent.parent.parent,capture_output=True,text=True,timeout=120) + text=result.stdout+result.stderr + if error: + need(result.returncode!=0 and error in text,'subprocess rejection: '+error+' '+text[-1000:]) + else: + need(result.returncode==0 and text.startswith('PASS_FIXED_DIMENSION_COEFFICIENTS '), + 'isolated positive replay '+text[-1000:]) + return text.strip() + + +def main(): + with TemporaryDirectory(prefix='fixed-dimension-boundaries-') as temp: + root=Path(temp); package=root/'research'/HERE.name + shutil.copytree(HERE,package,ignore=shutil.ignore_patterns('__pycache__','*.pyc')) + rows=json.loads((HERE/'SOURCES.json').read_text())['files'] + for row in rows: + if row['usage']!='input': continue + target=root/row['path']; target.parent.mkdir(parents=True,exist_ok=True) + shutil.copyfile(ROOT/row['path'],target) + invoke(package); invoke(package,optimized=True) + receipt=package/'RESULT.json'; old=receipt.read_bytes() + changed=json.loads(old); changed['schema']=True + receipt.write_text(json.dumps(changed)) + invoke(package,optimized=True,error='typed complete RESULT equality') + receipt.write_bytes(old) + source=root/'research/delayed-cover-chronological-fields/numerical/records.py' + old=source.read_bytes(); source.write_bytes(old+b'\n# intentional source drift\n') + invoke(package,error='source drift:'); source.write_bytes(old) + implementation=package/'consumer.py'; old=implementation.read_bytes() + altered=old.replace(b'"residue_pending":16*n*n+128',b'"residue_pending":0*n*n+1') + need(altered!=old,'capacity budget mutation applied') + implementation.write_bytes(altered) + invoke(package,optimized=True,error='pre-guard residue demand') + implementation.write_bytes(old) + print('PASS_FIXED_DIMENSION_BOUNDARIES 2 clean modes 3 real corruption controls') + + +if __name__=='__main__': main() diff --git a/research/fixed-dimension-bit-coefficients/verify.py b/research/fixed-dimension-bit-coefficients/verify.py new file mode 100644 index 0000000000..d08c13a219 --- /dev/null +++ b/research/fixed-dimension-bit-coefficients/verify.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python3 +"""Read-only exact replay; --write-result is explicit receipt generation. + +Prepared for CubeJerry with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +from hashlib import sha256 +import json +from pathlib import Path +import sys +from types import ModuleType + +HERE=Path(__file__).resolve().parent +ROOT=HERE.parents[1] + + +def need(condition,label): + if not condition: raise ValueError(label) + + +def load(path): + name='_coefficient_check_bytes' + module=ModuleType(name); module.__file__=str(path) + sys.modules[name]=module + try: exec(compile(path.read_bytes(),str(path),'exec'),module.__dict__) + finally: sys.modules.pop(name,None) + return module + + +def reject(action,label,fragment=None): + try: action() + except ValueError as exc: + text=str(exc) + need(fragment is None or fragment in text,label+': wrong rejection '+text) + return {'control':label,'error':text} + raise ValueError(label+': accepted') + + +def run(): + manifest=json.loads((HERE/'SOURCES.json').read_text()) + pins={} + for row in manifest['files']: + if row['usage']!='input': continue + digest=sha256((ROOT/row['path']).read_bytes()).hexdigest() + need(digest==row['sha256'],'source drift: '+row['path']) + pins[row['path']]=digest + checks=load(HERE/'check_consumer.py'); c=checks.C + cases=[] + for n,width,kinds,options in [ + (2,1,'',{}), + (2,2,'GG',{}), + (2,2,'GP',{'dense':True}), + (2,3,'PPP',{'dense':True}), + (3,2,'PP',{}), + (3,3,'GUPG',{'dense':True}), + (3,2,'GUPG',{'half_units':True}), + (3,2,'GUPG',{'repeat':4}), + (2,2,'PUP',{'warm_history':True}), + (3,2,'GUP',{'leaf':True,'coefficient':False}), + (3,2,'GPG',{'dense':True,'inverse':True,'offset':True}), + (44,2,'G',{'rank':43}), + (65,2,'',{}), + (130,1,'',{}), + ]: + cases.append(checks.run_case(n,width,kinds,**options)) + controls=[] + for value in (True,1,-1): + controls.append(reject(lambda v=value:c.build(v),'dimension '+repr(value),'fixed dimension >=2')) + for kw,fragment in [ + ({'short_capacity':True},'fixed register inventory'), + ({'wrong_field_code':True},'original global raw-field code'), + ({'truncate_field':True},'encoded word extent'), + ]: + result=checks.run_case(2,2,'GUPG' if 'wrong_field_code' in kw else 'GP',**kw) + need(fragment in result['control_error'],'actual bad encoded control') + controls.append({'control':next(iter(kw)),**result}) + old_changes=c.changes + def omit_word_limit(n): + edits=old_changes(n); edits['words']=[]; return edits + c.changes=omit_word_limit + try: + controls.append(reject(lambda:checks.run_case(130,1,''), + 'retained 128 multiplier guard','finite index multiplier')) + finally: c.changes=old_changes + def omit_rank_limit(n): + edits=old_changes(n) + edits['controller']=[pair for pair in edits['controller'] if pair[0]!='1 <= rank <= 42'] + return edits + c.changes=omit_rank_limit + try: + controls.append(reject(lambda:checks.run_case(44,2,'G',rank=43), + 'retained rank-42 guard','actual selected rank')) + finally: c.changes=old_changes + def omit_full_field_dimension(n): + edits=old_changes(n) + edits['records']=[pair for pair in edits['records'] if not pair[0].startswith('out = [[')] + return edits + c.changes=omit_full_field_dimension + try: + controls.append(reject(lambda:checks.run_case(65,2,''), + 'retained 64-squared reader','complete 64-dimensional raw high field')) + finally: c.changes=old_changes + old_open=c.Workspace.open + def fresh_tape(workspace,*args,**kwargs): + workspace.modules.records.Tape() + return old_open(workspace,*args,**kwargs) + c.Workspace.open=fresh_tape + try: + controls.append(reject(lambda:checks.run_case(2,2,'G'), + 'fresh continuation role','fresh continuation tape during callback')) + finally: c.Workspace.open=old_open + instance=c.build(130) + need(instance.edit_count==17,'all seventeen specialization sites') + need(all(row['source_changes']==17 for row in cases),'case specialization contract') + return {'schema':1,'claim':'fixed-dimension encoded consumer; no new kappa', + 'base':manifest['base_commit'],'source_inputs':pins, + 'implementation_sha256':{name:sha256((HERE/name).read_bytes()).hexdigest() + for name in ('consumer.py','check_consumer.py')}, + 'N130_specialized_sha256':instance.specialized_hashes, + 'cases':cases,'controls':controls,'case_count':len(cases),'control_count':len(controls)} + + +def main(): + parser=argparse.ArgumentParser(); parser.add_argument('--write-result',action='store_true') + args=parser.parse_args() + result=run(); encoded=json.dumps(result,sort_keys=True,separators=(',',':')) + if args.write_result: + (HERE/'RESULT.json').write_text(json.dumps(result,indent=2,sort_keys=True)+'\n') + else: + expected=json.loads((HERE/'RESULT.json').read_text()) + need(encoded==json.dumps(expected,sort_keys=True,separators=(',',':')),'typed complete RESULT equality') + print('PASS_FIXED_DIMENSION_COEFFICIENTS',result['case_count'],result['control_count'], + sha256(encoded.encode()).hexdigest()) + + +if __name__=='__main__': + try: main() + except (ValueError,KeyError,OSError) as exc: + print('FAIL_FIXED_DIMENSION_COEFFICIENTS',str(exc),file=sys.stderr) + raise SystemExit(1)