diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe54f23f19..5185786f2e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,6 +63,12 @@ For a parameter improvement, supply exact rational choices, the full dependency argument, and an updated patch against the pinned source. Explain whether the change stays within the parameter ceiling or changes one of its hypotheses. +Before extending a recursive cost edit, compare its complete paid and target +histograms with the [signed invoice preflight](docs/research/recursive-invoice-preflight.md). +It can certify uniform concave-moment gains or losses without a root search. +Its accounting contract is declared; source correctness and supplier admission +still require their own evidence. + Keep `upstream/`, frozen source archives and pinned evidence unchanged. When changing generated artifacts, edit their generators and include the regenerated certificates and patches in the same change. Run the checks affected by your diff --git a/docs/research/recursive-invoice-preflight.md b/docs/research/recursive-invoice-preflight.md new file mode 100644 index 0000000000..d55f6c136c --- /dev/null +++ b/docs/research/recursive-invoice-preflight.md @@ -0,0 +1,108 @@ +# Compare the complete recursive invoice before extending a construction + +The same local edit can save scalar instructions while worsening its recursive +bill. Conversely, owning a helper can remove paid work while also surrendering +a productive target. Compare **both** paid jobs and target credits first: + +```sh +python3 -B scripts/compare_recursive_invoices.py OLD.json NEW.json +``` + +This standard-library tool uses integer arithmetic, without a root search or +contribution replay. It reports an exact certificate for every increasing +concave rank tariff with f(0)=0, including r^(1-C), 00. Leaving the H9 target credited + produces a much larger, unsupported budget. +* [#5387](https://github.com/CrocSwap/integer-mult-bounds/pull/5387) and + [#5390](https://github.com/CrocSwap/integer-mult-bounds/pull/5390): compiler + refinements retain the same recursive invoice. #5390 also reports a smaller + sufficient compiler at a matched exponent. `equal` is therefore not a reason + to dismiss a compiler or implementation contribution. + +Run the source-bound current examples: + +```sh +python3 -B scripts/compare_recursive_invoices.py \ + research/owned-relation-exhaustion/examples/source.json \ + research/owned-relation-exhaustion/examples/exchange-128.json +python3 -B scripts/compare_recursive_invoices.py \ + research/owned-relation-exhaustion/examples/source.json \ + research/owned-relation-exhaustion/examples/h4-split.json +``` + +The second is a declared single-H4 edit to the complete source invoice, illustrating +the unfiltered retiming's algebra; it is not a newly emitted physical supplier. + +## Certificate and bounds + +Set d_r=Δpaid_r-Δtargets_r. The report gives K(k)=Σ d_r min(r,k) at every support +breakpoint. Between breakpoints K is linear. If all K are nonnegative, every +increasing concave cost change is nonnegative; reversing the signs gives the +reverse order. The discrete-slope proof is in the script and the worked package. +No equal-rank-mass assumption is required. + +Inputs are bounded to 1 MiB, 4,096 keys per histogram, ranks at most 10^9 and counts +at most 10^60. The implementation sweeps sparse support; it does not allocate an +array of ambient width. Duplicate keys, floats, booleans and differing contracts +fail with a diagnostic and exit code 2. Valid comparisons, including inconclusive +ones, exit 0: this is an arithmetic report, not an automatic acceptance gate. + +Prepared for zxv with substantial OpenAI Codex assistance. Apache-2.0. diff --git a/research/owned-relation-exhaustion/.gitattributes b/research/owned-relation-exhaustion/.gitattributes new file mode 100644 index 0000000000..58f48eebd7 --- /dev/null +++ b/research/owned-relation-exhaustion/.gitattributes @@ -0,0 +1,4 @@ +# Preserve exact retained source exports, including original line endings. +source/** -text +WITNESS.json -text +source/INVOICE.json whitespace=cr-at-eol diff --git a/research/owned-relation-exhaustion/PROOF.md b/research/owned-relation-exhaustion/PROOF.md new file mode 100644 index 0000000000..0010ef3f34 --- /dev/null +++ b/research/owned-relation-exhaustion/PROOF.md @@ -0,0 +1,128 @@ +# Signed invoice order and the fixed centre-exchange ceiling + +## 1. The reusable order certificate + +Let d_r=(P'_r-P_r)-(T'_r-T_r), with finite positive integer rank support and signed +integer coefficients. Put K(k)=Σ_r d_r min(r,k). For an increasing concave tariff +f with f(0)=0 and largest rank R, write s_j=f(j)-f(j-1). Direct telescoping gives + + Σ_r d_r f(r) = s_R K(R) + Σ_{k=1}^{R-1} (s_k-s_{k+1}) K(k). + +All coefficients are nonnegative. Thus nonnegative K means no improvement in +paid-minus-target cost; nonpositive K means no worsening. Conversely, each +min(r,k) is an allowed tariff, so these signs characterize the whole tariff +class. K is linear between support breakpoints, including the segment from zero +to the first breakpoint. Checking just the reported knots is sufficient. + +For f(r)=r^t, 00 and every curvature coefficient is positive. A nonzero +one-sided K therefore gives a strict sign. If every K vanishes, d vanishes. +Unequal rank mass is allowed; K(R) explicitly carries its linear contribution. +This is classical concave order, not a new theorem. mightyOil's retained T16 +audit supplies the closely related equal-mass predecessor implementation. + +Two useful controls have equal rank mass but opposite strict signs: + +* H4→2H2 gives d_2=2,d_4=-1, K(2)=2,K(4)=0: uniformly worse. +* Remove paid H1+H8 and target H9: d_1=d_8=-1,d_9=1, K(1)=K(8)=-1,K(9)=0: + uniformly better. For powers, the margin gain is g(C)=1+8^(1-C)-9^(1-C)>0. + +## 2. Exact current-source inventory and exchange family + +The retained final #4610 word has 3,298 paid events per orientation, including +exactly eight H8 centre events and no other H8 paid events. The retained p16/a7 +controller has sixteen backward and two forward local invocations: 144 original +centre slots. `source_invoice()` separately rebuilds the complete paid histogram +and targets from this word and controller, including copied queries, whole idles, +all helper endpoints and main diagonal outputs. It agrees exactly with the +final source invoice. Its rank surplus is 752. + +Define the following restricted optimistic family, for integers 0≤k≤144: + + P(k) = P(0) - k H1 - k H8 + T(k) = T(0) - k H9. + +There is at most one exchange per original centre slot and **all other recursive +charges and target credits remain fixed**. Giving every exchange free preparation, +storage, copying and completion only favors it. A scalar basis choice or schedule +cannot create a 145th original centre slot within this definition. No assumption +is made that all 144 exchanges have a physical realization. + +The margin is M_k(C)=Σ_r(T_r(k)-P_r(k))r^(1-C). By strict concavity, +M_k(C)=M_0(C)+k g(C), with g(C)>0 for 0 0, 'Positive reciprocal denominator') + return S*S//a[1], up(S*S, a[0]) + + +@lru_cache(None) +def log_reduced(q): + q = F(q) + need(1 <= q <= 2, 'Log reduction range') + z = (q-1)/(q+1) + term, total = z, F(0) + for j in range(64): + total += 2*term/(2*j+1) + term *= z*z + # All omitted terms are nonnegative, denominators at least 129. + tail = 2*term/(129*(1-z*z)) + return point(total)[0], point(total+tail)[1] + + +@lru_cache(None) +def log_rank(r): + need(type(r) is int and r > 0, 'Positive integer rank') + e = r.bit_length()-1 + return add(scale(log_reduced(F(2)), e), log_reduced(F(r, 2**e))) + + +def exp_positive(a): + need(0 <= a[0] <= a[1], 'Nonnegative exponential argument') + if a[1] >= S: + half = scale(a, F(1, 2)) + value = exp_positive(half) + return mul(value, value) + result, term = point(1), point(1) + for j in range(1, 49): + term = scale(mul(term, a), F(1, j)) + result = add(result, term) + first = scale(mul(term, a), F(1, 49)) + ratio = scale(a, F(1, 50)) + tail = mul(first, reciprocal((S-ratio[1], S-ratio[0]))) + return result[0], result[1]+tail[1] + + +@lru_cache(None) +def power(r, c): + c = F(c) + need(0 <= c <= 1, 'Saving in [0,1]') + return scale(reciprocal(exp_positive(scale(log_rank(r), c))), r) + + +def margin(targets, paid, c): + result = point(0) + for histogram, sign in [(targets, 1), (paid, -1)]: + for r, n in histogram.items(): + result = add(result, scale(power(r, F(c)), sign*n)) + return result + + +def derivative(targets, paid, lo, hi): + # d/dc (T-P) = sum(P-T) log(r) r**(1-c). + result = point(0) + for histogram, sign in [(paid, 1), (targets, -1)]: + for r, n in histogram.items(): + value = (power(r, F(hi))[0], power(r, F(lo))[1]) + result = add(result, scale(mul(log_rank(r), value), sign*n)) + return result + + +def decimal(a): + def convert(x): + prefix = '-' if x < 0 else '' + x = abs(x) + return prefix+str(x//S)+'.'+str(x%S).zfill(50) + return [convert(x) for x in a] + + +def exchange(targets, paid, count): + need(type(count) is int and 0 <= count <= 144, 'At most 144 original centre slots') + t, p = dict(targets), dict(paid) + p[1] -= count + p[8] -= count + t[9] -= count + need(min([*t.values(), *p.values()]) >= 0, 'No overspent paid or target inventory') + return t, p + + +def run(): + raw = (HERE/'source/INVOICE.json').read_bytes() + need(sha256(raw).hexdigest() == SOURCE_SHA, 'Exact original final-4610 invoice bytes') + source = json.loads(raw) + targets = {int(r): n for r, n in source['targets'].items()} + paid = {int(r): n for r, n in source['paid'].items()} + need(paid[8] == 144, 'All original centre jobs counted') + brackets = {0: ('.00302177587077', '.00302177587078'), + 16: ('.00302238736347', '.00302238736348'), + 128: ('.00302667476807', '.00302667476808'), + 144: ('.00302728824993', '.00302728824994')} + cases = {} + for count, (lo, hi) in brackets.items(): + t, p = exchange(targets, paid, count) + lower, upper = margin(t, p, F(lo)), margin(t, p, F(hi)) + need(lower[0] > 0 > upper[1], 'Strict root bracket '+str(count)) + # Monotonicity near the crossing; global nonfunding below handles the + # later range without incorrectly requiring a globally negative derivative. + slope = derivative(t, p, F(0), F(1, 100)) + need(slope[1] < 0, 'Strictly decreasing margin on [0,.01] '+str(count)) + cases[str(count)] = { + 'raw_root_bracket': [lo, hi], + 'margin_at_lower': decimal(lower), 'margin_at_upper': decimal(upper), + 'derivative_on_0_to_001': decimal(slope), + 'paid_calls': sum(p.values()), 'target_fields': sum(t.values()), + 'rank_surplus': sum(r*n for r,n in t.items())-sum(r*n for r,n in p.items())} + t, p = exchange(targets, paid, 144) + bit_boundary = margin(t, p, F('.0034')) + need(bit_boundary[1] < 0, 'Even all centre exchanges miss .0034') + # A directed interval cover proves that no second positive window occurs. + # For c in [lo,hi], every r**(1-c) lies between its endpoint values. + # All smaller exchange counts have <= this best-case margin by concavity. + cells = [] + for j in range(1024): + lo = F(1,100)+F(99*j,102400) + hi = F(1,100)+F(99*(j+1),102400) + bound = point(0) + for histogram, sign, endpoint in [(t, 1, lo), (p, -1, hi)]: + for r,n in histogram.items(): + bound = add(bound, scale(power(r, endpoint), sign*n)) + need(bound[1] < 0, 'Global nonfunding interval '+str(j)) + cells.append(bound[1]) + # Independent exact calibrations of logarithm/exponential arithmetic. + for r in (1, 2, 4, 8, 9, 16, 64, 145): + for c, value in [(F(0), r), (F(1), 1)]: + a = power(r, c) + need(a[0] <= value*S <= a[1], 'Exact integral-power calibration') + for r, root in [(4,2), (9,3), (16,4), (64,8)]: + a = power(r, F(1,2)) + need(a[0] <= root*S <= a[1], 'Exact square-root calibration') + rejected = {} + try: + exchange(targets, paid, 145) + except ValueError: + rejected['invented_145th_centre'] = True + bad_t, bad_p = exchange(targets, paid, 128) + bad_t[9] += 128 + need(margin(bad_t, bad_p, F('.0034'))[0] > 0, + 'Omitted target debits falsely fund the bit boundary') + rejected['omitted_H9_debits_change_answer'] = True + need(len(rejected) == 2, 'Both budget controls executed') + return {'status': 'PASS_FIXED_CENTRE_EXCHANGE_BUDGET', + 'source_invoice_sha256': SOURCE_SHA, 'cases': cases, + 'all_144_margin_at_0034': decimal(bit_boundary), + 'global_nonfunding_cover': {'interval': ['.01','1'], 'cells': 1024, + 'largest_margin_upper': decimal((0,max(cells)))[1]}, + 'remaining_raw_headroom_upper': str(F(brackets[144][1])-F(brackets[128][0])), + 'controls': rejected, + 'scope': 'At most one -H1-H8 paid/-H9 target exchange per original centre; all other inventory fixed. Raw moments only.'} + + +if __name__ == '__main__': + print(json.dumps(run(), indent=2, sort_keys=True)) diff --git a/research/owned-relation-exhaustion/census.py b/research/owned-relation-exhaustion/census.py new file mode 100644 index 0000000000..861536a2c0 --- /dev/null +++ b/research/owned-relation-exhaustion/census.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python3 +"""Fixed-relation zero and literal/proportional snapshot census. + +New independent source traversal, with the free-word convention credited to +Cinna Davis/zxv and Cao Yifan's retained PR4610 word. Relations and their first +physical realization are Ali Romman's PR5383. Prepared with OpenAI Codex +assistance, Apache-2.0. This census does not import predecessor evaluators. +""" +from collections import Counter, defaultdict +from copy import deepcopy +from fractions import Fraction as Q +from hashlib import sha256 +from pathlib import Path +import argparse +import gzip +import json + +HERE = Path(__file__).resolve().parent +SOURCE = HERE / 'source/ACTUAL-WORD.json.gz' +WITNESS = HERE / 'WITNESS.json' +PAYLOAD = 'cfcd36b40326d7a5815e1db5313444379b3fb756b27d5201c561574c085cc0dd' +WITNESS_SHA = '24599011da06325e1012619b2b84a4dd3aceb90ab42d3caaf6414879e7d16591' +EXPECTED_PROFILE = {1: 2201, 2: 412, 3: 510, 4: 127, 5: 40, 8: 8} + + +def need(condition, message): + if not condition: + raise ValueError(message) + + +def add(destination, source, coefficient): + for key, value in source.items(): + value = destination.get(key, Q(0)) + coefficient * value + if value: + destination[key] = value + else: + destination.pop(key, None) + + +def relation_basis(witnesses): + basis = {} + for witness in witnesses: + pairs = witness['relation'] + row = {h: Q(value) for h, value in pairs} + need(len(row) == len(pairs) and all(224 <= h < 632 for h in row), 'Helper-only relation') + for pivot, previous in sorted(basis.items()): + add(row, previous, -row.get(pivot, Q(0))) + need(row, 'Independent relation') + pivot = min(row) + coefficient = row[pivot] + row = {h: value / coefficient for h, value in row.items()} + for previous in basis.values(): + add(previous, row, -previous.get(pivot, Q(0))) + basis[pivot] = row + need(len(basis) == 8, 'Exactly eight fixed independent relations') + return dict(sorted(basis.items())) + + +def normal(row): + """Exact projective key, retaining signs separately as the leading value.""" + need(row, 'Nonzero projective row') + first = row[min(row)] + return tuple((key, value / first) for key, value in sorted(row.items())), first + + +def traverse(source, witnesses, direction, omit_scalar=None): + basis = relation_basis(witnesses) + rows = {('L', i): {(('L', i), ()): Q(1)} for i in range(632)} + rows['C', 0] = {(('C', 0), ()): Q(1)} + if direction == 'backward': + for pivot, row in basis.items(): + rows['L', pivot] = {(('L', h), ()): -value for h, value in row.items() if h != pivot} + frames = {('L', i): f for i, f in enumerate(source['canonical']['start'])} + frames['C', 0] = None + # Keeping every historical boundary value favors the putative replacement: + # it ignores snapshot slots, liveness, COPY, scalar and restoration costs. + seen = defaultdict(list) + def remember(event, role, frame): + if rows[role]: + key, coefficient = normal(rows[role]) + seen[frame, key].append((event, role, coefficient)) + for i, frame in enumerate(source['canonical']['start']): + remember(-1, ('L', i), frame) + paid, events = Counter(), Counter() + zero_rows, matches = [], [] + for position, event in enumerate(source['programs'][direction]): + kind = event[0] + events[kind] += 1 + role, frame = None, None + if kind == 'scalar': + operation, frame = event[1:] + role = tuple(operation[1]) + if position == omit_scalar: + need(operation[0] == 'add', 'Omission control names an ADD') + continue + if operation[0] == 'clear': + rows[role] = {} + frames[role] = frame + else: + need(frames[role] == frame, 'Scalar destination frame') + if operation[0] in ('copy', 'add'): + other = tuple(operation[2]) + need(frames[other] == frame, 'Scalar source frame') + if operation[0] == 'copy': + rows[role] = dict(rows[other]) + else: + add(rows[role], rows[other], Q(operation[3], operation[4])) + else: + need(operation[0] == 'scale', 'Known scalar opcode') + rows[role] = {key: Q(operation[2], operation[3]) * value for key, value in rows[role].items()} + elif kind == 'warp': + _, target, operator, old, frame = event + role = tuple(target) + need(frames[role] == old, 'Native input frame') + symbol = (1 if operator > 0 else -1) * (abs(operator) + (10**6 if direction == 'backward' else 0)) + rows[role] = {(variable, word[1:] if word and word[0] == -symbol else (symbol,) + word): value + for (variable, word), value in rows[role].items()} + frames[role] = frame + elif kind in ('climb', 'center'): + if kind == 'climb': + _, _, index, old, frame, rank = event + role = 'L', index + else: + _, index, old, frame, rank = event + role = 'C', index + need(frames[role] == old, 'Paid input frame') + need(rank == abs(len(source['canonical']['frames'][old]) - len(source['canonical']['frames'][frame])), 'Paid rank') + paid[rank] += 1 + if not rows[role]: + zero_rows.append({'event': position, 'source_event': event}) + else: + key, coefficient = normal(rows[role]) + prior = seen.get((frame, key), []) + if prior: + matches.append({'event': position, 'source_event': event, 'row_terms': len(rows[role]), + 'earlier_snapshots': [{'event': i, 'role': list(r), 'factor': str(coefficient / c)} for i, r, c in prior]}) + frames[role] = frame + else: + need(kind in ('phase', 'adapter'), 'Known source event') + if role is not None and frame is not None: + remember(position, role, frame) + need([frames['L', i] for i in range(632)] == source['canonical']['final'], 'All final frames') + need(dict(paid) == EXPECTED_PROFILE, 'Complete source paid census') + return {'paid_profile': dict(sorted(paid.items())), 'paid_total': sum(paid.values()), + 'event_counts': dict(events), 'zero_paid_rows': zero_rows, + 'nonzero_proportional_snapshot_matches': matches, + 'historical_snapshots_favorably_retained': True, + 'entry_relation_applied': direction == 'backward'} + + +def verify_census(result, witnesses, direction): + need(result['paid_total'] == 3298, 'All paid events visited') + zeros = [row['event'] for row in result['zero_paid_rows']] + expected_zeros = sorted(w['zero_event'] for w in witnesses) if direction == 'backward' else [] + need(zeros == expected_zeros, 'Exactly the known zero paid rows') + matches = result['nonzero_proportional_snapshot_matches'] + need([m['event'] for m in matches] == ([w['event'] for w in witnesses] if direction == 'backward' else []), 'Exactly the known matched paid sites') + for match, witness in zip(matches, witnesses): + need(match['earlier_snapshots'] == [{'event': witness['cached_event'], 'role': ['L', witness['cached_role']], + 'factor': str(Q(witness['copy_factor']))}], 'Unique exact chronological same-frame snapshot, including sign') + + +def run(controls=True): + raw = SOURCE.read_bytes() + need(sha256(gzip.decompress(raw)).hexdigest() == PAYLOAD, 'Pinned complete source payload') + source = json.loads(gzip.decompress(raw)) + witness_raw = WITNESS.read_bytes() + need(sha256(witness_raw).hexdigest() == WITNESS_SHA, 'Exact PR5383 witness bytes') + witnesses = json.loads(witness_raw) + directions = {} + for direction in ('forward', 'backward'): + directions[direction] = traverse(source, witnesses, direction) + verify_census(directions[direction], witnesses, direction) + rejected = {} + if controls: + mutated = deepcopy(witnesses) + mutated[0]['relation'][1][1] = str(-Q(mutated[0]['relation'][1][1])) + altered = traverse(source, mutated, 'backward') + try: + verify_census(altered, witnesses, 'backward') + except ValueError as error: + rejected['wrong_relation_sign'] = str(error) + else: + raise ValueError('Wrong relation accepted') + altered = traverse(source, witnesses, 'backward', omit_scalar=11331) + try: + verify_census(altered, witnesses, 'backward') + except ValueError as error: + rejected['omitted_source_ADD_11331'] = str(error) + else: + raise ValueError('Omitted source ADD accepted') + mutated = deepcopy(witnesses) + mutated[0]['copy_factor'] = '-1' + try: + verify_census(directions['backward'], mutated, 'backward') + except ValueError as error: + rejected['wrong_cached_global_sign'] = str(error) + else: + raise ValueError('Wrong cached sign accepted') + return {'status': 'PASS_FIXED_EIGHT_RELATION_FREE_WORD_ZERO_SNAPSHOT_SATURATION', + 'source_compressed_sha256': sha256(raw).hexdigest(), 'source_payload_sha256': PAYLOAD, + 'witness_sha256': sha256(WITNESS.read_bytes()).hexdigest(), 'pivots': list(relation_basis(witnesses)), + 'orientations': directions, 'negative_controls': rejected, + 'scope': 'Fixed eight entry relations, unchanged source event boundaries and free-word grammar. Unlimited historical scalar snapshots in the same physical output frame are allowed. No extra paid zero row or proportional single-snapshot equality remains beyond the eight known backward centre/zero pairs. New relations, scalar linear combinations, native identities beyond free reduction, changed event graph and physical admission are not covered.'} + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--no-controls', action='store_true') + parser.add_argument('--out', type=Path) + arguments = parser.parse_args() + result = run(not arguments.no_controls) + output = json.dumps(result, indent=2, sort_keys=True) + '\n' + if arguments.out: + arguments.out.write_text(output) + else: + print(output, end='') diff --git a/research/owned-relation-exhaustion/examples/exchange-128.json b/research/owned-relation-exhaustion/examples/exchange-128.json new file mode 100644 index 0000000000..f93e0fbf87 --- /dev/null +++ b/research/owned-relation-exhaustion/examples/exchange-128.json @@ -0,0 +1,40 @@ +{ + "schema": "integer-mult-recursive-invoice/v1", + "contract": { + "model": "mixed-target-unnormalized-power-v1", + "rank_semantics": "H_r has raw tariff r^(1-C), with surrendered productive fields debited", + "ambient_rank": 145, + "boundary": "complete p16/a7 unit before the retained mixed-target compiler" + }, + "paid": { + "1": 41170, + "2": 7416, + "3": 9180, + "4": 2286, + "5": 720, + "8": 16, + "16": 448, + "24": 448, + "32": 448, + "40": 448, + "48": 448, + "56": 448, + "64": 448, + "72": 224 + }, + "targets": { + "4": 504, + "7": 126, + "8": 846, + "9": 5740, + "17": 448, + "25": 448, + "33": 448, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "73": 224, + "145": 224 + } +} diff --git a/research/owned-relation-exhaustion/examples/exchange-144.json b/research/owned-relation-exhaustion/examples/exchange-144.json new file mode 100644 index 0000000000..fef046daab --- /dev/null +++ b/research/owned-relation-exhaustion/examples/exchange-144.json @@ -0,0 +1,39 @@ +{ + "schema": "integer-mult-recursive-invoice/v1", + "contract": { + "model": "mixed-target-unnormalized-power-v1", + "rank_semantics": "H_r has raw tariff r^(1-C), with surrendered productive fields debited", + "ambient_rank": 145, + "boundary": "complete p16/a7 unit before the retained mixed-target compiler" + }, + "paid": { + "1": 41154, + "2": 7416, + "3": 9180, + "4": 2286, + "5": 720, + "16": 448, + "24": 448, + "32": 448, + "40": 448, + "48": 448, + "56": 448, + "64": 448, + "72": 224 + }, + "targets": { + "4": 504, + "7": 126, + "8": 846, + "9": 5724, + "17": 448, + "25": 448, + "33": 448, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "73": 224, + "145": 224 + } +} diff --git a/research/owned-relation-exhaustion/examples/exchange-16.json b/research/owned-relation-exhaustion/examples/exchange-16.json new file mode 100644 index 0000000000..ec9c01129d --- /dev/null +++ b/research/owned-relation-exhaustion/examples/exchange-16.json @@ -0,0 +1,40 @@ +{ + "schema": "integer-mult-recursive-invoice/v1", + "contract": { + "model": "mixed-target-unnormalized-power-v1", + "rank_semantics": "H_r has raw tariff r^(1-C), with surrendered productive fields debited", + "ambient_rank": 145, + "boundary": "complete p16/a7 unit before the retained mixed-target compiler" + }, + "paid": { + "1": 41282, + "2": 7416, + "3": 9180, + "4": 2286, + "5": 720, + "8": 128, + "16": 448, + "24": 448, + "32": 448, + "40": 448, + "48": 448, + "56": 448, + "64": 448, + "72": 224 + }, + "targets": { + "4": 504, + "7": 126, + "8": 846, + "9": 5852, + "17": 448, + "25": 448, + "33": 448, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "73": 224, + "145": 224 + } +} diff --git a/research/owned-relation-exhaustion/examples/h4-split.json b/research/owned-relation-exhaustion/examples/h4-split.json new file mode 100644 index 0000000000..4a7a9c6697 --- /dev/null +++ b/research/owned-relation-exhaustion/examples/h4-split.json @@ -0,0 +1,40 @@ +{ + "schema": "integer-mult-recursive-invoice/v1", + "contract": { + "model": "mixed-target-unnormalized-power-v1", + "rank_semantics": "H_r has raw tariff r^(1-C), with surrendered productive fields debited", + "ambient_rank": 145, + "boundary": "complete p16/a7 unit before the retained mixed-target compiler" + }, + "paid": { + "1": 41298, + "2": 7418, + "3": 9180, + "4": 2285, + "5": 720, + "8": 144, + "16": 448, + "24": 448, + "32": 448, + "40": 448, + "48": 448, + "56": 448, + "64": 448, + "72": 224 + }, + "targets": { + "4": 504, + "7": 126, + "8": 846, + "9": 5868, + "17": 448, + "25": 448, + "33": 448, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "73": 224, + "145": 224 + } +} diff --git a/research/owned-relation-exhaustion/examples/source.json b/research/owned-relation-exhaustion/examples/source.json new file mode 100644 index 0000000000..b27318644f --- /dev/null +++ b/research/owned-relation-exhaustion/examples/source.json @@ -0,0 +1,40 @@ +{ + "schema": "integer-mult-recursive-invoice/v1", + "contract": { + "model": "mixed-target-unnormalized-power-v1", + "rank_semantics": "H_r has raw tariff r^(1-C), with surrendered productive fields debited", + "ambient_rank": 145, + "boundary": "complete p16/a7 unit before the retained mixed-target compiler" + }, + "paid": { + "1": 41298, + "2": 7416, + "3": 9180, + "4": 2286, + "5": 720, + "8": 144, + "16": 448, + "24": 448, + "32": 448, + "40": 448, + "48": 448, + "56": 448, + "64": 448, + "72": 224 + }, + "targets": { + "4": 504, + "7": 126, + "8": 846, + "9": 5868, + "17": 448, + "25": 448, + "33": 448, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "73": 224, + "145": 224 + } +} diff --git a/research/owned-relation-exhaustion/source/ACTUAL-WORD.json.gz b/research/owned-relation-exhaustion/source/ACTUAL-WORD.json.gz new file mode 100644 index 0000000000..46d929df83 Binary files /dev/null and b/research/owned-relation-exhaustion/source/ACTUAL-WORD.json.gz differ diff --git a/research/owned-relation-exhaustion/source/CONTROLLER.json b/research/owned-relation-exhaustion/source/CONTROLLER.json new file mode 100644 index 0000000000..49a2f06758 --- /dev/null +++ b/research/owned-relation-exhaustion/source/CONTROLLER.json @@ -0,0 +1,5224 @@ +{ + "ambient_rank": 145, + "boundaries": { + "left": [ + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "1", + "0", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ] + ], + "left_program": [ + [ + "SWAP", + 30, + 31 + ], + [ + "SWAP", + 29, + 30 + ], + [ + "SWAP", + 28, + 30 + ], + [ + "SWAP", + 27, + 29 + ], + [ + "SWAP", + 26, + 28 + ], + [ + "SWAP", + 25, + 30 + ], + [ + "SWAP", + 24, + 25 + ], + [ + "SWAP", + 23, + 26 + ], + [ + "SWAP", + 22, + 30 + ], + [ + "SWAP", + 20, + 26 + ], + [ + "SWAP", + 19, + 22 + ], + [ + "SWAP", + 18, + 29 + ], + [ + "SWAP", + 17, + 23 + ], + [ + "SWAP", + 16, + 27 + ], + [ + "SCALE", + 15, + "-1" + ], + [ + "SWAP", + 15, + 31 + ], + [ + "ADD", + 12, + 14, + "1" + ], + [ + "ADD", + 10, + 14, + "-1" + ], + [ + "ADD", + 8, + 14, + "1" + ], + [ + "ADD", + 6, + 14, + "-1" + ], + [ + "ADD", + 4, + 14, + "1" + ], + [ + "ADD", + 2, + 14, + "-1" + ], + [ + "ADD", + 0, + 14, + "1" + ], + [ + "SWAP", + 14, + 15 + ], + [ + "ADD", + 31, + 13, + "1" + ], + [ + "SWAP", + 13, + 30 + ], + [ + "ADD", + 10, + 12, + "1" + ], + [ + "ADD", + 8, + 12, + "-1" + ], + [ + "ADD", + 6, + 12, + "1" + ], + [ + "ADD", + 4, + 12, + "-1" + ], + [ + "ADD", + 2, + 12, + "1" + ], + [ + "ADD", + 0, + 12, + "-1" + ], + [ + "SWAP", + 12, + 14 + ], + [ + "ADD", + 31, + 11, + "-1" + ], + [ + "ADD", + 30, + 11, + "-1" + ], + [ + "SCALE", + 11, + "-1" + ], + [ + "SWAP", + 11, + 29 + ], + [ + "ADD", + 8, + 10, + "1" + ], + [ + "ADD", + 6, + 10, + "-1" + ], + [ + "ADD", + 4, + 10, + "1" + ], + [ + "ADD", + 2, + 10, + "-1" + ], + [ + "ADD", + 0, + 10, + "1" + ], + [ + "SWAP", + 10, + 13 + ], + [ + "ADD", + 31, + 9, + "1" + ], + [ + "ADD", + 30, + 9, + "1" + ], + [ + "ADD", + 29, + 9, + "1" + ], + [ + "SWAP", + 9, + 28 + ], + [ + "ADD", + 6, + 8, + "1" + ], + [ + "ADD", + 4, + 8, + "-1" + ], + [ + "ADD", + 2, + 8, + "1" + ], + [ + "ADD", + 0, + 8, + "-1" + ], + [ + "SWAP", + 8, + 12 + ], + [ + "ADD", + 31, + 7, + "-1" + ], + [ + "ADD", + 30, + 7, + "-1" + ], + [ + "ADD", + 29, + 7, + "-1" + ], + [ + "ADD", + 28, + 7, + "-1" + ], + [ + "SCALE", + 7, + "-1" + ], + [ + "SWAP", + 7, + 27 + ], + [ + "ADD", + 4, + 6, + "1" + ], + [ + "ADD", + 2, + 6, + "-1" + ], + [ + "ADD", + 0, + 6, + "1" + ], + [ + "SWAP", + 6, + 11 + ], + [ + "ADD", + 31, + 5, + "1" + ], + [ + "ADD", + 30, + 5, + "1" + ], + [ + "ADD", + 29, + 5, + "1" + ], + [ + "ADD", + 28, + 5, + "1" + ], + [ + "ADD", + 27, + 5, + "1" + ], + [ + "SWAP", + 5, + 26 + ], + [ + "ADD", + 2, + 4, + "1" + ], + [ + "ADD", + 0, + 4, + "-1" + ], + [ + "SWAP", + 4, + 10 + ], + [ + "ADD", + 31, + 3, + "-1" + ], + [ + "ADD", + 30, + 3, + "-1" + ], + [ + "ADD", + 29, + 3, + "-1" + ], + [ + "ADD", + 28, + 3, + "-1" + ], + [ + "ADD", + 27, + 3, + "-1" + ], + [ + "ADD", + 26, + 3, + "-1" + ], + [ + "SCALE", + 3, + "-1" + ], + [ + "SWAP", + 3, + 25 + ], + [ + "ADD", + 0, + 2, + "1" + ], + [ + "SWAP", + 2, + 9 + ], + [ + "ADD", + 31, + 1, + "1" + ], + [ + "ADD", + 30, + 1, + "1" + ], + [ + "ADD", + 29, + 1, + "1" + ], + [ + "ADD", + 28, + 1, + "1" + ], + [ + "ADD", + 27, + 1, + "1" + ], + [ + "ADD", + 26, + 1, + "1" + ], + [ + "ADD", + 25, + 1, + "1" + ], + [ + "SWAP", + 1, + 24 + ], + [ + "SWAP", + 0, + 8 + ] + ], + "right": [ + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "1", + "-1", + "1", + "-1", + "1", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "1", + "-1", + "1", + "-1", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "1", + "-1", + "1", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "-1", + "1", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "1", + "-1", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "1", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "-1", + "1", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "-1", + "1", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "-1" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ], + [ + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "1", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0", + "0" + ] + ], + "right_program": [ + [ + "ADD", + 30, + 31, + "-1" + ], + [ + "ADD", + 29, + 31, + "-1" + ], + [ + "ADD", + 28, + 31, + "-1" + ], + [ + "ADD", + 27, + 31, + "-1" + ], + [ + "SCALE", + 31, + "-1" + ], + [ + "ADD", + 31, + 30, + "-1" + ], + [ + "ADD", + 29, + 30, + "-1" + ], + [ + "ADD", + 28, + 30, + "-1" + ], + [ + "ADD", + 27, + 30, + "-1" + ], + [ + "ADD", + 31, + 29, + "-1" + ], + [ + "ADD", + 28, + 29, + "-1" + ], + [ + "ADD", + 27, + 29, + "-1" + ], + [ + "SCALE", + 29, + "-1" + ], + [ + "ADD", + 31, + 28, + "-1" + ], + [ + "ADD", + 27, + 28, + "-1" + ], + [ + "SWAP", + 28, + 29 + ], + [ + "ADD", + 31, + 27, + "-1" + ], + [ + "SCALE", + 27, + "-1" + ], + [ + "SWAP", + 27, + 29 + ], + [ + "ADD", + 31, + 26, + "1" + ], + [ + "SWAP", + 26, + 29 + ], + [ + "ADD", + 29, + 25, + "-1" + ], + [ + "ADD", + 24, + 25, + "-1" + ], + [ + "SWAP", + 25, + 28 + ], + [ + "ADD", + 28, + 24, + "1" + ], + [ + "SWAP", + 23, + 29 + ], + [ + "SWAP", + 22, + 25 + ], + [ + "SWAP", + 20, + 23 + ], + [ + "SWAP", + 19, + 25 + ], + [ + "SWAP", + 18, + 27 + ], + [ + "SWAP", + 17, + 29 + ], + [ + "SWAP", + 16, + 31 + ], + [ + "ADD", + 14, + 15, + "-1" + ], + [ + "SWAP", + 15, + 30 + ], + [ + "ADD", + 13, + 14, + "-1" + ], + [ + "SWAP", + 14, + 30 + ], + [ + "ADD", + 12, + 13, + "-1" + ], + [ + "SWAP", + 13, + 22 + ], + [ + "ADD", + 11, + 12, + "-1" + ], + [ + "SWAP", + 12, + 30 + ], + [ + "ADD", + 10, + 11, + "-1" + ], + [ + "SWAP", + 11, + 18 + ], + [ + "ADD", + 9, + 10, + "-1" + ], + [ + "SWAP", + 10, + 22 + ], + [ + "ADD", + 8, + 9, + "-1" + ], + [ + "SWAP", + 9, + 26 + ], + [ + "SWAP", + 8, + 30 + ], + [ + "SWAP", + 7, + 16 + ], + [ + "SWAP", + 6, + 18 + ], + [ + "SWAP", + 5, + 20 + ], + [ + "SWAP", + 4, + 22 + ], + [ + "SWAP", + 3, + 24 + ], + [ + "SWAP", + 2, + 26 + ], + [ + "SWAP", + 1, + 28 + ], + [ + "SWAP", + 0, + 30 + ] + ] + }, + "diagonal": [ + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1 + ], + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1 + ], + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + -1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + -1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + -1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + -1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + -1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + -1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + -1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + -1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + -1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ], + [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1 + ] + ], + "invoice": { + "main": { + "17": 448, + "25": 448, + "33": 448, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "73": 224, + "145": 224 + }, + "owned_streams_reused_sequentially": 1, + "paid": { + "1": 46446, + "2": 12834, + "3": 4032, + "4": 1836, + "5": 360, + "8": 144, + "16": 448, + "24": 448, + "32": 448, + "40": 448, + "48": 448, + "56": 448, + "64": 448, + "72": 224 + }, + "paid_calls": 69012, + "productive_fields": 10928, + "rank_surplus": 752, + "raw_scalar_record_bound": 1000000000, + "targets": { + "5": 504, + "6": 324, + "7": 1008, + "8": 1674, + "9": 3834, + "17": 448, + "25": 448, + "33": 448, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "73": 224, + "145": 224 + }, + "thick_calls": 18, + "thick_stages": [ + 0, + 1, + 3, + 5, + 7, + 9, + 11, + 13, + 15, + 17, + 19, + 21, + 23, + 25, + 27, + 29, + 31, + 32 + ], + "thin_queries": 1680, + "whole_idle": { + "16": 448, + "24": 448, + "32": 448, + "40": 448, + "48": 448, + "56": 448, + "64": 448, + "72": 224 + } + }, + "keep_mask": 35047648968703, + "kind": "complex", + "pairs": 16, + "physical_events": [ + [ + "LOCAL", + 0, + 0, + false + ], + [ + "LOCAL", + 1, + 0, + true + ], + [ + "IDLE", + 1, + [ + 0, + 1 + ] + ], + [ + "ADD", + 0, + 2, + 1 + ], + [ + "ADD", + 3, + 1, + -1 + ], + [ + "QUERY_SHEAR", + 2, + 0, + false + ], + [ + "ADD", + 0, + 2, + -1 + ], + [ + "ADD", + 3, + 1, + 1 + ], + [ + "LOCAL", + 3, + 1, + true + ], + [ + "IDLE", + 2, + [ + 0, + 1, + 3 + ] + ], + [ + "ADD", + 2, + 4, + 1 + ], + [ + "ADD", + 5, + 3, + -1 + ], + [ + "QUERY_SHEAR", + 4, + 1, + false + ], + [ + "ADD", + 2, + 4, + -1 + ], + [ + "ADD", + 5, + 3, + 1 + ], + [ + "LOCAL", + 5, + 2, + true + ], + [ + "IDLE", + 3, + [ + 0, + 1, + 3, + 5 + ] + ], + [ + "ADD", + 4, + 6, + 1 + ], + [ + "ADD", + 7, + 5, + -1 + ], + [ + "QUERY_SHEAR", + 6, + 2, + false + ], + [ + "ADD", + 4, + 6, + -1 + ], + [ + "ADD", + 7, + 5, + 1 + ], + [ + "LOCAL", + 7, + 3, + true + ], + [ + "IDLE", + 4, + [ + 0, + 1, + 3, + 5, + 7 + ] + ], + [ + "ADD", + 6, + 8, + 1 + ], + [ + "ADD", + 9, + 7, + -1 + ], + [ + "QUERY_SHEAR", + 8, + 3, + false + ], + [ + "ADD", + 6, + 8, + -1 + ], + [ + "ADD", + 9, + 7, + 1 + ], + [ + "LOCAL", + 9, + 4, + true + ], + [ + "IDLE", + 5, + [ + 0, + 1, + 3, + 5, + 7, + 9 + ] + ], + [ + "ADD", + 8, + 10, + 1 + ], + [ + "ADD", + 11, + 9, + -1 + ], + [ + "QUERY_SHEAR", + 10, + 4, + false + ], + [ + "ADD", + 8, + 10, + -1 + ], + [ + "ADD", + 11, + 9, + 1 + ], + [ + "LOCAL", + 11, + 5, + true + ], + [ + "IDLE", + 6, + [ + 0, + 1, + 3, + 5, + 7, + 9, + 11 + ] + ], + [ + "ADD", + 10, + 12, + 1 + ], + [ + "ADD", + 13, + 11, + -1 + ], + [ + "QUERY_SHEAR", + 12, + 5, + false + ], + [ + "ADD", + 10, + 12, + -1 + ], + [ + "ADD", + 13, + 11, + 1 + ], + [ + "LOCAL", + 13, + 6, + true + ], + [ + "IDLE", + 7, + [ + 0, + 1, + 3, + 5, + 7, + 9, + 11, + 13 + ] + ], + [ + "ADD", + 12, + 14, + 1 + ], + [ + "ADD", + 15, + 13, + -1 + ], + [ + "QUERY_SHEAR", + 14, + 6, + false + ], + [ + "ADD", + 12, + 14, + -1 + ], + [ + "ADD", + 15, + 13, + 1 + ], + [ + "LOCAL", + 15, + 7, + true + ], + [ + "ADD", + 14, + 16, + 1 + ], + [ + "ADD", + 17, + 15, + -1 + ], + [ + "QUERY_SHEAR", + 16, + 7, + false + ], + [ + "ADD", + 14, + 16, + -1 + ], + [ + "ADD", + 17, + 15, + 1 + ], + [ + "LOCAL", + 17, + 8, + true + ], + [ + "ADD", + 16, + 18, + 1 + ], + [ + "ADD", + 19, + 17, + -1 + ], + [ + "QUERY_SHEAR", + 18, + 8, + false + ], + [ + "ADD", + 16, + 18, + -1 + ], + [ + "ADD", + 19, + 17, + 1 + ], + [ + "LOCAL", + 19, + 9, + true + ], + [ + "ADD", + 18, + 20, + 1 + ], + [ + "ADD", + 21, + 19, + -1 + ], + [ + "QUERY_SHEAR", + 20, + 9, + false + ], + [ + "ADD", + 18, + 20, + -1 + ], + [ + "ADD", + 21, + 19, + 1 + ], + [ + "LOCAL", + 21, + 10, + true + ], + [ + "ADD", + 20, + 22, + 1 + ], + [ + "ADD", + 23, + 21, + -1 + ], + [ + "QUERY_SHEAR", + 22, + 10, + false + ], + [ + "ADD", + 20, + 22, + -1 + ], + [ + "ADD", + 23, + 21, + 1 + ], + [ + "LOCAL", + 23, + 11, + true + ], + [ + "ADD", + 22, + 24, + 1 + ], + [ + "ADD", + 25, + 23, + -1 + ], + [ + "QUERY_SHEAR", + 24, + 11, + false + ], + [ + "ADD", + 22, + 24, + -1 + ], + [ + "ADD", + 25, + 23, + 1 + ], + [ + "LOCAL", + 25, + 12, + true + ], + [ + "ADD", + 24, + 26, + 1 + ], + [ + "ADD", + 27, + 25, + -1 + ], + [ + "QUERY_SHEAR", + 26, + 12, + false + ], + [ + "ADD", + 24, + 26, + -1 + ], + [ + "ADD", + 27, + 25, + 1 + ], + [ + "LOCAL", + 27, + 13, + true + ], + [ + "ADD", + 26, + 28, + 1 + ], + [ + "ADD", + 29, + 27, + -1 + ], + [ + "QUERY_SHEAR", + 28, + 13, + false + ], + [ + "ADD", + 26, + 28, + -1 + ], + [ + "ADD", + 29, + 27, + 1 + ], + [ + "LOCAL", + 29, + 14, + true + ], + [ + "ADD", + 28, + 30, + 1 + ], + [ + "ADD", + 31, + 29, + -1 + ], + [ + "QUERY_SHEAR", + 30, + 14, + false + ], + [ + "ADD", + 28, + 30, + -1 + ], + [ + "ADD", + 31, + 29, + 1 + ], + [ + "LOCAL", + 31, + 15, + true + ], + [ + "LOCAL", + 32, + 15, + false + ], + [ + "IDLE", + 7, + [ + 17, + 19, + 21, + 23, + 25, + 27, + 29, + 31, + 32 + ] + ], + [ + "IDLE", + 8, + [ + 19, + 21, + 23, + 25, + 27, + 29, + 31, + 32 + ] + ], + [ + "IDLE", + 9, + [ + 21, + 23, + 25, + 27, + 29, + 31, + 32 + ] + ], + [ + "IDLE", + 10, + [ + 23, + 25, + 27, + 29, + 31, + 32 + ] + ], + [ + "IDLE", + 11, + [ + 25, + 27, + 29, + 31, + 32 + ] + ], + [ + "IDLE", + 12, + [ + 27, + 29, + 31, + 32 + ] + ], + [ + "IDLE", + 13, + [ + 29, + 31, + 32 + ] + ], + [ + "IDLE", + 14, + [ + 31, + 32 + ] + ], + [ + "ADD", + 30, + 28, + 1 + ], + [ + "ADD", + 29, + 31, + -1 + ], + [ + "ADD", + 28, + 26, + 1 + ], + [ + "ADD", + 27, + 29, + -1 + ], + [ + "ADD", + 26, + 24, + 1 + ], + [ + "ADD", + 25, + 27, + -1 + ], + [ + "ADD", + 24, + 22, + 1 + ], + [ + "ADD", + 23, + 25, + -1 + ], + [ + "ADD", + 22, + 20, + 1 + ], + [ + "ADD", + 21, + 23, + -1 + ], + [ + "ADD", + 20, + 18, + 1 + ], + [ + "ADD", + 19, + 21, + -1 + ], + [ + "ADD", + 18, + 16, + 1 + ], + [ + "ADD", + 17, + 19, + -1 + ], + [ + "ADD", + 16, + 14, + 1 + ], + [ + "ADD", + 15, + 17, + -1 + ], + [ + "ADD", + 14, + 12, + 1 + ], + [ + "ADD", + 13, + 15, + -1 + ], + [ + "ADD", + 12, + 10, + 1 + ], + [ + "ADD", + 11, + 13, + -1 + ], + [ + "ADD", + 10, + 8, + 1 + ], + [ + "ADD", + 9, + 11, + -1 + ], + [ + "ADD", + 8, + 6, + 1 + ], + [ + "ADD", + 7, + 9, + -1 + ], + [ + "ADD", + 6, + 4, + 1 + ], + [ + "ADD", + 5, + 7, + -1 + ], + [ + "ADD", + 4, + 2, + 1 + ], + [ + "ADD", + 3, + 5, + -1 + ], + [ + "ADD", + 2, + 0, + 1 + ], + [ + "ADD", + 1, + 3, + -1 + ], + [ + "SIGNED_SWAP", + 0, + 1 + ], + [ + "SIGNED_SWAP", + 2, + 3 + ], + [ + "SIGNED_SWAP", + 4, + 5 + ], + [ + "SIGNED_SWAP", + 6, + 7 + ], + [ + "SIGNED_SWAP", + 8, + 9 + ], + [ + "SIGNED_SWAP", + 10, + 11 + ], + [ + "SIGNED_SWAP", + 12, + 13 + ], + [ + "SIGNED_SWAP", + 14, + 15 + ], + [ + "SIGNED_SWAP", + 16, + 17 + ], + [ + "SIGNED_SWAP", + 18, + 19 + ], + [ + "SIGNED_SWAP", + 20, + 21 + ], + [ + "SIGNED_SWAP", + 22, + 23 + ], + [ + "SIGNED_SWAP", + 24, + 25 + ], + [ + "SIGNED_SWAP", + 26, + 27 + ], + [ + "SIGNED_SWAP", + 28, + 29 + ], + [ + "SIGNED_SWAP", + 30, + 31 + ] + ], + "prefix_pairs": 7 +} diff --git a/research/owned-relation-exhaustion/source/INVOICE.json b/research/owned-relation-exhaustion/source/INVOICE.json new file mode 100644 index 0000000000..0fdb65f946 --- /dev/null +++ b/research/owned-relation-exhaustion/source/INVOICE.json @@ -0,0 +1,241 @@ +{ + "compiler": { + "H": 38569300000000000, + "N": "2^38569300000000000", + "eta": { + "lower": "0.000000204535199106284215364833", + "upper": "0.000000204535199106284215364834" + }, + "gap": "1/700000000000", + "integer_test_exponent": 55099, + "logarithm_power": 1000, + "theta": "63/64", + "uniform_saving": "1057621533/350000000000", + "word_materialized": false + }, + "gain_over_PR4535": "4027/2500000000", + "kappa": "15108879/5000000000", + "local_helpers": { + "4": 28, + "7": 7, + "8": 47, + "9": 326 + }, + "local_paid": { + "1": 2201, + "2": 412, + "3": 510, + "4": 127, + "5": 40, + "8": 8 + }, + "margin_at_old_root_upper": [ + "78072058023577019965454984044224523228758899702419408235/196159429230833773869868419475239575503198607639501078528", + "1249152928377232319447279744707592371660142395238823308861/3138550867693340381917894711603833208051177722232017256448" + ], + "native_receipt_sha256": "eec3b14241430b6c9f5de3cbf0e3d45a172d8071d2dccd2b59d56a1fbac3d428", + "negative_controls": { + "closed_epsilon": [ + "epsilon_below_one", + "global_gamma_power_slack", + "actual_logarithmic_gamma_guard", + "source_axis_superpolynomial", + "gaussian_above_main", + "new_semantic_guard_with_C1_one" + ], + "closed_uniform": [ + "new_complex_uniform_saving_above_b" + ], + "old_BIT": [ + "actual_bit_above_effective" + ], + "unfunded_endpoint": [ + "main_transform_above_kappa", + "global_coordinate_router_above_kappa", + "fused_gaussian_above_kappa", + "group_bit_router_above_kappa", + "boundary_algebraic_matrix_above_kappa" + ] + }, + "nonrecursive": { + "local_routes": 4802000, + "local_scalar": 158168, + "raw_scalar_upper": 181098496 + }, + "ordinary_BIT": { + "admitted": "17/5000", + "after_cover": "69/20000", + "atom": "1/250", + "before_cover": "3459/1000000", + "ordinary_saving": "8590884599/2500000000000", + "prime_rule": "odd q > 2^26*N^5 avoiding all fixed denominators and rank witnesses" + }, + "outer": { + "functional_checks": { + "actual_new_BIT_stock_sublinear": "174299999999253/175000000000000", + "fixed_halo_explicit_metadata_branch": "13475000000001/175000000000", + "new_BIT_row_stock_sublinear_in_active_group": "697899999997009/700000000000000", + "new_semantic_group_guard": "3/700000000000" + }, + "margins": { + "boundary_algebraic_matrix": "1480670144797884756937/490000000000000000000000", + "fused_gaussian": "1480670144793654270811/490000000000000000000000", + "global_coordinate_router": "264405383/87500000000", + "group_bit_router": "185083768186706783851/61250000000000000000000", + "group_scans": "349999999999/350000000000", + "main_transform": "1480670144097884756937/490000000000000000000000", + "microbox_face_corrections": "13475000000001/175000000000", + "polynomial_products": "699999999999/700000000000", + "sparse_union_movement": "200543170144797884756937/490000000000000000000000" + }, + "parameters": { + "a": "264405383/87500000000", + "b": "423048613/140000000000", + "beta": "699999999997/700000000000", + "bit_saving": "17/5000", + "cap_xi": "445543170144097884756937/490000000000000000000000", + "complex_uniform_saving": "1057621533/350000000000", + "d": "1/700000000000", + "epsilon": "699999999999/700000000000", + "kappa": "15108879/5000000000", + "lambda_": "199395644839/200000000000", + "lambda_prime": "697884756937/700000000000", + "layout": "1/700000000000", + "q": "2115243063/700000000000", + "r0": "1/7000000000000", + "stop": "1/700000000000", + "tested_saving": "302177581/100000000000" + }, + "strict_checks": { + "actual_bit_above_effective": "33094617/87500000000", + "actual_logarithmic_gamma_guard": "1/700000000000", + "actual_logarithmic_group_guard": "44456829856952115243063/245000000000000000000000", + "alpha_logarithm_absorption": "1/7000000000000", + "boundary_algebraic_matrix_above_kappa": "2797884756937/490000000000000000000000", + "cap_above_band": "200543170144097884756937/490000000000000000000000", + "cap_below_cell": "44456829855202115243063/490000000000000000000000", + "cap_below_phase_cell_power": "534456829855902115243063/490000000000000000000000", + "complex_above_effective": "1/700000000000", + "complex_below_one_over_32": "3951951387/140000000000", + "complex_endpoint": "1/350000000000", + "epsilon_below_one": "1/700000000000", + "epsilon_positive": "699999999999/700000000000", + "fine_prime_halo_umbrella": "7/2", + "fused_gaussian_above_kappa": "2793654270811/490000000000000000000000", + "gaussian_above_main": "347884756937/245000000000000000000000", + "global_coordinate_router_above_kappa": "1/175000000000", + "global_gamma_power_slack": "9/7000000000000", + "group_below_dimension": "1/350000000000", + "group_bit_router_above_kappa": "436706783851/61250000000000000000000", + "group_gauge_power_slack": "44456829856917115243063/245000000000000000000000", + "group_key_fits_record": "1/350000000000", + "group_positive": "699999999997/700000000000", + "group_scans_above_kappa": "348942378469/350000000000", + "halo_covers_generic_inverse_radius": "5", + "improvement_over_user_baseline": "645402690400418148631/500000000000000000000000", + "lambda_above_internal": "1/1400000000000", + "lambda_above_sigma": "3/1400000000000", + "lambda_above_tau": "1/1400000000000", + "lambda_prime_above_lambda": "1/1400000000000", + "lambda_prime_above_leaf": "279576951387/98000000000000000000000", + "leaf_saving_above_effective": "139576951387/98000000000000000000000", + "main_transform_above_kappa": "2097884756937/490000000000000000000000", + "membership_arithmetic_fits_record": "1/700000000000", + "microbox_face_corrections_above_kappa": "3368617797309/43750000000", + "microbox_halo_volume": "55300000000003/700000000000", + "new_complex_uniform_saving_above_b": "1/700000000000", + "new_semantic_guard_with_C1_one": "1/700000000000", + "polynomial_products_above_kappa": "697884756939/700000000000", + "positive_layout_slack": "1/700000000000", + "q_below_effective": "1/700000000000", + "q_below_internal": "1/700000000000", + "q_below_leaf": "279576951387/98000000000000000000000", + "q_positive": "2115243063/700000000000", + "short_record_fallback": "139576951387/140000000000", + "source_axis_superpolynomial": "1/700000000000", + "sparse_union_movement_above_kappa": "199062500002797884756937/490000000000000000000000", + "stop_below_one": "699999999999/700000000000", + "stop_positive": "1/700000000000", + "strassen_integer_power_gap": "1951441519231", + "support_router_span": "3/700000000000", + "theta_positive_polynomial_power": "2", + "union_header_fits_record": "3/700000000000", + "union_tag_work_per_visit_fits_record": "3/700000000000" + } + }, + "paid": { + "1": 41298, + "16": 448, + "2": 7416, + "24": 448, + "3": 9180, + "32": 448, + "4": 2286, + "40": 448, + "48": 448, + "5": 720, + "56": 448, + "64": 448, + "72": 224, + "8": 144 + }, + "paid_calls": 64404, + "productive_fields": 10928, + "rank_mass_surplus": 752, + "raw_root_interval": [ + "302177587077/100000000000000", + "151088793539/50000000000000" + ], + "scope": "Exact changed-profile arithmetic only. Requires separately admitted changed native programs, paid transports and absolute phases. Retained compiler/native/precision/tape/analytic/recovery assumptions.", + "source_sha256": { + "research/fresh-helper-boundary/native.py": "9b55a2d3c3972148fae9d112e745d9244968166bd89bd900c938f429fc76ab29", + "research/higher-moment-strictification/verify.py": "0ce7e7137422d5ffeda22085c81fa88471bbe963100fdad62e659f1e3bf89326", + "research/joint-helper-lattice/CONTROLLER.json": "1f5d6aa267e4e66048818714b5d3b5eae17a58abe91d15deeaa34574f7391a5f", + "research/joint-helper-lattice/native_joint.py": "50869b1bcad7493e6b4cb2a4cd5d2fd9a193a5921100483fa2c3f2c999ddfd46", + "research/joint-helper-lattice/verify.py": "8eb13f77a94315f811612cb557a17edeecb6b9d9a75dfa238b112dd6520c336f", + "research/kappa-0023-productive-jobs/dependencies/kappa-next-regime/bit-compression/carrier-reuse/reference/joint_pair_dag.py": "8a0de761642d21919e969475c3f13e5d01a4bae7343c1e1f37c586d94b676a85", + "research/kappa-rebuild/architecture/mixed_target_probe.py": "011c3c9d0cf81103dc84d709a0e36793eb7c5ae3f23c85eac27650ef13afa04a", + "research/kappa-rebuild/bit/complex_controller_factor.py": "1de9aaf918e6a4f2f5448754c1f3c3da3b85e6257849ebd097af09859c4e5497", + "research/kappa-rebuild/bit/mixed_productive_bit.py": "b32291b0db7fc0d332ec444c70746ab0fb03351d2e50546f8bcb64060e3ff95e", + "research/kappa-round6-compiler-tightening-20261022/arithmetic.py": "960864e5427a1ca2c319a7b2dee292b6fe50bd5964830031e611591af10dac38", + "research/pr4359-p7-padding/dependencies/compiler-refill/endpoint.py": "d097e55f06c3f244f2074ffd7c1a0a5f3c4b4b6a6accf9619d1dde5c0ae85e15", + "research/query-thinned-controllers/RESULT.json": "6ebfc8c0f09166f4834e9d7427410cb31aefff2cd4d4ce588c8e52c9c70e9a0f", + "research/query-thinned-controllers/controller.py": "8b462d660487b1be4940357c4c7522967b1bfaede3c02b1c66109b85acae0fd2" + }, + "status": "PASS_CHANGED_PROFILE_ARITHMETIC_NATIVE_ADMISSION_SEPARATE", + "strictification": { + "alpha": { + "lower": "0.999999999936687383304469699479", + "upper": "0.999999999936687383304469699480" + }, + "cutoff": 20, + "delta": { + "lower": "0.958285308639504859158849914083", + "upper": "0.958285308639504859158849914084" + }, + "floor": 21, + "gamma": { + "lower": "0.956217509753795293454516855483", + "upper": "0.956217509753795293454516855484" + }, + "normalized_paid_upper": "104857600097656251/104857601073741824", + "power": 1024, + "tail_offset": "1/5", + "tested": "302177581/100000000000" + }, + "targets": { + "145": 224, + "17": 448, + "25": 448, + "33": 448, + "4": 504, + "41": 448, + "49": 448, + "57": 448, + "65": 448, + "7": 126, + "73": 224, + "8": 846, + "9": 5868 + } +} diff --git a/research/owned-relation-exhaustion/verify.py b/research/owned-relation-exhaustion/verify.py new file mode 100644 index 0000000000..d901f2c1dd --- /dev/null +++ b/research/owned-relation-exhaustion/verify.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +"""Source-bound signed-invoice examples, exchange cap and independent reuse audit.""" +from collections import Counter +from hashlib import sha256 +from pathlib import Path +import gzip +import importlib.util +import json +import sys + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +sys.path.insert(0, str(HERE)) +import budget +import census + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def load_comparator(): + path = ROOT/'scripts/compare_recursive_invoices.py' + spec = importlib.util.spec_from_file_location('invoice_order', path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def source_invoice(c): + word = json.loads(gzip.decompress((HERE/'source/ACTUAL-WORD.json.gz').read_bytes())) + ctrl = json.loads((HERE/'source/CONTROLLER.json').read_bytes()) + original = json.loads((HERE/'source/INVOICE.json').read_bytes()) + can = word['canonical'] + frames = can['frames'] + need((can['v'], can['h'], ctrl['pairs'], ctrl['prefix_pairs'], ctrl['ambient_rank']) + == (112,9,16,7,145), 'Pinned rank conventions and caller') + helpers = Counter(len(frames[can['final'][i]])-len(frames[can['start'][i]]) for i in range(224,632)) + need(min(helpers) > 0, 'Productive helper target ranks') + local = Counter({int(r): n for r,n in c['orientations']['forward']['paid_profile'].items()}) + need(local == Counter({int(r):n for r,n in c['orientations']['backward']['paid_profile'].items()}), 'Both local paid profiles') + for direction in word['programs'].values(): + centres = [e for e in direction if e[0]=='center'] + need(len(centres)==8 and all(e[-1]==8 for e in centres), 'Eight original H8 centre slots') + need(all(e[-1]!=8 for e in direction if e[0]=='climb'), 'All original H8 jobs are centres') + paid, targets, events, directions = Counter(), Counter(), Counter(), Counter() + for event in ctrl['physical_events']: + kind = event[0] + events[kind] += 1 + if kind == 'LOCAL': + directions[bool(event[3])] += 1 + paid.update(local) + targets.update(helpers) + elif kind == 'QUERY_SHEAR': + paid[1] += 112 + elif kind == 'IDLE': + need(event[2] and len(set(event[2]))==len(event[2]), 'Distinct whole-idle stages') + paid[8*len(event[2])] += 224 + else: + need(kind in ('ADD','SIGNED_SWAP'), 'Known whole-caller event') + for diagonal in ctrl['diagonal']: + need(len(diagonal)==34 and diagonal[0] in (-1,1) and all(t in (0,1) for t in diagonal[1:]), 'Main output rank convention') + targets[1+8*sum(diagonal[1:])] += 112 + need(events['LOCAL']==18 and directions==Counter({True:16,False:2}), '16 backward and two forward invocations') + need(paid == Counter({int(r):n for r,n in original['paid'].items()}), 'Independently rebuilt complete paid invoice') + need(targets == Counter({int(r):n for r,n in original['targets'].items()}), 'Independently rebuilt complete target invoice') + return targets, paid + + +def invoice(targets, paid, module): + return {'schema': module.SCHEMA, + 'contract': {'model':'mixed-target-unnormalized-power-v1', + 'rank_semantics':'H_r has raw tariff r^(1-C), with surrendered productive fields debited', + 'ambient_rank':145, + 'boundary':'complete p16/a7 unit before the retained mixed-target compiler'}, + 'paid':{str(r):n for r,n in sorted(paid.items()) if n}, + 'targets':{str(r):n for r,n in sorted(targets.items()) if n}} + + +def run(): + manifest = json.loads((HERE/'SOURCES.json').read_bytes()) + for row in manifest['retained_exports']: + need(sha256((HERE/row['local_path']).read_bytes()).hexdigest()==row['sha256'], 'Retained source: '+row['local_path']) + c = census.run() + targets, paid = source_invoice(c) + module = load_comparator() + original = invoice(targets, paid, module) + examples = {} + for count in (0,16,128,144): + t,p = budget.exchange(targets, paid, count) + candidate = invoice(t,p,module) + report = module.compare_invoices(original,candidate) + need(report['classification']==('equal' if count==0 else 'uniformly_better'), 'Signed target-debit comparison') + path = HERE/'examples'/('source.json' if count==0 else f'exchange-{count}.json') + need(json.loads(path.read_bytes())==candidate, 'Exact committed example invoice') + examples[str(count)] = report + split = invoice(targets,paid,module) + split['paid']['4'] -= 1 + split['paid']['2'] += 2 + need(module.compare_invoices(original,split)['classification']=='uniformly_worse', 'Scalar-saving H4 split loses') + need(json.loads((HERE/'examples/h4-split.json').read_bytes())==split, 'Committed split example') + b = budget.run() + result = {'status':'PASS_SIGNED_INVOICE_PREFLIGHT_AND_SCOPED_CENTRE_EXHAUSTION', + 'source_reconstruction':{'local_jobs_each_orientation':3298,'backward_invocations':16,'forward_invocations':2, + 'original_centre_slots':144,'rank_surplus':752}, + 'signed_comparisons':examples,'budget':b,'census':c, + 'scope':'Exact histogram order and this fixed exchange family; independent fixed-eight formal-row census. No new supplier or selected-frontier change.'} + # JSON object keys are strings, including the census's integer rank keys. + return json.loads(json.dumps(result)) + + +if __name__=='__main__': + result = run() + expected = json.loads((HERE/'RESULT.json').read_bytes()) + need(result==expected, 'Deterministic committed receipt') + print('PASS_SIGNED_INVOICE_PREFLIGHT_AND_SCOPED_CENTRE_EXHAUSTION') diff --git a/scripts/compare_recursive_invoices.py b/scripts/compare_recursive_invoices.py new file mode 100644 index 0000000000..fda2a852e9 --- /dev/null +++ b/scripts/compare_recursive_invoices.py @@ -0,0 +1,218 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Compare declared recursive invoices by exact signed concave order. + +Usage: python3 -B scripts/compare_recursive_invoices.py OLD.json NEW.json + +Each input has schema ``integer-mult-recursive-invoice/v1``, an identical +contract object with model, rank_semantics, ambient_rank and boundary, and +paid/targets objects mapping canonical positive decimal ranks to nonnegative +integer counts. Contracts are declarations, not verified mathematical premises. + +For d = (new paid - old paid) - (new targets - old targets), set +K(k) = sum_r d[r] min(r,k). The sign of K at every support knot determines +the order for every increasing concave tariff f with f(0)=0. Indeed, on the +integer ranks 0..R, write s_j=f(j)-f(j-1). Then + + sum_r d[r] f(r) = s_R K(R) + sum_(k=1..R-1) (s_k-s_(k+1)) K(k). + +All coefficients on the right are nonnegative. Conversely, the increasing +concave tariffs min(r,k) witness every required hinge. Between support knots +K is linear. For f(r)=r**t, 0= 0 for value in values): + classification, power_sign = "uniformly_worse", "strictly_positive" + else: + classification, power_sign = "inconclusive", "not_determined" + old_mass, new_mass = _masses(old), _masses(new) + return { + "schema": REPORT_SCHEMA, + "classification": classification, + "contract": old["contract"], + "delta_paid": paid, + "delta_targets": targets, + "signed_net_delta": net, + "hinges": hinges, + "rank_mass": {"old": old_mass, "new": new_mass, + "delta": {key: new_mass[key] - old_mass[key] for key in old_mass}}, + "quantity": "(new paid - new targets) - (old paid - old targets)", + "tariff_class": "increasing concave f on nonnegative ranks, with f(0)=0", + "uniform_order": "weak; some concave tariffs can give equality", + "power_moment": {"tariff": "r^t", "exponent": "0 < t < 1", + "new_minus_old_sign": power_sign}, + "assurance": { + "contract": "Exact matching user declarations; mathematical applicability is not verified.", + "input_binding": "SHA-256 identifies the exact input bytes read, when loaded by this CLI.", + "scope": "Histogram arithmetic only. Histogram correctness, circuit legality, ownership, " + "phases, precision, supplier admission and compiler endpoints are not validated.", + "inconclusive": "Mixed hinge signs do not establish a power-moment crossing or failure.", + }, + "method_credit": "Classical concave order/majorization; mightyOil's t16-moment-order-audit " + "and its retained predecessors. No new theorem claim.", + } + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("old", help="old invoice JSON") + parser.add_argument("new", help="new invoice JSON") + args = parser.parse_args(argv) + try: + old, old_evidence = load_invoice(args.old) + new, new_evidence = load_invoice(args.new) + report = compare_invoices(old, new) + report["inputs"] = {"old": old_evidence, "new": new_evidence} + except (OSError, ValueError, TypeError, RecursionError) as exc: + print(json.dumps({"status": "INVALID_RECURSIVE_INVOICE", "error": str(exc)}, + ensure_ascii=True), file=sys.stderr) + return 2 + print(json.dumps(report, indent=2, sort_keys=True, ensure_ascii=True)) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/test_compare_recursive_invoices.py b/tests/test_compare_recursive_invoices.py new file mode 100644 index 0000000000..35d797b4c5 --- /dev/null +++ b/tests/test_compare_recursive_invoices.py @@ -0,0 +1,155 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Independent finite tariff checks and real algebra controls for signed invoices.""" + +import copy +from hashlib import sha256 +import importlib.util +import itertools +import json +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest + + +SCRIPT = Path(__file__).resolve().parents[1] / "scripts/compare_recursive_invoices.py" +SPEC = importlib.util.spec_from_file_location("compare_recursive_invoices", SCRIPT) +M = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(M) + + +def invoice(paid=None, targets=None): + return {"schema": M.SCHEMA, + "contract": {"model": "declared-complete-recursive-invoice", + "rank_semantics": "one Gaussian child of integer rank r", + "ambient_rank": 145, + "boundary": "same arbitrary independent inputs and charged outputs"}, + "paid": {str(r): n for r, n in (paid or {}).items()}, + "targets": {str(r): n for r, n in (targets or {}).items()}} + + +class InvoiceComparisonTests(unittest.TestCase): + def test_real_h4_split_is_uniformly_worse(self): + result = M.compare_invoices(invoice({4: 1}), invoice({2: 2})) + self.assertEqual(result["classification"], "uniformly_worse") + self.assertEqual(result["signed_net_delta"], {"2": 2, "4": -1}) + self.assertEqual(result["hinges"], [{"rank": 0, "value": 0}, + {"rank": 2, "value": 2}, + {"rank": 4, "value": 0}]) + self.assertEqual(result["rank_mass"]["delta"]["paid_minus_targets"], 0) + self.assertEqual(result["power_moment"]["new_minus_old_sign"], "strictly_positive") + + def test_owned_relation_debits_surrendered_h9_target(self): + result = M.compare_invoices(invoice({1: 1, 8: 1}, {9: 1}), invoice()) + self.assertEqual(result["classification"], "uniformly_better") + self.assertEqual(result["delta_targets"], {"9": -1}) + self.assertEqual(result["signed_net_delta"], {"1": -1, "8": -1, "9": 1}) + self.assertEqual([row["value"] for row in result["hinges"]], [0, -1, -1, 0]) + self.assertEqual(result["power_moment"]["new_minus_old_sign"], "strictly_negative") + + def test_scalar_only_and_equal_net_moments(self): + self.assertEqual(M.compare_invoices(invoice({4: 1}), invoice({4: 1}))["classification"], "equal") + result = M.compare_invoices(invoice(), invoice({7: 2}, {7: 2})) + self.assertEqual(result["classification"], "equal") + self.assertEqual(result["delta_paid"], {"7": 2}) + self.assertEqual(result["delta_targets"], {"7": 2}) + + def test_mixed_hinges_are_inconclusive(self): + result = M.compare_invoices(invoice({2: 3}), invoice({1: 4})) + self.assertEqual(result["classification"], "inconclusive") + self.assertEqual(result["power_moment"]["new_minus_old_sign"], "not_determined") + + def test_unequal_mass_and_large_gaps_need_no_expanded_rank_array(self): + result = M.compare_invoices(invoice(), invoice({145: 1})) + self.assertEqual(result["classification"], "uniformly_worse") + self.assertEqual(result["rank_mass"]["delta"]["paid"], 145) + value = invoice({M.MAX_RANK: 1}) + value["contract"]["ambient_rank"] = M.MAX_RANK + zero = copy.deepcopy(value) + zero["paid"] = {} + self.assertEqual(len(M.compare_invoices(zero, value)["hinges"]), 2) + + def test_exhaustive_independent_discrete_slope_tariffs(self): + # Every extreme tariff min(r,k), including linear r, occurs among these + # slopes. Direct cumulative evaluation is independent of hinge code. + slopes = [s for s in itertools.product(range(3), repeat=4) + if all(s[i] >= s[i + 1] for i in range(3))] + tariffs = [list(itertools.accumulate(s)) for s in slopes] + for delta in itertools.product(range(-2, 3), repeat=4): + old = invoice({r: -d for r, d in enumerate(delta, 1) if d < 0}) + new = invoice({r: d for r, d in enumerate(delta, 1) if d > 0}) + # Add matching but nonconstant paid/target entries to exercise the + # signed presentation without changing its actual tariff value. + new["targets"] = {str(r): r for r in range(1, 5)} + old["targets"] = dict(new["targets"]) + values = [sum(d * f for d, f in zip(delta, tariff)) for tariff in tariffs] + expected = ("equal" if not any(delta) else + "uniformly_better" if max(values) <= 0 else + "uniformly_worse" if min(values) >= 0 else "inconclusive") + self.assertEqual(M.compare_invoices(old, new)["classification"], expected, delta) + + def test_changed_contract_rejected(self): + for key, value in (("model", "other"), ("rank_semantics", "different rank"), + ("ambient_rank", 146), ("boundary", "different ownership")): + old, new = invoice(), invoice() + new["contract"][key] = value + with self.assertRaisesRegex(ValueError, "contracts differ"): + M.compare_invoices(old, new) + + def test_histogram_and_contract_domain_rejections(self): + for histogram in ({"01": 1}, {"0": 1}, {"+1": 1}, {"1.0": 1}, + {" 1": 1}, {"١": 1}, {"146": 1}, {"1": True}, + {"1": -1}, {"1": 1.0}, {"1": 10**61}, + {"1" * 10000: 1}, {True: 1}): + value = invoice() + value["paid"] = histogram + with self.assertRaises(ValueError): + M.validate_invoice(value) + for contract in ({}, {**invoice()["contract"], "ambient_rank": True}, + {**invoice()["contract"], "boundary": " "}, + {**invoice()["contract"], "model": "x" * (M.MAX_TEXT + 1)}): + value = invoice() + value["contract"] = contract + with self.assertRaises(ValueError): + M.validate_invoice(value) + + def test_json_duplicate_numbers_and_resource_controls(self): + good = json.dumps(invoice()).encode() + cases = [good.replace(b'"paid": {}', b'"paid": {"1":1,"1":2}'), + good.replace(b'"paid": {}', b'"paid": {"1":' + b'9' * 5000 + b'}'), + good.replace(b'"paid": {}', b'"paid": {"1":NaN}'), + good.replace(b'"paid": {}', b'"paid": {"1":1e5}'), + b'x' * (M.MAX_BYTES + 1), b'\xff', b'[' * 2000] + for raw in cases: + with self.assertRaises(ValueError): + M.parse_invoice(raw) + too_many = invoice() + too_many["contract"]["ambient_rank"] = M.MAX_RANK + too_many["paid"] = {str(r): 0 for r in range(1, M.MAX_SUPPORT + 2)} + with self.assertRaises(ValueError): + M.validate_invoice(too_many) + + def test_cli_binds_exact_bytes_and_rejects_cleanly(self): + with tempfile.TemporaryDirectory() as folder: + old_path, new_path = Path(folder) / "old.json", Path(folder) / "new.json" + old_raw = (json.dumps(invoice({1: 1, 8: 1}, {9: 1})) + "\n").encode() + old_path.write_bytes(old_raw) + new_path.write_text(json.dumps(invoice())) + completed = subprocess.run([sys.executable, "-I", "-B", str(SCRIPT), + str(old_path), str(new_path)], capture_output=True, text=True) + self.assertEqual(completed.returncode, 0, completed.stderr) + report = json.loads(completed.stdout) + self.assertEqual(report["classification"], "uniformly_better") + self.assertEqual(report["inputs"]["old"]["sha256"], sha256(old_raw).hexdigest()) + new_path.write_text('{"paid":{"1":' + '9' * 5000 + '}}') + failed = subprocess.run([sys.executable, "-I", "-O", "-B", str(SCRIPT), + str(old_path), str(new_path)], capture_output=True, text=True) + self.assertEqual(failed.returncode, 2) + self.assertEqual(failed.stdout, "") + self.assertEqual(json.loads(failed.stderr)["status"], "INVALID_RECURSIVE_INVOICE") + self.assertNotIn("Traceback", failed.stderr) + + +if __name__ == "__main__": + unittest.main()