Skip to content

feat(lean): Add support for while loops#1857

Merged
abentkamp merged 1 commit intomainfrom
alex/while
Jan 8, 2026
Merged

feat(lean): Add support for while loops#1857
abentkamp merged 1 commit intomainfrom
alex/while

Conversation

@abentkamp
Copy link
Copy Markdown
Contributor

This PR adds support for simple while loops. Panic freedom of the loop in the test gets verified fully automatically.

Future work:

  • support while loops with returns and continues
  • implement a better default tactic to prove invariant and termination measure being pure
  • add an attribute to allow the user to replace this default tactic

@abentkamp abentkamp added lean Related to the Lean backend or library proof-lib Issues related the backend-specific definitions (in the proof-lib folder) labels Jan 8, 2026
@abentkamp abentkamp added this to the Lean proof library v1.0 milestone Jan 8, 2026
@abentkamp abentkamp requested a review from maximebuyse January 8, 2026 09:20
@abentkamp abentkamp marked this pull request as ready for review January 8, 2026 09:20
@abentkamp abentkamp requested a review from a team as a code owner January 8, 2026 09:20
Copy link
Copy Markdown
Contributor

@maximebuyse maximebuyse left a comment

Choose a reason for hiding this comment

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

Looks good. I am curious to see how we can deal with more complicated situations, as there are many different things to prove (panic freedom of invariant, condition, body, termination metric, etc., propagation of the invariant), I imagine we'll have to make the default tactic powerful enough as it might be impractical to allow custom tactics for all these different proofs.

@abentkamp abentkamp enabled auto-merge January 8, 2026 13:00
@abentkamp abentkamp added this pull request to the merge queue Jan 8, 2026
Merged via the queue into main with commit 0908a61 Jan 8, 2026
17 of 18 checks passed
@abentkamp abentkamp deleted the alex/while branch January 8, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lean Related to the Lean backend or library proof-lib Issues related the backend-specific definitions (in the proof-lib folder)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants