-
Notifications
You must be signed in to change notification settings - Fork 297
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
feat(tactic/tidy): limit the amount of time spent on refl #3380
Conversation
@@ -67,7 +67,8 @@ def CommRing_yoneda : TopCommRing.{u} ⥤ (Top.{u}ᵒᵖ ⥤ CommRing.{u}) := | |||
{ obj := λ X, continuous_functions X R, | |||
map := λ X Y f, continuous_functions.pullback f R }, | |||
map := λ R S φ, | |||
{ app := λ X, continuous_functions.map X φ } } | |||
{ app := λ X, continuous_functions.map X φ, }, | |||
map_comp' := by { intros X Y Z f g, ext V h, dsimp, refl, }, } |
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 proof still works by tidy
and could be omitted, but the whole declaration is up against the -T100000
limit, and now apparently slightly over, so I've put the map_comp
proof in by hand.
It would be better to improve the simp
lemmas so this refl
isn't even needed, but not today.
I am very uneasy about this change. In my experience it only needs one small and unrelated change to push the 49 to 51, and then some definitions in the category theory library will fail in a completely unclear way. Even worse, tidy is used extensively in auto params so the failure is even more mysterious. What is the debugging story here? Is there a tracing option that gives some information about how tidy fails and what to do to make it work? Ideally we'd also have an option to specify the refl timeout. |
The one (very weak) counter argument, is that you can actually remove I agree this is not a satisfactory answer to your objection! |
Nevertheless I think a reasonable solution may be to just remove |
Let me #xy the problem:
This sort of slow failure of |
I know nothing about the category theory library, but when I hear "refl takes 12 seconds to fail," I have to assume there's an |
In fact, this proof with a slow refl is just about polynomials. Let me extract it better... |
Here's the further minimised slow
|
Any one of the following works: attribute [irreducible] polynomial.eval₂ -- 1ms
attribute [irreducible] finsupp.sum -- 1ms
attribute [irreducible] finset.sum -- 1ms
attribute [irreducible] multiset.map -- 25ms |
I experimented with Does it seem reasonable to do this? That is, make something irreducible, adding local attributes to make existing proofs work, and defer the real work of fixing those proofs to use a proper API for later? Or is this adding more technical debt, and it would be better to only mark things as |
(I guess that this was going to be the cheapest change to make, out of those four.) |
If possible, I think we should try to add enough API that we don't need |
|
Thanks! That doesn't look so bad. I think some parts can be easily replaced by I heard on Zulip that somebody wanted to do a big refactor of the polynomials. Maybe it would be best to do this as part of the refactor. |
That was me... :-) But it keeps getting postponed! I will close this for now. |
A while back @gebner identified that [an unfortunate timeout could be avoided](#3380 (comment)) by making `polynomial.eval2` irreducible. This PR does that. It's not perfect: on a few occasions I have to temporarily set it back to semireducible, because it looks like the proofs really do some heavy refling. I'd like to make more things irreducible in the polynomial API, but not yet. Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: jalex-stark <alexmaplegm@gmail.com> Co-authored-by: kckennylau <kc_kennylau@yahoo.com.hk>
I have mixed feelings about
refl
intidy
.On the one hand, including it near the top of
default_tactics
list (as it is now) saves about 60s in compiling mathlib.On the other hand, it potentially makes
tidy
very slow, as it is willing to tackle "heavyrfl
" problems, even when other tactics would be more advisable.As a compromise, in this PR we run
refl
inside atry_for
wrapper.The time limit was chosen as a smallest value for which we get the full compilation time benefits
(in fact a slight overall improvement).
This PR also
by tidy
that fails ifrefl
is removed entirelytactic/tidy.lean