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

Better loop invariants #858

Open
W95Psp opened this issue Aug 19, 2024 · 0 comments
Open

Better loop invariants #858

W95Psp opened this issue Aug 19, 2024 · 0 comments
Labels
engine Issue in the engine enhancement New feature or request

Comments

@W95Psp
Copy link
Collaborator

W95Psp commented Aug 19, 2024

The design for loop invariant introduced by #857 (which will fix #605) is clunky:

  • it works only for a very limited set of couple loops + iterators (see the documentation of hax_lib::loop_invariant)
  • if the couple loop+iterator is not supported, there are no errors, it will produce bad code in the backend
  • the ergonomics is bad:
    • the invariants are inside loops bodies, but none of the bindings introduced in the loops can be used
    • invariants are closure, and that's the responsibility of the user to annotate the type of the binder of that closure

We need something better:

  • something that can work for any iterator, or at least for most of them, with a Rust error if that's the iterator is not supported
  • closure should be typed automatically according to the context
  • invariants should actually be before the loop, not inside
@W95Psp W95Psp added enhancement New feature or request engine Issue in the engine labels Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Issue in the engine enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant