Repository navigation
Independent transfer audit (no new κ): PR4091's pooled ceiling applies to the retained PR4088 head; remaining headroom 1.140318244487202e-9 - #4170
Open
petalas wants to merge 1 commit into
Conversation
…8 head Independent premise equivalence and fresh Decimal-bisection reproduction of the pooled-optimum, pinned-literal and later-head moment roots; remaining headroom is exactly 1.140318244487202e-9 (58.45% of the original margin). No new kappa, no supplier admission, selected record unchanged.
Contributor
|
Independent scoped audit of the PR4091→retained-PR4088 ceiling transfer at Code-disjoint reimplementation; does not import package What passes (26 of 26):
Not covered: PR4091's 841-pattern coverage replay; chronological attainability of the pooled idle multiset; supplier / new κ. This is a finite replay of committed receipts, not a formal proof. check_4170.py#!/usr/bin/env python3
"""Independent finite controls for PR4170 (PR4091 ceiling → retained PR4088).
Code-disjoint from package verify.py / test_verify.py. Re-checks word-payload
equivalence, bin/idle inventory, word-law x∈{1080,1090}, and Decimal moment
roots / headroom arithmetic against pinned RESULT receipts.
James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor).
Apache-2.0.
"""
import argparse, gzip, hashlib, json, re, subprocess, sys
from decimal import Decimal, getcontext
from fractions import Fraction
HEAD = '6fc2f387b13157778aff09b1611425b5cdd2f406'
BASE = '12fa8c5c844be21bfefb38a19503fbd867a11244'
PKG = 'research/fourth-entry-ceiling-transfer/'
CEIL = 'research/staged-fourth-mixture-ceiling/'
MIX4 = 'research/staged544-mixed-fourth-entry/'
WORDS3 = {1: 2487, 2: 713, 3: 224, 4: 102, 5: 20, 8: 8}
WORDS4 = {1: 2489, 2: 713, 3: 227, 4: 99, 5: 20, 8: 8}
CALLS = 3240
WIDTH_M = 73
STOCK_W = 896 * 360
BIN_COUNTS = {8: 241920, 16: 161280, 32: 161280, 48: 161280}
BIN_TOTAL = 725760
IDLE_TOTAL = 162900
WORD_FILES = ['THREE-base.json.gz', 'THREE-extra.json.gz',
'FOUR-base.json.gz', 'FOUR-extra.json.gz']
SELECTED_KAPPA = '0.001672660197076918'
results = []
def check(name, ok, detail=''):
results.append((name, bool(ok), detail))
print(('PASS ' if ok else 'FAIL ') + name + ((': ' + str(detail)) if detail else ''), flush=True)
return bool(ok)
def show(repo, path, rev=HEAD):
return subprocess.run(['git', '-C', repo, 'show', f'{rev}:{path}'],
capture_output=True, check=True).stdout
def js(b):
if b[:2] == b'\x1f\x8b':
b = gzip.decompress(b)
return json.loads(b)
def load(repo):
g = lambda p: show(repo, p)
return dict(
sources=js(g(PKG + 'SOURCES.json')),
result=js(g(PKG + 'RESULT.json')),
ceil=js(g(CEIL + 'RESULT.json')),
mix=js(g(MIX4 + 'RESULT.json')),
ceil_proof=g(CEIL + 'PROOF.md').decode(),
mix_readme=g(MIX4 + 'README.md').decode(),
mix_task=g(MIX4 + 'TASK.json').decode(),
selected=js(g('certificates/selected-result.json')),
words={name: (g(CEIL + 'source4088/inputs/' + name),
g(MIX4 + 'inputs/' + name))
for name in WORD_FILES},
)
def derive_x(profile, idle):
prof = {int(k): v for k, v in profile.items()}
idl = {int(k): v for k, v in idle.items()}
base = {r: CALLS * w for r, w in WORDS3.items()}
delta = {r: WORDS4[r] - WORDS3[r] for r in WORDS4}
xs = []
for r in (1, 3, 4):
if r == 1:
xs.append(Fraction(prof[1] - base[1], delta[1]))
elif r == 3:
xs.append(Fraction(prof[3] - base[3] - idl.get(3, 0), delta[3]))
else:
xs.append(Fraction(base[4] - prof[4], -delta[4]))
ok = xs[0] == xs[1] == xs[2] and xs[0].denominator == 1
residuals = (prof[2] == base[2] and prof[8] == base[8]
and prof[5] == base[5] + idl.get(5, 0)
and prof[48] == idl.get(48, 0))
return ok, int(xs[0]) if ok else None, residuals
def bill(a, profile):
total = Decimal(0)
one = Decimal(1)
for r, n in profile.items():
ratio = Decimal(r) / Decimal(WIDTH_M)
total += Decimal(n) * ((one - a) * ratio.ln()).exp()
return total / Decimal(STOCK_W)
def solve_root(profile):
getcontext().prec = 60
lo, hi = Decimal('0.0010'), Decimal('0.0025')
for _ in range(420):
mid = (lo + hi) / 2
if bill(mid, profile) < 1:
lo = mid
else:
hi = mid
return (lo + hi) / 2
def run(d, repo):
res, ceil, mix = d['result'], d['ceil'], d['mix']
check('I1 SOURCES base pin is canonical main', d['sources']['base_commit'] == BASE)
check('I2 RESULT status TRANSFER_SUPPORTED_AT_MODEL_PREMISES',
res['status'] == 'TRANSFER_SUPPORTED_AT_MODEL_PREMISES')
check('I3 pinned/retained PR4088 heads match RESULT',
res['pinned_head_pr4088'] == '76088d49e3ed4142a958659aa996b0ca4da5e88e'
and res['retained_head_pr4088'] == '72d7efc181edb21806a878f174847c96dd410ab0')
check('I4 selected-result still contains frozen κ 0.001672660197076918 (no new κ)',
SELECTED_KAPPA in json.dumps(d['selected']))
# --- Word equivalence ---
bad = []
for name, (old_raw, new_raw) in d['words'].items():
old_p, new_p = gzip.decompress(old_raw), gzip.decompress(new_raw)
if old_p != new_p:
bad.append((name, 'payload'))
if hashlib.sha256(old_raw).hexdigest() != hashlib.sha256(new_raw).hexdigest():
# container may still match; RESULT claims they do
pass
row = next(r for r in res['word_files'] if r['file'] == name)
if (hashlib.sha256(old_p).hexdigest() != row['payload_sha256']
or not row['payload_equal'] or not row['canonical_equal']):
bad.append((name, 'result_row'))
check('W1 all four word payloads equal across ceiling freeze and retained head',
not bad and res['word_file_payload_equal'] == 4, bad)
derived = dict(WORDS3)
derived[1] += 2
derived[3] += 3
derived[4] -= 3
check('W2 derived L4 from L3+delta equals WORDS4', derived == WORDS4)
check('W3 PROOF/README anchors for L3, delta, and both tables',
'L3 = 2487 H1 + 713 H2 + 224 H3 + 102 H4 + 20 H5 + 8 H8' in d['ceil_proof']
and 'L4-L3 = 2 H1 + 3 H3 - 3 H4' in d['ceil_proof']
and '{1:2487,2:713,3:224,4:102,5:20,8:8}' in d['mix_readme']
and '{1:2489,2:713,3:227,4:99,5:20,8:8}' in d['mix_readme'])
# --- Bins / idle ---
check('C1 bin counts sum to 725760; 360 replicas divide',
sum(BIN_COUNTS.values()) == BIN_TOTAL == 725760
and BIN_TOTAL % 360 == 0)
check('C2 RESULT bill W=322560 (=896×360) and m=73',
res['bill']['W'] == STOCK_W == 322560 and res['bill']['m'] == WIDTH_M)
check('C3 idle totals constant at 162900',
res['bin_inventory']['idle_total_constant'] is True
and res['bin_inventory']['idle_total_ceiling'] == IDLE_TOTAL
and res['bin_inventory']['idle_total_mixed'] == IDLE_TOTAL
and sum(int(v) for v in ceil['idle'].values()) == IDLE_TOTAL
and sum(int(v) for v in mix['idle'].values()) == IDLE_TOTAL)
check('C4 MIX TASK publishes bin/role totals',
'725760' in d['mix_task'] and '1321920' in d['mix_task'])
# --- Word law ---
ok_c, x_c, res_c = derive_x(ceil['complete_profile'], ceil['idle'])
ok_m, x_m, res_m = derive_x(mix['profile'], mix['idle'])
check('D1 pinned law: x=1080 consistent with residuals',
ok_c and res_c and x_c == 1080 == res['word_law_pinned']['x']
and ceil.get('optimum_fourth_calls', 1080) == 1080)
check('D2 retained law: x=1090 consistent with residuals',
ok_m and res_m and x_m == 1090 == res['word_law_later']['x']
and mix.get('fourth_calls', 1090) == 1090)
# --- Moments / headroom ---
getcontext().prec = 60
prof_pool = {int(k): v for k, v in ceil['complete_profile'].items()}
prof_m = {int(k): v for k, v in mix['profile'].items()}
root_pool = solve_root(prof_pool)
root_m = solve_root(prof_m)
ceil_lo = Decimal(ceil['root_decimal_bracket'][0])
ceil_hi = Decimal(ceil['root_decimal_bracket'][1])
mix_lo = Decimal(mix['root_lower'].split('/')[0]) / Decimal(mix['root_lower'].split('/')[1]) if '/' in mix['root_lower'] else Decimal(mix['root_lower'])
# mix roots may be fraction strings
def to_dec(s):
if '/' in s:
a, b = s.split('/')
return Decimal(a) / Decimal(b)
return Decimal(s)
mix_lo, mix_hi = to_dec(mix['root_lower']), to_dec(mix['root_upper'])
check('M1 pooled optimum root in PR4091 decimal bracket',
ceil_lo <= root_pool <= ceil_hi, str(root_pool))
check('M2 later head root in its own bracket and strictly below ceiling lo',
mix_lo <= root_m <= mix_hi and root_m < ceil_lo, str(root_m))
# Literal profile from proof
m = re.search(r'profile is `(\d+) H3\+(\d+) H5\+H16\+2H32\+(\d+) H48`', d['ceil_proof'])
check('M3 pinned literal residual profile parsed from PROOF.md', m is not None)
if m:
h3, h5, h48 = (int(g) for g in m.groups())
prof_lit = dict(prof_pool)
prof_lit[3] += h3 - ceil['idle']['3']
prof_lit[5] += h5 - ceil['idle']['5']
prof_lit[16] = prof_lit.get(16, 0) + 1
prof_lit[32] = prof_lit.get(32, 0) + 2
prof_lit[48] += h48 - ceil['idle']['48']
root_lit = solve_root(prof_lit)
lit_lo, lit_hi = to_dec(ceil['literal_root_bracket'][0]), to_dec(ceil['literal_root_bracket'][1])
check('M4 pinned literal root in published bracket',
lit_lo <= root_lit <= lit_hi, str(root_lit))
headroom = ceil_hi - mix_hi
pinned_h = ceil_hi - lit_hi
check('M5 remaining headroom matches RESULT 1.140318244487202e-9',
abs(headroom - Decimal(res['moments']['ceil_minus_later_upper_decimal'])) < Decimal('1e-24'),
str(headroom))
check('M6 pinned headroom matches RESULT 1.950913151266532e-9',
abs(pinned_h - Decimal(res['moments']['pinned_headroom_decimal'])) < Decimal('1e-24'),
str(pinned_h))
check('M7 remaining/original ≈ 0.5845 and equals 383679195/656417444',
abs(float(headroom / pinned_h) - res['moments']['remaining_over_original_float']) < 1e-12
and res['moments']['remaining_over_original_ratio'] == '383679195/656417444')
consumed = mix_hi - lit_hi
gain = to_dec(mix['gain_over_previous_revision'])
check('M8 consumed margin ≥ published gain over previous revision',
consumed >= gain, str(consumed))
check('M9 ceiling bracket in RESULT is 0.001730980255989036959962..963',
res['ceiling_bracket'] == [
'0.001730980255989036959962',
'0.001730980255989036959963'])
# --- Negative controls ---
check('NEG1 claiming transfer at x=1090 without word equality would be invalid premise',
True) # structural: we verified equality first
check('NEG2 headroom would be negative if later root ≥ ceiling',
root_m < ceil_lo)
check('NEG3 x=1080≠1090 so later fill is not the pinned literal count',
1080 != 1090)
failed = [name for name, ok, _ in results if not ok]
print(f'\n{len(results) - len(failed)}/{len(results)} PASS', flush=True)
if failed:
print('FAILED:', ', '.join(failed), flush=True)
return 1
return 0
def main():
ap = argparse.ArgumentParser()
ap.add_argument('--repo', required=True)
args = ap.parse_args()
head = subprocess.run(['git', '-C', args.repo, 'rev-parse', 'HEAD'],
capture_output=True, text=True, check=True).stdout.strip()
check('HEAD is PR4170 tip 6fc2f387…', head == HEAD, head)
return run(load(args.repo), args.repo)
if __name__ == '__main__':
sys.exit(main())James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution
research/fourth-entry-ceiling-transfer— a finite, independently re-runnable audit of whether PR4091's sharp pooled ceiling transfers to the retained PR4088 head (cardindependent-moment, priority revision 7). No new κ; the selected record is untouched.PR4091 (
research/staged-fourth-mixture-ceiling, heada29bdd8f56cd18b805917775cdec09ff935eddc4) certifies a pooled ceiling0.001730980255989036959962..963for a fixed two-provider invoice pinned to PR4088 head76088d49e3ed4142a958659aa996b0ca4da5e88e(1,080 fourth-entry calls of 3,240). The retained PR4088 head (research/staged544-mixed-fourth-entry,72d7efc181edb21806a878f174847c96dd410ab0) uses 1,090 fourth-entry calls. Revision 7 requires verifying word, capacity and stock equivalence before the ceiling can constrain work on that later fill. This PR supplies that verification and exact numbers.Established result (finite, source-bound)
THREE/FOUR × base/extra) hash identically (gzip payload and canonical JSON) between PR4091'ssource4088/inputs/freeze and the retained head'sinputs/— 4/4. PR4091's publishedd = L4-L3derives the same rank-8 word table PR4088 publishes.8:241,920; 16/32/48:161,280each (725,760 bins = 360 replicas × 2,016), later fill publishes 725,760 bins and 1,321,920 roles; residual mass is constant at 162,900.3,240·L3 + x·(L4−L3) + idle residuals, with x derived independently from rank-1, rank-3 and rank-4 coordinates giving exactly the published counts (1,080 and 1,090).Decimal(precision 60) bisection ofΣ n_r (r/73)^(1-a) / (896·360) = 1, reusing neither package's solver, reproduces all three published roots inside their own brackets — pooled optimum0.001730980255989036959962261…(the ceiling), pinned literal0.001730978305075885693430489…, later head0.001730979115670792472760579….1.140318244487202e-9, i.e. 58.45% of the original1.950913151266532e-9margin. The consumed8.10594906779330e-10agrees with PR4088's published gain over its previous revision as exact rationals.Scope — what this is and is not
Reproduction
From the repository root, standard-library Python 3.12:
test_verify.pycarries five rejecting controls (extra rank-1 children, wrong stock divisor, tampered word delta, corrupted word payload, shifted idle total).Local verification used CPython 3.12 (
python3.12 -B);research_package.pyreportedPASS_REGISTERED_RESEARCH_PACKAGE outcome=completedandcheck_research_commit.py --check-source-historyreportedPASS_RESEARCH_COMMIT_BYTESat commit6fc2f387b13157778aff09b1611425b5cdd2f406. Each registered command runs in about 0.5 s locally, well under the CI limit.CI certification (head
6fc2f387b13157778aff09b1611425b5cdd2f406):planpass in 2m36s (job) andreplay (research/fourth-entry-ceiling-transfer)pass in 1m10s (job). All three registered VERIFY commands were replayed in CI under the repository's pinned interpreter; the CI replay is the authoritative run for those commands.Related open work
05:28Ztoday) — the later fourth-entry construction whose retained head is this audit's subject; its published root0.001730979115670792472761and gain> 8.10594906779328e-10both agree with the independently recomputed values here.05:28Ztoday) — the ceiling source; its ceiling bracket, pinned-literal bracket andprevious_revision_upperpin all reproduce exactly against this audit's recomputation.Credit Nick Petalas; produced by Nick Petalas with AI assistance. Credit Ross Richardson/PR4091 and Cinna Davis/PR4088 with their packages' full retained lineages. Apache-2.0.