Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
recursive-self-improvement
autonomous-learning
formal-power-series
exact-arithmetic
certified-compilation
reproducible-research
Download research/tests/support_verify.py from PureOne/SORILUN-RSI: direct link, hf CLI and curl.
- Browser
- Download file 1.65 kB
-
https://huggingface.co/datasets/PureOne/SORILUN-RSI/resolve/main/research/tests/support_verify.py
- Command line
-
hf download hf://datasets/PureOne/SORILUN-RSI/research/tests/support_verify.py
-
curl -L -o support_verify.py https://huggingface.co/datasets/PureOne/SORILUN-RSI/resolve/main/research/tests/support_verify.py
1.65 kB
| from pathlib import Path | |
| import sys,json,time,math | |
| import numpy as np | |
| ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'src')) | |
| from resonant import * | |
| def run(): | |
| count=0;examples=[];rng=np.random.default_rng(731091) | |
| for p in [2,3,5,7]: | |
| for j in range(1,35): | |
| for minimum in [1,2]: | |
| expected=next((k for k in range(minimum,j+1) if math.comb(j,k)%p),math.inf) | |
| assert first_live_binomial(j,p,minimum)==expected;count+=1 | |
| for r in [p,p*p]: | |
| n=min(r*r,200) | |
| if r>=n:continue | |
| f=padded([0,1],n,p);delta=np.zeros(n,dtype=np.int64);delta[r]=1 | |
| R=Ring(p);out,cert=support_certified_update(f,f,delta,n,R) | |
| assert np.array_equal(out,R.inverse((f+delta)%p,n));count+=1 | |
| examples.append({'p':p,'patch_order':r,'precision':n,'certificate':cert, | |
| 'generic_bound':2*r-1,'passed':True}) | |
| for rep in range(24): | |
| n=41;R=Ring(p);f=rng.integers(0,p,n,dtype=np.int64);f[:2]=[0,1] | |
| r=int(rng.integers(2,21));d=rng.integers(0,p,n,dtype=np.int64);d[:r]=0;d[r]=1 | |
| cert=transport_precision_bound(f,d,p);k=min(n,cert['certified_precision'] or n) | |
| s=R.inverse(f,k) | |
| out,cert=support_certified_update(f[:k],s,d[:k],k,R) | |
| assert np.array_equal(out,R.inverse((f[:k]+d[:k])%p,k));count+=1 | |
| result={'assertions':count,'all_passed':True,'examples':examples} | |
| (ROOT/'results/support_verification.json').write_text(json.dumps(result,indent=2)) | |
| print(json.dumps(result,indent=2));return result | |
| if __name__=='__main__':run() | |