-
Notifications
You must be signed in to change notification settings - Fork 237
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 a subset_mem lemma to make mem_subset more complete #3199
Conversation
- Mirrors TSet - reflexivity is now implied thanks to the SMTPat in mem_subset, kept the function for compatibility but removed the SMTPat
ulib/FStar.List.Tot.Properties.fst
Outdated
let rec subset_mem (#a: eqtype) (la lb: list a) | ||
: Lemma (requires (subset la lb)) | ||
(ensures (forall x. mem x la ==> mem x lb)) | ||
[SMTPat (subset la lb)] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @chandradeepdey, this pattern is not optimal for the lemma, since it is not goal-directed. Usually, we pick patterns that mention terms in the goals (i.e., ensures
) so that Z3 instantiates the lemma when it needs to prove the postcondition.
Rest of the changes look good to me. Do you absolutely need this smtpat? E.g., could you remove the pattern, and invoke the lemma manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(If you prefer, I can also do this change in your branch, let me know.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, okay. What I wanted was subset la lb <==> (forall x. mem x la ==> mem x lb)
to be put in the context whenever subset la lb
is mentioned.
I was using mem_subset
to send a subset as a function argument. I don't need this new one, but thought it would be useful to have the reverse, i.e. get the information out of a function parameter.
Sure, you can make changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
@aseemr How about this? |
kept the function for compatibility but removed the SMTPat