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

Add is_empty and is_singleton to multiset #1246

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

rikosellic
Copy link

@rikosellic rikosellic commented Aug 21, 2024

I'm migrating code from Set to MultiSet and found that there is no spec function is_empty and is_singleton for MultiSet. So I add these two functions in multiset.rs and prove several lemmas about them imitating those in set_lib.rs.

/// A multiset has exactly one element, if and only if, it has at least one element with multiplicity 1 and any two elements are equal.
pub proof fn lemma_is_singleton(s: Multiset<A>)
ensures
s.is_singleton() == (s.len() == 1),
Copy link
Collaborator

Choose a reason for hiding this comment

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

We usually use <==> when comparing bools like this.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! It is fixed now.

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