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
Fixes #10812: tactic subst failure with section variables indirectly dependent in goal #12146
Fixes #10812: tactic subst failure with section variables indirectly dependent in goal #12146
Conversation
doc/changelog/04-tactics/12146-master+fix10812-subst-failure-section-variables.rst
Outdated
Show resolved
Hide resolved
@herbelin can you rebase to get a clean CI? |
Co-Authored-By: Théo Zimmermann <theo.zimmi@gmail.com>
2aed639
to
b9da31a
Compare
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 seems extremely strange to me. It breaks subject reduction in the context of the goal, right? Or else it is not reversible (if it clears the equation but not a
) or else repeat subst
will infinite loop (if it clears neither the equation nor a
)? If subst a
succeeds, what happens when I unfold b
? I think the proper fix for the bug is to make subst
not consider section variable occuring indirectly, not to make subst a
succeed when a
occurs indirectly.
Your arguments make sense. I will rethink about the PR. |
I consider this PR pending on the question of what
Should it fail with something like "This section variable occurs indirectly in the goal and cannot be substituted further." or "This section variable has an implicit occurrence in foo which could not be substituted" or "Cannot substitute a section variable with implicit occurrences"? Same question with a rewritable occurrence of See discussion at #12139. |
Co-Authored-By: Théo Zimmermann <theo.zimmi@gmail.com>
b9da31a
to
615de1f
Compare
615de1f
to
43e7db5
Compare
43e7db5
to
c0ed80a
Compare
@ppedrot: several tactics have to decide at some time whether a variable is a section variable or not. This is the case also of this PR. However, we have no way at the current time to assert for sure that a goal variable is the exact original instance of a section variable or an homonym with same type. One way to fix this (actually critical) issue would be to add to |
For the record, here is an example of the section variable homonymy problem:
|
Without a clear specification of what it means to be a section variable, I think this is doomed. What if you revert and intro a section variable? What if you perform a change that leaves the type untouched? My take is that this is only going to introduce new issues because the underlying problem of what sections are is still there. |
Forgot to add that I think that the proper fix is to separate the two representations in the constr syntax. We should have one node for section variables, and one node for goal variables. It's not going to be pretty in terms of backwards compatibility though. |
Ah sorry, I thought it was clear what is the specification I'm referring to. It is the following:
This is a different variable, i.e. a different binder (but possibly with the same name, in which case this will typically exhibits an alpha-conversion at
I don't understand the question.
There is no underlying problem with sections. Think at section variables like global objects with a qualified name + a discharge (= distributivity + strengthening) operation over contexts and the question of what sections are is clear. The missing information I was talking about in my previous comment is: when I have a name |
Yes, this would be much cleaner. My proposal is exactly to do that but without changing the internal representation, i.e. by keeping an indication in the typing context telling if a |
Co-Authored-By: Théo Zimmermann <theo.zimmi@gmail.com>
c0ed80a
to
476115d
Compare
Co-Authored-By: Théo Zimmermann <theo.zimmi@gmail.com>
476115d
to
86ac0ac
Compare
Co-Authored-By: Théo Zimmermann <theo.zimmi@gmail.com>
78e8ec5
to
fb0cc3e
Compare
@Zimmi48 : I'm a bit lost. |
@herbelin |
Co-Authored-By: Théo Zimmermann <theo.zimmi@gmail.com>
dcb5bfb
to
6f29883
Compare
@ppedrot: This seems to have reached a consensus among the persons having taken part to the discussion, as well as a green CI. Only the (backward-compatible) MetaCoq overlay has not been merged yet (MetaCoq/metacoq#415). |
@herbelin how come the CI passed if the fix has not been merged yet? |
The PR also includes the overlay. |
@herbelin I think you should then remove the overlay from the PR. I'll try to get my private informants to merge the MetaCoq PR meanwhile. |
Co-Authored-By: Théo Zimmermann <theo.zimmi@gmail.com>
Co-authored-by: Théo Zimmermann <theo.zimmi@gmail.com>
OK, done. |
6f29883
to
3a8376b
Compare
@herbelin people are complaining that the MetaCoq PR is breaking their CI, can you investigate? |
Can you get more information about what fails with what? It works for me with MetaCoq/metacoq#415 (17a84730) on Coq master (e4bfbdf). |
The CI fails with
On Coq 8.11. You can see the build log by clicking on the red x next to the commit, https://travis-ci.org/github/MetaCoq/metacoq/jobs/683270751 |
OK, I think I got the explanation. MetaCoq is not testing the MetaCoq PR against the master branch of MetaCoq but against the branch of MetaCoq called coq-8.11. This is because when I submitted the MetaCoq PR, the base was coq-8.11 and I did not pay attention that it was wrong. I changed it to master only afterwards, but the CI apparently did not take it into account (or maybe should it be restarted maually). The MetaCoq PR is ok on top of MetaCoq master with both Coq master and with this Coq PR (as tested by me locally and by Coq CI). |
@ppedrot The overlay has been merged now. This PR seems ready to merge. |
Right, sorry, forgot to merge it. |
Kind: bug fix
To decide if rewriting is needed, don't consider implicitly depending section variables as occurring since there are invisible from unification (i.e. use
local_occur_var
)This is a potential source of incompatibilites, but it also has to be fixed.
Fixes #10812
Fixes #12139