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

Fix step boundaries in fold_range_step_by #883

Merged
merged 2 commits into from
Sep 12, 2024
Merged

Conversation

mamonet
Copy link
Collaborator

@mamonet mamonet commented Sep 10, 2024

I run into case where index boundaries need to be precise for fold_range_step_by, let's consider the following case

Rust_primitives.Hax.Folds.fold_range_step_by 0ul
  32ul
  (sz 4)
  (fun sampled_i16s temp_1_ ->
      true)
  sampled_i16s
  (fun sampled_i16s outcome_set ->
      sampled_i16s)

The steps are the following [0, 4, 8, 12, 16, 20, 24, 28] so the boundary for index is i <= 28 but by default I get i < 32 by the condition v i < v end_ in fold_range_step_by, I adjusted that with proper condition in this PR.

@mamonet mamonet requested a review from W95Psp September 10, 2024 12:41
Copy link
Contributor

@karthikbhargavan karthikbhargavan left a comment

Choose a reason for hiding this comment

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

This is only used in ML-KEM for now. I feel there must be a better way of writing this condition, but let's get it in and iterate.

@karthikbhargavan karthikbhargavan added this pull request to the merge queue Sep 12, 2024
Merged via the queue into main with commit 9313dba Sep 12, 2024
13 checks passed
@karthikbhargavan karthikbhargavan deleted the fold-step-boundary branch September 12, 2024 08:29
@mamonet
Copy link
Collaborator Author

mamonet commented Sep 12, 2024

This is only used in ML-KEM for now. I feel there must be a better way of writing this condition, but let's get it in and iterate.

I think Lucas was thinking about proper condition by having this commented out line // /\ i % v step == v start % v step, while that condition is true, and I think it should be there I am not sure if it affects the index boundary which what I need for MLKEM now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants