diff --git a/research/selected-phase-linear-statistic/PREDECESSOR-RECIPE.json b/research/selected-phase-linear-statistic/PREDECESSOR-RECIPE.json new file mode 100644 index 0000000000..ea2bc6909e --- /dev/null +++ b/research/selected-phase-linear-statistic/PREDECESSOR-RECIPE.json @@ -0,0 +1,130 @@ +{ + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "native_event_index": 24472, + "event": [ + "MOVE", + 415, + 3, + 99, + false + ], + "side": "right", + "rank": 1, + "recipe": { + "matrix_rows": [ + 239, + 129, + 130, + 132, + 136, + 16, + 160, + 192, + 256 + ], + "offset": 1, + "quadratic_rows": [ + 111, + 111, + 111, + 111, + 0, + 111, + 111, + 0, + 0 + ], + "linear_Z4": [ + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 2, + 0 + ], + "phase": 1 + }, + "lowered_recipe": { + "rank": 1, + "left": { + "matrix_rows": [ + 3, + 5, + 9, + 17, + 32, + 65, + 129, + 1, + 256 + ], + "offset": 0, + "quadratic_rows": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "linear_Z4": [ + 2, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "phase": 0 + }, + "right": { + "matrix_rows": [ + 239, + 129, + 130, + 132, + 136, + 16, + 160, + 192, + 256 + ], + "offset": 1, + "quadratic_rows": [ + 111, + 111, + 111, + 111, + 0, + 111, + 111, + 0, + 0 + ], + "linear_Z4": [ + 3, + 3, + 3, + 3, + 0, + 3, + 3, + 2, + 0 + ], + "phase": 1 + } + }, + "catalogue_pairs_examined": 1, + "native_compressed_sha256": "2b94953dc14a122e3ef089633f05b58ec689ec5156feb7c784ed3e137dc01883", + "native_canonical_sha256": "91429a6b96729292a8764836e00c87a6f7cd3b76f05159033f4867f69a98d097" +} diff --git a/research/selected-phase-linear-statistic/PROOF.md b/research/selected-phase-linear-statistic/PROOF.md new file mode 100644 index 0000000000..cc5d1a2fd9 --- /dev/null +++ b/research/selected-phase-linear-statistic/PROOF.md @@ -0,0 +1,124 @@ +# The exact linear information of one selected tensor phase + +This scoped written proof was produced by Nick Petalas. Apache-2.0. + +## Contract and result + +Take the right monomial recipe in CubeJerry / Jerry Chen's +[#7426](https://github.com/CrocSwap/integer-mult-bounds/pull/7426), head +`172f4535ce8dcff79f626410af845f757c1563be`. Its unchanged factual recipe is +retained as PREDECESSOR-RECIPE.json. We study only its diagonal absolute +Gaussian phase, evaluated on the coordinates before the monomial's affine +address route. We cite the source's recipe binding; we do not replay that +binding or its literal tape program. + +Let S={0,1,2,3,5,6}. In its strict-upper convention the source phase is + + q(x) = 1 + 3 sum_(i in S) x_i + + 2 sum_(i=1, +the tensor phase on x in F2^(9f) is + + Q_f(x) = sum_(j=1..f) q(x^(j)) (mod 4). + +A binary affine-linear observation is Lx+c in F2^k. An arbitrary decoder of +its output must recover Q_f(x) on every input. The observation and decoder +are fixed, with no auxiliary access to x. Observation count means the +rank of L; deleting dependent output bits always gives an equivalent +statistic. No bound on the decoder's computational cost is asserted. + +**Theorem.** The exact minimum observation rank is f+1. An attaining linear +statistic is + + r_j = XOR_(i in S) x_(i,j), j=1..f, + b = XOR_(j=1..f) x_(7,j). + +Its decoder is + + Q_f(x) = f + 3 sum_j r_j + 2b (mod 4). (1) + +In particular, fifteen quadratic pair terms per column disappear from +this phase description. Compared with retaining the two natural observations +r_j and x_(7,j) separately at every column, aggregating the latter saves +f-1 independent observation bits. The sharp bound is about binary linear +information. Q_f itself has only four possible values, so two nonlinear +output bits always suffice. That is a different observation contract. + +## Contraction + +This contraction is inherited from #7426's PROOF.md, Section 1, which +explicitly proves q(x)=1-(sum_S x_i mod 2)+2*x_7. We recall it to fix the +phase convention. For Boolean bits, the classical identity + + XOR_i x_i = sum_i x_i - 2 sum_(i=1; give a contracted phase decoder and the complete translation-period subgroup.", + "scope_change_reason": "This is an original written phase-information side result from CubeJerry PR7426, rather than formalization or a replay of a predecessor. It changes no physical native or selected-frontier contract.", + "bottleneck_link": "The selected native phase has fifteen quadratic pair terms per column. A two-parity one-column description and exact tensor observation bound can guide a smaller phase producer, but its full physical time, ownership, cleanup and backing bill remain unknown.", + "budget_minutes": 60, + "stop_rule": "Stop at the first proved contraction and sharp linear-information bound; package it without extending to a physical implementation.", + "outcome": "completed", + "evidence": "PROOF.md and generated hash-bound verify.py stdout; exact one/two-column phase and period censuses, all one-bit linear maps, larger fixed tensor fixtures and controls.", + "author": "Nick Petalas", + "ai_assistance": "Independent human and formal proof-kernel review are unclaimed.", + "open_questions": [ + { + "question": "Can a literal producer exploit the contraction with a lower complete phase bill?", + "why_it_matters": "A symbolic simplification affects a supplier only if its physical savings survive acquisition and cleanup.", + "first_step": "Use the supplied PR7426 packed interface and replace quadratic updates while pricing every parity read, carry, owner return and cleanup.", + "blocked_by": "No complete time, historical-backing or recursive invoice for that changed producer is supplied." + }, + { + "question": "Can a sequential producer compute the nonlinear two-bit phase without retaining all f linear observations?", + "why_it_matters": "The f+1 information bound does not bound nonlinear streaming workspace.", + "first_step": "Specify one ordered scan and a reversible state/return contract, then construct its explicit producer.", + "blocked_by": "The decoder and its reversible execution costs are unpriced." + } + ], + "claim_url": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19591467", + "scientific_source": { + "pr": 7426, + "author": "CubeJerry", + "head": "172f4535ce8dcff79f626410af845f757c1563be", + "path": "research/literal-native-quadratic-phase/RECIPE.json", + "url": "https://github.com/CubeJerry/integer-mult-bounds/blob/172f4535ce8dcff79f626410af845f757c1563be/research/literal-native-quadratic-phase/RECIPE.json", + "retained_as": "PREDECESSOR-RECIPE.json", + "sha256": "96fadb44c3316be93c6c02f50cd2c841a9541d67b98fd94fc47b73fa64dd404c", + "use": "Unchanged factual phase recipe, its source binding, literal implementation and explicit one-column parity contraction are credited to PR7426. Only the tensor period subgroup and sharp f+1 linear-observation bound are new. No predecessor executable is replayed; retained bytes remove any pending-commit runtime dependency." + }, + "environment": { + "python": "3.12.15", + "system": "macOS arm64", + "dependencies": "standard library only" + }, + "orientation": { + "status": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "selected_pr": 7000, + "kappa": "363005817/100000000000", + "catalog_context_matches_selected": false, + "scientific_replay_run": false + }, + "overlap": { + "checked_utc": "2026-11-13T13:42:09Z", + "open_pr_snapshot_records": 800, + "discussion_snapshot_records": 7395, + "complete_remote_pagination": true, + "local_note_records": 10178, + "source_reference_account_matches": "PR7462, PR7468 and PR7477 cite 7426 as related work; none targets this phase-information question.", + "scope_distinction": "Address-map synthesis, central tensor integral-prefix scales and malformed-rejection cleanup are different questions and models. This result finds a sharp binary-linear statistic of a diagonal absolute phase.", + "limitations": "PR bodies, current comments, main README text and local metadata do not cover every arbitrary diff or unpublished investigation." + }, + "credit_clarification": "Full PR7426 PROOF.md Section 1 already proves the one-column parity contraction. The progress post corrects its initially overbroad novelty wording. The original result is the complete tensor period subgroup and sharp f+1 affine-linear observation minimum." +} diff --git a/research/selected-phase-linear-statistic/VERIFY.json b/research/selected-phase-linear-statistic/VERIFY.json new file mode 100644 index 0000000000..30106ac009 --- /dev/null +++ b/research/selected-phase-linear-statistic/VERIFY.json @@ -0,0 +1,34 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact literal/contracted phases, complete one-column derivatives, all two-column addresses and shifts, all one-bit linear maps, tensor fixtures, semantic/domain controls and generated file hashes." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact literal/contracted phases, complete one-column derivatives, all two-column addresses and shifts, all one-bit linear maps, tensor fixtures, semantic/domain controls and generated file hashes." + } + ] +} diff --git a/research/selected-phase-linear-statistic/verify.py b/research/selected-phase-linear-statistic/verify.py new file mode 100644 index 0000000000..695f95b392 --- /dev/null +++ b/research/selected-phase-linear-statistic/verify.py @@ -0,0 +1,208 @@ +"""Exact corroboration of the selected phase's sharp linear statistic.""" + +import hashlib +import itertools +import json +import platform +from pathlib import Path + + +ROOT = Path(__file__).resolve().parent +SUPPORT = (0, 1, 2, 3, 5, 6) +SOURCE_HASH = "96fadb44c3316be93c6c02f50cd2c841a9541d67b98fd94fc47b73fa64dd404c" +FILES = ( + "README.md", "PROOF.md", "PREDECESSOR-RECIPE.json", "verify.py", + "TASK.json", "SOURCES.json", "VERIFY.json", +) + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def source_recipe(): + path = ROOT / "PREDECESSOR-RECIPE.json" + require(path.is_file() and not path.is_symlink(), "recipe file") + require(path.stat().st_size < 65536, "recipe size") + raw = path.read_bytes() + require(hashlib.sha256(raw).hexdigest() == SOURCE_HASH, "source bytes") + data = json.loads(raw) + require(data["native_event_index"] == 24472, "source event") + require(data["side"] == "right", "source side") + require(data["event"] == ["MOVE", 415, 3, 99, False], "source occurrence") + require(data["recipe"] == data["lowered_recipe"]["right"], "source lowering") + return data["recipe"] + + +def literal_phase(address, recipe): + """Strict-upper polynomial oracle, without the contracted formula.""" + require(type(address) is int and 0 <= address < 512, "address domain") + bits = tuple((address >> i) & 1 for i in range(9)) + value = recipe["phase"] + for i in range(9): + value += recipe["linear_Z4"][i] * bits[i] + for j in range(i + 1, 9): + value += 2 * bits[i] * bits[j] * ((recipe["quadratic_rows"][i] >> j) & 1) + return value % 4 + + +def observations(columns): + require(type(columns) is tuple and 1 <= len(columns) <= 64, "column domain") + require(all(type(x) is int and 0 <= x < 512 for x in columns), "column value") + parities = tuple(sum((x >> i) & 1 for i in SUPPORT) % 2 for x in columns) + sign = sum((x >> 7) & 1 for x in columns) % 2 + return parities, sign + + +def compressed_phase(columns): + parities, sign = observations(columns) + return (len(columns) + 3 * sum(parities) + 2 * sign) % 4 + + +def primary_period(columns): + parities, sign = observations(columns) + return not any(parities) and sign == 0 + + +def constant_derivatives(table): + """All 512 truth-table translates, checked on every base point.""" + constants = [] + comparisons = 0 + for shift in range(512): + differences = set() + for x in range(512): + differences.add((table[x ^ shift] - table[x]) % 4) + comparisons += 1 + constants.append(next(iter(differences)) if len(differences) == 1 else None) + return tuple(constants), comparisons + + +def one_column(recipe): + table = tuple(literal_phase(x, recipe) for x in range(512)) + for x in range(512): + require(table[x] == compressed_phase((x,)), "one-column identity") + constants, comparisons = constant_derivatives(table) + periods = 0 + for shift in range(512): + require((constants[shift] == 0) == primary_period((shift,)), "one-column period") + periods += constants[shift] == 0 + # Exhaust every one-bit linear observation, including the zero map. + rejected_maps = 0 + for mask in range(512): + fibers = (set(), set()) + for x in range(512): + fibers[(mask & x).bit_count() % 2].add(table[x]) + require(any(len(fiber) > 1 for fiber in fibers), "false one-bit statistic") + rejected_maps += 1 + require(periods == 128, "one-column kernel size") + return table, constants, comparisons, periods, rejected_maps + + +def two_columns(table, constants): + phases = periods = 0 + digest = hashlib.sha256() + for left, right in itertools.product(range(512), repeat=2): + literal = (table[left] + table[right]) % 4 + contracted = compressed_phase((left, right)) + require(literal == contracted, "two-column identity") + digest.update(bytes((literal,))) + phases += 1 + a, b = constants[left], constants[right] + oracle = a is not None and b is not None and (a + b) % 4 == 0 + require(oracle == primary_period((left, right)), "two-column period") + periods += oracle + require(periods == 32768, "two-column kernel size") + return phases, periods, digest.hexdigest() + + +def rotate(pair, phase): + real, imag = pair + return ((real, imag), (-imag, real), (-real, -imag), (imag, -real))[phase % 4] + + +def tensor_fixtures(recipe): + # Fixed fixtures at larger f are not an exhaustive address census. + fixtures = rotations = 0 + for f in range(1, 65): + for seed in range(16): + columns = tuple((seed * 73 + j * 151 + f * j * j) % 512 for j in range(f)) + literal = sum(literal_phase(x, recipe) for x in columns) % 4 + require(literal == compressed_phase(columns), "larger tensor identity") + for pair in ((0, 0), (2, -3), (-5, 7)): + result = rotate(pair, literal) + require(rotate(result, -compressed_phase(columns)) == pair, "Gaussian inverse") + rotations += 1 + fixtures += 1 + return fixtures, rotations + + +def rejection_controls(recipe, table): + controls = 0 + require(table[0] != (compressed_phase((0,)) - 1) % 4, "constant control") + controls += 1 + changed = dict(recipe) + changed["quadratic_rows"] = list(recipe["quadratic_rows"]) + changed["quadratic_rows"][0] ^= 1 << 1 + require(literal_phase(3, changed) != table[3], "deleted pair control") + controls += 1 + require(compressed_phase((1,)) != (1 + 1) % 4, "odd phase sign control") + controls += 1 + require(compressed_phase((0,)) != compressed_phase((128,)), "sign observation control") + controls += 1 + require(compressed_phase((1, 1)) != compressed_phase((0, 0)), "parity-only weight control") + controls += 1 + require(compressed_phase((0, 0)) != table[0], "repeated constant control") + controls += 1 + require(not primary_period((1,)), "overlarge kernel control") + controls += 1 + require(primary_period((128, 128)), "joint-column sign cancellation") + controls += 1 + invalid = ((), (True,), (-1,), (512,), tuple(0 for _ in range(65))) + for columns in invalid: + try: + observations(columns) + except ValueError: + controls += 1 + else: + raise ValueError("invalid column accepted") + return controls + + +def file_hashes(): + hashes = {} + for name in FILES: + path = ROOT / name + require(path.is_file() and not path.is_symlink(), "package file") + require(path.stat().st_size <= 1048576, "package size") + hashes[name] = hashlib.sha256(path.read_bytes()).hexdigest() + return hashes + + +def main(): + recipe = source_recipe() + table, constants, derivatives, periods1, maps = one_column(recipe) + phases2, periods2, digest = two_columns(table, constants) + fixtures, rotations = tensor_fixtures(recipe) + result = { + "status": "PASS_SELECTED_PHASE_LINEAR_STATISTIC", + "claim_type": "scoped written proof with exact finite corroboration", + "one_column_addresses": len(table), + "one_column_derivative_comparisons": derivatives, + "one_column_periods": periods1, + "rejected_one_bit_linear_maps": maps, + "two_column_addresses_and_shifts": phases2, + "two_column_periods": periods2, + "two_column_phase_sha256": digest, + "larger_tensor_fixtures": fixtures, + "Gaussian_forward_inverse_pairs": rotations, + "controls": rejection_controls(recipe, table), + "python": platform.python_version(), + "source_hashes": file_hashes(), + "no_new_kappa": True, + } + print(json.dumps(result, sort_keys=True, indent=2)) + + +if __name__ == "__main__": + main()