-
Notifications
You must be signed in to change notification settings - Fork 201
Adapt w.r.t. coq/coq#14876. #1572
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
Conversation
jdchristensen
left a comment
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.
Maybe it would be helpful if there were comments explaining why those Hint Extern lines are needed. Even better if they could be removed or made more specific.
| #[local] | ||
| Hint Extern 4 => progress (cbv beta iota) : typeclass_instances. |
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.
| #[local] | |
| Hint Extern 4 => progress (cbv beta iota) : typeclass_instances. | |
| #[local] Hint Extern 4 => progress (cbv beta iota) : typeclass_instances. |
|
See rocq-prover/rocq#14876. It introduces a change of semantics of Hint Unfold which is hit quite a bit by HoTT, probably because it's one of the only devs that uses Hint Unfold for typeclasses. I am not sure that this change is desired, but I wanted to attract the attention of the HoTT developers (which has succeeded it seems). So, the doc states that Hint Unfold only applies to goals whose head is the global reference being unfolded, but this is only true for undiscriminated databases (i.e. virtually everybody except typeclass_instances). For discriminated databases (i.e. typeclasses) it actually unfolds the constant regardless of the goal, but this only happens when the hint is triggered (so this is conditioned by the priority, which is 4 for unfolding hints). The PR changes this behaviour to only trigger when the goal contains a constant to unfold, because otherwise this leads to a combinatorial explosion of the proof search (see the linked issue in the PR). Now the funny thing is that unfolding a constant that does not appear in the goal turns out not to be a no-op. Indeed, The easy fix is the one demonstrated by the changes of this PR, namely to emulate the same "random βι-normalization" through a Hint Extern for the few resolutions that depend on the bug. Some places just needed normalization of the goal, hence the |
|
I think @JasonGross would have some good input here. |
JasonGross
left a comment
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'm in favor of this change, and the Coq PR. I would be fine even adding a #[global] or #[export] hint to do beta-iota simplification in typeclasses everywhere
|
If we don't do it globally, then as people write new proofs, typeclass inference might not find things that it should, and they might not think to add the |
|
I think we can enforce this on the Coq side, though. Most hints produces only βι-normalized goals, to the notable exception of |
|
I had a look and it seems that HoTT relies quite pervasively on typeclass resolution not preserving the invariant that all the goals it applies to are βι-normal. One the major reason for this failure is that composition is just a notation rather than a definition, so it tend to disappear after normalization. I don't know if this design pattern is HoTT-specific though. |
|
I've reopened rocq-prover/rocq#14679 and closed rocq-prover/rocq#14876. See #1573 for the corresponding HoTT PR. Compared to this one I had to turn two |
No description provided.