diff --git a/research/jp8-direct-small-integers/CLAIM.json b/research/jp8-direct-small-integers/CLAIM.json new file mode 100644 index 0000000000..14f53551ed --- /dev/null +++ b/research/jp8-direct-small-integers/CLAIM.json @@ -0,0 +1,62 @@ +{ + "status": "completed; published as upstream PR1223; second finite scalar audit recorded", + "assignment_seed": 29, + "randomness": "Python secrets.randbelow(100), backed by operating-system randomness", + "started_utc": "2026-10-13T14:22:53.258115+00:00", + "claimed_utc": "2026-10-13T14:28:23.813834+00:00", + "expected_finish_utc": "2026-10-13T15:02:00+00:00", + "base_commit": "007664306fff84fbb1c9a1b4053b69f439764034", + "track": "20-39 complex supplier", + "selected_kappa": "1661957774647029/1000000000000000000", + "candidates": [ + { + "task": "Rescale historical eight-register factory", + "decision": "Not selected: PR924/949 cover coupled signed dyadic gauges and exact fixed-topology optimum." + }, + { + "task": "Add a second scratch register to bounded JP8 coefficient synthesis", + "decision": "Not selected: additional private work and its initialization/restoration require a larger interface; a simpler useful class is available." + }, + { + "task": "Compile JP8 integral coefficients +/-2 and +/-3 as repeated direct target updates followed by the retained work clear", + "decision": "Selected: changes the single-final-accumulation restriction of PR882; no extra work register or grid depth. Seed 29 selects historical JP8 by odd parity, and coefficient 3 as the first control." + } + ], + "object": "Historical PR626 JP8 scalar projections, all macros with absolute reduced coefficient 2 or 3, both orientations", + "method": "Complete occurrence census; compare accepted PR696 lowering with m signed unit target additions plus one work clear; exact all-input-column scalar replay and independent local matrix controls. No source mutation or macro boundary change.", + "optimistic_complete_cost": "Per real component: m+1 versus PR696 costs 4/5 for m=2/3, saving 1. Includes every source read and final work clear. Expected 1,424 occurrences per orientation from the initial census, saving 2,848 real primitives. Paid children, frame changes and global assembly retained; no kappa claimed.", + "domain": "Both complete pinned historical JP8 programs; no randomized search; stop after exact replay and meaningful corruption controls.", + "overlap": { + "open_prs_scanned": 703, + "through_pr": 949, + "open_issues": [ + 650, + 913 + ], + "related_prs": [ + 696, + 734, + 837, + 882, + 883, + 945, + 355 + ], + "distinction": "PR882 constrains coefficient preparation to work and one final accumulation; this permits multiple target updates. PR883 changes paired preconditions, PR945 shares distinct-source preparations across macros, PR355 uses repeated units in historical bit donor setup. No mechanism-priority claim." + }, + "expected_deliverable": "One source-pinned finite circuit package, proof and exact reproducible receipt, no new kappa.", + "contributor": "Michał Ciemięga (@zewelor)", + "ai_assistance": "Substantial OpenAI Codex assistance in research, implementation, verification and writing.", + "completed_utc": "2026-10-13T14:41:45.329159+00:00", + "result": "Both complete JP8 scalar projections save 2,848 real primitives; 1,424 changed macros each; 725 input columns; unchanged exact magnitude/grid maxima and paid profile; no new kappa.", + "result_reference": "HANDOFF.md", + "final_overlap_reference": "OVERLAP.json", + "submission": "https://github.com/CrocSwap/integer-mult-bounds/pull/1223; opened by the contributor after the integration create-PR operation returned HTTP403. Updates continue on the same fork branch.", + "publication_refresh_reference": "OVERLAP.json", + "second_audit": { + "reviewed_head": "86381e9adf3c9d1e958cca4d53fec15254190434", + "refreshed_main": "49b3157d1d89adcef16df8be98445451672be5ba", + "evidence": "VALIDATION.md; recheck_fraction.py", + "result": "Original circuit and exact receipt unchanged; full Fraction replay confirms every program receipt field." + } +} diff --git a/research/jp8-direct-small-integers/EXPECTED.json b/research/jp8-direct-small-integers/EXPECTED.json new file mode 100644 index 0000000000..7581002b94 --- /dev/null +++ b/research/jp8-direct-small-integers/EXPECTED.json @@ -0,0 +1,3203 @@ +{ + "schema": "jp8-direct-small-integers/1", + "status": "finite scalar construction; no new kappa", + "base_commit": "007664306fff84fbb1c9a1b4053b69f439764034", + "assignment_seed": 29, + "programs": { + "forward": { + "events": 27909, + "macros": 22693, + "exact_input_columns": 725, + "dirty_helpers_restored": 492, + "private_registers_cleared": 9, + "changed_macros": 1424, + "changed_event_indices": [ + 9688, + 9689, + 9690, + 9691, + 9709, + 9710, + 9724, + 9725, + 9744, + 9749, + 9780, + 9785, + 9816, + 9821, + 9849, + 9852, + 9853, + 9887, + 9890, + 9891, + 9925, + 9928, + 9929, + 9963, + 9966, + 9967, + 10001, + 10004, + 10005, + 10037, + 10038, + 10039, + 10056, + 10057, + 10058, + 10075, + 10076, + 10077, + 10078, + 10140, + 13477, + 13592, + 13594, + 13612, + 13614, + 13703, + 13705, + 13831, + 13832, + 13873, + 13874, + 13877, + 13878, + 13880, + 13881, + 13889, + 13890, + 13893, + 13894, + 13896, + 13897, + 13905, + 13906, + 13909, + 13910, + 13912, + 13913, + 13985, + 13986, + 13989, + 13990, + 13992, + 13993, + 16494, + 16499, + 16502, + 16509, + 16512, + 16517, + 16520, + 16525, + 16528, + 16533, + 16536, + 16543, + 16546, + 16551, + 16554, + 16559, + 16562, + 16567, + 16570, + 16577, + 16580, + 16585, + 16588, + 16593, + 16596, + 16601, + 16604, + 16611, + 16614, + 16619, + 16622, + 16627, + 16630, + 16635, + 16638, + 16645, + 16648, + 16653, + 16656, + 16661, + 16664, + 16669, + 16672, + 16679, + 16682, + 16687, + 16690, + 16695, + 16698, + 16703, + 16706, + 16713, + 16716, + 16721, + 16724, + 16729, + 16732, + 16737, + 16740, + 16747, + 16750, + 16755, + 16758, + 16763, + 16771, + 16781, + 16789, + 16797, + 16805, + 16815, + 16823, + 16831, + 16839, + 16849, + 16857, + 16865, + 16873, + 16883, + 16891, + 16899, + 16907, + 16917, + 16925, + 16933, + 16941, + 16951, + 16959, + 16967, + 16975, + 16985, + 16993, + 17001, + 17009, + 17019, + 17027, + 17035, + 17043, + 17053, + 17061, + 17069, + 17077, + 17087, + 17095, + 17103, + 17111, + 17121, + 17129, + 17137, + 17145, + 17155, + 17163, + 17171, + 17179, + 17189, + 17197, + 17205, + 17213, + 17223, + 17231, + 17239, + 18682, + 18693, + 18701, + 18723, + 18731, + 18753, + 18758, + 18763, + 18768, + 18840, + 18843, + 18847, + 18849, + 18852, + 18855, + 18915, + 18916, + 18925, + 18936, + 18948, + 18954, + 18957, + 19028, + 19029, + 19030, + 19032, + 19033, + 19034, + 19036, + 19037, + 19038, + 19045, + 19046, + 19047, + 19049, + 19050, + 19051, + 19053, + 19054, + 19055, + 19062, + 19063, + 19064, + 19066, + 19067, + 19068, + 19070, + 19071, + 19072, + 19079, + 19080, + 19081, + 19083, + 19084, + 19085, + 19087, + 19088, + 19089, + 19225, + 19234, + 19235, + 19236, + 19239, + 19249, + 19250, + 19253, + 19259, + 19274, + 19278, + 19305, + 19307, + 19308, + 19310, + 19321, + 19322, + 19324, + 19328, + 19335, + 19340, + 19351, + 19358, + 19364, + 19373, + 19409, + 19421, + 19422, + 19423, + 19424, + 19425, + 19426, + 19433, + 19434, + 19441, + 19481, + 19494, + 19496, + 19497, + 19498, + 19499, + 19500, + 19502, + 19515, + 19517, + 19518, + 19519, + 19522, + 19523, + 19535, + 19536, + 19539, + 19541, + 19544, + 19551, + 19560, + 19561, + 19562, + 19569, + 19579, + 19580, + 19590, + 19598, + 19609, + 19624, + 19627, + 19628, + 19629, + 19643, + 19647, + 19658, + 19661, + 19662, + 19663, + 19664, + 19665, + 19690, + 19692, + 19704, + 19716, + 19726, + 19734, + 19739, + 19740, + 19741, + 19742, + 19743, + 19746, + 19763, + 19764, + 19770, + 19772, + 19780, + 19782, + 19786, + 19790, + 19798, + 19799, + 19800, + 19803, + 19804, + 19821, + 19822, + 19823, + 19824, + 19825, + 19826, + 19829, + 19831, + 19842, + 19864, + 19866, + 19867, + 19868, + 19869, + 19870, + 19873, + 19877, + 19888, + 19896, + 19897, + 19899, + 19900, + 19902, + 19903, + 19908, + 19910, + 19912, + 19914, + 19915, + 19916, + 19920, + 19922, + 19948, + 19949, + 19974, + 19975, + 19980, + 19992, + 20000, + 20001, + 20002, + 20003, + 20005, + 20006, + 20007, + 20015, + 20016, + 20017, + 20018, + 20019, + 20035, + 20037, + 20039, + 20041, + 20042, + 20043, + 20046, + 20048, + 20057, + 20063, + 20079, + 20090, + 20094, + 20101, + 20103, + 20138, + 20139, + 20140, + 20141, + 20142, + 20178, + 20179, + 20180, + 20214, + 20263, + 20265, + 20266, + 20267, + 20305, + 20341, + 20346, + 20364, + 20371, + 20373, + 20377, + 20378, + 20379, + 20380, + 20386, + 20387, + 20398, + 20413, + 20416, + 20426, + 20435, + 20437, + 20438, + 20446, + 20449, + 20456, + 20457, + 20458, + 20459, + 20464, + 20466, + 20468, + 20469, + 20470, + 20471, + 20473, + 20477, + 20482, + 20487, + 20493, + 20496, + 20497, + 20506, + 20509, + 20510, + 20514, + 20516, + 20517, + 20523, + 20526, + 20527, + 20528, + 20529, + 20536, + 20545, + 20598, + 20599, + 20602, + 20603, + 20617, + 20620, + 20621, + 20629, + 20630, + 20636, + 20660, + 20680, + 20687, + 20689, + 20691, + 20694, + 20696, + 20698, + 20699, + 20706, + 20709, + 20710, + 20715, + 20719, + 20723, + 20728, + 20730, + 20731, + 20736, + 20737, + 20740, + 20742, + 20743, + 20751, + 20761, + 20775, + 20776, + 20777, + 20781, + 20784, + 20786, + 20787, + 20789, + 20790, + 20791, + 20792, + 20794, + 20795, + 20802, + 20804, + 20809, + 20820, + 20822, + 20826, + 20838, + 20860, + 20916, + 20924, + 20929, + 20944, + 20948, + 20949, + 20953, + 20977, + 20987, + 20991, + 20992, + 21014, + 21017, + 21051, + 21064, + 21069, + 21070, + 21072, + 21073, + 21084, + 21120, + 21122, + 21125, + 21126, + 21128, + 21131, + 21154, + 21158, + 21195, + 21197, + 21199, + 21201, + 21208, + 21233, + 21246, + 21248, + 21254, + 21286, + 21288, + 21294, + 21361, + 21370, + 21377, + 21378, + 21380, + 21394, + 21396, + 21399, + 21404, + 21407, + 21409, + 21418, + 21433, + 21439, + 21443, + 21448, + 21450, + 21466, + 21478, + 21479, + 21496, + 21536, + 21545, + 21547, + 21556, + 21558, + 21559, + 21563, + 21571, + 21576, + 21579, + 21590, + 21596, + 21598, + 21603, + 21608, + 21625, + 21626, + 21627, + 21628, + 21629, + 21673, + 21710, + 21722, + 21724, + 21753, + 21760, + 21803, + 21821, + 21827, + 21830, + 21832, + 21863, + 21870, + 21912, + 21916, + 21936, + 21954, + 21955, + 21956, + 21957, + 21958, + 21960, + 21969, + 21976, + 21984, + 21988, + 21991, + 21996, + 22028, + 22038, + 22040, + 22043, + 22044, + 22053, + 22054, + 22056, + 22057, + 22058, + 22061, + 22062, + 22065, + 22066, + 22069, + 22070, + 22111, + 22123, + 22125, + 22127, + 22128, + 22130, + 22132, + 22133, + 22134, + 22137, + 22138, + 22139, + 22140, + 22154, + 22155, + 22163, + 22164, + 22165, + 22166, + 22210, + 22212, + 22214, + 22220, + 22226, + 22229, + 22234, + 22236, + 22247, + 22249, + 22252, + 22256, + 22272, + 22273, + 22282, + 22293, + 22310, + 22336, + 22346, + 22347, + 22348, + 22350, + 22352, + 22354, + 22355, + 22357, + 22358, + 22359, + 22360, + 22363, + 22364, + 22365, + 22366, + 22368, + 22370, + 22371, + 22373, + 22375, + 22376, + 22378, + 22379, + 22381, + 22382, + 22385, + 22386, + 22387, + 22390, + 22391, + 22393, + 22394, + 22396, + 22397, + 22399, + 22400, + 22401, + 22407, + 22408, + 22409, + 22411, + 22415, + 22434, + 22435, + 22437, + 22438, + 22445, + 22452, + 22462, + 22463, + 22470, + 22471, + 22472, + 22479, + 22480, + 22511, + 22527, + 22536, + 22538, + 22544, + 22546, + 22551, + 22552, + 22558, + 22559, + 22560, + 22561, + 22562, + 22564, + 22565, + 22568, + 22608, + 22618, + 22625, + 22627, + 22628, + 22632, + 22634, + 22636, + 22637, + 22638, + 22639, + 22641, + 22642, + 22643, + 22650, + 22652, + 22653, + 22656, + 22663, + 22664, + 22712, + 22717, + 22718, + 22720, + 22734, + 22756, + 22760, + 22771, + 22777, + 22815, + 22817, + 22825, + 22827, + 22844, + 22853, + 22854, + 22857, + 22870, + 22871, + 22872, + 22874, + 22877, + 22878, + 22879, + 22882, + 22883, + 22903, + 22917, + 22918, + 22919, + 22920, + 22921, + 22922, + 22926, + 22953, + 22957, + 22959, + 22990, + 22994, + 22995, + 22997, + 23001, + 23005, + 23014, + 23018, + 23019, + 23020, + 23023, + 23024, + 23025, + 23026, + 23027, + 23028, + 23030, + 23039, + 23063, + 23067, + 23068, + 23070, + 23074, + 23078, + 23087, + 23088, + 23089, + 23090, + 23091, + 23093, + 23095, + 23096, + 23097, + 23105, + 23106, + 23107, + 23108, + 23109, + 23112, + 23113, + 23114, + 23118, + 23123, + 23127, + 23137, + 23138, + 23139, + 23140, + 23141, + 23188, + 23197, + 23205, + 23252, + 23269, + 23291, + 23292, + 23309, + 23310, + 23312, + 23313, + 23314, + 23316, + 23319, + 23327, + 23328, + 23330, + 23331, + 23332, + 23348, + 23352, + 23362, + 23363, + 23369, + 23371, + 23372, + 23383, + 23384, + 23385, + 23418, + 23431, + 23435, + 23436, + 23447, + 23449, + 23452, + 23453, + 23454, + 23455, + 23456, + 23459, + 23460, + 23461, + 23463, + 23465, + 23469, + 23470, + 23471, + 23472, + 23473, + 23481, + 23485, + 23486, + 23488, + 23489, + 23493, + 23494, + 23504, + 23506, + 23513, + 23514, + 23524, + 23526, + 23553, + 23598, + 23649, + 23655, + 23658, + 23660, + 23661, + 23663, + 23668, + 23685, + 23686, + 23709, + 23710, + 23726, + 23727, + 23732, + 23738, + 23741, + 23743, + 23744, + 23746, + 23748, + 23765, + 23766, + 23767, + 23768, + 23772, + 23774, + 23806, + 23807, + 23808, + 23809, + 23811, + 23812, + 23813, + 23816, + 23851, + 23868, + 23870, + 23880, + 23882, + 23883, + 23885, + 23887, + 23888, + 23891, + 23892, + 23893, + 23895, + 23897, + 23903, + 23905, + 23910, + 23920, + 23922, + 23923, + 23933, + 23935, + 23942, + 23943, + 23953, + 23955, + 24007, + 24008, + 24009, + 24024, + 24025, + 24027, + 24028, + 24029, + 24030, + 24031, + 24039, + 24040, + 24064, + 24066, + 24067, + 24068, + 24069, + 24070, + 24079, + 24085, + 24086, + 24087, + 24099, + 24150, + 24151, + 24153, + 24163, + 24165, + 24166, + 24167, + 24169, + 24170, + 24182, + 24184, + 24207, + 24209, + 24210, + 24211, + 24212, + 24213, + 24222, + 24251, + 24286, + 24287, + 24292, + 24306, + 24307, + 24309, + 24310, + 24311, + 24312, + 24313, + 24320, + 24321, + 24326, + 24352, + 24354, + 24360, + 24361, + 24363, + 24364, + 24368, + 24372, + 24377, + 24381, + 24382, + 24383, + 24395, + 24400, + 24402, + 24440, + 24442, + 24443, + 24445, + 24447, + 24448, + 24459, + 24462, + 24463, + 24479, + 24480, + 24516, + 24518, + 24521, + 24523, + 24524, + 24525, + 24536, + 24539, + 24540, + 24541, + 24543, + 24555, + 24562, + 24564, + 24602, + 24604, + 24605, + 24607, + 24609, + 24610, + 24620, + 24623, + 24624, + 24658, + 24659, + 24665, + 24666, + 24670, + 24671, + 24707, + 24709, + 24712, + 24714, + 24715, + 24716, + 24726, + 24729, + 24730, + 24731, + 24732, + 24734, + 24748, + 24752, + 24763, + 24764, + 24765, + 24771, + 24772, + 24779, + 24783, + 24851, + 24861, + 24895, + 24899, + 24900, + 24903, + 24926, + 24936, + 24946, + 24948, + 24950, + 24952, + 24954, + 24955, + 24956, + 24957, + 24990, + 25006, + 25013, + 25015, + 25033, + 25035, + 25051, + 25067, + 25069, + 25070, + 25072, + 25075, + 25081, + 25084, + 25085, + 25086, + 25087, + 25088, + 25089, + 25090, + 25092, + 25094, + 25095, + 25099, + 25102, + 25103, + 25148, + 25150, + 25153, + 25156, + 25158, + 25162, + 25166, + 25168, + 25169, + 25170, + 25174, + 25175, + 25176, + 25177, + 25190, + 25193, + 25194, + 25195, + 25196, + 25199, + 25203, + 25253, + 25259, + 25263, + 25265, + 25267, + 25270, + 25273, + 25275, + 25276, + 25277, + 25281, + 25282, + 25283, + 25295, + 25296, + 25307, + 25309, + 25310, + 25312, + 25313, + 25314, + 25316, + 25320, + 25322, + 25323, + 25331, + 25332, + 25335, + 25338, + 25358, + 25361, + 25371, + 25375, + 25377, + 25379, + 25381, + 25393, + 25399, + 25400, + 25402, + 25405, + 25428, + 25429, + 25430, + 25434, + 25435, + 25436, + 25460, + 25464, + 25468, + 25469, + 25473, + 25474, + 25475, + 25484, + 25541, + 25588, + 25591, + 25610, + 25620, + 25625, + 25665, + 25691, + 25700, + 25731, + 25732, + 25742, + 25743, + 25744, + 25745, + 25747, + 25748, + 25752, + 25786, + 25806, + 25808, + 25832, + 25834, + 25851, + 25855, + 25857, + 25858, + 25860, + 25861, + 25863, + 25864, + 25868, + 25870, + 25871, + 25874, + 25883, + 25894, + 25895, + 25900, + 25909, + 25911, + 25920, + 25922, + 25930, + 25932, + 25941, + 25943, + 26001, + 26004, + 26011, + 26012, + 26021, + 26030, + 26034, + 26060, + 26062, + 26088, + 26090, + 26101, + 26106, + 26110, + 26113, + 26116, + 26118, + 26123, + 26124, + 26148, + 26205, + 26208, + 26219, + 26228, + 26236, + 26240, + 26265, + 26266, + 26272, + 26277, + 26278, + 26299, + 26301, + 26316, + 26319, + 26325, + 26328, + 26330, + 26334, + 26336, + 26360, + 26372, + 26374, + 26405, + 26407, + 26424, + 26428, + 26435, + 26438, + 26439, + 26444, + 26480, + 26482, + 26513, + 26515, + 26532, + 26536, + 26543, + 26546, + 26547, + 26550, + 26553, + 26582, + 26594, + 26596, + 26603, + 26625, + 26627, + 26642, + 26646, + 26650, + 26655, + 26662, + 26787, + 26899, + 26935, + 26939, + 26940, + 26943, + 26965, + 26984, + 26986, + 26988, + 26989, + 26990, + 26991, + 26992, + 27036, + 27037, + 27059, + 27061, + 27093, + 27095, + 27097, + 27101, + 27106, + 27107, + 27108, + 27109, + 27110, + 27111, + 27112, + 27113, + 27115, + 27117, + 27118, + 27121, + 27125, + 27295, + 27296, + 27311, + 27353, + 27355, + 27379, + 27380, + 27388, + 27390, + 27399, + 27404, + 27405, + 27406, + 27407, + 27410, + 27519, + 27639, + 27676, + 27679 + ], + "coefficient_census": { + "-2": 771, + "-3": 43, + "2": 572, + "3": 38 + }, + "phase_census": { + "A": 40, + "B": 153, + "full_frame_cleanup": 1231 + }, + "frame_census": { + "0": 39, + "1": 1231, + "1001": 2, + "1007": 2, + "1013": 2, + "1019": 2, + "1025": 2, + "1031": 2, + "2": 3, + "3": 1, + "423": 6, + "430": 6, + "431": 6, + "432": 6, + "437": 6, + "822": 2, + "824": 2, + "826": 2, + "828": 2, + "830": 2, + "832": 2, + "834": 2, + "836": 2, + "838": 2, + "840": 2, + "842": 2, + "844": 2, + "846": 2, + "848": 2, + "850": 2, + "852": 2, + "854": 2, + "856": 2, + "858": 2, + "860": 2, + "862": 2, + "864": 2, + "902": 1, + "903": 1, + "905": 2, + "906": 1, + "907": 1, + "908": 1, + "909": 1, + "911": 2, + "912": 1, + "913": 1, + "914": 1, + "915": 1, + "917": 2, + "918": 1, + "919": 1, + "920": 1, + "921": 1, + "923": 2, + "924": 1, + "925": 1, + "926": 1, + "927": 1, + "929": 2, + "930": 1, + "931": 1, + "932": 1, + "933": 1, + "935": 2, + "936": 1, + "937": 1, + "938": 1, + "939": 1, + "941": 2, + "942": 1, + "943": 1, + "944": 1, + "945": 1, + "947": 2, + "948": 1, + "949": 1, + "953": 2, + "959": 2, + "965": 2, + "971": 2, + "977": 2, + "983": 2, + "989": 2, + "995": 2 + }, + "paid_profile": { + "1": 2512, + "2": 400, + "3": 448, + "4": 160, + "5": 70, + "6": 8, + "8": 8 + }, + "retained_nonscalar_sha256": "bd1e5e7700469f06100d7580e064a6524658931785359e6c9fe6429425b4a47b", + "baseline": { + "real_primitives": 200380, + "primitive_counts": { + "add": 29050, + "clear": 44454, + "copy": 32008, + "double": 32576, + "halve": 39438, + "negate": 692, + "subtract": 22162 + }, + "real_macro_source_reads": 51228, + "real_operand_reads": 207138, + "maximum_denominator_depth": 4, + "maximum_row_l1": "503316465", + "stream_sha256": "65af87a53b40699f2711182819179af1820be741474b291009c4f5567921bf56" + }, + "candidate": { + "real_primitives": 197532, + "primitive_counts": { + "add": 30184, + "clear": 44454, + "copy": 29160, + "double": 29728, + "halve": 39438, + "negate": 692, + "subtract": 23876 + }, + "real_macro_source_reads": 54076, + "real_operand_reads": 207138, + "maximum_denominator_depth": 4, + "maximum_row_l1": "503316465", + "stream_sha256": "7bdb65c4f8f605989b00e2c43b74efded1bda6428b1c393340947580c267f34e" + }, + "saved_real_primitives": 2848 + }, + "backward": { + "events": 27909, + "macros": 22693, + "exact_input_columns": 725, + "dirty_helpers_restored": 492, + "private_registers_cleared": 9, + "changed_macros": 1424, + "changed_event_indices": [ + 9688, + 9689, + 9690, + 9691, + 9709, + 9710, + 9724, + 9725, + 9744, + 9749, + 9780, + 9785, + 9816, + 9821, + 9849, + 9852, + 9853, + 9887, + 9890, + 9891, + 9925, + 9928, + 9929, + 9963, + 9966, + 9967, + 10001, + 10004, + 10005, + 10037, + 10038, + 10039, + 10056, + 10057, + 10058, + 10075, + 10076, + 10077, + 10078, + 10140, + 13477, + 13592, + 13594, + 13612, + 13614, + 13703, + 13705, + 13831, + 13832, + 13873, + 13874, + 13877, + 13878, + 13880, + 13881, + 13889, + 13890, + 13893, + 13894, + 13896, + 13897, + 13905, + 13906, + 13909, + 13910, + 13912, + 13913, + 13985, + 13986, + 13989, + 13990, + 13992, + 13993, + 16494, + 16499, + 16502, + 16509, + 16512, + 16517, + 16520, + 16525, + 16528, + 16533, + 16536, + 16543, + 16546, + 16551, + 16554, + 16559, + 16562, + 16567, + 16570, + 16577, + 16580, + 16585, + 16588, + 16593, + 16596, + 16601, + 16604, + 16611, + 16614, + 16619, + 16622, + 16627, + 16630, + 16635, + 16638, + 16645, + 16648, + 16653, + 16656, + 16661, + 16664, + 16669, + 16672, + 16679, + 16682, + 16687, + 16690, + 16695, + 16698, + 16703, + 16706, + 16713, + 16716, + 16721, + 16724, + 16729, + 16732, + 16737, + 16740, + 16747, + 16750, + 16755, + 16758, + 16763, + 16771, + 16781, + 16789, + 16797, + 16805, + 16815, + 16823, + 16831, + 16839, + 16849, + 16857, + 16865, + 16873, + 16883, + 16891, + 16899, + 16907, + 16917, + 16925, + 16933, + 16941, + 16951, + 16959, + 16967, + 16975, + 16985, + 16993, + 17001, + 17009, + 17019, + 17027, + 17035, + 17043, + 17053, + 17061, + 17069, + 17077, + 17087, + 17095, + 17103, + 17111, + 17121, + 17129, + 17137, + 17145, + 17155, + 17163, + 17171, + 17179, + 17189, + 17197, + 17205, + 17213, + 17223, + 17231, + 17239, + 18682, + 18693, + 18701, + 18723, + 18731, + 18753, + 18758, + 18763, + 18768, + 18840, + 18843, + 18847, + 18849, + 18852, + 18855, + 18915, + 18916, + 18925, + 18936, + 18948, + 18954, + 18957, + 19028, + 19029, + 19030, + 19032, + 19033, + 19034, + 19036, + 19037, + 19038, + 19045, + 19046, + 19047, + 19049, + 19050, + 19051, + 19053, + 19054, + 19055, + 19062, + 19063, + 19064, + 19066, + 19067, + 19068, + 19070, + 19071, + 19072, + 19079, + 19080, + 19081, + 19083, + 19084, + 19085, + 19087, + 19088, + 19089, + 19225, + 19234, + 19235, + 19236, + 19239, + 19249, + 19250, + 19253, + 19259, + 19274, + 19278, + 19305, + 19307, + 19308, + 19310, + 19321, + 19322, + 19324, + 19328, + 19335, + 19340, + 19351, + 19358, + 19364, + 19373, + 19409, + 19421, + 19422, + 19423, + 19424, + 19425, + 19426, + 19433, + 19434, + 19441, + 19481, + 19494, + 19496, + 19497, + 19498, + 19499, + 19500, + 19502, + 19515, + 19517, + 19518, + 19519, + 19522, + 19523, + 19535, + 19536, + 19539, + 19541, + 19544, + 19551, + 19560, + 19561, + 19562, + 19569, + 19579, + 19580, + 19590, + 19598, + 19609, + 19624, + 19627, + 19628, + 19629, + 19643, + 19647, + 19658, + 19661, + 19662, + 19663, + 19664, + 19665, + 19690, + 19692, + 19704, + 19716, + 19726, + 19734, + 19739, + 19740, + 19741, + 19742, + 19743, + 19746, + 19763, + 19764, + 19770, + 19772, + 19780, + 19782, + 19786, + 19790, + 19798, + 19799, + 19800, + 19803, + 19804, + 19821, + 19822, + 19823, + 19824, + 19825, + 19826, + 19829, + 19831, + 19842, + 19864, + 19866, + 19867, + 19868, + 19869, + 19870, + 19873, + 19877, + 19888, + 19896, + 19897, + 19899, + 19900, + 19902, + 19903, + 19908, + 19910, + 19912, + 19914, + 19915, + 19916, + 19920, + 19922, + 19948, + 19949, + 19974, + 19975, + 19980, + 19992, + 20000, + 20001, + 20002, + 20003, + 20005, + 20006, + 20007, + 20015, + 20016, + 20017, + 20018, + 20019, + 20035, + 20037, + 20039, + 20041, + 20042, + 20043, + 20046, + 20048, + 20057, + 20063, + 20079, + 20090, + 20094, + 20101, + 20103, + 20138, + 20139, + 20140, + 20141, + 20142, + 20178, + 20179, + 20180, + 20214, + 20263, + 20265, + 20266, + 20267, + 20305, + 20341, + 20346, + 20364, + 20371, + 20373, + 20377, + 20378, + 20379, + 20380, + 20386, + 20387, + 20398, + 20413, + 20416, + 20426, + 20435, + 20437, + 20438, + 20446, + 20449, + 20456, + 20457, + 20458, + 20459, + 20464, + 20466, + 20468, + 20469, + 20470, + 20471, + 20473, + 20477, + 20482, + 20487, + 20493, + 20496, + 20497, + 20506, + 20509, + 20510, + 20514, + 20516, + 20517, + 20523, + 20526, + 20527, + 20528, + 20529, + 20536, + 20545, + 20598, + 20599, + 20602, + 20603, + 20617, + 20620, + 20621, + 20629, + 20630, + 20636, + 20660, + 20680, + 20687, + 20689, + 20691, + 20694, + 20696, + 20698, + 20699, + 20706, + 20709, + 20710, + 20715, + 20719, + 20723, + 20728, + 20730, + 20731, + 20736, + 20737, + 20740, + 20742, + 20743, + 20751, + 20761, + 20775, + 20776, + 20777, + 20781, + 20784, + 20786, + 20787, + 20789, + 20790, + 20791, + 20792, + 20794, + 20795, + 20802, + 20804, + 20809, + 20820, + 20822, + 20826, + 20838, + 20860, + 20916, + 20924, + 20929, + 20944, + 20948, + 20949, + 20953, + 20977, + 20987, + 20991, + 20992, + 21014, + 21017, + 21051, + 21064, + 21069, + 21070, + 21072, + 21073, + 21084, + 21120, + 21122, + 21125, + 21126, + 21128, + 21131, + 21154, + 21158, + 21195, + 21197, + 21199, + 21201, + 21208, + 21233, + 21246, + 21248, + 21254, + 21286, + 21288, + 21294, + 21361, + 21370, + 21377, + 21378, + 21380, + 21394, + 21396, + 21399, + 21404, + 21407, + 21409, + 21418, + 21433, + 21439, + 21443, + 21448, + 21450, + 21466, + 21478, + 21479, + 21496, + 21536, + 21545, + 21547, + 21556, + 21558, + 21559, + 21563, + 21571, + 21576, + 21579, + 21590, + 21596, + 21598, + 21603, + 21608, + 21625, + 21626, + 21627, + 21628, + 21629, + 21673, + 21710, + 21722, + 21724, + 21753, + 21760, + 21803, + 21821, + 21827, + 21830, + 21832, + 21863, + 21870, + 21912, + 21916, + 21936, + 21954, + 21955, + 21956, + 21957, + 21958, + 21960, + 21969, + 21976, + 21984, + 21988, + 21991, + 21996, + 22028, + 22038, + 22040, + 22043, + 22044, + 22053, + 22054, + 22056, + 22057, + 22058, + 22061, + 22062, + 22065, + 22066, + 22069, + 22070, + 22111, + 22123, + 22125, + 22127, + 22128, + 22130, + 22132, + 22133, + 22134, + 22137, + 22138, + 22139, + 22140, + 22154, + 22155, + 22163, + 22164, + 22165, + 22166, + 22210, + 22212, + 22214, + 22220, + 22226, + 22229, + 22234, + 22236, + 22247, + 22249, + 22252, + 22256, + 22272, + 22273, + 22282, + 22293, + 22310, + 22336, + 22346, + 22347, + 22348, + 22350, + 22352, + 22354, + 22355, + 22357, + 22358, + 22359, + 22360, + 22363, + 22364, + 22365, + 22366, + 22368, + 22370, + 22371, + 22373, + 22375, + 22376, + 22378, + 22379, + 22381, + 22382, + 22385, + 22386, + 22387, + 22390, + 22391, + 22393, + 22394, + 22396, + 22397, + 22399, + 22400, + 22401, + 22407, + 22408, + 22409, + 22411, + 22415, + 22434, + 22435, + 22437, + 22438, + 22445, + 22452, + 22462, + 22463, + 22470, + 22471, + 22472, + 22479, + 22480, + 22511, + 22527, + 22536, + 22538, + 22544, + 22546, + 22551, + 22552, + 22558, + 22559, + 22560, + 22561, + 22562, + 22564, + 22565, + 22568, + 22608, + 22618, + 22625, + 22627, + 22628, + 22632, + 22634, + 22636, + 22637, + 22638, + 22639, + 22641, + 22642, + 22643, + 22650, + 22652, + 22653, + 22656, + 22663, + 22664, + 22712, + 22717, + 22718, + 22720, + 22734, + 22756, + 22760, + 22771, + 22777, + 22815, + 22817, + 22825, + 22827, + 22844, + 22853, + 22854, + 22857, + 22870, + 22871, + 22872, + 22874, + 22877, + 22878, + 22879, + 22882, + 22883, + 22903, + 22917, + 22918, + 22919, + 22920, + 22921, + 22922, + 22926, + 22953, + 22957, + 22959, + 22990, + 22994, + 22995, + 22997, + 23001, + 23005, + 23014, + 23018, + 23019, + 23020, + 23023, + 23024, + 23025, + 23026, + 23027, + 23028, + 23030, + 23039, + 23063, + 23067, + 23068, + 23070, + 23074, + 23078, + 23087, + 23088, + 23089, + 23090, + 23091, + 23093, + 23095, + 23096, + 23097, + 23105, + 23106, + 23107, + 23108, + 23109, + 23112, + 23113, + 23114, + 23118, + 23123, + 23127, + 23137, + 23138, + 23139, + 23140, + 23141, + 23188, + 23197, + 23205, + 23252, + 23269, + 23291, + 23292, + 23309, + 23310, + 23312, + 23313, + 23314, + 23316, + 23319, + 23327, + 23328, + 23330, + 23331, + 23332, + 23348, + 23352, + 23362, + 23363, + 23369, + 23371, + 23372, + 23383, + 23384, + 23385, + 23418, + 23431, + 23435, + 23436, + 23447, + 23449, + 23452, + 23453, + 23454, + 23455, + 23456, + 23459, + 23460, + 23461, + 23463, + 23465, + 23469, + 23470, + 23471, + 23472, + 23473, + 23481, + 23485, + 23486, + 23488, + 23489, + 23493, + 23494, + 23504, + 23506, + 23513, + 23514, + 23524, + 23526, + 23553, + 23598, + 23649, + 23655, + 23658, + 23660, + 23661, + 23663, + 23668, + 23685, + 23686, + 23709, + 23710, + 23726, + 23727, + 23732, + 23738, + 23741, + 23743, + 23744, + 23746, + 23748, + 23765, + 23766, + 23767, + 23768, + 23772, + 23774, + 23806, + 23807, + 23808, + 23809, + 23811, + 23812, + 23813, + 23816, + 23851, + 23868, + 23870, + 23880, + 23882, + 23883, + 23885, + 23887, + 23888, + 23891, + 23892, + 23893, + 23895, + 23897, + 23903, + 23905, + 23910, + 23920, + 23922, + 23923, + 23933, + 23935, + 23942, + 23943, + 23953, + 23955, + 24007, + 24008, + 24009, + 24024, + 24025, + 24027, + 24028, + 24029, + 24030, + 24031, + 24039, + 24040, + 24064, + 24066, + 24067, + 24068, + 24069, + 24070, + 24079, + 24085, + 24086, + 24087, + 24099, + 24150, + 24151, + 24153, + 24163, + 24165, + 24166, + 24167, + 24169, + 24170, + 24182, + 24184, + 24207, + 24209, + 24210, + 24211, + 24212, + 24213, + 24222, + 24251, + 24286, + 24287, + 24292, + 24306, + 24307, + 24309, + 24310, + 24311, + 24312, + 24313, + 24320, + 24321, + 24326, + 24352, + 24354, + 24360, + 24361, + 24363, + 24364, + 24368, + 24372, + 24377, + 24381, + 24382, + 24383, + 24395, + 24400, + 24402, + 24440, + 24442, + 24443, + 24445, + 24447, + 24448, + 24459, + 24462, + 24463, + 24479, + 24480, + 24516, + 24518, + 24521, + 24523, + 24524, + 24525, + 24536, + 24539, + 24540, + 24541, + 24543, + 24555, + 24562, + 24564, + 24602, + 24604, + 24605, + 24607, + 24609, + 24610, + 24620, + 24623, + 24624, + 24658, + 24659, + 24665, + 24666, + 24670, + 24671, + 24707, + 24709, + 24712, + 24714, + 24715, + 24716, + 24726, + 24729, + 24730, + 24731, + 24732, + 24734, + 24748, + 24752, + 24763, + 24764, + 24765, + 24771, + 24772, + 24779, + 24783, + 24851, + 24861, + 24895, + 24899, + 24900, + 24903, + 24926, + 24936, + 24946, + 24948, + 24950, + 24952, + 24954, + 24955, + 24956, + 24957, + 24990, + 25006, + 25013, + 25015, + 25033, + 25035, + 25051, + 25067, + 25069, + 25070, + 25072, + 25075, + 25081, + 25084, + 25085, + 25086, + 25087, + 25088, + 25089, + 25090, + 25092, + 25094, + 25095, + 25099, + 25102, + 25103, + 25148, + 25150, + 25153, + 25156, + 25158, + 25162, + 25166, + 25168, + 25169, + 25170, + 25174, + 25175, + 25176, + 25177, + 25190, + 25193, + 25194, + 25195, + 25196, + 25199, + 25203, + 25253, + 25259, + 25263, + 25265, + 25267, + 25270, + 25273, + 25275, + 25276, + 25277, + 25281, + 25282, + 25283, + 25295, + 25296, + 25307, + 25309, + 25310, + 25312, + 25313, + 25314, + 25316, + 25320, + 25322, + 25323, + 25331, + 25332, + 25335, + 25338, + 25358, + 25361, + 25371, + 25375, + 25377, + 25379, + 25381, + 25393, + 25399, + 25400, + 25402, + 25405, + 25428, + 25429, + 25430, + 25434, + 25435, + 25436, + 25460, + 25464, + 25468, + 25469, + 25473, + 25474, + 25475, + 25484, + 25541, + 25588, + 25591, + 25610, + 25620, + 25625, + 25665, + 25691, + 25700, + 25731, + 25732, + 25742, + 25743, + 25744, + 25745, + 25747, + 25748, + 25752, + 25786, + 25806, + 25808, + 25832, + 25834, + 25851, + 25855, + 25857, + 25858, + 25860, + 25861, + 25863, + 25864, + 25868, + 25870, + 25871, + 25874, + 25883, + 25894, + 25895, + 25900, + 25909, + 25911, + 25920, + 25922, + 25930, + 25932, + 25941, + 25943, + 26001, + 26004, + 26011, + 26012, + 26021, + 26030, + 26034, + 26060, + 26062, + 26088, + 26090, + 26101, + 26106, + 26110, + 26113, + 26116, + 26118, + 26123, + 26124, + 26148, + 26205, + 26208, + 26219, + 26228, + 26236, + 26240, + 26265, + 26266, + 26272, + 26277, + 26278, + 26299, + 26301, + 26316, + 26319, + 26325, + 26328, + 26330, + 26334, + 26336, + 26360, + 26372, + 26374, + 26405, + 26407, + 26424, + 26428, + 26435, + 26438, + 26439, + 26444, + 26480, + 26482, + 26513, + 26515, + 26532, + 26536, + 26543, + 26546, + 26547, + 26550, + 26553, + 26582, + 26594, + 26596, + 26603, + 26625, + 26627, + 26642, + 26646, + 26650, + 26655, + 26662, + 26787, + 26899, + 26935, + 26939, + 26940, + 26943, + 26965, + 26984, + 26986, + 26988, + 26989, + 26990, + 26991, + 26992, + 27036, + 27037, + 27059, + 27061, + 27093, + 27095, + 27097, + 27101, + 27106, + 27107, + 27108, + 27109, + 27110, + 27111, + 27112, + 27113, + 27115, + 27117, + 27118, + 27121, + 27125, + 27295, + 27296, + 27311, + 27353, + 27355, + 27379, + 27380, + 27388, + 27390, + 27399, + 27404, + 27405, + 27406, + 27407, + 27410, + 27519, + 27639, + 27676, + 27679 + ], + "coefficient_census": { + "-2": 572, + "-3": 38, + "2": 771, + "3": 43 + }, + "phase_census": { + "A": 40, + "B": 153, + "full_frame_cleanup": 1231 + }, + "frame_census": { + "0": 39, + "1": 1231, + "1001": 2, + "1007": 2, + "1013": 2, + "1019": 2, + "1025": 2, + "1031": 2, + "2": 3, + "3": 1, + "423": 6, + "430": 6, + "431": 6, + "432": 6, + "437": 6, + "822": 2, + "824": 2, + "826": 2, + "828": 2, + "830": 2, + "832": 2, + "834": 2, + "836": 2, + "838": 2, + "840": 2, + "842": 2, + "844": 2, + "846": 2, + "848": 2, + "850": 2, + "852": 2, + "854": 2, + "856": 2, + "858": 2, + "860": 2, + "862": 2, + "864": 2, + "902": 1, + "903": 1, + "905": 2, + "906": 1, + "907": 1, + "908": 1, + "909": 1, + "911": 2, + "912": 1, + "913": 1, + "914": 1, + "915": 1, + "917": 2, + "918": 1, + "919": 1, + "920": 1, + "921": 1, + "923": 2, + "924": 1, + "925": 1, + "926": 1, + "927": 1, + "929": 2, + "930": 1, + "931": 1, + "932": 1, + "933": 1, + "935": 2, + "936": 1, + "937": 1, + "938": 1, + "939": 1, + "941": 2, + "942": 1, + "943": 1, + "944": 1, + "945": 1, + "947": 2, + "948": 1, + "949": 1, + "953": 2, + "959": 2, + "965": 2, + "971": 2, + "977": 2, + "983": 2, + "989": 2, + "995": 2 + }, + "paid_profile": { + "1": 2512, + "2": 400, + "3": 448, + "4": 160, + "5": 70, + "6": 8, + "8": 8 + }, + "retained_nonscalar_sha256": "f6d942e0ed78b1df58bc5e9b5f313b96385ab10ec315feff237fcbe11b755622", + "baseline": { + "real_primitives": 200396, + "primitive_counts": { + "add": 29176, + "clear": 44470, + "copy": 31992, + "double": 32576, + "halve": 39438, + "negate": 692, + "subtract": 22052 + }, + "real_macro_source_reads": 51228, + "real_operand_reads": 207154, + "maximum_denominator_depth": 27, + "maximum_row_l1": "1469388997/2", + "stream_sha256": "8a1f3a16f146088e72c4a3decf0f967ff449b58a3521a86c3ee5c60d8abc5e75" + }, + "candidate": { + "real_primitives": 197548, + "primitive_counts": { + "add": 30728, + "clear": 44470, + "copy": 29144, + "double": 29728, + "halve": 39438, + "negate": 692, + "subtract": 23348 + }, + "real_macro_source_reads": 54076, + "real_operand_reads": 207154, + "maximum_denominator_depth": 27, + "maximum_row_l1": "1469388997/2", + "stream_sha256": "56f4f3f3172b48a2e56271f9772adcf665479418d3e579e060d474d5f27fdf77" + }, + "saved_real_primitives": 2848 + } + }, + "local_controls": { + "positive_words": { + "3": { + "cost": 4, + "source_reads": 3, + "columns": 3 + }, + "-3": { + "cost": 4, + "source_reads": 3, + "columns": 3 + }, + "2": { + "cost": 3, + "source_reads": 2, + "columns": 3 + }, + "-2": { + "cost": 3, + "source_reads": 2, + "columns": 3 + } + }, + "equivalent_early_clears": 4, + "reduced_coefficient_positives": 4, + "rejections": { + "missing_clear": "endpoint or dirt", + "missing_repeat": "endpoint or dirt", + "wrong_sign": "endpoint or dirt", + "private_dirt_read": "endpoint or dirt", + "clear_source": "source mutation", + "restore_source_after_mutation": "source mutation", + "endpoint_neutral_grid_excursion": "fractional excursion", + "endpoint_neutral_growth": "magnitude excursion", + "uncharged_clear": "unpaid instruction", + "source_target_alias": "invalid macro rejected by retained PR696 validation", + "work_alias": "invalid macro rejected by retained PR696 validation", + "zero": "invalid macro rejected by retained PR696 validation", + "nondyadic": "invalid macro rejected by retained PR696 validation" + } + } +} diff --git a/research/jp8-direct-small-integers/HANDOFF.md b/research/jp8-direct-small-integers/HANDOFF.md new file mode 100644 index 0000000000..aff41abc8e --- /dev/null +++ b/research/jp8-direct-small-integers/HANDOFF.md @@ -0,0 +1,64 @@ +# Review handoff + +Status: **finite complex-supplier construction; no new kappa**. + +Base: `007664306fff84fbb1c9a1b4053b69f439764034`. +Published branch: `zewelor/integer-mult-bounds:research/jp8-direct-small-integers-seed29`. +Scope: only `research/jp8-direct-small-integers/`. + +The completed result replaces all historical PR626 JP8 coefficients ±2/±3 +with direct target accumulation and a paid work clear. Counts fall by 2,848 +real primitives in each orientation, with exact scalar boundary, dirty-input, +prefix, grid, source-access and unchanged-paid-profile evidence. + +Clone the published contribution and record the reviewed head: + +```sh +git clone --single-branch --branch research/jp8-direct-small-integers-seed29 https://github.com/zewelor/integer-mult-bounds.git jp8-review +cd jp8-review +git rev-parse HEAD +python3 -I -O -B research/jp8-direct-small-integers/verify.py +python3 -I -O -B research/jp8-direct-small-integers/test_package.py +python3 -I -O -B research/jp8-direct-small-integers/recheck_fraction.py +``` + +Expected: `PASS_JP8_DIRECT_SMALL_INTEGERS macros=1424+1424 saved=2848/2848 columns=725 no_new_kappa`, six passing tests, and +`PASS_JP8_FRACTION_RECHECK all_program_receipt_fields=equal no_new_kappa`. + +Original patch validation: a fresh temporary Git index based at the exact base +accepted the initial patch and produced the same tree as that contribution. A minimal +export from that Git tree (this package plus its six pinned inputs) passed the +optimized isolated verifier without Git or network access. Python syntax, +JSON parsing and staged whitespace checks also passed. + +Suggested PR title: +**Finite complex construction: direct JP8 integer updates save 2,848 primitives per orientation (no new kappa)**. + +The patch is ready for an independently scoped review; production adoption is +separate. Read `README.md` for the proof, complete cost/access comparisons, +predecessor credit and unresolved physical/compiler/analytic obligations. +`EXPECTED.json` is the exact finite certificate; `SOURCES.json` pins all six +consumed inputs; `VALIDATION.md` records executed checks. + +Publication resumed after the contributor created `zewelor/integer-mult-bounds`. +The result is published on `research/jp8-direct-small-integers-seed29` in that +writable fork, preserving the exact research base. The contributor opened +[PR1223](https://github.com/CrocSwap/integer-mult-bounds/pull/1223) after the +integration's create-PR attempt returned HTTP 403. The former patch-only handoff +is superseded by the published branch and PR. +No pinned coordination issue existed, so the claim is recorded locally. +Refreshed upstream main is `1b59b624d21924f8e3537cdc1ac52d3be6eda2fe`; all six +consumed inputs are unchanged. Related PR999/1036/1064 are credited and the +additional JP8 scope is explained in `README.md` and `OVERLAP.json`. + +A requested second audit checked the published head +`86381e9adf3c9d1e958cca4d53fec15254190434` (tree +`0166b06587244338e81d81635892e5cff7ecd12e`) and added the complete Fraction +interpreter. The original lowering and `EXPECTED.json` are unchanged. +All six source payloads also match refreshed main +`49b3157d1d89adcef16df8be98445451672be5ba`. Repeated validation is recorded in +`VALIDATION.md`; hosted workflows were awaiting maintainer action at that audit. + +Prepared by Michał Ciemięga (@zewelor), with substantial OpenAI Codex assistance. +Apache-2.0. No independent human review, full multiplication proof, global +invoice/assembly run, or new kappa is claimed. diff --git a/research/jp8-direct-small-integers/OVERLAP.json b/research/jp8-direct-small-integers/OVERLAP.json new file mode 100644 index 0000000000..bf90817756 --- /dev/null +++ b/research/jp8-direct-small-integers/OVERLAP.json @@ -0,0 +1,166 @@ +{ + "initial_inventory_count": 703, + "initial_highest_pr": 949, + "final_refreshed_utc": "2026-10-13T14:39:16.143203+00:00", + "refreshed_main": "007664306fff84fbb1c9a1b4053b69f439764034", + "recent_pr_count": 100, + "new_or_changed": [ + { + "number": 957, + "title": "Adversarial audit: frontier890 endpoint certification, reduction and surcharge stakes (no new kappa)", + "head": "65c931415587c444a7a1f48939842c4cf0aa0411" + }, + { + "number": 956, + "title": "Research: close the PR390 heterogeneous physical provider in exact RAM", + "head": "25b32f59d18abbe676dba3e55359b0728f9e5a63" + }, + { + "number": 955, + "title": "Research: close the eight register words left open by PR800 (no kappa)", + "head": "df668be6f75e76e12d25da5e03eb22ff656aaf86" + }, + { + "number": 952, + "title": "Finite bit construction: whole six-wire synthesis saves 38 further ADDs beyond PR936 (no new kappa)", + "head": "11d24706f06e95271804c9438869546724c67aab" + }, + { + "number": 954, + "title": "Scoped negative result: classify E8's first decoder rank drop (no new kappa)", + "head": "a98219aa708e1bd2ae4ca90e720e66569f7f0147" + }, + { + "number": 953, + "title": "Research construction: optimal dyadic-run BIT query batches (no new kappa)", + "head": "5f052969846b0882ac4e22d9e818dd8ac05ea56f" + }, + { + "number": 951, + "title": "Research: two additive cyclic inverse calls with no dirty connector (no new kappa)", + "head": "de0c8641dcf1a4cd0abde9b897fa946de2bede49" + } + ], + "conclusion": "No overlapping direct small-integer JP8 refinement identified. New arrivals concern endpoints, bit circuits, decoder rank, cyclic inverses or recursive interfaces. This is not a claim of literature priority.", + "ledger_consulted": "docs/research/pr-ledger.md at base: PR696, PR837, PR882, PR883 incorporated; PR355 unreviewed; PR945 pending.", + "related_heads": { + "355": { + "head": "e59117a865452b4562891d80c3d2b154b60cb5cf", + "author": "Dugongue", + "title": "Conditional \u03ba = 8.01967436473393e-4: exact integer-lifted shared donors with E8 (+0.1103% over #352)" + }, + "734": { + "head": "ba76ba3321d000c8996b0b254bcf0d7260e1bbb6", + "author": "AllStars101-sudo", + "title": "Research: prefix-bounded signed-Horner circuits for CK and JP8 (no new kappa)" + }, + "945": { + "head": "a3245bf22fa2a2eb778b11128cbc605b130d737f", + "author": "RossRichardson", + "title": "Finite construction: joint Horner saves 13,072 PR799 backward primitives (no new kappa)" + }, + "949": { + "head": "102ddfb47d11c8ad66121350907d4a2cc04cea8c", + "author": "RossRichardson", + "title": "Scoped negative result: exact 73-primitive factory scale optimum (no new kappa)" + }, + "924": { + "head": "d02d83332581f6a23616c1366c6b3901d42f4b06", + "author": "CubeJerry", + "title": "Research: compose PR922 factory fusions with PR924 rescaling" + }, + "876": { + "head": "0d8d4be2b8093e809c4c422849c486532f6ee1c1", + "author": "navinor", + "title": "Scoped negative result: simultaneous full pair/triple exchanges do not beat SW4 (seed 29)" + }, + "937": { + "head": "b303fed6dfe2066dcd78c0d8ed74d2a3b153ba72", + "author": "RossRichardson", + "title": "Finite complex construction: two center shears save 5,562 primitives per invocation (no new kappa)" + }, + "947": { + "head": "b6f6418bdcae748b267cea72a5949d551feb7bb2", + "author": "RossRichardson", + "title": "Scoped negative result: exact constant-row center shear optimum (no new kappa)" + } + }, + "publication_refresh": { + "time": "2026-10-13T20:15:47.802916+00:00", + "open_prs": 821, + "page_sizes": [ + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 100, + 21, + 0, + 0, + 0 + ], + "main": "1b59b624d21924f8e3537cdc1ac52d3be6eda2fe", + "current_selected_kappa": "0.001672660197076918", + "consumed_inputs": "All six unchanged relative to the exact research base.", + "related": [ + { + "number": 999, + "title": "Research: bounded target accumulation saves additional complex primitives (no new kappa)", + "head": "fd38a824adb3a5c60c101a86c950a6d590454adf", + "author": "ZK-Snarky" + }, + { + "number": 1036, + "title": "Research: exact two-register CK coefficient frontier (no new kappa)", + "head": "c4ad801099d0813ffac56f0b517a908cd8ae0c6a", + "author": "bbMisk" + }, + { + "number": 1064, + "title": "Construction: complete complex factory lowering from 44 to 38 paid primitives", + "head": "b0181971c2364744d1dd9b0c2d4ee1ea532b8bb6", + "author": "aliromman" + }, + { + "number": 1118, + "title": "Finite complex construction: CK grid-preserving circuits save 1,310 per orientation (no new kappa)", + "head": "82575f429d817f1730c28537e669e56a8016e3a7", + "author": "ToikY" + }, + { + "number": 1145, + "title": "Scoped negative result: scratch-free CK/JP8 boundaries need extra primitives", + "head": "fd4d5ffc448361297e717aa30eafed578caf8e61", + "author": "RossRichardson" + } + ], + "conclusion": "PR1036 checks the same direct integer mechanism on CK. This independently implemented package adds full JP8 coverage. PR999 retains PR696 Horner at +/-2 and +/-3; a pinned isolated comparator check reproduced costs4/5 versus this package3/4. No unrestricted novelty or composed global saving claimed.", + "pr999_targeted_replay": { + "head": "fd38a824adb3a5c60c101a86c950a6d590454adf", + "git_blob": "e3cbf7be8ff28e693b427a35f67d5adabf310ca2", + "code_sha256": "5eb72cb67292ab2c8870814ae7e1e4d25d04c2188c88088ef3933be8cc8e1b0b", + "coefficients": [ + 2, + 3, + -2, + -3 + ], + "chosen_method": [ + "horner", + "horner", + "horner", + "horner" + ], + "costs": [ + 4, + 5, + 4, + 5 + ], + "scope": "Targeted code replay only; not a full PR999 package audit. No pending code is a package replay dependency." + } + } +} diff --git a/research/jp8-direct-small-integers/README.md b/research/jp8-direct-small-integers/README.md new file mode 100644 index 0000000000..dfdb677ebf --- /dev/null +++ b/research/jp8-direct-small-integers/README.md @@ -0,0 +1,248 @@ +# Direct small-integer JP8 accumulation + +**Finite complex-supplier circuit construction; no new kappa.** Replace only +historical PR626 JP8 addition macros with reduced coefficients ±2 and ±3 by +repeated signed unit additions into the target, followed by the existing paid +coefficient-work clear. This saves **2,848 real-component primitives in each +orientation** without changing a macro boundary or introducing a register. + +| Complete JP8 scalar projection | Accepted PR696 lowering | Candidate | Saved | +| --- | ---: | ---: | ---: | +| Forward | 200,380 | 197,532 | 2,848 | +| Backward / inverse transpose | 200,396 | 197,548 | 2,848 | + +Each orientation replaces all **1,424** eligible macros: 1,343 of magnitude two +and 81 of magnitude three. This is a complete census of two frozen programs, +not a search for a better multiplication exponent. The result improves the +specified PR696 baseline; it does not claim the best scalar bill among all +pending lowerings or compositions. + +## Reproduce + +Python 3.11+ and the standard library, offline, from the repository root: + +```sh +python3 -I -O -B research/jp8-direct-small-integers/verify.py +``` + +Expected: + +```text +PASS_JP8_DIRECT_SMALL_INTEGERS macros=1424+1424 saved=2848/2848 columns=725 no_new_kappa +``` + +The command checks six input pins before loading the reference lowerer, executes +both complete primitive projections, recomputes the occurrence census and every +receipt field, and runs 13 rejection controls. It writes nothing. `--json` +prints the checked receipt. The development option `--write NEW_PATH` creates +a new receipt and refuses existing output. Focused tests: + +```sh +python3 -I -O -B research/jp8-direct-small-integers/test_package.py +``` + +An additional full replay uses `Fraction` coefficients throughout, without +importing the primary interpreter, its row arithmetic or its local controls: + +```sh +python3 -I -O -B research/jp8-direct-small-integers/recheck_fraction.py +``` + +Expected final line: +`PASS_JP8_FRACTION_RECHECK all_program_receipt_fields=equal no_new_kappa`. +This checks all 725 input columns and the entire register state at every one of +the 22,693 scalar macro boundaries in each orientation, recomputes every program +receipt field, and runs seven additional endpoint/prefix/cost mutation controls. +It shares the pinned programs, the two lowerers and the expected receipt with +the first checker; it is a second arithmetic implementation, not independent +human review. See `VALIDATION.md` for the repeated checks and publication pin. + +`EXPECTED.json` is an exact certificate of the finite executions and counts, +including every changed event index, coefficient/frame/phase census, complete +primitive-stream digests, prefix metrics and unchanged paid profiles. +`SOURCES.json` records dependency heads, SHA-256 input pins and committed Git +blob identities. Gzip equality is on the entire decompressed payload; harmless +recompression is accepted. + +## Circuit, proof and complete local cost + +For distinct target T, source S and private work W, let q = sign*m, m in {2,3}. +Use m copies of `T += sign*S`, then `clear W`. After j updates the state is +`(T0 + j*sign*S0, S0, W0)`, by induction on j. Clearing W therefore gives +exactly `(T0 + q*S0, S0, 0)` for arbitrary incoming values, including dirty W. +The source is never written. Both signs and both scalar orientations use the +same argument. The real and imaginary components are executed separately. + +| Per real component | PR696 | Candidate | Source reads, old → new | +| --- | ---: | ---: | ---: | +| m = 2 | copy, double, accumulate, clear: 4 | two additions, clear: 3 | 1 → 2 | +| m = 3 | copy, double, source-add, accumulate, clear: 5 | three additions, clear: 4 | 2 → 3 | + +Every repeated source access is an explicitly charged addition; the final clear +remains even when W happens to be clean. There are no preparation, source +restoration, new helper, copy, frame transition or recursive-child instructions +in the replacement. Unchanged work outside these macros is recounted in full. +Savings are `2*(1343+81)=2848`, including both real components. Macro-source +reads rise **51,228 → 54,076** per orientation. All arithmetic operand reads +remain **207,138 forward / 207,154 backward**, because target/source reads +replace coefficient-work reads. These are instruction-access counts, not a +measurement of physical memory traffic or wall-clock speed. + +The original macros, event order, frame IDs, helpers, copies and recursive +profile remain fixed. Each emitted primitive uses its enclosing macro's frame. +The inherited paid profile is +`{1:2512, 2:400, 3:448, 4:160, 5:70, 6:8, 8:8}`. +The historical controller's paid recurrence and outer assembly are not changed +or repriced. No saving in their exponents follows from this local scalar bill. +A production integration must bind the new lowering and rebuild the complete +physical invoice; this package does not silently replace that certificate. + +## Prefix and precision argument + +For any input vector and any norm, each intermediate target is the convex +combination + +`T_j = (1-j/m)*T_0 + (j/m)*(T_0 + q*S_0)`. + +Its norm is at most the larger target endpoint norm. Both endpoint values +occur in the old execution. The source stays fixed. Work retains its incoming +value until the paid clear; that value also occurs at the old entrance. Thus +the maximum over registers and prefixes cannot exceed the PR696 maximum. +This argument permits correlated inputs and does not assume sign cancellation +in a positive majorant. With a triangle envelope, the successive target bounds +are A+jB ≤ A+mB, exactly the old final target bound. No new prefix allocation +is needed. + +All new operations are integral additions or clearing. Each intermediate row +stays on the common dyadic grid of the entrance target and source, both of +which are present in the old trace. This preserves the global maximum +fractional depth, even if cancellation makes a particular exit row integral. +It does not by itself prove the full rounded physical implementation. + +The complete exact scalar replay confirms unchanged maximum row-l1 norms +**503,316,465 forward / 1,469,388,997/2 backward**, and unchanged maximum +denominator depths **4 / 27**. These stay within the retained historical +positive envelopes (64 / 101 bits, charged allocation 192 bits). Those physical +allocations are retained, not reduced based on exact-coordinate measurements. + +## Verification boundary + +The primary checker executes primitive instructions on sparse integer rows +with exact power-of-two denominators. A separate direct macro oracle checks +every target and work boundary; allowed-write checks and induction cover the +unchanged registers. Complete endpoints are also checked against the expected +forward and inverse-transpose shears on all **716 logical + 9 private input +columns**. All **492 dirty helpers** restore, and all nine private cells clear. + +A separate dense Fraction-matrix interpreter checks the four changed signed +coefficient maps on arbitrary T/S/W columns. Thirteen adverse controls reject +missing repetition/clearing, wrong signs, dirty-work contamination, source +mutation, endpoint-neutral magnitude/grid excursions, an unpaid instruction, +and invalid or aliased macros. Early clearing and reduced rational encodings +are accepted as equivalent positives. Package tests check 3,000 sparse arithmetic +operations against Fraction arithmetic, domain preservation, source corruption, +equivalent gzip repacking, optimized offline relocation, typed-receipt +corruption and output preservation. + +The primary primitive and direct-macro all-column engines share row arithmetic. +The dense local checker, bounded Fraction differential checks and the additional +complete `recheck_fraction.py` scalar interpreter check that shared dependency. +The supplemental interpreter uses Fraction-valued rows instead of integer rows +with a shared dyadic denominator; it compares complete register states at each +macro boundary. All implementations were prepared in the same AI-assisted +conversation. No independently implemented complete physical replay is claimed. Non-scalar +frame, phase and wrapper events are preserved and hashed, but not executed by +this scalar checker. The pinned maintainer evidence supplies that ancestry. +Finite linear-map evidence is not formal verification of the full multiplication +theorem. + +## Scope, pins and predecessor credit + +Exact base: **007664306fff84fbb1c9a1b4053b69f439764034**. At this base the selected +conditional result is **PR890, κ = 0.001661957774647029**; its certificate, +T21 construction and maintainer review were read. This contribution deliberately +uses historical PR626 JP8, not the current U8/T21 supplier. The original +checkpoint is immutable context and input binding; no current-frontier edit is +made. Only this directory is added, and `upstream/` is unchanged. + +Source heads: + +- PR626: `660de893d27bb7abd1d5b01b1640207528a5c851`. +- PR622: `f69477f4f6d3c7eb1f740b166881bffed4ffa9f6`. +- PR696: `5a3f983715027c4fd83f50bc9001d4b18463bed1`. + +Credit **Sagar Thakrar / PR696** for copy/unit lowering, the cost baseline and +cleared-work contract; **Jeremy Kothe / PR622** and **Chafik Boukhalfa / PR626** +for the provider and its archived replay; **icekylinx**, DreamingOfClouds, +eumemic, Rohan Arun and their retained compiler, circuit and analytic lineage. +**Philipp / PR882** supplies related single-scratch synthesis and the sparse +dyadic-row verification design. Its bounded graph permits one final target +accumulation; this contribution changes that restriction, so its shortest-word +result is not contradicted or reopened with more computation. **Gareth Davidson / +PR837** and **Chris Pagolu / PR734** provide related coefficient circuits. + +PR883 changes paired X4 preconditions; PR945 shares coefficient preparation +across different-source macros; this package preserves each original macro and +work-clearing boundary. Historical **PR355 by Dugongue** already uses +repeated unit additions for integral bit-donor setup. Repeated addition itself +is elementary and no mechanism-priority claim is made. The added evidence here +is a complete JP8 primitive refinement, dirty-input restoration, exact prefix +guarantees and a reproducible cost/access census. No pending code is imported, +and unrelated savings are not assumed additive. + +The OS assignment seed was **29** (complex-supplier track). Odd parity selected +historical JP8; seed29 selected coefficient three for the first control. Three +candidate tasks, the initial 703-PR overlap inventory, stopping rule and local +claim are in `CLAIM.json`. There was no pinned sprint coordination issue. +This experiment covers exactly both pinned programs and all ±2/±3 occurrences; +it makes no global circuit optimum or impossibility claim. + +Publication resumed after the contributor created a writable fork. A complete +821-open-PR refresh found related later submissions. **Hanson Sun / @bbMisk, +PR1036** (`c4ad801099d0813ffac56f0b517a908cd8ae0c6a`) applies the same +ordinary ±2/±3 unit updates to historical **CK**. This package adds separately +implemented **JP8** coverage, both complete 725-column primitive traces and +exact source-access, prefix and fractional-depth receipts. It does not claim +priority for the elementary identity or the mechanism. PR1036's broader +CK two-register exclusion is not imported or reproved here. + +**Seb / @ZK-Snarky, PR999** at +`fd38a824adb3a5c60c101a86c950a6d590454adf` supplies broader bounded target +accumulation. A targeted replay of its pinned `addition` function chooses +unchanged Horner words for ±2 and ±3, at costs 4 and 5 per real component. +Our direct-source words cost 3 and 4. Thus its 4,086-primitive JP8 saving does +not already include these replacements. No full PR999 replay or composition +with that broader compiler is claimed. **Ali Romman / PR1064** credits and uses +PR1036's integer routes in a different raw factory; its factory savings and +physical invoice are not combined with this package. + +Refreshed main is `1b59b624d21924f8e3537cdc1ac52d3be6eda2fe`, now selecting +conditional κ **0.001672660197076918** (PR1094). All six consumed historical +inputs remain byte-identical or decompressed-payload-identical. The research +base and historical JP8 scope are preserved; no transport to the new selected +supplier is claimed. Exact overlap and targeted comparator evidence are in +`OVERLAP.json`. + +All-size compilation, common-label/mutable-source realization, whole-call +hosting, precision/tape/recovery, bit-supplier H1–H5 and analytic-transfer +obligations remain inherited. Native physical admission, production lowerer +integration, global invoices/assembly and transport to U8/T21 remain open. + +## Open next questions + +- **Can these exact words pass the historical JP8 physical interface?** This + determines whether the local saving can enter a complete construction. First + bind the replacement lowerer to that interface and rebuild its source-access, + frame/owner, precision and complete invoice checks. The blocker is that this + package executes scalar projections only; the unchanged scalar maxima do not + discharge physical admission. +- **Does the replacement compose with pinned PR999?** Its retained ±2/±3 Horner + words suggest additional local savings, but no combined result is certified. + First replay both complete JP8 programs with an explicit composed dispatcher + and independently recompute the total cost, prefix bounds and dirty-input + contract. The blocker is the absent combined replay and interface evidence; + totals from separate packages must not simply be added. + +Prepared by **Michał Ciemięga (@zewelor)** with substantial **OpenAI Codex +assistance** in research, code, proof writing and verification. Apache-2.0, +with predecessor attribution retained. No independent human review is claimed. diff --git a/research/jp8-direct-small-integers/SOURCES.json b/research/jp8-direct-small-integers/SOURCES.json new file mode 100644 index 0000000000..4406e94db2 --- /dev/null +++ b/research/jp8-direct-small-integers/SOURCES.json @@ -0,0 +1,40 @@ +{ + "base_commit": "007664306fff84fbb1c9a1b4053b69f439764034", + "source_heads": { + "626": "660de893d27bb7abd1d5b01b1640207528a5c851", + "622": "f69477f4f6d3c7eb1f740b166881bffed4ffa9f6", + "696": "5a3f983715027c4fd83f50bc9001d4b18463bed1" + }, + "files": { + "research/complex-dyadic-lowering/lower.py": { + "representation": "exact-bytes", + "sha256": "eb37d00063dc09323e9aca041d23da749ce17fbd71dade9aaf1c059cab0b9753", + "committed_git_blob": "a2c2889e5be41a0fc30d4dfa5dfcebb03d6d47f8" + }, + "research/complex-k492-owner-repair/data/SPEC.json": { + "representation": "exact-bytes", + "sha256": "2a2577ac526535826fed9d5f7f83f6e2e0ec058a146c64f7286720b995fa2323", + "committed_git_blob": "cdc4f6ce03e96fd1ffc5a19926e1d0d4bce4e9de" + }, + "certificates/checkpoints/k492626.json": { + "representation": "exact-bytes", + "sha256": "b3bf402f31a69bde0629936a9b569bed48281568d7b16d5fba120b5311ea1f53", + "committed_git_blob": "92a10096dee76479af88a897714b3818d8263141" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/LOCAL-PROGRAMS.json.gz": { + "representation": "decompressed-payload", + "sha256": "efe45ce7fb025a6f53cc9eb54e951ac2211a5ed927e689a049e4f68ca680654b", + "committed_git_blob": "e22169a1633638213a5c63425a1919c7185f4c43" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/LOCAL-CHECKS.json": { + "representation": "exact-bytes", + "sha256": "0fad744aa863eedb288a9f87b1c23225a36b316b6275cc3b1bcedd42afe28a67", + "committed_git_blob": "0d84d903086993330ddcd871e66b15854f0c3ccd" + }, + "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/INDEPENDENT-LOCAL-REPLAY.json": { + "representation": "exact-bytes", + "sha256": "cb2f99ed351925dd35434b73de16f4085884fe81a35a69e1c7ce2d5e96cb975b", + "committed_git_blob": "19a4edfa2091d4cf38db49d7a780d29232badb49" + } + } +} diff --git a/research/jp8-direct-small-integers/VALIDATION.md b/research/jp8-direct-small-integers/VALIDATION.md new file mode 100644 index 0000000000..2ecf7df5bd --- /dev/null +++ b/research/jp8-direct-small-integers/VALIDATION.md @@ -0,0 +1,90 @@ +# Executed validation + +Linux x86_64, CPython 3.12.14, 13 October 2026. Exact base: +`007664306fff84fbb1c9a1b4053b69f439764034`. + +- `python3 -I -O -B research/jp8-direct-small-integers/verify.py --write NEW_PATH` + generated the exact receipt; the same command without `--write` compares it. +- Both complete primitive projections passed all 725 formal input columns at + every macro boundary and at the final expected shear. The source pin and + SPEC/program bindings passed. All 1,424 replacements in each orientation + were checked, with cost/access counts and unchanged prefix/grid metrics. +- All 13 dense mathematical/interface rejection controls passed, alongside + four early-clear positives and four reduced-coefficient positives. +- `python3 -I -O -B research/jp8-direct-small-integers/test_package.py`: + **6 tests passed** in 11.194 seconds. Includes 3,000 integer-row arithmetic + crosschecks, source corruption, gzip recompression, optimized minimal offline + relocation in a path with spaces, typed-receipt corruption and existing-output + preservation. The timing is a local test duration, not a performance claim. +- `make selected-record-check`: passed, selected conditional kappa remains + `1661957774647029/1000000000000000000`. +- `python3 -B -m unittest discover -s tests -p 'test_selected_result.py' -v`: + **5 existing tests passed** in 0.740 seconds. + +No existing generator, production lowerer, selected artifact, workflow or +upstream source is modified. Full `make verify`, native physical/phase/owner +replay, cold supplier reconstruction, global invoice/assembly, Lean, a second +platform and hosted CI were not run. Their inherited scope is not represented +as newly verified. Relevant focused checks are used for this isolated package. + +Final patch application, clean export and whitespace results are recorded in +`HANDOFF.md`. `OVERLAP.json` records the final metadata refresh and exact heads. + +## Requested second audit, 13 October 2026 + +Reviewed the actual published PR1223 head +`86381e9adf3c9d1e958cca4d53fec15254190434`, tree +`0166b06587244338e81d81635892e5cff7ecd12e`, in a separate worktree. Its content +exactly matched the previously tested local tree. No error was found in the +claimed finite scalar construction; the candidate lowerer, primary checker, +source pins and exact receipt remain unchanged. + +- Repeated the optimized isolated primary checker: the same pass line and exact + receipt, including all 13 local rejection controls. +- Repeated `test_package.py`: six tests passed in 10.457 seconds. +- Repeated `make selected-record-check` and the five `test_selected_result.py` + tests at the exact original base: all passed. These are checks of that pinned + base's selected record, not a new replay of the later PR1094 construction. +- Independently compared all six recorded Git blob identities against the + original base. Their exact or decompressed payloads also match refreshed main + `49b3157d1d89adcef16df8be98445451672be5ba`, which still selects conditional + PR1094, kappa `836330098538459/500000000000000000`. +- Added `recheck_fraction.py`, a second full scalar interpreter using native + Fraction coefficients. It imports neither the primary checker nor its row + arithmetic/controls. The two programs, their lowerers and the receipt are + shared inputs. It checks the complete register state on all 725 formal input + columns at every one of the 22,693 macro boundaries per orientation. +- Both Fraction replays matched **every program receipt field**: all changed + event IDs, coefficient/frame/phase counts, paid profiles, stream digests, + exact prefix norms and denominator depths, source/operand reads and complete + primitive counts. The result remains **2,848 saved real primitives per + orientation**. The first complete run took 92.212 seconds on this environment; + this is a verification duration, not a circuit runtime claim. +- Seven additional controls check four wrong-endpoint/dirty-work mutations and + three endpoint-preserving changes to fractional depth, magnitude or cost. + The latter require the corresponding measured metric to increase, rather + than merely relying on a changed stream hash. +- Rechecked Python syntax, JSON parsing, whitespace, the exact changed-path + inventory and preservation of `upstream/`. Reviewed the elementary identity, + arbitrary-dirty work contract, convexity/grid arguments, access counts and + limitation statements. PR999 and PR1036 remain open at the credited heads. +- Finally exported just the twelve package files plus six pinned inputs into a + fresh directory with spaces and no Git metadata. All three commands passed + there under `-I -O -B`: primary replay 4.879 seconds, package tests 10.145 + seconds (six passing tests), complete Fraction replay 90.592 seconds. The + final Fraction checker SHA-256 is + `6285545407e210a7059a70a9201724dc94f032abd340a4afbbeb4e790350b370`. + +Reproduce the added check with: + +```sh +python3 -I -O -B research/jp8-direct-small-integers/recheck_fraction.py +``` + +Expected final line: +`PASS_JP8_FRACTION_RECHECK all_program_receipt_fields=equal no_new_kappa`. + +PR1223's six hosted workflow runs reported `action_required`; no hosted test +success is claimed. The second audit does not discharge physical-frame, +whole-call, cold supplier, global invoice/assembly or analytic obligations, and +does not constitute independent human review or a full multiplication proof. diff --git a/research/jp8-direct-small-integers/controls.py b/research/jp8-direct-small-integers/controls.py new file mode 100644 index 0000000000..b4b9824d87 --- /dev/null +++ b/research/jp8-direct-small-integers/controls.py @@ -0,0 +1,89 @@ +"""Dense Fraction-matrix checks separate from the sparse integer replay. + +Michał Ciemięga (@zewelor), with substantial OpenAI Codex assistance. +Apache-2.0. Both implementations were written in one AI session. +""" +from fractions import Fraction as Q +from lower import lower + +T, S, W = ("T", 0), ("S", 0), ("W", 0) + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def check_word(q, word, cost): + rows = {T: [Q(1), Q(0), Q(0)], S: [Q(0), Q(1), Q(0)], W: [Q(0), Q(0), Q(1)]} + reads = 0 + for ins in word: + op, dst = ins[:2] + need(dst in (T, W), "source mutation") + if op in ("add", "subtract"): + src = ins[2] + need(src in rows and src != dst, "source alias") + rows[dst] = [a + (1 if op == "add" else -1)*b for a, b in zip(rows[dst], rows[src])] + reads += int(src == S) + elif op == "clear": + rows[dst] = [Q(0)]*3 + elif op == "copy": + rows[dst] = rows[ins[2]].copy() + reads += int(ins[2] == S) + elif op in ("double", "halve", "negate"): + factor = {"double": Q(2), "halve": Q(1, 2), "negate": Q(-1)}[op] + rows[dst] = [factor*x for x in rows[dst]] + else: + raise ValueError("unknown primitive") + need(all(x.denominator == 1 for r in rows.values() for x in r), "fractional excursion") + need(all(sum(abs(x) for x in r) <= 1+abs(q) for r in rows.values()), "magnitude excursion") + need(rows == {T: [Q(1), Q(q), Q(0)], S: [Q(0), Q(1), Q(0)], W: [Q(0)]*3}, "endpoint or dirt") + need(len(word) == cost, "unpaid instruction") + need(reads == abs(q), "source read count") + return {"cost": cost, "source_reads": reads, "columns": 3} + + +def run(baseline): + positives = {} + for q in (3, -3, 2, -2): # Seed29 selects magnitude3 for the first control. + op = ["add", list(T), list(S), q, 1] + word = lower(op, baseline) + positives[str(q)] = check_word(q, word, abs(q)+1) + check_word(q, word[-1:]+word[:-1], abs(q)+1) # Early clear is equivalent. + need(lower(["add", list(T), list(S), 2*q, 2], baseline) == word, "reduced coefficient") + good = lower(["add", list(T), list(S), 3, 1], baseline) + cases = { + "missing_clear": (good[:-1], 3, "endpoint or dirt"), + "missing_repeat": (good[1:], 3, "endpoint or dirt"), + "wrong_sign": ([("subtract", T, S)]+good[1:], 4, "endpoint or dirt"), + "private_dirt_read": ([("add", T, W)]+good[1:], 4, "endpoint or dirt"), + "clear_source": (good[:-1]+[("clear", S)], 4, "source mutation"), + "restore_source_after_mutation": ([("double", S),("halve", S)]+good, 6, "source mutation"), + "endpoint_neutral_grid_excursion": ([("halve", T),("double", T)]+good, 6, "fractional excursion"), + "endpoint_neutral_growth": ([("double", T)]*3+[("halve", T)]*3+good, 10, "magnitude excursion"), + "uncharged_clear": (good+[("clear", W)], 4, "unpaid instruction"), + } + rejected = {} + for name, (word, cost, reason) in cases.items(): + try: + check_word(3, word, cost) + except ValueError as error: + need(str(error) == reason, "wrong rejection reason: " + name + ": " + str(error)) + rejected[name] = str(error) + else: + raise ValueError("accepted negative control: " + name) + invalid = { + "source_target_alias": ["add", list(T), list(T), 3, 1], + "work_alias": ["add", list(T), list(W), 3, 1], + "zero": ["add", list(T), list(S), 0, 1], + "nondyadic": ["add", list(T), list(S), 2, 3], + } + for name, op in invalid.items(): + try: + lower(op, baseline) + except ValueError: + rejected[name] = "invalid macro rejected by retained PR696 validation" + else: + raise ValueError("accepted invalid macro: " + name) + return {"positive_words": positives, "equivalent_early_clears": 4, + "reduced_coefficient_positives": 4, "rejections": rejected} diff --git a/research/jp8-direct-small-integers/lower.py b/research/jp8-direct-small-integers/lower.py new file mode 100644 index 0000000000..b003fe0b39 --- /dev/null +++ b/research/jp8-direct-small-integers/lower.py @@ -0,0 +1,19 @@ +"""Direct small-integer target accumulation; Apache-2.0. + +Michał Ciemięga (@zewelor), with substantial OpenAI Codex assistance. +PR696 supplies the baseline and the arbitrary-dirty, cleared-work contract. +""" +from fractions import Fraction + + +def lower(op, baseline): + """Keep the original macro boundary, frame and private-work clear.""" + original = baseline(op) # Retain predecessor validation, including aliases. + if op[0] != "add": + return original + q = Fraction(op[3], op[4]) + if abs(q) not in (2, 3): + return original + target, source = tuple(op[1]), tuple(op[2]) + update = ("add" if q > 0 else "subtract", target, source) + return [update] * abs(q.numerator) + [("clear", ("W", 0))] diff --git a/research/jp8-direct-small-integers/recheck_fraction.py b/research/jp8-direct-small-integers/recheck_fraction.py new file mode 100644 index 0000000000..412d0575f1 --- /dev/null +++ b/research/jp8-direct-small-integers/recheck_fraction.py @@ -0,0 +1,225 @@ +#!/usr/bin/env python3 +"""Second full scalar interpreter, using Fraction coefficients throughout. + +Michał Ciemięga (@zewelor), substantial OpenAI Codex assistance, Apache-2.0. +No imports from verify.py, controls.py, or their row-arithmetic implementation. +The source programs and the two lowerers are intentionally shared inputs. +This checks finite scalar traces, not physical frames or the full theorem. +""" +from collections import Counter +from fractions import Fraction +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PROVIDER = "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/" +REFERENCE = "research/complex-dyadic-lowering/lower.py" +WORK = ("W", 0) +REGISTERS = [("L", i) for i in range(716)] + [WORK] + [("C", i) for i in range(8)] + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def encode(value): + return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True).encode() + + +def read(path): + data = path.read_bytes() + return json.loads(gzip.decompress(data) if path.suffix == ".gz" else data) + + +def load_lower(path, name): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module.lower + + +def basis(): + return {r: {i: Fraction(1)} for i, r in enumerate(REGISTERS)} + + +class FractionMachine: + def __init__(self): + self.state = basis() + self.counts = Counter() + self.reads = self.source_reads = self.depth = 0 + self.peak = Fraction(1) + self.stream = hashlib.sha256() + + def execute(self, word, target, macro_source, event_index=0, frame=0): + for instruction in word: + tag, dst = instruction[:2] + binary = tag in ("copy", "add", "subtract") + require(len(instruction) == (3 if binary else 2), "arity") + require(dst in self.state and dst in (target, WORK), "write outside macro") + src = instruction[2] if binary else None + if binary: + require(src in self.state and src != dst, "source alias or missing register") + require(src in (target, macro_source, WORK), "read outside macro") + operands = ([] if tag == "clear" else [src] if tag == "copy" + else [dst, src] if binary else [dst]) + self.reads += len(operands) + self.source_reads += operands.count(macro_source) if macro_source is not None else 0 + if tag == "clear": + result = {} + elif tag == "copy": + result = self.state[src].copy() + elif tag in ("add", "subtract"): + result = self.state[dst].copy() + for column, coefficient in self.state[src].items(): + if tag == "add": + result[column] = result.get(column, Fraction(0)) + coefficient + else: + result[column] = result.get(column, Fraction(0)) - coefficient + elif tag in ("double", "halve", "negate"): + factor = {"double": Fraction(2), "halve": Fraction(1, 2), "negate": Fraction(-1)}[tag] + result = {column: factor*coefficient for column, coefficient in self.state[dst].items()} + else: + raise ValueError("unknown primitive") + self.state[dst] = {column: coefficient for column, coefficient in result.items() if coefficient} + self.peak = max(self.peak, sum(map(abs, self.state[dst].values()), Fraction(0))) + for coefficient in self.state[dst].values(): + denominator = coefficient.denominator + require(denominator & (denominator-1) == 0, "nondyadic coefficient") + self.depth = max(self.depth, denominator.bit_length()-1) + self.counts[tag] += 1 + self.stream.update(encode([event_index, frame, instruction]) + b"\n") + + def receipt(self): + return {"real_primitives": 2*sum(self.counts.values()), + "primitive_counts": {key: 2*value for key, value in sorted(self.counts.items())}, + "real_macro_source_reads": 2*self.source_reads, "real_operand_reads": 2*self.reads, + "maximum_denominator_depth": self.depth, "maximum_row_l1": str(self.peak), + "stream_sha256": self.stream.hexdigest()} + + +def macro_endpoint(before, op): + """Specify the entire macro map directly, without primitive execution.""" + tag, dst = op[0], tuple(op[1]) + after = before.copy() + if tag == "clear": + after[dst] = {} + elif tag == "copy": + after[dst] = before[tuple(op[2])].copy() + elif tag == "scale": + factor = Fraction(op[2], op[3]) + after[dst] = {i: x*factor for i, x in before[dst].items() if x*factor} + elif tag == "add": + src, q = tuple(op[2]), Fraction(op[3], op[4]) + after[dst] = {i: before[dst].get(i, 0) + q*before[src].get(i, 0) + for i in before[dst].keys() | before[src].keys()} + after[dst] = {i: x for i, x in after[dst].items() if x} + after[WORK] = {} + else: + raise ValueError("unknown macro") + return after + + +def check_direction(direction, events, expected, baseline, candidate): + machines = [FractionMachine(), FractionMachine()] + changed, coefficients, phases, frames, paid = [], Counter(), Counter(), Counter(), Counter() + nonscalar = hashlib.sha256() + phase, macros = None, 0 + for index, event in enumerate(events): + if event[0] != "scalar": + require(event[0] in ("phase", "center", "climb", "adapter", "residual_adapter"), "unknown event") + nonscalar.update(encode([index, event]) + b"\n") + if event[0] == "phase": + phase = event[1] + if event[0] in ("center", "climb"): + paid[str(event[4] if event[0] == "center" else event[5])] += 1 + continue + _, op, frame = event + dst = tuple(op[1]) + src = tuple(op[2]) if op[0] in ("add", "copy") else None + words = [baseline(op), candidate(op, baseline)] + qualifies = op[0] == "add" and abs(Fraction(op[3], op[4])) in (2, 3) + require((words[0] != words[1]) == qualifies, "replacement domain") + if qualifies: + changed.append(index) + coefficients[str(Fraction(op[3], op[4]))] += 1 + phases[str(phase)] += 1 + frames[str(frame)] += 1 + endpoint = macro_endpoint(machines[0].state, op) + for machine, word in zip(machines, words): + machine.execute(word, dst, src, index, frame) + require(machine.state == endpoint, f"{direction}: full boundary at event {index}") + macros += 1 + endpoint = basis() + for i in range(112): + if direction == "forward": + endpoint[("L", i+112)][i] = Fraction(1) + else: + endpoint[("L", i)][i+112] = Fraction(-1) + for register in REGISTERS[716:]: + endpoint[register] = {} + for machine in machines: + require(machine.state == endpoint, "final shear, helper restoration or private clear") + old, new = (machine.receipt() for machine in machines) + actual = {"events": len(events), "macros": macros, "exact_input_columns": len(REGISTERS), + "dirty_helpers_restored": 716-2*112, "private_registers_cleared": len(REGISTERS)-716, + "changed_macros": len(changed), "changed_event_indices": changed, + "coefficient_census": dict(coefficients), "phase_census": dict(phases), + "frame_census": dict(frames), "paid_profile": dict(paid), + "retained_nonscalar_sha256": nonscalar.hexdigest(), "baseline": old, "candidate": new, + "saved_real_primitives": old["real_primitives"]-new["real_primitives"]} + require(encode(actual) == encode(expected), f"{direction}: Fraction receipt mismatch") + print(f"PASS_FRACTION_{direction.upper()} macros={macros} columns={len(REGISTERS)} " + f"saved={actual['saved_real_primitives']}", flush=True) + + +def check_rejections(baseline, candidate): + op = ["add", ["L", 0], ["L", 1], 3, 1] + word = candidate(op, baseline) + endpoint = macro_endpoint(basis(), op) + mutants = [word[:-1], word[1:], [("subtract", ("L", 0), ("L", 1))]+word[1:], + [("add", ("L", 0), WORK)]+word[1:]] + for mutant in mutants: + machine = FractionMachine() + machine.execute(mutant, ("L", 0), ("L", 1)) + require(machine.state != endpoint, "accepted wrong endpoint or private dirt") + # Endpoint-preserving perturbations must still change the checked receipt. + good = FractionMachine() + good.execute(word, ("L", 0), ("L", 1)) + for metric, prefix in ( + ("maximum_denominator_depth", [("halve", ("L", 0)), ("double", ("L", 0))]), + ("maximum_row_l1", [("double", ("L", 0))]*3+[("halve", ("L", 0))]*3), + ("real_primitives", [("clear", WORK)]), + ): + machine = FractionMachine() + machine.execute(prefix+word, ("L", 0), ("L", 1)) + require(machine.state == endpoint, "invalid endpoint-preserving control") + require(Fraction(machine.receipt()[metric]) > Fraction(good.receipt()[metric]), + "missed changed prefix or cost: " + metric) + print("PASS_FRACTION_CONTROLS endpoint_mutations=4 prefix_or_cost_mutations=3", flush=True) + + +def main(): + pins = read(HERE / "SOURCES.json") + for name, pin in pins["files"].items(): + payload = (ROOT / name).read_bytes() + if name.endswith(".gz"): + payload = gzip.decompress(payload) + require(hashlib.sha256(payload).hexdigest() == pin["sha256"], "source pin: " + name) + baseline = load_lower(ROOT / REFERENCE, "fraction_pr696") + candidate = load_lower(HERE / "lower.py", "fraction_candidate") + expected = read(HERE / "EXPECTED.json") + programs = read(ROOT / (PROVIDER + "LOCAL-PROGRAMS.json.gz")) + require(set(programs) == {"forward", "backward"}, "orientation coverage") + check_rejections(baseline, candidate) + for direction in ("forward", "backward"): + check_direction(direction, programs[direction], expected["programs"][direction], baseline, candidate) + print("PASS_JP8_FRACTION_RECHECK all_program_receipt_fields=equal no_new_kappa") + + +if __name__ == "__main__": + main() diff --git a/research/jp8-direct-small-integers/test_package.py b/research/jp8-direct-small-integers/test_package.py new file mode 100644 index 0000000000..c5a261fa74 --- /dev/null +++ b/research/jp8-direct-small-integers/test_package.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +"""Mathematical and packaging failure controls; Apache-2.0. + +Michał Ciemięga (@zewelor), with substantial OpenAI Codex assistance. +""" +from fractions import Fraction as Q +import gzip +import json +from pathlib import Path +import random +import shutil +import subprocess +import sys +import tempfile +import unittest + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import controls +import verify as v + + +class PackageTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + v.source_check() + cls.baseline = staticmethod(v.load_reference()) + + def test_dense_contract_controls(self): + result = controls.run(self.baseline) + self.assertEqual(len(result["rejections"]), 13) + + def test_integer_rows_against_fraction(self): + rng = random.Random(29) + for _ in range(1000): + a = v.row({i: rng.randrange(-32, 33) for i in range(4)}, rng.randrange(9)) + b = v.row({i: rng.randrange(-32, 33) for i in range(4)}, rng.randrange(9)) + q = Q(rng.randrange(-32, 33), 1 << rng.randrange(9)) + for actual, expected in ( + (v.add(a, b), {i: Q(a[1].get(i, 0), 1 << a[0])+Q(b[1].get(i, 0), 1 << b[0]) for i in range(4)}), + (v.add(a, b, -1), {i: Q(a[1].get(i, 0), 1 << a[0])-Q(b[1].get(i, 0), 1 << b[0]) for i in range(4)}), + (v.scale(a, q), {i: q*Q(a[1].get(i, 0), 1 << a[0]) for i in range(4)}), + ): + self.assertEqual({i: Q(n, 1 << actual[0]) for i, n in actual[1].items()}, + {i: n for i, n in expected.items() if n}) + + def test_exact_replacement_domain(self): + for n in range(-25, 26): + if n == 0: + continue + for d in (1, 2, 4, 8, 16): + op = ["add", ["T", 0], ["S", 0], n, d] + original, candidate = self.baseline(op), v.lower(op, self.baseline) + self.assertEqual(candidate != original, abs(Q(n, d)) in (2, 3)) + self.assertLessEqual(len(candidate), len(original)) + for op in (["clear", ["T", 0]], ["copy", ["T", 0], ["S", 0]], + ["scale", ["T", 0], -1, 8], ["scale", ["T", 0], 8, 1]): + self.assertEqual(v.lower(op, self.baseline), self.baseline(op)) + + def test_source_binding_and_semantic_recompression(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + for name in v.FILES: + dst = root / name + dst.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(v.ROOT / name, dst) + compressed = root / (v.PROVIDER + "LOCAL-PROGRAMS.json.gz") + payload = gzip.decompress(compressed.read_bytes()) + compressed.write_bytes(gzip.compress(payload, compresslevel=1, mtime=29)) + v.source_check(root) # Changed container bytes preserve all input fields. + bad = root / v.REFERENCE + bad.write_bytes(bad.read_bytes() + b"\n# changed\n") + with self.assertRaisesRegex(ValueError, "source pin mismatch"): + v.source_check(root) + + def test_optimized_minimal_relocation_and_receipt_corruption(self): + with tempfile.TemporaryDirectory(prefix="jp8 direct test ") as directory: + root = Path(directory) + for name in v.FILES: + dst = root / name + dst.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(v.ROOT / name, dst) + package = root / "research/jp8-direct-small-integers" + shutil.copytree(HERE, package, ignore=shutil.ignore_patterns("__pycache__")) + command = [sys.executable, "-I", "-O", "-B", str(package / "verify.py")] + run = subprocess.run(command, cwd=directory, capture_output=True, text=True, timeout=90) + self.assertEqual(run.returncode, 0, run.stderr) + self.assertIn("PASS_JP8_DIRECT_SMALL_INTEGERS", run.stdout) + receipt = package / "EXPECTED.json" + value = json.loads(receipt.read_text(encoding="utf-8")) + value["programs"]["forward"]["changed_macros"] = 1424.0 + receipt.write_text(json.dumps(value), encoding="utf-8") + run = subprocess.run(command, cwd=directory, capture_output=True, text=True, timeout=90) + self.assertNotEqual(run.returncode, 0) + self.assertIn("expected receipt mismatch", run.stderr) + + def test_existing_output_preserved(self): + with tempfile.TemporaryDirectory() as directory: + output = Path(directory) / "keep.json" + output.write_bytes(b"keep\n") + run = subprocess.run([sys.executable, "-I", "-O", "-B", str(HERE / "verify.py"), + "--write", str(output)], capture_output=True, text=True, timeout=10) + self.assertNotEqual(run.returncode, 0) + self.assertIn("output already exists", run.stderr) + self.assertEqual(output.read_bytes(), b"keep\n") + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/research/jp8-direct-small-integers/verify.py b/research/jp8-direct-small-integers/verify.py new file mode 100644 index 0000000000..b72824d90e --- /dev/null +++ b/research/jp8-direct-small-integers/verify.py @@ -0,0 +1,271 @@ +#!/usr/bin/env python3 +"""Source-pinned finite JP8 circuit replay; standard library, no writes by default. + +Michał Ciemięga (@zewelor), with substantial OpenAI Codex assistance. +Apache-2.0. The sparse dyadic-row representation follows the independent +integer replay in Philipp's PR882; code here is newly written. PR696 supplies +the unchanged reference lowering. This does not execute physical frame events. +""" +import argparse +from collections import Counter +from fractions import Fraction as Q +import gzip +import hashlib +import importlib.util +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +sys.path.insert(0, str(HERE)) +from lower import lower + +BASE = "007664306fff84fbb1c9a1b4053b69f439764034" +PROVIDER = "research/community-k492-audit/pr626/replay/mixed-global/base/providers/jp8/" +REFERENCE = "research/complex-dyadic-lowering/lower.py" +SPEC = "research/complex-k492-owner-repair/data/SPEC.json" +CHECKPOINT = "certificates/checkpoints/k492626.json" +FILES = {REFERENCE, SPEC, CHECKPOINT, + PROVIDER + "LOCAL-PROGRAMS.json.gz", PROVIDER + "LOCAL-CHECKS.json", + PROVIDER + "INDEPENDENT-LOCAL-REPLAY.json"} +WORK = ("W", 0) +PRIVATE = (WORK,) + tuple(("C", i) for i in range(8)) +REGISTERS = tuple(("L", i) for i in range(716)) + PRIVATE + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def canonical(value): + return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True) + + +def digest(value): + return hashlib.sha256(canonical(value).encode()).hexdigest() + + +def read(path): + data = path.read_bytes() + return json.loads(gzip.decompress(data) if path.suffix == ".gz" else data) + + +def source_check(root=ROOT): + pins = read(HERE / "SOURCES.json") + need(pins["base_commit"] == BASE, "wrong source base") + need(set(pins["files"]) == FILES, "source inventory mismatch") + for name, pin in pins["files"].items(): + data = (root / name).read_bytes() + expected_kind = "decompressed-payload" if name.endswith(".gz") else "exact-bytes" + need(pin["representation"] == expected_kind, "source representation mismatch") + if name.endswith(".gz"): + data = gzip.decompress(data) + need(hashlib.sha256(data).hexdigest() == pin["sha256"], "source pin mismatch: " + name) + checkpoint, spec = read(root / CHECKPOINT), read(root / SPEC) + need(checkpoint["audited_source_head"] == "660de893d27bb7abd1d5b01b1640207528a5c851", + "historical source head mismatch") + need(Q(checkpoint["kappa"]) == Q(spec["expected"]["kappa"]), "checkpoint/SPEC mismatch") + return spec["providers"]["jp8"] + + +def load_reference(): + spec = importlib.util.spec_from_file_location("pr696_direct_reference", ROOT / REFERENCE) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module.lower + + +def row(numerators, depth=0): + """Canonical sparse integer row divided by 2**depth.""" + numerators = {k: v for k, v in numerators.items() if v} + if not numerators: + return (0, {}) + common = min([depth] + [(abs(v) & -abs(v)).bit_length() - 1 for v in numerators.values()]) + return depth - common, {k: v >> common for k, v in numerators.items()} + + +def scale(value, q): + need(q.denominator & (q.denominator - 1) == 0, "nondyadic row scale") + return row({k: v * q.numerator for k, v in value[1].items()}, + value[0] + q.denominator.bit_length() - 1) + + +def add(left, right, sign=1): + depth = max(left[0], right[0]) + result = {k: v << (depth - left[0]) for k, v in left[1].items()} + for k, v in right[1].items(): + result[k] = result.get(k, 0) + sign * (v << (depth - right[0])) + return row(result, depth) + + +def initial(): + return {register: (0, {i: 1}) for i, register in enumerate(REGISTERS)} + + +def macro(rows, op): + """Direct mathematical oracle, independent of primitive lowering.""" + tag, target = op[0], tuple(op[1]) + if tag == "clear": + rows[target] = (0, {}) + elif tag == "copy": + rows[target] = rows[tuple(op[2])] + elif tag == "scale": + rows[target] = scale(rows[target], Q(op[2], op[3])) + elif tag == "add": + rows[target] = add(rows[target], scale(rows[tuple(op[2])], Q(op[3], op[4]))) + rows[WORK] = (0, {}) + else: + raise ValueError("unknown macro") + + +class Replay: + def __init__(self): + self.rows = initial() + self.counts = Counter() + self.source_reads = self.operand_reads = self.depth = 0 + self.peak = Q(1) + self.stream = hashlib.sha256() + + def step(self, instruction, event_index, frame, macro_source): + tag, target = instruction[:2] + need(target in self.rows, "unknown primitive target") + source = instruction[2] if len(instruction) == 3 else None + need(len(instruction) == (3 if tag in ("copy", "add", "subtract") else 2), + "primitive arity") + if source is not None: + need(source in self.rows and source != target, "unknown or aliased source") + reads = ([] if tag == "clear" else [source] if tag == "copy" + else [target, source] if source is not None else [target]) + self.operand_reads += len(reads) + self.source_reads += reads.count(macro_source) if macro_source else 0 + if tag == "clear": + self.rows[target] = (0, {}) + elif tag == "copy": + self.rows[target] = self.rows[source] + elif tag in ("add", "subtract"): + self.rows[target] = add(self.rows[target], self.rows[source], 1 if tag == "add" else -1) + elif tag in ("double", "halve", "negate"): + self.rows[target] = scale(self.rows[target], {"double": Q(2), "halve": Q(1, 2), "negate": Q(-1)}[tag]) + else: + raise ValueError("unknown primitive") + d, values = self.rows[target] + self.depth = max(self.depth, d) + self.peak = max(self.peak, Q(sum(abs(v) for v in values.values()), 1 << d)) + self.counts[tag] += 2 + self.stream.update((canonical([event_index, frame, instruction]) + "\n").encode()) + + def receipt(self): + return {"real_primitives": sum(self.counts.values()), "primitive_counts": dict(sorted(self.counts.items())), + "real_macro_source_reads": 2*self.source_reads, "real_operand_reads": 2*self.operand_reads, + "maximum_denominator_depth": self.depth, "maximum_row_l1": str(self.peak), + "stream_sha256": self.stream.hexdigest()} + + +def replay(direction, events, checks, inherited, baseline): + old, new, oracle = Replay(), Replay(), initial() + changed, census, phases, frames, paid = [], Counter(), Counter(), Counter(), Counter() + nonscalar = hashlib.sha256() + phase = None + macros = 0 + for index, event in enumerate(events): + if event[0] != "scalar": + need(event[0] in ("phase", "center", "climb", "adapter", "residual_adapter"), "unknown event") + if event[0] == "phase": + phase = event[1] + elif event[0] in ("center", "climb"): + paid[str(event[4 if event[0] == "center" else 5])] += 1 + nonscalar.update((canonical([index, event]) + "\n").encode()) + continue + need(len(event) == 3, "scalar event arity") + op, frame = event[1:] + target = tuple(op[1]) + source = tuple(op[2]) if op[0] in ("add", "copy") else None + original, replacement = baseline(op), lower(op, baseline) + if replacement != original: + q = Q(op[3], op[4]) + need(op[0] == "add" and abs(q) in (2, 3), "changed outside claimed domain") + need(len(original) - len(replacement) == 1, "unexpected local cost") + changed.append(index) + census[str(q)] += 1 + phases[str(phase)] += 1 + frames[str(frame)] += 1 + for machine, word in ((old, original), (new, replacement)): + for instruction in word: + need(instruction[1] in ({target, WORK} if op[0] == "add" else {target}), "extra primitive write") + if len(instruction) == 3: + need(instruction[2] in {target, source, WORK}, "extra primitive read") + machine.step(instruction, index, frame, source) + macro(oracle, op) + for machine in (old, new): + need(machine.rows[target] == oracle[target], f"{direction} event {index}: target boundary") + need(machine.rows[WORK] == oracle[WORK], f"{direction} event {index}: work boundary") + macros += 1 + for i in range(716): + expected = {i: 1} + if direction == "forward" and 112 <= i < 224: + expected[i-112] = 1 + elif direction == "backward" and i < 112: + expected[i+112] = -1 + for machine in (old, new): + need(machine.rows[("L", i)] == (0, expected), "full endpoint mismatch") + for machine in (old, new): + need(all(machine.rows[r] == (0, {}) for r in PRIVATE), "private dirt survived") + need(machine.rows == oracle, "full oracle mismatch") + need(macros == checks["scalar_macros"] and len(events) == checks["events"], "event census mismatch") + need(dict(paid) == checks["paid_profile"] == inherited["paid_profiles"][direction], "paid profile mismatch") + a, b = old.receipt(), new.receipt() + need(a["real_primitives"] - b["real_primitives"] == 2*len(changed), "complete cost mismatch") + need(b["real_macro_source_reads"] - a["real_macro_source_reads"] == 2*len(changed), "source access mismatch") + need(a["real_operand_reads"] == b["real_operand_reads"], "operand access mismatch") + need(new.depth <= old.depth and new.peak <= old.peak, "prefix budget increased") + need(new.peak <= Q(inherited["local"][direction]["prefix_l1_upper"]), "inherited envelope exceeded") + return {"events": len(events), "macros": macros, "exact_input_columns": 725, + "dirty_helpers_restored": 492, "private_registers_cleared": 9, + "changed_macros": len(changed), "changed_event_indices": changed, + "coefficient_census": dict(sorted(census.items())), "phase_census": dict(sorted(phases.items())), + "frame_census": dict(sorted(frames.items())), "paid_profile": dict(sorted(paid.items())), + "retained_nonscalar_sha256": nonscalar.hexdigest(), "baseline": a, "candidate": b, + "saved_real_primitives": a["real_primitives"] - b["real_primitives"]} + + +def collect(): + provider = source_check() + baseline = load_reference() + import controls + programs = read(ROOT / (PROVIDER + "LOCAL-PROGRAMS.json.gz")) + checks = read(ROOT / (PROVIDER + "LOCAL-CHECKS.json")) + inherited = read(ROOT / (PROVIDER + "INDEPENDENT-LOCAL-REPLAY.json")) + need(set(programs) == {"forward", "backward"}, "orientation coverage") + need(digest(programs) == provider["artifact_semantic_sha256"]["LOCAL-PROGRAMS.json.gz"], "SPEC payload mismatch") + result = {} + for direction in ("forward", "backward"): + need(digest(programs[direction]) == checks[direction]["sha256"] == provider["program_hashes"][direction], "program source binding") + result[direction] = replay(direction, programs[direction], checks[direction], inherited, baseline) + return {"schema": "jp8-direct-small-integers/1", "status": "finite scalar construction; no new kappa", + "base_commit": BASE, "assignment_seed": 29, + "programs": result, "local_controls": controls.run(baseline)} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write", type=Path, help="write a new receipt; refuse an existing path") + parser.add_argument("--json", action="store_true") + args = parser.parse_args() + if args.write and args.write.exists(): + parser.error("output already exists") + receipt = collect() + if args.write: + with args.write.open("x", encoding="utf-8", newline="\n") as stream: + json.dump(receipt, stream, indent=2, ensure_ascii=False) + stream.write("\n") + else: + need(canonical(receipt) == canonical(read(HERE / "EXPECTED.json")), "expected receipt mismatch") + if args.json: + print(json.dumps(receipt, indent=2)) + print("PASS_JP8_DIRECT_SMALL_INTEGERS macros=1424+1424 saved=2848/2848 columns=725 no_new_kappa") + + +if __name__ == "__main__": + main()