-
Notifications
You must be signed in to change notification settings - Fork 196
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
Remove some Global Instances #1818
Conversation
|
Probably https://coq.inria.fr/doc/master/refman/addendum/type-classes.html#coq:flag.Typeclass-Resolution-For-Conversion |
I tried both
with a full search after that. |
you may need: to add |
Thanks, it does the trick with |
Thanks! With |
It was easy to get the library to build with this change. I think I had to change four spots and in three of them I just filled in some underscores, which also made the proofs more readable. There was one spot in BlakersMassey where I couldn't see how to fix it, so I just temporarily switched back to |
To get |
As it happens, I was trying to set up hint mode for wildcat. It's great to see it is useful elsewhere. |
Well, my summary of the situation is that it didn't speed anything up, and in a few cases it made typeclass search fail, so I was planning to not add this hint. (It does speed things up for the example I posted, but the changes in the first commit here also improve the example enough that it's not an issue anymore.) |
@jdchristensen I will continue to play with it for WildCat since it ought to be useful when resolving functoriality lemmas. There we do a lot of useless searches and need to prioritise what should be searched. Other changes here however look good. FTR, how did you diagnose the original issue? With |
@Alizter I used |
I was noticing some slow typeclass search, and saw that a few things were being tried that were either futile (because Coq would have to guess something) or caused a loop (which Coq seemed to at least notice and cut short). This PR removes them from the global database, without needing to change any proofs. I was hoping the build would be faster, but there is no noticeable change. Still, this might let us use
rapply
in places where we were forced to usenrapply
combined with some specificexact _
lines.I also have a question. Consider the following:
On the last line, Coq does typeclass inference, and the part that was slow before this PR involves:
Is there a way to tell Coq to not bother doing typeclass search if we don't know what
X
is? Coq ends up on a bit of a wild goose chase trying to find various modalities, etc. BecauseX
is pointed, it explores things involving theunit_name
map.I also wonder why Coq is even attempting typeclass search. Note that the type of
refine (lem m.+1 X)
isforall Y, Contr (X -> Y)
, which does not match the type of the goal. Is there a reason that Coq does typeclass inference rather than just immediately noticing the problem and giving up? (This is not a silly thing to try, since ourrapply
tactic does exactly this before trying two underscores, which works.)