SORILUN-RSI / research /tests /context_verify.py
PureOne's picture
Add SORILUN research dataset release
aff9293 verified
Raw History Blame Contribute Delete
1.13 kB
from pathlib import Path
import sys,json
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'src'))
from context_policy import ContextPolicy
def run():
policy=ContextPolicy.from_gate(ROOT/'results/hardware_gate.json');checks=0;rows=[]
for family in ['reciprocal','exponential','reversion','implicit_catalan','convolution']:
for n in [32,64,128,256,512,1024,2048,4096,8192]:
c=policy.choose_cap(family,n)
allowed=any((fam,n0)==(family,n) and cap==c for fam,n0,cap in policy.accepted)
assert c==0 or allowed;checks+=1
if family!='reciprocal':assert c==0;checks+=1
rows.append({'family':family,'length':n,'cap':c})
result={'assertions':checks,'all_passed':True,'accepted_contexts':list(policy.accepted),
'rows':rows,'limitation':'Context quarantine prevents unvalidated export; it does not prove no future timing drift. Lookup overhead remains real.'}
(ROOT/'results/context_verification.json').write_text(json.dumps(result,indent=2));print(json.dumps(result,indent=2))
return result
if __name__=='__main__':run()