Skip to content

Lean backend#217

Merged
anjapetkovic merged 21 commits intomainfrom
lean
Apr 3, 2026
Merged

Lean backend#217
anjapetkovic merged 21 commits intomainfrom
lean

Conversation

@anjapetkovic
Copy link
Copy Markdown
Collaborator

This PR creates a backend for Lean theorem prover, similar to the Rocq backend.
It uses the same structure of the backend as Rocq.hs, but adapted to Lean syntax in Lean.hs

The summary of the main changes:

  • new file src/Act/Lean.hs that generates the state transition system in Lean
  • new file lib/Actlib.lean that generates the act library for Lean, and it's accompanying lakefile.toml
  • slightly changed test cases in tests/lean: the spec had to be changed from Rocq test case, because to is a reserved word in Lean
  • A documentation of the Lean backend (similar to Rocq) in doc/src/lean.md
  • Adapted documentation for Rocq backend, to account for the new way we report preconditions
  • Nits to integrate the new backend into the pipeline.

, debug :: w ::: Bool <?> "Print verbose SMT output (default: False)"
}

| Lean { file :: w ::: Maybe String <?> "Path to file"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Indentation seems weird here (also in the Rocq case, but it wont let me do a suggestion)

Suggested change
| Lean { file :: w ::: Maybe String <?> "Path to file"
| Lean { file :: w ::: Maybe String <?> "Path to file"

, debug :: w ::: Bool <?> "Print verbose SMT output (default: False)"
}

| Lean { file :: w ::: Maybe String <?> "Path to file"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As a general remark for future work: we can consider factoring out commonalities in the interface for Rocq and Lean (e.g., have the specific prover be an option to a more general command).

@@ -0,0 +1,265 @@
contract Amm
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perhaps we could use a symbolic link to the AMM so that it automatically stays up-to-date when we change it?

Copy link
Copy Markdown
Collaborator

@zoep zoep left a comment

Choose a reason for hiding this comment

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

Very nice work! Just some minor remarks.

@zoep zoep requested a review from lefterislazar April 1, 2026 13:03
@lefterislazar
Copy link
Copy Markdown
Collaborator

Looks good. There were some hypothesis that were left-over from before the factorization that was merged for Rocq, and their removal did not carry over. I also added some basic functionality to test the generated Lean files for compilation using make test-lean. After the checks we can merge.

Copy link
Copy Markdown
Collaborator

@lefterislazar lefterislazar left a comment

Choose a reason for hiding this comment

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

Everything looks good

@anjapetkovic
Copy link
Copy Markdown
Collaborator Author

Thanks for cleaning up the code Lefteris!

@anjapetkovic anjapetkovic merged commit 661df5f into main Apr 3, 2026
4 checks passed
@anjapetkovic anjapetkovic deleted the lean branch April 3, 2026 09:44
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.

3 participants