VELORYN-Boundary-Kernel-Entropy / examples /cross_version_regression.py
PureOne's picture
Release VELORYN v1.0.0: boundary-kernel entropy theory
1c08905 verified
Raw History Blame Contribute Delete
1.22 kB
"""Reproduce the three exact fair-Salem moments recorded by the input v6 release.
These fixed integer constants are historical regression targets, not independent
proofs. No file or code from the earlier release is required to run this script.
"""
from fractions import Fraction as Q
from pathlib import Path
import json
import sys
sys.path.insert(0,str(Path(__file__).resolve().parents[1]))
from veloryn import collision_matrix
from veloryn.examples import fair
TARGETS={20:4119392,64:15531370961563437757056,
128:1930790484095185524333598330165083738834124712}
records=[]
for n,numerator in TARGETS.items():
matrix,diag=collision_matrix(fair('salem'),n,2)
expected=Q(numerator,4**n)
if matrix[0][0]!=expected:
raise AssertionError(f'exact v6 regression failed at depth {n}')
records.append({'depth':n,'historical_numerator':str(numerator),
'historical_denominator':'4**'+str(n),
'exact_match':True,'max_layer_states':diag['max_layer_states']})
print('exact fair-Salem regression passed:',n,flush=True)
root=Path(__file__).resolve().parents[1]
(root/'evidence'/'cross_version_regression.json').write_text(json.dumps(records,indent=2)+'\n')