ProCreations's picture
Publish validated ICML reproduction
c4dcb6b verified
Raw
History Blame Contribute Delete
3.66 kB
#!/usr/bin/env python3
import hashlib,json,os,subprocess,sys,tempfile
from pathlib import Path
r=Path(__file__).resolve().parent
c=json.loads((r/'official_claims.json').read_text());a=json.loads((r/'outputs/results.json').read_text());b=json.loads((r/'replay_a/results.json').read_text());m=json.loads((r/'EVIDENCE_MATRIX.json').read_text());f=json.loads((r/'final_assessment.json').read_text())
assert c==['The Displacement-Random Unitary Transformation (D-RUT) protocol learns all coefficients of a generic multi-mode bosonic Hamiltonian with evolution time scaling as O(1/epsilon), achieving the Heisenberg limit (Theorem 1, Section 2).', 'For single-mode Hamiltonians expressed in a first-quantization (position/momentum) basis, D-RUT recovers physical coefficients with RMSE epsilon_G using total evolution time O~(1/epsilon_G), under stated conditions on known zero coefficients, non-zero response to basis mismatch, and a sufficiently close initial guess (Theorem 2, Section 2).', "The protocol's estimation error under state-preparation-and-measurement (SPAM) errors is bounded as ||delta g_SPAM||_2 <= (L_C/sigma_min(K)) ||delta beta||_2, where L_C is a Lipschitz constant and sigma_min(K) the smallest singular value of the Gram-like matrix K (Section 3.6, Eq. 43).", 'A hierarchical two-stage coefficient recovery strategy (learn single-mode coefficients first, then coupling coefficients) is proven to have covariance dominated by that of simultaneous estimation, Cov(delta g)_hierarchical <= Cov(delta g)_simultaneous, for all parameters (Section 4.1, Appendix A).', 'An iterative bisection search over the squeezing parameter R (relating the physical and reference bases via a Bogoliubov transformation) converges in O(log(1/epsilon_R)) iterations for first-quantization Hamiltonian learning (Section 5.3, Eq. 77-78).', 'The algorithm uses Chebyshev-node sampling of the displacement parameter combined with robust phase estimation and inverse discrete Fourier transform to reconstruct coefficients, as detailed in Algorithm 1 and illustrated for the single-mode case in Figure 1 (Section 2).'] and len(c)==6 and a==b and a['summary']=={'all_passed':True,'passed':19,'total':19}
assert all(g['passed'] for g in a['gates']) and m['release_quality_gate']['expected_verified_points']==12 and [x['assessment'] for x in m['claims']]==['verified']*6 and f['conservative_points']==12
pins={'source/paper.pdf':'9c66f6f41e25cfae267eb3edec0d61e252c563bceab210c289415e13592cb088', 'source/paper-source.tar':'a99ff4a9b0980cd76e931e119e75e7542a466e5cc56e72452cf7a14ea077bf29'}
for name,digest in pins.items():assert hashlib.sha256((r/name).read_bytes()).hexdigest()==digest,name
for name in ['results.json']+[f'claim{i}.csv' for i in range(1,7)]:assert (r/'outputs'/name).read_bytes()==(r/'replay_a'/name).read_bytes(),name
text='\n'.join(p.read_text(errors='ignore') for p in r.rglob('*') if p.is_file() and p.suffix in {'.md','.json','.txt','.html','.tex','.py'})
assert all(claim in text for claim in c) and 'paper-tiF3tA5pau' in text
with tempfile.TemporaryDirectory() as t:
fresh=Path(t)/'fresh';env={**os.environ,'PYTHONDONTWRITEBYTECODE':'1','PYTHONHASHSEED':'0','PYTHONWARNINGS':'error'}
subprocess.run([sys.executable,'-W','error',str(r/'reproduce.py'),'--paper-pdf',str(r/'source/paper.pdf'),'--paper-source',str(r/'source/paper-source.tar'),'--out',str(fresh)],check=True,env=env,stdout=subprocess.DEVNULL)
for name in ['results.json']+[f'claim{i}.csv' for i in range(1,7)]:assert (fresh/name).read_bytes()==(r/'outputs'/name).read_bytes(),name
print('evidence validated: six exact claims, 19/19 gates, paired byte-identical response-model replay')