Port scripts/gen_w384_lean.py (Python, 8 functions) to specs/port/scripts/gen_w384_lean.t27 - #6555
Merged
Merged
Conversation
…ean.t27 One-commit replacement of the earlier PR for this issue: its follow-up commit lacked an issue reference and failed L1 TRACEABILITY. The spec is the final version from that PR (tests compare with std.mem.eql, no copied helper). Closes #6080 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6080
Ports
scripts/gen_w384_lean.pytospecs/port/scripts/gen_w384_lean.t27. One file,.t27only.Design
The original builds Lean theorem text. t27 has no string concatenation or f-strings. Rather than reduce the text to integer stand-ins, this port builds the same text byte for byte into byte buffers that the caller supplies. A function that returned
strwrites intobufatposand returns the end position. A function that returned(str, str)writes into two buffers and returns both lengths.var_names(n, sep, buf, pos)writes the first n names joined bysep, skipping the Lean keywords in the original's skip set. Every caller of the Pythonlist[str]either joins it or walks it, so activations are carried as name ordinals.nest_mac,plus_chain,minus_chain,cancellation_chain,zero_weight_closureandtheorem_blockare ported in full.main()keeps anundefined;body that no test calls, because it does file I/O and prints. Its two decisions are ported and tested:already_present, the idempotence check;w384_appendix, the exact text main appends ("\n\n" + "\n\n".join(blocks) + "\n").put_forallwrites the UTF-8 bytesE2 88 80.Every expected value in the tests was printed by running the Python original:
Acceptance criteria
These were run on the Railway t27c lab, with t27c built from origin/master e7afb32.
gen-rustandgen-calso succeed.coveragelists 22 functions with 17 tested directly. The other 5 aremain, which is plumbing, and four byte writers that the string-equality tests exercise.Negative control. I changed three expected values (the appendix hash,
"a + b"to"a+b", and the 62-name length from 159 to 160).test-reportthen printedpass 9, FAIL 3, naming exactly those tests.Note. duplicate-bodies flagged the local
bytes_eqas a copy ofgen_w367.t27'sslices_equal. The tests now usestd.mem.eql, andcontainscompares bytes inline. The criteria above and the negative control were re-run after that change.Replaces #6531. That PR had the same file, but its second commit had no issue reference and failed L1 TRACEABILITY. This PR has the same final spec in one commit.
🤖 Generated with Claude Code