diff --git a/research/p104-frontier-compression/NOTICE b/research/p104-frontier-compression/NOTICE new file mode 100644 index 0000000000..8b0f8a1128 --- /dev/null +++ b/research/p104-frontier-compression/NOTICE @@ -0,0 +1,10 @@ +Frontier compression: DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. +Apache-2.0. + +The word, price and checker chain are PR6167 by Ali Romman (OpenAI Codex assistance), +over PR6144 and PR6143 by DreamingOfClouds, PR5827 and the earlier P104, native, helper, +caller, compiler and BIT work. PR6169 (Ali Romman) is the precedent for a no-kappa +resynthesis package. The gzip portability controls follow the base package. +The full source notices are retained in research/p104-retained-operand-descent/NOTICE +and in its pinned source archive, which this package reads and does not copy. +This package claims no predecessor construction as new. diff --git a/research/p104-frontier-compression/README.md b/research/p104-frontier-compression/README.md new file mode 100644 index 0000000000..a7d02b65a3 --- /dev/null +++ b/research/p104-frontier-compression/README.md @@ -0,0 +1,56 @@ +# Frontier compression: 22,821 to 18,083 events, no new kappa + +This package shortens the merged word of +[PR6167](https://github.com/CrocSwap/integer-mult-bounds/pull/6167) +(conditional kappa 0.003128645) from **22,821 to 18,083 events** (-4,738, -20.8%). +**No kappa is claimed.** The complete invoice (13,444 productive fields, +66,762 paid calls, rank surplus 760), the paid profile, the storage and the raw +crossing (between 0.00312865201590 and 0.00312865201591) are identical to PR6167's. + +## The edit + +Only ADD and SCALE events change: 18,423 to 13,686 ADD and 861 to 860 SCALE. +All 3,449 MOVE events and all INIT, COPY and CLEAR events are kept, in order. + +- **Shared partial sums.** The 104 Y registers each receive about 78 helper terms, and + pairs of rows overlap in about 79 of 85 terms with the same coefficient ratio. A row + that needs many terms that another, already complete row holds now adds that row's + final value and folds the donor's other columns into its own initial-value reads. +- **Window resynthesis.** Within each stretch of ADD and SCALE events between MOVE + events at one frame, the register update is re-solved exactly (Gauss/LU on the + read graph, readers first). A new column is accepted only if it creates no cycle. + +ADD and SCALE events do not enter the price, so the paid profile cannot change. The +event and scalar slack of the word grows (scalar allowance is recomputed in RESULT.json). + +## Evidence + +`verify.py` authenticates PR6167's word, price and the pinned PR5827 checker chain +(read from the merged package `research/p104-retained-operand-descent`, pinned in +[SOURCES.json](SOURCES.json)), checks that only ADD and SCALE events changed, then +replays the compressed word through the unmodified chain: identical productive targets, +paid profile and storage, all 799 input columns with 638,401 coefficients, the 2,922 +native maps, the physical caller and the complete price. [RESULT.json](RESULT.json) +records the outcome. + +```sh +python3.12 -I -O -B research/p104-frontier-compression/test_portability.py +python3.12 -I -B research/p104-frontier-compression/verify.py +python3.12 scripts/research_package.py --package research/p104-frontier-compression +``` + +These are author checks. Independent review is pending and the inherited framework +assumptions remain. + +## Coordination and credit + +Base word and checker: PR6167 by Ali Romman. Precedent: PR6169 (exact multi-gate +resynthesis, no kappa). The compression tool is `tk compress` from PR6170. +Prepared by DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. +See [NOTICE](NOTICE). + +## Open next questions + +- Does an independent reviewer confirm the replay? Start with `verify.py`. +- Can the rewrite be combined with the next merged word? Run it on that word and + compare the replayed price. Details are in [TASK.json](TASK.json). diff --git a/research/p104-frontier-compression/RESULT.json b/research/p104-frontier-compression/RESULT.json new file mode 100644 index 0000000000..a56e551c0d --- /dev/null +++ b/research/p104-frontier-compression/RESULT.json @@ -0,0 +1,53 @@ +{ + "events_after": 18083, + "events_before": 22821, + "paid": { + "1": 41448, + "16": 416, + "2": 8208, + "24": 416, + "3": 8928, + "32": 416, + "4": 1764, + "40": 416, + "48": 416, + "5": 2970, + "56": 416, + "6": 144, + "64": 416, + "7": 162, + "72": 208, + "8": 18 + }, + "raw_root_interval": [ + "31286520159/10000000000000", + "312865201591/100000000000000" + ], + "removed": { + "ADD": 4737, + "SCALE": 1 + }, + "scalar_allowance_after": 134190, + "scalar_allowance_before": 189670, + "status": "PASS_P104_FRONTIER_COMPRESSION_NO_NEW_KAPPA", + "targets": { + "1": 252, + "145": 208, + "17": 416, + "2": 144, + "25": 416, + "3": 72, + "33": 416, + "4": 1926, + "41": 416, + "49": 416, + "5": 252, + "57": 416, + "6": 36, + "65": 416, + "7": 162, + "73": 208, + "8": 342, + "9": 6930 + } +} diff --git a/research/p104-frontier-compression/SOURCES.json b/research/p104-frontier-compression/SOURCES.json new file mode 100644 index 0000000000..d51eab5ddc --- /dev/null +++ b/research/p104-frontier-compression/SOURCES.json @@ -0,0 +1,54 @@ +{ + "schema_version": 1, + "base_commit": "2485805a6d47f36ea83ddde6327d453ac82d44dc", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "d59b5035e7b4cbaa9d688a1d32dd0d6eb79c466a", + "sha256": "9b8d0eea95b3bf0dfcb7938a732a6439b87a2685dec2a5ab9e525b3b34debbfa" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + }, + { + "path": "research/p104-retained-operand-descent/WORD.json.gz", + "usage": "input", + "git_blob": "f2d3f98964f939e5ca652f9b1453a0604f15f829", + "sha256": "68d1ff048bc6d30d85ceaeb38e2557adab87b20a9c67cf73948f95f54104575f" + }, + { + "path": "research/p104-retained-operand-descent/pricing.py", + "usage": "input", + "git_blob": "cd8220ca7a393f03341f08a93b9d1287f0bb3689", + "sha256": "bba1611b05b6cc35279aa1667dcc62ce0e7f27f0ba21f20eb68244fa772e0ae7" + }, + { + "path": "research/p104-retained-operand-descent/sources.py", + "usage": "input", + "git_blob": "bef6542243a082755a881dff42097434e6370609", + "sha256": "a62fefda1709614157ba440d38c164c366a8b3322ab8f866b6b4bd47b9d83dbc" + }, + { + "path": "research/p104-retained-operand-descent/SOURCES.json", + "usage": "input", + "git_blob": "0c574b6026a7239aac7365c433d3760928748edb", + "sha256": "7c7b6fac64005eb8932283a902069d672d98c52bda2b63cc7eaa4a2cac13ce8f" + }, + { + "path": "research/p104-retained-operand-descent/RESULT.json", + "usage": "input", + "git_blob": "9d78529c1ac43faef6b3dff6e4b1262d89a86b40", + "sha256": "cffec38f3a5ab0bf5ee1bcd15b2e7bf8bcfd711b57ee57de8ec0fea0c5a823df" + }, + { + "path": "research/p104-retained-operand-descent/inputs/pr5827-source.tar", + "usage": "input", + "git_blob": "1e10936044959f81a4c5fcd5bdb7b9e4c060ec8e", + "sha256": "7af5908a4d83e83e28f59523fd7494841f669b7295311cfdbc3027fa65c5826d" + } + ] +} diff --git a/research/p104-frontier-compression/TASK.json b/research/p104-frontier-compression/TASK.json new file mode 100644 index 0000000000..cc7b8c9176 --- /dev/null +++ b/research/p104-frontier-compression/TASK.json @@ -0,0 +1,124 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 8, + "base_commit": "2485805a6d47f36ea83ddde6327d453ac82d44dc", + "original_card": { + "id": "p104-side-correction", + "question": "Can joint helper bases and a legal causal split improve the complete P104 productive/paid invoice?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "research/p104-helper-subspace-splits/README.md", + "research/dyadic-helper-channel-capacity/README.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Start with the selected #5599 emitted word and review pending #5718 distinct input/output bases plus #5717/#5719 coverage before claiming work. Pick one uncovered source word, helper group and cut region. Prove the arbitrary-input relation and legal entry/exit corrections, then compare full target and paid profiles. Reject if completion, owned lifetimes or consumer costs repay the gain. A static pairing rank alone is not a physical split.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "P104", + "helper basis", + "helper split", + "5718", + "dyadic capacity" + ], + "existing_checks": [ + { + "scope": "PR #4133: literal-slot defect", + "evidence": "research/p104-literal-slot-defect/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "88666f1dee93fbd85b31fd5d6f91a219e111b5f4", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4136: uniform commutation gap", + "evidence": "research/p104-uniform-commutation-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "281ce601a8be9db470de630759179c23e1dfaa88", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4140: uniform encoding gap", + "evidence": "research/p104-uniform-encoding-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "de25c6525aa866962309df5d107b32d55e6e5628", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4153: source-chart shortcut exhausts its optimistic allowance", + "evidence": "research/p104-source-chart-shortcut/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "9123241fea53df77e51ffe30d9aca1625d4bf3a8", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4154: fiber-tag seam mismatch", + "evidence": "research/p104-fiber-tag-seam/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "4ffcdaee5d6255a9cea1fe53a5424435068089d0", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Rewrite only the ADD and SCALE events of the merged PR6167 word with shared partial sums across overlapping Y rows and exact window resynthesis, keeping every MOVE, INIT, COPY and CLEAR event, and check that the complete invoice and kappa are unchanged.", + "scope_change_reason": "The current card asks for a helper basis split. This package instead leaves the paid profile fixed and shortens the scalar word; it claims no kappa.", + "bottleneck_link": "None: ADD and SCALE events are not in the price, so the complete invoice, productive targets and paid profile are identical to PR6167. The package only lowers the event and scalar counts.", + "budget_minutes": null, + "stop_rule": "Publish only if the replayed price, native maps, caller and endpoint columns are identical to PR6167 and the event count is strictly lower.", + "outcome": "completed", + "evidence": "WORD.json.gz, verify.py and RESULT.json", + "author": "DreamingOfClouds", + "ai_assistance": "Claude Opus 5.5 (Anthropic), via Claude Code. The base word and checker chain are PR6167 (Ali Romman, OpenAI Codex assistance); PR6169 is the precedent for a no-kappa resynthesis package.", + "open_questions": [ + { + "question": "Can the same shared-partial-sum rewrite be combined with a future paid-profile improvement?", + "why_it_matters": "A shorter scalar word leaves more event and scalar slack for later constructions.", + "first_step": "Run the rewrite on the next merged word and compare the replayed price.", + "blocked_by": "Needs a new merged word; independent review of this package is also pending." + } + ], + "coordination": { + "source_pr": 6167, + "source_commit": "564a076b113621a93edc4e39968ee4e4a8c9caf0", + "precedent_pr": 6169, + "toolkit_pr": 6170, + "local_notes": "Author checks only. No new kappa is claimed." + } +} diff --git a/research/p104-frontier-compression/VERIFY.json b/research/p104-frontier-compression/VERIFY.json new file mode 100644 index 0000000000..72ce3c4b98 --- /dev/null +++ b/research/p104-frontier-compression/VERIFY.json @@ -0,0 +1,37 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/p104-retained-operand-descent/WORD.json.gz", + "research/p104-retained-operand-descent/pricing.py", + "research/p104-retained-operand-descent/sources.py", + "research/p104-retained-operand-descent/SOURCES.json", + "research/p104-retained-operand-descent/RESULT.json", + "research/p104-retained-operand-descent/inputs/pr5827-source.tar" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/test_portability.py" + ], + "timeout_seconds": 30, + "checks": "Accept changed gzip headers and compression for the generated payload. Reject changed payloads, type substitutions and corrupt containers." + }, + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 500, + "checks": "Authenticate the PR6167 word, price and checker chain by pin; check that only ADD and SCALE events changed, then replay the compressed word: identical productive targets, paid profile, storage, 799 endpoint columns, native maps, physical caller and complete price (same raw crossing as PR6167). No new kappa is claimed." + } + ] +} diff --git a/research/p104-frontier-compression/WORD.json.gz b/research/p104-frontier-compression/WORD.json.gz new file mode 100644 index 0000000000..998ee2b497 Binary files /dev/null and b/research/p104-frontier-compression/WORD.json.gz differ diff --git a/research/p104-frontier-compression/construct.py b/research/p104-frontier-compression/construct.py new file mode 100644 index 0000000000..24bfc53fbb --- /dev/null +++ b/research/p104-frontier-compression/construct.py @@ -0,0 +1,14 @@ +"""Payload helpers for the compressed word. Apache-2.0. + +Prepared by DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. +""" +import gzip +import json + + +def payload(value): + return (json.dumps(value, sort_keys=True, indent=2) + '\n').encode() + + +def matches_shipped(value, compressed): + return gzip.decompress(compressed) == payload(value) diff --git a/research/p104-frontier-compression/test_portability.py b/research/p104-frontier-compression/test_portability.py new file mode 100644 index 0000000000..dd53b6d559 --- /dev/null +++ b/research/p104-frontier-compression/test_portability.py @@ -0,0 +1,75 @@ +"""Regenerated-output portability controls; immutable inputs stay exact. + +Portability controls follow the base package's maintainer repair (see its NOTICE). +Prepared by DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. Apache-2.0. +""" +from copy import deepcopy +import gzip +import io +import json +from pathlib import Path +import sys +import unittest +import zlib + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +from construct import matches_shipped, payload + + +class WordPortabilityTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.shipped = (HERE / 'WORD.json.gz').read_bytes() + cls.word = json.loads(gzip.decompress(cls.shipped)) + + def test_original_word(self): + self.assertTrue(matches_shipped(self.word, self.shipped)) + + def test_os_header_variants(self): + # Byte 9 is gzip's OS field. Neither the payload nor CRC changes. + for code in (0, 3, 19, 255): + changed = bytearray(self.shipped) + changed[9] = code + with self.subTest(os_code=code): + self.assertTrue(matches_shipped(self.word, bytes(changed))) + + def test_compression_timestamp_and_filename(self): + for level in (1, 6, 9): + with self.subTest(level=level): + buffer = io.BytesIO() + with gzip.GzipFile(filename='different-name.json', mode='wb', + compresslevel=level, mtime=1700000000, + fileobj=buffer) as stream: + stream.write(payload(self.word)) + self.assertNotEqual(buffer.getvalue(), self.shipped) + self.assertTrue(matches_shipped(self.word, buffer.getvalue())) + + def test_changed_event_and_unknown_field_rejected(self): + changed = deepcopy(self.word) + changed['program'].pop() + self.assertFalse(matches_shipped(changed, self.shipped)) + changed = deepcopy(self.word) + changed['unexpected_proof_field'] = 1 + self.assertFalse(matches_shipped(changed, self.shipped)) + + def test_boolean_is_not_an_integer(self): + changed = deepcopy(self.word) + move = next(event for event in changed['program'] if event[0] == 'MOVE') + self.assertIs(type(move[4]), bool) + move[4] = int(move[4]) + # Python object equality alone would silently accept this mutation. + self.assertEqual(changed, self.word) + self.assertFalse(matches_shipped(changed, self.shipped)) + + def test_extra_payload_and_corrupt_container_rejected(self): + self.assertFalse(matches_shipped(self.word, gzip.compress(payload(self.word) + b' '))) + self.assertFalse(matches_shipped(self.word, self.shipped + gzip.compress(b'not a word'))) + for bad in (self.shipped[:20], self.shipped[:-8] + b'\0' * 8): + with self.subTest(size=len(bad)): + with self.assertRaises((gzip.BadGzipFile, EOFError, zlib.error)): + matches_shipped(self.word, bad) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/research/p104-frontier-compression/verify.py b/research/p104-frontier-compression/verify.py new file mode 100644 index 0000000000..a1ecf606d3 --- /dev/null +++ b/research/p104-frontier-compression/verify.py @@ -0,0 +1,118 @@ +"""Check that the compressed word is a lossless rewrite of PR6167's word. + +Prepared by DreamingOfClouds with Claude Opus 5.5 (Anthropic), via Claude Code. Apache-2.0. +The word, price and checker chain are PR6167's (Ali Romman) over PR6144 and PR5827; they are read +from the merged package research/p104-retained-operand-descent, authenticated by SOURCES.json pins. +""" +from collections import Counter +from contextlib import ExitStack +from pathlib import Path +import gzip +import json +import sys +import tempfile + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +BASE = HERE.parent / 'p104-retained-operand-descent' +sys.path.insert(0, str(HERE)) +from construct import matches_shipped + +STATUS = 'PASS_P104_FRONTIER_COMPRESSION_NO_NEW_KAPPA' + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def load(path, name): + import importlib.util + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +def authenticate(path, pin): + from hashlib import sha1, sha256 + raw = Path(path).read_bytes() + need(sha256(raw).hexdigest() == pin['sha256'], 'Exact SHA256: ' + pin['path']) + need(sha1(b'blob ' + str(len(raw)).encode() + b'\0' + raw).hexdigest() == pin['git_blob'], + 'Exact Git blob: ' + pin['path']) + return raw + + +def run(): + pins = {r['path']: r for r in json.loads((HERE / 'SOURCES.json').read_text())['files']} + root_dir = HERE.parent.parent + for name, pin in pins.items(): + if pin['usage'] == 'input': + authenticate(root_dir / name, pin) + base_raw = (BASE / 'WORD.json.gz').read_bytes() + source = json.loads(gzip.decompress(base_raw)) + shipped = (HERE / 'WORD.json.gz').read_bytes() + word = json.loads(gzip.decompress(shipped)) + need(matches_shipped(word, shipped), 'Canonical payload') + old, new = source['program'], word['program'] + need({k: v for k, v in word.items() if k != 'program'} == {k: v for k, v in source.items() if k != 'program'}, + 'Header unchanged') + need((len(old), len(new)) == (22821, 18083), 'Exact event counts') + for kind in ('MOVE', 'INIT', 'CLEAR', 'COPY'): + need([e for e in old if e[0] == kind] == [e for e in new if e[0] == kind], + kind + ' events unchanged and in order') + need(all(type(e[4]) is bool for e in new if e[0] == 'MOVE'), 'Boolean ownership flags') + print('PASS only ADD and SCALE events changed: 22,821 -> 18,083 events', flush=True) + with ExitStack() as contexts: + S = load(BASE / 'sources.py', 'base_sources') + parent = contexts.enter_context(S.sources()) + cursor = contexts.enter_context(load(parent / 'sources.py', 'base_source_top').sources()) + for depth in range(7): + module = load(cursor / 'sources.py', 'base_source_' + str(depth)) + cursor, root = contexts.enter_context(module.sources()) + L = load(parent / 'local.py', 'local') + L.ROOT = root + baseline, local = L.replay(source), L.replay(word) + for key in ('helpers', 'paid', 'public_inputs', 'owned_fields', 'owned_lifetimes', 'peak_owned_fields'): + need(local[key] == baseline[key], 'Unchanged replay field: ' + key) + print('PASS replay: productive targets, paid profile and storage identical', flush=True) + columns = L.reverse_columns(word) + need(columns == L.reverse_columns(source), 'Identical endpoint columns') + need(columns['columns'] == 799 and columns['coefficients'] == 638401, 'All input columns') + print('PASS separate transpose: 799 columns, 638,401 coefficients identical', flush=True) + native = L.native(word) + C = load(root / 'research/p104-productive-controller/caller.py', 'base_caller') + caller = C.construct() + physical = C.physical(caller, word) + P = load(BASE / 'pricing.py', 'retained_operand_price') + price = P.run(local, native, caller, physical) + ref = json.loads((BASE / 'RESULT.json').read_text()) + need(price['raw_root_interval'] == ref['complete_cost']['raw_root_interval'], 'Same raw crossing') + for key in ('paid', 'targets'): + need(price[key] == ref['complete_cost'][key], 'Same complete invoice: ' + key) + rt = lambda v: json.loads(json.dumps(v)) + need(rt(physical) == ref['physical_caller'], 'Same physical caller') + need(rt(native) == ref['native'], 'Same native maps') + print('PASS native maps, physical caller and complete price identical to PR6167', flush=True) + return dict(status=STATUS, events_before=len(old), events_after=len(new), + removed={k: Counter(e[0] for e in old)[k] - Counter(e[0] for e in new)[k] + for k in ('ADD', 'SCALE')}, + raw_root_interval=price['raw_root_interval'], paid=price['paid'], targets=price['targets'], + scalar_allowance_before=baseline['real_scalar_allowance'], + scalar_allowance_after=local['real_scalar_allowance']) + + +def main(): + with tempfile.TemporaryDirectory(prefix='frontier-compression-') as cache: + sys.pycache_prefix = cache + result = run() + if '--write' in sys.argv: + (HERE / 'RESULT.json').write_text(json.dumps(result, sort_keys=True, indent=2) + '\n') + else: + need(json.loads((HERE / 'RESULT.json').read_text()) == result, 'Exact retained result') + print(STATUS, flush=True) + + +if __name__ == '__main__': + main()