From 7e720d66e20e7e36f0cca33dd8f38832f8784d71 Mon Sep 17 00:00:00 2001 From: Sricharan Vagvala Date: Tue, 13 Oct 2026 19:22:30 -0700 Subject: [PATCH 1/2] Research: certify paid quadratic-reader restoration --- .../CERTIFICATE.json | 845 ++++++++++++++++++ .../quadratic-reader-restoration/CLAIM.json | 27 + .../quadratic-reader-restoration/CONTEXT.json | 21 + .../quadratic-reader-restoration/OVERLAP.json | 51 ++ .../quadratic-reader-restoration/README.md | 277 ++++++ .../quadratic-reader-restoration/SOURCES.json | 42 + .../quadratic-reader-restoration/TASK.json | 60 ++ .../VALIDATION.json | 41 + .../quadratic-reader-restoration/VERIFY.json | 20 + .../context/pr1205-README.md | 263 ++++++ .../context/pr1246-README.md | 288 ++++++ .../test_package.py | 66 ++ .../quadratic-reader-restoration/verify.py | 366 ++++++++ 13 files changed, 2367 insertions(+) create mode 100644 research/quadratic-reader-restoration/CERTIFICATE.json create mode 100644 research/quadratic-reader-restoration/CLAIM.json create mode 100644 research/quadratic-reader-restoration/CONTEXT.json create mode 100644 research/quadratic-reader-restoration/OVERLAP.json create mode 100644 research/quadratic-reader-restoration/README.md create mode 100644 research/quadratic-reader-restoration/SOURCES.json create mode 100644 research/quadratic-reader-restoration/TASK.json create mode 100644 research/quadratic-reader-restoration/VALIDATION.json create mode 100644 research/quadratic-reader-restoration/VERIFY.json create mode 100644 research/quadratic-reader-restoration/context/pr1205-README.md create mode 100644 research/quadratic-reader-restoration/context/pr1246-README.md create mode 100644 research/quadratic-reader-restoration/test_package.py create mode 100644 research/quadratic-reader-restoration/verify.py diff --git a/research/quadratic-reader-restoration/CERTIFICATE.json b/research/quadratic-reader-restoration/CERTIFICATE.json new file mode 100644 index 0000000000..e7d9465af5 --- /dev/null +++ b/research/quadratic-reader-restoration/CERTIFICATE.json @@ -0,0 +1,845 @@ +{ + "assignment_seed": 55, + "census": { + "alphabet": "alpha,beta in {-1,+1}", + "batches": 1364, + "lengths": [ + 1, + 2, + 3, + 4, + 5 + ], + "numeric_assignments": 36828, + "repair_rank_0": 132, + "repair_rank_1": 256, + "repair_rank_2": 976 + }, + "controls": { + "basis_only_false_acceptance": { + "basis_probes": 3, + "mixed_defect_at_1_1": 4 + }, + "nonunit_price": { + "multiplications": 3, + "unpaid_false_total": 28 + }, + "rejected_word_mutations": [ + "missing_source_restoration", + "omitted_nonlinear_repair", + "wrong_repair_frame", + "wrong_repair_sign" + ], + "uncharged_repeated_read": { + "correct_reads": 39, + "wrong_reads": 58 + }, + "unsafe_prefix": true + }, + "cost_cases": [ + { + "arity": 2, + "costs": { + "bilinear": { + "add": 7, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 15, + "data_writes": 7, + "descriptor_fields": 29, + "events": 7, + "scalar_operations": 13, + "square_mul": 2 + }, + "eager": { + "add": 6, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 12, + "data_writes": 6, + "descriptor_fields": 24, + "events": 6, + "scalar_operations": 8, + "square_mul": 2 + }, + "square_only": { + "add": 8, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 16, + "data_writes": 8, + "descriptor_fields": 32, + "events": 8, + "scalar_operations": 12, + "square_mul": 4 + } + } + }, + { + "arity": 3, + "costs": { + "bilinear": { + "add": 9, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 19, + "data_writes": 9, + "descriptor_fields": 37, + "events": 9, + "scalar_operations": 16, + "square_mul": 3 + }, + "eager": { + "add": 9, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 18, + "data_writes": 9, + "descriptor_fields": 36, + "events": 9, + "scalar_operations": 12, + "square_mul": 3 + }, + "square_only": { + "add": 11, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 22, + "data_writes": 11, + "descriptor_fields": 44, + "events": 11, + "scalar_operations": 20, + "square_mul": 5 + } + } + }, + { + "arity": 4, + "costs": { + "bilinear": { + "add": 11, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 23, + "data_writes": 11, + "descriptor_fields": 45, + "events": 11, + "scalar_operations": 19, + "square_mul": 4 + }, + "eager": { + "add": 12, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 24, + "data_writes": 12, + "descriptor_fields": 48, + "events": 12, + "scalar_operations": 16, + "square_mul": 4 + }, + "square_only": { + "add": 13, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 26, + "data_writes": 13, + "descriptor_fields": 52, + "events": 13, + "scalar_operations": 23, + "square_mul": 6 + } + } + }, + { + "arity": 5, + "costs": { + "bilinear": { + "add": 13, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 27, + "data_writes": 13, + "descriptor_fields": 53, + "events": 13, + "scalar_operations": 22, + "square_mul": 5 + }, + "eager": { + "add": 15, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 30, + "data_writes": 15, + "descriptor_fields": 60, + "events": 15, + "scalar_operations": 20, + "square_mul": 5 + }, + "square_only": { + "add": 15, + "constant_mul": 3, + "cross_mul": 0, + "data_reads": 30, + "data_writes": 15, + "descriptor_fields": 60, + "events": 15, + "scalar_operations": 25, + "square_mul": 7 + } + } + }, + { + "arity": 6, + "costs": { + "bilinear": { + "add": 15, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 31, + "data_writes": 15, + "descriptor_fields": 61, + "events": 15, + "scalar_operations": 25, + "square_mul": 6 + }, + "eager": { + "add": 18, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 36, + "data_writes": 18, + "descriptor_fields": 72, + "events": 18, + "scalar_operations": 24, + "square_mul": 6 + }, + "square_only": { + "add": 17, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 34, + "data_writes": 17, + "descriptor_fields": 68, + "events": 17, + "scalar_operations": 29, + "square_mul": 8 + } + } + }, + { + "arity": 7, + "costs": { + "bilinear": { + "add": 17, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 35, + "data_writes": 17, + "descriptor_fields": 69, + "events": 17, + "scalar_operations": 28, + "square_mul": 7 + }, + "eager": { + "add": 21, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 42, + "data_writes": 21, + "descriptor_fields": 84, + "events": 21, + "scalar_operations": 28, + "square_mul": 7 + }, + "square_only": { + "add": 19, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 38, + "data_writes": 19, + "descriptor_fields": 76, + "events": 19, + "scalar_operations": 32, + "square_mul": 9 + } + } + }, + { + "arity": 8, + "costs": { + "bilinear": { + "add": 19, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 39, + "data_writes": 19, + "descriptor_fields": 77, + "events": 19, + "scalar_operations": 31, + "square_mul": 8 + }, + "eager": { + "add": 24, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 48, + "data_writes": 24, + "descriptor_fields": 96, + "events": 24, + "scalar_operations": 32, + "square_mul": 8 + }, + "square_only": { + "add": 21, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 42, + "data_writes": 21, + "descriptor_fields": 84, + "events": 21, + "scalar_operations": 35, + "square_mul": 10 + } + } + }, + { + "arity": 9, + "costs": { + "bilinear": { + "add": 21, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 43, + "data_writes": 21, + "descriptor_fields": 85, + "events": 21, + "scalar_operations": 34, + "square_mul": 9 + }, + "eager": { + "add": 27, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 54, + "data_writes": 27, + "descriptor_fields": 108, + "events": 27, + "scalar_operations": 36, + "square_mul": 9 + }, + "square_only": { + "add": 23, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 46, + "data_writes": 23, + "descriptor_fields": 92, + "events": 23, + "scalar_operations": 38, + "square_mul": 11 + } + } + }, + { + "arity": 10, + "costs": { + "bilinear": { + "add": 23, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 47, + "data_writes": 23, + "descriptor_fields": 93, + "events": 23, + "scalar_operations": 37, + "square_mul": 10 + }, + "eager": { + "add": 30, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 60, + "data_writes": 30, + "descriptor_fields": 120, + "events": 30, + "scalar_operations": 40, + "square_mul": 10 + }, + "square_only": { + "add": 25, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 50, + "data_writes": 25, + "descriptor_fields": 100, + "events": 25, + "scalar_operations": 41, + "square_mul": 12 + } + } + }, + { + "arity": 11, + "costs": { + "bilinear": { + "add": 25, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 51, + "data_writes": 25, + "descriptor_fields": 101, + "events": 25, + "scalar_operations": 40, + "square_mul": 11 + }, + "eager": { + "add": 33, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 66, + "data_writes": 33, + "descriptor_fields": 132, + "events": 33, + "scalar_operations": 44, + "square_mul": 11 + }, + "square_only": { + "add": 27, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 54, + "data_writes": 27, + "descriptor_fields": 108, + "events": 27, + "scalar_operations": 44, + "square_mul": 13 + } + } + }, + { + "arity": 12, + "costs": { + "bilinear": { + "add": 27, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 55, + "data_writes": 27, + "descriptor_fields": 109, + "events": 27, + "scalar_operations": 43, + "square_mul": 12 + }, + "eager": { + "add": 36, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 72, + "data_writes": 36, + "descriptor_fields": 144, + "events": 36, + "scalar_operations": 48, + "square_mul": 12 + }, + "square_only": { + "add": 29, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 58, + "data_writes": 29, + "descriptor_fields": 116, + "events": 29, + "scalar_operations": 47, + "square_mul": 14 + } + } + }, + { + "arity": 13, + "costs": { + "bilinear": { + "add": 29, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 59, + "data_writes": 29, + "descriptor_fields": 117, + "events": 29, + "scalar_operations": 46, + "square_mul": 13 + }, + "eager": { + "add": 39, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 78, + "data_writes": 39, + "descriptor_fields": 156, + "events": 39, + "scalar_operations": 52, + "square_mul": 13 + }, + "square_only": { + "add": 31, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 62, + "data_writes": 31, + "descriptor_fields": 124, + "events": 31, + "scalar_operations": 50, + "square_mul": 15 + } + } + }, + { + "arity": 14, + "costs": { + "bilinear": { + "add": 31, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 63, + "data_writes": 31, + "descriptor_fields": 125, + "events": 31, + "scalar_operations": 49, + "square_mul": 14 + }, + "eager": { + "add": 42, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 84, + "data_writes": 42, + "descriptor_fields": 168, + "events": 42, + "scalar_operations": 56, + "square_mul": 14 + }, + "square_only": { + "add": 33, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 66, + "data_writes": 33, + "descriptor_fields": 132, + "events": 33, + "scalar_operations": 53, + "square_mul": 16 + } + } + }, + { + "arity": 15, + "costs": { + "bilinear": { + "add": 33, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 67, + "data_writes": 33, + "descriptor_fields": 133, + "events": 33, + "scalar_operations": 52, + "square_mul": 15 + }, + "eager": { + "add": 45, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 90, + "data_writes": 45, + "descriptor_fields": 180, + "events": 45, + "scalar_operations": 60, + "square_mul": 15 + }, + "square_only": { + "add": 35, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 70, + "data_writes": 35, + "descriptor_fields": 140, + "events": 35, + "scalar_operations": 56, + "square_mul": 17 + } + } + }, + { + "arity": 16, + "costs": { + "bilinear": { + "add": 35, + "constant_mul": 3, + "cross_mul": 1, + "data_reads": 71, + "data_writes": 35, + "descriptor_fields": 141, + "events": 35, + "scalar_operations": 55, + "square_mul": 16 + }, + "eager": { + "add": 48, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 96, + "data_writes": 48, + "descriptor_fields": 192, + "events": 48, + "scalar_operations": 64, + "square_mul": 16 + }, + "square_only": { + "add": 37, + "constant_mul": 4, + "cross_mul": 0, + "data_reads": 74, + "data_writes": 37, + "descriptor_fields": 148, + "events": 37, + "scalar_operations": 59, + "square_mul": 18 + } + } + } + ], + "pilot": { + "arity": 8, + "bilinear_word": [ + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "square_a", + "1" + ], + [ + "shift", + "1" + ], + [ + "shift", + "-11/2" + ], + [ + "product", + "-56" + ], + [ + "shift", + "-5/2" + ] + ], + "largest_stored_coefficient_denominator": 2, + "moments": [ + "8", + "28", + "140" + ], + "peak_polynomial_coefficient_l1": "205" + }, + "rational_fixture": true, + "recursive_cases": [ + { + "costs": { + "bilinear": { + "add": 0, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 0, + "data_writes": 0, + "descriptor_fields": 0, + "events": 0, + "scalar_operations": 0, + "square_mul": 0 + }, + "eager": { + "add": 0, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 0, + "data_writes": 0, + "descriptor_fields": 0, + "events": 0, + "scalar_operations": 0, + "square_mul": 0 + } + }, + "depth": 0, + "dirty_data_scalars": 1, + "internal_nodes": 0, + "n": 1 + }, + { + "costs": { + "bilinear": { + "add": 38, + "constant_mul": 6, + "cross_mul": 2, + "data_reads": 78, + "data_writes": 38, + "descriptor_fields": 154, + "events": 38, + "scalar_operations": 62, + "square_mul": 16 + }, + "eager": { + "add": 48, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 96, + "data_writes": 48, + "descriptor_fields": 192, + "events": 48, + "scalar_operations": 64, + "square_mul": 16 + } + }, + "depth": 1, + "dirty_data_scalars": 6, + "internal_nodes": 1, + "n": 2 + }, + { + "costs": { + "bilinear": { + "add": 152, + "constant_mul": 24, + "cross_mul": 8, + "data_reads": 312, + "data_writes": 152, + "descriptor_fields": 616, + "events": 152, + "scalar_operations": 248, + "square_mul": 64 + }, + "eager": { + "add": 192, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 384, + "data_writes": 192, + "descriptor_fields": 768, + "events": 192, + "scalar_operations": 256, + "square_mul": 64 + } + }, + "depth": 2, + "dirty_data_scalars": 20, + "internal_nodes": 3, + "n": 4 + }, + { + "costs": { + "bilinear": { + "add": 456, + "constant_mul": 72, + "cross_mul": 24, + "data_reads": 936, + "data_writes": 456, + "descriptor_fields": 1848, + "events": 456, + "scalar_operations": 744, + "square_mul": 192 + }, + "eager": { + "add": 576, + "constant_mul": 0, + "cross_mul": 0, + "data_reads": 1152, + "data_writes": 576, + "descriptor_fields": 2304, + "events": 576, + "scalar_operations": 768, + "square_mul": 192 + } + }, + "depth": 3, + "dirty_data_scalars": 56, + "internal_nodes": 7, + "n": 8 + } + ], + "schema_version": 1, + "sources": { + "base_commit": "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", + "files": [ + { + "git_blob": "7ed4d89d17c5cdeba0e5e5eb160919e0e9c5a076", + "path": "context/pr1205-README.md", + "sha256": "fc672e69f4b3363fa7736efa4b4103c755fcb72f6f5d45e5d268c10e133a914d" + }, + { + "git_blob": "e9263fffce7aa51fa0a86821dfbf17f817d50348", + "path": "context/pr1246-README.md", + "sha256": "31a9770a4dfa057a84def481132591b5400a58f1f1ccf802747c3f0db2a54b60" + } + ], + "license": "Apache-2.0", + "predecessor_heads": { + "PR1205": "e2008d7ffcad464da7ec21c69e8d8a8c91de4930", + "PR1246": "5ed1ce17a9df4c853a93f9758ba903d2620c3443" + }, + "usage": "Retained source notes only; no predecessor verifier is imported or replayed." + }, + "status": "scoped nonlinear boundary; no new kappa" +} diff --git a/research/quadratic-reader-restoration/CLAIM.json b/research/quadratic-reader-restoration/CLAIM.json new file mode 100644 index 0000000000..c8238696ea --- /dev/null +++ b/research/quadratic-reader-restoration/CLAIM.json @@ -0,0 +1,27 @@ +{ + "track": "recursive-interfaces", + "assignment_seed": 55, + "seed_source": "python3 secrets.randbelow(100), OS randomness, drawn once at session entry", + "base_commit": "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", + "object": "Repeated quadratic dirty readers y += beta_i*a^2 with a += alpha_i*b, terminal output observation and complete source restoration", + "method": "Exact polynomial identity, independently interpreted rational events, complete stream/child invoices and restricted square-repair rank obstruction", + "pilot": "r = 2 + (55 mod 7) = 8; all-positive shears and readers", + "domain": "All signed reader/shear batches of lengths 1 through 5; arities 2 through 16 for deterministic cost comparison; no general circuit search", + "changed_hypothesis": "Extend the linear-reader model of PR1205/1246 to a specified nonlinear square reader; pay every nonlinear correction and source frame change", + "candidates": [ + {"task": "Linear endpoint defect repair", "decision": "Rejected: already covered by PR1246"}, + {"task": "Persistent order-four dirty echoes", "decision": "Rejected: overlaps PR1391, PR1410 and PR1499"}, + {"task": "Quadratic reader with paid bilinear repair", "decision": "Chosen: distinct nonlinear observer, square-call rank floor and full tariff"} + ], + "predecessors": { + "PR1205": "e2008d7ffcad464da7ec21c69e8d8a8c91de4930", + "PR1246": "5ed1ce17a9df4c853a93f9758ba903d2620c3443" + }, + "claim_location": "local; GitHub GraphQL pinnedIssues was empty at 2026-10-14 01:54 UTC", + "overlap": "Fresh full PR/Discussion metadata checked before recording; literal quadratic/nonlinear-reader terms had no matches. This is bounded evidence, not a novelty guarantee.", + "expected_deliverable": "One source-pinned recursive-interface research package with exact certificate, cost threshold, rejection controls and bounded replay", + "expected_finish_utc": "2026-10-14T02:37:50Z", + "verification_starts_by_utc": "2026-10-14T02:26:35Z", + "stopping_rule": "One completed bounded package; stop supplier adoption if even the complete favorable tariff does not help; do not infer a new kappa", + "attribution": "Prepared by @theon199 with substantial OpenAI Codex assistance; Apache-2.0" +} diff --git a/research/quadratic-reader-restoration/CONTEXT.json b/research/quadratic-reader-restoration/CONTEXT.json new file mode 100644 index 0000000000..9661a7a01e --- /dev/null +++ b/research/quadratic-reader-restoration/CONTEXT.json @@ -0,0 +1,21 @@ +{ + "base_commit": "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", + "predecessor_heads": { + "PR1205": "e2008d7ffcad464da7ec21c69e8d8a8c91de4930", + "PR1246": "5ed1ce17a9df4c853a93f9758ba903d2620c3443" + }, + "files": [ + { + "path": "context/pr1205-README.md", + "sha256": "fc672e69f4b3363fa7736efa4b4103c755fcb72f6f5d45e5d268c10e133a914d", + "git_blob": "7ed4d89d17c5cdeba0e5e5eb160919e0e9c5a076" + }, + { + "path": "context/pr1246-README.md", + "sha256": "31a9770a4dfa057a84def481132591b5400a58f1f1ccf802747c3f0db2a54b60", + "git_blob": "e9263fffce7aa51fa0a86821dfbf17f817d50348" + } + ], + "license": "Apache-2.0", + "usage": "Retained source notes only; no predecessor verifier is imported or replayed." +} diff --git a/research/quadratic-reader-restoration/OVERLAP.json b/research/quadratic-reader-restoration/OVERLAP.json new file mode 100644 index 0000000000..8e4b46d576 --- /dev/null +++ b/research/quadratic-reader-restoration/OVERLAP.json @@ -0,0 +1,51 @@ +{ + "status": "POSSIBLE_OVERLAP_NOT_A_NOVELTY_CERTIFICATE", + "searched_at": "2026-10-14T02:22:17.583221+00:00", + "terms": [ + "quadratic reader", + "nonlinear reader", + "square reader", + "quadratic observer" + ], + "coverage": { + "open_prs": { + "fetched_at": "2026-10-14T02:21:43.501730+00:00", + "complete_pagination": true, + "records": 774 + }, + "discussions": { + "fetched_at": "2026-10-14T02:22:17.512137+00:00", + "complete_pagination": true, + "records": 199 + } + }, + "local_records": 329, + "warnings": [], + "limits": "Remote PR scope is open PRs including drafts. Closed work is searched through local READMEs, TASK metadata and ledger only. No code diffs or arbitrary package files are searched. Recheck relevant heads before submission.", + "matches_total": 2, + "matches": [ + { + "kind": "local-task", + "title": "research/quadratic-reader-restoration/TASK.json", + "path": "research/quadratic-reader-restoration/TASK.json", + "sha256": "73f0394b163b8b5be1c17d4ffe1aabbb3f71be31c4192271cf639149a9254d23", + "matched_terms": [ + "nonlinear reader", + "square reader" + ], + "score": 2, + "excerpt": "ope_change_reason\": \"Existing PR1205 and PR1246 cover linear observations and repairs; this tests a square reader with a mixed quadratic defect and separately paid square/product backends.\",\n \"bottleneck_link\": \"Side result: specifies when eliminated source restoration survives its nonlinear child and coefficient bill; no supported supplier with this indivisible reader is established.\",\n \"budget_minutes\": 45,\n \"stop_rule\": \"Complete signed batches of lengths 1..5, fixed arities 2..16 and bina" + }, + { + "kind": "local-readme", + "title": "research/quadratic-reader-restoration/README.md", + "path": "research/quadratic-reader-restoration/README.md", + "sha256": "eaf5278c40eeab8235014926fda17f3fe163c808ab642704802ee26dddc8ce68", + "matched_terms": [ + "nonlinear reader" + ], + "score": 1, + "excerpt": "nd is supplied by this package.\n\n## Open next questions\n\nDoes a supported supplier have indivisible nonlinear readers whose full repair\nsatisfies `P+3C < (r-2)L`? This matters because the extra product child can erase\nthe apparent restoration saving. First pin an actual child return map and price\nits frames, private scratch, coefficient preparation, precision, transport and\nhosting in the displayed tariff. The blocker is that no such admitted child has\nbeen identified. If these toy reader calls " + } + ] +} diff --git a/research/quadratic-reader-restoration/README.md b/research/quadratic-reader-restoration/README.md new file mode 100644 index 0000000000..71c6d22f17 --- /dev/null +++ b/research/quadratic-reader-restoration/README.md @@ -0,0 +1,277 @@ +# Paid nonlinear repair of quadratic dirty readers + +**Recursive-interface research construction and scoped repair bound; no new κ.** +Sricharan Vagvala (@theon199), with substantial OpenAI Codex assistance in +mathematics, implementation, verification and writing. New material is Apache-2.0. + +An eight-call quadratic-reader batch can replace eight source restorations by +two paid source frame changes and one paid product correction. The frame changes +also restore the source. The literal exact scalar bill is **32 → 31**; a backend +with expensive product children may lose instead. This is a boundary option for +fixed calls, not an admitted supplier or an optimized squaring algorithm. + +## Exact interface and result + +Work over the rationals, with arbitrary incoming values of three distinct +length-`N` streams `y,a,b`. Every operation is componentwise. Child `i` is fixed: + +``` +y += beta_i * a^2 # observes a before this child's source drift +a += alpha_i * b +``` + +Eager execution immediately restores `a -= alpha_i*b` after each child. Its +terminal map is `(y + sum(beta_i)*a_entry^2, a_entry, b_entry)`. Deferred +execution retains all original children in order and repairs only at the exit. +There is no feedback from `y`, adaptive choice of coefficients, external source +write, or intermediate observation of `y` or `a`. `b` is read-only. These +sources are intended arguments of the observer: this result does not make the +output independent of arbitrary borrowed-source dirt by itself. Private scratch +of any substituted child backend must be restored by that backend. + +Let `p_i = sum_(j=2` family has the exact tariff + +``` +E_r(N) = 2r*L(N) + r*Q(N) +F_r(N) = (r+2)*L(N) + r*Q(N) + P(N) + 3*C(N). +``` + +The correction has two nonunit source coefficients and one nonunit product +coefficient at every integer `r>=2`. All `r` original square children and the +extra product child remain charged. Deferral helps exactly when +`P(N)+3*C(N) < (r-2)*L(N)` in this implementation. In the scalar backend, +`L=C=N` and `Q=P=2N`, so `E_r=4rN`, `F_r=(3r+7)N`. It first strictly improves +at `r=8`, ties at seven and loses below seven. This is a cost boundary, not an +impossibility result for different coefficient circuits or backends. + +Each shift/square event reads its two named data values once and writes its +target once. A product reads three values once and writes once. Nonunit scaling +uses an already read scalar; it is still a paid arithmetic operation. Logical +event descriptors have four fields (kind, target, source, coefficient), or five +for a product. At the pilot there are 96 eager versus 77 repaired descriptor +fields per stream position. An addressed-machine bill adds separate prices for +these reads, writes, descriptor reads and dispatches. A separate scalar +interpreter observes every addressed read and write on all 15 priced arities; +an extra-read control preserves the mathematical endpoint but fails the invoice. +Inverse execution has +identical counts. Rational constants and ordinary expression temporaries are +not a proof of a reversible multiplication-child or fixed-tape lowering; their +complete backend scratch, precision and transport costs must enter `P,Q,C,L` +before invoking those interfaces. + +## Implemented recursive composition and its full recurrence + +`tree_events` supplies a precise recursive program, rather than extrapolating a +node count. A depth-`d` node of length `N=2^d` first calls two depth-`d-1` +children on the two contiguous output halves. Then it executes its complete +eight-reader batch on its own two source streams. Each active level has distinct +arbitrary dirty `a,b` streams, partitioned between siblings; output `y` is +shared. Children do not touch their parent's sources. Every local batch is +restored before its exit, so its proven endpoint composes by induction. +The identity depth-zero leaf has no events, a concrete convention of this +experiment rather than an unimplemented multiplication backend. + +For the literal scalar backend, the full recurrences are + +``` +E_0(N)=F_0(N)=0 +E_d(N)=2*E_(d-1)(N/2)+32N = 32Nd +F_d(N)=2*F_(d-1)(N/2)+31N = 31Nd. +``` + +Replacing the node tariff by its backend expression gives +`T_d(N)=2*T_(d-1)(N/2)+E_8(N)` or `+F_8(N)`, with every square/product +backend invocation included. The two recursive children are additional work; +the shell's square/product calls are not silently substituted for them. +This construction is an explicit multi-level boundary experiment, not a +contracting supplier recurrence or an exponent improvement. + +There are `J=2^d-1` internal nodes and `2J` recursive edges. Data storage is +exactly `(2d+1)N` arbitrary initial scalars; no source is initialized to zero. +For `d=3,N=8`, the emitted programs pay **768 → 744 scalar operations** and +use the same 56 dirty data scalars. Event/materialized descriptor storage, +arithmetic, reads, writes and dispatch are in the certificate. Preparing this +literal word takes linear work in its emitted size plus the tree traversal; +an end-to-end bill must charge that preparation, `2J` call dispatches, memory +reservation and address arithmetic separately. The interpreter uses ordinary +indexed arrays. No physical tape-head traversal, controller encoding, hosting +admission or actual bit-complexity speedup is claimed. + +For integer source inputs of magnitude at most `M`, a forward pilot source is +bounded by `9M`, and its repair frame by `(7/2)M`. The output can temporarily +contain quadratic terms of size `O(r^3 M^2)`; repaired endpoint size alone is +not a valid precision budget. The certificate records exact coefficient +one-norms and stored-coefficient denominators at every abstract event prefix. +These describe symbolic stream states only, not lower-level product temporaries +or a rounded-error theorem. Exact rational execution here requires no rounding. + +## Reproduce, completed coverage and controls + +From the repository root, Python 3.12, standard library only: + +```sh +python3.12 scripts/research_package.py --package research/quadratic-reader-restoration +``` + +Expected final marker: +`PASS_REGISTERED_RESEARCH_PACKAGE research/quadratic-reader-restoration outcome=completed`. +The registered command runs a relocated optimized replay and five on-disk +corruption rejections. Direct standalone replay also works without Git: +`python3 -I -O -B research/quadratic-reader-restoration/verify.py`. +`--emit` prints a newly recomputed certificate without writing files; ordinary +verification compares every field of [CERTIFICATE.json](CERTIFICATE.json). + +The bounded domain is all **1,364** signed batches of lengths 1 through 5, +`alpha_i,beta_i in {-1,+1}`, and all 27 dirty triples in `{-1,0,1}^3` per batch. +Both product and square-only schedules, eager execution and their literal +inverses are checked. A separately implemented sparse rational-polynomial oracle +checks every coefficient, including mixed terms, without importing a predecessor +checker or the defect formula. Additional evidence covers all-positive arities +2 through 16, genuinely rational coefficients, and four literal binary recursion +depths 0 through 3. Stopping rule: finish these fixed domains; no search outside +them or unrestricted circuit optimum is asserted. + +Controls expose missing/wrong-sign repair, missing source restoration, a wrong +correction frame, unsafe intermediate observation and unpaid nonunit coefficients. +A pure mixed defect `4ab` agrees with the eager map on all three coordinate basis +inputs but fails at `(y,a,b)=(0,1,1)`. Thus the basis-only test valid for linear +interfaces is insufficient here. The package test rejects changed source bytes, +changed predecessor head, an unpaid coefficient certificate, an omitted product +and an incomplete census receipt. Relocation checks independence from the repo's +working directory and Git metadata; this is independent implementation evidence, +not independent human or formal verification of the full multiplication theorem. + +## Provenance and relationship to other work + +Base: `ef5f39403610d231a0c27e8a6b4f08c10209bcd6`. The selected conditional +result at that base is PR1094, `κ=836330098538459/500000000000000000`. +Its source manifest, assembly, review and actual T16 construction were followed; +the source-binding baseline passes. [SOURCES.json](SOURCES.json) pins that context +and the originating task card as historical Git provenance. + +Adam Gall's PR1205 (`e2008d7ffcad464da7ec21c69e8d8a8c91de4930`) provides the +exact linear observation criterion. Hanson Sun's PR1246 +(`5ed1ce17a9df4c853a93f9758ba903d2620c3443`) pays nonzero linear reader repair. +Their complete notes and original attribution are retained byte-for-byte under +`context/`; [CONTEXT.json](CONTEXT.json) records source heads, published Git blobs +and SHA256 hashes. Those are recorded fetch pins, not a GitHub-history proof. +Aaron Wang/Navinor's PR1155 and the other predecessor credit in those notes remain +with their original authors. No priority is claimed for linear deferral or repair. +This adds the explicitly quadratic defect, sharp appended-square-query bound, +fused restoring product frame and separate nonlinear child tariff. + +[CLAIM.json](CLAIM.json) records the seed, three candidates and local claim. +No pinned coordination issue was present. Fresh PR/Discussion searches found +no matching quadratic/nonlinear-reader term before the claim; title/body/comment +searches do not cover every code diff and cannot establish novelty. Final overlap +metadata and validation are recorded separately. No selected construction, +review-ledger disposition, frozen package or `upstream/` input is changed. + +The selected all-size/compiler, mutable-source realization, whole-call hosting, +precision/tape, analytic transfer and bit H1–H5 assumptions remain. No selected +cold replay, native supplier replay, backend scratch theorem, hosted Linux result, +formal proof or new multiplication bound is supplied by this package. + +## Open next questions + +Does a supported supplier have indivisible nonlinear readers whose full repair +satisfies `P+3C < (r-2)L`? This matters because the extra product child can erase +the apparent restoration saving. First pin an actual child return map and price +its frames, private scratch, coefficient preparation, precision, transport and +hosting in the displayed tariff. The blocker is that no such admitted child has +been identified. If these toy reader calls may be opened, their endpoint is just +`y += r*a^2`, which can be evaluated with one square and one scaling; both +batch implementations are then needlessly expensive. The fixed-call assumption +is therefore essential to the limited saving reported here. Structured next +questions and the refined scope are in [TASK.json](TASK.json). diff --git a/research/quadratic-reader-restoration/SOURCES.json b/research/quadratic-reader-restoration/SOURCES.json new file mode 100644 index 0000000000..d2cab7fc7d --- /dev/null +++ b/research/quadratic-reader-restoration/SOURCES.json @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "base_commit": "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", + "files": [ + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "c05fafaa25ba95b2d5af86b1800427198e3d20eb", + "sha256": "89b5928bc92c81e2647b6d702a7ad85a6795b8f44e2eb267b2ff3145d8f2b2ce" + }, + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/community-batch1099-review.md", + "usage": "provenance", + "git_blob": "6cb6ec061a071a06a2d18cd4dc3e9a2b05d28099", + "sha256": "7e76d2c38e5fce30587835b7251df1430488ae4dd372611ef69a3f03f476b6cb" + }, + { + "path": "research/community-frontier1094-audit/SELECTED-SOURCE.json", + "usage": "provenance", + "git_blob": "6a75493790b4eff9c4a98051ef8b01d6aad0d5a8", + "sha256": "79b3de5db3dbcb9829789ba58e9e45758926031e2a7d80667a08429d369be53b" + }, + { + "path": "research/community-frontier1094-audit/ASSEMBLY.json", + "usage": "provenance", + "git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0", + "sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045" + }, + { + "path": "research/complex-t16-rare-pattern-exchanges/README.md", + "usage": "provenance", + "git_blob": "f205b7132243aedcb2aa85110a44f0c8cd1e4fe1", + "sha256": "da542711a6a3eb01ce1ebdf8f28a748e6195512687f61d003b95ac5ff281a7b2" + } + ] +} diff --git a/research/quadratic-reader-restoration/TASK.json b/research/quadratic-reader-restoration/TASK.json new file mode 100644 index 0000000000..93a55b9b38 --- /dev/null +++ b/research/quadratic-reader-restoration/TASK.json @@ -0,0 +1,60 @@ +{ + "schema_version": 1, + "task_id": "persistent-boundary", + "priority_revision": 2, + "base_commit": "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", + "original_card": { + "id": "persistent-boundary", + "question": "Can a specified pair of consecutive calls eliminate a restoration that the next call reconstructs?", + "starting_points": [ + "research/heterogeneous-owner-assembly/README.md", + "certificates/selected-result.json" + ], + "methods": [ + "Write typed entry/exit contracts and a contracting multitype recurrence.", + "Derive a lower bound for the compulsory transitions of one proposed typed interface." + ], + "acceptance_gate": "Show actual eliminated work and legal composition; changing a scalar recurrence into a matrix is insufficient.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Find a concrete consecutive-call boundary in the selected review and list its entry/exit obligations.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Specify two call types and one operation actually removed by composition; derive the normalized recurrence.", + "bottleneck_link": "Eliminating compulsory boundary work can lower recursive cost beyond packing gains.", + "allowed_variations": [ + "A two-type pilot or one explicit deferred restoration." + ], + "scope_change_triggers": [ + "Rewriting the old scalar recurrence as a matrix without eliminating work." + ], + "overlap_terms": [ + "persistent boundary", + "deferred restoration", + "multitype" + ] + }, + "scope_status": "refined", + "actual_scope": "Coalesce fixed quadratic-reader restoration, fusing the paid nonlinear correction frame with the source exit restoration.", + "scope_change_reason": "Existing PR1205 and PR1246 cover linear observations and repairs; this tests a square reader with a mixed quadratic defect and separately paid square/product backends.", + "bottleneck_link": "Side result: specifies when eliminated source restoration survives its nonlinear child and coefficient bill; no supported supplier with this indivisible reader is established.", + "budget_minutes": 45, + "stop_rule": "Complete signed batches of lengths 1..5, fixed arities 2..16 and binary recursion depths 0..3, then verify and hand off; no arbitrary circuit optimization.", + "outcome": "completed", + "evidence": "CERTIFICATE.json recomputed by verify.py; written rank proof and exact literal scalar/polynomial replay.", + "author": "Sricharan Vagvala (@theon199)", + "ai_assistance": "Substantial OpenAI Codex assistance in mathematics, implementation, testing and prose. No independent human or proof-assistant review.", + "open_questions": [ + { + "question": "Does an admitted supplier expose fixed nonlinear readers whose full product repair satisfies P+3C < (r-2)A?", + "why_it_matters": "The scalar saving cannot improve a recursive profile if the additional product backend is more expensive than the eliminated restoration.", + "first_step": "Identify and pin one concrete child return map, then substitute its complete frame/precision/hosting/child costs in the displayed tariff before implementation.", + "blocked_by": "No current supplier with this indivisible quadratic-reader contract is identified." + } + ] +} diff --git a/research/quadratic-reader-restoration/VALIDATION.json b/research/quadratic-reader-restoration/VALIDATION.json new file mode 100644 index 0000000000..59918fbe64 --- /dev/null +++ b/research/quadratic-reader-restoration/VALIDATION.json @@ -0,0 +1,41 @@ +{ + "status": "PASS scoped package; no new kappa", + "verified_at_utc": "2026-10-14T02:19:50.633081+00:00", + "base_commit": "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", + "refreshed_origin_main": "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", + "platform": "macOS-27.0.1-arm64-arm-64bit-Mach-O", + "replays": [ + { + "command": "python3.12 scripts/research_package.py --package research/quadratic-reader-restoration", + "python": "3.12.13", + "result": "PASS_REGISTERED_RESEARCH_PACKAGE; optimized relocation, 1364 signed batches, 8 mathematical/resource controls, 5 on-disk corruption rejections" + }, + { + "command": "python3 -I -B research/quadratic-reader-restoration/verify.py", + "python": "3.14.5", + "result": "PASS_QUADRATIC_READER batches=1364 pilot=32->31 square_repair_rank=2 controls=8 kappa=unchanged" + }, + { + "command": "python3 -B scripts/research_baseline.py", + "result": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY; complex supplier binding; context only, not full cold replay" + } + ], + "files": { + "verify.py": "501e3f839a2381aa03a2a99e99e759444171fe79b302ec08900c5537a9910213", + "test_package.py": "a4e5a8a7ec51419b894858baa1adb498d19680a3033e84b32fdc7643e9515cb0", + "CERTIFICATE.json": "82b48cb639023994894b47f643060ed1c7a766ebdc0b260416ff6ab60b550641", + "CONTEXT.json": "5596a2494a5f090d0e2f5f41f37e3528efd7ba36900f054e732130702ad0c3e9" + }, + "scope": "Exact rational stream primitives and full endpoints; child/precision/tape/hosting realization and the multiplication theorem are not verified. The written determinant argument establishes the restricted square-query bound; the finite replay does not prove the full theorem.", + "unrun": [ + "selected frontier1094 cold replay", + "native/physical supplier admission", + "complete nonlinear backend scratch/precision proof", + "hosted Linux CI", + "proof-assistant verification" + ], + "predecessor_heads_rechecked": { + "PR1205": "e2008d7ffcad464da7ec21c69e8d8a8c91de4930", + "PR1246": "5ed1ce17a9df4c853a93f9758ba903d2620c3443" + } +} diff --git a/research/quadratic-reader-restoration/VERIFY.json b/research/quadratic-reader-restoration/VERIFY.json new file mode 100644 index 0000000000..6609717313 --- /dev/null +++ b/research/quadratic-reader-restoration/VERIFY.json @@ -0,0 +1,20 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/test_package.py" + ], + "timeout_seconds": 180, + "checks": "Full rational polynomial identity, signed census, literal scalar/inverse replay, recursive invoices, meaningful nonlinear controls, standalone relocation and on-disk corruption rejections." + } + ] +} diff --git a/research/quadratic-reader-restoration/context/pr1205-README.md b/research/quadratic-reader-restoration/context/pr1205-README.md new file mode 100644 index 0000000000..7ed4d89d17 --- /dev/null +++ b/research/quadratic-reader-restoration/context/pr1205-README.md @@ -0,0 +1,263 @@ +# Observer-safe deferred dirty restoration + +**Recursive-interface research construction and correction; no new kappa.** +Adam Gall (@adamgall), with substantial OpenAI Codex assistance in the research, +proof, implementation, verification and writing. New material is Apache-2.0. + +## Result and provenance + +[PR1155](https://github.com/CrocSwap/integer-mult-bounds/pull/1155), Aaron Wang +(@navinor), proposes replacing per-child workspace restoration by one final +composed restoration. Its frozen README says this preserves final observables +“if and only if no child reads the workspace's intermediate value” and that +“one reader child breaks it”. Its exhibited bad reader is a valid counterexample +to *unrestricted* deferral, but cannot establish that necessity statement. + +This package gives the exact replacement criterion, a strictly larger constructive +class with nonzero readers, and the distinction between terminal and prefix +observations. It does not dispute PR1155's read-free examples or claim priority +for restoration coalescing. Its finite census is new evidence, not a finite +replay presented as an all-size proof. The proof below supplies the all-size +statement in the specified linear model. + +Base: `1b59b624d21924f8e3537cdc1ac52d3be6eda2fe`. PR1155 source head: +`9821c6e9388f3fc097e94b72be9fa7b41a849527`. The complete source README is +preserved byte-for-byte under `context/`, with attribution intact; `SOURCES.json` +pins it, the license and the base selected record. No predecessor verifier is +imported. The actual selected base result is PR1094, conditional +`kappa = 836330098538459/500000000000000000`, not an open PR headline. Its +[review](../../docs/research/community-batch1099-review.md) and actual +`research/complex-t16-rare-pattern-exchanges/README.md` were followed from the +selected certificate. This package does not modify that construction. + +Seed **52**, derived from fresh OS uint32 `3718171852` modulo 100. The seed picks +the recursive-interface track and the concrete odd arity `2 + (52 mod 7) = 5`. +`CLAIM.json` records the three candidates and overlap decisions. No pinned sprint +issue exists; the only open issues at claiming were #913 and #650, neither a +coordination issue. Scope was claimed locally before implementation and reserved +with the parent of the five independent rounds. Prior PRs #1114 and #1098 are +not reused as these rounds' deliverables. + +## Exact criterion + +Work over any field. Let data be `D in F^d`, borrowed workspace `W in F^w`, and +fixed child `i` perform + +``` +D <- D + B_i W (reads the pre-child workspace) +W <- G_i W (G_i invertible) +``` + +Read-only external-source increments may be added to both versions and cancel. +The children do not choose later matrices from intermediate data. Eager execution +applies `G_i^{-1}` after every child. Deferred execution applies only +`P_r^{-1}` at the end, where `P_0=I` and `P_i=G_i ... G_1`. + +**Terminal theorem.** The two programs agree on final `(D,W)` for every arbitrary +dirty input exactly when + +``` +Delta_r = sum_{i=1}^r B_i (P_{i-1} - I) = 0. +``` + +**Proof.** Before child `i`, eager workspace is `W_0`, and deferred workspace is +`P_{i-1} W_0`. Summing the respective data increments gives difference +`Delta_r W_0`. Both restore workspace to `W_0`. Equality on every `W_0` is +equivalent to the displayed matrix vanishing (test the basis columns). This is +an all-size algebraic proof, not an inference from the census. + +**Prefix theorem.** If data may be observed after every child, agreement requires +and is equivalent to `Delta_j=0` for every `j`. Subtracting consecutive equations +makes this equivalent to `B_i(P_{i-1}-I)=0` for each `i`. It does *not* require +`B_i=0`. These observations exclude the intentionally drifting workspace itself. +If that workspace must be observed in its entry coordinates, it must be restored +at that observation boundary. If a later control depends on data, use the prefix +criterion; terminal cancellation alone is not an admissible adaptive rewrite. + +### Two strict counterexamples to read-free necessity + +Let `G_i = [[1,1],[0,1]]` for three children and write workspace `(a,b)`. + +1. `B_i=(0,1)` for every child. Each child reads nonzero dirty data `b`, yet + drift changes only `a`. Every data prefix agrees; both final programs return + `(D+3b,a,b)`. Final restoration is `a <- a-3b`. +2. `B_1=(0,0), B_2=(2,0), B_3=(-1,0)`. Child 2 genuinely reads the changed + value `a+b`; child 3 reads `a+2b`. Deferred data increment is + `2(a+b)-(a+2b)=a`, equal to eager `2a-a=a`. The intermediate data difference + after child 2 is `2b`, so this batch is terminal-safe but not prefix-safe. + +The second example directly addresses observable reads of the changing component, +not just a reader that happens to avoid it. + +## Constructive family and fully paid local invoice + +For a square-zero drift `U=uv^T` with `v^T u=0`, take `G_i=I+alpha_i U`. +Then `P_i=I+(sum_{k<=i}alpha_k)U`, and its inverse subtracts that coefficient. +Every `B_i` with `B_i u=0` is prefix-safe, even if nonzero. This supplies a family +at arbitrary dimension and arity. Its cheap implementation below uses coordinate +`u=e_a,v=e_b`, rather than pretending a dense outer product costs one primitive. + +There are three length-`N` streams `D,a,b`. The concrete child shell is +`D += b; a += alpha_i b`, with each `alpha_i` equal to `+1` or `-1`. +Every source access is retained; no clean copy of `a` or `b` is required. +Eager additionally executes `a -= alpha_i b` after each shell. Deferred executes +`a -= S b` once, where `S=sum alpha_i`, skipping it only when `S=0`. + +Count a signed ADD as one scalar primitive and a nonunit constant multiplication +as one additional primitive; this is an exact-arithmetic accounting convention, +not the selected complex real-primitive backend. Let `h=[S!=0]` and +`m=[abs(S)>1]`. At one node the complete shell invoice is: + +| Work | Eager | Deferred | +|---|---:|---:| +| nonzero-reader ADDs | rN | rN | +| forward workspace ADDs | rN | rN | +| restoration ADDs | rN | hN | +| nonunit constant MULs | 0 | mN | +| total scalar primitives | 3rN | (2r+h+m)N | + +Each ADD reads two data scalars and writes one; each extra multiplication reads +one scalar and writes one reusable scalar temporary. Thus reads are +`2*ADD+MUL`, writes `ADD+MUL`, and peak allocated data is `3N+m` scalars (the +extra scalar may be reused across all nodes). Constants and event descriptors are +read-only program data. For the frozen family they are compile-time constants; +constructing a general coefficient sum costs `r-1` descriptor additions once per +node specification, not an uncharged data pass. Forward shears, output updates, +final restoration, accesses and any temporary are all included. There are no +frame changes, initialized auxiliary streams, source copies, or omitted inverse +recursive calls in this explicitly specified program. + +All-positive coefficients give `S=r`, so the priced saving is `(r-2)N`, not +`(r-1)N`: the multiplication by `r` is paid. The seed-selected odd-five family +`(1,-1,1,-1,1)` gives `S=1`, so every command is an ADD: **15N -> 11N**, a saving +of **4N**. Scratch really drifts at children 2 and 4, while each reader still +sees the invariant stream. This is not merely omitting an identity restoration. + +## Complete recursion and precision boundary + +To make the child term explicit, `emit` constructs an actual recursive program. +At depth `d>0`, split each stream into `r` disjoint equal partitions. For each +child `i`, first invoke the depth-`d-1` source-restoring program on partition `i` +with its arbitrary current dirty `a`, then execute that child's full-`N` shell +above. Eager restores after each shell, deferred only at node exit. A leaf is +the identity and has zero cost. Children can run with drifted `a` because every +data read depends only on invariant `b`; by induction all children restore their +entry workspace. Each position receives `r*d` additions of its own `b`. + +For `N=r^d`, the full recurrences, including all recursive work, are + +``` +E_0(N)=F_0(N)=0 +E_d(N)=r E_{d-1}(N/r) + 3rN +F_d(N)=r F_{d-1}(N/r) + (2r+h+m)N +E_d(N)=3rNd; F_d(N)=(2r+h+m)Nd. +``` + +These equations count scalar arithmetic, not free machine dispatch. There are +`J=(r^d-1)/(r-1)` internal nodes, `rJ` recursive child invocations, and respectively +`3rJ` or `(2r+h)J` stream events. Charging `C_call` per recursive invocation, +`C_event` per event and `C_step` per scalar loop iteration adds exactly +`rJ*C_call + events*C_event + ADD*C_step` in this abstract controller model, +plus the separately tabulated data reads/writes. An event's five immutable +descriptor fields can be charged five descriptor reads within `C_event`. +Routing is an ordered contiguous scan of the named partition, not a free +permutation. A streaming recursive realization keeps an `O(d)` index stack +and the fixed `r` coefficients besides the stated data; it need not materialize +the word. The verifier deliberately materializes the complete event list +(`5*events` descriptor scalars) for independent reversal and replay. Neither +its Python memory use nor its runtime is claimed to attain the streaming +resource bound. All extra controller terms and the reader/scratch work remain; +only the displayed restoration events disappear. + +The inverse program reverses all events and negates coefficients, without new +storage; its scalar invoice is identical. `verify.py` replays both directions +on every basis column of all three dirty streams for depths 0..3 and arities 3 +and 5. The zero-cost identity leaf is part of this completely implemented +restoration experiment, not a placeholder for a promised supplier. A real leaf +backend of cost `L` would add `r^d L` to *both* recurrences and must independently +satisfy this reader/restoration contract. + +For integer inputs of magnitude at most `M`, unit shells along a depth-`d` path +keep both data and scratch magnitudes at most `(1+rd)M`; the temporary for a +nonunit restoration is at most `rM`. Consequently adding +`ceil(log2(1+rd))` magnitude bits (plus a sign bit under an unsigned-magnitude +convention) suffices in this integer model. The code uses unbounded exact Python +integers and Fractions. No fixed-tape implementation, rounded complex arithmetic +contract, native compiler, or supplier precision admission is claimed. This +boundary is distinct from the rounded-leaf obstruction in PR1135 and modular +borrowing in PR1159; it does not evade those results. + +## Reproduction, domain and controls + +From the repository root, Python 3.10+, standard library only: + +```sh +python3 -I -O -B research/observer-safe-restoration/verify.py +``` + +The command authenticates the pinned source/context bytes, recomputes every +certificate field and compares `EXPECTED.json`. It never writes by default. +`--write NEW_PATH` creates a fresh certificate and refuses to overwrite one. +No randomized search or tolerance acceptance is used. + +For one complete relocated replay followed by an actual source-corruption +subprocess rejection (without repeating the expensive census for the corrupt +source), run: + +```sh +python3 -I -O -B research/observer-safe-restoration/test_package.py +``` + +Its final marker is +`PASS_OBSERVER_RESTORATION_PACKAGE relocation=1 source_corruption=1`. + +The bounded census is all **46,656** three-child tuples: each `G_i` is one of +four integral shears `I +/- E_12`, `I +/- E_21`; each row reader is one of the nine +vectors in `{-1,0,1}^2`. Full 3-by-3 state-operator composition is compared with +the separately computed two-dimensional defect. The signed coefficient domain, +three-child stopping rule and complete coverage are fixed before execution. +This census is not an impossibility theorem outside its domain. A noncommuting +rational fixture additionally checks the formula with genuine denominators. + +The completed census finds **7,776 terminal-safe** tuples, of which **6,048** +are prefix-safe and **1,728** are terminal-only. **7,712** terminal-safe tuples +contain a nonzero reader. Recursive forward/inverse replay covers **588** +dirty-state basis columns across eight `(arity,depth)` instances. At arity five, +depth three and `N=125`, the complete emitted scalar invoice is **5,625 -> 4,125 +ADDs** (zero constant multiplications), saving 1,500 ADDs with the same 375 dirty +data scalars. These are emitted-program counts, not a runtime measurement. + +Six meaningful controls require failure: a reader outside the drift annihilator, +observing an unsafe prefix of a terminal-cancelling batch, wrong inverse order +for noncommuting shears, omitted final restoration, changing a shear direction, +and a defect hidden by testing only zero-initialized dirty helpers. These are +mathematical counterexamples, not failed searches. The exact receipt records +classification counts, all recursive invoices and the explicit rational defect. + +Only this isolated package's checks are relevant. No selected cold replay, +repository-wide `make verify`, remote CI or proof-assistant build is claimed. +The universal theorem is the written argument above; finite tests check the +implementations and exhibited failures. Selected all-size/compiler, +common-label/mutable-source, hosting, precision/tape, analytic and bit H1-H5 +assumptions remain untouched. No new multiplication exponent or admitted paid +supplier profile follows from saving these boundary primitives. + +## Related work and credit + +Aaron Wang / Navinor's PR1155 is the direct predecessor and supplies the model, +coalescing direction and source text corrected here. Its own credits to Chafik +Boukhalfa's dirty-connector work, Gareth Davidson, Ross Richardson, Douglas +Colkitt and the retained complex batching recurrence are preserved in the frozen +README. PR1012 and PR974 price restoration at hosted-assembly level; this package +changes the operator admissibility class, not their rank-mass conclusion. +PR1057/1164 concern borrowed-port echo allocation, and PR1135/1159 concern exact +versus rounded/modular contracts; none is a dependency of this implementation. +PR889 (`e2021d1c9e06948528cbc0a8fd7079b671da981d`) batches common-factor +product shears with a query-minimal one-connector word. It does not supply this +observer defect criterion. PR1105 (`20a960b545f4b0ade4f26922ef686bd5eaf275f4`) +audits projected cleanup with target feedback in PR543; our children have no +data-to-workspace feedback and use full inverse workspace restoration. These +nearby algebraic interfaces are distinct and their negative conclusions are +not reopened. +Substantial OpenAI Codex assistance is disclosed above; no independent human or +formal review is asserted. The repository Apache-2.0 license is retained locally. diff --git a/research/quadratic-reader-restoration/context/pr1246-README.md b/research/quadratic-reader-restoration/context/pr1246-README.md new file mode 100644 index 0000000000..e9263fffce --- /dev/null +++ b/research/quadratic-reader-restoration/context/pr1246-README.md @@ -0,0 +1,288 @@ +# Pay for nonzero reader defects instead of restoring every child + +**Recursive-interface construction and partition planner; no new kappa.** +For the fixed five-child example below, a complete dirty-workspace echo costs +**244 scalar instructions instead of 380**. Readers do not cancel their drift +errors. The parent restores the workspace and pays for an explicit output +correction. Both source-copy passes, both directions of every child, all +private scratch and the correction are included. + +The contribution extends the zero-defect cut rule in Sagar Thakrar's +[PR1199](https://github.com/CrocSwap/integer-mult-bounds/pull/1199) and the +observer criterion independently developed by mightyOil in +[PR1203](https://github.com/CrocSwap/integer-mult-bounds/pull/1203) and Adam Gall in +[PR1205](https://github.com/CrocSwap/integer-mult-bounds/pull/1205). Their defect +identity is reused and credited, not claimed as new. The added operation is a +**paid output shear with a nonzero defect**, together with a minimum-cost +partition over a specified implementation of that operation. The selected +example uses a noncentral cyclic workspace permutation, outside the fixed +workspace-negation alphabet of Thakrar's +[PR1227](https://github.com/CrocSwap/integer-mult-bounds/pull/1227). + +This is an interface result with indivisible children. If a compiler may open +these particular leaves, their final map is just a five-ADD signed dot product; +direct evaluation is much cheaper than either echo. No supported supplier +requiring this indivisible boundary has been identified. The result supplies +a checked option for such a boundary, not an optimized matrix algorithm, +physical supplier, runtime speedup or change to the selected exponent. + +## Exact terminal repair + +Let `D` be data and `W` arbitrary dirty workspace. Fixed linear children satisfy + +``` +C_i(D,W) = (D + B_i W, G_i W), G_i invertible. +``` + +Each child's private scratch is arbitrary and restored. The matrices do not +depend on intermediate data, and there is no data-to-workspace feedback. +Eager execution follows every child by its workspace inverse. Its desired +return map is `(D + sum_i B_i W, W)`. + +Write `P_0=I`, `P_i=G_i ... G_1` and + +``` +E = sum_i B_i (P_(i-1) - I). +``` + +The cited predecessor criterion admits uncorrected deferral exactly when +`E=0`. For arbitrary `E`, the following enlarged boundary is exact: + +1. Execute each unchanged child once in its fixed order. +2. Apply `P_k^-1` to workspace. +3. Apply `D <- D - E W`, now using restored entry-coordinate workspace. + +**Proof.** Before child `i`, deferred workspace is `P_(i-1) W_entry`. The raw +data return is therefore `D_entry + (sum_i B_i + E) W_entry`. Step 2 returns +`W_entry`; step 3 subtracts exactly the unwanted term. Every private scratch +port has its original value. This proves the identity for arbitrary dirty +inputs and dimensions over any field with these exact operations. It does +not infer a universal theorem from finite samples. + +Restoration must precede the stated correction. Correcting against `P_k W` +instead would require a different matrix, `E P_k^-1`. A noncommuting example +in the controls detects this order error. An intermediate observer or adaptive +child cannot use the uncorrected output as if it were canonical. Such a point +must be a required cut, with its entire restoration and correction paid first. + +## Declared operation alphabet and partition optimum + +The executable specialization has one output coordinate, an integer row +`B_i`, and a signed permutation `G_i` on `N` workspace coordinates. There are +only two scalar instructions: `target += sign * source` for distinct ports, +where `sign` is `+1` or `-1`, and unary `NEG`. Registers are addressed exactly; +no clean scratch or implicit source copy is available. + +Canonical signed-permutation synthesis first permutes absolute indices using +`N-cycles` swaps, then negates negative coordinates. A swap uses three ADDs +and one NEG, with no temporary. Inversion has the same number of cycles and +negative coordinates. The correction repeats a unit signed ADD `|E_j|` times +for each coefficient. A coefficient of magnitude four costs four ADDs, not +one. These are implementations with a known price, not globally shortest +linear circuits. + +For a segment `[a,b)`, its boundary cost is thus + +``` +b(a,b) = 4 (N - cycles(abs(P))) + negative_signs(P) + sum_j |E_j|. +``` + +The child words are common to every partition. With `F(0)=0`, the planner uses + +``` +F(t) = min_{0 <= s < t} { F(s) + b(s,t) }, +``` + +excluding intervals that cross a required observation cut. Each chosen segment +returns the same data and workspace as eager execution, so legal segments +compose. Conversely, every partition in this alphabet has a last segment; +removing it gives the displayed recurrence. Induction proves the minimum over +these partitions. This is not an optimum over arbitrary repairs, edits inside +children, interleaved adapters, or a different operation alphabet. The +`zero_defect_only` comparison additionally requires `E=0` on every segment. + +## Seed-selected example and actual eliminated work + +OS assignment seed **58** selected recursive interfaces. It also selects +`N=3+(58 mod 4)=5`, then the following row and signs using the documented +`random.Random(58)` calls in `selected()`: + +``` +R = (1,-1,-1,1,1) +s = (1,-1,-1,1,1), sum s_i = 1 +B_i = s_i R +G(W_0,W_1,W_2,W_3,W_4) = (W_1,W_2,W_3,W_4,W_0). +``` + +Each child reader costs five ADDs. Its workspace cycle costs twelve ADDs and +four NEGs. On the full five-child batch, `P=I` and + +``` +E = (-4,-2,2,4,0). +``` + +The raw batch is wrong: on `W=e_0` it adds `-3` instead of `1`. The completed +one-block repair costs twelve ADDs. The best zero-defect partition is all five +singletons, costing **80 boundary instructions**. The repaired optimum is +the full batch at **12**, as checked against all sixteen partitions. It removes +five workspace inverses, pays twelve correction ADDs, and preserves the child +word. If every interior child boundary must be observed, the optimum returns +to 80; the observation restriction is material. + +The transparent source echo uses a separate arbitrary dirty `W` and preserved +source `X`: + +``` +W += X; B(D,W); W -= X; B^-1(D,W). +``` + +Since the completed batch is `B(D,W)=(D+R W,W)`, the two passes add +`R(W_initial+X)-R W_initial = R X`. The inverse is the literal reversed +instruction word, not a free inverse query. At depth one the complete echo is: + +| Schedule | ADD | NEG | Total | Reads | Writes | Descriptor fields | +|---|---:|---:|---:|---:|---:|---:| +| Eager / zero-defect cuts | 300 | 80 | 380 | 680 | 380 | 1,360 | +| Paid defect repair | 204 | 40 | 244 | 448 | 244 | 896 | + +## Complete recursion, storage and arithmetic scope + +`recursive_word` realizes an actual tree. A leaf adds its signed row to `D` +and applies `G` to its source. An interior reader executes the above echo using +five depth-`h-1` readers with rows `s_i R`, then applies `G` to its own source. +Because the signs sum to one, the reader at every depth returns +`(D+R X,G X)`. Negative rows use the same construction with all reader +coefficients negated. Children restore their private scratch, so siblings and +both echo passes reuse one dirty block per active level. An induction on depth +proves the stated map for all incoming values. + +Let `A_h,Q_h` count ADD and NEG instructions of an interior **reader**, including +all descendants and inverses. For this selected family the complete recurrences +are: + +``` +A_0 = 17, Q_0 = 4 +eager: A_h = 10 A_(h-1) + 142; Q_h = 10 Q_(h-1) + 44 +repair: A_h = 10 A_(h-1) + 46; Q_h = 10 Q_(h-1) + 4. +``` + +The factor ten pays both directions of all five children. The additive terms +include ten source-copy ADDs, both boundary bills, and the final source cycle. +A root echo omits that last cycle: subtract twelve ADDs and four NEGs. Thus +the depth-`h` saving is `136*(10^h-1)/9` instructions. This is tree depth at +fixed port width, not an input-size recurrence or a primitive exponent. + +| Echo depth | Eager total | Repaired total | Data registers | Eager peak | Repaired peak | +|---|---:|---:|---:|---:|---:| +| 1 | 380 | 244 | 11 | 11 | 27 | +| 2 | 4,130 | 2,634 | 16 | 26 | 52 | +| 3 | 41,630 | 26,534 | 21 | 46 | 71 | + +The data allocation is `1+(h+1)N` scalars: output, source and dirty blocks. +For `A` ADDs and `Q` NEGs, every emitted instruction incurs one dispatch, +`2A+Q` data reads, `A+Q` writes and `4A+2Q` instruction-field reads, including +signs and addresses. On the declared addressed machine, arbitrary prices for +arithmetic, these accesses and dispatch can be substituted into those counts. +All recursive calls are expanded into this instruction word; there is no +omitted runtime call dispatcher or coefficient multiplication. No frame change +is a free relabeling: each signed permutation is physically emitted. + +Program preparation is separate work. For fixed `N`, arity and bounded row, +the supplied compiler conservatively takes `O((h+1)P_h)` list work and storage, +where `P_h=A_h+Q_h`, including its repeated planning and word reversal/copying. +The materialized program contains exactly the tabulated descriptor fields. +An end-to-end bill must add this preparation to execution; the counts do not +claim faster compilation or an amortization schedule. No streaming compiler, +tape routing, address-bit cost or physical hosting theorem is supplied. + +The peaks in the table are exact maximum row one-norms over **every instruction +prefix**, on the complete original-input basis, including private dirt. If +initial integers have magnitude at most `M`, every intermediate magnitude is +at most `peak*M`. The repaired schedule therefore needs a larger magnitude +bound in these examples. The verifier uses unbounded integers and rationals; +unit instruction counts alone do not price arbitrary-precision bit arithmetic. +For general emitted words, the elementary bound `2^A M` also suffices. Neither +these bounds nor finite replay establishes a rounded or fixed-tape interface. + +## Reproduce and inspect the evidence + +Python 3.10+; standard library only. From the repository root: + +```sh +python3 -I -O -B research/paid-reader-defect-seed58/test_package.py +``` + +Expected markers: + +``` +PASS_PAID_READER_DEFECT batches=5256 seeded=160 echo=380->244 controls=9 kappa=unchanged +PASS_PAID_READER_PACKAGE relocation=1 corruptions=5 +``` + +`verify.py` checks the retained source-note SHA256 and Git blob identities, +recomputes every field of `CERTIFICATE.json`, and compares the result exactly. +`--emit` prints the recomputed certificate without changing files. Checks use +explicit exceptions and remain active with Python's `-O` flag. + +The independent oracle composes complete state matrices and exhausts all cut +sets. It does not call the production defect routine or planner to derive +its costs. The bounded domain is all 72 single children and 5,184 ordered pairs +at width two: eight signed permutations and nine rows in `{-1,0,1}^2` per +child. This covers **5,256 batches and 10,440 partitions per policy**; 1,116 +batches strictly improve over zero-defect cuts. An additional 160 deterministic +seed-58 cases have widths 3..6, arities 3..7 and row entries -2..2. All contain +noncommuting adjacent drifts; 54 impose interior observation cuts. Their 152 +improvements are finite evidence, not an impossibility or optimality theorem +outside the stated domain. The stopping rule is completion of these domains. + +The recursive census checks 120 generic reader/echo cases on all 1,044 original +basis columns, literal inverses and rational dirty probes, plus nine selected +depth/schedule cases. Every selected partition is also replayed. Nine controls +cover omitted/wrong-sign correction, wrong repair coordinates, missing cleanup, +noncommuting inverse order, omitted source uncopy, a missing second pass, +premature output observation, and nonunit coefficient cost. Eight invalid +inputs are rejected. The package test runs from outside the repository and +rejects five real file corruptions: retained source bytes, source-commit label, +certificate price, omitted correction, and treating a nonunit coefficient as a +single ADD. Source labels are recorded fetch pins; this is not a cryptographic +proof of GitHub publication or a fresh replay of predecessor packages. + +## Provenance, scope and open next questions + +Investigation base: `49b3157d1d89adcef16df8be98445451672be5ba`. The selected +certificate at that base is PR1094, conditional +`kappa=836330098538459/500000000000000000`. Its actual construction, source +manifest and review were followed; `SOURCE-PINS.json` records their hashes as +context. The source-binding baseline check passed. The selected cold replay, +native supplier admission, Linux CI, independent human review and a formal +multiplication proof were not run. Selected compiler/all-size, realization, +hosting, precision/tape, analytic and bit-interface obligations remain open. + +`CLAIM.json` records the three considered tasks, scope, seed and bounded +domain. No pinned sprint issue was present, so the donor's local-claim fallback +was used. Open PR bodies and current discussions were checked; overlap evidence +is bounded and is not proof of novelty. This package changes no predecessor, +selected record, review ledger or upstream source. + +**Open next questions.** Does a supported supplier expose indivisible drifting +readers whose defect is cheap to apply? Trace one concrete child return map and +price its composed inverse and correction before implementing this wrapper. +The blockers are a real child contract, routing and precision; transparent +leaves that can simply be rewritten do not qualify. Within the declared model, +a correction circuit with sharing could reduce the twelve-ADD bill further, +but it would need a different cost function and a newly checked partition +comparison. No global shortest-circuit claim is made here. + +Credit Aaron Wang / Navinor's PR1155 for restoration coalescing; Sagar Thakrar's +PR1199 and PR1227 for the cut and output-sign interfaces; mightyOil's PR1203 and +Adam Gall's PR1205 for independent observer/dirty-reader treatments; and Ross +Richardson / CubeJerry's PR889 for prior common-factor dirty echo work. PR1012 +and PR974 address hosted restoration mass, a different cost model. The selected +Rohan Arun / Jeremy Kothe construction and its contributor lineage are unchanged. +Three predecessor notes are retained byte-for-byte with their notices and exact +heads in `SOURCE-PINS.json`; no predecessor executable is imported. + +Prepared by **Hanson Sun (@bbMisk)** with substantial **OpenAI Codex assistance** +in algebra, implementation, verification and writing. New material is Apache-2.0 +under the retained repository license. This is a written scoped proof with exact +finite implementation evidence, not independent human or proof-assistant review. diff --git a/research/quadratic-reader-restoration/test_package.py b/research/quadratic-reader-restoration/test_package.py new file mode 100644 index 0000000000..44180e76c2 --- /dev/null +++ b/research/quadratic-reader-restoration/test_package.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Standalone replay and real rejection controls. Apache-2.0. + +Sricharan Vagvala (@theon199), with substantial OpenAI Codex assistance. +""" +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile + +HERE = Path(__file__).resolve().parent + + +def run(package, cwd, expected_success): + result = subprocess.run([sys.executable, "-I", "-O", "-B", str(package / "verify.py")], + cwd=cwd, text=True, capture_output=True, timeout=120) + if expected_success: + if result.returncode or "PASS_QUADRATIC_READER" not in result.stdout: + raise ValueError("valid standalone replay failed: " + result.stdout + result.stderr) + print(result.stdout.strip()) + elif result.returncode == 0 or "FAIL_QUADRATIC_READER" not in result.stderr: + raise ValueError("corruption was not rejected: " + result.stdout + result.stderr) + + +def main(): + with tempfile.TemporaryDirectory(prefix="quadratic-reader-check-") as temporary: + root = Path(temporary) + package = root / "package" + shutil.copytree(HERE, package, ignore=shutil.ignore_patterns("__pycache__")) + run(package, root, True) + source = package / "context/pr1205-README.md" + original = source.read_bytes() + source.write_bytes(original + b"\ncorrupt source\n") + run(package, root, False) + source.write_bytes(original) + context = package / "CONTEXT.json" + original_context = context.read_text() + changed = json.loads(original_context) + changed["predecessor_heads"]["PR1205"] = "0" * 40 + context.write_text(json.dumps(changed)) + run(package, root, False) + context.write_text(original_context) + certificate = package / "CERTIFICATE.json" + original_certificate = certificate.read_text() + for corruption in ("unpaid_coefficients", "omitted_repair", "missing_census_case"): + changed = json.loads(original_certificate) + if corruption == "unpaid_coefficients": + pilot = next(c for c in changed["cost_cases"] if c["arity"] == 8) + pilot["costs"]["bilinear"]["constant_mul"] = 0 + pilot["costs"]["bilinear"]["scalar_operations"] -= 3 + elif corruption == "omitted_repair": + changed["pilot"]["bilinear_word"] = [ + gate for gate in changed["pilot"]["bilinear_word"] if gate[0] != "product"] + else: + changed["census"]["batches"] -= 1 + certificate.write_text(json.dumps(changed)) + run(package, root, False) + certificate.write_text(original_certificate) + print("PASS_QUADRATIC_READER_PACKAGE relocation=1 corruptions=5") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/research/quadratic-reader-restoration/verify.py b/research/quadratic-reader-restoration/verify.py new file mode 100644 index 0000000000..09559f8d44 --- /dev/null +++ b/research/quadratic-reader-restoration/verify.py @@ -0,0 +1,366 @@ +#!/usr/bin/env python3 +"""Exact quadratic-reader boundary experiment. @theon199 + OpenAI Codex. + +Apache-2.0. The polynomial oracle and numerical interpreter are separate +implementations. Explicit exceptions keep all checks active under python -O. +""" +import argparse +from collections import Counter +from fractions import Fraction as F +from hashlib import sha256, sha1 +from itertools import product +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def moments(alpha, beta): + require(len(alpha) == len(beta) and len(alpha) > 0, "nonempty paired batch required") + prefix = F(0) + first = second = F(0) + for drift, reader in zip(alpha, beta): + first += reader * prefix + second += reader * prefix * prefix + prefix += drift + return prefix, first, second + + +def event(kind, coefficient): + return (kind, F(coefficient)) + + +def eager(alpha, beta): + word = [] + for drift, reader in zip(alpha, beta): + if reader: + word.append(event("square_a", reader)) + if drift: + word.extend([event("shift", drift), event("shift", -drift)]) + return word + + +def deferred(alpha, beta, square_only=False): + """The final two/three source shifts also perform source restoration.""" + total, first, second = moments(alpha, beta) + word = [] + for drift, reader in zip(alpha, beta): + if reader: + word.append(event("square_a", reader)) + if drift: + word.append(event("shift", drift)) + if first and square_only: + u = (second / first + 1) / 2 + v = u - 1 + word.extend([event("shift", u - total), event("square_a", -first), + event("shift", -1), event("square_a", first), event("shift", -v)]) + elif first: + t = second / (2 * first) + word.extend([event("shift", t - total), event("product", -2 * first), + event("shift", -t)]) + else: + word.append(event("shift", -total)) + if second: + word.append(event("square_b", -second)) + return [(kind, coefficient) for kind, coefficient in word if coefficient] + + +def execute(word, values): + """Literal exact scalar program, with arbitrary incoming y, a, b.""" + y, a, b = map(F, values) + for kind, coefficient in word: + if kind == "shift": + a += coefficient * b + elif kind == "square_a": + y += coefficient * a * a + elif kind == "square_b": + y += coefficient * b * b + elif kind == "product": + y += coefficient * a * b + else: + raise ValueError("unknown event: " + kind) + return y, a, b + + +def inverse(word): + return [(kind, -coefficient) for kind, coefficient in reversed(word)] + + +class AccessStore: + """Observe every addressed data access of a second scalar interpreter.""" + def __init__(self, values): + self.values = list(map(F, values)) + self.reads = self.writes = 0 + + def __getitem__(self, index): + self.reads += 1 + return self.values[index] + + def __setitem__(self, index, value): + self.writes += 1 + self.values[index] = value + + +def observed_execute(word, values, duplicate_read=False): + state = AccessStore(values) + for kind, coefficient in word: + if duplicate_read: + _ = state[2] + if kind == "shift": + target, donor = state[1], state[2] + state[1] = target + coefficient * donor + elif kind == "square_a" or kind == "square_b": + target, donor = state[0], state[1 if kind == "square_a" else 2] + state[0] = target + coefficient * donor * donor + elif kind == "product": + target, left, right = state[0], state[1], state[2] + state[0] = target + coefficient * left * right + else: + raise ValueError("unknown observed event") + return tuple(state.values), state.reads, state.writes + + +# Independent sparse polynomials in original y, a, b, with rational coefficients. +# Their multiplication checks mixed terms, which dirty-state basis probes miss. +def add(left, right, scale=F(1)): + result = dict(left) + for monomial, coefficient in right.items(): + result[monomial] = result.get(monomial, F(0)) + scale * coefficient + return {key: value for key, value in result.items() if value} + + +def multiply(left, right): + result = {} + for x, c in left.items(): + for z, d in right.items(): + key = tuple(i + j for i, j in zip(x, z)) + result[key] = result.get(key, F(0)) + c * d + return {key: value for key, value in result.items() if value} + + +def polynomial_replay(word): + rows = [{(1, 0, 0): F(1)}, {(0, 1, 0): F(1)}, {(0, 0, 1): F(1)}] + peak = F(1) + denominator = 1 + for kind, coefficient in word: + if kind == "shift": + rows[1] = add(rows[1], rows[2], coefficient) + elif kind == "square_a": + rows[0] = add(rows[0], multiply(rows[1], rows[1]), coefficient) + elif kind == "square_b": + rows[0] = add(rows[0], multiply(rows[2], rows[2]), coefficient) + elif kind == "product": + rows[0] = add(rows[0], multiply(rows[1], rows[2]), coefficient) + else: + raise ValueError("unknown polynomial event") + peak = max(peak, *(sum(abs(c) for c in row.values()) for row in rows)) + denominator = max(denominator, *(c.denominator for row in rows for c in row.values())) + return rows, peak, denominator + + +def expected_polynomials(beta): + return [{(1, 0, 0): F(1), **({(0, 2, 0): F(sum(beta))} if sum(beta) else {})}, + {(0, 1, 0): F(1)}, {(0, 0, 1): F(1)}] + + +def invoice(word): + """Literal scalar-expression price; constants are never free scalings.""" + counts = Counter(add=0, square_mul=0, cross_mul=0, constant_mul=0, + data_reads=0, data_writes=0, descriptor_fields=0, events=0) + for kind, coefficient in word: + require(coefficient != 0, "zero event should be removed") + counts["add"] += 1 + counts["events"] += 1 + counts["data_writes"] += 1 + counts["constant_mul"] += int(abs(coefficient) != 1) + counts["data_reads"] += 3 if kind == "product" else 2 + counts["descriptor_fields"] += 5 if kind == "product" else 4 + if kind.startswith("square"): + counts["square_mul"] += 1 + elif kind == "product": + counts["cross_mul"] += 1 + else: + require(kind == "shift", "unknown invoice event") + counts["scalar_operations"] = sum(counts[key] for key in + ("add", "square_mul", "cross_mul", "constant_mul")) + return dict(sorted(counts.items())) + + +def check_batch(alpha, beta, probes=False): + target = expected_polynomials(beta) + words = [eager(alpha, beta), deferred(alpha, beta), deferred(alpha, beta, True)] + for word in words: + require(polynomial_replay(word)[0] == target, "wrong full polynomial endpoint") + require(polynomial_replay(word + inverse(word))[0] == expected_polynomials([0]), + "inverse failed on full polynomial state") + if probes: + for values in product((-1, 0, 1), repeat=3): + y, a, b = map(F, values) + wanted = (y + sum(beta) * a * a, a, b) + for word in words: + require(execute(word, values) == wanted, "scalar/polynomial disagreement") + require(execute(inverse(word), wanted) == tuple(map(F, values)), + "literal scalar inverse failed") + + +def tree_events(depth, n, batch_word, level=0, start=0): + """Binary tree: children first; each level has its own two dirty streams.""" + if depth == 0: + return [] + require(n % 2 == 0, "binary node must split evenly") + result = [] + for offset in (0, n // 2): + result.extend(tree_events(depth - 1, n // 2, batch_word, level + 1, start + offset)) + for gate in batch_word: + for position in range(start, start + n): + result.append((level, position, gate)) + return result + + +def execute_tree(events, y, a, b): + y, a, b = list(map(F, y)), [list(map(F, row)) for row in a], [list(map(F, row)) for row in b] + for level, position, gate in events: + yy, aa, bb = execute([gate], (y[position], a[level][position], b[level][position])) + y[position], a[level][position], b[level][position] = yy, aa, bb + return y, a, b + + +def failure_controls(): + alpha = beta = (1,) * 8 + good = deferred(alpha, beta) + values = (F(7, 3), F(2, 5), F(-3, 7)) + wanted = execute(eager(alpha, beta), values) + mutants = { + "omitted_nonlinear_repair": [g for g in good if g[0] != "product"], + "wrong_repair_sign": [(k, -c if k == "product" else c) for k, c in good], + "missing_source_restoration": good[:-1], + "wrong_repair_frame": good[:-3] + [event("shift", -8), good[-2], good[-1]], + } + for name, word in mutants.items(): + require(execute(word, values) != wanted, "mutation escaped: " + name) + require(execute(good[:4], values)[0] != execute(eager(alpha[:2], beta[:2]), values)[0], + "unsafe intermediate observation escaped") + # Signed readers can hide a pure mixed defect from all coordinate basis tests. + raw = [("square_a", F(1)), ("shift", F(1)), ("square_a", F(1)), + ("shift", F(-2)), ("square_a", F(-1)), ("shift", F(1))] + plain = eager((1, -2, 1), (1, 1, -1)) + for value in ((1, 0, 0), (0, 1, 0), (0, 0, 1)): + require(execute(raw, value) == execute(plain, value), "basis-blind fixture changed") + require(execute(raw, (0, 1, 1))[0] - execute(plain, (0, 1, 1))[0] == 4, + "mixed-term negative control failed") + free = invoice(good) + require(free["constant_mul"] == 3 and free["scalar_operations"] == 31, + "nonunit scalings were not fully priced") + extra, reads, writes = observed_execute(good, values, duplicate_read=True) + require(extra == wanted and (reads, writes) != (free["data_reads"], free["data_writes"]), + "uncharged repeated-read control escaped") + # A source-basis repair without the product does restore a, but leaves a false y. + return {"rejected_word_mutations": sorted(mutants), "unsafe_prefix": True, + "basis_only_false_acceptance": {"basis_probes": 3, "mixed_defect_at_1_1": 4}, + "nonunit_price": {"multiplications": 3, "unpaid_false_total": 28}, + "uncharged_repeated_read": {"wrong_reads": reads, "correct_reads": free["data_reads"]}} + + +def source_checks(): + data = json.loads((HERE / "CONTEXT.json").read_text()) + require(data["base_commit"] == "ef5f39403610d231a0c27e8a6b4f08c10209bcd6", "base pin changed") + require(data["predecessor_heads"] == { + "PR1205": "e2008d7ffcad464da7ec21c69e8d8a8c91de4930", + "PR1246": "5ed1ce17a9df4c853a93f9758ba903d2620c3443"}, "predecessor head changed") + for row in data["files"]: + contents = (HERE / row["path"]).read_bytes() + require(sha256(contents).hexdigest() == row["sha256"], "source content mismatch") + blob = sha1(b"blob " + str(len(contents)).encode() + b"\0" + contents).hexdigest() + require(blob == row["git_blob"], "source blob mismatch") + return data + + +def certificate(): + sources = source_checks() + census = Counter() + for length in range(1, 6): + for choices in product(tuple(product((-1, 1), repeat=2)), repeat=length): + alpha, beta = zip(*choices) + check_batch(alpha, beta, probes=True) + _, first, second = moments(alpha, beta) + rank = 2 if first else int(second != 0) + census["batches"] += 1 + census["repair_rank_" + str(rank)] += 1 + cases = [] + for length in range(2, 17): + alpha = beta = (1,) * length + check_batch(alpha, beta, probes=True) + records = {label: invoice(word) for label, word in ( + ("eager", eager(alpha, beta)), ("bilinear", deferred(alpha, beta)), + ("square_only", deferred(alpha, beta, True)))} + for label, word in (("eager", eager(alpha, beta)), ("bilinear", deferred(alpha, beta)), + ("square_only", deferred(alpha, beta, True))): + endpoint, reads, writes = observed_execute(word, (F(7, 3), F(2, 5), F(-3, 7))) + require(endpoint == execute(word, (F(7, 3), F(2, 5), F(-3, 7))), "access oracle endpoint failed") + require((reads, writes) == (records[label]["data_reads"], records[label]["data_writes"]), + "literal addressed-access invoice failed") + require(records["eager"]["scalar_operations"] == 4 * length, "eager cost formula failed") + require(records["bilinear"]["scalar_operations"] == 3 * length + 7, "fused cost formula failed") + cases.append({"arity": length, "costs": records}) + # Truly rational source drift and reader weights, outside the signed census. + rational = ((F(2, 3), F(-5, 7), F(3, 2)), (F(4, 5), F(-2, 3), F(7, 4))) + check_batch(*rational, probes=True) + trees = [] + eager_word, fused_word = eager((1,) * 8, (1,) * 8), deferred((1,) * 8, (1,) * 8) + for depth in range(4): + n = 2 ** depth + y = [F(i - 2, 3) for i in range(n)] + a = [[F(2 * level + i - 1, 5) for i in range(n)] for level in range(depth)] + b = [[F(i - level + 2, 7) for i in range(n)] for level in range(depth)] + expected_y = [y[i] + 8 * sum(a[level][i] ** 2 for level in range(depth)) for i in range(n)] + summaries = {} + for label, word in (("eager", eager_word), ("bilinear", fused_word)): + events = tree_events(depth, n, word) + actual = execute_tree(events, y, a, b) + require(actual == (expected_y, a, b), "recursive dirty-state endpoint failed") + reversed_events = [(lev, pos, (k, -c)) for lev, pos, (k, c) in reversed(events)] + require(execute_tree(reversed_events, *actual) == (y, a, b), "recursive inverse failed") + bill = invoice([gate for _, _, gate in events]) + require(bill["scalar_operations"] == invoice(word)["scalar_operations"] * n * depth, + "complete recursive recurrence failed") + summaries[label] = bill + trees.append({"depth": depth, "n": n, "dirty_data_scalars": (2 * depth + 1) * n, + "internal_nodes": 2 ** depth - 1, "costs": summaries}) + _, peak, denominator = polynomial_replay(fused_word) + return {"schema_version": 1, "status": "scoped nonlinear boundary; no new kappa", + "sources": sources, "assignment_seed": 55, + "census": {**dict(sorted(census.items())), "numeric_assignments": census["batches"] * 27, + "lengths": [1, 2, 3, 4, 5], "alphabet": "alpha,beta in {-1,+1}"}, + "pilot": {"arity": 8, "moments": [str(v) for v in moments((1,) * 8, (1,) * 8)], + "bilinear_word": [[k, str(c)] for k, c in fused_word], + "peak_polynomial_coefficient_l1": str(peak), + "largest_stored_coefficient_denominator": denominator}, + "cost_cases": cases, "recursive_cases": trees, "rational_fixture": True, + "controls": failure_controls()} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--emit", action="store_true", help="print a freshly computed certificate; no file writes") + args = parser.parse_args() + try: + result = certificate() + if args.emit: + print(json.dumps(result, indent=2, sort_keys=True)) + else: + require(result == json.loads((HERE / "CERTIFICATE.json").read_text()), "certificate mismatch") + print("PASS_QUADRATIC_READER batches=1364 pilot=32->31 square_repair_rank=2 controls=8 kappa=unchanged") + except (ValueError, OSError, KeyError, TypeError) as error: + print("FAIL_QUADRATIC_READER: " + str(error), file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From aa54509994cb050174ff2ee1442af8caf8161670 Mon Sep 17 00:00:00 2001 From: Sricharan Vagvala Date: Tue, 13 Oct 2026 19:23:57 -0700 Subject: [PATCH 2/2] Record quadratic-reader sprint handoff --- .../quadratic-reader-restoration/CLAIM.json | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/research/quadratic-reader-restoration/CLAIM.json b/research/quadratic-reader-restoration/CLAIM.json index c8238696ea..f22b0fa1ba 100644 --- a/research/quadratic-reader-restoration/CLAIM.json +++ b/research/quadratic-reader-restoration/CLAIM.json @@ -9,9 +9,18 @@ "domain": "All signed reader/shear batches of lengths 1 through 5; arities 2 through 16 for deterministic cost comparison; no general circuit search", "changed_hypothesis": "Extend the linear-reader model of PR1205/1246 to a specified nonlinear square reader; pay every nonlinear correction and source frame change", "candidates": [ - {"task": "Linear endpoint defect repair", "decision": "Rejected: already covered by PR1246"}, - {"task": "Persistent order-four dirty echoes", "decision": "Rejected: overlaps PR1391, PR1410 and PR1499"}, - {"task": "Quadratic reader with paid bilinear repair", "decision": "Chosen: distinct nonlinear observer, square-call rank floor and full tariff"} + { + "task": "Linear endpoint defect repair", + "decision": "Rejected: already covered by PR1246" + }, + { + "task": "Persistent order-four dirty echoes", + "decision": "Rejected: overlaps PR1391, PR1410 and PR1499" + }, + { + "task": "Quadratic reader with paid bilinear repair", + "decision": "Chosen: distinct nonlinear observer, square-call rank floor and full tariff" + } ], "predecessors": { "PR1205": "e2008d7ffcad464da7ec21c69e8d8a8c91de4930", @@ -23,5 +32,14 @@ "expected_finish_utc": "2026-10-14T02:37:50Z", "verification_starts_by_utc": "2026-10-14T02:26:35Z", "stopping_rule": "One completed bounded package; stop supplier adoption if even the complete favorable tariff does not help; do not infer a new kappa", - "attribution": "Prepared by @theon199 with substantial OpenAI Codex assistance; Apache-2.0" + "attribution": "Prepared by @theon199 with substantial OpenAI Codex assistance; Apache-2.0", + "result": { + "status": "DONE", + "finished_at_utc": "2026-10-14T02:23:57.254280+00:00", + "pull_request": "https://github.com/CrocSwap/integer-mult-bounds/pull/1532", + "verified_code_commit": "7e720d66e20e7e36f0cca33dd8f38832f8784d71", + "summary": "Exact quadratic reader defect, fused restoring one-product repair, rank-two appended-square floor, full nonlinear tariff and literal recursion; pilot 32->31 scalar operations, no new kappa.", + "verification": "1364 signed batches; 36828 dirty triples; full polynomial coefficients and literal inverses; 15 cost/access arities; 4 recursion depths; 8 semantic/resource controls; optimized Python 3.12 registered relocation and 5 on-disk corruption rejections; normal Python 3.14 replay.", + "handoff": "Pin an admitted indivisible nonlinear reader and substitute complete backend/precision/tape/hosting costs in P+3C<(r-2)L before claiming a supplier improvement." + } }