Skip to content

chore(proofs): no axiom prints in library modules - #4247

Merged
tcoratger merged 1 commit into
ethereum:masterfrom
tcoratger:pf-no-build-commands
Nov 22, 2026
Merged

tcoratger merged 1 commit into
ethereum:masterfrom
tcoratger:pf-no-build-commands

Conversation

@tcoratger

Copy link
Copy Markdown
Collaborator

The nine #print axioms checks leave the two unforgeability modules, and a new CI check rejects any command such as #print, #eval or #check in a library module.
The axioms of those theorems stay checked: the declaration check of CI already fails on any theorem of EthLib that depends on an axiom beyond the three standard ones.

Closes #4236.

The problem

Proofs/Xmss/Unforgeability.lean and Proofs/Sphincs/Unforgeability.lean ended with nine commands of the form #guard_msgs in #print axioms <theorem>.
Each one runs again at every build of its module, so axiom checks lived in the build rather than in the check that CI runs for them.
Nothing stopped a new #eval or #check from landing in a library module either.

The idea

  • lake exe check-decls, the step "declarations" of CI, loads EthLib, EthLib.Proofs and EthLib.Exports and fails on any axiom beyond propext, Classical.choice and Quot.sound that a declaration depends on; its baseline lists no axiom finding.
    Both modules sit under EthLib.Proofs, so the nine guards only repeated it, and they go.
  • scripts/check_lean_commands.py reads every Lean file under EthLib/, blanks its comments and strings with the stripper of soundness_facts.py, and reports each line where a # keyword, such as #eval or #eval!, opens the line or follows in.
    A command that must run at build time goes in scripts/check_lean_commands_allowlist.txt, as path | reason | command line; an entry that matches no command fails the check.
  • CI runs the check and its tests next to the check of comments; CONTRIBUTING.md states the rule beside the rule on axioms.

Example

The XMSS module ended with six blocks like this one, now removed:

/--
info: 'EthLib.Cryptography.Xmss.Unforgeability.unforgeable' depends on axioms:
[propext, Classical.choice, Quot.sound]
-/
#guard_msgs (whitespace := lax) in
#print axioms EthLib.Cryptography.Xmss.Unforgeability.unforgeable

On the tree before this change, the new check reports 18 lines, one for each #guard_msgs and one for each #print.
It reports none of the 35 lines that open with a vector literal such as #v[...], since [ follows #v.

For reviewers

Checks

  • lake build --wfail EthLib.Cryptography.Proofs.Xmss.Unforgeability EthLib.Cryptography.Proofs.Sphincs.Unforgeability: success.
  • lake exe check-decls --scope EthLib.Cryptography.Proofs.Xmss --baseline <empty file> EthLib.Cryptography.Proofs.Xmss.Unforgeability: 7446 declarations, 0 findings; the same for SPHINCS: 9332 declarations, 0 findings.
  • python scripts/check_lean_commands.py: no finding; on upstream/master it reports the 18 lines above.
  • python -m unittest scripts/test_check_lean_commands.py: 11 tests pass; dropping the comment stripper, the keyword boundary, the allowlist match or the stale-entry report each makes a test fail.
  • uvx ruff check, uvx ruff format --check, uvx ty check, check_python_comments.py, check_docstrings.py on the new scripts: no finding.
  • check_writing.py --base upstream/master, check_lean_layout.py --base upstream/master, check_layers.py, soundness_facts.py --check, check_comment_code.py: no finding.

🤖 Generated with Claude Code

The two unforgeability modules ended with nine `#print axioms` commands
under `#guard_msgs`, which ran again at every build of the module.
`lake exe check-decls` in CI already fails on any axiom beyond the three
standard ones, for every theorem of these modules, so they go.

A new check, `scripts/check_lean_commands.py`, fails on any line of a
library module that runs a `#` command, outside comments and strings.
A command that must run at build time is listed with its reason in
`scripts/check_lean_commands_allowlist.txt`.
CI runs the check and its tests, and CONTRIBUTING.md states the rule.

Closes ethereum#4236.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tcoratger
tcoratger merged commit 8cee90b into ethereum:master Nov 22, 2026
15 checks passed
@github-actions github-actions Bot added crypto Cryptography: EthLib/Cryptography crypto: sphincs SPHINCS+ hash-based signatures crypto: xmss XMSS hash-based signatures ci Workflows and scripts: .github and scripts docs Markdown documentation proofs Theorems under a Proofs directory labels Nov 22, 2026
@tcoratger
tcoratger deleted the pf-no-build-commands branch November 22, 2026 21:53
@github-actions github-actions Bot added the type: chore Anything else that touches no library code, proof or test label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Workflows and scripts: .github and scripts crypto: sphincs SPHINCS+ hash-based signatures crypto: xmss XMSS hash-based signatures crypto Cryptography: EthLib/Cryptography docs Markdown documentation proofs Theorems under a Proofs directory type: chore Anything else that touches no library code, proof or test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(proofs): no axiom prints in library modules

1 participant