Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lean: improve handling of arguments #1015

Merged
merged 1 commit into from
Feb 16, 2025

Conversation

ineol
Copy link
Collaborator

@ineol ineol commented Feb 15, 2025

  1. We handle irrefutable patterns in argument positions by adding an equivalent let in the prelude of the function.
  2. We handle atom types deep inside the type of the arguments. We translate the pattern in the argument as above as a variable, and we replace the sail type variable by tuple.2.1 in the return type. This path and the variable bound in the let binding in the prelude are definitionally equal.
  3. As a side fix, we use more unique names for the autogenerated variable names by numbering them, which should avoid some spurious shadowing.

@ineol ineol added the Lean Issues with Sail to Lean translation label Feb 15, 2025
Copy link

github-actions bot commented Feb 15, 2025

Test Results

   13 files  ±0     27 suites  ±0   0s ⏱️ ±0s
  811 tests ±0    811 ✅ ±0  0 💤 ±0  0 ❌ ±0 
2 805 runs  ±0  2 805 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b86ea3c. ± Comparison against base commit 6ae1f3d.

♻️ This comment has been updated with latest results.

@ineol ineol force-pushed the lean-better-args branch 2 times, most recently from 9b4a108 to 6758c41 Compare February 15, 2025 19:15
@tobiasgrosser
Copy link
Collaborator

Nice. This resolves 158 errors.

Copy link
Collaborator

@tobiasgrosser tobiasgrosser left a comment

Choose a reason for hiding this comment

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

This LGTM modulo the above comment.

1. We handle irrefutable patterns in argument positions by adding an
   equivalent let in the prelude of the function.
2. We handle `atom` types deep inside the type of the arguments. We
   translate the pattern in the argument as above as a variable, and we
   replace the sail type variable by `tuple.2.1` in the return type.
   This path and the variable bound in the let binding in the prelude
   are definitionally equal.
3. As a side fix, we use more unique names for the autogenerated
   variable names by numbering them, which should avoid some spurious
   shadowing.
@Alasdair Alasdair merged commit c6458c5 into rems-project:sail2 Feb 16, 2025
7 checks passed
@ineol ineol deleted the lean-better-args branch February 16, 2025 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lean Issues with Sail to Lean translation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants