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

Indexing of FMap in logic #1254

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

arnaudgolfouse
Copy link
Collaborator

Allow indexing of a FMap in logic. It only works with Sized values though.

Also add FMap::create and FSet::create for consistency with Seq.

#[trusted]
#[logic]
#[ensures(result.len() == 0)]
#[ensures(result.view() == Mapping::cst(None))]
pub fn empty() -> Self {
pub fn create() -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is logic not ghost I'm not sure create is really the write name, all empty sets should be the same, there is no other notion of identity right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe not, I was primarily aiming for consistency between Seq/FMap/FSet. We could have both an empty creation method and an EMPTY constant for the three of them, how does that sound?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer that over create. create implies something fresh to me so the fact that they are all the same unit element of their type would suggest a different name.

@arnaudgolfouse arnaudgolfouse merged commit 048a844 into creusot-rs:master Nov 27, 2024
4 checks passed
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.

2 participants