Erdős #530 grid-certificate-78: gen_shards.py refuses a malformed certificate before writing and removes stale shards. On head 777431e. Python and NOTES.md only; git diff shows nothing under ErdosSwarm/.
Changes (experiments/erdos530/grid-certificate-78/)
- gen_shards.py: new
well_formed(k, group), called fromcheckbefore the replay. It exits non-zero, naming the entry, unless the centres are two natural numbers, every witness has 111 heights that are natural numbers below 65536 and a natural-number level, and every block is a pair (end, index) withtype(x) is int, end ≥ 0 and 0 ≤ index < number of witnesses (the test verify.py makes). All of this runs beforemkdir/any write. When writing, theC*.leanfiles of the output directory that the run does not produce are removed after the new ones are written, and their names printed. - emit_lean.py:
grid_check78raises ValueError on a block whose end or index is not a non-negative int instead of indexing the Python list from the end (4 lines; for valid input nothing changes). - NOTES.md: two sentences in the generator paragraph describing both cases.
Checks I ran (all python3 -IB, in the folder)
- Both defects reproduce with the scripts of HEAD copied to a temp folder: index −1 gives exit 0 and a C00.lean containing
, -1); 4 shards then--shards 2then--shards 2 --verifygives "files differ", rc 1. - Reproduction 1 with the fix (
row[2]["left"][0][1] = -1,--certificate bad.json --out DIR): message "entry 2, left block 0: witness index -1 is not one of 0, …, 0", rc 1, DIR not created. Also rc 1 with a named entry and no DIR for: negative end, index = number of witnesses, index 0.0, index true, end "3", height −1, level 1.5, centre −0.0. - Reproduction 2:
--out DIR(4 shards), then--out DIR --shards 2prints "removed 2 stale shards from DIR: C02.lean, C03.lean", DIR holds exactly C00.lean and C01.lean, and--out DIR --shards 2 --verifyexits 0. - Default output unchanged:
gen_shards.py --verifyexits 0 ("4 shards in …/GridData78 equal the generator's output");--outinto a fresh folder isdiff -r-identical to the committed GridData78; running the default write in the repository leavesgit statusclean under ErdosSwarm/.emit_lean.py --check(113 entries, 2791 blocks, same least margin 11009946797971040000) andverify.pystill pass. - scripts/check.sh: exit 0, last lines "Build completed successfully (9331 jobs)." and "8760 theorems use only propext, Classical.choice and Quot.sound; none of the 13320 constants under ErdosSwarm uses sorry".
Note for the reviewer: the stale-file removal deletes every C*.lean in --out that the run does not write, as the task asks; do not point --out at a folder holding other files of that name. Not changed: the missing-key case of a certificate already ended in a traceback before any write; it now gives a message instead.