Skip to content

hax-lib: introduce a Prop abstraction#1301

Merged
karthikbhargavan merged 38 commits intomainfrom
prop-predicates
Feb 20, 2025
Merged

hax-lib: introduce a Prop abstraction#1301
karthikbhargavan merged 38 commits intomainfrom
prop-predicates

Conversation

@karthikbhargavan
Copy link
Copy Markdown
Contributor

@karthikbhargavan karthikbhargavan commented Feb 9, 2025

This PR introduces a Prop type for use in formulas.
It also cleans up the structure of hax-lib a little.

@karthikbhargavan karthikbhargavan changed the title Prop predicates Hax Lib Improvements Feb 9, 2025
@W95Psp W95Psp changed the title Hax Lib Improvements hax-lib: introduce a Prop type Feb 18, 2025
@W95Psp W95Psp changed the title hax-lib: introduce a Prop type hax-lib: introduce a Prop abstraction Feb 18, 2025
@W95Psp
Copy link
Copy Markdown
Contributor

W95Psp commented Feb 18, 2025

I wonder if we should not add a prelude to hax-lib.
Exporting everything in the hax_lib namespace feels a bit aggressive.

Instead, we could have a hax_lib::prelude module that re-exports every name that make sense to have top-level, i.e. not assert (which overrides core's assert).

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

I have tested this on libcrux and it works well.
It will unblock cryspen/libcrux#788
So let's review and get this in.

@karthikbhargavan
Copy link
Copy Markdown
Contributor Author

@maximebuyse it would be good to check that this PR will not break PQ11 or Sandwich.

@karthikbhargavan
Copy link
Copy Markdown
Contributor Author

I wonder if we should not add a prelude to hax-lib. Exporting everything in the hax_lib namespace feels a bit aggressive.

As a user, I would really not have to know too much about the structure of hax_lib, so a single namespace seems fine to me? Or else we could break it into a couple of name spaces but let's do it soon or else it will be painful to refactor later.

@W95Psp
Copy link
Copy Markdown
Contributor

W95Psp commented Feb 19, 2025

Yeah, but exposing everything top-level is not so nice either: it's polluting context.
If you want to use both std's assert and Int for instance, you'd have to use hax_lib::{Int, Abstraction, Concretization}.

A prelude would be nice to import automatically traits: use hax_lib::prelude::* could import all the traits, and maybe a few other items whose name are explicitely referring to proofs or hax (e.g. fstar!).

I think preludes are pretty common in the Rust ecosystem, so I don't think this will be unintuitive for users.

Copy link
Copy Markdown
Contributor

@maximebuyse maximebuyse left a comment

Choose a reason for hiding this comment

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

All good for PQ11 and Sandwich

@karthikbhargavan karthikbhargavan added this pull request to the merge queue Feb 20, 2025
Merged via the queue into main with commit b5321c1 Feb 20, 2025
@karthikbhargavan karthikbhargavan deleted the prop-predicates branch February 20, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants