Skip to content

SIMD Traits Spec and Pre-Condition Style#788

Merged
karthikbhargavan merged 42 commits intomainfrom
simd-scaffolding-746
Feb 21, 2025
Merged

SIMD Traits Spec and Pre-Condition Style#788
karthikbhargavan merged 42 commits intomainfrom
simd-scaffolding-746

Conversation

@karthikbhargavan
Copy link
Copy Markdown
Contributor

@karthikbhargavan karthikbhargavan commented Feb 3, 2025

This PR addresses #746
It needs to be merged after #776 and #780
We should also discuss and agree on the style here

As a side-effect, this PR also improves the specs and proofs for ML-DSA in the following ways:

  • the specs for simd/portable/arithmetic.rs now use the add_pre, add_post, sub_pre, sub_post functions from simd/traits.rs. This reduces clutter and will help verification performance
  • the proofs for simd/portable/encoding/commitment.rs are now fully automated, relying on a hand-unrolling of the loops

@franziskuskiefer
Copy link
Copy Markdown
Member

I think here too, a transparent attribute could make things nicer. Let's look at this together.

@karthikbhargavan
Copy link
Copy Markdown
Contributor Author

This PR is currently blocked by some issues with the translations of attributes.
In particular, in the treatment of bool vs Prop.
https://github.com/cryspen/hax-evit/issues/11

@franziskuskiefer franziskuskiefer added the blocked Status: marked as blocked on something else. label Feb 10, 2025
@karthikbhargavan
Copy link
Copy Markdown
Contributor Author

With the work in cryspen/hax#1301, I've now updated this PR so it passes F*.
Let's work towards merging that hax PR next and then get back to this one (should be quick)

@karthikbhargavan
Copy link
Copy Markdown
Contributor Author

@W95Psp @mamonet you may want to look at the styles here:

  • We should aim for full automation using SMT in the style of simd/portable/encoding/commitment.rs whenever possible
  • We should aim to re-use predicates like add_pre (see simd/portable/arithmetic.rs) as much as possible. (We can them make these predicates opaque if necessary, without the need to make the functions add, sub opaque.)

@W95Psp: we still need a little more work on cryspen/hax#1301 for this.
In particular, the forall predicates within the add_pre etc get compiled into valid F* but do not easily lend themselves to use in proofs. It would be better to have a custom translation of everything in Hax_lib.Prop so that these specs can be super-compact in F*.

@karthikbhargavan karthikbhargavan marked this pull request as ready for review February 19, 2025 04:39
@karthikbhargavan karthikbhargavan requested a review from a team as a code owner February 19, 2025 04:39
@karthikbhargavan
Copy link
Copy Markdown
Contributor Author

Seeing this failure (outside CI): https://github.com/cryspen/libcrux/actions/runs/13447960542

Copy link
Copy Markdown
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

Let's get this in.

@karthikbhargavan karthikbhargavan merged commit 9055a34 into main Feb 21, 2025
@karthikbhargavan karthikbhargavan deleted the simd-scaffolding-746 branch February 21, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Status: marked as blocked on something else. verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants