diff --git a/research/p104-caller-owned-interface/PACKAGE-INVENTORY.json b/research/p104-caller-owned-interface/PACKAGE-INVENTORY.json new file mode 100644 index 0000000000..e931a259be --- /dev/null +++ b/research/p104-caller-owned-interface/PACKAGE-INVENTORY.json @@ -0,0 +1,22 @@ +{ + "files": { + "code/adapter.py": "bc8fc77d3c8dbeec83f9c0cdf8084b507df68f5a5edcae943ba6a19b9b1496cb", + "code/guard.py": "7065977995a11aec919579031299d90bb2fb5f3a2fe45828997fb0f22004a221", + "code/interface.py": "b827ba3ec2c23b612fc031f8d086b275a7745ca18bce94e7e16df9005b2b95c2", + "evidence/candidate-guard.json": "de8f45986ce22ed661526e2f5c4b70bdc5b2960fad76533ce9dd94d225a465e9", + "evidence/candidate-receipt.json": "c768a58a8439cfdb42d7cbd8bcf885a3b684571ccf0a8270fe5f3a73eafaa7ed", + "evidence/historical-pr5684-binding.json": "6380e961dd45a58ef6b87d3c0421a94800102c4046ee1fe6c202d8827200e8a6", + "evidence/historical-pr5684-receipt.json": "6c899e52d1da5c94b0bc159378b11106ccc665c4f5780bd48bc75c6c0c674082", + "evidence/original-guard.json": "97d1ee64006f1d59cb816247359e3774ddd67dba8ed98c444c5735f3d2549f15", + "evidence/original-receipt.json": "777f92d67599486368c946a84170fbc410e95610c2cbb8d354889e5f377e033b", + "evidence/primary-prerequisite.log": "7e5afa9051fcd1b8856a443ef30a3e88437a80b7a6f4dcb1295dbc6d99b4c07d", + "expected/candidate.json.gz": "2f22c811a85f5a37a6658ba0a21705aee55fc848a8aa85ddd5fefced8e1f460b", + "source/BINDING.json": "aff998b6d3069cea1a0a10b2a2fcd3b8100d3c84e521ef54b679a5c996839a99", + "source/EXPORT.json": "24c2e769a55474476e0b038e7c211a5aa745cc9bd2a04aaa34eb182a9583767b", + "source/NOTICE-PR5713": "a252225cb4d9c61fc94b5b7f638600393a859e47750cfea7688c75b1f6610077", + "source/RESULT.json": "3ce2dfdd7ccb6b0d6d8d674bc7614a8302a0f2f9e23f16ece95dedb9d7ea561e", + "source/WORD.json.gz": "9fd67dd89ed24a644257cd9aef06934ed4c6fbe0441804684a968868f2ef66a8", + "source/selected-adapter.patch": "4cc4829764a7511251d5c632a209e666a1f4946fe1e2b43ec90bec456e360dba" + }, + "schema_version": 1 +} diff --git a/research/p104-caller-owned-interface/PROOF.md b/research/p104-caller-owned-interface/PROOF.md new file mode 100644 index 0000000000..c4c4d2a5c5 --- /dev/null +++ b/research/p104-caller-owned-interface/PROOF.md @@ -0,0 +1,134 @@ +# Independent caller interface adaptation + +This is a source-bound extension of the selected PR5599 admission's independent +caller adapter, not a new multiplication bound or a replacement for the primary +native replay. The selected checker is pinned at SHA256 +`6fce1e331747aebee13ecc6e33ab2fd49b9383640c20546e245be3e624933b52`. +The unchanged original PR5550 checker and its complete expected output are +separately pinned; its positive control must reproduce all original output bytes. + +## Admission comparison + +The completed PR5599 review permits noncanonical helper endpoints and dirty +independent inputs. Endpoint normalizers are placed before and after each fresh +forward local call. All eighteen local calls remain forward: the main-pair +signed swaps and translations are not a transpose of COPY/CLEAR. At finite +precision, COPY is an ADD into an ideally initialized owned zero; its injected +residual must survive later arithmetic. No overwrite of noisy state is justified. +These facts cover the kind of scalar dependency changes in our shared relays, +provided their complete arbitrary-input local identities are independently +verified. They do not themselves establish any new candidate's identities. + +The old selected caller adapter has a narrower *inventory implementation*: +`helpers = public - 208`, every public label productive, eight owned lifetimes, +and a single scratch slot. That code cannot represent retired public role 573, +eleven owned lifetimes, or two simultaneous lifetimes. This is an evidence gap +in applying that independent adapter, not a counterexample to the primary local +construction. The present extension closes this inventory gap without changing +the spectral, Laurent, native-normalizer, target or negative-control equations. + +The five retained assumptions still apply: native all-width semantics, owned +erasure, compiler closure, precision/tape realization, and analytic recovery. +This adapter does not prove those assumptions. In particular it continues to +report `paid_native_maps_replayed: false` and `machine_and_precision_admitted: +false`; parent primary replay supplies the separate native-map evidence. + +## Exact scope of the extension + +`interface.py` partitions the literal local fields into independent public inputs +and owned labels. For a compact word, these are consecutive public inputs and +the declared `owned_fields`; for a legacy word, `independent_public` and +`owned_roles` must form an exact disjoint partition, including any explicitly +retired holes. All 104 main pairs must remain independent. Only the remaining +independent fields receive helper targets. Their individual native endpoint +normalizers are still checked by the original signed-Pauli and independent +dense-phase routines. + +The interface walk checks every event's ownership, current chart, strict nested +MOVE, active scalar sources and dyadic coefficient constraints. It does not +replace the primary exact scalar endpoint replay. Each INIT allocates the lowest +unused scratch slot and each CLEAR releases it. An explicit lifetime schedule +is checked independently for overlap, label alias and balanced exits. A COPY +is allowed only into an owned field with no scalar write since INIT; ideal zero +is preserved by any preceding MOVE. Its numerical interpretation remains the +residual-retaining ADD described above. + +For each of eighteen sequential LOCAL sites, the 208 local main inputs bind to +that caller bank pair and every independent helper binds to its own fresh global +field. Retired holes have no productive global ID. Owned lifetimes instead bind +to the scratch slots immediately above the complete productive inventory. +Distinct simultaneous lifetimes cannot share a slot. Every local lifetime ends +before that LOCAL returns, so subsequent LOCALs and the intervening thin-query +scratch may reuse these slots. This is checked using explicit hierarchical +instruction addresses `(physical event, sequential port, local instruction)`. +Each local INIT/CLEAR and each query INIT/CLEAR becomes an interval in that +ordering; intervals sharing a global scratch slot must not overlap. Substituted +LOCAL instructions have a single outer event index, while thin-query recipes +have their own event index and execute by port. A mutation moves a query interval +into a live local interval and must fail. Thin-query chronology and inverse-Q +correction remain checked by the original routines. + +The recursive paid and productive histograms are rederived from literal MOVEs, +the independently normalized helper endpoints, the unchanged main targets, +queries and whole idles. Scalar allowance is recounted twice from literal +coefficients. The local ordinary routing allowance is + +`1000 * (paid local jobs + 2*helpers + 208 + 4*104 + 4*owned lifetimes)`. + +The complete ordinary pass count then uses the original fixed controller census +and must fit the source's finite raw allowance. This is still an abstract +address/phase/scalar pass allowance under the retained tape contract, not a new +machine-time estimate. Two owned scratch fields are explicitly recorded; +constants for fixed inventories remain subject to the same compiler/storage +assumptions and threshold argument as in the selected admission. + +All ten original fault controls remain present, including contact phase, +exterior sign, missing idle, helper alias, main translation, owned query alias, +missing inverse-Q correction and Laurent overflow. The extension adds deliberate +overlap of simultaneous owned lifetimes and erroneous productive credit to an +owned role. The productive-credit fault mutates the literal input inventory +and reruns the interface audit; additional full audit mutations remove an +independent field, stale the source lifetime count, and reuse a label before its +first CLEAR. An original positive-control run uses the untouched PR5550 source +and compares its entire scientific output byte-for-byte. On Windows only the +unavailable operational RSS module is supplied with a nullable value; scientific +code and output are unchanged. A separate guard samples the actual child RSS. + +## Source-specific lightweight checks + +For PR5713 head `a5348f7143f95fe0046b92b96172e30763c7d731`, the literal interface +has 743 independent inputs, 535 helper targets, 9 owned labels, 11 lifetimes and +peak 2. Eighteen fresh helper inventories plus 3,328 main fields give 12,958 +productive fields; owned slots are 12958 and 12959. The independently recounted +local scalar and routing allowances are 220,326 and 5,164,000. + +The registered lightweight compatibility fixture exchanges helper label 573 with +owned label 743 in this same frozen word. It permutes destinations and scalar +sources, relocates the corresponding independent initial/final charts, and +declares 573 a retired hole inside 744 public slots. There are still 743 independent +inputs and 752 total local labels. This is a role permutation, not a new linear +construction. The interface and full caller allocation must reproduce all +profiles and allowances, give 573 no productive ID, retain one for relocated +helper 743, and verify all 1,758 local/query lifetime intervals. Thus the public-hole +branch is exercised without relying on an additional pending source. + +The literal original PR5550 interface also passes the same lightweight audit: +735 public inputs, 527 helpers, eight lifetimes, peak 1. Full original and current +candidate runs are explicitly separate, bounded serial commands. Their results +are recorded only after successful completion; preparation is not a scientific +caller pass. See the generated binding, patch, output, guard and receipt files. + +The unchanged original positive control and the current PR5713 candidate +have completed in separate serial runs. The original output agrees with +all frozen bytes (SHA256 `b51a7d19c10faea7d569a48e9536db8ba1e7418f8dd8dfb25646cc87cc9c4009`). +The candidate verifies 7,488 contacts, 302 distinct signed-Pauli/independent-phase +checks, 9,630 fresh helpers, 66,348 paid jobs, 12,958 productive fields and all 16 +negative controls. Its ordinary pass count 124,284,844 is below 184,647,552. +The candidate full output SHA256 is +`9fe876e5e74e878e691b0f9277ebbc39ce4610262526632db489816a4dd741ac`. +Original/candidate elapsed times were 25.625/26.313 seconds, sampled child RSS +peaks 73,019,392/76,578,816 bytes, under separate 120-second/512-MiB caps. These +operational results are local evidence, not a guarantee on another host. + +Prepared for flyingviper with substantial OpenAI Codex assistance. Original +PR5550/PR5599 contributor notices remain in the generated checker. Apache-2.0. diff --git a/research/p104-caller-owned-interface/README.md b/research/p104-caller-owned-interface/README.md new file mode 100644 index 0000000000..4f5cde3f95 --- /dev/null +++ b/research/p104-caller-owned-interface/README.md @@ -0,0 +1,144 @@ +# Independent P104 caller audit with explicit owned lifetimes + +The selected PR5599 independent caller adapter assumes every public label is +productive, eight owned lifetimes, and one reusable scratch field. Newer P104 +constructions use retired public labels and overlapping owned lifetimes. This +package supplies the missing inventory and scheduling adapter and checks it on +[PR5713](https://github.com/CrocSwap/integer-mult-bounds/pull/5713), head +`a5348f7143f95fe0046b92b96172e30763c7d731`. + +The source's recursive invoice is unchanged. **This is a scoped independent +forward-caller audit: no new construction, kappa gain, selected-frontier update or +complete supplier admission.** The old adapter's inventory restriction is an +evidence gap for the newer interface, not a demonstrated flaw in the source's +primary verifier. + +## Checked result + +| Obligation | Exact coverage | +|---|---| +| Unchanged original positive control | Complete PR5550 scientific output reproduced byte-for-byte | +| Physical caller | 7,488 contacts; all eighteen forward LOCALs; exact 32-bank free-Laurent endpoint | +| Native target binding | 535 helper normalizers and 208 intrinsic main adapters; 302 distinct signed-Pauli/independent-phase comparisons | +| Productive inventory | 743 independent local inputs; 9,630 fresh caller helpers; 12,958 total productive fields | +| Owned storage | Nine local owned labels, eleven lifetimes, peak two; explicit global interval schedule including thin queries | +| Complete invoice | 66,348 paid jobs and 12,958 targets, equal to the pinned source | +| Ordinary allowance | 124,284,844 abstract address/phase/scalar passes < retained 184,647,552 allowance | +| Fault rejection | All ten original controls plus six inventory/lifetime/scratch controls | + +The actual source is compact. A separate exact role-permutation fixture swaps +helper 573 with owned 743 to create a retired public hole while preserving every +chart, coefficient, input count and lifetime. It verifies that the hole gets no +productive ID, the relocated helper does, and all 1,758 local/query owned +intervals remain nonoverlapping on their assigned scratch fields. This tests +the general adapter without importing another construction or changing the +candidate's scientific result. + +The exact candidate output is stored as `expected/candidate.json.gz`; replay +compares its **complete decompressed bytes**. SHA256: +`9fe876e5e74e878e691b0f9277ebbc39ce4610262526632db489816a4dd741ac`. +Its inherited `reviewed_head` and `canonical_main` keys identify the original +PR5550 checker capsule. The current candidate is separately and explicitly +bound by `candidate_input.declared_source_head` to PR5713; those legacy keys +are not its source revision. +The original positive-control output remains the canonical PR5550 artifact, +with SHA256 +`b51a7d19c10faea7d569a48e9536db8ba1e7418f8dd8dfb25646cc87cc9c4009`. + +## What changed in the checker + +[The explicit adapter patch](source/selected-adapter.patch) retains the selected +checker's route, Laurent, signed-phase, native-normalizer and original fault +equations. [The interface checker](code/interface.py) replaces numeric inventory +assumptions with a disjoint independent/owned partition, literal INIT/CLEAR +intervals and actual lifetime recount. It records two scratch fields above the +productive inventory and proves query reuse is sequential by expanding their +addresses as `(physical event, port, local instruction)`. + +The new controls modify real inventories or schedules: promote an owned label +to an independent input, remove an independent field, stale the source's +lifetime receipt, INIT a reused label before its prior CLEAR, alias simultaneous +local lifetimes, and place a thin query inside a live local interval. Each fails. +See [PROOF.md](PROOF.md) for the exact boundary and accounting argument. + +## Prerequisites and limits + +The primary PR5713 verifier is a separate prerequisite. A fresh parent-side +replay passed its complete 752-column scalar/transpose obligations, 2,917 native +maps/phases, primary physical caller and complete pricing; the short output is +retained in `evidence/primary-prerequisite.log`. This package does not rerun that +primary science or turn its log into an independent proof. Its own native checks +cover helper/main normalizers, not every paid native map. + +The five selected framework assumptions remain: native all-width semantics, +owned erasure, compiler closure, precision/tape realization and analytic +recovery. COPY is an ADD into an ideally initialized owned zero, with numerical +residuals retained; overwrite of noisy state is not justified. The result keeps +`paid_native_maps_replayed: false` and `machine_and_precision_admitted: false`. +The ordinary count is a finite descriptor-pass allowance under the retained +tape contract, not a new machine-runtime, precision or storage theorem. + +## Reproduction and source custody + +Python 3.12, standard library, no network. From an integrated checkout: + +```sh +python3 -B scripts/research_package.py --package research/p104-caller-owned-interface --check-only +python3 -B scripts/research_package.py --package research/p104-caller-owned-interface +python3 -B scripts/check_research_commit.py --package research/p104-caller-owned-interface --check-source-history +``` + +Expected marker: `PASS_P104_EXPLICIT_OWNED_CALLER_AUDIT`. +Each registered normal/optimized command runs the original and candidate +serially, with separate 120-second and sampled 512-MiB child caps. Normal and +optimized equality is reproducibility, not two independent implementations. +The untouched original positive control passed in 25.625 seconds. The current +candidate passed in 26.313 seconds with a sampled RSS peak of 76,578,816 bytes; +portable registered replay and publication checks are reported separately. +The earlier PR5684 compact receipt and binding are retained in `evidence/` as +historical evidence; they are not substituted for the PR5713 replay. + +Main provenance is `df0137efd35e11b4445734bf612bdd4c7ebc330c`. Canonical PR5550 +capsule inputs and the selected PR5599 adapter are declared live inputs in +`SOURCES.json` and `VERIFY.json`; their bytes are authenticated before imports. +The original capsule is reused in place. Only the current pending word, result, +notice, exact adaptation and new evidence are packaged here. Pending PR5713 +bytes have explicit hashes in `source/EXPORT.json`; their archival custody does +not claim that its head is in main's ancestry. Fresh child bytecode namespaces +prevent stale caches from replacing authenticated source. + +## Scope and overlap + +This is an explicit user-authorized independent verification checkpoint. It +changes the historical `supplier-boundary-audit` card's subject from PR4088 to +the current P104 caller, retaining the card's gate: pin one exact obligation and +preserve rejection predicates. It does not claim the original complete +ordinary/outer admission task is finished. The parent coordinates current PR +and discussion overlap and any publication; unknown unpublished coverage is +not evidence of novelty. + +## Open next questions + +- Rebind this adapter to a successor only after pinning its primary all-input + and native evidence and comparing its actual controller and helper ABI. +- Independently map the full pending supplier to all selected compiler, + precision, storage and analytic premises before any frontier admission. + +Concrete first steps and blockers are recorded in `TASK.json`. No broader +search or recurring run is started by this package. + +## Credit + +Chris R/Clear1nsight's PR5550 supplies the independent caller, spectral, +Laurent and native-normalizer checker. The maintainer PR5599 review supplies +the selected inventory adapter and admission analysis. Ali Romman supplies +PR5713 with OpenAI Codex assistance, building on Joel Pulikkan/GamingPuzzled's +PR5684 with Claude assistance and Ali Romman's PR5678. The predecessor +attribution is retained verbatim in +`source/NOTICE-PR5713`. This includes the work of flyingviper, Scratch-net, +Pierre-Loic Doulcet, Joel Pulikkan, DreamingOfClouds, thu-nmrc, Gareth Davidson, +David Arias, Cinna Davis, Jacob Alan Sussman, zxv and Cao Yifan. + +New explicit ownership adaptation, independent replay and package prepared for +flyingviper with substantial OpenAI Codex assistance. Agent checks are not +independent human or formal mathematical acceptance. Apache-2.0. diff --git a/research/p104-caller-owned-interface/SOURCES.json b/research/p104-caller-owned-interface/SOURCES.json new file mode 100644 index 0000000000..337e192c9b --- /dev/null +++ b/research/p104-caller-owned-interface/SOURCES.json @@ -0,0 +1,144 @@ +{ + "base_commit": "df0137efd35e11b4445734bf612bdd4c7ebc330c", + "files": [ + { + "git_blob": "24c3871887c69ef7b634d28441e413ad75a71bf4", + "path": "docs/research/pr-intake-evidence/pr5599/caller-check.py", + "sha256": "6fce1e331747aebee13ecc6e33ab2fd49b9383640c20546e245be3e624933b52", + "usage": "input" + }, + { + "git_blob": "93d8e9dd203e856a33d53102d2db11867c88e1fa", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-20261025/CLOSEOUT.json", + "sha256": "cfaaf70e5e6efd120ba75e0fd39ce928d20d0b9dbb9b8afbe92f0c18fd0e878b", + "usage": "input" + }, + { + "git_blob": "1bb5f6f359c12319ccb4d1813c73f2db8ee70db4", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-20261025/check.py", + "sha256": "140fde975d37b8518a1332dc8cecedf571188d7db438629b1acc67c3b2571655", + "usage": "input" + }, + { + "git_blob": "f536924d81d748efc1f2690b9a858f3504e9b763", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/INPUTS.json", + "sha256": "e94c93d575f2dcce37bf3aedaeaf5f2200ccb4b14693dead84a7eeb5ad71a701", + "usage": "input" + }, + { + "git_blob": "506882c655d02cbf1ce6a61aabc8ea15982561e8", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/check.py", + "sha256": "0e5e0e3d56165437fc2821f41927e3f0cae838c60841a93e8b5cb46caeb7657c", + "usage": "input" + }, + { + "git_blob": "d9a4f84211182ca200c081ea061d724c8a2cfb70", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/sources/DATA-PHASES.json", + "sha256": "c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa", + "usage": "input" + }, + { + "git_blob": "8d2d96e3998254c2333c43fe47cdfd074cbd811e", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/sources/native_inventory.py", + "sha256": "65539acaf45bdfe8c5aee6830f9c9b3d1107c442a60842ef803fdd7688de8f32", + "usage": "input" + }, + { + "git_blob": "05cb6fa03502696857586cafc5672f5477200379", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/RESULT-normal.json", + "sha256": "3c4d8db5a9695924027f5801901b55cefe0cdc5ea07450aaf396de7e5887e608", + "usage": "input" + }, + { + "git_blob": "a4daa8e3f1d90ba8f103f4cdf0abe5bff8b4986e", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/contact/RESULT.json", + "sha256": "b1dc682a4d9db5a726fbdf5c05c081f3c9ff9816829e5d8c900db1904a1f98c1", + "usage": "input" + }, + { + "git_blob": "5c136e714dd740982ea66e6bd9ac062fcb6db58f", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/contact/SOURCES.json", + "sha256": "42a7f956bf450c15a92449e285bd2b355159cc99e78bc1d815a4b902221ab89f", + "usage": "input" + }, + { + "git_blob": "1ce96b0130daeea46ef53fdbd32bca2727aa6b35", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/contact/WORD.json.gz", + "sha256": "a1e416add9d2bb44fce923111ebc50513e5d845e56aabe214f2f0bc7d5f2b45d", + "usage": "input" + }, + { + "git_blob": "cc539db709cf7a6c42872c4380902736ad453af3", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/predecessor/CONTROLLER.json", + "sha256": "a84f6bbd547379597464e56c420cc665f96bc43a9a1351eed4b7cd0fce3cc4b9", + "usage": "input" + }, + { + "git_blob": "6ac5e735691555ecafe2afbcff71edd923178113", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/predecessor/caller.py", + "sha256": "300d40043953e4f6aecfde8f2d1004b8ad6dc5a79ec3c7666c9908c2466c91c8", + "usage": "input" + }, + { + "git_blob": "dbb3d56a4f5b733bb0c32a91249d1f6a7e1ab5d2", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/predecessor/local.py", + "sha256": "878734dfd64c4b9d362d0ae476cc5c2a19fe93e48b7378763b23f3e0dd0a5a71", + "usage": "input" + }, + { + "git_blob": "44eb3b3a9ce0a2297186da5ea8c541091cbc3e91", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/RESULT-normal.json", + "sha256": "34299df26387b69f1a89cc52d52cae3add51f4e12c0715e0de38d42fab302c9f", + "usage": "input" + }, + { + "git_blob": "e7e663bebaf13f44c95fb8eb118b472cf377e137", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/check.py", + "sha256": "43fd40847a0853c0ac511d58ce77ef822a5c6dd1b25f662f01cefaa3196a2f7d", + "usage": "input" + }, + { + "git_blob": "166841a037f069249f6f7f6dedb89248812f59e2", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/sources/clifford_exact.py", + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962", + "usage": "input" + }, + { + "git_blob": "2c209dfa9cfade3bc20ac5fc9d876b433a147f8c", + "path": "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/sources/native_verify.py", + "sha256": "3049471905b47b385c88378a1a3be7a18b8858aadd035b8a6da2f4a03b470f38", + "usage": "input" + }, + { + "git_blob": "84af5ed23588511cefd1e03766bff031357198aa", + "path": "research/p104-caller-independent-audit/capsule/swarm-price-plane-20261023T112711Z/coordination/run_guarded.py", + "sha256": "720153b7491acede2c66bdc2dfd3174653195fa3222ec3589d0671c406a5bad8", + "usage": "input" + }, + { + "git_blob": "812ef403ffb149c6230e4a58f29bea75c38f9ba2", + "path": "research/p104-caller-independent-audit/expected/caller.json.gz", + "sha256": "383509fce75e2d364138775a4fc96181c9c4cf2608eda0819a7c0c6236faa679", + "usage": "input" + }, + { + "git_blob": "581f8d87008354eb5b869f7ed9de1317ad837ce8", + "path": "certificates/selected-result.json", + "sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5", + "usage": "provenance" + }, + { + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "path": "docs/research/agent-task-catalog.json", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72", + "usage": "provenance" + }, + { + "git_blob": "8089de45c78fb229a70ee1587cc90aacaca01ebc", + "path": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "sha256": "7688e5d8bf40fcdfb5bea43ba47e1f8d60a77a91ede6c307bb8163a9a7e16b3f", + "usage": "provenance" + } + ], + "schema_version": 1 +} diff --git a/research/p104-caller-owned-interface/TASK.json b/research/p104-caller-owned-interface/TASK.json new file mode 100644 index 0000000000..85afeb22a5 --- /dev/null +++ b/research/p104-caller-owned-interface/TASK.json @@ -0,0 +1,97 @@ +{ + "actual_scope": "Independent PR5713 forward-caller audit with explicit independent public holes, multiple owned lifetimes, scratch scheduling and complete ordinary recount.", + "ai_assistance": "Substantial OpenAI Codex assistance for the independent interface audit, exact adapter and controls, source binding and packaging. Agent review is not human or formal mathematical acceptance.", + "author": "flyingviper, with substantial OpenAI Codex assistance", + "base_commit": "df0137efd35e11b4445734bf612bdd4c7ebc330c", + "bottleneck_link": "Close an exact source-specific caller evidence gap left by the selected single-owned-bank inventory adapter, without weakening its equations or claiming a new bound.", + "budget_minutes": 60, + "evidence": "PROOF.md; source/selected-adapter.patch; complete expected/candidate.json.gz; code/interface.py; evidence/", + "open_questions": [ + { + "blocked_by": "No successor source is part of this fixed package.", + "first_step": "Pin the successor and its primary all-input/native receipt, then diff the physical controller and interface before adapting any equations.", + "question": "Can the same explicit-inventory audit be rebound to a successor with a changed caller or helper ABI?", + "why_it_matters": "The present proof is bound to the fixed eighteen-call PR5713 interface; inventory generality alone does not validate new scalar/native identities." + }, + { + "blocked_by": "Primary native and compiler results are separate prerequisites; this package does not independently prove the five framework assumptions.", + "first_step": "Map the exact source-bound receipts to the selected admission assumptions, preserving residual-retaining COPY and explicit owned erasure.", + "question": "Does this complete pending supplier satisfy every retained compiler, precision, storage and analytic admission premise?", + "why_it_matters": "A scoped forward-caller pass does not admit the complete multiplication theorem or select a new bound." + } + ], + "original_card": { + "acceptance_gate": "Pin the current sources and one obligation; the historical owner audit is an example, not evidence of a current bug.", + "allowed_variations": [ + "One provider-registry, dispatch, native-closure or admission-predicate obligation; separate branches must name distinct coverage." + ], + "bottleneck_link": "Closing a current acceptance gap or proof obligation strengthens reliability even without changing kappa.", + "existing_checks": [ + { + "evidence": "research/staged544-mixed-fourth-entry/README.md", + "remaining": "Rebind and validate ordinary/outer admission with all four providers; full mixed release not established.", + "scope": "PR #4088: author-checked local words, native receipts, owner/phase fill and exact moment.", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "72d7efc181edb21806a878f174847c96dd410ab0", + "status": "author-checked" + }, + { + "evidence": "research/scatter-boundary-decision/README.md", + "remaining": "Consult its exact acceptance scope before any new exporter audit; not proof of a selected failure.", + "scope": "PR #3801: successor scatter-boundary decision package.", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "source_commit": "911f8800ba7a4b03603ef62c5ffc6240e53cb5fd", + "status": "author-checked" + } + ], + "first_experiment": "Pin the provider registry, four native source closures and dispatch. Make a bounded acceptance coverage map or one registry adapter preserving every inherited admission predicate and rejection control (including an omitted fourth provider). Record remaining ordinary/outer obligations and a resource estimate before heavy execution. Stop at unresolved source/caller dependencies; no selected-result promotion from a local pass.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read #4088 Scope and Open next questions: local words, native receipts and literal fill do not include a rerun of the mixed four-provider ordinary/outer engine. #3801 is the newer scatter-boundary decision; do not restart #2977 as if untouched.", + "scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately." + }, + "id": "supplier-boundary-audit", + "methods": [ + "Trace one hypothesis through the source, checker and complete caller.", + "Construct one semantically invalid but superficially well-formed fixture and test rejection." + ], + "overlap_terms": [ + "owner boundary", + "bridge omission", + "hosting", + "2977", + "scatter export", + "duplicate index", + "parity semantics", + "4088", + "3801", + "staged544-mixed-fourth-entry", + "scatter-boundary-decision" + ], + "question": "Can the #4088 four-provider dispatch satisfy the complete ordinary/outer admission contract?", + "scope_change_triggers": [ + "Reporting the historical timing-only diagnostic as a new current acceptance bug.", + "Calling a malformed mutant a failure of the selected construction, or importing an opt-in repair without testing the exporter boundary.", + "Running another root enclosure instead of validating dispatch or weakening an inherited predicate to make mixed admission pass." + ], + "starting_points": [ + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "research/staged544-mixed-fourth-entry/README.md", + "research/scatter-boundary-decision/README.md" + ] + }, + "original_card_acceptance_gate_met": false, + "outcome": "partial", + "priority_revision": 7, + "schema_version": 1, + "scope_change_reason": "Explicit user-authorized independent verification of the current P104 research source; this is not the historical card's PR4088 dispatch.", + "scope_status": "changed", + "stop_rule": "Stop after the original positive control, bounded candidate replay, focused package and handoff; no new construction or selected-frontier admission.", + "task_id": "supplier-boundary-audit" +} diff --git a/research/p104-caller-owned-interface/VALIDATION.md b/research/p104-caller-owned-interface/VALIDATION.md new file mode 100644 index 0000000000..4cc1545706 --- /dev/null +++ b/research/p104-caller-owned-interface/VALIDATION.md @@ -0,0 +1,31 @@ +# Validation of the PR5713-focused draft + +Checks were run serially on Windows with the bundled Python interpreter. +The scientific adapter and interface code are unchanged from the independently +reviewed PR5684 package. The original PR5550 positive control previously matched +its complete frozen output in 25.625 seconds, with sampled RSS 73,019,392 bytes. + +The PR5713 candidate at a5348f7143f95fe0046b92b96172e30763c7d731 passed +its independent full caller run in 26.313 seconds, with sampled peak RSS +76,578,816 bytes, under separate 120-second/512-MiB caps. Its complete output +SHA256 is 9fe876e5e74e878e691b0f9277ebbc39ce4610262526632db489816a4dd741ac. +The result checks 66,348 paid jobs, 12,958 targets, 302 normalizer/phase anchors, +9,630 fresh helpers, eleven local lifetimes with peak two, and all sixteen +negative controls. Ordinary allowance is 124,284,844 below 184,647,552. + +The source primary verifier passed separately before the independent run; +its short output is retained in evidence/primary-prerequisite.log. That is +prerequisite evidence, not an independent primary-map replay by this package. + +The portable wrapper retains the reviewed Windows UTF-8/LF stdout fix. The +original scientific checker and expected bytes remain unchanged. The wrapper's +summary now reads the candidate head from its authenticated scientific output. +The registered normal and optimized replay pair passed after integration. +Normal original/candidate times were 25.891/26.797 seconds; optimized times +were 24.157/25.078 seconds. All four complete scientific output hashes matched +the frozen originals, and sampled peak child RSS stayed below 76 MiB. +The package metadata and pins check passed, and a separate agent checked the +integrated source bindings, literal inventory and public-hole schedule. +Committed-byte, source-history and standalone-export checks are publication +gates, reported in the PR after execution. Historical PR5684 compact evidence +is labeled as historical. diff --git a/research/p104-caller-owned-interface/VERIFY.json b/research/p104-caller-owned-interface/VERIFY.json new file mode 100644 index 0000000000..5e79149c03 --- /dev/null +++ b/research/p104-caller-owned-interface/VERIFY.json @@ -0,0 +1,49 @@ +{ + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "checks": "Source custody; untouched original complete-output positive control; current PR5713 independent caller/normalizer/inventory/schedule/recount; sixteen fault controls. No frontier admission.", + "timeout_seconds": 300 + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "{package}/verify.py" + ], + "checks": "Source custody; untouched original complete-output positive control; current PR5713 independent caller/normalizer/inventory/schedule/recount; sixteen fault controls. No frontier admission.", + "timeout_seconds": 300 + } + ], + "inputs": [ + "docs/research/pr-intake-evidence/pr5599/caller-check.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-20261025/CLOSEOUT.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-20261025/check.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/INPUTS.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/check.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/sources/DATA-PHASES.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-caller-route-audit-v2-20261025/sources/native_inventory.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/RESULT-normal.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/contact/RESULT.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/contact/SOURCES.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/contact/WORD.json.gz", + "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/predecessor/CONTROLLER.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/predecessor/caller.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-contact-reassessment-20261025/sources/predecessor/local.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/RESULT-normal.json", + "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/check.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/sources/clifford_exact.py", + "research/p104-caller-independent-audit/capsule/outputs/p104-native-contact-audit-20261025/sources/native_verify.py", + "research/p104-caller-independent-audit/capsule/swarm-price-plane-20261023T112711Z/coordination/run_guarded.py", + "research/p104-caller-independent-audit/expected/caller.json.gz" + ], + "python": "3.12", + "requirements": [], + "schema_version": 1, + "status": "ready" +} diff --git a/research/p104-caller-owned-interface/code/adapter.py b/research/p104-caller-owned-interface/code/adapter.py new file mode 100644 index 0000000000..ec5a816e3d --- /dev/null +++ b/research/p104-caller-owned-interface/code/adapter.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python3 +"""Source-pinned extension of the selected PR5599 independent caller adapter. + +Prepare is lightweight. `run ... original` and `run ... candidate` are separate, +serial scientific replays; neither is implicit. Prepared for flyingviper with +substantial OpenAI Codex assistance. Apache-2.0; original notices are retained. +""" +from pathlib import Path +import argparse +import contextlib +import difflib +import gzip +import hashlib +import importlib.util +import json +import os +import sys +import types + +HERE = Path(__file__).resolve().parent +SELECTED_SHA = '6fce1e331747aebee13ecc6e33ab2fd49b9383640c20546e245be3e624933b52' +ORIGINAL_SHA = '0e5e0e3d56165437fc2821f41927e3f0cae838c60841a93e8b5cb46caeb7657c' +EXPECTED_SHA = 'b51a7d19c10faea7d569a48e9536db8ba1e7418f8dd8dfb25646cc87cc9c4009' + +def need(ok, message): + if not ok: + raise ValueError(message) + +def sha(raw): + return hashlib.sha256(raw).hexdigest() + +def read(path): + raw = path.read_bytes() + return json.loads(gzip.decompress(raw) if path.suffix == '.gz' else raw) + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(',', ':')).encode() + +def load_interface(): + spec = importlib.util.spec_from_file_location('p104_caller_interface', HERE/'interface.py') + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + +def adapted(source): + edits = [] + def replace(old, new, label): + nonlocal source + need(source.count(old) == 1, 'Unique selected-checker anchor: '+label) + source = source.replace(old, new) + edits.append(label) + replace('B = Path(__file__).resolve().parent', + "B = Path(os.environ['P104_CAPSULE_CHECKER']).resolve().parent\nfrom p104_caller_interface import audit, allocation, caller_schedule", 'authenticated capsule location') + replace(" helper_count = public - 208\n field_count = 3328 + 18*helper_count", + " interface = audit(word, source)\n helper_count = interface['helper_count']\n field_count = interface['productive_fields']", 'independent public inventory') + replace("source['physical_caller']['route_payload_sha256']", "source_physical(source)['route_payload_sha256']", 'source physical receipt schema') + replace(" helpers = [r for r in range(public) if r not in local_main]", + " helpers = interface['helpers']\n need(local_main == set(interface['main']), 'Independent main inventory agrees')", 'retired-public target exclusion') + old = """ fields = [] + for site, event in enumerate(full): + mapping = {} + for p, r in enumerate(word['live']): + mapping[r], mapping[r+112] = 2*event[2]*104+p, (2*event[2]+1)*104+p + mapping.update({h:3328+site*helper_count+i for i, h in enumerate(helpers)}) + need(len(mapping) == len(set(mapping.values())) == public, 'injective full-call public inventory') + fields.append({'site': site, 'stage': event[1], 'local_to_global': [mapping[i] for i in range(public)], 'owned_lifetimes': {f'{public}..{public+7}':field_count}})""" + replace(old, " fields = allocation(interface, full, word['live'])\n global_owned = caller_schedule(interface, controller, fields)\n controls.update(interface['controls'])\n controls.update(global_owned['controls'])", 'literal overlapping owned schedule') + replace("+4*104+4*8)*1000", "+4*104+4*interface['lifetime_count'])*1000", 'ordinary recount actual owned lifetimes') + replace(" events, boundary = len(controller['physical_events'])", + " need(scalar == interface['scalar'] and nr['local_routes'] == interface['routes'], 'Second literal ordinary recount agrees')\n events, boundary = len(controller['physical_events'])", 'second ordinary recount agreement') + replace("'schema':'p104-physical-caller-target-binding/v1'", "'schema':'p104-physical-caller-target-binding/explicit-owned-interface-v2'", 'result interface schema') + replace("'owned_peak':1}", "'owned_peak':interface['peak']}", 'actual simultaneous scratch census') + replace(" checkpoint('invoice_complete', paid=sum(paid.values()), targets=sum(targets.values()))", + """ result['candidate_input'] = CANDIDATE_INPUT + result['local_interface'] = {key:interface[key] for key in + ('public_slots','fields','independent','owned','retired','helper_count','productive_fields','lifetime_count','peak')} + result['owned_scratch_fields'] = list(range(field_count, field_count+interface['peak'])) + result['owned_caller_schedule'] = global_owned + checkpoint('invoice_complete', paid=sum(paid.values()), targets=sum(targets.values()))""", 'explicit candidate source and scratch evidence') + # Keep the existing route, Laurent, native-normalizer, phase and fault code. + compile(source, '', 'exec') + return source, edits + +def source_physical(result): + keys = [key for key in ('physical_caller', 'physical') if key in result] + need(keys, 'Source contains physical caller evidence') + if len(keys) == 2: + need(result[keys[0]] == result[keys[1]], 'Unambiguous physical caller evidence') + return result[keys[0]] + +def original_paths(repo): + package = repo/'research/p104-caller-independent-audit' + return (repo/'docs/research/pr-intake-evidence/pr5599/caller-check.py', + package/'capsule/outputs/p104-caller-route-audit-v2-20261025/check.py', + package/'expected/caller.json.gz') + +def prepare(args): + repo, word_path, result_path = map(lambda p:Path(p).resolve(), (args.repo,args.word,args.result)) + selected, original, expected = original_paths(repo) + need(sha(selected.read_bytes()) == SELECTED_SHA, 'Selected independent adapter pin') + need(sha(original.read_bytes()) == ORIGINAL_SHA, 'Original positive-control checker pin') + need(sha(gzip.decompress(expected.read_bytes())) == EXPECTED_SHA, 'Original scientific output pin') + word, result = read(word_path), read(result_path) + interface = load_interface().audit(word, result) + source_physical(result) + new_source, edits = adapted(selected.read_text()) + binding = dict(schema='p104-explicit-interface-binding/v1', declared_source_head=args.head, + repo=str(repo), word=str(word_path), result=str(result_path), + word_bytes_sha256=sha(word_path.read_bytes()), word_canonical_sha256=sha(canonical(word)), + result_bytes_sha256=sha(result_path.read_bytes()), selected_checker_sha256=SELECTED_SHA, + original_checker_sha256=ORIGINAL_SHA, original_output_sha256=EXPECTED_SHA, + interface_sha256=sha((HERE/'interface.py').read_bytes()), adapter_sha256=sha(Path(__file__).read_bytes()), + generated_checker_sha256=sha(new_source.encode()), edits=edits) + stem = HERE/args.name + need(stem.parent == HERE and stem.name == args.name, 'Outputs stay inside the assigned work directory') + stem.with_suffix('.binding.json').write_text(json.dumps(binding,sort_keys=True,indent=2)+'\n') + stem.with_suffix('.interface.json').write_text(json.dumps(interface,sort_keys=True,indent=2)+'\n') + stem.with_suffix('.check.py').write_text(new_source, newline='\n') + diff = difflib.unified_diff(selected.read_text().splitlines(True),new_source.splitlines(True), + fromfile='selected-caller-check.py',tofile='explicit-interface-caller-check.py') + stem.with_suffix('.patch').write_text(''.join(diff), newline='\n') + print(json.dumps(dict(status='PREPARED_LIGHTWEIGHT_INTERFACE_PASS',binding=str(stem.with_suffix('.binding.json')), + helper_count=interface['helper_count'],peak=interface['peak'],lifetimes=interface['lifetime_count']),sort_keys=True)) + +def run(args): + binding_path = Path(args.binding).resolve() + need(binding_path.parent == HERE, 'Use a binding in the assigned work directory') + binding = read(binding_path) + selected, original, expected = original_paths(Path(binding['repo'])) + need(sha(selected.read_bytes()) == SELECTED_SHA and sha(original.read_bytes()) == ORIGINAL_SHA, 'Both source checker pins') + need(sha(gzip.decompress(expected.read_bytes())) == EXPECTED_SHA, 'Positive scientific output pin') + need(sha((HERE/'interface.py').read_bytes()) == binding['interface_sha256'] and + sha(Path(__file__).read_bytes()) == binding['adapter_sha256'], 'Prepared adapter code unchanged') + for key in ('word','result'): + need(sha(Path(binding[key]).read_bytes()) == binding[key+'_bytes_sha256'], 'Bound candidate '+key) + need(sha(canonical(read(Path(binding['word'])))) == binding['word_canonical_sha256'], 'Bound canonical candidate word') + # Windows has no resource module. This supplies only nullable operational + # RSS metadata; the original checker and its scientific output are unchanged. + try: + import resource + except ImportError: + sys.modules['resource'] = types.SimpleNamespace(RUSAGE_SELF=0, + getrusage=lambda _:types.SimpleNamespace(ru_maxrss=None)) + for key in ('P104_WORD','P104_RESULT','P104_TRACE_FILE','P104_CAPSULE_CHECKER'): + os.environ.pop(key,None) + prefix = binding_path.name.removesuffix('.binding.json')+'-'+args.mode + output = HERE/(prefix+'.json') + trace = HERE/(prefix+'.jsonl') + need(not output.exists() and not trace.exists(), 'Keep existing run evidence; choose a fresh binding name') + os.environ['P104_TRACE_FILE'] = str(trace) + namespace = dict(__name__='__main__',__file__=str(original)) + if args.mode == 'original': + source = original.read_text() + else: + source, _ = adapted(selected.read_text()) + need(sha(source.encode()) == binding['generated_checker_sha256'], 'Prepared generated checker unchanged') + os.environ.update(P104_WORD=binding['word'],P104_RESULT=binding['result'],P104_CAPSULE_CHECKER=str(original)) + module = load_interface() + sys.modules['p104_caller_interface'] = module + namespace.update(source_physical=source_physical,CANDIDATE_INPUT={k:binding[k] for k in + ('declared_source_head','word_bytes_sha256','word_canonical_sha256','result_bytes_sha256','selected_checker_sha256','interface_sha256','adapter_sha256')}) + with output.open('w',encoding='utf-8',newline='\n') as stream, contextlib.redirect_stdout(stream): + exec(compile(source,str(original) if args.mode == 'original' else prefix+'.check.py','exec'),namespace) + if args.mode == 'original': + need(output.read_bytes() == gzip.decompress(expected.read_bytes()), 'Unmodified original full scientific positive control') + data = read(output) + receipt = dict(status='PASS_ORIGINAL_BYTE_EQUAL' if args.mode == 'original' else 'PASS_CANDIDATE_SCOPED_CALLER', + output=str(output),output_sha256=sha(output.read_bytes()),native_checks=data['native_checks'],ordinary=data['ordinary'], + controls=data['controls'],paid=sum(data['paid'].values()),targets=sum(data['targets'].values())) + (HERE/(prefix+'-receipt.json')).write_text(json.dumps(receipt,sort_keys=True,indent=2)+'\n') + print(json.dumps(receipt,sort_keys=True)) + +if __name__ == '__main__': + parser=argparse.ArgumentParser(description=__doc__) + commands=parser.add_subparsers(dest='command',required=True) + p=commands.add_parser('prepare') + for key in ('repo','word','result','head','name'): p.add_argument('--'+key,required=True) + p=commands.add_parser('run');p.add_argument('binding');p.add_argument('mode',choices=('original','candidate')) + args=parser.parse_args() + (prepare if args.command == 'prepare' else run)(args) diff --git a/research/p104-caller-owned-interface/code/guard.py b/research/p104-caller-owned-interface/code/guard.py new file mode 100644 index 0000000000..8293b01bb4 --- /dev/null +++ b/research/p104-caller-owned-interface/code/guard.py @@ -0,0 +1,72 @@ +"""Bound one non-spawning scientific child by elapsed time and sampled RSS. + +Operational wrapper only. The caller adapter imports Python modules and does +not create descendant processes. Windows RSS uses GetProcessMemoryInfo. +""" +from pathlib import Path +import argparse +import ctypes +import hashlib +import json +import os +import subprocess +import sys +import time + +def rss(proc): + if os.name != 'nt': + return int(Path(f'/proc/{proc.pid}/statm').read_text().split()[1])*os.sysconf('SC_PAGE_SIZE') + from ctypes import wintypes + class Counters(ctypes.Structure): + _fields_ = [('cb',wintypes.DWORD),('PageFaultCount',wintypes.DWORD)]+[ + (name,ctypes.c_size_t) for name in ('PeakWorkingSetSize','WorkingSetSize','QuotaPeakPagedPoolUsage', + 'QuotaPagedPoolUsage','QuotaPeakNonPagedPoolUsage','QuotaNonPagedPoolUsage','PagefileUsage','PeakPagefileUsage')] + info= Counters();info.cb=ctypes.sizeof(info) + call=ctypes.windll.psapi.GetProcessMemoryInfo + call.argtypes=[wintypes.HANDLE,ctypes.POINTER(Counters),wintypes.DWORD] + call.restype=wintypes.BOOL + if not call(int(proc._handle),ctypes.byref(info),info.cb): + raise ctypes.WinError() + return info.WorkingSetSize + +if __name__ == '__main__': + ap=argparse.ArgumentParser(description=__doc__) + ap.add_argument('--name',required=True) + ap.add_argument('--seconds',type=int,default=120) + ap.add_argument('--memory-mib',type=int,default=512) + ap.add_argument('command',nargs=argparse.REMAINDER) + a=ap.parse_args();command=a.command[1:] if a.command[:1]==['--'] else a.command + root=Path(__file__).resolve().parent + if not command or Path(a.name).name != a.name or a.seconds<=0 or a.memory_mib<=0: + ap.error('Bounded command and local output name required') + log=root/(a.name+'.log');receipt_path=root/(a.name+'-guard.json') + if log.exists() or receipt_path.exists(): + ap.error('Preserve existing guard evidence') + env=dict(os.environ,PYTHONDONTWRITEBYTECODE='1',OMP_NUM_THREADS='1',OPENBLAS_NUM_THREADS='1',MKL_NUM_THREADS='1') + start=time.monotonic();peak=samples=0;cause=None + with log.open('wb') as output: + proc=subprocess.Popen(command,stdout=output,stderr=subprocess.STDOUT,env=env, + creationflags=subprocess.CREATE_NO_WINDOW if os.name=='nt' else 0) + try: + while proc.poll() is None: + try: + usage=rss(proc);peak=max(peak,usage);samples+=1 + except OSError: + if proc.poll() is None: + raise + break + if usage>a.memory_mib*1024**2: cause='sampled_memory_limit' + if time.monotonic()-start>a.seconds: cause='timeout' + if cause: + proc.kill();break + time.sleep(.1) + code=proc.wait() + except BaseException: + proc.kill();proc.wait();raise + receipt=dict(command=command,exit_code=code,termination=cause,elapsed_seconds=time.monotonic()-start, + sampled_peak_child_rss_bytes=peak,rss_samples=samples,memory_limit_mib=a.memory_mib, + timeout_seconds=a.seconds,log_sha256=hashlib.sha256(log.read_bytes()).hexdigest(), + scope='Operational resource bounds on the non-spawning scientific child; scientific claims depend on its output.') + receipt_path.write_text(json.dumps(receipt,sort_keys=True,indent=2)+'\n') + print(json.dumps(receipt,sort_keys=True)) + raise SystemExit(int(code!=0 or cause is not None)) diff --git a/research/p104-caller-owned-interface/code/interface.py b/research/p104-caller-owned-interface/code/interface.py new file mode 100644 index 0000000000..45697af7cb --- /dev/null +++ b/research/p104-caller-owned-interface/code/interface.py @@ -0,0 +1,223 @@ +"""Independent P104 caller interface census for compact or retired public IDs. + +No native or endpoint equations are relaxed. This module supplies the public +allocation, lifetime schedule and ordinary recount missing from the legacy +index-boundary adapter. All ordinary scalar coefficients are counted literally. +Prepared for flyingviper with substantial OpenAI Codex assistance. Apache-2.0. +""" +from collections import Counter +from copy import deepcopy +from fractions import Fraction as Q + +def need(ok, message): + if not ok: + raise ValueError(message) + +def reject(action): + try: + action() + except ValueError as error: + return str(error) + raise ValueError('Invalid interface control accepted') + +def span(basis): + values = {0} + for v in basis: + need(type(v) is int and 0 < v < 512 and v not in values, 'Independent binary chart') + values |= {x ^ v for x in tuple(values)} + return values + +def check_schedule(lifetimes, owned, independent, fields): + boundaries = [] + for life in lifetimes: + need(life['role'] in owned and life['role'] not in independent, + 'Owned schedule has no productive alias') + need(0 <= life['start'] < life['end'] and type(life['slot']) is int and life['slot'] >= 0, + 'Owned lifetime interval') + boundaries.extend([(life['start'], 1, life), (life['end'], 0, life)]) + active_roles, active_slots = {}, {} + for _, begin, life in sorted(boundaries, key=lambda x:(x[0], x[1])): + r, s = life['role'], life['slot'] + if begin: + need(r not in active_roles and s not in active_slots, 'Overlapping owned lifetime alias') + active_roles[r] = s + active_slots[s] = r + else: + need(active_roles.get(r) == s and active_slots.get(s) == r, 'Matching owned lifetime exit') + del active_roles[r], active_slots[s] + need(all(fields + s >= fields for s in active_slots), 'Scratch outside productive allocation') + need(not active_roles and not active_slots, 'Owned schedule fully closed') + +def audit(word, source, *, _controls=True): + public = word['public'] + need(len(word['initial']) == len(word['final']) == public, 'Legacy boundary inventory') + independent = list(word.get('independent_public', range(public))) + need(len(independent) == len(set(independent)) and all(type(r) is int and 0 <= r < public for r in independent), + 'Distinct independent public roles') + retired = set(range(public)) - set(independent) + if 'retired_public' in word: + need(retired == set(word['retired_public']), 'Exact retired-public holes') + owned_count = word.get('owned_fields', 8) + fields = word.get('fields', public + owned_count) + owned = list(word.get('owned_roles', range(public, fields))) + need(len(owned) == len(set(owned)) and set(owned).isdisjoint(independent), 'Distinct owned roles') + need(set(independent) | set(owned) == set(range(fields)), 'Every field is independent or owned') + need(set(owned) & set(range(public)) == retired, 'All legacy public holes are owned') + main = set(word['live']) | {r+112 for r in word['live']} + need(len(word['live']) == len(word['ports']) == 104 and len(main) == 208 and main <= set(independent), + 'All104 main pairs are independent') + helpers = [r for r in independent if r not in main] + targets = Counter(len(word['frames'][word['final'][r]])-len(word['frames'][word['initial'][r]]) for r in helpers) + need(targets and min(targets) > 0, 'Every independent helper has a positive target') + charts = [span(f) for f in word['frames']] + current = list(word['initial']) + [None]*(fields-public) + for r in owned: + current[r] = None + active, lifetimes, scalar, paid, peak = {}, [], 0, Counter(), 0 + initialized = set() + for index, event in enumerate(word['program']): + op, r = event[:2] + need(type(r) is int and 0 <= r < fields, 'Event destination inventory') + if op == 'INIT': + need(type(event[2]) is int and 0 <= event[2] < len(charts), 'Owned initial chart inventory') + need(r in owned and r not in active and current[r] is None, 'Owned initialization chronology') + slot = 0 + while slot in {life['slot'] for life in active.values()}: + slot += 1 + life = dict(role=r, slot=slot, start=index, start_chart=event[2]) + active[r] = life + current[r] = event[2] + initialized.add(r) + peak = max(peak, len(active)) + scalar += 2 + elif op == 'CLEAR': + need(r in active and current[r] == event[2], 'Owned clear chronology and chart') + life = active.pop(r) + life.update(end=index, end_chart=event[2]) + lifetimes.append(life) + current[r] = None + initialized.discard(r) + scalar += 2 + elif op == 'MOVE': + _, _, a, b, private = event + need(current[r] == a and type(private) is bool and private == (r in active), 'MOVE ownership') + need(charts[b] < charts[a] if private else charts[a] < charts[b], 'Strict nested MOVE') + current[r] = b + paid[abs(len(word['frames'][a])-len(word['frames'][b]))] += 1 + else: + q, f = Q(event[-2]), event[-1] + need(current[r] == f and (r not in owned or r in active), 'Scalar destination is active and coframed') + need(q and q.denominator & (q.denominator-1) == 0 and abs(q)+1 < 2**16, 'Literal dyadic coefficient bound') + n, d = abs(q.numerator), q.denominator + if op == 'SCALE': + need(n & (n-1) == 0, 'SCALE is a dyadic unit') + scalar += 2*(abs(n.bit_length()-d.bit_length())+int(q < 0)) + else: + s = event[2] + need(type(s) is int and 0 <= s < fields and s != r and current[s] == f, + 'Scalar source is active and coframed') + need(s not in owned or s in active, 'No inactive owned source') + need(op in ('ADD','COPY'), 'Known scalar opcode') + if op == 'COPY': + need(r in active and r in initialized, 'COPY follows an owned initialization') + scalar += 2*(3+n.bit_length()-1+n.bit_count()+d.bit_length()-1) + initialized.discard(r) + need(not active and all(current[r] == word['final'][r] for r in independent), 'All local public and owned exits') + need(set(life['role'] for life in lifetimes) == set(owned), 'Every declared owned role has a lifetime') + local = source['local'] + need(len(independent) == local['public_inputs'] and len(lifetimes) == local['owned_lifetimes'] and peak == local['peak_owned_fields'], + 'Independently recounted input and lifetime inventory') + if 'owned_fields' in local: + need(len(owned) == local['owned_fields'], 'Independently recounted owned fields') + need(targets == Counter({int(k):v for k,v in local['helpers'].items()}) and + paid == Counter({int(k):v for k,v in local['paid'].items()}), 'Independent paid and productive profiles') + need(scalar == local['real_scalar_allowance'], 'Independent scalar allowance') + productive_fields = 3328 + 18*len(helpers) + check_schedule(lifetimes, set(owned), set(independent), productive_fields) + routes = (sum(paid.values())+2*len(helpers)+208+4*104+4*len(lifetimes))*1000 + nr = source['complete_cost']['nonrecursive'] + need(nr['local_scalar'] == scalar and nr['local_routes'] == routes, 'Independent local ordinary allowance') + need(nr['peak_owned_fields'] == peak, 'Ordinary ledger owned peak') + controls = {} + if _controls and peak > 1: + bad = deepcopy(lifetimes) + pair = next((a,b) for a in bad for b in bad if a is not b and a['start'] < b['start'] < a['end']) + pair[1]['slot'] = pair[0]['slot'] + controls['overlapping_local_owned_alias'] = reject(lambda:check_schedule(bad,set(owned),set(independent),productive_fields)) + if _controls: + bad_word = deepcopy(word) + bad_word['independent_public'] = independent+[owned[0]] + controls['owned_marked_productive'] = reject(lambda:audit(bad_word,source,_controls=False)) + bad_word = deepcopy(word) + bad_word['independent_public'] = independent[:-1] + controls['stale_independent_inventory'] = reject(lambda:audit(bad_word,source,_controls=False)) + bad_source = deepcopy(source) + bad_source['local']['owned_lifetimes'] -= 1 + controls['stale_source_lifetime_inventory'] = reject(lambda:audit(word,bad_source,_controls=False)) + if len(lifetimes) > len(owned): + role = next(r for r,n in Counter(life['role'] for life in lifetimes).items() if n>1) + starts = [i for i,event in enumerate(word['program']) if event[:2] == ['INIT',role]] + bad_word = deepcopy(word) + later = bad_word['program'].pop(starts[1]) + bad_word['program'].insert(starts[0]+1,later) + controls['reused_owned_label_before_clear'] = reject(lambda:audit(bad_word,source,_controls=False)) + return dict(public_slots=public,fields=fields,independent=independent,owned=owned,retired=sorted(retired), + main=sorted(main),helpers=helpers,helper_count=len(helpers),productive_fields=productive_fields, + paid=dict(paid),targets=dict(targets),scalar=scalar,routes=routes,lifetimes=lifetimes, + lifetime_count=len(lifetimes),peak=peak,controls=controls) + +def allocation(interface, full_calls, live): + fields = [] + for site,event in enumerate(full_calls): + mapping = {} + for p,r in enumerate(live): + mapping[r],mapping[r+112] = 2*event[2]*104+p,(2*event[2]+1)*104+p + mapping.update({h:3328+site*interface['helper_count']+i for i,h in enumerate(interface['helpers'])}) + need(set(mapping) == set(interface['independent']) and len(mapping) == len(set(mapping.values())), + 'Injective full-call independent inventory') + lives = [dict(x,global_field=interface['productive_fields']+x['slot']) for x in interface['lifetimes']] + fields.append(dict(site=site,stage=event[1],local_to_global=[mapping.get(i) for i in range(interface['public_slots'])], + independent_mapping=mapping,owned_lifetimes=lives)) + return fields + +def check_global_intervals(intervals, productive_fields): + boundaries=[] + for interval in intervals: + need(interval['global_field'] >= productive_fields, 'Owned caller scratch outside productive fields') + need(tuple(interval['start']) < tuple(interval['end']), 'Proper hierarchical owned interval') + boundaries.extend([(tuple(interval['start']),1,interval),(tuple(interval['end']),0,interval)]) + active={} + for _,begin,interval in sorted(boundaries,key=lambda item:(item[0],item[1])): + field=interval['global_field'] + if begin: + need(field not in active, 'Caller owned intervals cannot overlap on one field') + active[field]=interval + else: + need(active.get(field) is interval, 'Caller owned interval closes its own field') + del active[field] + need(not active, 'No caller owned scratch remains live') + +def caller_schedule(interface, controller, fields): + # Addresses are (outer physical event, port subcall, local instruction). + # A LOCAL's instructions are substituted at its own outer event; QUERY + # recipes run sequentially by port at their distinct outer event. + intervals=[];site=0 + for index,event in enumerate(controller['physical_events']): + if event[0] == 'LOCAL': + need(fields[site]['site'] == site and fields[site]['stage'] == event[1], 'Caller local-site order') + for life in fields[site]['owned_lifetimes']: + intervals.append(dict(kind='local',site=site,role=life['role'],global_field=life['global_field'], + start=[index,0,life['start']],end=[index,0,life['end']])) + site+=1 + elif event[0] == 'QUERY_SHEAR': + for port in range(104): + intervals.append(dict(kind='query',port=port,global_field=interface['productive_fields'], + start=[index,port,0],end=[index,port,7])) + need(site == len(fields) == 18, 'All local substitutions have closed owned schedules') + check_global_intervals(intervals,interface['productive_fields']) + bad=deepcopy(intervals) + local=next(item for item in bad if item['kind']=='local') + query=next(item for item in bad if item['kind']=='query') + query.update(global_field=local['global_field'],start=local['start'][:],end=local['end'][:]) + controls={'thin_query_overlaps_local_owned':reject(lambda:check_global_intervals(bad,interface['productive_fields']))} + return dict(intervals=intervals,controls=controls,address_order='physical event, sequential port, local instruction') diff --git a/research/p104-caller-owned-interface/evidence/candidate-guard.json b/research/p104-caller-owned-interface/evidence/candidate-guard.json new file mode 100644 index 0000000000..46daf80901 --- /dev/null +++ b/research/p104-caller-owned-interface/evidence/candidate-guard.json @@ -0,0 +1,19 @@ +{ + "command": [ + "python", + "-B", + "adapter.py", + "run", + "pr5713.binding.json", + "candidate" + ], + "elapsed_seconds": 26.313000000081956, + "exit_code": 0, + "log_sha256": "8a50306194c20b5f8c0c86bc60f9c7b3e1d6f5c8ddeee9ead14d3506d40e13dd", + "memory_limit_mib": 512, + "rss_samples": 262, + "sampled_peak_child_rss_bytes": 76578816, + "scope": "Operational resource bounds on the non-spawning scientific child; scientific claims depend on its output. Command paths normalized for publication; source output hashes are unchanged.", + "termination": null, + "timeout_seconds": 120 +} diff --git a/research/p104-caller-owned-interface/evidence/candidate-receipt.json b/research/p104-caller-owned-interface/evidence/candidate-receipt.json new file mode 100644 index 0000000000..7f3061e9a6 --- /dev/null +++ b/research/p104-caller-owned-interface/evidence/candidate-receipt.json @@ -0,0 +1,38 @@ +{ + "controls": { + "exterior_sign": "literal complete free-Laurent endpoint and exterior signs", + "global_phase": "nonzero absolute spectral phase", + "helper_alias_collision": "helper output alias collision", + "laurent_exponent_overflow": "Laurent exponent overflow rejected, never wrapped", + "lost_idle": "literal complete free-Laurent endpoint and exterior signs", + "missing_final_main_translation": "missing final main translation", + "missing_inverse_Q_correction": "literal clear/copy/positive-child/correct/add/clear chronology", + "omitted_contact_translation": "missing nonzero physical contact translation", + "overlapping_local_owned_alias": "Overlapping owned lifetime alias", + "owned_lifetime": "owned query/source/destination separation", + "owned_marked_productive": "Distinct independent public roles", + "reused_owned_label_before_clear": "Owned initialization chronology", + "stale_independent_inventory": "Every field is independent or owned", + "stale_source_lifetime_inventory": "Independently recounted input and lifetime inventory", + "thin_query_overlaps_local_owned": "Caller owned intervals cannot overlap on one field", + "wrong_route": "contact absolute/quadratic phase" + }, + "native_checks": { + "distinct_signed_Pauli_and_independent_phase_anchors": 302, + "fresh_helpers": 9630, + "owned_peak": 2 + }, + "ordinary": { + "abstract_address_phase_scalar_pass_upper": 124284844, + "local_contact_pass_bound": 306, + "machine_and_precision_admitted": false, + "main_map_pair_pass_bound": 699, + "meaning": "fixed finite descriptor passes under retained per-pass/tape contract; not a new tape or precision theorem", + "paid_native_maps_replayed": false, + "retained_raw_scalar_upper": 184647552 + }, + "output_sha256": "9fe876e5e74e878e691b0f9277ebbc39ce4610262526632db489816a4dd741ac", + "paid": 66348, + "status": "PASS_CANDIDATE_SCOPED_CALLER", + "targets": 12958 +} diff --git a/research/p104-caller-owned-interface/evidence/historical-pr5684-binding.json b/research/p104-caller-owned-interface/evidence/historical-pr5684-binding.json new file mode 100644 index 0000000000..e0ae2bebf7 --- /dev/null +++ b/research/p104-caller-owned-interface/evidence/historical-pr5684-binding.json @@ -0,0 +1,25 @@ +{ + "adapter_sha256": "bc8fc77d3c8dbeec83f9c0cdf8084b507df68f5a5edcae943ba6a19b9b1496cb", + "declared_source_head": "d0f6fa2555410a1e23fe4191424c2097ab3d5d97", + "edits": [ + "authenticated capsule location", + "independent public inventory", + "source physical receipt schema", + "retired-public target exclusion", + "literal overlapping owned schedule", + "ordinary recount actual owned lifetimes", + "second ordinary recount agreement", + "result interface schema", + "actual simultaneous scratch census", + "explicit candidate source and scratch evidence" + ], + "generated_checker_sha256": "0e6096f7ec2c321cf4162ee0f28744c70b00211c50fc8ef74c7a9a7f5ceacb86", + "interface_sha256": "b827ba3ec2c23b612fc031f8d086b275a7745ca18bce94e7e16df9005b2b95c2", + "original_checker_sha256": "0e5e0e3d56165437fc2821f41927e3f0cae838c60841a93e8b5cb46caeb7657c", + "original_output_sha256": "b51a7d19c10faea7d569a48e9536db8ba1e7418f8dd8dfb25646cc87cc9c4009", + "result_bytes_sha256": "de245b8762f4e7f5e73ed5b3c6c5e47fa0f64caa9c852986164359e9aec1f2dd", + "schema": "p104-explicit-interface-binding/v1", + "selected_checker_sha256": "6fce1e331747aebee13ecc6e33ab2fd49b9383640c20546e245be3e624933b52", + "word_bytes_sha256": "d6db1d0d97b13ea483a462c65437664d15d34dec56c3682cf6e1de31266ec6c2", + "word_canonical_sha256": "3ae490190103898b9a20d32a4be8865b1214dd9a84a154e509022dc698e3f8fc" +} diff --git a/research/p104-caller-owned-interface/evidence/historical-pr5684-receipt.json b/research/p104-caller-owned-interface/evidence/historical-pr5684-receipt.json new file mode 100644 index 0000000000..0cef8171a1 --- /dev/null +++ b/research/p104-caller-owned-interface/evidence/historical-pr5684-receipt.json @@ -0,0 +1,38 @@ +{ + "controls": { + "exterior_sign": "literal complete free-Laurent endpoint and exterior signs", + "global_phase": "nonzero absolute spectral phase", + "helper_alias_collision": "helper output alias collision", + "laurent_exponent_overflow": "Laurent exponent overflow rejected, never wrapped", + "lost_idle": "literal complete free-Laurent endpoint and exterior signs", + "missing_final_main_translation": "missing final main translation", + "missing_inverse_Q_correction": "literal clear/copy/positive-child/correct/add/clear chronology", + "omitted_contact_translation": "missing nonzero physical contact translation", + "overlapping_local_owned_alias": "Overlapping owned lifetime alias", + "owned_lifetime": "owned query/source/destination separation", + "owned_marked_productive": "Distinct independent public roles", + "reused_owned_label_before_clear": "Owned initialization chronology", + "stale_independent_inventory": "Every field is independent or owned", + "stale_source_lifetime_inventory": "Independently recounted input and lifetime inventory", + "thin_query_overlaps_local_owned": "Caller owned intervals cannot overlap on one field", + "wrong_route": "contact absolute/quadratic phase" + }, + "native_checks": { + "distinct_signed_Pauli_and_independent_phase_anchors": 302, + "fresh_helpers": 9630, + "owned_peak": 2 + }, + "ordinary": { + "abstract_address_phase_scalar_pass_upper": 124302196, + "local_contact_pass_bound": 306, + "machine_and_precision_admitted": false, + "main_map_pair_pass_bound": 699, + "meaning": "fixed finite descriptor passes under retained per-pass/tape contract; not a new tape or precision theorem", + "paid_native_maps_replayed": false, + "retained_raw_scalar_upper": 184647552 + }, + "output_sha256": "b0cdb4c137b90dd1abd13d97a275434dda0b1edc37f6e25ce4b9a97230a18768", + "paid": 66366, + "status": "PASS_CANDIDATE_SCOPED_CALLER", + "targets": 12958 +} diff --git a/research/p104-caller-owned-interface/evidence/original-guard.json b/research/p104-caller-owned-interface/evidence/original-guard.json new file mode 100644 index 0000000000..d8f638ef73 --- /dev/null +++ b/research/p104-caller-owned-interface/evidence/original-guard.json @@ -0,0 +1,19 @@ +{ + "command": [ + "python", + "-B", + "adapter.py", + "run", + "pr5684-v3.binding.json", + "original" + ], + "elapsed_seconds": 25.625, + "exit_code": 0, + "log_sha256": "f007aff4605a00bd582a7c3369b431f4fb131489cfb9de61e7b70b5b91e95eba", + "memory_limit_mib": 512, + "rss_samples": 255, + "sampled_peak_child_rss_bytes": 73019392, + "scope": "Operational resource bounds on the non-spawning scientific child; scientific claims depend on its output. Command paths normalized for publication; source output hashes are unchanged.", + "termination": null, + "timeout_seconds": 120 +} diff --git a/research/p104-caller-owned-interface/evidence/original-receipt.json b/research/p104-caller-owned-interface/evidence/original-receipt.json new file mode 100644 index 0000000000..5f33a23db5 --- /dev/null +++ b/research/p104-caller-owned-interface/evidence/original-receipt.json @@ -0,0 +1,32 @@ +{ + "controls": { + "exterior_sign": "literal complete free-Laurent endpoint and exterior signs", + "global_phase": "nonzero absolute spectral phase", + "helper_alias_collision": "helper output alias collision", + "laurent_exponent_overflow": "Laurent exponent overflow rejected, never wrapped", + "lost_idle": "literal complete free-Laurent endpoint and exterior signs", + "missing_final_main_translation": "missing final main translation", + "missing_inverse_Q_correction": "literal clear/copy/positive-child/correct/add/clear chronology", + "omitted_contact_translation": "missing nonzero physical contact translation", + "owned_lifetime": "owned query/source/destination separation", + "wrong_route": "contact absolute/quadratic phase" + }, + "native_checks": { + "distinct_signed_Pauli_and_independent_phase_anchors": 288, + "fresh_helpers": 9486, + "owned_peak": 1 + }, + "ordinary": { + "abstract_address_phase_scalar_pass_upper": 127292680, + "local_contact_pass_bound": 306, + "machine_and_precision_admitted": false, + "main_map_pair_pass_bound": 699, + "meaning": "fixed finite descriptor passes under retained per-pass/tape contract; not a new tape or precision theorem", + "paid_native_maps_replayed": false, + "retained_raw_scalar_upper": 184647552 + }, + "output_sha256": "b51a7d19c10faea7d569a48e9536db8ba1e7418f8dd8dfb25646cc87cc9c4009", + "paid": 69912, + "status": "PASS_ORIGINAL_BYTE_EQUAL", + "targets": 12814 +} diff --git a/research/p104-caller-owned-interface/evidence/primary-prerequisite.log b/research/p104-caller-owned-interface/evidence/primary-prerequisite.log new file mode 100644 index 0000000000..c5e1b65bc5 --- /dev/null +++ b/research/p104-caller-owned-interface/evidence/primary-prerequisite.log @@ -0,0 +1,3 @@ +PASS temporal source identity and all 565504 endpoint entries +PASS all native maps, phases and the complete physical caller +PASS_P104_TEMPORAL_UPDATES_KAPPA_00310915222 diff --git a/research/p104-caller-owned-interface/expected/candidate.json.gz b/research/p104-caller-owned-interface/expected/candidate.json.gz new file mode 100644 index 0000000000..720b118760 Binary files /dev/null and b/research/p104-caller-owned-interface/expected/candidate.json.gz differ diff --git a/research/p104-caller-owned-interface/source/BINDING.json b/research/p104-caller-owned-interface/source/BINDING.json new file mode 100644 index 0000000000..d7152c1526 --- /dev/null +++ b/research/p104-caller-owned-interface/source/BINDING.json @@ -0,0 +1,25 @@ +{ + "adapter_sha256": "bc8fc77d3c8dbeec83f9c0cdf8084b507df68f5a5edcae943ba6a19b9b1496cb", + "declared_source_head": "a5348f7143f95fe0046b92b96172e30763c7d731", + "edits": [ + "authenticated capsule location", + "independent public inventory", + "source physical receipt schema", + "retired-public target exclusion", + "literal overlapping owned schedule", + "ordinary recount actual owned lifetimes", + "second ordinary recount agreement", + "result interface schema", + "actual simultaneous scratch census", + "explicit candidate source and scratch evidence" + ], + "generated_checker_sha256": "0e6096f7ec2c321cf4162ee0f28744c70b00211c50fc8ef74c7a9a7f5ceacb86", + "interface_sha256": "b827ba3ec2c23b612fc031f8d086b275a7745ca18bce94e7e16df9005b2b95c2", + "original_checker_sha256": "0e5e0e3d56165437fc2821f41927e3f0cae838c60841a93e8b5cb46caeb7657c", + "original_output_sha256": "b51a7d19c10faea7d569a48e9536db8ba1e7418f8dd8dfb25646cc87cc9c4009", + "result_bytes_sha256": "3ce2dfdd7ccb6b0d6d8d674bc7614a8302a0f2f9e23f16ece95dedb9d7ea561e", + "schema": "p104-explicit-interface-binding/v1", + "selected_checker_sha256": "6fce1e331747aebee13ecc6e33ab2fd49b9383640c20546e245be3e624933b52", + "word_bytes_sha256": "9fd67dd89ed24a644257cd9aef06934ed4c6fbe0441804684a968868f2ef66a8", + "word_canonical_sha256": "32adce6656e49aa020d3e6317f1c45c11fccadeeb67a8d506172d101703d2138" +} diff --git a/research/p104-caller-owned-interface/source/EXPORT.json b/research/p104-caller-owned-interface/source/EXPORT.json new file mode 100644 index 0000000000..cc8dddbd8c --- /dev/null +++ b/research/p104-caller-owned-interface/source/EXPORT.json @@ -0,0 +1,13 @@ +{ + "declared_source_head": "a5348f7143f95fe0046b92b96172e30763c7d731", + "files": { + "NOTICE-PR5713": "a252225cb4d9c61fc94b5b7f638600393a859e47750cfea7688c75b1f6610077", + "RESULT.json": "3ce2dfdd7ccb6b0d6d8d674bc7614a8302a0f2f9e23f16ece95dedb9d7ea561e", + "WORD.json.gz": "9fd67dd89ed24a644257cd9aef06934ed4c6fbe0441804684a968868f2ef66a8" + }, + "path": "research/p104-temporal-updates", + "pull_request": 5713, + "repository": "https://github.com/CrocSwap/integer-mult-bounds", + "scope": "Exact pending-source bytes exported locally. This is not a Git ancestry/admission claim. No fetch or pending Git object is needed at replay.", + "word_canonical_sha256": "32adce6656e49aa020d3e6317f1c45c11fccadeeb67a8d506172d101703d2138" +} diff --git a/research/p104-caller-owned-interface/source/NOTICE-PR5713 b/research/p104-caller-owned-interface/source/NOTICE-PR5713 new file mode 100644 index 0000000000..36c1b859be --- /dev/null +++ b/research/p104-caller-owned-interface/source/NOTICE-PR5713 @@ -0,0 +1,44 @@ +Four paid interior public-basis changes. +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +No subagents. + +The following exact notice is retained from PR5660. + +New helper-subspace construction, proof and replay: +Ali Romman with substantial OpenAI Codex assistance. Apache-2.0. +The same assistant performed the construction and author-side checks. + +Retained contributions: +flyingviper: PR5605 shared relay, PR5612 delayed relay, and the PR5608/PR5613 +relay/split compositions. +Scratch-net: PR5606 prepared-helper identities and target debit. +Pierre-Loic Doulcet (hexapode): PR5565 commuting-contact construction, used as the exact source. +Ali Romman: PR5602 fixed boundary relations, PR5601 three-contact frame +change, PR5580 contact step, +and PR5544/5545 complete P104 caller. +Joel Pulikkan (GamingPuzzled): PR5569 priced helper handoff. +DreamingOfClouds: PR5561 free helper endpoints and PR5568 search tools. +thu-nmrc: PR5551 contact improvements. +Gareth Davidson (bitplane): PR2305 source composition. +David Arias: PR2152 coalesced P104 word. +Cinna Davis: PR2219 private reuse and the controller lineage. +Jacob Alan Sussman: productive mixed-target recursion. +zxv and Cao Yifan: exact intervals, compiler and native/pricing lineage. +GamingPuzzled: PR5472 successor handoff, a predecessor to the split concept. +The retained source notices preserve earlier geometry, BIT and analytic credit. + +The elementary rank-one basis identity is not claimed as a new general +linear-algebra theorem. The contribution is its explicit independent-target +use on this P104 word and the complete conditional kappa improvement. + +New contribution: Ali Romman, with substantial OpenAI Codex assistance. +The four-gate source-version rewrite composes zxv PR5643 and Ali Romman PR5644. +The A2 method retains Chris R/Clear1nsight PR3998 and ToikY PR4019 credit. +The compensated triangle method retains Cinna Davis PR4692 credit. +No subagents were used for this contribution. Apache-2.0. + +Concurrent PR5650 by zxv publishes the PR5643/PR5644 composition. PR5651 by +Ali Romman corroborates it. This package credits that released composition +and contributes the further four-gate placement. + +New work: distributed scalar updates on an unobserved public field interval, the exact witness and complete conditional price. Prepared for Ali Romman with substantial OpenAI Codex assistance. No subagents. Apache-2.0. The source archive retains all predecessor notices. diff --git a/research/p104-caller-owned-interface/source/RESULT.json b/research/p104-caller-owned-interface/source/RESULT.json new file mode 100644 index 0000000000..8fc639f9b3 --- /dev/null +++ b/research/p104-caller-owned-interface/source/RESULT.json @@ -0,0 +1,404 @@ +{ + "complete_cost": { + "compiler": { + "H": 80511200000000000, + "N": "2^80511200000000000", + "eta": { + "lower": "0.000000131022217212430301374984", + "upper": "0.000000131022217212430301374985" + }, + "gap": "1/1400000000000", + "integer_test_exponent": 57508, + "logarithm_power": 1024, + "theta": "63/64", + "uniform_saving": "2176406557/700000000000", + "word_materialized": false + }, + "full_forward_calls": 18, + "gain": "4391/10000000000", + "kappa": "155457611/50000000000", + "kappa_decimal": "0.00310915222", + "margin_at_previous": { + "lower": "0.106625834236318763156961686328", + "upper": "0.106625834236318763156961686329" + }, + "negative_controls": { + "old_BIT": "Rejected by outer inequalities", + "old_cutoff": "Rejected by completion-tail ratio greater than one" + }, + "nonrecursive": { + "fixed_scalar_growth_bound": "At most 2^(16*26000) before native factors; a declared constant, not an attained norm.", + "local_paid_rank_mass": 5987, + "local_routes": 5164000, + "local_scalar": 220326, + "peak_owned_fields": 2, + "raw_budget": 1000000000, + "raw_scalar_upper": 184647552, + "tensor_native_growth_bound": "Each rank-r Gaussian has row l1 norm at most 2^(rf); use local_paid_rank_mass for the whole word." + }, + "ordinary_BIT": { + "admitted": "17/5000", + "after_cover": "69/20000", + "atom": "1/250", + "before_cover": "3459/1000000", + "ordinary_saving": "8590884599/2500000000000", + "prime_rule": "odd q > 2^26*N^5 avoiding all fixed denominators and rank witnesses" + }, + "outer": { + "functional_checks": { + "actual_new_BIT_stock_sublinear": "348599999999253/350000000000000", + "fixed_halo_explicit_metadata_branch": "26950000000001/350000000000", + "new_BIT_row_stock_sublinear_in_active_group": "1395799999997009/1400000000000000", + "new_semantic_group_guard": "3/1400000000000" + }, + "margins": { + "boundary_algebraic_matrix": "6093938356795647186889/1960000000000000000000000", + "fused_gaussian": "6093938356786941560667/1960000000000000000000000", + "global_coordinate_router": "544101639/175000000000", + "group_bit_router": "761742294773367695083/245000000000000000000000", + "group_scans": "699999999999/700000000000", + "main_transform": "6093938355395647186889/1960000000000000000000000", + "microbox_face_corrections": "26950000000001/350000000000", + "polynomial_products": "1399999999999/1400000000000", + "sparse_union_movement": "802343938356795647186889/1960000000000000000000000" + }, + "parameters": { + "a": "544101639/175000000000", + "b": "4352813113/1400000000000", + "beta": "1399999999997/1400000000000", + "bit_saving": "17/5000", + "cap_xi": "1782343938355395647186889/1960000000000000000000000", + "complex_uniform_saving": "2176406557/700000000000", + "d": "1/1400000000000", + "epsilon": "1399999999999/1400000000000", + "kappa": "155457611/50000000000", + "lambda_": "398756339111/400000000000", + "lambda_prime": "1395647186889/1400000000000", + "layout": "1/1400000000000", + "q": "4352813111/1400000000000", + "r0": "1/14000000000000", + "stop": "1/1400000000000", + "tested_saving": "124366089/40000000000" + }, + "strict_checks": { + "actual_bit_above_effective": "50898361/175000000000", + "actual_logarithmic_gamma_guard": "1/1400000000000", + "actual_logarithmic_group_guard": "177656061646704352813111/980000000000000000000000", + "alpha_logarithm_absorption": "1/14000000000000", + "boundary_algebraic_matrix_above_kappa": "5595647186889/1960000000000000000000000", + "cap_above_band": "802343938355395647186889/1960000000000000000000000", + "cap_below_cell": "177656061643204352813111/1960000000000000000000000", + "cap_below_phase_cell_power": "2137656061644604352813111/1960000000000000000000000", + "complex_above_effective": "1/1400000000000", + "complex_below_one_over_32": "39397186887/1400000000000", + "complex_endpoint": "1/700000000000", + "epsilon_below_one": "1/1400000000000", + "epsilon_positive": "1399999999999/1400000000000", + "fine_prime_halo_umbrella": "7/2", + "fused_gaussian_above_kappa": "5586941560667/1960000000000000000000000", + "gaussian_above_main": "695647186889/980000000000000000000000", + "global_coordinate_router_above_kappa": "1/350000000000", + "global_gamma_power_slack": "9/14000000000000", + "group_below_dimension": "1/700000000000", + "group_bit_router_above_kappa": "873367695083/245000000000000000000000", + "group_gauge_power_slack": "177656061646634352813111/980000000000000000000000", + "group_key_fits_record": "1/700000000000", + "group_positive": "1399999999997/1400000000000", + "group_scans_above_kappa": "139564718689/140000000000", + "halo_covers_generic_inverse_radius": "5", + "improvement_over_user_baseline": "689090900400418148631/500000000000000000000000", + "lambda_above_internal": "1/2800000000000", + "lambda_above_sigma": "3/2800000000000", + "lambda_above_tau": "1/2800000000000", + "lambda_prime_above_lambda": "1/2800000000000", + "lambda_prime_above_leaf": "2795647186887/1960000000000000000000000", + "leaf_saving_above_effective": "1395647186887/1960000000000000000000000", + "main_transform_above_kappa": "4195647186889/1960000000000000000000000", + "membership_arithmetic_fits_record": "1/1400000000000", + "microbox_face_corrections_above_kappa": "6737227949181/87500000000", + "microbox_halo_volume": "110600000000003/1400000000000", + "new_complex_uniform_saving_above_b": "1/1400000000000", + "new_semantic_guard_with_C1_one": "1/1400000000000", + "polynomial_products_above_kappa": "1395647186891/1400000000000", + "positive_layout_slack": "1/1400000000000", + "q_below_effective": "1/1400000000000", + "q_below_internal": "1/1400000000000", + "q_below_leaf": "2795647186887/1960000000000000000000000", + "q_positive": "4352813111/1400000000000", + "short_record_fallback": "1395647186887/1400000000000", + "source_axis_superpolynomial": "1/1400000000000", + "sparse_union_movement_above_kappa": "796250000005595647186889/1960000000000000000000000", + "stop_below_one": "1399999999999/1400000000000", + "stop_positive": "1/1400000000000", + "strassen_integer_power_gap": "1951441519231", + "support_router_span": "3/1400000000000", + "theta_positive_polynomial_power": "2", + "union_header_fits_record": "3/1400000000000", + "union_tag_work_per_visit_fits_record": "3/1400000000000" + } + }, + "paid": { + "1": 40872, + "16": 416, + "2": 8262, + "24": 416, + "3": 8910, + "32": 416, + "4": 1656, + "40": 416, + "48": 416, + "5": 2862, + "56": 416, + "6": 396, + "64": 416, + "7": 270, + "72": 208 + }, + "paid_calls": 66348, + "previous_open_pr5660": "19429457/6250000000", + "productive_fields": 12958, + "query_shears": 15, + "rank_mass_surplus": 760, + "raw_ceiling": { + "derivative_upper": "-739527737203957000275288525290373783419970457168925055914772323/3138550867693340381917894711603833208051177722232017256448", + "interval": [ + "0", + "17/5000" + ] + }, + "raw_headroom": [ + "1281/50000000000000", + "2563/100000000000000" + ], + "raw_root_interval": [ + "155457612281/50000000000000", + "310915224563/100000000000000" + ], + "relative_gain_percent": "548875/38858914", + "strictification": { + "alpha": { + "lower": "0.999999999979045390727904314922", + "upper": "0.999999999979045390727904314923" + }, + "cutoff": 17, + "delta": { + "lower": "0.967460429302773034801102736481", + "upper": "0.967460429302773034801102736482" + }, + "floor": 18, + "gamma": { + "lower": "0.968263729732811178316707419523", + "upper": "0.968263729732811178316707419524" + }, + "normalized_paid_upper": "1048576000976562501/1048576001073741824", + "power": 1024, + "reserve": "1/1000000000000", + "tail_block": 128, + "tail_decay": "39/40", + "tail_offset": "1/5", + "tested": "124366089/40000000000" + }, + "targets": { + "1": 36, + "145": 208, + "17": 416, + "2": 72, + "25": 416, + "33": 416, + "4": 1638, + "41": 416, + "49": 416, + "5": 108, + "57": 416, + "65": 416, + "7": 90, + "73": 208, + "8": 270, + "9": 7416 + }, + "whole_idle_jobs": 3120 + }, + "limits": [ + "The five inherited framework assumptions remain.", + "The complete rounded multiplier and huge uniform word are not materialized.", + "Author checks do not establish independent scientific acceptance.", + "The gain is small. No large gain or global optimum is claimed." + ], + "local": { + "endpoint_coefficients": 565504, + "helpers": { + "1": 2, + "2": 4, + "4": 91, + "5": 6, + "7": 5, + "8": 15, + "9": 412 + }, + "owned_fields": 9, + "owned_lifetimes": 11, + "paid": { + "1": 2184, + "2": 459, + "3": 495, + "4": 92, + "5": 159, + "6": 22, + "7": 15 + }, + "paid_rank_mass": 5987, + "peak_owned_fields": 2, + "public_inputs": 743, + "real_scalar_allowance": 220326 + }, + "local_helper_delta": {}, + "local_paid_delta": { + "1": -1, + "2": -1, + "3": 1 + }, + "native": { + "distinct_maps": 2917, + "helper_normalizers": 1070, + "helpers": { + "1": 2, + "2": 4, + "4": 91, + "5": 6, + "7": 5, + "8": 15, + "9": 412 + }, + "main_adapters": 208, + "proof": "Every signed Pauli image and exact global phase; frame induction at every positive tensor width", + "recipe_payload_sha256": "626b4ce338e77fd1f5c5d90cf107d91bb73af42c107cd8eea14fe657ddb324e4", + "wrong_phase_rejected": true + }, + "negative_controls": { + "extra_target": "Every productive helper has a native target", + "interval_crosses_target_read": "No original instruction reads the changed target", + "missing_central_translation": "Rejected by the complete Laurent endpoint", + "missing_late_update": "Exact distributed source functional", + "missing_native_transport": "Scalar destination and coefficient", + "missing_owned_erasure": "All public and owned exits", + "unpaid_query": "Complete field and call counts", + "wrong_common_frame": "Each replacement has an actual common frame", + "wrong_history_sign": "Exact distributed source functional" + }, + "physical_caller": { + "central_square_columns": 53248, + "full_calls": 18, + "main_targets": { + "145": 208, + "17": 416, + "25": 416, + "33": 416, + "41": 416, + "49": 416, + "57": 416, + "65": 416, + "73": 208 + }, + "new_paid_jobs": 0, + "physical_contacts": 7488, + "ports": 104, + "route_payload_sha256": "7f4f0ca768ffbc4f93dcff575592c4c67411f46b4289e45b73f715a2ad47b142", + "tensor_rule": "Factorwise native maps; scalar signs stay outside the tensor power.", + "whole_idle_jobs": { + "16": 416, + "24": 416, + "32": 416, + "40": 416, + "48": 416, + "56": 416, + "64": 416, + "72": 208 + }, + "wrapper_sites": [ + 1, + 3, + 5, + 7, + 9, + 11, + 13, + 15, + 17, + 19, + 21, + 23, + 25, + 27, + 29, + 31 + ] + }, + "separate_columns": { + "arithmetic": "Dense integer rows with binary denominators; reverse chronology", + "coefficients": 565504, + "columns": 752 + }, + "source_commit": "d0f6fa2555410a1e23fe4191424c2097ab3d5d97", + "source_local": { + "endpoint_coefficients": 565504, + "helpers": { + "1": 2, + "2": 4, + "4": 91, + "5": 6, + "7": 5, + "8": 15, + "9": 412 + }, + "owned_fields": 9, + "owned_lifetimes": 11, + "paid": { + "1": 2185, + "2": 460, + "3": 494, + "4": 92, + "5": 159, + "6": 22, + "7": 15 + }, + "paid_rank_mass": 5987, + "peak_owned_fields": 2, + "public_inputs": 743, + "real_scalar_allowance": 220290 + }, + "status": "PASS_P104_TEMPORAL_UPDATES_KAPPA_00310915222", + "temporal_identity": { + "observations": [ + [ + 823, + 525, + 3, + 1 + ], + [ + 823, + 712, + 3, + 1 + ], + [ + 14983, + 525, + 396, + 106 + ], + [ + 14983, + 340, + 396, + 7 + ] + ], + "removed_event": 13578, + "role": 715, + "source_coefficients": 105, + "source_sha256": "cddffb3e9a025e4a68c44ef66cc5c88b2d8eb88c6180415d7552f04ff6a48689", + "start": 823, + "stop": 14983 + } +} diff --git a/research/p104-caller-owned-interface/source/WORD.json.gz b/research/p104-caller-owned-interface/source/WORD.json.gz new file mode 100644 index 0000000000..45f6c10bf8 Binary files /dev/null and b/research/p104-caller-owned-interface/source/WORD.json.gz differ diff --git a/research/p104-caller-owned-interface/source/selected-adapter.patch b/research/p104-caller-owned-interface/source/selected-adapter.patch new file mode 100644 index 0000000000..83e327e9eb --- /dev/null +++ b/research/p104-caller-owned-interface/source/selected-adapter.patch @@ -0,0 +1,100 @@ +--- selected-caller-check.py ++++ explicit-interface-caller-check.py +@@ -18,7 +18,8 @@ + import sys + import time + +-B = Path(__file__).resolve().parent ++B = Path(os.environ['P104_CAPSULE_CHECKER']).resolve().parent ++from p104_caller_interface import audit, allocation, caller_schedule + ROOT = B.parents[1] + PRIOR = ROOT/'outputs/p104-contact-reassessment-20261025' + NATIVE = ROOT/'outputs/p104-native-contact-audit-20261025' +@@ -260,8 +261,9 @@ + controller = read(PRIOR/'sources/predecessor/CONTROLLER.json') + source = read(Path(os.environ['P104_RESULT'])) if 'P104_RESULT' in os.environ else read(PRIOR/'sources/contact/RESULT.json') + public = word['public'] +- helper_count = public - 208 +- field_count = 3328 + 18*helper_count ++ interface = audit(word, source) ++ helper_count = interface['helper_count'] ++ field_count = interface['productive_fields'] + global FIELD_COUNT + FIELD_COUNT = field_count + phases = {r['q']: r['idle_children'][0]['orthogonal_axes'][:8] for r in read(B/'sources/DATA-PHASES.json')['recipes']} +@@ -301,7 +303,7 @@ + routes.append({'stage': stage, 'pair': pair, 'port': port, 'q': q, 'swap_vectors': swaps, 'maps': maps}) + contact_payload.append([stage, q, maps]) + checkpoint('contact_site_complete', stage_index=stage, contacts=4*len(routes)) +- need(hashlib.sha256(json.dumps(contact_payload, separators=(',', ':')).encode()).hexdigest() == source['physical_caller']['route_payload_sha256'], 'author contact payload independently reconstructed') ++ need(hashlib.sha256(json.dumps(contact_payload, separators=(',', ':')).encode()).hexdigest() == source_physical(source)['route_payload_sha256'], 'author contact payload independently reconstructed') + a, b, route = first_translation + controls['omitted_contact_translation'] = reject(lambda: need(polynomial(moved(a, route)) == polynomial(b), 'missing nonzero physical contact translation')) + controls['wrong_route'] = reject(lambda: contact(a, b, AXES)) +@@ -337,7 +339,8 @@ + exact(V.adjoint(right)+literal+V.adjoint(left), V.fourier(rec['rank']), 'normalized helper Gaussian') + return rec, check + local_main = set(word['live']) | {r+112 for r in word['live']} +- helpers = [r for r in range(public) if r not in local_main] ++ helpers = interface['helpers'] ++ need(local_main == set(interface['main']), 'Independent main inventory agrees') + helper_profile = Counter() + for h in helpers: + a, b = word['initial'][h], word['final'][h] +@@ -359,14 +362,10 @@ + adapters.append({'local_field': r, 'recipe': rec, 'exact_check': exact(V.recipe(rec), literal, 'intrinsic main adapter')}) + checkpoint('main_intrinsic_adapters_complete', adapters=len(adapters)) + need(len(helpers) == helper_count and helper_profile == Counter({int(k):v for k,v in source['local']['helpers'].items()}), 'complete helper profile') +- fields = [] +- for site, event in enumerate(full): +- mapping = {} +- for p, r in enumerate(word['live']): +- mapping[r], mapping[r+112] = 2*event[2]*104+p, (2*event[2]+1)*104+p +- mapping.update({h:3328+site*helper_count+i for i, h in enumerate(helpers)}) +- need(len(mapping) == len(set(mapping.values())) == public, 'injective full-call public inventory') +- fields.append({'site': site, 'stage': event[1], 'local_to_global': [mapping[i] for i in range(public)], 'owned_lifetimes': {f'{public}..{public+7}':field_count}}) ++ fields = allocation(interface, full, word['live']) ++ global_owned = caller_schedule(interface, controller, fields) ++ controls.update(interface['controls']) ++ controls.update(global_owned['controls']) + helper_ids = [f['local_to_global'][h] for f in fields for h in helpers] + need(set(helper_ids) == set(range(3328, field_count)) and len(helper_ids) == len(set(helper_ids)), 'all fresh helpers owned once') + def bad_alias(): +@@ -441,7 +440,8 @@ + q=F(e[-2]); n,d=abs(q.numerator),q.denominator + if e[0] == 'SCALE': scalar += 2*(abs(n.bit_length()-d.bit_length())+int(q<0)) + else: scalar += 2*(3+n.bit_length()-1+n.bit_count()+d.bit_length()-1) +- need(nr['local_scalar'] == scalar and nr['local_routes'] == (sum(paid_local.values())+2*helper_count+208+4*104+4*8)*1000, 'independently recounted ordinary allowances') ++ need(nr['local_scalar'] == scalar and nr['local_routes'] == (sum(paid_local.values())+2*helper_count+208+4*104+4*interface['lifetime_count'])*1000, 'independently recounted ordinary allowances') ++ need(scalar == interface['scalar'] and nr['local_routes'] == interface['routes'], 'Second literal ordinary recount agrees') + events, boundary = len(controller['physical_events']), sum(len(controller['boundaries'][s+'_program']) for s in ('left', 'right')) + ordinary = 18*(nr['local_scalar']+nr['local_routes'])+len(queries)*1000+2*len(idles)*1000+len(mains)*1000+16*32*104*(events+boundary)+sum(e[0] == 'Q_POWER' for e in controller['physical_events'])*104*9 + need(17*17+17 < 1000 and 2*(264+81)+9 < 1000, 'explicit fixed-map address-pass bounds') +@@ -449,13 +449,13 @@ + # Packed representation controls are exact, with no modular exponent alias. + controls['laurent_exponent_overflow'] = reject(lambda: shifted([{packed((127,)+(0,)*33):1}], (1,)+(0,)*33)) + need(shifted([{packed((-2,)+(0,)*33):3}], (2,)+(0,)*33) == [{ZERO:3}], 'negative Laurent powers retained exactly') +- result = {'schema':'p104-physical-caller-target-binding/v1', 'status':'PASS_SCOPED_CALLER_AND_TARGET_BINDING', ++ result = {'schema':'p104-physical-caller-target-binding/explicit-owned-interface-v2', 'status':'PASS_SCOPED_CALLER_AND_TARGET_BINDING', + 'reviewed_head':manifest['reviewed_head'], 'canonical_main':manifest['canonical_main'], 'sources':manifest['files'], + 'dimension':DIM, 'free_laurent_endpoint_sha256':endpoint_hash, 'route_recipes':routes, + 'helper_normalizers':normalizers, 'intrinsic_main_adapters':adapters, 'field_maps':fields, + 'canonical_layouts':layouts, 'main_targets':mains, 'whole_idles':idles, 'thin_queries':queries, + 'paid':dict(sorted(paid.items())), 'targets':dict(sorted(targets.items())), 'controls':controls, +- 'native_checks':{'distinct_signed_Pauli_and_independent_phase_anchors':len(checked), 'fresh_helpers':len(helper_ids), 'owned_peak':1}, ++ 'native_checks':{'distinct_signed_Pauli_and_independent_phase_anchors':len(checked), 'fresh_helpers':len(helper_ids), 'owned_peak':interface['peak']}, + 'ordinary':{'abstract_address_phase_scalar_pass_upper':ordinary, 'retained_raw_scalar_upper':nr['raw_scalar_upper'], + 'paid_native_maps_replayed':False, 'machine_and_precision_admitted':False, + 'main_map_pair_pass_bound':2*(264+81)+9, 'local_contact_pass_bound':17*17+17, +@@ -463,6 +463,11 @@ + 'limits':['Local all-input native ABI and untouched paid-map correctness remain inherited.', + 'Spectators are not additional productive outputs; helper normalizers occur before/after their own fresh call.', + 'No full compiler/outer replay or independent human/formal admission. No kappa claim.'], 'kappa_claim':None} ++ result['candidate_input'] = CANDIDATE_INPUT ++ result['local_interface'] = {key:interface[key] for key in ++ ('public_slots','fields','independent','owned','retired','helper_count','productive_fields','lifetime_count','peak')} ++ result['owned_scratch_fields'] = list(range(field_count, field_count+interface['peak'])) ++ result['owned_caller_schedule'] = global_owned + checkpoint('invoice_complete', paid=sum(paid.values()), targets=sum(targets.values())) + print(json.dumps(result, sort_keys=True, separators=(',', ':'))) + checkpoint('scientific_output_complete') diff --git a/research/p104-caller-owned-interface/verify.py b/research/p104-caller-owned-interface/verify.py new file mode 100644 index 0000000000..7e84a5f838 --- /dev/null +++ b/research/p104-caller-owned-interface/verify.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python3 +"""Exact independent forward-caller replay with explicit owned inventories. + +Prepared for flyingviper with substantial OpenAI Codex assistance. Apache-2.0. +Canonical PR5550 and PR5599 source notices remain intact. +""" +from pathlib import Path +import argparse +from copy import deepcopy +import gzip +import hashlib +import importlib.util +import json +import os +import subprocess +import sys +import tempfile +import time +import types + +HERE=Path(__file__).resolve().parent +CAPSULE='research/p104-caller-independent-audit/capsule' +CHECK=CAPSULE+'/outputs/p104-caller-route-audit-v2-20261025/check.py' +SELECTED='docs/research/pr-intake-evidence/pr5599/caller-check.py' +EXPECTED='research/p104-caller-independent-audit/expected/caller.json.gz' + +def need(ok,message): + if not ok: raise ValueError(message) + +def sha(raw): return hashlib.sha256(raw).hexdigest() + +def load(path,name): + spec=importlib.util.spec_from_file_location(name,path) + module=importlib.util.module_from_spec(spec);sys.modules[name]=module + spec.loader.exec_module(module);return module + +def authenticate(root): + for row in json.loads((HERE/'SOURCES.json').read_text())['files']: + if row['usage']=='input': + path=root/row['path'];raw=path.read_bytes() + need(not path.is_symlink() and sha(raw)==row['sha256'],'Canonical source byte '+row['path']) + need(hashlib.sha1(b'blob '+str(len(raw)).encode()+b'\0'+raw).hexdigest()==row['git_blob'], + 'Canonical source blob '+row['path']) + inventory=json.loads((HERE/'PACKAGE-INVENTORY.json').read_text())['files'] + actual={p.relative_to(HERE).as_posix() for folder in ('source','expected','code','evidence') + for p in (HERE/folder).rglob('*') if p.is_file()} + need(actual==set(inventory),'Complete frozen package inventory') + for name,digest in inventory.items(): + path=HERE/name + need(not path.is_symlink() and sha(path.read_bytes())==digest,'Frozen package byte '+name) + binding=json.loads((HERE/'source/BINDING.json').read_text()) + need(sha((root/CHECK).read_bytes())==binding['original_checker_sha256'],'Original checker pin') + need(sha((root/SELECTED).read_bytes())==binding['selected_checker_sha256'],'Selected adapter pin') + need(sha(gzip.decompress((root/EXPECTED).read_bytes()))==binding['original_output_sha256'],'Original output pin') + for key in ('interface','adapter'): + need(sha((HERE/'code'/(key+'.py')).read_bytes())==binding[key+'_sha256'],'Checked adapter source '+key) + for key,filename in (('word','WORD.json.gz'),('result','RESULT.json')): + need(sha((HERE/'source'/filename).read_bytes())==binding[key+'_bytes_sha256'],'Candidate source '+key) + word=json.loads(gzip.decompress((HERE/'source/WORD.json.gz').read_bytes())) + need(sha(json.dumps(word,sort_keys=True,separators=(',',':')).encode())==binding['word_canonical_sha256'],'Canonical candidate word') + return binding + +def child(root,mode): + binding=authenticate(root) + # The frozen output uses UTF-8/LF; Windows stdout otherwise writes CRLF. + # Configure the stream before executing the unchanged scientific checker. + sys.stdout.reconfigure(encoding='utf-8',newline='\n') + # Operational trace portability only; no scientific object is changed. + try: import resource + except ImportError: + sys.modules['resource']=types.SimpleNamespace(RUSAGE_SELF=0,getrusage=lambda _:types.SimpleNamespace(ru_maxrss=None)) + for key in ('P104_WORD','P104_RESULT','P104_TRACE_FILE','P104_CAPSULE_CHECKER'): + os.environ.pop(key,None) + namespace=dict(__name__='__main__',__file__=str(root/CHECK)) + if mode=='original': + source=(root/CHECK).read_text() + else: + adapter=load(HERE/'code/adapter.py','p104_checked_caller_adapter') + load(HERE/'code/interface.py','p104_caller_interface') + source,_=adapter.adapted((root/SELECTED).read_text()) + need(sha(source.encode())==binding['generated_checker_sha256'],'Exact frozen selected-checker adaptation') + os.environ.update(P104_WORD=str(HERE/'source/WORD.json.gz'),P104_RESULT=str(HERE/'source/RESULT.json'),P104_CAPSULE_CHECKER=str(root/CHECK)) + namespace.update(source_physical=adapter.source_physical,CANDIDATE_INPUT={k:binding[k] for k in + ('declared_source_head','word_bytes_sha256','word_canonical_sha256','result_bytes_sha256','selected_checker_sha256','interface_sha256','adapter_sha256')}) + exec(compile(source,str(root/CHECK) if mode=='original' else 'explicit-owned-caller.py','exec'),namespace) + +def interface_fixture(root): + interface=load(HERE/'code/interface.py','p104_fixture_interface') + word=json.loads(gzip.decompress((HERE/'source/WORD.json.gz').read_bytes())) + result=json.loads((HERE/'source/RESULT.json').read_text()) + original=interface.audit(word,result) + # Permute one helper and one owned label. This produces a genuine public + # hole without changing a linear map, any chart, coefficient or interval. + helper,owned=573,word['public'] + need(helper in original['helpers'] and owned in original['owned'],'Fixed source relabeling fixture') + rename=lambda r:owned if r==helper else helper if r==owned else r + changed=deepcopy(word);changed['public']=word['public']+1 + zero=next(i for i,basis in enumerate(word['frames']) if not basis) + for side in ('initial','final'): + changed[side]=[zero]*changed['public'] + for role in original['independent']:changed[side][rename(role)]=word[side][role] + changed.update(fields=original['fields'],independent_public=[rename(r) for r in original['independent']], + owned_roles=[rename(r) for r in original['owned']],retired_public=[helper]) + for event in changed['program']: + event[1]=rename(event[1]) + if event[0] in ('ADD','COPY'):event[2]=rename(event[2]) + hole=interface.audit(changed,result) + for key in ('helper_count','productive_fields','paid','targets','scalar','routes','lifetime_count','peak'): + need(hole[key]==original[key],'Pure role permutation preserves '+key) + controller=json.loads((root/CAPSULE/'outputs/p104-contact-reassessment-20261025/sources/predecessor/CONTROLLER.json').read_text()) + full=[event for event in controller['physical_events'] if event[0]=='LOCAL'] + fields=interface.allocation(hole,full,changed['live']) + need(all(site['local_to_global'][helper] is None and site['local_to_global'][owned] is not None for site in fields), + 'Retired hole has no productive ID and relocated helper retains one') + schedule=interface.caller_schedule(hole,controller,fields) + return dict(status='PASS_EXACT_ROLE_PERMUTATION_PUBLIC_HOLE',retired_public=[helper], + relocated_helper=owned,public_slots=changed['public'],independent_inputs=len(hole['independent']), + owned_lifetimes=hole['lifetime_count'],peak=hole['peak'],caller_owned_intervals=len(schedule['intervals'])) + +def replay(root,mode,temporary,guard): + out=temporary/(mode+'.json');err=temporary/(mode+'.stderr') + command=[sys.executable,'-X','pycache_prefix='+str(temporary/'bytecode')] + if sys.flags.optimize: command.append('-O') + command+=['-B',str(HERE/'verify.py'),'--canonical-root',str(root),'--child',mode] + env=dict(os.environ,PYTHONDONTWRITEBYTECODE='1',OMP_NUM_THREADS='1',OPENBLAS_NUM_THREADS='1',MKL_NUM_THREADS='1') + env.pop('PYTHONOPTIMIZE',None) + start=time.monotonic();peak=0;cause=None + with out.open('wb') as output,err.open('wb') as errors: + proc=subprocess.Popen(command,stdout=output,stderr=errors,env=env, + creationflags=subprocess.CREATE_NO_WINDOW if os.name=='nt' else 0) + try: + while proc.poll() is None: + try: usage=guard.rss(proc) + except OSError: + if proc.poll() is None: raise + break + peak=max(peak,usage) + if usage>512*1024**2: cause='sampled memory exceeds512 MiB' + if time.monotonic()-start>120: cause='elapsed time exceeds120 seconds' + if cause: proc.kill();break + time.sleep(.1) + code=proc.wait() + except BaseException: + proc.kill();proc.wait();raise + need(code==0 and cause is None and not err.read_bytes(), + mode+' child failed: '+str(cause)+' '+err.read_text(errors='replace')[:4000]) + expected=gzip.decompress((root/EXPECTED if mode=='original' else HERE/'expected/candidate.json.gz').read_bytes()) + need(out.read_bytes()==expected,mode+' complete frozen scientific output equality') + return json.loads(expected),dict(mode=mode,seconds=time.monotonic()-start,sampled_peak_child_rss_bytes=peak, + complete_output_sha256=sha(expected),cap_seconds=120,cap_mib=512) + +def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--canonical-root',type=Path,default=HERE.parents[1],help='Draft replay only; registered replay uses repository root') + parser.add_argument('--child',choices=('original','candidate')) + parser.add_argument('--check-only',action='store_true') + parser.add_argument('--interface-only',action='store_true') + args=parser.parse_args();root=args.canonical_root.resolve();authenticate(root) + if args.child: child(root,args.child);return + if args.check_only: + print('PASS_P104_EXPLICIT_OWNED_CALLER_SOURCE_BINDINGS_ONLY');return + fixture=interface_fixture(root) + if args.interface_only: + print(json.dumps(fixture,sort_keys=True));return + guard=load(HERE/'code/guard.py','p104_scoped_resource_guard') + with tempfile.TemporaryDirectory(prefix='p104-owned-caller-') as name: + original,old_run=replay(root,'original',Path(name),guard) + candidate,new_run=replay(root,'candidate',Path(name),guard) + need(original['kappa_claim'] is None and candidate['kappa_claim'] is None,'No new bound from caller audit') + need(len(original['controls'])==10 and len(candidate['controls'])==16,'All retained and interface-specific controls') + need(candidate['native_checks']['owned_peak']==2 and len(candidate['owned_scratch_fields'])==2,'Explicit simultaneous scratch bound') + authenticate(root) + print('PASS_P104_EXPLICIT_OWNED_CALLER_AUDIT') + print(json.dumps(dict(source_head=candidate['candidate_input']['declared_source_head'],contacts=len(candidate['route_recipes'])*4, + fresh_helpers=candidate['native_checks']['fresh_helpers'],owned_peak=2,paid_jobs=sum(candidate['paid'].values()), + productive_fields=sum(candidate['targets'].values()),ordinary_pass_upper=candidate['ordinary']['abstract_address_phase_scalar_pass_upper'], + controls=len(candidate['controls']),public_hole_fixture=fixture,runs=[old_run,new_run],full_parent_admitted=False,new_kappa=None),sort_keys=True)) + +if __name__=='__main__': main()