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

[Merged by Bors] - feat(tactic/choose): choose can now decompose conjunctions #3699

Closed
wants to merge 4 commits into from

Conversation

cipher1024
Copy link
Collaborator


In goal of the form

h : ∀ x, ∃ y, P
⊢ ...

mk_constructive h produces this goal:

h : ∀ x, Σ' y, P
⊢ ...

This makes it easier to use elimination on h later even when the goal is not a Prop

@cipher1024
Copy link
Collaborator Author

This PR was spun off from #3638

@cipher1024 cipher1024 added the awaiting-review The author would like community review of the PR label Aug 5, 2020
@gebner
Copy link
Member

gebner commented Aug 5, 2020

We already have a choose tactic that does something very similar: https://leanprover-community.github.io/mathlib_docs/tactics.html#choose

@@ -0,0 +1,42 @@

Copy link
Member

Choose a reason for hiding this comment

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

Copyright boilerplate, and module docstring please!

@cipher1024
Copy link
Collaborator Author

We already have a choose tactic that does something very similar: https://leanprover-community.github.io/mathlib_docs/tactics.html#choose

I see yes, it's mostly redundant with that tactic. Maybe I should recycle this PR to make a change to choose. I think it should treat as existentials. Comments?

@fpvandoorn
Copy link
Member

fpvandoorn commented Aug 5, 2020

choose indeed already exists for this purpose.
Changing choose so that you can split conjunctions in the same way as existentials is very welcome (I've already missed that feature at least once).

@fpvandoorn fpvandoorn added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Aug 6, 2020
@cipher1024 cipher1024 added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Aug 12, 2020
@cipher1024
Copy link
Collaborator Author

This PR is now completely revamped and it is now an improvement of choose

@bryangingechen
Copy link
Collaborator

Can you update the PR title / comment?

@cipher1024 cipher1024 changed the title feat(tactic/mk_constructive): turn existential assumptions into sigma typed local constants feat(tactic/choose): choose can now decompose conjunctions Aug 12, 2020
src/tactic/core.lean Outdated Show resolved Hide resolved
Copy link
Member

@fpvandoorn fpvandoorn left a comment

Choose a reason for hiding this comment

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

Looks good. Some comments:

  • please add one or more tests for this tactic.
  • Ideally choose can parse something like ⟨⟨h1, h2⟩, h3⟩ as argument, in the same way as the (conjunctive part of) rcases. That could be a different PR, though.

@cipher1024
Copy link
Collaborator Author

Ideally choose can parse something like ⟨⟨h1, h2⟩, h3⟩ as argument, in the same way as the (conjunctive part of) rcases. That could be a different PR, though.

I thought about that too. As you say, that's probably a bigger change but it's worth considering. The one part that gives me pause though is that patterns a | b, a part of the rcases language, does not have a useful interpretation. That might not be enough not to consider doing it though.

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>
@cipher1024
Copy link
Collaborator Author

I do have tests. For some reason, they don't show up here. I don't get it. I do git log on my computer and it's there.

@cipher1024
Copy link
Collaborator Author

I was looking at the wrong PR 🤦

@fpvandoorn
Copy link
Member

I thought about that too. As you say, that's probably a bigger change but it's worth considering. The one part that gives me pause though is that patterns a | b, a part of the rcases language, does not have a useful interpretation. That might not be enough not to consider doing it though.

We can easily implement a different parser that only reads the conjunctive patterns of rcases.

For the moment, LGTM

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Aug 12, 2020
@bors
Copy link

bors bot commented Aug 13, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(tactic/choose): choose can now decompose conjunctions [Merged by Bors] - feat(tactic/choose): choose can now decompose conjunctions Aug 13, 2020
@bors bors bot closed this Aug 13, 2020
@bors bors bot deleted the mk-constructive branch August 13, 2020 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants