diff --git a/research/higher-order-cut-activation/CODE-BOUNDS.md b/research/higher-order-cut-activation/CODE-BOUNDS.md new file mode 100644 index 0000000000..b1a75f8ba3 --- /dev/null +++ b/research/higher-order-cut-activation/CODE-BOUNDS.md @@ -0,0 +1,42 @@ +# Executable bounds and implementation inspection + +Produced by Nick Petalas. Apache-2.0. + +The executable is calibration software. Its two modules have no recursion, +dynamic evaluation, subprocesses, network use, background work or file writes. +All functions are under 60 physical lines. Scalar words contain only signed +ADDs on distinct valid coordinates. Scientific checks use explicit exceptions +and remain active under optimized Python; internal assertions are additional +checks, not the only mathematical acceptance conditions. + +The public constructors limit banks to eight, entries to 10^9 and scalar +fixtures to d <= 49. The Euclidean loop has 64 iterations, exceeding its +worst-case bound for two positive integers at most 10^9. At most eight Bezout +steps are used. Literal words have at most 816 signed ADDs and 24 scalar +coordinates. The registered verifier uses 57 families on at most six banks, +602 proper subpools and 25 three-coordinate scalar words. Its largest minor +oracle has 2^6-1 = 63 nonempty diagonal minors. No scientific loop grows its +own input collection. Source/package hashing is bounded by the fixed committed +file list; changing that list changes the authenticated payload. + +Rule 3, fixed memory capacity: CPython integers, tuples, lists and JSON require +managed allocations. The code does not claim fixed allocation after startup. +The input and loop bounds above limit live collections. Bezout coefficients +are bounded by eight products of input-sized coefficients; scalar coordinates +in the actual finite checks are fixed small integers. Follow-up, if this code +becomes a physical execution engine, is a separately specified fixed-width +representation with capacity/exhaustion checks. This diagnostic program is +not that engine. + +Rule 9, indirect calls: rejecting controls pass bounded, explicit lambdas to +one local helper. These targets are visible in verify_controls and live only +for one call; there is no registry or external dispatch. The finite verifier +also uses ordinary Python library iterators. Replacing the callbacks is only +needed if this checker is ported to a runtime forbidding indirect calls. + +Rule 10, diagnostics: registered normal and optimized commands run with +`-I -W error -B`; the direct syntax inspection uses ast.parse and compile with +warnings treated as errors. No third-party linter or static type checker is +required by this standalone standard-library package. Repository package +metadata, source pins, whitespace, committed-byte/history and scientific +replay checks supply the recurring verification boundary. diff --git a/research/higher-order-cut-activation/PROOF.md b/research/higher-order-cut-activation/PROOF.md new file mode 100644 index 0000000000..3ea2b18b55 --- /dev/null +++ b/research/higher-order-cut-activation/PROOF.md @@ -0,0 +1,135 @@ +# Arbitrarily high activation arity at a parallel helper cut + +Produced by Nick Petalas. Apache-2.0. + +## Contract and credited premise + +Let D = Z[1/2]. For a reversible scalar prefix A and suffix B = A^-1, +fix the coordinate support G of helper inputs/outputs and eligible cut +support F. The eligible rows are all v supported in F with vA supported +in G. The eligible columns are all u supported in F with Bu supported +in G. Choose full D-module bases L0 and R0 and write K = L0 R0. + +A t-channel normalized algebraic interface is X K Y = I_t over D. +Ali Romman's PR5615 proves that its maximum t is + + c(K) = min over odd primes p of rank over F_p of (K mod p). + +We cite that single-cut theorem, including its requirement for full module +bases. It is not a result reverified by this contribution. Smith normal +form and Bezout identities are classical. The new claims below concern +activation arity under parallel composition and a causal scalar realization. +No native frame, Gaussian response, independent productive target or free +basis conversion is part of this scalar contract. + +## Theorem 1: activation arity is unbounded + +For every integer q >= 2, there are q independent reversible scalar banks +such that every proper nonempty subpool has capacity zero and their full +parallel pool has capacity exactly one. All inputs, including excluded +coordinates, are arbitrary, and the complete scalar word restores them. +For q = 2 the algebraic phenomenon is already illustrated by PR5615's +diag(3,5) example. The arbitrary q statement and scalar banks are the +present contribution. + +Choose distinct odd primes p_1,...,p_q. Put P = product_i p_i and + + d_i = P/p_i, K = diag(d_1,...,d_q). + +If J is a proper nonempty index subset, choose j outside J. Every d_i for +i in J is divisible by p_j. Reducing K_J modulo p_j gives the zero matrix, +so c(K_J) = 0. This obstruction applies to arbitrary dyadic row/column +combinations within that subpool, not just to its individual entries. + +For the full pool, gcd(d_1,...,d_q) = 1: every prime divisor of P is absent +from one of the d_i, and there are no other prime divisors. Bezout therefore +provides integers b_i with sum_i b_i d_i = 1. Taking X = (b_1,...,b_q) and +Y = (1,...,1)^T gives X K Y = 1. Hence c(K) >= 1. + +For any j, the reduction of the full K modulo p_j has exactly one nonzero +diagonal entry, d_j. Its rank is one, so c(K) <= 1. This proves the exact +capacity and every proper-subpool exclusion. Section 3 realizes each d_i +as the full pairing of an actual reversible scalar bank, completing the +causal assertion. + +Consequently, for every fixed h >= 1, testing only subpools with at most h +banks cannot justify excluding all joint channels: choose q = h+1. This +is a statement about the declared algebraic parallel-cut model. It does +not invalidate a census with a stronger source-specific theorem limiting +which banks can share a physical chart or time. + +## 3. Reversible scalar bank with full pairing [d] + +For any positive integer d, take three arbitrary scalar coordinates +(x_0,x_1,z). The prefix consists of ordinary unit-coefficient ADDs: + + x_0 += z + x_1 += z + z += x_0 + repeat d-1 times: z += x_1 + +It has d+2 ADDs and column-convention matrix + + A_d = [[1, 0, 1], + [0, 1, 1], + [1, d-1, d+1]]. + +The suffix reverses the prefix order and negates each ADD, so it has the +same cost and restores all three arbitrary input values. In particular, + + B_d = A_d^-1 = [[2, d-1, -1], + [1, d, -1], + [-1, 1-d, 1]]. + +At the cut and boundary take F = G = span_D(e_0,e_1), excluding z. +A row (a,b,0) is eligible exactly when its excluded prefix coordinate +vanishes, a+b=0. Thus its full module basis is l = (1,-1,0). +A column (a,b,0)^T is eligible exactly when -a+(1-d)b=0. Its full module +basis is r = (d-1,-1,0)^T. These descriptions parameterize every solution +over D directly; there is no independently rescaled rational nullspace. +The pairing l r equals d. Both generators are primitive. In fact lA_d=l +and B_d r=r, so the displayed boundary supports hold exactly. + +Parallel banks are disjoint coordinate blocks. Their eligibility equations +separate by block, even when candidate vectors use arbitrary combinations +across banks. The full eligible modules are therefore the direct sums of +the displayed modules, and their pairing is exactly diag(d_i). Every bank +prefix precedes one common scalar cut and every inverse suffix follows it. +The total scalar ADD cost is 2 sum_i(d_i+2), on 3q arbitrary coordinates. + +This is a complete ordinary scalar invoice for the calibration word. It +is not the native or recursive invoice of a productive helper supplier. +The word itself is identity and earns no productive credit by that fact. + +## 4. Concrete three-bank certificate + +Take (d_1,d_2,d_3) = (15,21,35). Their pairwise gcds are 3,5,7 respectively, +so all three pairs have capacity zero; each singleton also has capacity +zero. The full pool has the unit certificate + + (1,1,-1) diag(15,21,35) (1,1,1)^T = 1. + +Modulo 3,5 or 7 its rank is one, proving optimality. Its integer Smith +factors are 1,105,105: the gcd of entries is 1, the gcd of nonzero 2-minors +is 105 and the determinant is 11025. + +The nine-coordinate causal realization costs + + 2((15+2)+(21+2)+(35+2)) = 154 signed ADDs. + +The pooled eligible row is (l,l,-l) and column is (r_15,r_21,r_35)^T. +Their pairing is one. The suffix restores all nine arbitrary coordinates; +no zero-initialized workspace, source consumption, erasure or discarded +history is used. Preparing a physical common helper frame and executing +these cross-bank combinations still requires its own charged construction. + +## Verification boundary + +The dimension-uniform assertions are the written proof above. The finite +checker corroborates 57 prime families from subsets of {3,5,7,11,13,17}, +all 602 proper nonempty subpools, 57 Bezout witnesses, 25 literal scalar +banks at odd d between 1 and 49, and the complete nine-coordinate word. +It computes determinantal divisors without the predecessor Smith program, +checks exact prefix/inverse matrices, full dirty basis columns, support +identities, primitive generators and explicit invalid controls. It imports +no predecessor executable and performs no predecessor scientific replay. diff --git a/research/higher-order-cut-activation/README.md b/research/higher-order-cut-activation/README.md new file mode 100644 index 0000000000..6461a74554 --- /dev/null +++ b/research/higher-order-cut-activation/README.md @@ -0,0 +1,112 @@ +# Helper channels can require arbitrarily many parallel banks + +This contribution was produced by Nick Petalas. Apache-2.0. + +**Scoped proof with exact finite corroboration; no new kappa.** For every +q >= 2, q independent reversible scalar helper banks have zero dyadic unit +capacity in every proper nonempty subpool and capacity exactly one jointly. +The first new arity is three: + + every singleton and pair of [15], [21], [35]: capacity 0 + diag(15,21,35): capacity 1, since 15+21-35 = 1 + +The proof constructs d_i = product_{j != i} p_j for distinct odd primes. +An omitted prime obstructs each proper subpool. An integral Bezout identity +attains the full channel, and reduction modulo any chosen prime proves its +optimality. Each [d_i] is the full saturated pairing of an explicit +three-coordinate reversible scalar bank. The three-bank fixture restores +nine arbitrary dirty inputs in exactly 154 signed unit-coefficient ADDs. + +[PROOF.md](PROOF.md) states the contract and all-size argument. +[activation.py](activation.py) constructs the finite witnesses and literal +scalar words. [verify.py](verify.py) uses a separate determinantal-divisor +oracle and exact dirty-input replay. It emits a computed stdout receipt +bound to SHA256 hashes of package files and the credited source input. + +The practical implication is limited but concrete: bounded-arity grouping +cannot certify that arbitrary parallel helper banks have no algebraic unit +channel. A search needs either a source-specific restriction on joint banks +or their full prime obstruction data. This construction does not assert +that the selected P104 word contains these banks or can place them in one +legal common native chart. + +## Reproduce + +From the repository root, use CPython 3.12 and its standard library: + +```sh +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -W error -B research/higher-order-cut-activation/verify.py +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -O -W error -B research/higher-order-cut-activation/verify.py +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/higher-order-cut-activation +/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/higher-order-cut-activation --check-source-history +``` + +Another CPython 3.12 path may replace the absolute path. Expected markers +are `PASS_HIGHER_ORDER_CUT_ACTIVATION`, `PASS_REGISTERED_RESEARCH_PACKAGE` +and `PASS_RESEARCH_COMMIT_BYTES`. + +Finite coverage is 57 prime families, all 602 proper nonempty subpools, +57 attaining unit witnesses, 25 literal scalar cut fixtures, the 154-ADD +nine-coordinate forward/inverse identity, and 16 rejecting controls. +Normal and optimized commands must agree on every computed result. + +## Scope, costs and remaining obligations + +The changed contract is parallel pooling, with arbitrary cross-bank dyadic +row/column combinations at one scalar cut. There is no tensor multiplication. +Ali Romman's PR5615 single-cut capacity theorem and its diag(3,5) example +are credited premises. We add unbounded activation arity and its causal +scalar realization, not a new Smith theorem or a new two-bank phenomenon. +The new question was posed directly at the coverage-law-change bottleneck; +it was not selected from a predecessor's open next questions. + +The scalar prefix/suffix and arbitrary-input restoration are proved and +implemented. Common native charts, physical carrier delivery, preparation +of joint bases, independent productive Gaussian targets, precision/growth, +stock, compiler and the complete paid/target invoice are **unproved**. +The scalar ADD invoice does not price those missing obligations. No selected +scientific replay, native supplier replay, Lean, Docker, rounded multiplier, +independent human review or formal proof-kernel review was performed. +All five selected framework assumptions remain. No frontier change is made. + +Executable calibration bounds are at most eight banks, positive entries +through 10^9 and literal scalar fixtures through d=49. The written theorem +has no such bounds. Guard rejection is not a mathematical obstruction. +[CODE-BOUNDS.md](CODE-BOUNDS.md) records the managed-runtime deviations and +finite resource bounds. + +## Sources and overlap + +Base canonical main is a5bff3bf133e482541c09eba4e773884bdb2b1b7, priority 8. +The selected record resolves to conditional kappa .003125804; earlier values +in priority prose do not define this package's baseline. The source-bound +baseline passed without a selected scientific replay. + +[Advance CLAIM](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19279640). +Live handoffs, active Discussions, open/merged PRs, recent account work and +local reservations were checked. Main README searches covered direct sums, +parallel pooling, complementary primes, higher-order activation, proper +subpools and the three diagonal entries. The cached overlap report covered +338 open PR records and 5,947 discussion records, but only 93 of 8,623 local +note paths; this is bounded overlap evidence, not proof of global novelty. +No matching arbitrary-arity parallel activation result appeared. + +Credit Ali Romman's PR5615 single-cut capacity criterion, PR5602/5611 helper +handoff/completion, PR5599, and their retained P104/controller/native lineage. +The algebraic two-bank activation diag(3,5) is explicitly predecessor work. +Nick Petalas's PR5882 concerns tensor capacity, while zxv's product-module +result concerns factored tensor supports; those are context with a different +composition contract, not results rechecked or extended by this package. +Bezout, prime divisibility and Smith normal form are classical. Source bytes +are pinned in [SOURCES.json](SOURCES.json). No predecessor credit is changed. + +## Open next questions + +1. Does one actual source word have three compatible simultaneous banks with + complementary prime obstructions and a legal shared native chart? Extract + their full saturated modules first. Physical timing and carrier costs are + the blockers; a positive algebraic pairing is insufficient. +2. Can the cross-bank unit witness be delivered as an independent productive + target at a favorable complete signed bill? Start with the nine-coordinate + fixture and charge both basis preparations, restoration and native maps. + No favorable bound on those missing costs is claimed here. diff --git a/research/higher-order-cut-activation/SOURCES.json b/research/higher-order-cut-activation/SOURCES.json new file mode 100644 index 0000000000..6fc1e9a792 --- /dev/null +++ b/research/higher-order-cut-activation/SOURCES.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "base_commit": "a5bff3bf133e482541c09eba4e773884bdb2b1b7", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a", + "sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "research/dyadic-helper-channel-capacity/PROOF.md", + "usage": "input", + "git_blob": "c97a6edce3070414c81f0ef6e6c099ebb17f3a90", + "sha256": "b258a217f2cd0fc48461285fe8ae24de26b0c5963668d9d8f0955fc6e759e929" + } + ] +} diff --git a/research/higher-order-cut-activation/TASK.json b/research/higher-order-cut-activation/TASK.json new file mode 100644 index 0000000000..f5552896bd --- /dev/null +++ b/research/higher-order-cut-activation/TASK.json @@ -0,0 +1,84 @@ +{ + "schema_version": 1, + "task_id": "coverage-law-change", + "priority_revision": 8, + "base_commit": "a5bff3bf133e482541c09eba4e773884bdb2b1b7", + "original_card": { + "id": "coverage-law-change", + "question": "Can a completed call earn more independent productive target credit without an offsetting paid bill?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "A source-bound arbitrary-input identity and legal producer/consumer boundary with the complete paid and productive target invoice, including restoration, ownership, native alignment and extra charges. Price under the actual current model; historical ceiling.py assumptions must be established before use. A favorable optimistic relaxation keeps a route open but is not a completed supplier. A scoped local result remains useful; expansion requires the family-level budget gate.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Use #5599 as a completed positive control, then choose one uncovered cut/module beyond an applicable frozen exclusion. Derive independence, saturation and chronological availability rather than counting rational rank alone. Price target credits and all new jobs together, then check compiler and actual caller compatibility. Stop on a nonphysical credit or an unfavorable complete relaxation.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "target credit", + "helper split", + "coverage law" + ], + "existing_checks": [ + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Unbounded activation arity under parallel pooling of reversible scalar dyadic helper cuts.", + "scope_change_reason": "The card asks for productive native target credit. This original algebraic side result constructs causal scalar cuts requiring arbitrarily many joint banks; physical charts and a complete productive invoice remain open.", + "bottleneck_link": "A group-local or bounded-arity capacity search cannot rule out all algebraic joint channels without a source-specific grouping theorem. The construction names a missing physical joint-bank contract rather than claiming a supplier gain.", + "budget_minutes": 60, + "stop_rule": "Stop on the first exact higher-order activation proof and literal dirty-input realization; leave physical deployment and invoice optimization to open next questions.", + "outcome": "completed", + "evidence": "PROOF.md and warning-strict normal/optimized verify.py replay; computed SHA256-bound stdout receipts.", + "author": "Nick Petalas", + "ai_assistance": "Independent human and formal proof-kernel review are unclaimed.", + "open_questions": [ + { + "question": "Does an actual native source word contain three simultaneous compatible banks with complementary prime obstructions?", + "why_it_matters": "A new algebraic joint unit channel could motivate a productive helper construction.", + "first_step": "Extract full saturated modules and legal common chart/timing for three banks.", + "blocked_by": "Physical carrier delivery, native chart compatibility and complete scalar/recursive charges." + }, + { + "question": "Can a cross-bank unit witness earn an independent productive target with a favorable complete signed invoice?", + "why_it_matters": "Algebraic activation alone supplies no recursive saving.", + "first_step": "Price both basis preparations, all native maps and restoration for the concrete nine-coordinate fixture.", + "blocked_by": "No native realization or favorable full cost bound is supplied." + } + ], + "coordination": { + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19279640", + "source": "original", + "composition_contract": "parallel direct sum, not tensor multiplication" + } +} diff --git a/research/higher-order-cut-activation/VERIFY.json b/research/higher-order-cut-activation/VERIFY.json new file mode 100644 index 0000000000..6f5fae5650 --- /dev/null +++ b/research/higher-order-cut-activation/VERIFY.json @@ -0,0 +1,36 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/dyadic-helper-channel-capacity/PROOF.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Authenticate source, all finite proper pools and unit witnesses, exact scalar banks and nine-coordinate arbitrary-dirt restoration, rejecting controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Repeat every acceptance and rejection check with Python assertions disabled." + } + ] +} diff --git a/research/higher-order-cut-activation/activation.py b/research/higher-order-cut-activation/activation.py new file mode 100644 index 0000000000..5c0f2eb0c6 --- /dev/null +++ b/research/higher-order-cut-activation/activation.py @@ -0,0 +1,90 @@ +"""Exact scalar fixtures for parallel helper-cut activation. + +Produced by Nick Petalas. Apache-2.0. +""" + +from math import gcd, prod + +MAX_BANKS = 8 +MAX_ENTRY = 10**9 +MAX_SCALAR = 49 + + +def checked_entries(values): + """Bound the executable domain; the written theorem is not bounded by it.""" + entries = tuple(values) + if not 1 <= len(entries) <= MAX_BANKS: + raise ValueError("require between one and eight diagonal entries") + if any(type(value) is not int or not 1 <= value <= MAX_ENTRY for value in entries): + raise ValueError("require positive integer entries at most 10^9") + return entries + + +def extended_gcd(a, b): + if not 1 <= a <= MAX_ENTRY or not 1 <= b <= MAX_ENTRY: + raise ValueError("extended gcd operands outside executable bounds") + old_r, r, old_s, s, old_t, t = a, b, 1, 0, 0, 1 + for _ in range(64): + if r == 0: + assert old_s * a + old_t * b == old_r + return old_r, old_s, old_t + quotient = old_r // r + old_r, r = r, old_r - quotient * r + old_s, s = s, old_s - quotient * s + old_t, t = t, old_t - quotient * t + raise ArithmeticError("Euclidean iteration guard exhausted") + + +def unit_witness(values): + entries = checked_entries(values) + coefficients = [1] + divisor = entries[0] + for value in entries[1:]: + divisor, left, right = extended_gcd(divisor, value) + coefficients = [left * entry for entry in coefficients] + [right] + if divisor & (divisor - 1): + raise ValueError("diagonal entries have a common odd divisor") + assert sum(a * b for a, b in zip(coefficients, entries)) == divisor + return tuple(coefficients), divisor + + +def omitted_prime_entries(primes): + """The caller supplies distinct primes; the verifier tests that premise.""" + primes = checked_entries(primes) + if len(primes) < 2 or len(set(primes)) != len(primes): + raise ValueError("require at least two distinct primes") + if any(value < 3 or value % 2 == 0 for value in primes): + raise ValueError("require odd primes") + total = prod(primes) + entries = checked_entries(tuple(total // prime for prime in primes)) + assert all(gcd(entry, prime) == 1 for entry, prime in zip(entries, primes)) + return entries + + +def prefix(d): + """Emit ordinary unit-coefficient ADDs, including coefficient repetition.""" + if type(d) is not int or not 1 <= d <= MAX_SCALAR: + raise ValueError("scalar fixture requires 1 <= d <= 49") + gates = [(0, 2, 1), (1, 2, 1), (2, 0, 1)] + gates.extend((2, 1, 1) for _ in range(d - 1)) + assert len(gates) == d + 2 + return tuple(gates) + + +def inverse(gates): + if len(gates) > MAX_BANKS * (MAX_SCALAR + 2): + raise ValueError("gate list exceeds fixture bound") + return tuple((target, source, -sign) for target, source, sign in reversed(gates)) + + +def replay(gates, values): + state = list(values) + if not 1 <= len(state) <= 3 * MAX_BANKS or len(gates) > 2 * MAX_BANKS * (MAX_SCALAR + 2): + raise ValueError("replay dimensions exceed fixture bounds") + for target, source, sign in gates: + if not (0 <= target < len(state) and 0 <= source < len(state)): + raise ValueError("gate coordinate outside state") + if target == source or sign not in (-1, 1): + raise ValueError("require a signed ADD between distinct coordinates") + state[target] += sign * state[source] + return tuple(state) diff --git a/research/higher-order-cut-activation/verify.py b/research/higher-order-cut-activation/verify.py new file mode 100644 index 0000000000..cfe557c30f --- /dev/null +++ b/research/higher-order-cut-activation/verify.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python3 +"""Finite corroboration, exact causal words and SHA256-bound stdout receipt. + +Produced by Nick Petalas. Apache-2.0. +""" + +import hashlib +import itertools +import json +from math import gcd, prod +from pathlib import Path +import sys + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import activation + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def authenticate(): + package = Path(__file__).resolve().parent + root = package.parents[1] + sources = json.loads((package / "SOURCES.json").read_text()) + hashes = {} + for row in sources["files"]: + if row["usage"] == "input": + digest = hashlib.sha256((root / row["path"]).read_bytes()).hexdigest() + require(digest == row["sha256"], "source hash mismatch: " + row["path"]) + hashes[row["path"]] = digest + for path in sorted(package.iterdir()): + if path.is_file(): + hashes[path.name] = hashlib.sha256(path.read_bytes()).hexdigest() + return hashes + + +def minor_capacity(entries): + """Independent determinantal-divisor oracle, with no Smith implementation.""" + require(1 <= len(entries) <= 8, "minor dimension guard") + answer = 0 + for size in range(1, len(entries) + 1): + divisor = 0 + for chosen in itertools.combinations(entries, size): + divisor = gcd(divisor, prod(chosen)) + if divisor & (divisor - 1): + break + answer = size + return answer + + +def verify_families(): + prime_menu = (3, 5, 7, 11, 13, 17) + for prime in prime_menu: + require(all(prime % d for d in range(2, prime)), "nonprime menu member") + families = proper_pools = witnesses = 0 + for size in range(2, 7): + for primes in itertools.combinations(prime_menu, size): + entries = activation.omitted_prime_entries(primes) + require(minor_capacity(entries) == 1, "full pool capacity") + coefficients, divisor = activation.unit_witness(entries) + require(sum(a * b for a, b in zip(coefficients, entries)) == divisor == 1, + "unit witness identity") + families += 1 + witnesses += 1 + for mask in range(1, (1 << size) - 1): + selected = tuple(entries[i] for i in range(size) if mask >> i & 1) + missing = next(i for i in range(size) if not mask >> i & 1) + prime = primes[missing] + require(all(value % prime == 0 for value in selected), "missing-prime obstruction") + require(minor_capacity(selected) == 0, "proper pool capacity") + proper_pools += 1 + return {"families": families, "proper_nonempty_pools": proper_pools, + "attaining_unit_witnesses": witnesses} + + +def columns(gates, dimension): + return tuple(activation.replay(gates, tuple(int(j == i) for j in range(dimension))) + for i in range(dimension)) + + +def verify_scalar(d): + gates = activation.prefix(d) + backward = activation.inverse(gates) + forward_columns = columns(gates, 3) + expected = ((1, 0, 1), (0, 1, d - 1), (1, 1, d + 1)) + require(forward_columns == expected, "literal prefix differs from formula") + require(columns(backward, 3) == ((2, 1, -1), (d - 1, d, 1 - d), (-1, -1, 1)), + "literal suffix differs from inverse formula") + for word in (gates + backward, backward + gates): + require(columns(word, 3) == ((1, 0, 0), (0, 1, 0), (0, 0, 1)), "dirty restoration") + left, right = (1, -1, 0), (d - 1, -1, 0) + require(tuple(sum(left[j] * col[j] for j in range(3)) for col in forward_columns) == left, + "prefix-eligible row") + require(activation.replay(backward, right) == right, "suffix-eligible column") + require(sum(a * b for a, b in zip(left, right)) == d, "cut pairing") + require(gcd(*left) == gcd(*right) == 1, "saturated rank-one basis") + + +def verify_nine_coordinate_word(): + entries = (15, 21, 35) + gates = tuple((target + 3 * bank, source + 3 * bank, sign) + for bank, d in enumerate(entries) + for target, source, sign in activation.prefix(d)) + backward = activation.inverse(gates) + require(len(gates + backward) == 154, "complete scalar ADD invoice") + for word in (gates + backward, backward + gates): + require(columns(word, 9) == tuple(tuple(int(i == j) for i in range(9)) for j in range(9)), + "nine-coordinate dirty restoration") + left = tuple(coefficient * entry for coefficient in (1, 1, -1) for entry in (1, -1, 0)) + right = tuple(entry for d in entries for entry in (d - 1, -1, 0)) + require(sum(a * b for a, b in zip(left, right)) == 1, "literal unit channel") + prefix_columns = columns(gates, 9) + require(tuple(sum(left[j] * col[j] for j in range(9)) for col in prefix_columns) == left, + "pooled prefix support") + require(activation.replay(backward, right) == right, "pooled suffix support") + dirty = (7, -11, 13, -17, 19, -23, 29, -31, 37) + require(activation.replay(gates + backward, dirty) == dirty, "signed dirty-input fixture") + return {"coordinates": 9, "complete_scalar_adds": len(gates + backward), + "forward_inverse_basis_columns": 18, "pairing": list(entries), + "unit_row": [1, 1, -1], "unit_column": [1, 1, 1]} + + +def rejects(call): + try: + call() + except ValueError: + return 1 + raise ValueError("a rejecting control was accepted") + + +def verify_controls(): + controls = 0 + for entries in ((15,), (15, 21), (15, 35), (21, 35)): + controls += rejects(lambda entries=entries: activation.unit_witness(entries)) + for entries in ((), (True,), (-1,), (10**9 + 1,), (1,) * 9): + controls += rejects(lambda entries=entries: activation.checked_entries(entries)) + controls += rejects(lambda: activation.omitted_prime_entries((3, 3))) + controls += rejects(lambda: activation.omitted_prime_entries((2, 3))) + controls += rejects(lambda: activation.prefix(50)) + controls += rejects(lambda: activation.replay(((0, 0, 1),), (1, 2, 3))) + controls += rejects(lambda: require(15 + 21 + 35 == 1, "wrong channel sign")) + controls += rejects(lambda: require(minor_capacity((15, 21)) == 1, "false pair activation")) + gates = activation.prefix(15) + controls += rejects(lambda: require(columns(gates + activation.inverse(gates)[:-1], 3) + == ((1, 0, 0), (0, 1, 0), (0, 0, 1)), "omitted cleanup")) + require(activation.unit_witness((2, 6))[1] == 2, "dyadic unit positive control") + require(minor_capacity((1, 3, 5)) == 2, "two-channel positive control") + return controls + + +def main(): + hashes = authenticate() + families = verify_families() + scalar_cases = tuple(range(1, 50, 2)) + for d in scalar_cases: + verify_scalar(d) + result = {"family_checks": families, "scalar_cut_cases": len(scalar_cases), + "concrete_word": verify_nine_coordinate_word(), + "rejecting_controls": verify_controls()} + print(json.dumps({"result": result, "sha256": hashes}, sort_keys=True)) + print("PASS_HIGHER_ORDER_CUT_ACTIVATION") + + +if __name__ == "__main__": + main()