From 4c0ef119c6bad986ff633ecf1cfa8ebdf661755d Mon Sep 17 00:00:00 2001 From: Clear Insight Date: Mon, 19 Oct 2026 07:48:21 +1100 Subject: [PATCH 1/2] research: test source-bound centre sheaf and integer-fibre reduction Draft bounded follow-up to PR3147/3656. Reuse the frozen PR3071 source extractor; do not change selected sources or claim physical sharing. --- research/centre-sheaf-fibre/PROOF.md | 99 +++++++++++ research/centre-sheaf-fibre/README.md | 58 +++++++ research/centre-sheaf-fibre/SOURCES.json | 10 ++ research/centre-sheaf-fibre/TASK.json | 35 ++++ research/centre-sheaf-fibre/VERIFY.json | 12 ++ research/centre-sheaf-fibre/sheaf.py | 190 ++++++++++++++++++++++ research/centre-sheaf-fibre/test_sheaf.py | 106 ++++++++++++ research/centre-sheaf-fibre/verify.py | 93 +++++++++++ 8 files changed, 603 insertions(+) create mode 100644 research/centre-sheaf-fibre/PROOF.md create mode 100644 research/centre-sheaf-fibre/README.md create mode 100644 research/centre-sheaf-fibre/SOURCES.json create mode 100644 research/centre-sheaf-fibre/TASK.json create mode 100644 research/centre-sheaf-fibre/VERIFY.json create mode 100644 research/centre-sheaf-fibre/sheaf.py create mode 100644 research/centre-sheaf-fibre/test_sheaf.py create mode 100644 research/centre-sheaf-fibre/verify.py diff --git a/research/centre-sheaf-fibre/PROOF.md b/research/centre-sheaf-fibre/PROOF.md new file mode 100644 index 0000000000..2fceac5f32 --- /dev/null +++ b/research/centre-sheaf-fibre/PROOF.md @@ -0,0 +1,99 @@ +# Local-to-global reduction for a fixed subgroup block + +A general exact lemma, followed by a finite application that must be checked. +All observations are scalar maps over Q. The same conclusions hold over +characteristic-zero extensions. No physical caller or recursive cost is proved. + +## Coset elimination + +Let G contain involutions rho_p and a finite subgroup H. Let r_p be the columns +of a full-row-rank d-by-n rational matrix R. Arrays x(g,p) are supported on H +and extended by zero outside H. Set + + Sx(g) = sum_p r_p x(g,p), + 4Tx(z) = sum_p r_p x(z rho_p,p). + +Partition ports by H rho_p=H rho_q, equivalent to rho_p rho_q in H. For a class +C and an output z in its coset, only C contributes. If R_C has independent +columns, Tx(z)=0 forces each incoming coordinate to zero. Every source/port +coordinate appears at z=g rho_p, so all coordinates in such classes vanish. + +Suppose the only deficient class is P={a,b,c}, rank two, with the unique +relation r_a-r_b-r_c=0. The source equations force + + x(g,a)=alpha(g), x(g,b)=x(g,c)=-alpha(g). + +At z=g rho_a, the later equation is + + r_a alpha(g)-r_b alpha(g rho_a rho_b)-r_c alpha(g rho_a rho_c)=0. + +Independence of r_b,r_c forces equality of these three amplitudes. If the two +even route products generate H, alpha is constant. Conversely every constant +works. Hence the full common kernel is Qv, where v equals(1,-1,-1) on P at +every owner of H and is zero on all other ports. This uses every port; absence +of other individual routes from a larger group cannot replace the coset test. + +## Cellular sheaf + +Use the bipartite graph of source owners and touched output owners. Source +vertex stalks are ker R; an output vertex for class C has stalk ker R_C. Each +port edge has stalk Q, with restriction maps given by the corresponding source +and output coordinates. Global sections are exactly ker S intersect ker T. +Independent output stalks vanish and eliminate their incident coordinates. +Remaining triple stalks have dimension one. Normalising by their nonzero +coefficients makes every edge restriction equality. Connectivity therefore +gives a one-dimensional global-section space. No higher-cohomology assertion +about the unreduced sheaf is needed. + +## Information and proper subblocks + +S has rank dh. Thus rank(T restricted to ker S)=(n-d)h-1. If linear additional +observations L permit recovery of T from(S,L), even by a nonlinear decoder, +then ker S intersect ker L is contained in ker T. Consequently L needs at +least(n-d)h-1 scalar coordinates; a linear quotient attains this abstractly. +This does not give a native programme or tariff. + +Any kernel vector on a proper B subset H extends by zero to H, hence is a +multiple of v. Because v is nonzero at every owner, that multiple must be +zero. The proper-subblock requirement is therefore(n-d)|B|. Left translates +of H have the same result, but arbitrary equally sized owner sets do not +follow from it. + +## Primitive integer fibres + +When R is integral, stack S and4T into an integer matrix A. Since v has an +entry one, ker_Z A=Zv. A nonempty nonnegative integer fibre equals + + {n0+t v: t integer, lower<=t<=upper}, + lower=max_{v_i=1}(-n0_i), upper=min_{v_i=-1}(n0_i). + +The single primitive move v in either direction connects every such fibre. +The associated toric ideal is generated by the binomial for v-positive and +v-negative. This is a coefficient-fibre statement, not an operation-scheduling +model. In particular sum(v)=-h, so imposing a fixed total-count row kills the +kernel. Extra resource invariants cannot be silently discarded. + +## Proposed finite application + +PR3071/3147/3656 give n=112,d=8,h=4080. If the full coset certificate passes, +there are456960 variables, old rank32640, common kernel dimension one, and +424319 additional linear observations are necessary and sufficient abstractly. +The move has4080 positive and8160 negative entries. Source-dependent execution +is pending in this draft. Physical phases, payload covariance, acquisition, +chronology, dirty restoration, precision, hosting and a favourable complete +supplier bill remain outside this scalar theorem. + +## References and credit + +Hansen and Ghrist, Toward a spectral theory of cellular sheaves, Journal of +Applied and Computational Topology3 (2019),315-358, DOI10.1007/s41468-019-00038-7. +Diaconis and Sturmfels, Algebraic algorithms for sampling from conditional +distributions, Annals of Statistics26(1) (1998),363-397, DOI10.1214/aos/1030563990. +These established theories motivate the formulation; they do not prove the +source-specific premises. + +Credit Matarener/3656 for the4080-owner subgroup and witness, dcharb78/3147 for +the programme, Ross Richardson/3071 for the observation model and extractor, +Sagar Thakrar/3291 and Sudarsh Chaturvedi/3168 for the corrected graph/census +lineage, and all selected source notices. Clear1nsight with substantial OpenAI +assistance; Apache-2.0. No separate human or formal-kernel acceptance claimed. diff --git a/research/centre-sheaf-fibre/README.md b/research/centre-sheaf-fibre/README.md new file mode 100644 index 0000000000..307ed48eca --- /dev/null +++ b/research/centre-sheaf-fibre/README.md @@ -0,0 +1,58 @@ +# Centre sheaf and primitive integer fibre + +Draft source-bound investigation of PR3147's centre-sharing lineage, answering +PR3656's full-kernel question on its explicit4080-owner subgroup. This does not +supply a physical shared centre, a recursive tariff, or a new kappa. + +## Precise test + +The known triple(0,6,85) gives one common-kernel vector. Group all112 port +routes by right cosets of its even subgroup H. Full-column-rank output classes +force their input coordinates to zero. If the only deficient class is the +known rank-two triple, remaining compatibility forces one constant amplitude +across H. This would prove that the known vector spans the entire common +kernel, even when all112 ports can vary. + +The conditional reduction is in PROOF.md. The actual coset certificate must +pass before the application is claimed. The verifier deliberately rejects any +additional deficient class instead of assuming it away. + +## Verification boundary + +Eight generic tests passed normally and with -O under local CPython3.13.5. +They compare an independently assembled full matrix on a noncommutative small +group, every proper support subset, and all binary nonnegative fibre points. +They are not a substitute for the actual selected geometry. + +The container cannot fetch the selected archive. Source-dependent execution is +registered for the repository's existing Python3.12 workflow. No successful +source-dependent execution is claimed in this draft. + +```sh +python3.12 -B scripts/research_package.py --package research/centre-sheaf-fibre +``` + +`verify.py --emit-geometry` exports derived rational columns and binary routes +after source authentication. `--geometry FILE` is explicitly arithmetic-only. +Default commands preserve inputs. No predecessor heavy census is run. + +## Open next questions + +TASK.json records the exact dimension test and later physical-contract question. +Stop after a useful source-bound result. Information dimension is not a native +child rank, paid storage quantity, or permission to discard borrowed state. + +## Credit + +Matarener/PR3656 supplies the actual subgroup and witness. David Charbonneau/ +dcharb78/PR3147 supplies the dependent-column and route programme. Ross +Richardson/PR3071 supplies the observation model and authenticated extractor +reused unchanged. Sagar Thakrar/PR3291 supplies the corrected small-block floor; +Sudarsh Chaturvedi/PR3168 supplies separate route checks. Aaron Wang/navinor/ +PR2391, ywz65, and the retained selected geometry/compiler lineage keep credit. + +Sheaf and integer-fibre methods are classical, not invented here. Prepared by +Clear1nsight with substantial OpenAI assistance. No separate agent, independent +human, proof-kernel or full multiplication verification is claimed. Apache-2.0. +Existing sources and frontier are unchanged. The upstream coordination-comment +attempt received HTTP403 and is not a published reservation. diff --git a/research/centre-sheaf-fibre/SOURCES.json b/research/centre-sheaf-fibre/SOURCES.json new file mode 100644 index 0000000000..46fa01a11f --- /dev/null +++ b/research/centre-sheaf-fibre/SOURCES.json @@ -0,0 +1,10 @@ +{ + "schema_version": 1, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "files": [ + {"path": "certificates/selected-result.json", "usage": "provenance", "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129"}, + {"path": "docs/research/agent-task-catalog.json", "usage": "provenance", "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0"}, + {"path": "research/centre-block-repair-information/independent.py", "usage": "input", "git_blob": "d2db50ec7a595b1a1a87b7843fd5ca043c43fd25", "sha256": "b298ff3902c14db11e4ed057259785efc185e8ae3bb39c0d1c432e2340ceb4ea"}, + {"path": "research/community-frontier1094-audit/selected-replay.tar.gz", "usage": "input", "git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f", "sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6"} + ] +} diff --git a/research/centre-sheaf-fibre/TASK.json b/research/centre-sheaf-fibre/TASK.json new file mode 100644 index 0000000000..81213aa8ee --- /dev/null +++ b/research/centre-sheaf-fibre/TASK.json @@ -0,0 +1,35 @@ +{ + "schema_version": 1, + "task_id": "centre-path-sharing", + "priority_revision": 6, + "base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", + "original_card": { + "id": "centre-path-sharing", + "question": "Can the 64-per-call centre path (eight rank-8 COPY/ERASE totals through the private temporary) be shared across calls or shrunk?", + "starting_points": ["docs/research/research-family-status.md", "research/complex-local-word-ceiling/README.md", "research/split-centres-global/proofs/PR386-BIT-GEOMETRY.txt", "certificates/selected-result.json"], + "methods": ["Derive a fully charged favorable relaxation for sharing one centre path across k calls, including restoration, hosting and precision.", "Prove a lower bound on copied information per call for the selected decoder contract."], + "acceptance_gate": "Show the changed centre charge and copy profile per call with every added restoration or hosting cost charged, and its ceiling via ceiling.ceiling(centre=...). A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": {"command": ["python3", "-B", "research/complex-local-word-ceiling/verify.py"], "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", "scope": "Positive control and planning budget only; this is not a new construction or full cold replay."}, + "first_experiment": "Write the per-call centre charge and copy children for sharing across k = 2 calls, charge the sharing overhead, and screen it; stop this route if even the ideal sharing gains under 10%. Ideal budgets: free 2.80x, shared by two 1.90x (levers.py).", + "bottleneck_link": "The centre path consumes 64 of about 99.6 unpaid coordinates per call, i.e. about 64% of the raw deficit.", + "allowed_variations": ["One sharing pattern across a fixed number of calls.", "One reduced copied-total contract for the existing decoder.", "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope."], + "scope_change_triggers": ["Removing copies without a replacement contract for the decoder's copied totals.", "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts."], + "overlap_terms": ["centre path", "copied totals", "private temporary", "shared centre", "batching"] + }, + "scope_status": "changed", + "actual_scope": "User-assigned sheaf and integer-fibre approach to PR3147, refined to the complete112-port common observation kernel on PR3656's4080-owner subgroup. Test exact coset elimination and global compatibility before claiming a dimension.", + "scope_change_reason": "The simple circle route already has PR3151 and PR3194 obstructions. PR3656 supplies a concrete common-kernel witness but leaves its full kernel dimension open. This closes a different information obligation rather than repeating a circle cancellation or the single-triple census.", + "bottleneck_link": "Determines whether the first concrete large block has useful hidden information capacity or only its known one-dimensional perturbation. Information coordinates are not recursive tariffs.", + "budget_minutes": null, + "stop_rule": "Stop after one complete source-bound local-to-global kernel certificate or a counterexample to the proposed reduction. No physical supplier expansion without a changed favourable full boundary and cost ledger.", + "outcome": "partial", + "evidence": "Eight generic finite-group, matrix and nonnegative-fibre control tests pass normally and with -O on local CPython3.13.5. Actual archive-dependent subgroup and coset reduction await execution; draft status until verified.", + "author": "Clear1nsight", + "ai_assistance": "Substantial OpenAI assistance in proof, implementation, tests and writing. No separate agent, independent human or proof-kernel review is claimed.", + "open_questions": [ + {"question": "Does exact outgoing-coset elimination reduce all112 ports on the named block to the known triple?", "why_it_matters": "It decides the full common-kernel dimension without an enormous dense matrix.", "first_step": "Run the authenticated source extractor and finite coset/rank certificate, then independently verify the derived geometry.", "blocked_by": "Archive-dependent execution not yet completed."}, + {"question": "Can a different owner block or output contract yield an affordable physical sharing mechanism?", "why_it_matters": "A scalar kernel does not remove a paid recursive call.", "first_step": "Specify the actual source and return interfaces, chronology and all cost allowances before expanding search.", "blocked_by": "No native acquisition, restoration, hosting or complete supplier bill is supplied."} + ], + "coordination": {"assigned_pr": 3147, "specific_predecessor_pr": 3656, "specific_predecessor_head": "69e745992b966c647e10696b980cb4c96d7ebeed", "entry_canonical_main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90", "overlap": "Targeted live PR searches for sheaf, centre, kernel and the named predecessors; current PR3656 had no comments. Not a complete Discussion or arbitrary-diff census.", "claim_attempt": "Upstream PR3656 claim comment rejected by integration with HTTP403. Not published.", "environment": "Container DNS unavailable; no local repository/selected archive. Fork branch is writable. Registered source-dependent CI, if available, will be distinguished from local generic tests."}, + "family_gate": {"decision": "narrow", "reason": "One bounded information theorem and primitive fibre result only; no numerical saving, no full supplier or selected-frontier change."} +} diff --git a/research/centre-sheaf-fibre/VERIFY.json b/research/centre-sheaf-fibre/VERIFY.json new file mode 100644 index 0000000000..16289cd13f --- /dev/null +++ b/research/centre-sheaf-fibre/VERIFY.json @@ -0,0 +1,12 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": ["research/centre-block-repair-information/independent.py", "research/community-frontier1094-audit/selected-replay.tar.gz"], + "commands": [ + {"argv": ["{python}", "-I", "-B", "{package}/test_sheaf.py"], "timeout_seconds": 60, "checks": "Independent small matrix, proper-subblock and bounded nonnegative-fibre controls; not actual physical semantics."}, + {"argv": ["{python}", "-I", "-B", "{package}/verify.py", "--emit-geometry"], "timeout_seconds": 300, "checks": "Authenticate original selected archive and credited source extractor, test the full112-port subgroup/coset reduction and emit bounded derived geometry."}, + {"argv": ["{python}", "-I", "-O", "-B", "{package}/verify.py"], "timeout_seconds": 300, "checks": "Repeat all actual mathematical guards under optimization."} + ] +} diff --git a/research/centre-sheaf-fibre/sheaf.py b/research/centre-sheaf-fibre/sheaf.py new file mode 100644 index 0000000000..0d72453e09 --- /dev/null +++ b/research/centre-sheaf-fibre/sheaf.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Exact local-to-global kernel certificates for a routed observation block. + +Clear1nsight, with substantial OpenAI assistance. Classical sheaf/coset and +integer-fibre methods are credited in PROOF.md. This is not a native program. +""" +from __future__ import annotations + +from collections import Counter, deque +from fractions import Fraction as Q +from hashlib import sha256 +from itertools import combinations +import json + + +def need(condition: bool, message: str) -> None: + if not condition: + raise ValueError(message) + + +def canonical(value: object) -> bytes: + return json.dumps(value, sort_keys=True, separators=(",", ":")).encode() + + +def digest(value: object) -> str: + return sha256(canonical(value)).hexdigest() + + +def apply(columns: tuple[int, ...], vector: int) -> int: + out = 0 + while vector: + low = vector & -vector + out ^= columns[low.bit_length() - 1] + vector ^= low + return out + + +def compose(left: tuple[int, ...], right: tuple[int, ...]) -> tuple[int, ...]: + """The product left*right, represented by columns over F2.""" + return tuple(apply(left, column) for column in right) + + +def closure(generators: list[tuple[int, ...]], cap: int = 10000) -> list[tuple[int, ...]]: + need(bool(generators), "nonempty generating set") + identity = tuple(1 << i for i in range(len(generators[0]))) + found = {identity} + queue = deque([identity]) + while queue: + element = queue.popleft() + for generator in generators: + other = compose(element, generator) + if other not in found: + need(len(found) < cap, "group closure exceeds declared cap") + found.add(other) + queue.append(other) + return sorted(found) + + +def rref(matrix: list[list[Q]]) -> tuple[list[list[Q]], list[int]]: + if not matrix: + return [], [] + width = len(matrix[0]) + need(all(len(row) == width for row in matrix), "rectangular matrix") + work = [[Q(x) for x in row] for row in matrix] + pivots: list[int] = [] + for column in range(width): + pivot = next((i for i in range(len(pivots), len(work)) if work[i][column]), None) + if pivot is None: + continue + at = len(pivots) + work[at], work[pivot] = work[pivot], work[at] + divisor = work[at][column] + work[at] = [x / divisor for x in work[at]] + for i in range(len(work)): + if i != at and work[i][column]: + scalar = work[i][column] + work[i] = [x - scalar * y for x, y in zip(work[i], work[at])] + pivots.append(column) + if len(pivots) == len(work): + break + return work, pivots + + +def rank(matrix: list[list[Q]]) -> int: + return len(rref(matrix)[1]) + + +def coset_classes(routes: list[tuple[int, ...]], subgroup: set[tuple[int, ...]]) -> list[list[int]]: + """Partition involutory ports by H*rho_p = H*rho_q. + + This is equivalent to rho_p*rho_q in H. Test every pair, including both + directions and diagonal, rather than treating a union-find guess as proof. + """ + width = len(routes[0]) + identity = tuple(1 << i for i in range(width)) + need(all(compose(route, route) == identity for route in routes), "routes must be involutions") + classes: list[list[int]] = [] + assignment = [] + for p, route in enumerate(routes): + found = next((j for j, block in enumerate(classes) + if compose(route, routes[block[0]]) in subgroup), None) + if found is None: + found = len(classes) + classes.append([]) + classes[found].append(p) + assignment.append(found) + for p in range(len(routes)): + for q in range(len(routes)): + need((compose(routes[p], routes[q]) in subgroup) == (assignment[p] == assignment[q]), + "right-coset equivalence failed") + return classes + + +def analyse(rows: list[list[Q]], routes: list[tuple[int, ...]], triple=(0, 6, 85), cap=10000) -> dict: + """Compute a finite certificate; fails unless full kernel reduces to triple. + + The proof in PROOF.md, not floating-point rank or toy sampling, lifts these + exact premises to the full routed kernel over Q and its integer fibre. + """ + ports = len(routes) + need(len(rows) == 8 and all(len(row) == ports for row in rows), "eight query rows") + need(len(set(routes)) == ports, "distinct routes") + need(rank(rows) == 8, "full old-query rank") + a, b, c = triple + need(len(set(triple)) == 3 and all(0 <= p < ports for p in triple), "triple range") + need(all(row[a] - row[b] - row[c] == 0 for row in rows), "triple relation is (1,-1,-1)") + need(rank([[row[p] for p in triple] for row in rows]) == 2, "triple rank two") + generators = [compose(routes[a], routes[b]), compose(routes[a], routes[c])] + elements = closure(generators, cap) + subgroup = set(elements) + classes = coset_classes(routes, subgroup) + table = [] + for block in classes: + matrix = [[row[p] for p in block] for row in rows] + table.append({"ports": block, "rank": rank(matrix)}) + deficient = [entry for entry in table if entry["rank"] != len(entry["ports"])] + need(deficient == [{"ports": sorted(triple), "rank": 2}], + "full-block reduction has additional dependent coset classes: " + str(deficient)) + # Build an undirected compatibility graph independently of group closure. + # Edges say alpha(h)=alpha(h*rho_a*rho_b/c). Keep both directions, with + # separate endpoint and spanning-tree checks. + index = {g: i for i, g in enumerate(elements)} + adjacency = [set() for _ in elements] + for i, element in enumerate(elements): + for generator in generators: + j = index[compose(element, generator)] + adjacency[i].add(j) + adjacency[j].add(i) + start = index[tuple(1 << i for i in range(len(routes[0])))] + parent = {start: None} + queue = deque([start]) + tree = [] + while queue: + i = queue.popleft() + for j in sorted(adjacency[i]): + if j not in parent: + parent[j] = i + tree.append([i, j]) + queue.append(j) + need(len(parent) == len(elements) and len(tree) + 1 == len(elements), "compatibility graph connected") + variables = ports * len(elements) + old_rank = 8 * len(elements) + ambient_old_kernel = variables - old_rank + return { + "schema_version": 1, + "status": "PASS_CENTRE_SHEAF_FIBRE", + "ports": ports, + "active_dimension": len(routes[0]), + "owners": len(elements), + "right_coset_classes": table, + "class_size_histogram": {str(k): v for k, v in sorted(Counter(map(len, classes)).items())}, + "deficient_coset_classes": deficient, + "compatibility_vertices": len(elements), + "compatibility_edges": sum(map(len, adjacency)) // 2, + "spanning_tree_edges": len(tree), + "spanning_tree_sha256": digest(tree), + "subgroup_sha256": digest(elements), + "geometry_sha256": digest({"rows": [[str(x) for x in row] for row in rows], "routes": routes}), + "full_variables": variables, + "old_rank": old_rank, + "old_kernel_dimension": ambient_old_kernel, + "full_joint_kernel_dimension": 1, + "additional_linear_observations_required": ambient_old_kernel - 1, + "primitive_move_positive_entries": len(elements), + "primitive_move_negative_entries": 2 * len(elements), + "primitive_move_support": 3 * len(elements), + "constant_count_constraint_kills_kernel": True, + "scope": "Fixed H block and all declared ports, exact scalar observations only; no native tariff or physical caller.", + } diff --git a/research/centre-sheaf-fibre/test_sheaf.py b/research/centre-sheaf-fibre/test_sheaf.py new file mode 100644 index 0000000000..ea1f40f77d --- /dev/null +++ b/research/centre-sheaf-fibre/test_sheaf.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Small complete matrix/fibre oracles, not a substitute for real-source replay.""" +from fractions import Fraction as Q +from itertools import product +from pathlib import Path +import types +import unittest + +HERE = Path(__file__).resolve().parent +engine = types.ModuleType("tested_sheaf") +engine.__file__ = str(HERE / "sheaf.py") +exec(compile((HERE / "sheaf.py").read_bytes(), engine.__file__, "exec"), engine.__dict__) +ROUTES = [(2, 1), (1, 3), (3, 2)] +ROWS = [[1, 1, 0], [1, 0, 1]] + + +def full_operator(rows, routes, owners, omit_outputs=()): + """Independent direct assembly: send each (owner,port) to its actual output. + + The later equation is multiplied by four, harmless over Q/Z for kernels. + """ + width = len(owners) * len(routes) + old = [[0] * width for _ in range(len(owners) * len(rows))] + outputs = sorted({engine.compose(owner, route) for owner in owners for route in routes}) + outputs = [x for x in outputs if x not in omit_outputs] + positions = {owner: i for i, owner in enumerate(outputs)} + later = [[0] * width for _ in range(len(outputs) * len(rows))] + for i, owner in enumerate(owners): + for p, route in enumerate(routes): + col = i * len(routes) + p + target = engine.compose(owner, route) + for k, row in enumerate(rows): + old[i * len(rows) + k][col] = row[p] + if target in positions: + later[positions[target] * len(rows) + k][col] = row[p] + return old + later + + +def matvec(matrix, vector): + return tuple(sum(a * b for a, b in zip(row, vector)) for row in matrix) + + +class Tests(unittest.TestCase): + def setUp(self): + self.owners = engine.closure([engine.compose(ROUTES[0], ROUTES[1]), engine.compose(ROUTES[0], ROUTES[2])]) + self.matrix = full_operator(ROWS, ROUTES, self.owners) + self.move = (1, -1, -1) * len(self.owners) + + def test_noncommuting_routes(self): + self.assertEqual(len(self.owners), 3) + self.assertNotEqual(engine.compose(ROUTES[0], ROUTES[1]), engine.compose(ROUTES[1], ROUTES[0])) + self.assertEqual(engine.coset_classes(ROUTES, set(self.owners)), [[0, 1, 2]]) + + def test_complete_operator_kernel(self): + self.assertEqual(engine.rank(self.matrix), 8) + self.assertEqual(matvec(self.matrix, self.move), (0,) * len(self.matrix)) + echelon, pivots = engine.rref(self.matrix) + self.assertEqual(len(pivots), 8) + self.assertEqual(len(self.move) - len(pivots), 1) + + def test_every_proper_owner_subset(self): + for bits in product((0, 1), repeat=3): + subset = [g for b, g in zip(bits, self.owners) if b] + if subset and len(subset) < 3: + self.assertEqual(engine.rank(full_operator(ROWS, ROUTES, subset)), 3 * len(subset)) + + def test_exact_nonnegative_fibres(self): + fibres = {} + for point in product((0, 1), repeat=9): + fibres.setdefault(matvec(self.matrix, point), []).append(point) + multiple = 0 + for points in fibres.values(): + if len(points) > 1: + multiple += 1 + first = points[0] + for point in points: + t = point[0] - first[0] + self.assertEqual(tuple(a + t * v for a, v in zip(first, self.move)), point) + self.assertGreater(multiple, 0) + + def test_count_constraint(self): + self.assertEqual(sum(self.move), -3) + self.assertEqual(engine.rank(self.matrix + [[1] * 9]), 9) + + def test_wrong_sign_breaks_witness(self): + wrong = (1, 1, -1) * 3 + self.assertNotEqual(matvec(self.matrix, wrong), (0,) * len(self.matrix)) + + def test_omitting_later_constraints_is_unsafe(self): + old_only = self.matrix[:6] + self.assertEqual(engine.rank(old_only), 6) + self.assertLess(engine.rank(old_only), engine.rank(self.matrix)) + + def test_wrong_port_permutation(self): + changed = list(ROUTES) + changed[0], changed[1] = changed[1], changed[0] + matrix = full_operator(ROWS, changed, self.owners) + # Source equality alone cannot detect a route change on a constant + # global mode. An impulse response does detect it. + impulse = (1, 0, 0, 0, 0, 0, 0, 0, 0) + self.assertNotEqual(matvec(matrix, impulse), matvec(self.matrix, impulse)) + + +if __name__ == "__main__": + unittest.main() diff --git a/research/centre-sheaf-fibre/verify.py b/research/centre-sheaf-fibre/verify.py new file mode 100644 index 0000000000..cb9f931c68 --- /dev/null +++ b/research/centre-sheaf-fibre/verify.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Source-bound sheaf reduction, deliberately separate from supplier admission.""" +from __future__ import annotations +import argparse +from fractions import Fraction as Q +from hashlib import sha256 +import json +from pathlib import Path +import sys +import types + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PINS = { + "research/centre-block-repair-information/independent.py": + "b298ff3902c14db11e4ed057259785efc185e8ae3bb39c0d1c432e2340ceb4ea", + "research/community-frontier1094-audit/selected-replay.tar.gz": + "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6", +} + + +def local_module(name: str, filename: str): + # Execute the named source bytes directly, ignoring pre-existing bytecode. + module = types.ModuleType(name) + module.__file__ = str(HERE / filename) + exec(compile((HERE / filename).read_bytes(), module.__file__, "exec"), module.__dict__) + return module + + +def geometry(root: Path = ROOT): + for name, expected in PINS.items(): + path = root / name + if not path.is_file() or path.is_symlink(): + raise ValueError("missing regular source: " + name) + if sha256(path.read_bytes()).hexdigest() != expected: + raise ValueError("source SHA256 mismatch: " + name) + name = "research/centre-block-repair-information/independent.py" + module = types.ModuleType("credited_pr3071_source_extractor") + module.__file__ = str(root / name) + exec(compile((root / name).read_bytes(), module.__file__, "exec"), module.__dict__) + word, phases = module.sources() + rows, later = module.query_rows(word) + if later != [[x / 4 for x in row] for row in rows]: + raise ValueError("source contract H=R/4 fails") + routes, products, _ = module.route_certificates(word, phases) + if len(products) != 112 * 111: + raise ValueError("source route uniqueness") + for route in routes: + if len(route) != 73 or any(route[k] != 1 << k for k in range(17, 73)): + raise ValueError("spectator identity") + if any(x >> 17 for x in route[:17]): + raise ValueError("active subspace invariant") + return rows, [tuple(route[:17]) for route in routes] + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--emit-geometry", action="store_true", help="Print authenticated derived geometry for offline verification") + parser.add_argument("--geometry", type=Path, help="Use an explicitly labelled derived geometry export rather than re-read the source archive") + parser.add_argument("--root", type=Path, default=ROOT) + args = parser.parse_args() + engine = local_module("centre_sheaf_engine", "sheaf.py") + if args.geometry: + raw = json.loads(args.geometry.read_text()) + rows = [[Q(x) for x in row] for row in raw["rows"]] + routes = [tuple(row) for row in raw["routes"]] + source_mode = "derived geometry only; archive extraction not rerun" + else: + rows, routes = geometry(args.root) + source_mode = "authenticated archive and credited PR3071 extractor" + if args.emit_geometry: + print("GEOMETRY_JSON=" + json.dumps({"rows": [[str(x) for x in row] for row in rows], "routes": routes}, separators=(",", ":"))) + # Print finite diagnostic before the stronger assertion, so a failed model + # reduction remains a reproducible result rather than a silent truncation. + a, b, c = 0, 6, 85 + group = engine.closure([engine.compose(routes[a], routes[b]), engine.compose(routes[a], routes[c])]) + blocks = engine.coset_classes(routes, set(group)) + diagnostic = [{"ports": block, "rank": engine.rank([[row[p] for p in block] for row in rows])} for block in blocks] + print("COSET_DIAGNOSTIC=" + json.dumps(diagnostic, separators=(",", ":"))) + result = engine.analyse(rows, routes) + engine.need(result["owners"] == 4080, "pinned subgroup order differs from 4080") + result["source_mode"] = source_mode + print("RESULT_JSON=" + json.dumps(result, sort_keys=True, separators=(",", ":"))) + print("PASS_CENTRE_SHEAF_FIBRE owners=4080 all_ports=112 kernel=1 integer_generator_owners=4080 no_new_kappa") + + +if __name__ == "__main__": + try: + main() + except (ValueError, KeyError, OSError, TypeError) as error: + print("FAIL_CENTRE_SHEAF_FIBRE " + str(error), file=sys.stderr) + raise SystemExit(1) from error From 403ef45de40e41baaf8b1f4cfddaf3ba1d57af1c Mon Sep 17 00:00:00 2001 From: Clear Insight Date: Mon, 19 Oct 2026 08:01:32 +1100 Subject: [PATCH 2/2] research: independently reconstruct the routed centre kernel Add a separate archive parser, sparse forward coefficient propagation, row-matrix closure, modular rank certificate and direct residual controls. --- research/centre-sheaf-fibre/VERIFY.json | 6 +- research/centre-sheaf-fibre/independent.py | 248 +++++++++++++++++++++ 2 files changed, 252 insertions(+), 2 deletions(-) create mode 100644 research/centre-sheaf-fibre/independent.py diff --git a/research/centre-sheaf-fibre/VERIFY.json b/research/centre-sheaf-fibre/VERIFY.json index 16289cd13f..192d030d62 100644 --- a/research/centre-sheaf-fibre/VERIFY.json +++ b/research/centre-sheaf-fibre/VERIFY.json @@ -6,7 +6,9 @@ "inputs": ["research/centre-block-repair-information/independent.py", "research/community-frontier1094-audit/selected-replay.tar.gz"], "commands": [ {"argv": ["{python}", "-I", "-B", "{package}/test_sheaf.py"], "timeout_seconds": 60, "checks": "Independent small matrix, proper-subblock and bounded nonnegative-fibre controls; not actual physical semantics."}, - {"argv": ["{python}", "-I", "-B", "{package}/verify.py", "--emit-geometry"], "timeout_seconds": 300, "checks": "Authenticate original selected archive and credited source extractor, test the full112-port subgroup/coset reduction and emit bounded derived geometry."}, - {"argv": ["{python}", "-I", "-O", "-B", "{package}/verify.py"], "timeout_seconds": 300, "checks": "Repeat all actual mathematical guards under optimization."} + {"argv": ["{python}", "-I", "-B", "{package}/verify.py", "--emit-geometry"], "timeout_seconds": 300, "checks": "Authenticate original selected archive and credited source extractor, test all112 ports and emit derived geometry."}, + {"argv": ["{python}", "-I", "-O", "-B", "{package}/verify.py"], "timeout_seconds": 300, "checks": "Repeat source-bound primary guards under optimization."}, + {"argv": ["{python}", "-I", "-B", "{package}/independent.py"], "timeout_seconds": 120, "checks": "Separate raw-archive parser, sparse forward coefficient propagation, row-matrix routes, left group closure, modular minors and direct routed residuals."}, + {"argv": ["{python}", "-I", "-O", "-B", "{package}/independent.py"], "timeout_seconds": 120, "checks": "Repeat the independent source and algebra audit with explicit checks under optimization."} ] } diff --git a/research/centre-sheaf-fibre/independent.py b/research/centre-sheaf-fibre/independent.py new file mode 100644 index 0000000000..c085d6de5f --- /dev/null +++ b/research/centre-sheaf-fibre/independent.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Separate row-matrix and modular-minor audit, with no primary code imports. + +Clear1nsight, substantial OpenAI assistance. A separately coded check in this +same session, not an independent human review or a native execution proof. +""" +from __future__ import annotations + +import argparse +from collections import Counter, deque +from fractions import Fraction +from hashlib import sha256 +import gzip +import json +from pathlib import Path +import tarfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +ARCHIVE = 'research/community-frontier1094-audit/selected-replay.tar.gz' +ARCHIVE_SHA = 'f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6' +MEMBERS = { + 'candidate/strict/global/base/providers/gauge44/CANONICAL-WORD.json.gz': + '16bc0ebb04b4be6c0ade74badc6a0c0cdba4215eda86e4ff9f13abf8ecebd219', + 'candidate/strict/global/base/work/complex-nine-native/DATA-PHASES.json': + 'c5916ff312678f12aba403847643fbbc29f643acec60bdf836fa56cd3e8251fa', +} + + +def need(ok, reason): + if not ok: + raise ValueError(reason) + + +def digest(value): + return sha256(json.dumps(value, sort_keys=True, separators=(',', ':')).encode()).hexdigest() + + +def sparse_add(destination, source, multiplier): + for key, value in source.items(): + destination[key] = destination.get(key, Fraction(0)) + multiplier*value + if destination[key] == 0: + del destination[key] + + +def push_source_rows(word, backwards=False): + events = word['precondition'] + word['compensation'] + word['A'] + extent = 1+max(max(e[1:3]) if e[0] == 'add' else e[1] for e in events + word['cut']) + state = [{i: Fraction(1)} if i < 112 else {} for i in range(extent)] + if backwards: + for i in range(112): + state[112+i] = {i: Fraction(1)} + for event in events: + if event[0] == 'scale': + target = event[1] + value = Fraction(event[2], event[3]) + need(value != 0, 'invertible scale') + multiplier = 1/value if backwards else value + state[target] = {i: x*multiplier for i,x in state[target].items()} + else: + need(event[0] == 'add', 'canonical elementary event') + target, source = event[1:3] + value = Fraction(event[3], event[4]) + if backwards: + target, source, value = source, target, -value + need(target != source, 'distinct elementary roles') + sparse_add(state[target], state[source], value) + if not backwards: + return [[state[c].get(i, Fraction(0)) for i in range(112)] for c in word['centers']] + rows = [] + for centre in word['centers']: + out = {} + for event in word['cut']: + need(event[0] == 'add', 'canonical cut') + if event[2] == centre: + sparse_add(out, state[event[1]], Fraction(event[3], event[4])) + rows.append([out.get(i, Fraction(0)) for i in range(112)]) + return rows + + +def transpose(rows): + n = len(rows) + return tuple(sum(((rows[i] >> j)&1) << i for i in range(n)) for j in range(n)) + + +def multiply(a,b): + """Binary row-matrix product, using parity dot products.""" + columns = transpose(b) + return tuple(sum(((row & col).bit_count()&1) << j for j,col in enumerate(columns)) for row in a) + + +def own_extract(root): + path = root / ARCHIVE + need(path.is_file() and not path.is_symlink(), 'archive regular file') + need(sha256(path.read_bytes()).hexdigest() == ARCHIVE_SHA, 'archive SHA256') + data = [] + with tarfile.open(path) as archive: + for name,expected in MEMBERS.items(): + matches = [item for item in archive.getmembers() if item.name == name] + need(len(matches) == 1 and matches[0].isfile(), 'unique regular member') + raw = archive.extractfile(matches[0]).read() + need(sha256(raw).hexdigest() == expected, 'member SHA256') + data.append(json.loads(gzip.decompress(raw) if name.endswith('.gz') else raw)) + word,phases = data + rows = push_source_rows(word) + later = push_source_rows(word, True) + need(later == [[x/4 for x in row] for row in rows], 'independent later query') + need(phases['m'] == 73 and len(phases['recipes']) == 112, 'source dimensions') + routes = [] + for index,record in enumerate(phases['recipes']): + q = record['q'] + axes = record['idle_children'][0]['orthogonal_axes'][:8] + need(q == word['ports'][index], 'source port ordering') + basis = [q] + axes + need(len(basis) == 9 and all(0 < v < 512 for v in basis), 'chart dimensions') + need(all(((a&b).bit_count()&1) == int(i==j) + for i,a in enumerate(basis) for j,b in enumerate(basis)), 'orthonormal chart') + upper = tuple((q if (q>>i)&1 else 0) | + sum(((axis>>i)&1) << (9+j) for j,axis in enumerate(axes)) for i in range(9)) + route = upper+tuple(axes) + identity = tuple(1<