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 some multiset-related lemmas #1329

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

Conversation

zeldovich
Copy link
Collaborator

The main lemmas of interest here are:

fold_right_permutation proves that, when doing a fold_right with a commutative operator, any permutation of the sequence produces the same result.

to_multiset_remove strengthens to_multiset_ensures() to reason about removing elements from a seq.

lemma_multiset_has_no_duplicates_conv is the converse of lemma_multiset_has_no_duplicates and helps prove that, if a sequence was no_duplicates(), then any permutation (with an equal to_multiset()) also has no_duplicates().

For a commutative fold_right operator, any folding order (i.e., folding
over any permutation of a sequence) produces the same result.
lemma_fold_right_split (formerly aux_lemma_fold_right_alt) is a useful
lemma in its own right about how fold_right distributes over splitting
a sequence into two parts using subrange.

lemma_fold_right_commute_one is also useful for proofs that need to
commute the order of operations in fold_right, in a way that's not quite
about permutations.
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.

1 participant