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

Annotations for loop invariants #605

Closed
W95Psp opened this issue Apr 15, 2024 · 3 comments · Fixed by #857
Closed

Annotations for loop invariants #605

W95Psp opened this issue Apr 15, 2024 · 3 comments · Fixed by #857
Assignees
Labels
backend Issue in one of the backends (i.e. F*, Coq, EC...) engine Issue in the engine enhancement New feature or request

Comments

@W95Psp
Copy link
Collaborator

W95Psp commented Apr 15, 2024

Requires #394

@W95Psp W95Psp self-assigned this Apr 15, 2024
@W95Psp W95Psp added enhancement New feature or request engine Issue in the engine backend Issue in one of the backends (i.e. F*, Coq, EC...) labels Jul 15, 2024
@mamonet
Copy link
Member

mamonet commented Jul 15, 2024

It would be great if we can define loop invariant to keep track on updated variable inside the loop body for each iteration. Here is a use case for the feature
In the following loop body, we need to have invariant for updated variable zeta_i to tell the resolver that its value is still inside the boundaries https://github.com/cryspen/libcrux/blob/ml-kem-lax-check/libcrux-ml-kem/src/ntt.rs#L61-L63

The feature can replace the assumptions in this code https://github.com/cryspen/libcrux/blob/ml-kem-panic-free/libcrux-ml-kem/src/ntt.rs#L66-L69 to make it verify.

@mamonet
Copy link
Member

mamonet commented Jul 15, 2024

One more instance of this issue, in situations where we use enumerate(), we have to make assumptions around the index that should happen be default in case Core.Iter.Traits.Iterator.f_enumerate maintains the index through iterations. e.g. for this loop we need to tell assist the resolver by assuming the index is inside the boundaries https://github.com/cryspen/libcrux/blob/ml-kem-panic-free/libcrux-ml-kem/src/serialize.rs#L65-L67

@franziskuskiefer
Copy link
Member

We may not tackle #394 right away but use workarounds for now.

Next step: make design

This was referenced Aug 19, 2024
@github-project-automation github-project-automation bot moved this to Done in hax Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Issue in one of the backends (i.e. F*, Coq, EC...) engine Issue in the engine enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants