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 a subset_mem lemma to make mem_subset more complete #3199

Merged
merged 3 commits into from
Feb 19, 2024
Merged

Add a subset_mem lemma to make mem_subset more complete #3199

merged 3 commits into from
Feb 19, 2024

Conversation

chandradeepdey
Copy link
Contributor

@chandradeepdey chandradeepdey commented Jan 30, 2024

  • Mirrors TSet
  • reflexivity is now implied thanks to the SMTPat in mem_subset,
    kept the function for compatibility but removed the SMTPat

- Mirrors TSet
- reflexivity is now implied thanks to the SMTPat in mem_subset,
  kept the function for compatibility but removed the SMTPat
@chandradeepdey chandradeepdey changed the title Change the list subset lemmas to look more like the ones in TSet Add a subset_mem lemma to make mem_subset more complete Jan 30, 2024
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)] =
Copy link
Collaborator

@aseemr aseemr Feb 17, 2024

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?

Copy link
Collaborator

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.)

Copy link
Contributor Author

@chandradeepdey chandradeepdey Feb 19, 2024

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks again!

@chandradeepdey
Copy link
Contributor Author

@aseemr How about this?

@aseemr aseemr merged commit 1998265 into FStarLang:master Feb 19, 2024
2 checks passed
@chandradeepdey chandradeepdey deleted the subset branch March 8, 2024 09:28
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