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
Move equality sections out of Tactics chapter. #13892
Conversation
ebbe402
to
3677629
Compare
3677629
to
1c64547
Compare
@jfehrle I've updated your PR to do the usual git dance to preserve the history. I've preserved your changes to these sections and they are now highlighted as part of the last commit (this will also ease the review). Content-wise, this current version is identical to what you had pushed except that the file is now called Now on to the actual review (
|
1c64547
to
c6cf0b8
Compare
Is there a simpler way to fetch your changes than this? I don't like having to delete and recreate the branch. Also not sure I need the
|
Something like this should work git fetch origin move_equality_section
git checkout move_equality_section
git reset --hard origin/move_equality_section (the first 2 commute) |
I'm having trouble rebasing this on master or even just trying to squash it down to 2 commits. For the former, I have a weird conflict on the step that removes things from tactics.rst and then the final commit shows the additions to When I tried to squash, my IDE tool for resolving the conflict--which is quite reliable--can't access the conflicting files for some reason. Perhaps you could experiment with these and see if it works for you? For the first one in particular, it seems like that might be a recurring problem. (I started on rebasing because WDYT? |
This is expected. You shouldn't try any of the two. The point of all these commits in particular the merge commits is to preserve the git history and it is lost if you rebase or squash. If we really need to rebase, I will have to redo all this work.
You should probably just regenerate an up-to-date |
The idea is that we avoid rebasing unless it's necessary, and if so, do it just before the PR is merged? This won't create a problem for others later rebasing on a master that includes this PR? |
Updated. |
3d6bea2
to
2563967
Compare
Yes.
No, these just are merge commits: hard to rebase but easy to rebase on top. |
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.
Regarding the title of the first section, I don't like using an enumeration that feels exhaustive when it isn't. If you don't like my initial proposal (I understand that "basic" is too vague) what about "Tactics for goals that are equalities"? This would still not be fully precise (symmetry
can also be used in a hypothesis and "equality" is too specific) but this would properly encompass most actual use cases of these tactics.
Updated. |
Um, "Tactics for simple equalities"? |
dade435
to
f9a6d34
Compare
Did this fall through a crack? I think it only needs only a few minutes' attention from you. And would be best to get it merged before some other change forces this to be rebased (which would be a problem because of the history preservation dance). |
Ah, I didn't realize that you had pushed a new update. I just thought you had asked some questions. Let me have a look. |
then :n:`simplify_eq @ident` first introduces the hypothesis in the local | ||
context using :n:`intros until @ident`. | ||
|
||
.. tacn:: esimplify_eq {? @destruction_arg } |
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.
Is it plan to document what destruction_arg
is?
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.
I'll put it here for now. All the other tactics that use it are in tactics.rst
(and out of date).
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.
Sorry, I should have noticed it earlier but since esimply_eq
can be seen as a variant of simplify_eq
, it would make sense to indent it and to put the prodn
for destruction_arg
below simplify_eq
.
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.
Now, its definition is so simple, I wonder whether it wouldn't make sense to splice @destruction_arg
into {| @one_term_with_bindings | @natural }
. In any case, reversing the order of the two productions (since one_term_with_bindings
seems to be the main variant) would probably make sense.
Updated. |
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.
Now that I read the section "Equality and inductive sets" more carefully, considering my proposal to also split out a page dedicated to tactics for inductive types from the tactics chapter, I realize that it would make more sense in such a page than in the one on equality (in particular, it would be presented together with discriminate
and injection
).
Sorry for seeing this only now. I'll try to see if I can rework things with git
to preserve all your changes to this section without doing the move (done, see below).
All my new comments apply to this section only, so you may consider this PR ready from your point of view.
Let :n:`@term` be the proof of a statement with the conclusion :n:`@term__1 = @term__2`. | ||
If :n:`@term__1` and :n:`@term__2` are structurally different (in the sense | ||
described for the tactic :tacn:`discriminate`), then the tactic | ||
``simplify_eq`` behaves as :n:`discriminate @term`, otherwise it behaves as | ||
:n:`injection @term`. | ||
|
||
If the current goal has form :g:`t1 <> t2`, it behaves as | ||
:n:`intro @ident; simplify_eq @ident`. | ||
|
||
:n:`simplify_eq @natural` is equivalent to :n:`intros until @natural` then | ||
:n:`simplify_eq @ident` where :n:`@ident` is the identifier for the last | ||
introduced hypothesis. | ||
|
||
If :n:`@bindings` are provided in :n:`@destruction_arg`, they are used to | ||
instantiate parameters or hypotheses of :n:`@term`. |
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.
Since term
doesn't appear anymore in the syntax shown above, we must clarify what it is. Something like:
Let :n:`@term` be the proof of a statement with the conclusion :n:`@term__1 = @term__2`. | |
If :n:`@term__1` and :n:`@term__2` are structurally different (in the sense | |
described for the tactic :tacn:`discriminate`), then the tactic | |
``simplify_eq`` behaves as :n:`discriminate @term`, otherwise it behaves as | |
:n:`injection @term`. | |
If the current goal has form :g:`t1 <> t2`, it behaves as | |
:n:`intro @ident; simplify_eq @ident`. | |
:n:`simplify_eq @natural` is equivalent to :n:`intros until @natural` then | |
:n:`simplify_eq @ident` where :n:`@ident` is the identifier for the last | |
introduced hypothesis. | |
If :n:`@bindings` are provided in :n:`@destruction_arg`, they are used to | |
instantiate parameters or hypotheses of :n:`@term`. | |
Let :n:`@one_term` be the proof of a statement with the conclusion :n:`@term__1 = @term__2`. | |
If :n:`@term__1` and :n:`@term__2` are structurally different (in the sense | |
described for the tactic :tacn:`discriminate`), then the tactic | |
:n:`simplify_eq @one_term` behaves as :n:`discriminate @one_term`, otherwise it behaves as | |
:n:`injection @one_term`. | |
If the current goal has form :g:`t1 <> t2`, it behaves as | |
:n:`intro @ident; simplify_eq @ident`. | |
:n:`simplify_eq @natural` is equivalent to :n:`intros until @natural` then | |
:n:`simplify_eq @ident` where :n:`@ident` is the identifier for the last | |
introduced hypothesis. | |
If :n:`@bindings` are provided in :n:`@destruction_arg`, they are used to | |
instantiate parameters or hypotheses of :n:`@one_term`. |
|
||
If the current goal has form :g:`t1 <> t2`, it behaves as | ||
:n:`intro @ident; simplify_eq @ident`. | ||
This works the same as :tacn:`simplify_eq` but if the type of :n:`@term` or the |
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.
This term
should also become one_term
with my suggestion above.
|
||
This tactic applies to any goal. If :n:`@ident` has type | ||
If :n:`@ident` has type |
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 :n:`@ident` has type | |
If :n:`@one_term` has type |
:g:`(existT B a b)=(existT B a' b')` in the local context (i.e. each | ||
:n:`@term` of the equality has a sigma type :g:`{ a:A & (B a)}`) this tactic |
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.
:g:`(existT B a b)=(existT B a' b')` in the local context (i.e. each | |
:n:`@term` of the equality has a sigma type :g:`{ a:A & (B a)}`) this tactic | |
:g:`(existT B a b)=(existT B a' b')` in the local context (i.e. each | |
side of the equality has a sigma type :g:`{ a:A & (B a)}`) this tactic |
I've pushed a proposal at https://github.com/Zimmi48/coq/tree/mv-rewriting. I suggest force-pushing commit f41ebd5 to this PR and keeping cbfbe5e for another PR or for later when we do move this section to a new page (just after this PR is merged). My comments to this section should be kept for this other PR. |
To clarify what I mean: IMHO this PR is ready, with just the move of the first Equality section. If you agree, you can just force-push commit f41ebd5 from my branch (or I can take care of it) and I will immediately merge. Then, we can start working on a new page on tactics for inductive types with sections coming from the tactics chapter. And at that point we can reuse your changes to the "Equality and inductive sets" section that I've preserved in commit cbfbe5e. |
05579f4
to
3e40c15
Compare
Ah, OK, provided you create the new page for inductives ASAP--otherwise too many details to remember, too likely to get lost. I pulled f41ebd5 and then updated |
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.
@coqbot merge now
I have created a new branch: https://github.com/Zimmi48/coq/tree/inductive_page Some notes regarding this new page:
|
I think |
Thanks for the review and merge. I plan to update the new branch within a few days. |
We need a different name for |
The symmetry between the two was on purpose. I didn't realize this could create problems. It's a bit sad if the use of directories doesn't allow reusing file names. |
Sorry about that, I should have tried doing it for you before the split. |
The problem is that when I'm editing the doc, I'm constantly navigating to files by the last part of the path names. So far they've been unique. If they're not unique, it becomes way too easy to open the wrong file and waste time. And requires more thinking. Any suggestion for a different name? |
No good idea. Let's just avoid making the name too long. |
The unfortunate thing is that the filename will become the final part of the URL. So its choice should only be based on developers' convenience. |
As discussed in #13707.