Skip to content

feat: add --help and --all-theorems command line options#33

Open
robsimmons wants to merge 9 commits intomasterfrom
rob-v4.29.0
Open

feat: add --help and --all-theorems command line options#33
robsimmons wants to merge 9 commits intomasterfrom
rob-v4.29.0

Conversation

@robsimmons
Copy link
Copy Markdown

@robsimmons robsimmons commented Apr 29, 2026

If we'd like to export and replay the contents of a module, it's desirable to be able to export just the constants in that module and their transitive dependencies.

This PR, in addition adds an --all-theorems MODULE_NAME command line option that adds all the theorems in the specified module to the root set of constants for exporting. It can be used in conjunction with naming individual constants with the -- option.

Additional changes:

  • Refactor: consolidates parsing of command line arguments

  • Feature: adds usage information, -h argument

  • Feature: turns several panics into controlled error (invalid constant, constant not present in environment)

  • Backwards incompatible (or bugfix, depending on your perspective): Move the filtering of unsafe constants from the "dump constant" phase to the "figure out what 'everything' is when we export everything".

    Currently, if Foo contains an unsafe definition x, then lean4export Foo -- x just silently drops x. It should either throw an error ("--export-unsafe required") or print out x and its dependencies, and this resolves to do the latter: --export-unsafe only affects the "export everything" behavior.

@robsimmons robsimmons requested review from hargoniX and nomeata April 29, 2026 19:53
Copy link
Copy Markdown
Contributor

@nomeata nomeata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems unnecessarily restrictive. Why not allow the user to specify any set of module names and/or constants to export? Maybe I need an export of module A and B and additionally foo.

@robsimmons
Copy link
Copy Markdown
Author

@nomeata I think you're right — I've changed the behavior quite a bit so that "export all (theorems) from a module" and "export these constants specifically" are compatible.

@robsimmons robsimmons marked this pull request as ready for review April 30, 2026 22:21
@robsimmons robsimmons requested a review from nomeata April 30, 2026 22:21
@robsimmons robsimmons changed the title feat: add --help and --all-module-constants command line options feat: add --help and --all-theorems command line options May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants