diff --git a/research/selected-complex-height-ledger/PROOF.md b/research/selected-complex-height-ledger/PROOF.md new file mode 100644 index 0000000000..aeb02abb80 --- /dev/null +++ b/research/selected-complex-height-ledger/PROOF.md @@ -0,0 +1,250 @@ +# The selected event ledger implies the conditional height recurrence + +This is a source-bound application of the arithmetic lemmas in AAAmirinu's +PR #2327 to Jose Manuel's PR #2287. The latter proposes the recursive +construction; this note independently fills its finite event-accounting +premise. It does not prove a physical compiler or the selected native +operator equalities. Exact source heads and unchanged copies are in +`SOURCES.json`. The claim is in discussion #2253. + +## 1. Statement and retained hypotheses + +Fix integers p >= 2, d >= 1, and an incoming height t >= 0. A coefficient +has height t if it lies in 2^(-p-t) Z[i] and has modulus at most 2^t. +The same component bound applies to real arithmetic temporaries. Use the +literal R480 words and selected T16 caller in the pinned PR1094 archive. +At a node of width e, write e = 73 f + delta, 0 <= delta <= 72. + +The assertion is conditional on these execution semantics: + +1. Each selected positive rank-r event executes exactly one child on r f + axes. Completed children implement the declared C tensor (or inverse) + on arbitrary input arrays, restore spectators and return on the same + grid. Their endpoint increases height by at most r f. This is the + ideal, well-founded endpoint premise of PR2287; we do not infer it from + the child's rank or a numerical test. +2. The proposed depth-first interpreter executes the supplied local word + once for each selected call and cover class. It includes every positive + idle remainder once. Only one complex child is unfinished at a time. + Native monomials, alignments, translations, selection and scatter have + the stated permutation/quarter-phase semantics. Their implementations + introduce no additional interpreted coefficient arithmetic. +3. Scalar operations use PR2287's pinned `Grid` arithmetic. Copy, clear and + parking have their stated byte-preserving or zeroing effects. All + coefficient scratch is closed before a recursive call. Arbitrary bit + interchange work is not interpreted as coefficients until its completed + return. This note does not prove that physical dispatch/parking contract. +4. A direct leaf executes the elementary C kernels sequentially. Root + reservations use only the specified disjoint selected axes; normalization + is the section 8 formula of PR2287, with no intermediate rounding. + +Let + + Gamma = 2^1296 product_(i=1)^36 (2^(2i)-1), + s = 1041408 Gamma, E = 2^100000, B = s+E, + C0 = 2^210000. + +Then every interpreted coefficient and coefficient temporary in a width-e +recursive call has height at most t+2Be. The reservations and normalization +fit the retained layer bound t+(2B+18)d < t+C0 d. For the root t=0, one +grid with Delta=C0 d, fraction width p+Delta and signed word width +p+2Delta+3 implements the stated arithmetic exactly, including its shift +extent checks. Neither a new exponent nor a smaller production guard is +claimed. + +## 2. What the executable ledger binds + +The checker authenticates the selected archive and seven individual members. +It compares the local words with the embedded provider and the SHA256 in +each actual call. It does not import `bounds.scalar_charge`, +`caller.schedule`, the producer's rank profile or their aggregate results. +Every local event and caller event is assigned a closed-alphabet rule. +Unknown events fail. Native ranks are compared with directed recipe records; +idle ranks are compared with the actual pending suffix lengths. These are +source bindings, not new proofs of the recipe identities or hosting geometry. + +The two 24,767-event words each contain 3,494 recursive children of total +rank 5,586. The 482-event caller dispatches 80 forward and 64 backward +words, 144 bridges, 160 idle sweeps, and its terminal monomial operations. +Thus there are 3,566,448 local events per cover class. The 35,840 original +idle deadlines contain 7,526 positive remainders. Zero-rank deadlines +still carry their source translations; the height rule is zero, not an +authorization to omit those operations. + +The reconstructed positive-child histogram is + + rank: 1 2 3 4 5 7 8 48 + count: 349604 60192 62585 20448 11808 7 1152 4866. + +It has 510,662 children and rank mass 1,041,408 per cover. For height +accounting this mass is multiplied by Gamma, never divided by the number +of live families W=14,336. The time recurrence has a different volume +normalization. No claim about the sharp necessary height follows from this +deliberately global maximum bound. + +All 6,088 stored local monomial records have invertible 9-by-9 binary +address matrices, integer binary offsets and phases i^P with integer P. +Consequently their mathematical maps, inverses and columnwise lifts +preserve coefficient denominators and modulus. The finite check establishes +this shape, not the correctness of a tape implementation or equality to a +desired native operator. Cover permutations and Pauli alignments retain the +corresponding semantic hypotheses in section 1. + +## 3. Scalar, leaf and normalization charges + +We use the already proved PR2327 prefix bounds, credited also to Gareth +Davidson's earlier PR1282 Horner analysis. For a reduced scalar c=n/2^k, +write b=bit_length(|n|). A SCALE, or an ADD whose two inputs have height h, +has all coefficient temporaries and its completed output at height at most + + h + max(b,k). + +The n=0 case has b=k=0. For nonzero n the unsigned Horner multiplier never +exceeds |n|, and 1+|n| <= 2^b controls the final ADD. Horner leaves the +input denominator unchanged; its final division adds at most k denominator +bits. One must distinguish that denominator bound from the temporary +magnitude bound h+b: the required extra reserve is their maximum, rather +than charging only the final coefficient magnitude. Negative numerators +and the source's non-normalized fraction spellings are reduced exactly. + +The actual finite totals are: + +| Item | Prefix increment sum | PR2287 conservative charge | +| --- | ---: | ---: | +| One forward word | 30,232 | 145,372 | +| One backward word | 30,179 | 145,420 | +| All local calls per cover | 4,350,016 | 20,936,640 | +| 32,256 signed bridge ADDs per cover | 32,256 | 258,048 | +| Complete scalar total per cover | **4,382,272** | **21,194,688** | + +The source's local charge is 2b+k+4 and dominates max(b,k). Its bridge +allowance is eight per ADD; the sufficient increment is one. Each bridge +has 112 X ADDs and 112 companion Y ADDs. COPY/CLEAR, signed exchanges and +quarter phases add zero height. Prefix hashes in `RESULT.json` bind the +ordered cumulative local and caller ledgers, without materializing Gamma +cover classes. + +Maximum local scalar shifts are 16 forward and 7 backward. The executable +controls run all 332 distinct actual coefficients through the pinned +arithmetic against independent rational outputs and inspect every allocated +temporary. They are finite application checks, not the quantified proof. +For example the source coefficient -65537/2 has an unsigned Horner prefix +65537 on input 1; its final magnitude is only 65537/2. On input 1/16 its +output is -65537/32, so ignoring the denominator charge fails too. + +One C or inverse-C kernel has endpoint increment one and temporary increment +two. Sequential application of u >= 1 elementary axes therefore has endpoint +increment u and prefix increment at most u+1 <= 8u. This proves the direct +leaf allowance for any leaf width, including the global cutoff leaves. +For u=0 there is no kernel and no increment. The initial remainder of an +internal node costs at most delta at its endpoint and delta+1 <= 73 in +its own prefixes. The retained slack 32*73=2336 is more than sufficient. + +Writing D=2j+o, the normalizer uses an optional (z-iz)/2, a quarter phase +and a shift by j. Its prefix increment is at most j+o=ceil(D/2); every +normalization shift is at most d. These are the actual closed normalizer's +operations, not D separately rounded record passes. + +## 4. The chronological induction, including parked values + +Consider the ideal exact arithmetic first. Let A(e) be a monotone upper +envelope for the additional height in an unfinished width-e call. This +definition makes the notation A(48f) legitimate; monotonicity of the +actual executed program's height is not assumed. + +At any parent program point, each previous child has completed. Under the +endpoint hypothesis its contribution to the current maximum is at most +its width r f, regardless of how large its unfinished prefixes were. +The scalar contributions are nonnegative prefix increments. Thus just +before any child begins, the height is bounded by + + t + delta + f*(sum of preceding child ranks) + preceding scalar charge. + +This bound also covers every stored copy and every parked coefficient: +those values were created at earlier program points and are preserved +while the child runs. It does not assign a numerical interpretation to +arbitrary bit-work strings. At most one active child adds an unfinished +envelope; all other children contribute their completed endpoint widths. +In particular, the *analysis* may improve a child's bound at return while +the stored grid and its exact bits remain unchanged. + +Summing over every cover class gives a valid, loose bound on every prefix, +including local scalar temporaries and the final parent endpoint: + + A(e) <= A(48f) + s f + H', + H' = 4382272 Gamma + 2336. + +The executable exact integer comparison proves + + H' <= 21194688 Gamma + 2336 < E. + +The two nontrivial charge magnitudes have respectively 2650 and 2652 bits; +E has exponent 100000. This verifies the proposed finite allowance from +operations, rather than from a copied summary. An omitted child, another +scalar alphabet or an implementation that performs additional coefficient +arithmetic would invalidate this particular binding. + +Strong induction on width now gives A(e) <= 2Be. A leaf satisfies it since +8 <= 2B. At an internal node, f >= 1, every child has width at most 48f < e, +and + + A(e) <= 2B*48f + s f + E + <= (96B+s+E) f + <= 146B f + <= 2B e. + +Here E <= E f and 2B(73-48) >= s+E are exact inequalities. A direct proof +can replace A(48f) by max_(r<=48) A(rf); the same induction applies and +needs no monotonicity assumption at all. The ideal completed C-tensor +endpoint continues to have increment at most e, not 2Be, for use by its +parent. The endpoint correctness is the separately retained semantic +induction, not a consequence of this bound. + +At the root, at most d disjoint reserved axes are processed individually. +Their prefix allowance is at most d+1. The recursive core has width at +most d. The H0 normalization adds at most ceil(D/2) <= d. These contributions +fit the predecessor's conservative additional 18d for d >= 1; the small-D +all-elementary fallback does too. Thus the retained exact inequality +2B+18 < C0 yields the stated whole-layer bound. This concerns one specified +layer invocation, not an uncharged sequence of independent layer calls. + +## 5. Root-grid exactness and shift extents + +Set Delta=C0 d, F=p+Delta and w=p+2Delta+3. All relevant heights are +strictly below Delta. A component of height h has an integer encoding N +on this grid, with |N| <= 2^(F+h). Since w-1=F+Delta+2, signed headroom +is strict for both signs, including all Horner and kernel scratch. + +For a scalar denominator 2^k, the Horner numerator still has denominator +dividing 2^(p+h_input). The charged result height includes h_input+k, +which is below Delta. Hence its encoded numerator is divisible by 2^k; +also k <= Delta < w. Kernel halving has the same property with k=1 and +the completed kernel denominator charge. The normalizer's optional half +and final j shift have their separately charged denominator increments; +j <= d <= Delta < w. Zero shifts satisfy the extent test as well. + +Consequently all divisions discard only zeros and meet the actual +`Grid.divide` syntactic extent guard. Combined with headroom, the pinned +arithmetic simulates the ideal procedure exactly. Child returns neither +round nor re-encode: exact endpoint cancellation may restore divisibility +on the unchanged root grid. Only the permitted final truncation is outside +this exact prefix argument. + +## 6. Evidence and limits + +The executable result is a finite source certificate plus exact integer +inequalities. The all-width assertion is the written conditional induction +above. The verifier has no random search, floating-point acceptance, +moment solver or imported ledger implementation. It does execute pinned +predecessor arithmetic as the subject of finite rational-oracle checks. + +No discrepancy was found in PR2287's stated height allowance under the +listed semantics. This result does not establish native recipe identities, +common-label realization, hosting/owner geometry, full physical payload +execution, row/tape admission, actual work lifetime, time bounds, outer +Gaussian/FFT/recovery transfer, a Lean theorem or an unconditional integer +multiplication result. The small coefficient tests are not an execution of +the selected O(73,2) payload. Those distinctions are essential to the claim. + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. +New material is Apache-2.0. Predecessor sources and notices are unchanged. diff --git a/research/selected-complex-height-ledger/README.md b/research/selected-complex-height-ledger/README.md new file mode 100644 index 0000000000..8b75069892 --- /dev/null +++ b/research/selected-complex-height-ledger/README.md @@ -0,0 +1,132 @@ +# Selected complex height ledger + +**Result: a finite source certificate and a written conditional proof.** The +actual selected R480/T16 event stream fits PR #2287's common-grid height +allowance. This independently supplies the finite accounting premise requested +by PR #2327 in [discussion #2253](https://github.com/CrocSwap/integer-mult-bounds/discussions/2253#discussioncomment-18941636). +No discrepancy was found under the stated execution semantics. No new supplier, +production precision reduction or multiplication exponent is claimed. + +Prepared for commdata2338 (@commdata2338), with substantial OpenAI Codex assistance. + +## Exact scope and result + +The checker reads the pinned selected PR1094 archive directly. It does not +import PR2287's ledger, scalar-charge function or schedule checker. It accounts +for both 24,767-event local words, all 144 calls, the 482-event caller, +35,840 idle deadlines and 7,526 positive idle remainders. Per cover class: + +- 3,566,448 local events and 32,256 external signed bridge ADDs; +- 510,662 recursive children, with unnormalized rank mass **1,041,408**; +- sufficient scalar-prefix charge **4,382,272**, below the predecessor's + conservative **21,194,688**; +- 6,088 local monomial records with invertible binary address maps and unit + quarter phases; maximum scalar shifts 16 forward and 7 backward. + +The proof in [PROOF.md](PROOF.md) applies these actual counts to the unfinished +child recurrence. It explicitly includes completed-child height resets, the +initial remainder, scalar scratch, parked coefficients and shift extents. With +`s=1041408*Gamma`, `E=2^100000`, `B=s+E`, and `C0=2^210000`, it proves the +conditional bound `A(e)<=2Be` and the retained layer guard `= s+E", + "2B+18 < C0" + ], + "predecessor_scalar_charge_bits": 2652, + "remainder_slack": 2336, + "scalar_and_remainder_charge_bits": 2650, + "unnormalized_mass_bits": 2648 + }, + "rejected_controls": [ + "omitted_local_event", + "wrong_native_child_rank", + "omitted_positive_idle", + "duplicate_call", + "changed_call_direction", + "unknown_caller_event", + "unpriced_bank_child", + "non_quarter_phase", + "nondyadic_coefficient", + "live_family_normalization" + ], + "source_coefficient_controls": { + "add_cases": 6972, + "distinct_source_coefficients": 332, + "exact_divisions": 987, + "scale_cases": 2324, + "shortcut_witnesses": { + "endpoint_only_horner": { + "coefficient": "-65537/2", + "input": "1", + "prefix": 65537 + }, + "missing_denominator_charge": { + "coefficient": "-65537/2", + "input": "1/16", + "output": "-65537/32" + } + } + }, + "status": "PASS_SELECTED_COMPLEX_HEIGHT_LEDGER" +} diff --git a/research/selected-complex-height-ledger/SOURCES.json b/research/selected-complex-height-ledger/SOURCES.json new file mode 100644 index 0000000000..26bd3a22e2 --- /dev/null +++ b/research/selected-complex-height-ledger/SOURCES.json @@ -0,0 +1,75 @@ +{ + "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" + }, + { + "path": "research/community-frontier1094-audit/selected-replay.tar.gz", + "usage": "input", + "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", + "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6" + } + ], + "pending_sources": [ + { + "path": "sources/pr2287/PROOF.md", + "source_path": "research/selected-complex-layer-closure/PROOF.md", + "commit": "8c60765b5dea9d862b3b190d55da102a576031bf", + "git_blob": "d7ec0d101405a5f099f55f6a73e9791731737fd0", + "sha256": "43feda0342c07a9429699c3a44e8936a3f3fb57ce9b32f38ff3dc06ac887b265" + }, + { + "path": "sources/pr2287/arithmetic.py", + "source_path": "research/selected-complex-layer-closure/arithmetic.py", + "commit": "8c60765b5dea9d862b3b190d55da102a576031bf", + "git_blob": "009d7b7166718832ebbf11893cb1ef258184a4f9", + "sha256": "31e4b21bb64924d723d1248a7eccf4e9c80d323ba8784804af79a75da18c346a" + }, + { + "path": "sources/pr2287/bounds.py", + "source_path": "research/selected-complex-layer-closure/bounds.py", + "commit": "8c60765b5dea9d862b3b190d55da102a576031bf", + "git_blob": "2409b1db05b46c81698e42d3f34db962714e9e75", + "sha256": "dacc5a425e2ef9dc0c02e5c68390898ef599948dce000e8a7ed4c07ac4d76dd4" + }, + { + "path": "sources/pr2287/NOTICE.md", + "source_path": "research/selected-complex-layer-closure/NOTICE.md", + "commit": "8c60765b5dea9d862b3b190d55da102a576031bf", + "git_blob": "a620743f667c0080fd6445d66f16c375bd565fbf", + "sha256": "a309166077259abef2f896518cf4b40165215628d8a514c69f15ea17f681daab" + }, + { + "path": "sources/pr2287/vendor/streams.py", + "source_path": "research/selected-complex-layer-closure/vendor/streams.py", + "commit": "8c60765b5dea9d862b3b190d55da102a576031bf", + "git_blob": "61542ce4c9eb51bfc113475b4f98649cb90a853e", + "sha256": "718a582a50aee8f1f04945ed942be1d4162962fe47dbf05c6ff37b7fb8c61257" + }, + { + "path": "sources/pr2327/PROOF.md", + "source_path": "research/complex-grid-prefix-audit/PROOF.md", + "commit": "367a8539770166d3ccd555583b41e96097178a3e", + "git_blob": "30f019e14866200660cbd2ad82f3bff707003210", + "sha256": "9c2473e080a64de5139abf66680534043143ec9f4488ceabf62403702047a3ad" + }, + { + "path": "sources/pr2327/README.md", + "source_path": "research/complex-grid-prefix-audit/README.md", + "commit": "367a8539770166d3ccd555583b41e96097178a3e", + "git_blob": "952f2ba9b9eadd93979d69af94fa846f5c2e4da1", + "sha256": "295b8322e110b04a56654b15a6638ecec47eef9a4b1a7e84455afa38f72ab8dc" + } + ] +} diff --git a/research/selected-complex-height-ledger/TASK.json b/research/selected-complex-height-ledger/TASK.json new file mode 100644 index 0000000000..82da4be30e --- /dev/null +++ b/research/selected-complex-height-ledger/TASK.json @@ -0,0 +1,108 @@ +{ + "schema_version": 1, + "task_id": "independent-moment", + "priority_revision": 4, + "base_commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "original_card": { + "id": "independent-moment", + "question": "Does one changed supplier or assembly claim lack a source-bound independent check of a specific new implication?", + "starting_points": [ + "certificates/selected-result.json" + ], + "methods": [ + "Reconstruct the rank ledger from original operations rather than trusting its aggregate.", + "Implement certified moment inequalities through a different exact enclosure method." + ], + "acceptance_gate": "Demonstrate independence, source binding, positive cases and semantic failure controls. Name the existing checks and the missing coverage. More digits or another equivalent evaluation of an unchanged root is not by itself new verification coverage.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Record the selected certificate and complex_profile rather than taking a PR headline as input.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "List the existing independent checks for the exact selected or candidate sources. Pick a new changed input, missing binding or distinct failure mode; stop with a handoff if the proposed arithmetic check is already covered.", + "bottleneck_link": "Independent pricing prevents unsupported frontier claims and can reveal genuine accounting slack.", + "allowed_variations": [ + "Reconstruct either a source ledger or a numeric enclosure with a different method." + ], + "scope_change_triggers": [ + "Importing the primary function and calling its output independent verification." + ], + "overlap_terms": [ + "independent moment", + "rank histogram", + "exact enclosure" + ] + }, + "scope_status": "refined", + "actual_scope": "Independently bind the selected R480/T16 complete scalar and recursive-child event stream to PR2287 section 6 height and shift reserves, taking the released PR2327 handoff in discussion #2253.", + "scope_change_reason": "The suggested independent-moment card permits a changed supplier missing implication. The released complete-program height handoff is source-bound and is not an already covered moment/root calculation.", + "bottleneck_link": "The complex supplier binds the selected construction; a correct source-to-grid implication is necessary for its proposed recursive realization, even with the paid profile unchanged.", + "budget_minutes": 60, + "stop_rule": "Stop at an actual missing event/charge or a complete conditional source ledger; no unbounded payload or supplier construction.", + "outcome": "completed", + "evidence": "RESULT.json finite certificate and PROOF.md conditional all-width proof; normal/optimized registered replay and semantic rejection controls.", + "author": "commdata2338", + "ai_assistance": "Prepared for commdata2338 with substantial OpenAI Codex assistance in derivation, implementation, checking and writing; no independent human review.", + "open_questions": [ + { + "question": "Does an actual selected native child and its complete physical dispatcher satisfy the proof semantic hypotheses?", + "why_it_matters": "This binds the conditional coefficient reserve to physical supplier execution.", + "first_step": "Implement or independently audit one selected rank-one child with monomial adapters, coefficient scratch, spectators and parking return.", + "blocked_by": "Complete physical interpreter and native endpoint contracts are not established by this ledger." + }, + { + "question": "Can a per-family chronological height analysis improve the sufficient global maximum guard?", + "why_it_matters": "It may clarify precision constants but changes neither the paid profile nor exponent by itself.", + "first_step": "Derive one complete selected call ledger retaining all scalar temporaries and child-return resets.", + "blocked_by": "Prioritize physical admission; an abstract smaller guard alone does not close it." + } + ], + "scope_key": "c6f2494b197df3bc3591", + "refined_scope_key": "selected-complex/R480-T16/PR2287-height-ledger-to-grid", + "claim_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2253#discussioncomment-18942782", + "selection": { + "nonce": "3012c97dfee81c9485f5da37f5282030", + "track": "independent-verification", + "suggestion": "independent-moment", + "passed_over": "formal-interface-lemma: generic recurrence and tensor lemmas already covered; finite source binding remains requested" + }, + "dependency_heads": { + "2287": "8c60765b5dea9d862b3b190d55da102a576031bf", + "2327": "367a8539770166d3ccd555583b41e96097178a3e" + }, + "evidence_status": "author-checked conditional proof and finite certificate; independent review and physical admission separate", + "upstream_refresh": { + "checked_at_utc": "2026-10-15T06:59:14.520647+00:00", + "commit": "0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2", + "priority_revision": 4, + "changes": "No main changes from the recorded base; continue the pinned source audit." + }, + "overlap": { + "entry": { + "open_prs_at": "2026-10-15T06:28:56.749233+00:00", + "discussions_at": "2026-10-15T06:31:18.032505+00:00", + "open_prs": 570, + "discussion_records": 1082 + }, + "final": { + "open_prs_at": "2026-10-15T06:55:23.240869+00:00", + "discussions_at": "2026-10-15T06:57:32.010338+00:00", + "open_prs": 583, + "discussion_records": 1111 + }, + "complete_pagination": true, + "coverage_limit": "Cached open PRs including drafts and Discussion records; offline warnings, arbitrary code diffs excluded.", + "nearest": [ + "PR2287 proposed complex layer", + "PR2327 primitive-prefix audit and released handoff", + "PR2284 generic recurrence formalization", + "PR2341 generic tensor bridge" + ], + "complementary_active_claim": "Discussion2253 comment18942629 refines one PR2250 physical monomial; this package only checks local monomial shape and does not implement or formalize that interpreter." + } +} diff --git a/research/selected-complex-height-ledger/VERIFY.json b/research/selected-complex-height-ledger/VERIFY.json new file mode 100644 index 0000000000..3666894a56 --- /dev/null +++ b/research/selected-complex-height-ledger/VERIFY.json @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/community-frontier1094-audit/selected-replay.tar.gz" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Source-bound complete event ledger, exact conditional guard inequalities, actual coefficient prefixes and ten rejection controls; compare immutable receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Same complete certificate with Python assertions disabled." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/test_verify.py" + ], + "timeout_seconds": 120, + "checks": "Eight focused independent source, semantic and receipt-integrity test groups." + } + ] +} diff --git a/research/selected-complex-height-ledger/sources/pr2287/NOTICE.md b/research/selected-complex-height-ledger/sources/pr2287/NOTICE.md new file mode 100644 index 0000000000..a620743f66 --- /dev/null +++ b/research/selected-complex-height-ledger/sources/pr2287/NOTICE.md @@ -0,0 +1,48 @@ +# Attribution and dependencies + +Jose Manuel (`jmbarrancoml`) prepared the new caller binding, Gaussian +primitives, precision/time checks and written composition with substantial +OpenAI Codex assistance. New material uses the repository's Apache-2.0 +license. We claim no independent human or new proof-assistant verification. + +The selected word and finite certificates retain the native Clifford, +gauge44, hyperplane-ending, owner and T16 lineage, including Rohan Arun, +Jeremy Kothe, Hao Yan, DreamingOfClouds and the contributors credited by +the selected source notices. We import their finite algebra as attributed +premises rather than claim it as new. + +The Lemma G/A packages supply the abstract module and whole-invocation +theorems. Their credited lineage includes Zhihao Chen's conjugation lemma, +chafreaky's paid wrappers and stream owners, Dugongue's normalization and +asynchronous realization, DaysSky's idle-axis hosting, Rohan Arun's +footprint hosting, icekylinx's complex supplier and DreamingOfClouds' +gauge/kernel construction. Their Lean conventions retain the jamesyc and +Mathlib lineage. We do not claim a new Lean instantiation. + +We reuse the authenticated `contains` and `local` functions from the +selected `hpe_audit_local.py` checker. We extract those two function +definitions and compile them with `optimize=0`; we do not run the module's +writing CLI. This is reuse of the existing PR514/PR433 independent replay, +not an independent reimplementation. + +Gareth Davidson (`bitplane`) supplies the selected chart/phase audit. +We execute its selected-object audit and compare its retained receipt. +We do not rerun its separate orthogonal-group census. The current native +recipe and wrapper equality certificates remain pinned source inputs. + +Douglas Colkitt's compact-control and layer work, the retained OpenAI +framework, the completed-child guard lineage, and commdata2338's unequal +parking boundary supply the methods we compose. The exact interval engines +remain unchanged; we evaluate one coarse point rather than search for a root. + +PR2234, head `d047ef86fbc5b1614d3d8e2b8d3441413beab73f`, supplies the pending +written ordinary-interchange contract. PR2250, head +`d404b48a1e7b147556b309497d55089c837dddb2`, supplies the compact monomial +implementation. Both are Jose Manuel contributions. We copy its +`streams.py` unchanged under `vendor/`, with its source path and hash in +`SOURCES.json`; the other dependency is mathematical, with no code import. + +The new contribution is the current selected all-size composition, including +typed private work, complete fresh rows, global frame tracking, mandatory +zero-remainder translations, one exact grid and the coarse layer bound. +We have not merged or closed predecessor work or changed the selected result. diff --git a/research/selected-complex-height-ledger/sources/pr2287/PROOF.md b/research/selected-complex-height-ledger/sources/pr2287/PROOF.md new file mode 100644 index 0000000000..d7ec0d1014 --- /dev/null +++ b/research/selected-complex-height-ledger/sources/pr2287/PROOF.md @@ -0,0 +1,481 @@ +# A completed selected complex layer + +We give a written all-size construction for the selected R480/T16 complex +layer. We use the completed ordinary-interchange contract of PR2234 and the +sequential compact monomial implementation of PR2250. Both contributions +remain under review. We retain the selected finite word and its credited +algebraic certificates, and close the recursive complex-child, row/work and +precision contracts below. We claim no outer multiplication theorem or +change to the selected frontier. + +## 1. Statement and model + +Write + + C = 1/2 [[1+i,1-i],[1-i,1+i]], + H0 = 1/2 [[1,1],[1,-1]]. + +Fix the following rational parameters: + + epsilon=997/1000, spacing=1/500, beta=1/1000, + tau=99830289/100000000, sigma=99833/100000, + lambda=249583/250000, lambdaPrime=599/600. + +For precision p>=2, let d=floor(p^epsilon) and K=floor(d^spacing). Consider +D<=d selected address bits at positions rho+jK in D consecutive K-bit +chunks, with 0<=rho1-sum(4^-i)>1/2. +Define the sufficient depth + + D0(e)=0 for e<73; + D0(e)=1+D0(48 floor(e/73)) otherwise. + +Since 73^2>2*48^2, two levels halve the width and +D0(e)<=2 ceil(log2(max(2,e))). Every positive child r floor(e/73), r<=48, +has strictly smaller width and depth at most D0(e)-1. + +Use the retained global compact parameters + + G=4 ceil(log2 p)+6, H=dG, + q0=ceil(log2 L) D0(d), qF=ceil(2H/K), qB=ceil(H/K), + Q0=q0+qF+qB. + +If D<=Q0, apply the selected C kernels individually. Otherwise first +process the first q0+qF and last qB selected axes individually. The first +q0 whole chunks supply a preceding row range of size 2^(q0K)>=L^D0(d). +The next qF chunks supply two H-bit front compact fields; the last qB +chunks supply one H-bit back field. Collapse unused bits into spectators. +All these fields come from existing coordinates, and their initial values +may be arbitrary. + +Pad only the row range to the next multiple of L^D0(d), increasing volume +by less than two. A padded row includes the entire compact/body/spectator +rectangle and its records. At an internal node with row count R_rows +divisible by L^D0(e), decode + + [W] x [Gamma] x [U], U=R_rows/L. + +For each family and cover class, the owner packet has exactly v=V/L bits +and the complete unused row range U. No compact-field bit enters this +selector. For a child e', L^D0(e') divides U. A completed child restores its +own row labels, so all subsequent siblings reuse the same stock. + +Keep p,d,K,G,H global down the recursion. At width e, each local slot has +f=floor(e/73) axes. The monomial adapters carve (f-1)G<=H bits from each +compact field and preserve the unused parts as spectators. Restore the +compact fields before any scalar gate, child or return. + +The row count need not be a power of two. The coefficient kernels scan an +arbitrary number of complete outer rows; `c_axis` implements this directly. +For PR2250's binary-field monomial interpreter, apply the same completed +routine successively to each outer row and concatenate its output in the +original order. Each row retains its complete compact and binary ranges. +Summing O(V_row b^tau) gives O(V b^tau); per-row setup is covered by the long +record allowance. This extension allocates no tape per row. Reassemble the +whole owner packet before invoking a recursive complex child. We do not +replace one complex child by a child per unused row. + +At the completed root endpoint, every row receives the same C tensor on +the core and identity on its row coordinate. Padded zero rows are therefore +zero again and can be deleted. The reserved-axis kernels commute with +the completed core tensor because they act on disjoint axes. We recover +the desired layer on the original address rectangle. + +## 4. A physical whole-call interpreter + +Follow the exact 482-event selected execution schedule. It preserves each +replica's 30 source events, followed by the two global final events. The +source-bound check verifies all 144 call positions, actual bridge touches, +69120 hosted occurrences and their untouched windows. Each call owns +704 distinct live physical families. Thus its owner packets are distinct, +and its packets for different common cover classes are also disjoint. + +For one common cover matrix d, gather the 704 owned packets into local work. +An owner descriptor gives family F and g=d sigma^-1. Select that complete +(F,g) packet by a sequential scan of its family. Keep the original family +until the local word finishes. First apply P_d^-1 to the gathered packet, +then its stored entrance Pauli alignment, to obtain the common native view. +After the local word, apply the stored exit alignment and P_d before +scattering. These are fixed monomials for this d. +PR2250 compiles them columnwise. A finite cover table or an enumeration of +73-by-73 orthogonal binary matrices supplies d; this cost is a fixed +constant independent of p and f. + +Execute the literal program in that common view: + +* At a relabel, execute its stored monomial adapters and one proper-width + child. The labels themselves are bookkeeping; we do not physically apply + an entire entrance label before the program. +* At ADD or SCALE, execute the original dyadic coefficient pointwise on + aligned Gaussian records. Copy preserves its source; clear writes a + logical packet of zeros, with its extent unchanged. +* For a forward private centre, clear fresh C_k, copy its carrier, transport + the rank-eight centre and scatter, then clear C_k. +* For a backward private centre, clear at frame zero, gather targets, + transport to the centre frame, subtract into the carrier, then clear. + +The backward private value need not equal a copy of the original source. +We use Lemma G's linear copy/clear semantics and zero private input, not +the BIT transported-source erasure guard. The eight private packets and +coefficient work are fresh scratch, outside the original live row range. +We leave live helper inputs arbitrary. + +After completing the local word, invert the common view and scatter all +704 packets back into their original family/cover positions. A full-family +replacement finishes before another child call. We then erase the local +copies and release the zero private packets as empty work. This implements +the stream units and whole-invocation hypothesis +of Lemma A. Its unit helper rows and zero cross-columns permit deferral +of completed helper pieces within the checked untouched windows. + +For an idle deadline, visit every original child/port, including children +whose positive-rank part hosting has fully consumed. Apply any remaining +C tensor on the exact pending-axis suffix, using an explicit completed +orthogonal chart to place those axes first, and then apply the declared +translation X_(g theta). The hosted pieces use disjoint actual axes; their +products and the remainder recover the original pending kernel. We retain +the exact axes, rather than only their span or rank. + +There are 35840 original idle phase slots, 7526 positive remainders and +6822 fully hosted cases with a nonzero translation. For example, replica0, +child0, port0, family224 has no positive remainder but still needs mask15. +Omitting it maps a post-child delta at zero to zero instead of delta15. +Such a post-child state is possible because the completed hosted operator +is invertible. This is a caller constraint, not a defect in the source. + +For one port and cover class g, put T=C_(gq) and +A_s=P_g C_[0,9+8s) P_g^-1. The retained unary DATA-PHASES identities give +initial labels X_(-1)=T, Y_(-1)=I and level-s labels + + X_s=A_s, Y_s=A_s T^-1. + +Idle advances put both pairs at the same level before each bridge. We +check these levels in the actual asynchronous schedule. Consequently each +global X-to-X or Y-to-Y bridge is another common-label ADD. Each completed +local macro advances both labels and applies its decoded scalar shear under +the conjugation formula in section2. The nine local +scalar shears, nine paired bridges and final signed exchange have scalar +matrix I_8; the exact eight-column replay rejects omission of each bridge. +This is a second application of the common-label invariant, not a tensor +power of a one-column role-mixing equality. + +Before the exchange, the Y label is A_8 T^-1. The terminal translation +X_(gq)=T^2 changes it to A_8 T. After the signed exchange the labels are +(A_8 T,A_8), while the initial labels were (T,I). Since the complete scalar +shadow is identity, each family receives A_8=P_g C_all P_g^-1. These steps +use unary products, inverses and C_q^2=X_q, so they lift to every f. + +Keep the terminal Y translation before the signed exchange. Finally +apply X_delta(g) on every live family, after bank padding and data exchange, +where delta_i=(wt(row_i(g))-1)/2 mod2. + +For completeness, the full C tensor has Fourier multiplier i^wt(z). +Orthogonality makes wt(g^T z)-wt(z) modulo four an even additive function; +evaluation on e_i gives twice delta_i. Hence + + P_g C_all P_g^-1 = C_all X_delta(g). + +The final translation removes that defect. These unary identities lift +columnwise. Together with the common-label and chronological arguments, +the whole core computes C^tensor-(73f) on every original live row, fixes +its row coordinate and leaves its spectators unchanged. + +## 5. Proper-width recursion and fixed work + +At width e, stop if e<73 or e^1000=1, E<=Ef. The inequality + + 2B(73-48)>=s+E + +therefore gives A(e)<=2Be by induction. It also covers the values parked +in the caller, since those values occur at preceding program points. +The source's finite prefix bounds52/68 and global397 bits are useful +bindings, but they are not this all-depth proof. + +The reserved-axis kernels and final normalization add at most18d, so + + A_layer <= (2B+18)d < C0 d. + +The source guard checks 32*73B^215999/10^9, + mu_1=1017/1022. + +We evaluate one coarse point, 1-sigma=167/100000, rather than search for +a new root. Integer floors can only decrease the weighted widths. +The strict sigma-moment gives total leaf cost + + O(V d^(sigma+beta(1-sigma))). + +The base cutoff is max(73,d^beta); the factor73 changes only the constant. +For internal widths e>=d^beta, e^tau<=d^(beta(tau-sigma))e^sigma, since +sigma>tau. Summing the strict weighted tree gives internal cost + + O(V (log p)^tau d^chi), + chi=sigma+beta(tau-sigma). + +Root reservations cost O(V(log(2d)+d^(1-spacing)log p+1)). In particular, +Gamma affects the row-depth constant, not the reservation exponent. +The exact exponents are + + chi=99832997289/10^11, + leaf=99833167/10^8, + reserve=499/500. + +Each lies below lambda=249583/250000, and lambdaPrime-lambda=1/750000. +Thus the retained logarithmic factors fit O(V d^lambdaPrime). The small-D +reservation fallback obeys the same bound. For the finite initial range +where an asymptotic compact-field inequality fails, use individual kernels; +enlarge the fixed time constant to cover that range. + +Finally, 1-epsilon(1+spacing)=503/500000>0 gives the required address +geometry, and 1-epsilon=3/1000>0 gives both the precision and long-record +conditions. Also epsilon*spacing>0, so K/log p tends to infinity. No +positive-rank fallback surcharge belongs to the complex moment. + +## 8. Normalization and evidence limits + +Let S_D multiply a record by i raised to the sum of its selected bits. +Evaluate that phase once per record, using polynomial control work, and +apply it coefficientwise in linear record time. The retained identity is + + H0^tensor-D = b^D S_D C^tensor-D S_D, b=(1-i)/2. + +For k=floor(D/2), use + + b^D=(-i)^k 2^-k b^(D mod2). + +This needs an optional (z-iz)/2, one quarter-phase and one variable binary +shift, each linear in guarded word width. It does not perform D full +record passes. `normalize_b` executes that rule. Since H0 has absolute +row sum one, the completed normalized layer preserves the input unit +disk. Final truncation toward zero changes each component by less than +2^-p, preserves the disk and gives the stated sqrt(2)*2^-p error. + +Our checks replay the retained current common-label/scalar conditions, +bind every current native recipe, reuse the selected chart/phase audit, +and verify chronological owner windows and all idle phase deadlines. +They also execute Gaussian kernels with a non-power-of-two outer row +count, exact scaling, normalization and inverse cancellation. The row, +height and coarse time inequalities have exact integer/rational checks. + +These checks support the written construction; they are not a complete +payload execution or proof-assistant verification. We retain the finite +Clifford and hosting results as attributed source premises. The outer +FFT/convolution embedding, analytic error transfer and integer packing +remain outside this contribution. We have not changed the selected +frontier or proved an integer-multiplication exponent here. diff --git a/research/selected-complex-height-ledger/sources/pr2287/arithmetic.py b/research/selected-complex-height-ledger/sources/pr2287/arithmetic.py new file mode 100644 index 0000000000..009d7b7166 --- /dev/null +++ b/research/selected-complex-height-ledger/sources/pr2287/arithmetic.py @@ -0,0 +1,151 @@ +"""Exact fixed-grid Gaussian words; no rounding at a child return. + +Word arrays stand for local arithmetic tapes. Each loop traverses them in +order; arithmetic_steps charges their bit traversals separately from payload. +""" +from dataclasses import dataclass,field +from fractions import Fraction + +from streams import need,Tape,copy + + +@dataclass +class Grid: + bits: int + fraction_bits: int + arithmetic_steps: int=0 + exact_divisions: int=0 + workspace: list=field(default_factory=list) + peak_words: int=0 + + def track(self,word): + self.workspace.append(word);self.peak_words=max(self.peak_words,len(self.workspace)) + return word + + def close(self): + for word in self.workspace: + for i in range(len(word)):word[i]=0 + self.arithmetic_steps+=len(word) + self.workspace.clear() + + def check(self,a): + need(len(a)==self.bits and all(x in (0,1) for x in a),"one signed grid word") + + def zero(self):return self.track(bytearray(self.bits)) + + def add(self,a,b): + self.check(a);self.check(b);out=bytearray();carry=0 + for x,y in zip(a,b): + value=x+y+carry;out.append(value&1);carry=value>>1 + self.arithmetic_steps+=8*self.bits + need(a[-1]!=b[-1] or out[-1]==a[-1],"signed addition headroom") + return self.track(out) + + def neg(self,a): + self.check(a);out=bytearray();carry=1 + for x in a: + value=1-x+carry;out.append(value&1);carry=value>>1 + self.arithmetic_steps+=6*self.bits + need(not (a[-1] and out[-1]),"signed negation headroom") + return self.track(out) + + def subtract(self,a,b):return self.add(a,self.neg(b)) + + def divide(self,a,k): + self.check(a);need(0<=k0) + return self.track(bytearray(a[k:])+bytearray((a[-1],))*k) + + def scale(self,a,coefficient): + c=Fraction(coefficient);n=abs(c.numerator);den=c.denominator + need(den&(den-1)==0,"Gaussian-dyadic scalar") + out=self.zero() + for bit in bin(n)[2:]: + out=self.add(out,out) + if bit=="1":out=self.add(out,a) + if c<0:out=self.neg(out) + return self.divide(out,den.bit_length()-1) + + def phase(self,z,k): + real,imag=z;k%=4 + if k==0:return real,imag + if k==1:return self.neg(imag),real + if k==2:return self.neg(real),self.neg(imag) + return imag,self.neg(real) + + def pair(self,a,b,inverse=False): + p=(self.add(a[0],b[0]),self.add(a[1],b[1])) + q=self.phase((self.subtract(a[0],b[0]),self.subtract(a[1],b[1])), + -1 if inverse else 1) + first=(self.divide(self.add(p[0],q[0]),1),self.divide(self.add(p[1],q[1]),1)) + second=(self.divide(self.subtract(p[0],q[0]),1),self.divide(self.subtract(p[1],q[1]),1)) + return first,second + + +def read_number(tape,grid):return grid.track(tape.read(grid.bits)),grid.track(tape.read(grid.bits)) + + +def write_number(tape,value): + tape.write(value[0]);tape.write(value[1]) + + +def c_axis(source,address_bits,position,coefficients,grid,inverse=False,outer_rows=1): + """One exact C axis on complete Gaussian records, with sequential tapes.""" + need(0<=position=1 and outer_rows>=1,"selected C axis") + record=2*grid.bits*coefficients;suffix=(1<<(address_bits-position-1))*record + need(len(source.data)==outer_rows*(1<=0 and len(source.data)%(2*grid.bits)==0,"normalization extent") + source.rewind();out=Tape(source.meter);k,odd=divmod(axes,2) + for _ in range(len(source.data)//(2*grid.bits)): + z=read_number(source,grid) + if odd: + z=(grid.divide(grid.add(z[0],z[1]),1), + grid.divide(grid.subtract(z[1],z[0]),1)) + z=grid.phase(z,-k) + write_number(out,tuple(grid.divide(x,k) for x in z)) + grid.close() + source.finish();source.erase();out.rewind();return out diff --git a/research/selected-complex-height-ledger/sources/pr2287/bounds.py b/research/selected-complex-height-ledger/sources/pr2287/bounds.py new file mode 100644 index 0000000000..2409b1db05 --- /dev/null +++ b/research/selected-complex-height-ledger/sources/pr2287/bounds.py @@ -0,0 +1,111 @@ +"""Exact row, height and coarse-layer inequalities; no new root search.""" +from fractions import Fraction as F +from importlib.util import spec_from_file_location,module_from_spec +from math import prod + +from streams import need +from caller import depth + + +def scalar_charge(events): + result=0;largest=0 + for event in events: + if event[0]!="scalar":continue + operation=event[1] + if operation[0] not in ("add","scale"):continue + c=F(operation[-2],operation[-1]);den=c.denominator + need(den&(den-1)==0,"selected scalars are dyadic") + cost=2*abs(c.numerator).bit_length()+den.bit_length()+3 + result+=cost;largest=max(largest,cost) + return result,largest + + +def precision(data,profile): + gamma=(1<<1296)*prod((1<<(2*i))-1 for i in range(1,37)) + need(1<<2627=s+E,"completed-child height induction") + charges={name:scalar_charge(events) for name,events in data["programs"].items()} + local=sum(charges[c["orientation"]][0] for c in data["template"]["calls"]) + # Each bridge has one X and one Y ADD for each of 112 ports. + actual=gamma*(local+144*224*8)+32*73 + need(actual=73: + f=e//73 + for r in range(1,49): + need(0F(15999,10**9),"strict selected coarse moment") + linear=F(sum(r*n for r,n in profile.items()),73*14336) + need(linear==F(1017,1022),"linear moment") + chi=tau+(1-beta)*max(sigma-tau,0);leaf=sigma+beta*(1-sigma) + margins={"sigma-tau":sigma-tau,"lambda-tau":lam-tau,"lambda-sigma":lam-sigma, + "lambda-chi":lam-chi,"lambda-leaf":lam-leaf,"lambdaPrime-lambda":lamp-lam, + "lambdaPrime-leaf":lamp-leaf,"lambdaPrime-reservation":lamp-(1-spacing), + "geometry":1-epsilon*(1+spacing),"precision":1-epsilon,"spacing_growth":epsilon*spacing} + need(all(x>0 for x in margins.values()),"complete strict layer gaps") + return {"tau":str(tau),"sigma":str(sigma),"beta":str(beta),"spacing":str(spacing), + "lambda":str(lam),"lambdaPrime":str(lamp),"epsilon":str(epsilon), + "internal_exponent":str(chi),"leaf_exponent":str(leaf), + "linear_moment":str(linear),"coarse_moment_gap_lower":str(gap), + "margins":{k:str(v) for k,v in margins.items()},"layer_saving":"1/600", + "scope":"Fixed coarse point using retained interval engines; no new selected root or kappa."} + + +def run(root,data,profile): + return {"precision":precision(data,profile),"rows":rows(),"parameters":parameters(root,profile)} diff --git a/research/selected-complex-height-ledger/sources/pr2287/vendor/streams.py b/research/selected-complex-height-ledger/sources/pr2287/vendor/streams.py new file mode 100644 index 0000000000..61542ce4c9 --- /dev/null +++ b/research/selected-complex-height-ledger/sources/pr2287/vendor/streams.py @@ -0,0 +1,115 @@ +"""Sequential bit-stream simulator with charged contiguous transfers. + +Bulk methods abbreviate consecutive tape transitions; they charge each bit. +Payload destinations are append-only. Random lookup is confined to controls. +""" +from dataclasses import dataclass,field + + +def need(condition,message): + if not condition: + raise ValueError(message) + + +@dataclass +class Meter: + reads: int=0 + writes: int=0 + moves: int=0 + erases: int=0 + control_evaluations: int=0 + digit_passes: int=0 + rotation_passes: int=0 + radix_passes: int=0 + repair_records: int=0 + ordinary_calls: list=field(default_factory=list) + + +class Tape: + def __init__(self,meter,data=b""): + self.meter=meter;self.data=bytearray(data);self.head=0 + + def read(self,size): + need(0<=size<=len(self.data)-self.head,"sequential read boundary") + value=self.data[self.head:self.head+size];self.head+=size + self.meter.reads+=size;self.meter.moves+=size + return value + + def write(self,value): + need(self.head==len(self.data),"append-only output") + self.data.extend(value);self.head+=len(value) + self.meter.writes+=len(value);self.meter.moves+=len(value) + + def rewind(self): + self.meter.moves+=self.head;self.head=0 + + def finish(self): + need(self.head==len(self.data),"complete sequential consumption") + + def erase(self): + self.rewind();size=len(self.data) + self.meter.erases+=size;self.meter.moves+=2*size + self.data.clear();self.head=0 + + +def copy(source,target,size): + target.write(source.read(size)) + + +def bit_key(value,width): + need(0<=value<1<>i)&1 for i in range(width)) + + +def key_value(bits): + need(all(b in (0,1) for b in bits),"binary control encoding") + return sum(b<= 0`. A Gaussian value has height at most `t` when +it belongs to `2^-(p+t) Z[i]` and its complex absolute value is at most +`2^t`. A real arithmetic temporary has the analogous component bound. +This distinction matters: separately stored real and imaginary workspace +words need not form a simultaneous logical Gaussian value. + +Set `F=p+Delta`. A signed `w`-bit two's-complement word encodes the real +value `N/2^F`, where + + -2^(w-1) <= N <= 2^(w-1)-1. + +Suppose every real component and arithmetic temporary under consideration +has height at most `H`, with `H <= Delta`, and + + w >= F+H+2. + +Then `N` is an integer, `|N| <= 2^(F+H)`, and both signs are representable, +strictly below the absolute overflow threshold `2^(w-1)`. Addition and negation whose ideal results +obey this bound therefore pass the source's signed-overflow guards and +produce the exact ideal word. This includes zero and excludes the sole +problematic two's-complement negation, the most negative word. + +For an input of height `h`, its encoded integer is divisible by +`2^(Delta-h)`. In particular, if `h+k <= Delta`, exact division by `2^k` +discards only zeros. Arithmetic right shift with sign extension implements +the quotient even for negative inputs. The source's `0 <= k < w` condition +also follows for nonnegative `k`: `k <= Delta < w` under these hypotheses. +Thus the literal `Grid.divide` guard and its bit operation implement the +rational division. + +For a shift satisfying `0<=k= 0`, and put +`b=bit_length(abs(n))`. For nonzero `n`, `b >= 1` and + + |n| < 2^b, 1+|n| <= 2^b. + +In `Grid.scale`, the unsigned Horner multiplier starts at zero, doubles +at each binary digit, and optionally adds one copy of the input. Every +intermediate multiplier is a nonnegative integer at most `|n|`: the +doubled prefix is at most the next full prefix, which is at most `|n|`. +The optional final negation changes no absolute value. All these words +therefore have denominator dividing `2^(p+t)` and absolute value less +than `2^(t+b)` when the input has height `t`. + +The final division introduces at most `k` denominator bits and decreases +absolute value. Every real temporary of the scale thus has height at most + + t + max(b,k). + +For the completed Gaussian `scalar_add(a,x,c)`, assume both inputs have +height at most `t`. The final value has denominator dividing +`2^(p+t+k)` and + + |a+c*x| <= (1+|n|/2^k) 2^t <= (1+|n|) 2^t <= 2^(t+b). + +Thus the same bound covers all its word temporaries and completed Gaussian +output. It also covers `scalar_scale`. If `n=0`, reduced form has `k=0` +and `b=0`: the source's zero Horner iteration stays zero, and ADD returns +the target. The bound remains valid without a special positive charge. + +The actual `bounds.scalar_charge` assigns + + 2*b + denominator.bit_length() + 3 = 2*b+k+4 + +to each scalar ADD or SCALE. This is at least `max(b,k)`, including the +zero case. It conservatively covers the actual Horner intermediates, +final division and ADD; it is not merely a bound on the final multiplier. +No sharper reserve constant or supplier improvement is claimed here. + +## 3. One C kernel and its inverse + +For Gaussian inputs `a,b` of height at most `t`, `Grid.pair` forms + + P=a+b, Q=+i(a-b) or -i(a-b), + outputs=(P+Q)/2, (P-Q)/2. + +The intermediate complex values `P,Q` have modulus at most `2^(t+1)`; +the numerators `P+Q,P-Q` have modulus at most `2^(t+2)`. Their real +component words satisfy the same bounds. Before the final shifts, their +denominators still divide `2^(p+t)`; after them they divide +`2^(p+t+1)`. Hence every arithmetic temporary has height at most `t+2`. +Each completed C or inverse-C output has height at most `t+1`: its +absolute row sum is `sqrt(2) <= 2`, and its coefficients are Gaussian +integers divided by two. + +The distinction is real. For `p=3,t=0`, take + + a=(5-5i)/8, b=(5+5i)/8. + +Both inputs lie in the unit disk. The forward first numerator `P+Q=5/2` +exceeds `2^(t+1)`, although the returned first output is `5/4` and has +height at most `t+1`. This refutes using the completed endpoint height as +an all-prefix height bound. It is not a counterexample to PR2287's larger +prefix allowance or its additional signed headroom. + +After `u` elementary axes, completed C-tensor or inverse-C-tensor outputs +have height at most `t+u`. Applying the preceding temporary bound at each +axis gives the elementary sequential implementation an all-prefix bound +`t+u+1` for `u>=1`. In particular the predecessor's direct-leaf allowance +`t+8u` is sufficient for these arithmetic operations. + +## 4. The closed normalization routine + +Write `D=2j+o`, where `o` is zero or one, and let `b0=(1-i)/2`. The source +`normalize_b` implements + + b0^D = (-i)^j 2^-j b0^o. + +For odd `D`, its real numerators `x+y` and `y-x` have absolute value at +most `sqrt(2)|z| <= 2^(t+1)`. Their division by two gives exactly `b0*z`, +whose modulus is `|z|/sqrt(2)` and whose denominator gains at most one +bit. Quarter phases preserve denominators and modulus. The final shift +by `j` gains at most `j` denominator bits and decreases modulus. + +Every component temporary and the completed output therefore have height +at most + + t+j+o = t+ceil(D/2). + +For `D=0` this is `t`, as the source performs only zero shifts. The +completed modulus is exactly `2^(-D/2)|z|`. This is an arithmetic statement +about this routine; it does not certify the surrounding Fourier identity, +phase evaluation, layout or complete layer. + +## 5. Child returns: a bound may improve, the representation must remain + +For every `p>=0`, the input pair `(2^-p,0)` followed by one forward C +axis and its inverse is an exact identity. The intermediate pair is + + (2^-(p+1)(1+i), 2^-(p+1)(1-i)). + +It needs one extra fractional bit although the completed composition +returns to height zero. On a root grid with `Delta>=1`, the inverse +restores the original divisibility. Truncating both components toward +zero to only `p` fractional bits at the intermediate return instead +produces zero, so the inverse returns zero. This is an all-`p` family, +not an empirical failure at one selected precision. + +In a recursive execution, a proved completed-child endpoint may therefore +replace an internal height bound by the smaller endpoint bound at return. +This is an update to the analysis, justified by the exact operator identity. +It does not change the common grid or round the stored word. Subsequent +operations may use the restored divisibility. Conversely, an endpoint +identity alone supplies no bound on the unfinished child's prefixes. + +## 6. What this establishes, and what remains assumed + +Together these lemmas give a source-level bridge: if the ideal chronological +execution has the asserted all-prefix height bound, the pinned word +operations, conservative scalar charges and a sufficiently wide common grid +simulate it exactly, provided every executed shift also satisfies `0<=k= s+E, 'all-width induction coefficients') + need(2*B+18 < C0, 'whole-layer height guard') + checked = 0 + for e in list(range(1, 1001)) + [10**k+j for k in (6, 12, 60) for j in (0, 1, 72)]: + f, delta = divmod(e, 73) + if f: + need(2*B*48*f+s*f+h <= 2*B*e, 'internal height consequence') + need(delta+1 <= slack, 'remainder prefix slack') + else: + need(e+1 <= 8*e <= 2*B*e, 'direct leaf prefixes') + checked += 1 + return {'cover_bits': gamma.bit_length(), 'cover_sha256_hex_integer': digest(hex(gamma).encode()), + 'unnormalized_mass_bits': s.bit_length(), 'scalar_and_remainder_charge_bits': h.bit_length(), + 'predecessor_scalar_charge_bits': old_h.bit_length(), 'remainder_slack': slack, + 'E_exponent': 100000, 'C0_exponent': 210000, 'finite_width_checks': checked, + 'inequalities': ['Gamma*H+2336 <= Gamma*H_old+2336 < E', '8 <= 2B', + '2B*(73-48) >= s+E', '2B+18 < C0'], + 'conditional_conclusion': 'A(e)<=2Be; all layer coefficient prefixes < C0*d'} + + +def import_arithmetic(): + base = PACKAGE / 'sources' / 'pr2287' + for name, path in (('streams', base / 'vendor' / 'streams.py'), + ('height_subject_arithmetic', base / 'arithmetic.py')): + 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 actual_coefficient_controls(coefficients): + module = import_arithmetic() + cases = divisions = additions = 0 + witnesses = {} + for c in sorted(coefficients): + b, k = abs(c.numerator).bit_length(), c.denominator.bit_length()-1 + increment = max(b, k) + p, delta = 4, increment+2 + F, width = p+delta, p+2*delta+3 + for numerator in (-16, -15, -1, 0, 1, 15, 16): + x = Q(numerator, 1 << p) + encoded = int(x * (1 << F)) + word = bytearray((encoded >> j) & 1 for j in range(width)) + grid = module.Grid(width, F) + out = grid.scale(word, c) + value = sum(bit << j for j, bit in enumerate(out)) - (out[-1] << width) + need(Q(value, 1 << F) == c*x, 'source coefficient exact oracle') + for temp in grid.workspace: + v = sum(bit << j for j, bit in enumerate(temp)) - (temp[-1] << width) + q = Q(v, 1 << F) + need(abs(q) <= (1 << increment), 'source coefficient prefix magnitude') + need(((1 << (p+increment)) * q).denominator == 1, 'source coefficient prefix denominator') + divisions += grid.exact_divisions + grid.close() + need(not grid.workspace, 'coefficient work closes') + cases += 1 + for target in (-1, 0, 1): + grid = module.Grid(width, F) + a = bytearray(((target << F) >> j) & 1 for j in range(width)) + out = grid.add(a, grid.scale(word, c)) + value = sum(bit << j for j, bit in enumerate(out)) - (out[-1] << width) + need(Q(value, 1 << F) == target+c*x, 'source ADD coefficient oracle') + for temp in grid.workspace: + v = sum(bit << j for j, bit in enumerate(temp)) - (temp[-1] << width) + q = Q(v, 1 << F) + need(abs(q) <= (1 << increment) and + ((1 << (p+increment))*q).denominator == 1, 'source ADD prefix reserve') + grid.close() + additions += 1 + if k > 0 and 'missing_denominator_charge' not in witnesses: + exact = c * Q(1, 1 << p) + need(((1 << p)*exact).denominator > 1, 'denominator omission witness') + witnesses['missing_denominator_charge'] = {'coefficient': str(c), 'input': '1/16', 'output': str(exact)} + if abs(c.numerator) > abs(c) and abs(c.numerator) > 1 and 'endpoint_only_horner' not in witnesses: + witnesses['endpoint_only_horner'] = {'coefficient': str(c), 'input': '1', 'prefix': abs(c.numerator)} + need(len(witnesses) == 2, 'source scalar shortcut witnesses') + return {'distinct_source_coefficients': len(coefficients), 'scale_cases': cases, 'add_cases': additions, + 'exact_divisions': divisions, 'shortcut_witnesses': witnesses} + + +def controls(data, ledger): + rejected = [] + def reject(label, mutate, expected): + altered = copy.deepcopy(data) + mutate(altered) + altered['template']['local_providers']['gauge44']['local_programs'] = altered['programs'] + try: + audit(altered) + except ValueError as error: + need(str(error) == expected, 'control failed at unexpected gate: ' + label + ': ' + str(error)) + rejected.append(label) + else: + raise ValueError('accepted malformed ledger: ' + label) + reject('omitted_local_event', lambda x: x['programs']['forward'].pop(), 'selected local event count') + reject('wrong_native_child_rank', lambda x: next(e for e in x['programs']['forward'] if e[0] == 'climb').__setitem__(-1, 48), 'native child rank binding') + reject('omitted_positive_idle', lambda x: x['template']['idle_children'].pop(), 'unique idle children') + reject('duplicate_call', lambda x: x['template']['calls'].__setitem__(0, copy.deepcopy(x['template']['calls'][1])), 'unique selected calls') + reject('changed_call_direction', lambda x: x['template']['calls'][0].__setitem__('orientation', 'backward'), 'exact called local word') + reject('unknown_caller_event', lambda x: x['template']['execution_schedule'][0].__setitem__('kind', 'unpriced_kernel'), 'closed caller alphabet') + reject('unpriced_bank_child', lambda x: x['template']['bank_padding']['children'].append({'rank': 1}), 'no uncounted padding children') + reject('non_quarter_phase', lambda x: x['recipes']['children'][0]['left'].__setitem__('phase', Q(1, 2)), 'quarter phase') + try: + scalar_parameters(['scale', ['L', 0], 1, 3]) + except ValueError: + rejected.append('nondyadic_coefficient') + else: + raise ValueError('accepted nondyadic scalar') + bad = copy.deepcopy(ledger) + bad['unnormalized_rank_mass_per_cover'] = Q(bad['unnormalized_rank_mass_per_cover'], 14336) + try: + recurrence(bad) + except ValueError as error: + need(str(error) == 'height mass must equal the unnormalized emitted children', 'normalization control gate') + rejected.append('live_family_normalization') + else: + raise ValueError('accepted time-normalized height mass') + return rejected + + +def build_result(): + authenticate() + data, pins = load() + ledger, coefficients = audit(data) + return {'status': 'PASS_SELECTED_COMPLEX_HEIGHT_LEDGER', 'member_sha256': pins, + 'ledger': ledger, 'recurrence': recurrence(ledger), + 'source_coefficient_controls': actual_coefficient_controls(coefficients), + 'rejected_controls': controls(data, ledger)} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--write', action='store_true', help='explicitly regenerate this package receipt') + args = parser.parse_args() + result = build_result() + path = PACKAGE / 'RESULT.json' + if args.write: + path.write_text(json.dumps(result, indent=2, sort_keys=True) + '\n') + else: + need(canonical(json.loads(path.read_text())) == canonical(result), 'receipt mismatch') + ledger = result['ledger'] + print(result['status'], 'local_events=' + str(ledger['local_events_per_cover']), + 'children=' + str(ledger['children_per_cover']), 'rank_mass=' + str(ledger['unnormalized_rank_mass_per_cover']), + 'scalar_height=' + str(ledger['scalar_height_per_cover']), + 'controls=' + str(len(result['rejected_controls'])), 'conditional_no_new_kappa') + + +if __name__ == '__main__': + main()