diff --git a/research/selected-control-request-mass/PROOF.md b/research/selected-control-request-mass/PROOF.md new file mode 100644 index 0000000000..44065c591d --- /dev/null +++ b/research/selected-control-request-mass/PROOF.md @@ -0,0 +1,228 @@ +# Width contraction pays for a complete generated-weight vector + +This is a scoped resource theorem for Jose Manuel's PR2310 interpreter at +`a5258f548bfb6da71c3b72733fbbd2fb4995c929`. It strengthens its preparation +estimate under the same implementation hypotheses. It does not change a +child, a supplier invoice, the selected exponent or the physical dispatcher. +The four unmodified predecessor files and their hashes are in `SOURCES.json`. + +## 1. Exact model and statement + +Let `n_0=e` be a positive integer. A valid chronological descriptor chain has +`h` steps and positive extents `n_0,...,n_h`. With `f=floor(n_(i-1)/64)`, its +steps are precisely the following operations in `Program.extents` and +`evaluate`: + +| Step | Child extent `n_i` | Recursive parent requests `b_i` | Table reads per value request | Ring operations | +|---|---:|---:|---:|---:| +| Good of rank `r`, `1<=r<=42` | `r*f` | 1 | 1 | 1 | +| Pair | `f` | 0, 1 or 2 | 1 | 3 | +| Unit reset | `f` | 0 | 0 | 0 | +| Half-unit reset | `floor(f/2)` | 0 | 0 | 0 | + +For Pair, the two potential parent rows are `field` and +`permutation[field]`; a row below 64 requests its parent weight and a row +at least 64 returns a constant. Thus `b_i` does not depend on the coordinate +being evaluated. A reset discards expression ancestry, but retains all global +frozen-field positions. Both physical orientations have the same work count. +No memoization, cancellation of equal requests, or recursive vector building +is assumed. + +Evaluate every coordinate `0<=j=2`, `e^17<=w^10000` gives the entirely integral comparison + + (e*w^3)^17 <= w^(10000+51) <= w^(592*17), + +so `E_vector <= A_q*w^592`. When `w=1`, root coupling forces `e=1`; the +empty ancestry has bounded preparation and the predecessor's identity-header +bypass applies. Exponent 592 is a sufficient envelope, not a lower bound on +the optimal preparation algorithm. + +PR2310's existing factorial absorption argument applies with `A=592`: + + w^592 / q^(w-1) <= 2^592 * 592! (q>=2, w>=1). + +Indeed `w^A/A! <= binomial(w+A-1,A) <= 2^(w+A-1)`. Thus the same complete +body/header fibre accounting retains a root-independent constant. The explicit +factor has 5,196 bits instead of the predecessor's 18,675-bit factor for +`A=1800` (the checker recomputes both exact integers). This does not compare +the unknown constants `A_q` or establish a practical runtime improvement. + +The predecessor already claims `C_q V(n+w)` under its physical premises. +This result tightens one sufficient preparation estimate within that claim. +It does not close completed payload dispatch, actual matrix production, +spectator/counter lowering, physical parking, selected GL64 hosting, precision, +the recurrence's physical premises or supplier admission. No new kappa follows. + +## 6. Evidence and attribution + +`audit.py` computes level multiplicities independently of the source's stack +execution order. It compares them with the unchanged source's meters and +counts actual popped events with Python line tracing. The abstract finite +census, actual full-vector corpus, deep binary fixture, sharpness instances +and adversarial controls are separately labelled in `RESULT.json`. Source +and receipt authentication remain part of replay. + +The grammar, interpreter, global-age reset contract and factorial absorption +are predecessor work: Jose Manuel/PR2310 and PR2234, commdata2338/PR2188, +Ross Richardson/PR2159 and their retained lineage. PR2332's actual-table +binding is complementary and is not replayed here. The new result is the +coupled width/request proof, sharp constants and its conditional preparation +consequence. Prepared for commdata2338 (@commdata2338), with substantial +OpenAI Codex assistance. Author-checked only; no independent human or formal +review is claimed. diff --git a/research/selected-control-request-mass/README.md b/research/selected-control-request-mass/README.md new file mode 100644 index 0000000000..9cade50b25 --- /dev/null +++ b/research/selected-control-request-mass/README.md @@ -0,0 +1,118 @@ +# Sharp request bounds for the selected BIT control grammar + +For PR2310's unchanged Good/Pair/unit-reset interpreter, a complete final +weight vector at any ancestry depth uses at most **21e/16 value requests**, +where `e` is the original extent. The constant is sharp. Branching is paid +for by the width loss at the same step; no memoization is needed. + +The [proof](PROOF.md) also gives sharp bounds on table reads, modular-operation +counts, all interpreter events and sequential frozen-tape head movement: + +| Whole-vector quantity | Sharp upper bound | +|---|---:| +| Value requests, including root/reset | `21e/16` | +| Complete table reads | `441e/512` | +| Source-counted modular operations | `441e/512` | +| All popped events | `2205e/1024` | +| Head movement, for page length `L` | `972405eL/262144` | + +Global table ages remain charged after unit resets. Under PR2310's retained +fixed-size preparation, sequential-vector and physical-pass hypotheses, this +gives the sufficient preparation envelope `O_q(e*w^3)`, hence `O_q(w^592)` +under `w=ceil(e^(17/10000))`, in place of its looser `O_q(w^1800)` estimate. +The existing factorial absorption argument then uses `2^592*592!`. + +This is an author-checked scoped proof and finite source audit. It is not a +physical caller implementation, an independent audit of the matrix producer, +a supplier admission, a practical speedup or a new kappa. The predecessor +already establishes its conditional asymptotic form; this sharpens one +resource estimate within that argument. + +## Exact source and overlap + +The interpreter is copied unchanged from Jose Manuel's +[PR2310](https://github.com/CrocSwap/integer-mult-bounds/pull/2310), commit +`a5258f548bfb6da71c3b72733fbbd2fb4995c929`. Its proof, README and NOTICE are +preserved alongside it. [SOURCES.json](SOURCES.json) binds every copy by +source path, commit, Git blob and SHA256; the verifier checks the bytes. + +The claim is in [discussion #2304](https://github.com/CrocSwap/integer-mult-bounds/discussions/2304#discussioncomment-18942789), +following its released control-work review handoff. +This account's [PR2332](https://github.com/CrocSwap/integer-mult-bounds/pull/2332) +binds actual producer coefficients to the tables; this package does not repeat +that work. [Discussion2319](https://github.com/CrocSwap/integer-mult-bounds/discussions/2319) +reports the generic execution successor [PR2364](https://github.com/CrocSwap/integer-mult-bounds/pull/2364) +and now claims a selected coefficient-site refinement. Both remain separate +from this request-count result. The task card and +exact scope are in [TASK.json](TASK.json). + +## Reproduce and inspect evidence + +Python 3.12, standard library only, from the repository root: + +```sh +python3 -I -B scripts/research_package.py --package research/selected-control-request-mass +``` + +The hook performs normal and optimized read-only replays and four integrity tests. +Direct replay: + +```sh +python3 -I -B research/selected-control-request-mass/verify.py +``` + +Expected final line: + +```text +PASS_SELECTED_CONTROL_REQUEST_MASS source_programs=628 coordinates=4920 abstract_cases=112347 controls=9 preparation_exponent=592 no_new_kappa +``` + +[RESULT.json](RESULT.json) separately records: + +- 112,347 exact abstract cases: all chains through depth five over eight + representative operation types, at three root offsets; +- 628 unchanged-interpreter programs and 4,920 coordinates, covering all + legal Good ranks, six small rings, both orientations and reset pruning; +- an actual depth-ten binary fixture with 2,047 value requests, 1,023 table + reads and maximum stack size 21; +- sharpness at Good(42) depths one and two by complete vector execution; + depth four by one coordinate trace plus the proved multiplicity identity; +- nine rejection controls, including lost Pair branches, forgotten resets, + compacted physical ages and exceeding the final-vector request allowance. + +The level-multiplicity oracle is separate from the predecessor's stack order. +Actual popped events are observed with Python tracing; table/movement/ring +counts are checked against the source meters. Value hashes identify the +fixtures; they are not a new proof of coefficient semantics. The written +product and ratio arguments, rather than the finite census, establish the +all-depth theorem. Optimized replay retains every acceptance predicate. + +`verify.py --emit` prints fresh evidence without writing. `--write` is the +explicit regeneration option. The integrity tests additionally change saved +evidence and source behavior in isolated copies, including tests that rebind +hashes to ensure semantic work checks still detect the change. + +## Open next questions + +Bind the request allowance at an actual preparation site in the joined +physical caller: show that a site evaluates at most a fixed multiple of its +current extent, with no recursive parent-vector construction or repeated +spectator-prefix traversal. Begin with one complete Good-to-Pair/reset site +in the Discussion2319 work. This connects the resource theorem to execution; +it requires the completed caller and its physical accounting. + +The proof does not determine an optimal preparation algorithm or numerical +bit-cost constant. Tightening either would require an explicit arithmetic +implementation, not another sampled root calculation. + +## Credit + +Jose Manuel (@jmbarrancoml) supplies PR2310's interpreter, global-field contract +and uniform absorption proof, and PR2234's caller work. The grammar derives +from commdata2338's PR2188, source527 and Ross Richardson's PR2159 fallback +algebra. Gareth Davidson's PR2289/2295 address the separate recurrence and +moment implications. The complete predecessor notice remains at +[sources/pr2310/NOTICE.md](sources/pr2310/NOTICE.md). + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. +New material is Apache-2.0. No independent human or proof-assistant review is claimed. diff --git a/research/selected-control-request-mass/RESULT.json b/research/selected-control-request-mass/RESULT.json new file mode 100644 index 0000000000..3bdcd83670 --- /dev/null +++ b/research/selected-control-request-mass/RESULT.json @@ -0,0 +1,203 @@ +{ + "schema_version": 1, + "status": "SCOPED_PROOF_WITH_FINITE_SOURCE_CHECKS_NO_NEW_KAPPA", + "predecessor_sha256": { + "sources/pr2310/control.py": "b2de80d8292e4af8ac86e1b4db35cb968f304c797c5faa4ee13be74eacf06739", + "sources/pr2310/PROOF.md": "a46ec34988750656c8d6a9d6420bed529807ab1509a5eeda6a72a593efcca5e5", + "sources/pr2310/README.md": "695544c4fd7693a73175c1127289067c4dfa9ce47cbf7dfbf97184f1f4852285", + "sources/pr2310/NOTICE.md": "3852a06b0a563a2413f7b011fe9ac81f28d5455ea1b39be4c2834543fa8389af" + }, + "analytic": { + "maxima": { + "requests": { + "value": "21/16", + "at_depth": 1 + }, + "table_reads": { + "value": "441/512", + "at_depth": 2 + }, + "ring_operations": { + "value": "441/512", + "at_depth": 2 + }, + "events": { + "value": "2205/1024", + "at_depth": 2 + }, + "head_pages": { + "value": "972405/262144", + "at_depth": 4 + } + }, + "preparation_exponent": 592, + "absorption_constant_bits": 5196, + "previous_absorption_constant_bits": 18675 + }, + "abstract_census": { + "alphabet_size": 8, + "maximum_depth": 5, + "root_offsets": [ + 0, + 1, + 63 + ], + "cases": 112347, + "trace_sha256": "976f6b677a837ea76e56541dcfbe697dddd7f350380a1123ce4abd8d83297df2" + }, + "source_census": { + "programs": 628, + "coordinates": 4920, + "totals": { + "requests": 16508, + "table_reads": 10565, + "ring_operations": 17819, + "events": 29677, + "head_pages": 42660 + }, + "trace_sha256": "c9abe27d6e99322cb18d13a22d6d03102978d3b9d75e84a988e3dfadaa18cd7b", + "rings": [ + [ + 3, + 1 + ], + [ + 3, + 2 + ], + [ + 5, + 1 + ], + [ + 5, + 2 + ], + [ + 7, + 2 + ], + [ + 3, + 3 + ] + ], + "deep_binary": { + "root": 1152921504606846976, + "final": 1, + "emitted": 1, + "observed": { + "requests": 2047, + "table_reads": 1023, + "ring_operations": 3069, + "events": 3070, + "head_pages": 4072 + }, + "page_bits": 1872, + "maximum_stack_items": 21, + "value_trace_sha256": "5d7c73dc05af743b1e951d603362747a05bcb7d991ad71e85aaf65398e60828d" + } + }, + "sharpness": { + "1": { + "execution": { + "root": 64, + "final": 42, + "emitted": 42, + "observed": { + "requests": 84, + "table_reads": 42, + "ring_operations": 42, + "events": 126, + "head_pages": 84 + }, + "page_bits": 1872, + "maximum_stack_items": 2, + "value_trace_sha256": "90734d894ba33b0e38c3662613fb98ca5009b66f010c74d26dfb22ff276158f2" + }, + "full_vector_ratios": { + "requests": "21/16", + "table_reads": "21/32", + "ring_operations": "21/32", + "events": "63/32", + "head_pages": "21/16" + }, + "attains": [ + "requests" + ], + "coverage": "all coordinates" + }, + "2": { + "execution": { + "root": 4096, + "final": 1764, + "emitted": 1764, + "observed": { + "requests": 5292, + "table_reads": 3528, + "ring_operations": 3528, + "events": 8820, + "head_pages": 10584 + }, + "page_bits": 1872, + "maximum_stack_items": 3, + "value_trace_sha256": "2691e0357c659ff2a4ee03ffafe3b783d38d5103391df79f293992c6aaa10dae" + }, + "full_vector_ratios": { + "requests": "1323/1024", + "table_reads": "441/512", + "ring_operations": "441/512", + "events": "2205/1024", + "head_pages": "1323/512" + }, + "attains": [ + "table_reads", + "ring_operations", + "events" + ], + "coverage": "all coordinates" + }, + "4": { + "execution": { + "root": 16777216, + "final": 3111696, + "emitted": 1, + "observed": { + "requests": 5, + "table_reads": 4, + "ring_operations": 4, + "events": 9, + "head_pages": 20 + }, + "page_bits": 1872, + "maximum_stack_items": 5, + "value_trace_sha256": "1a1ce3313f428c5e70913fe5ff783fa0470d3f3c71cd75e69758f1a77b992c4f" + }, + "full_vector_ratios": { + "requests": "972405/1048576", + "table_reads": "194481/262144", + "ring_operations": "194481/262144", + "events": "1750329/1048576", + "head_pages": "972405/262144" + }, + "attains": [ + "head_pages" + ], + "coverage": "one coordinate plus exact multiplicity proof" + } + }, + "controls": { + "rejections": [ + "Good43 breaks the sharp request constant", + "pinned interpreter rejects rank43", + "binary branching without its width loss breaks the bound", + "discarded Pair branch changes actual work", + "traversing discarded reset ancestry changes work", + "post-reset field remains at its global physical age", + "root-many requests at a smaller child exceed the contract", + "zero-width half reset is inadmissible", + "missing global frozen table rejected" + ], + "positive_orientation_pair": true + } +} diff --git a/research/selected-control-request-mass/SOURCES.json b/research/selected-control-request-mass/SOURCES.json new file mode 100644 index 0000000000..fd8ce6bd3a --- /dev/null +++ b/research/selected-control-request-mass/SOURCES.json @@ -0,0 +1,48 @@ +{ + "schema_version": 1, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "e8870e5917057d59b730eb14721a778639eca050", + "sha256": "d46eb6d5b3e279428753d770653663fbdf1063e55c255ea073d768f344927ef7" + } + ], + "vendored_sources": [ + { + "path": "sources/pr2310/control.py", + "source_path": "research/selected-control-uniformity/control.py", + "commit": "a5258f548bfb6da71c3b72733fbbd2fb4995c929", + "git_blob": "3d9ab566d9bcbc30180c13c4321c6cc349d00e6a", + "sha256": "b2de80d8292e4af8ac86e1b4db35cb968f304c797c5faa4ee13be74eacf06739" + }, + { + "path": "sources/pr2310/PROOF.md", + "source_path": "research/selected-control-uniformity/PROOF.md", + "commit": "a5258f548bfb6da71c3b72733fbbd2fb4995c929", + "git_blob": "1b8db5d0dabe7bb02fc05f843d22991f9e19c9a3", + "sha256": "a46ec34988750656c8d6a9d6420bed529807ab1509a5eeda6a72a593efcca5e5" + }, + { + "path": "sources/pr2310/README.md", + "source_path": "research/selected-control-uniformity/README.md", + "commit": "a5258f548bfb6da71c3b72733fbbd2fb4995c929", + "git_blob": "49412b80be9f8da7348a511f5cf9c07a8600ae63", + "sha256": "695544c4fd7693a73175c1127289067c4dfa9ce47cbf7dfbf97184f1f4852285" + }, + { + "path": "sources/pr2310/NOTICE.md", + "source_path": "research/selected-control-uniformity/NOTICE.md", + "commit": "a5258f548bfb6da71c3b72733fbbd2fb4995c929", + "git_blob": "7fe56b0130e487ed869887da77f8bc788f85e430", + "sha256": "3852a06b0a563a2413f7b011fe9ac81f28d5455ea1b39be4c2834543fa8389af" + } + ] +} diff --git a/research/selected-control-request-mass/TASK.json b/research/selected-control-request-mass/TASK.json new file mode 100644 index 0000000000..cf567e81f2 --- /dev/null +++ b/research/selected-control-request-mass/TASK.json @@ -0,0 +1,106 @@ +{ + "schema_version": 1, + "task_id": "uniform-transfer-audit", + "priority_revision": 4, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "original_card": { + "id": "uniform-transfer-audit", + "question": "Can one exact all-size/compiler, precision, hosting or restoration implication be proved or falsified?", + "starting_points": [ + "certificates/selected-result.json", + "docs/audit.md" + ], + "methods": [ + "Prove one missing implication with explicit quantified hypotheses.", + "Find an exact counterexample at the claimed interface boundary." + ], + "acceptance_gate": "Identify the proposition and what would change downstream; do not equate a finite replay with a universal proof.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the selected review scope and choose one exact all-size or precision implication.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Write its quantified inputs and conclusion; find a missing hypothesis or construct a minimal exact adversarial instance.", + "bottleneck_link": "Finite supplier improvements are useful only under the retained transfer obligations.", + "allowed_variations": [ + "Choose one tape, precision, hosting or restoration lemma." + ], + "scope_change_triggers": [ + "Replacing a quantified obligation with another finite smoke test." + ], + "overlap_terms": [ + "uniform transfer", + "all-size", + "precision" + ] + }, + "scope_status": "refined", + "actual_scope": "All-depth complete-vector request, event and sequential frozen-table scan bounds for the unchanged PR2310 Good/Pair/unit-reset evaluator, with a conditional preparation envelope.", + "scope_change_reason": "Take the released Discussion2304 control-work review handoff and couple actual child-width loss to branching, keeping physical dispatch and producer correctness separate.", + "bottleneck_link": "This supplies an exact resource implication for the pending selected BIT compiler; it changes no paid child, moment or selected exponent.", + "budget_minutes": 60, + "stop_rule": "Stop after the scoped proof, exact source-meter binding and behavioral controls; do not infer physical caller admission.", + "outcome": "completed", + "evidence": "PROOF.md and RESULT.json; 112347 abstract cases, 628 actual programs, 4920 coordinates, sharp grammar witnesses and nine rejection controls.", + "author": "commdata2338", + "ai_assistance": "Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. OpenAI Codex (GPT-6 Astra) derived, implemented, checked and wrote this contribution; no independent human review.", + "open_questions": [ + { + "question": "Does one actual joined caller preparation site make at most a fixed multiple of its current extent in generated-weight requests?", + "why_it_matters": "The new complete-vector bound applies to this request discipline; it is not a complete physical invocation invoice.", + "first_step": "Bind one Good-to-Pair/reset coefficient site in Discussion2319, counting all requests, sequential scans and cleanup.", + "blocked_by": "Completed caller implementation and its physical pass, spectator and preparation contracts." + } + ], + "scope_key": "603f341b99f590f17a76", + "selection": { + "mode": "central-handoff override", + "handoff": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2304", + "specific_card_lookup_seed": "00000000000000000000000000000000", + "note": "Default chooser ran once but its output was truncated; no random reroll. Deterministic card lookup is provenance only." + }, + "predecessors": [ + { + "pr": 2310, + "head": "a5258f548bfb6da71c3b72733fbbd2fb4995c929", + "role": "Exact interpreter and conditional preparation premises; four files vendored unchanged." + }, + { + "pr": 2332, + "head": "0ee2ca645f3b04e1e4df1e1055b6f9aab09eaa95", + "role": "Contextual actual-producer binding; not imported or re-audited." + } + ], + "refresh_checkpoint": { + "checked_at": "2026-10-15T06:57:55.967418+00:00", + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "origin_main": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "changed_guidance_or_selected": [], + "dependency_heads": { + "2310": "a5258f548bfb6da71c3b72733fbbd2fb4995c929", + "2332": "0ee2ca645f3b04e1e4df1e1055b6f9aab09eaa95" + } + }, + "overlap": { + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2304#discussioncomment-18942789", + "snapshot_coverage": { + "open_prs": { + "fetched_at": "2026-10-15T06:55:23.240869+00:00", + "complete_pagination": true, + "records": 583 + }, + "discussions": { + "fetched_at": "2026-10-15T06:57:32.010338+00:00", + "complete_pagination": true, + "records": 1111 + } + }, + "limitations": "Anonymous shared snapshot, complete pagination; titles/bodies/notes are not a code-diff novelty proof. Expected offline warnings.", + "nearest_work": "PR2310 is the exact predecessor; PR2332 binds coefficients. PR2364 at b9293bb14d40f8e820ce5efd99939278e5871c56 reports generic dispatch; Discussion2319 now claims canonical-prefix coefficient-site refinement while retaining PR2310's old preparation allowance. These do not establish the new all-depth resource constants." + } +} diff --git a/research/selected-control-request-mass/VERIFY.json b/research/selected-control-request-mass/VERIFY.json new file mode 100644 index 0000000000..634400f6c1 --- /dev/null +++ b/research/selected-control-request-mass/VERIFY.json @@ -0,0 +1,46 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact source pins, resource multiplicities, actual interpreter traces, sharp witnesses, nine semantic controls and typed receipt equality." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Same complete scientific checks under optimized Python; acceptance predicates are explicit." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "-m", + "unittest", + "discover", + "-s", + "{package}", + "-p", + "test_integrity.py" + ], + "timeout_seconds": 120, + "checks": "Four behavioral integrity tests: changed evidence, frozen-source drift, branch loss and head undercharge, including rebound source pins." + } + ] +} diff --git a/research/selected-control-request-mass/audit.py b/research/selected-control-request-mass/audit.py new file mode 100644 index 0000000000..2eb38a272f --- /dev/null +++ b/research/selected-control-request-mass/audit.py @@ -0,0 +1,404 @@ +"""Exact resource audit of the unchanged PR2310 generated-weight interpreter. + +Prepared for commdata2338 with substantial OpenAI Codex assistance. +New work: Apache-2.0. The separately pinned interpreter is Jose Manuel's. +""" +from collections import Counter +from dataclasses import dataclass +from fractions import Fraction +import ast +import hashlib +import importlib.util +import itertools +import json +from math import factorial, gcd +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +ALPHA = Fraction(21, 32) +LIMITS = { + "requests": Fraction(21, 16), + "table_reads": Fraction(441, 512), + "ring_operations": Fraction(441, 512), + "events": Fraction(2205, 1024), + "head_pages": Fraction(972405, 262144), +} + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":")) + + +def reject(call, label): + try: + call() + except ValueError: + return label + raise ValueError("failure control accepted: " + label) + + +def pins(): + source = json.loads((HERE / "SOURCES.json").read_text()) + entries = source["vendored_sources"] + need({e["path"] for e in entries} == { + "sources/pr2310/" + name + for name in ("control.py", "README.md", "PROOF.md", "NOTICE.md") + }, "complete pinned predecessor input set") + for entry in entries: + data = (HERE / entry["path"]).read_bytes() + need(hashlib.sha256(data).hexdigest() == entry["sha256"], + "predecessor SHA256: " + entry["path"]) + blob = b"blob " + str(len(data)).encode() + b"\0" + data + need(hashlib.sha1(blob).hexdigest() == entry["git_blob"], + "predecessor Git blob: " + entry["path"]) + need(entry["commit"] == "a5258f548bfb6da71c3b72733fbbd2fb4995c929", + "exact PR2310 source head") + return {e["path"]: e["sha256"] for e in entries} + + +def load_source(): + path = HERE / "sources/pr2310/control.py" + spec = importlib.util.spec_from_file_location("pr2310_request_mass_source", path) + module = importlib.util.module_from_spec(spec) + sys.modules[spec.name] = module + spec.loader.exec_module(module) + tree = ast.parse(path.read_text()) + function = next(n for n in tree.body if isinstance(n, ast.FunctionDef) + and n.name == "evaluate") + pops = [n for n in ast.walk(function) if isinstance(n, ast.Assign) + and isinstance(n.value, ast.Call) + and isinstance(n.value.func, ast.Attribute) + and isinstance(n.value.func.value, ast.Name) + and n.value.func.value.id == "pending" + and n.value.func.attr == "pop"] + need(len(pops) == 1, "one unchanged interpreter event-pop site") + return module, pops[0].lineno + + +@dataclass(frozen=True) +class Kind: + name: str + rank: int = 0 + branches: int = 0 + + def child(self, extent): + f = extent // 64 + if self.name == "good": + return self.rank * f + if self.name == "half": + return f // 2 + return f + + def inverse_extent(self, child): + if self.name == "good": + return 64 * ((child + self.rank - 1) // self.rank) + return (128 if self.name == "half" else 64) * child + + @property + def b(self): + return 1 if self.name == "good" else self.branches + + @property + def table(self): + return int(self.name in ("good", "pair")) + + @property + def constants(self): + return 2 - self.branches if self.name == "pair" else 0 + + @property + def ring(self): + return 3 if self.name == "pair" else self.table + + +ALPHABET = (Kind("good", 1), Kind("good", 7), Kind("good", 42), + Kind("pair", branches=0), Kind("pair", branches=1), + Kind("pair", branches=2), Kind("unit"), Kind("half")) + + +def extents(kinds, root): + sizes = [root] + for kind in kinds: + sizes.append(kind.child(sizes[-1])) + need(0 < sizes[-1] < sizes[-2], "positive proper child") + return sizes + + +def minimal_root(kinds): + root = 1 + for kind in reversed(kinds): + root = kind.inverse_extent(root) + return root + + +def counts(kinds): + """Level multiplicities, independent of the interpreter's execution order. + + Constants are events but not recursive value requests. Ages remain global + even when a reset annihilates all requests to older levels. + """ + multiplicities = [0] * (len(kinds) + 1) + multiplicities[-1] = 1 + for level in range(len(kinds), 0, -1): + multiplicities[level - 1] = multiplicities[level] * kinds[level - 1].b + reads = {level: multiplicities[level] * kind.table + for level, kind in enumerate(kinds, 1)} + tables = sum(reads.values()) + constants = sum(multiplicities[i] * k.constants + for i, k in enumerate(kinds, 1)) + requests = sum(multiplicities) + return { + "requests": requests, + "table_reads": tables, + "ring_operations": sum(multiplicities[i] * k.ring + for i, k in enumerate(kinds, 1)), + "events": requests + tables + constants, + "head_pages": 2 * sum(i * amount for i, amount in reads.items()), + "field_reads": {i - 1: amount for i, amount in reads.items() if amount}, + } + + +def check_limits(root, final, expected): + for key, limit in LIMITS.items(): + need(final * expected[key] * limit.denominator <= root * limit.numerator, + "complete-vector bound: " + key) + + +def make_source_case(source, kinds, root, q=5, width=2, reverse=False): + steps, tables = [], [] + modulus = q ** width + units = [i for i in range(1, modulus) if gcd(i, q) == 1] + for age, kind in enumerate(kinds): + tag = 100 + age + permutation = list(range(128)) + field = 1 + if kind.name == "pair": + a, b = {0: (64, 65), 1: (1, 65), 2: (1, 2)}[kind.branches] + permutation[a], permutation[b] = permutation[b], permutation[a] + field = a + steps.append(source.Step( + "unit" if kind.name == "half" else kind.name, tag, + rank=kind.rank if kind.name == "good" else 7, + field=field, reverse=reverse, half=kind.name == "half")) + tables.append(source.Table(tag, + tuple(units[(j + age) % len(units)] for j in range(64)), + tuple(units[(3 * j + age) % len(units)] for j in range(128)), + tuple(permutation))) + program = source.Program(q, width, root, units[-1], tuple(steps)) + meter = source.Meter() + tape = source.FrozenTape(tuple(tables), modulus, meter) + return program, tape, meter + + +def execute(source, pop_line, kinds, root, *, all_coordinates=True, + q=5, width=2, reverse=False): + program, tape, meter = make_source_case(source, kinds, root, q, width, reverse) + sizes = extents(kinds, root) + need(program.extents() == sizes, "source extent binding") + expected = counts(kinds) + indices = range(sizes[-1]) if all_coordinates else (sizes[-1] - 1,) + emitted = len(indices) + event_count = 0 + values = hashlib.sha256() + + def local_trace(frame, event, arg): + nonlocal event_count + if event == "line" and frame.f_lineno == pop_line: + event_count += 1 + return local_trace + + def trace(frame, event, arg): + return local_trace if frame.f_code is source.evaluate.__code__ else None + + previous_trace = sys.gettrace() + sys.settrace(trace) + try: + for index in indices: + value = source.evaluate(program, tape, index) + values.update((str(value) + ",").encode()) + finally: + sys.settrace(previous_trace) + observed = { + "requests": meter.requests, + "table_reads": len(meter.field_reads), + "ring_operations": meter.ring_operations, + "events": event_count, + "head_pages": meter.head_moves // tape.page_bits, + } + wanted = {key: emitted * expected[key] for key in LIMITS} + need(observed == wanted, "level recurrence equals unchanged source meters") + need(meter.head_moves == wanted["head_pages"] * tape.page_bits, + "integral complete-page round trips") + need(meter.bit_reads == wanted["table_reads"] * tape.page_bits, + "complete-page bit reads") + need(meter.combines == wanted["table_reads"], "one continuation per table") + need(dict(Counter(meter.field_reads)) == + {slot: n * emitted for slot, n in expected["field_reads"].items()}, + "global field ages and reset pruning") + need(tape.head == 0 and meter.maximum_stack_items <= 2 * len(kinds) + 1, + "head and stack boundary") + check_limits(root, sizes[-1], expected) + return {"root": root, "final": sizes[-1], "emitted": emitted, + "observed": observed, "page_bits": tape.page_bits, + "maximum_stack_items": meter.maximum_stack_items, + "value_trace_sha256": values.hexdigest()} + + +def analytic_constants(): + # The written proof extends each finite maximum by its decreasing ratio. + sequences = { + "requests": lambda h: (h + 1) * ALPHA ** h, + "table_reads": lambda h: h * ALPHA ** h, + "ring_operations": lambda h: h * ALPHA ** h, + "events": lambda h: (2 * h + 1) * ALPHA ** h, + "head_pages": lambda h: h * (h + 1) * ALPHA ** h, + } + maxima = {} + for key, sequence in sequences.items(): + values = [sequence(h) for h in range(33)] + maximum = max(values) + need(maximum == LIMITS[key], "sharp rational envelope constant") + maxima[key] = {"value": str(maximum), "at_depth": values.index(maximum)} + need(10000 + 3 * 17 <= 592 * 17, "root-coupled integer exponent") + # A=591 does not follow from e^17 <= w^10000 by this exponent comparison. + need(10000 + 3 * 17 > 591 * 17, "envelope exponent boundary") + return {"maxima": maxima, "preparation_exponent": 592, + "absorption_constant_bits": (2 ** 592 * factorial(592)).bit_length(), + "previous_absorption_constant_bits": + (2 ** 1800 * factorial(1800)).bit_length()} + + +def abstract_census(): + digest, checked = hashlib.sha256(), 0 + for depth in range(6): + for indices in itertools.product(range(len(ALPHABET)), repeat=depth): + kinds = tuple(ALPHABET[i] for i in indices) + minimum = minimal_root(kinds) + expected = counts(kinds) + for offset in (0, 1, 63): + root = minimum + offset + final = extents(kinds, root)[-1] + check_limits(root, final, expected) + digest.update(canonical([indices, root, final, expected]).encode() + b"\n") + checked += 1 + return {"alphabet_size": len(ALPHABET), "maximum_depth": 5, + "root_offsets": [0, 1, 63], "cases": checked, + "trace_sha256": digest.hexdigest()} + + +def source_census(source, pop_line): + digest, programs, coordinates = hashlib.sha256(), 0, 0 + totals = Counter() + rings = ((3, 1), (3, 2), (5, 1), (5, 2), (7, 2), (3, 3)) + for depth in range(4): + for indices in itertools.product(range(len(ALPHABET)), repeat=depth): + kinds = tuple(ALPHABET[i] for i in indices) + q, width = rings[programs % len(rings)] + row = execute(source, pop_line, kinds, minimal_root(kinds), + q=q, width=width, reverse=bool(programs % 2)) + digest.update(canonical([indices, q, width, programs % 2, row]).encode() + b"\n") + programs += 1 + coordinates += row["emitted"] + totals.update(row["observed"]) + # Cover every legal Good rank, not just the three census representatives. + for rank in range(1, 43): + row = execute(source, pop_line, (Kind("good", rank),), 127) + digest.update(canonical(["all_ranks", rank, row]).encode() + b"\n") + programs += 1 + coordinates += row["emitted"] + totals.update(row["observed"]) + deep = (Kind("pair", branches=2),) * 10 + deep_row = execute(source, pop_line, deep, 64 ** 10) + digest.update(canonical(["binary_depth_ten", deep_row]).encode() + b"\n") + programs += 1 + coordinates += deep_row["emitted"] + totals.update(deep_row["observed"]) + return {"programs": programs, "coordinates": coordinates, + "totals": dict(totals), "trace_sha256": digest.hexdigest(), + "rings": [list(r) for r in rings], "deep_binary": deep_row} + + +def sharpness(source, pop_line): + result = {} + for depth in (1, 2, 4): + kinds = (Kind("good", 42),) * depth + root = 64 ** depth + row = execute(source, pop_line, kinds, root, + all_coordinates=depth < 4) + # At depth four, one exact coordinate trace is scaled by the proven + # coordinate-independent event recurrence; no full-vector run is claimed. + c = counts(kinds) + ratios = {key: str(Fraction(row["final"] * c[key], root)) for key in LIMITS} + keys = {1: ("requests",), 2: ("table_reads", "ring_operations", "events"), + 4: ("head_pages",)}[depth] + for key in keys: + need(Fraction(ratios[key]) == LIMITS[key], "attaining legal grammar") + result[str(depth)] = {"execution": row, "full_vector_ratios": ratios, + "attains": list(keys), + "coverage": "all coordinates" if depth < 4 else + "one coordinate plus exact multiplicity proof"} + return result + + +def controls(source, pop_line): + labels = [] + labels.append(reject(lambda: check_limits(64, 43, counts((Kind("good", 43),))), + "Good43 breaks the sharp request constant")) + labels.append(reject(lambda: source.Program(5, 2, 64, 1, + (source.Step("good", 1, rank=43),)).extents(), + "pinned interpreter rejects rank43")) + labels.append(reject(lambda: check_limits(64, 32, counts((Kind("pair", branches=2),))), + "binary branching without its width loss breaks the bound")) + kinds = (Kind("pair", branches=2),) + row = execute(source, pop_line, kinds, 64) + wrong = counts((Kind("pair", branches=1),)) + labels.append(reject(lambda: need(row["observed"]["requests"] == wrong["requests"], + "second recursive bank was discarded"), + "discarded Pair branch changes actual work")) + kinds = (Kind("good", 42), Kind("unit"), Kind("good", 42)) + row = execute(source, pop_line, kinds, minimal_root(kinds)) + wrong = counts((Kind("good", 42), Kind("good", 1), Kind("good", 42))) + labels.append(reject(lambda: need(row["observed"]["table_reads"] == + row["emitted"] * wrong["table_reads"], "reset did not prune"), + "traversing discarded reset ancestry changes work")) + labels.append(reject(lambda: need(row["observed"]["head_pages"] == + 2 * row["observed"]["table_reads"], "global field age was compacted"), + "post-reset field remains at its global physical age")) + kinds = (Kind("good", 42),) * 2 + labels.append(reject(lambda: check_limits(4096, 4096, counts(kinds)), + "root-many requests at a smaller child exceed the contract")) + labels.append(reject(lambda: source.Program(5, 2, 64, 1, + (source.Step("unit", 1, half=True),)).extents(), + "zero-width half reset is inadmissible")) + p, tape, _ = make_source_case(source, (Kind("good", 42),), 64) + tape.count = 0 + labels.append(reject(lambda: source.evaluate(p, tape, 0), + "missing global frozen table rejected")) + # Both orientations must have the same work despite different atom maps. + kinds = (Kind("good", 42), Kind("pair", branches=2), Kind("good", 7)) + root = minimal_root(kinds) + left = execute(source, pop_line, kinds, root, reverse=False) + right = execute(source, pop_line, kinds, root, reverse=True) + need(left["observed"] == right["observed"], "orientation-invariant resource count") + return {"rejections": labels, "positive_orientation_pair": True} + + +def build_receipt(): + source_hashes = pins() + source, pop_line = load_source() + return { + "schema_version": 1, + "status": "SCOPED_PROOF_WITH_FINITE_SOURCE_CHECKS_NO_NEW_KAPPA", + "predecessor_sha256": source_hashes, + "analytic": analytic_constants(), + "abstract_census": abstract_census(), + "source_census": source_census(source, pop_line), + "sharpness": sharpness(source, pop_line), + "controls": controls(source, pop_line), + } diff --git a/research/selected-control-request-mass/sources/pr2310/NOTICE.md b/research/selected-control-request-mass/sources/pr2310/NOTICE.md new file mode 100644 index 0000000000..7fe56b0130 --- /dev/null +++ b/research/selected-control-request-mass/sources/pr2310/NOTICE.md @@ -0,0 +1,33 @@ +# Attribution and scope + +Jose Manuel (`jmbarrancoml`) prepared the iterative control interpreter, +global-slot/reset checks, explicit polynomial envelope and uniform fibre +absorption argument with substantial OpenAI Codex assistance. New material +uses Apache-2.0. We claim no independent human or new formal verification. + +commdata2338's PR2188 supplies the Root/Good/FallbackPair grammar, building +on source527, Ross Richardson's PR2159 fallback algebra and Jose Manuel's +PR2171 handoff. `reference.py` adapts the three value formulas from that +descriptor as retained in PR2234. We replace the descriptor objects with +level-indexed program records and add the unit-reset base case. We import +no unchanged predecessor executable and make no independent source-replay +claim for this reference. + +Jose Manuel's PR2234 supplies the selected caller, chronological expression +binding, retained stream adapters and root-coupled recursion. Its notices +retain DreamingOfClouds, eumemic, alephnan, Rohan Arun and the rest of the +selected supplier lineage. commdata2338's PR1379 supplies the parking-boundary +argument, and OpenAI's frozen stream source supplies the local counter and +complete-fibre conventions. + +Gareth Davidson (`bitplane`) formalizes the stopped recurrence in PR2289 +and discharges its fractional moment in PR2295. He identifies the uniform +physical charge as a remaining premise. We address its control/metadata +portion under the named payload primitives; we do not claim that those +Lean developments prove our new compiler or the full selected machine. + +SOURCES.json pins the relevant PR2234 text and implementation interfaces. +Those pending files are proof/source references, not runtime imports in this +package. The local checker authenticates the declared live inputs and tests +the new control model. Independent assessment of the complete physical +realization remains open. diff --git a/research/selected-control-request-mass/sources/pr2310/PROOF.md b/research/selected-control-request-mass/sources/pr2310/PROOF.md new file mode 100644 index 0000000000..1b8db5d0da --- /dev/null +++ b/research/selected-control-request-mass/sources/pr2310/PROOF.md @@ -0,0 +1,220 @@ +# One control-work constant across selected BIT root contexts + +We address the physical-charge handoff in PR2289/2295. PR2234 states a +nonchild bound `C V(n+w)` but leaves its control preparation in polynomial +notation. We give an explicit compiler discipline and polynomial envelope +for that preparation, including field access after a unit reset. We retain +the selected literal schedule and the completed payload primitives. + +The result concerns their nonchild work. It does not prove the entire +selected machine, rerun its GL64 payload, or improve the selected exponent. +We claim no new recurrence or moment result. Gareth Davidson's PR2289/2295 +formalize those separate implications; their physical premises remain +distinct from the Lean proof. + +## 1. Quantified context + +Fix q, an odd prime, and the selected dimension 64 and literal word. The +production construction chooses q>2^80; the argument here only needs q>=3. +For an original digit width e>=1 set + + c=17/10000, w=ceil(e^c), B=q^w. + +Keep w fixed throughout that coarse recursion. Global generation depth h +counts every descent, including unit and orientation children. The selected +proper-width rule gives `h<=2 ceil(log2(max(2,e)))`; at e=1 there are no +descendants. The incoming atom width n is at most e. Each generated weight +reads only earlier frozen matrix fields and its fixed descriptor. It does +not read the current fresh matrix, unused stock or arbitrary spectators. + +We implement each bounded-dimensional modular preparation using schoolbook +binary arithmetic. Constants may depend on q and the fixed selected word, +but not on e,w,n,h, matrix values, arbitrary spectator cardinalities, row +multiplicity or the parking-stack position. We count full payload volume V +at the current node, after any enclosing one-time padding. + +**Claim.** For the pass compiler below, one scalar/atom pass costs O_q(V), +one fixed header route costs O_q(Vw), and the selected node's complete +nonchild work costs `C_q V(n+w)` with one constant C_q across these contexts. +We include coefficient preparation, local metadata, counters, rewinds, +scratch erasure and parked control state. This statement uses the retained +linear payload-pass and parking constructions at their stated boundaries. + +## 2. A shared descriptor and a local evaluator + +Store one chronological chain of Good, FallbackPair and unit-reset records. +Each record holds its parent index, atom extent, finite request/low-class +metadata and global frozen-field slot. A unit reset starts a new constant +weight expression but increments the global age. It does not delete a +physical coordinate or silently renumber later field references. + +For a fixed prefix fibre, maintain its generated matrix fields as local +counters. A field has 4096 radix-q digits per high layer and a fixed low +matrix. Accessing a requested field scans this compact control band and +returns its head. The band excludes arbitrary spectator and unused-stock +counters. Build the full-ring projector and the unweighted normalizer or +128-by-128 fallback plan from this field. No parent weight appears in that +matrix preparation. + +The weight grammar, with m=64 and f=floor(parent_size/m), is + + Root(i)=a; + Good(i)=Parent(i)*delta_floor(i/f); + Pair(i)=d_j * B_(pi(j),t) / B_(j,t), + B_(r,t)=Parent(r*f+t) for r=2, root coupling gives + + e^17<=w^10000, e<=w^589, + h<=2 ceil(log2 e), 2^(h+1)<=8e^2. + +Thus one weight evaluation visits at most 8e^2 grammar nodes. Both local +indices and the generated control chain fit +`O_q(h(w+log(e+1)))=O_q(w^2)` bits, since +`log2 e<=589 log2 w` and `log2 w<=w`. This includes sequential table +location and return of the local head, rather than a unit-cost random read. + +Modular operands have O_q(w) bits. Long multiplication and reduction cost +O_q(w^2); Euclidean inversion has O_q(w) division steps of O_q(w^2) cost, +so O_q(w^3) suffices. The 64/128 matrix dimensions are fixed. Their complete +projectors, bases, elimination, coefficient and scalar preparation therefore +cost O_q(w^3), independent of rank, high values and pivot itinerary. The +stack/control scan fits within that allowance. Preparing at most e requested +values and their fixed-size plans costs + + E(w)<=A_q e^3 w^3<=A_q w^1800. + +For an exact exponent check, raise to the seventeenth power: +`e^51 w^51<=w^30051<=w^30600=(w^1800)^17`. +The constant A_q also covers root parsing, a literal vector if requested, +local scratch erasure and the finite initial cases. We do not scan a vector +of length e inside each grammar node; such a different implementation needs +its own bound. + +When w=1, root coupling forces e=1. There is no recursive ancestry or +growing descriptor. The high-header field has cardinality 1, and its route +takes the retained identity bypass. Fixed low-class operations still have +a q-dependent constant cost. Thus the same envelope covers this case. + +## 4. Uniform absorption, including high-header fibres + +For any positive integers w and A, + + w^A/A! <= binomial(w+A-1,A) <= 2^(w+A-1). + +The first inequality compares the factors w,w+1,...,w+A-1 with w; the +second uses the sum of the row of Pascal's triangle. Since q>=2, + + w^1800 / q^(w-1) <= 2^1800 * 1800!. + +Define `K_q=A_q*2^1800*1800!`. We obtain E(w)<=K_q q^(w-1) for all +w>=1, with no cutoff depending on the root context. The body target has +the larger range q^w. We do not substitute q^w for a header's q^(w-1) +range or infer this assertion from numerical sampling of w. + +For a complete atom pass, at most V/q^w target fibres each require one +coefficient preparation. Splitting and merging each perform one such scan; +they may recompute rather than save an enormous coefficient table. Hence + + O_q(V) + O_q((V/q^w) E(w)) = O_q(V). + +The actual retained controlled-ADD implementation prepares once per parent +prefix before its unused/source/middle loops, which is less frequent than +this conservative count. At header boundaries use V/q^(w-1) instead. +The fixed route uses O(w) elementary passes and therefore costs O_q(Vw). + +## 5. Arbitrary spectators require separate counters + +An unrelated prefix can have bit length L independent of w. Repeatedly +reading it at each target fibre would cost `Theta(V L/q^(w-1))`, which +the preceding bound does not cover. In particular, the finite Python +header model's `(prefix//middle)%radix` must not become a fresh division +of a long flattened address on each visit. + +Compile the pass as nested counters for `before`, active source x, `middle`, +target blocks and suffix bits. The offset reads only x, permitted generated +fields and fixed low carries. Hold x while the middle loop runs. Advance +and reset arbitrary spectator counters in their own bands; do not include +them in an ancestry scan. For fixed header scaling, update the piece index +as a finite residue state, since its multiplier belongs to the fixed route +alphabet. Prepare its endpoints once per pass. + +Copy target blocks by nested block/suffix counters. Do not multiply an +arbitrarily long suffix descriptor into a fresh flattened length at each +fibre. A suffix counter reset costs O(log(2S)) and precedes S copied bits; +`log2(2S)<=2S` absorbs it. Ripple carry/decrement visits amortize over a +complete counter traversal. Initialize arbitrary shape lengths once per +pass, charging their fixed polynomial in log(2V) to O(V). The source's +fixed collapsed-field convention supplies exactly these local counters. + +This is a compiler choice within the retained stream interface. We do not +claim the Python indexed-address model already implements bit-cost arithmetic +or that arbitrary spectral/row counters have O(w) bits. + +## 6. Node charge, reset boundary and parking + +The selected good and fallback bodies use O(n) atom passes, with fixed +dimension, rank and low-class multiplicities. Fixed header routes contribute +O(Vw); selection, XOR, copy/erase and packet replacement contribute O(V). +The peeled remainder has fewer than 64 atoms and costs O(Vw). Summing these +charges gives one `C_q V(n+w)`. + +Before a recursive call, discard numerical preparation and pass a shared +symbolic descriptor. Copy the needed local metadata once; keep the frozen +field coordinates in the complete I/O prefix. The child reconstructs their +values through its local counters. It reads no buried ancestor record. +The remaining descriptor/control volume has a polynomial bound in w and +can be charged to the same complete-fibre allowance. Add its O_q(V) copying, +parking, restoration and cleanup to the retained unequal-buffer wrapper. +No counter needs an additional tape per recursive depth: the stacks and +records occupy a fixed set of marked work tapes. + +The constant may be enormous and depends on the selected program and q. +It is independent of ancestor values, root width, arbitrary spectator sizes, +row multiplicity and stack offset. This supplies the uniform-control and +local-state portion of the nonchild-charge premise. The complete selected +payload endpoint, physical pass implementation and recursion remain the +named PR2234 construction; we do not equate a control evaluator with its +entire realization or claim a new Lean instantiation. + +## 7. Evidence and credit + +The finite checks compare an iterative evaluator with an attributed recursive +reference for the retained weight grammar, exercise unit-reset descendants +with global field slots, +and test counter-based offsets against address formulas. They include +independence from fresh stock, stale/compacted-field rejection and stack/head +cleanup. Exact inequalities certify the polynomial exponent and factorial +absorption. Finite operation counts supplement the all-size argument above; +they do not bound Python runtime or enumerate the selected GL64 payload. + +We credit commdata2338's shared descriptor grammar, Ross Richardson's +fallback algebra, the selected supplier lineage and the existing PR2234 +stream constructions. Gareth Davidson's PR2289/2295 supply the separate +formal recurrence/moment results and the explicit physical-charge handoff. +Jose Manuel (`jmbarrancoml`) prepared this contribution with substantial +OpenAI Codex assistance. Independent review remains necessary. diff --git a/research/selected-control-request-mass/sources/pr2310/README.md b/research/selected-control-request-mass/sources/pr2310/README.md new file mode 100644 index 0000000000..49412b80be --- /dev/null +++ b/research/selected-control-request-mass/sources/pr2310/README.md @@ -0,0 +1,62 @@ +# Uniform control work for the selected BIT caller + +We give an explicit control compiler and a root-independent nonchild-work +bound for the pending PR2234 construction. We implement its generated weight +grammar with a stack and sequential frozen-table reads, retaining global +field slots after unit resets. Under the retained complete-stream pass and +parking contracts, we derive one `C_q V(n+w)` bound across the allowed roots. + +For `w=ceil(e^(17/10000))`, our preparation allowance is `O_q(w^1800)`. +The all-integer inequality + + w^1800 / q^(w-1) <= 2^1800 * 1800! + +absorbs that work into both body and high-header target fibres. We include +the width-one bypass. The compiler keeps arbitrary spectator counters +outside its compact ancestry scans; a repeated read of an unrelated long +prefix would invalidate this argument. + +[PROOF.md](PROOF.md) traces the actual selected coefficient formulas and +preparation sites, gives the stack bound and specifies the counter lowering. +This addresses the physical-charge handoff from +[PR2289](https://github.com/CrocSwap/integer-mult-bounds/pull/2289) and +[PR2295](https://github.com/CrocSwap/integer-mult-bounds/pull/2295). +We claim no new recurrence, moment, exponent or full selected-machine proof. + +## Evidence and reproduction + +The checker exercises 82 generated-coordinate cases, including full binary +request trees through depth 10 and Good→unit reset→Good/Pair paths. It checks +2,916 complete small body records and 82,680 header fibres. Controls reject +field compaction without rebinding, a current-fresh-field capture, swapped +bindings and unused-stock reads. The constant's exact value has 18,675 bits. + +Use Python 3.12 and the standard library: + +```sh +python3.12 scripts/research_package.py --package research/selected-control-uniformity +``` + +The hook runs normal and optimized replays. `verify.py --emit` prints a fresh +receipt without writing files. [RESULT.json](RESULT.json) records the counts +and scope. We compare the iterative interpreter with an attributed recursive +reference for the same mathematical grammar. We test prepared unit tables, +not the complete selected matrix producers or a recursive payload dispatcher. +The bit-read/head counters measure the finite control model. The written +proof supplies schoolbook arithmetic and ripple-counter costs; we do not +treat Python runtime or list access as a Turing-machine time measurement. + +## Open next questions + +Review the uniform bound together with the pending physical caller. In +particular, check the separate spectator counters, one sequential vector +pass rather than a vector per grammar node, and cleanup before parking. +The next implementation step is to connect this control interpreter to +the retained full-ring preparation and complete payload dispatcher. +[TASK.json](TASK.json) records the concrete boundary and remaining work. + +Jose Manuel ([jmbarrancoml](https://github.com/jmbarrancoml)) prepared this +contribution with substantial OpenAI Codex assistance. We claim no independent +human or new proof-assistant verification. [NOTICE.md](NOTICE.md) retains +predecessor credit. Coordination: +[Discussion2304](https://github.com/CrocSwap/integer-mult-bounds/discussions/2304). diff --git a/research/selected-control-request-mass/sources/pr2310/control.py b/research/selected-control-request-mass/sources/pr2310/control.py new file mode 100644 index 0000000000..3d9ab566d9 --- /dev/null +++ b/research/selected-control-request-mass/sources/pr2310/control.py @@ -0,0 +1,200 @@ +"""Iterative generated-weight control with sequential frozen-table access. + +Tables represent completed fixed-size full-ring preparation. Their producer +cost is a separate part of PROOF.md, not measured by this finite interpreter. +""" +from dataclasses import dataclass, field +from math import gcd + + +def need(test, message): + if not test: + raise ValueError(message) + + +@dataclass(frozen=True) +class Step: + kind: str + tag: int + rank: int = 7 + field: int = 1 + reverse: bool = False + half: bool = False + + +@dataclass(frozen=True) +class Program: + q: int + width: int + root_size: int + unit: int + steps: tuple + + def extents(self): + need(self.q >= 3 and self.q % 2 and self.width >= 1, "odd atom ring") + need(gcd(self.unit, self.q) == 1 and self.root_size > 0, "root unit and extent") + out = [self.root_size] + for step in self.steps: + f = out[-1] // 64 + need(f >= 1 and step.tag >= 0 and + step.tag.bit_length() <= 4096 * (self.q**self.width).bit_length() + 64, + "internal descriptor extent") + if step.kind == "good": + need(1 <= step.rank <= 42, "selected good rank") + size = step.rank * f + elif step.kind == "pair": + need(0 <= step.field < 127, "diagonal pair field") + size = f + else: + need(step.kind == "unit", "generated descriptor kind") + size = f // 2 if step.half else f + need(0 < size <= 42 * f < out[-1], "proper generated child") + out.append(size) + return out + + +@dataclass(frozen=True) +class Table: + tag: int + pivots: tuple + diagonal: tuple + permutation: tuple + + +@dataclass +class Meter: + requests: int = 0 + combines: int = 0 + field_reads: list = field(default_factory=list) + bit_reads: int = 0 + head_moves: int = 0 + ring_operations: int = 0 + maximum_stack_items: int = 0 + + +class FrozenTape: + """Read-only, fixed-size pages with charged head motion and word decoding.""" + def __init__(self, tables, modulus, meter): + self.modulus = modulus + self.word_bits = (modulus - 1).bit_length() + self.tag_bits = max(16, max((t.tag.bit_length() for t in tables), default=0)) + need(self.tag_bits <= 4096 * modulus.bit_length() + 64, "bounded low/request metadata") + self.page_bits = self.tag_bits + 192 * self.word_bits + 128 * 7 + self.count = len(tables) + self.meter = meter + self.head = 0 + data = [] + def emit(value, width): + need(0 <= value < 1 << width, "encoded field extent") + data.extend((value >> j) & 1 for j in range(width)) + for table in tables: + need(len(table.pivots) == 64 and len(table.diagonal) == 128, + "fixed preparation table dimensions") + need(sorted(table.permutation) == list(range(128)), "row permutation") + need(all(0 <= x < modulus and gcd(x, modulus) == 1 + for x in table.pivots + table.diagonal), "prepared units") + emit(table.tag, self.tag_bits) + for value in table.pivots + table.diagonal: + emit(value, self.word_bits) + for value in table.permutation: + emit(value, 7) + self.data = tuple(data) + + @property + def unused_stock(self): + raise ValueError("unused stock is outside coefficient control") + + def move(self, destination): + need(0 <= destination <= len(self.data), "local frozen-tape boundary") + self.meter.head_moves += abs(destination - self.head) + self.head = destination + + def word(self, width): + value = 0 + for j in range(width): + need(self.head < len(self.data), "complete control word") + value |= self.data[self.head] << j + self.head += 1 + self.meter.bit_reads += 1 + self.meter.head_moves += 1 + return value + + def read(self, slot, tag): + need(0 <= slot < self.count, "frozen field excludes current fresh matrix") + self.move(slot * self.page_bits) + observed = self.word(self.tag_bits) + pivots = tuple(self.word(self.word_bits) for _ in range(64)) + diagonal = tuple(self.word(self.word_bits) for _ in range(128)) + permutation = tuple(self.word(7) for _ in range(128)) + self.move(0) + need(observed == tag, "frozen low/request binding") + self.meter.field_reads.append(slot) + return Table(observed, pivots, diagonal, permutation) + + +def evaluate(program, tape, index): + sizes = program.extents() + depth = len(program.steps) + need(tape.count == depth, "retain the global frozen-field prefix") + need(0 <= index < sizes[-1], "requested weight extent") + modulus = program.q**program.width + need(tape.modulus == modulus and tape.head == 0, "one local ring and head origin") + pending, values = [("value", depth, index)], [] + meter = tape.meter + while pending: + meter.maximum_stack_items = max(meter.maximum_stack_items, len(pending) + len(values)) + event = pending.pop() + if event[0] == "constant": + values.append(event[1]) + elif event[0] == "multiply": + values[-1] = values[-1] * event[1] % modulus + meter.ring_operations += 1 + meter.combines += 1 + elif event[0] == "pair": + denominator, numerator = values.pop(), values.pop() + need(gcd(denominator, modulus) == 1, "generated denominator unit") + values.append(event[1] * numerator * pow(denominator, -1, modulus) % modulus) + meter.ring_operations += 3 + meter.combines += 1 + else: + _, level, coordinate = event + meter.requests += 1 + need(0 <= coordinate < sizes[level], "recursive index extent") + if level == 0: + values.append(program.unit % modulus) + continue + step = program.steps[level - 1] + if step.kind == "unit": + values.append(1) + continue + table = tape.read(level - 1, step.tag) + f = sizes[level - 1] // 64 + if step.kind == "good": + pending.extend((("multiply", table.pivots[coordinate // f]), + ("value", level - 1, coordinate))) + else: + j = f - 1 - coordinate if step.reverse else coordinate + def bank(row): + return ("value", level - 1, row * f + j) if row < 64 else ("constant", 1) + pending.extend((("pair", table.diagonal[step.field]), + bank(step.field), bank(table.permutation[step.field]))) + need(len(values) == 1 and gcd(values[0], modulus) == 1, "one completed unit value") + result = values.pop() + need(not pending and not values and tape.head == 0, "local stack and head restoration") + return result + + +def header_offsets(before, radix, middle, coefficient, carry, meter): + """Active-source counter stays separate from arbitrary spectator counters.""" + need(before >= 1 and middle >= 1 and radix >= 1, "complete header rectangle") + for _before in range(before): + for source in range(radix): + if radix == 1: + offset = 0 + else: + offset = (coefficient * source + carry) % radix + meter["active_preparations"] += 1 + meter["active_bits_read"] += max(1, source.bit_length()) + for _middle in range(middle): + meter["fibres"] += 1 + yield offset diff --git a/research/selected-control-request-mass/test_integrity.py b/research/selected-control-request-mass/test_integrity.py new file mode 100644 index 0000000000..e5a07c0060 --- /dev/null +++ b/research/selected-control-request-mass/test_integrity.py @@ -0,0 +1,76 @@ +"""Behavioral integrity checks; never alter committed evidence or source.""" +import hashlib +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile +import unittest + +HERE = Path(__file__).resolve().parent + + +class Integrity(unittest.TestCase): + def run_copy(self, change, semantic=False): + with tempfile.TemporaryDirectory(prefix="request-mass-test-", dir=HERE) as tmp: + target = Path(tmp) / "package" + shutil.copytree(HERE, target, ignore=shutil.ignore_patterns( + "request-mass-test-*", "__pycache__")) + change(target) + if semantic: + path = target / "SOURCES.json" + sources = json.loads(path.read_text()) + for entry in sources["vendored_sources"]: + data = (target / entry["path"]).read_bytes() + entry["sha256"] = hashlib.sha256(data).hexdigest() + entry["git_blob"] = hashlib.sha1( + b"blob " + str(len(data)).encode() + b"\0" + data).hexdigest() + path.write_text(json.dumps(sources)) + return subprocess.run([sys.executable, "-I", "-O", "-B", + str(target / "verify.py")], + capture_output=True, text=True, timeout=120) + + def test_receipt_corruption(self): + def change(target): + path = target / "RESULT.json" + result = json.loads(path.read_text()) + result["analytic"]["preparation_exponent"] = 591 + path.write_text(json.dumps(result)) + result = self.run_copy(change) + self.assertNotEqual(result.returncode, 0) + self.assertIn("exact typed receipt equality", result.stderr) + + def test_source_pin(self): + def change(target): + with (target / "sources/pr2310/control.py").open("a") as stream: + stream.write("\n# source drift\n") + result = self.run_copy(change) + self.assertNotEqual(result.returncode, 0) + self.assertIn("predecessor SHA256", result.stderr) + + def test_semantic_branch_loss_with_rebound_pins(self): + def change(target): + path = target / "sources/pr2310/control.py" + text = path.read_text() + old = "bank(table.permutation[step.field])" + self.assertEqual(text.count(old), 1) + path.write_text(text.replace(old, '("constant", 1)')) + result = self.run_copy(change, semantic=True) + self.assertNotEqual(result.returncode, 0) + self.assertIn("level recurrence equals unchanged source meters", result.stderr) + + def test_semantic_head_undercharge_with_rebound_pins(self): + def change(target): + path = target / "sources/pr2310/control.py" + text = path.read_text() + old = "self.meter.head_moves += abs(destination - self.head)" + self.assertEqual(text.count(old), 1) + path.write_text(text.replace(old, "self.meter.head_moves += 0")) + result = self.run_copy(change, semantic=True) + self.assertNotEqual(result.returncode, 0) + self.assertIn("level recurrence equals unchanged source meters", result.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/research/selected-control-request-mass/verify.py b/research/selected-control-request-mass/verify.py new file mode 100644 index 0000000000..3daf99aa37 --- /dev/null +++ b/research/selected-control-request-mass/verify.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +"""Read-only replay by default; --write explicitly regenerates RESULT.json.""" +import argparse +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +from audit import build_receipt, canonical, need + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + group = parser.add_mutually_exclusive_group() + group.add_argument("--write", action="store_true") + group.add_argument("--emit", action="store_true") + args = parser.parse_args() + receipt = build_receipt() + if args.emit: + print(json.dumps(receipt, indent=2)) + return + if args.write: + (HERE / "RESULT.json").write_text(json.dumps(receipt, indent=2) + "\n") + else: + saved = json.loads((HERE / "RESULT.json").read_text()) + need(canonical(saved) == canonical(receipt), "exact typed receipt equality") + print("PASS_SELECTED_CONTROL_REQUEST_MASS" + f" source_programs={receipt['source_census']['programs']}" + f" coordinates={receipt['source_census']['coordinates']}" + f" abstract_cases={receipt['abstract_census']['cases']}" + f" controls={len(receipt['controls']['rejections'])}" + " preparation_exponent=592 no_new_kappa") + + +if __name__ == "__main__": + main()