把黎曼猜想的 Lean 证明,写成人能读懂的证明
把黎曼猜想的 Lean 证明写成数学家能读的证明文章,以及人人能看懂的证明思路
| 1 | """Resume exact dependency fetches without restaging the original source tree.""" |
| 2 | import argparse,hashlib,json,os,subprocess,time |
| 3 | from pathlib import Path |
| 4 | SOURCE_TREE='24df20b62d9976ccd20da819bc20b16f808f0fdd' |
| 5 | def main(): |
| 6 | p=argparse.ArgumentParser(description=__doc__);p.add_argument('--project',type=Path,required=True);p.add_argument('--report',type=Path,required=True);a=p.parse_args();root=a.project.resolve() |
| 7 | git=['git','-c','credential.helper=','-c','core.longpaths=true','-c','http.version=HTTP/1.1','-c','http.lowSpeedLimit=1024','-c','http.lowSpeedTime=60'] |
| 8 | if os.name=='nt':git+=['-c','http.sslBackend=schannel'] |
| 9 | tree=subprocess.check_output(git+['-C',str(root),'rev-parse','HEAD:src'],text=True).strip() |
| 10 | if tree!=SOURCE_TREE:raise ValueError('unexpected private source tree') |
| 11 | raw=(root/'lake-manifest.json').read_bytes() |
| 12 | if hashlib.sha256(raw).hexdigest()!='fee57ee9ed399d0a638ca955e5ad40a37a36eeb9b6dfd9f5964114fa7bbe4774':raise ValueError('dependency manifest mismatch') |
| 13 | manifest=json.loads(raw);records={} |
| 14 | for index,package in enumerate(manifest['packages'],1): |
| 15 | dest=root/'.lake/packages'/package['name'];revision=package['rev'] |
| 16 | if not (dest/'.git').exists():subprocess.run(git+['init',str(dest)],check=True) |
| 17 | existing=subprocess.run(git+['-C',str(dest),'remote','get-url','origin'],capture_output=True,text=True) |
| 18 | if existing.returncode:subprocess.run(git+['-C',str(dest),'remote','add','origin',package['url']],check=True) |
| 19 | elif existing.stdout.strip()!=package['url']:raise ValueError('unexpected dependency remote') |
| 20 | for attempt in range(5): |
| 21 | present=subprocess.run(git+['-C',str(dest),'cat-file','-e',revision+'^{commit}'],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL).returncode==0 |
| 22 | if present:break |
| 23 | print(f'Fetching exact dependency {package["name"]}, attempt {attempt+1}',flush=True) |
| 24 | r=subprocess.run(git+['-C',str(dest),'fetch','--depth=1','origin',revision]) |
| 25 | if r.returncode==0:break |
| 26 | if attempt==4:raise RuntimeError('dependency fetch failed; safe to resume') |
| 27 | time.sleep(3) |
| 28 | subprocess.run(git+['-C',str(dest),'checkout','--detach',revision],check=True) |
| 29 | actual=subprocess.check_output(git+['-C',str(dest),'rev-parse','HEAD'],text=True).strip() |
| 30 | if actual!=revision:raise ValueError('dependency revision mismatch') |
| 31 | records[package['name']]=actual;print(f'progress: {index}/{len(manifest["packages"])} exact dependencies ready',flush=True) |
| 32 | a.report.write_text(json.dumps({'source_tree':tree,'dependencies':records,'scope':'Pinned source checkouts; no proof build.'},indent=2)+'\n',encoding='utf-8') |
| 33 | print('Exact dependency checkouts ready.',flush=True) |
| 34 | if __name__=='__main__':main() |