-
Notifications
You must be signed in to change notification settings - Fork 453
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
fix: rw
argument elaboration
#2793
Conversation
|
The downstream failure is due to a regression from this PR that we should fix:
This is a pretty common pattern in Mathlib, where a side condition for a rewrite rule is specified with an optional value. |
We have conflicting requests. In some situations, users want the implicit arguments consumed (e.g., example above). In other situations, they don't want because the implicit parameter causes a failure (e.g., associated issue). @semorrison Any suggestions? BTW, we can keep things as-is, and just tell users to use |
I don't immediately see what #2736 has to do with optParam insertion, as there are no optParams in the example and it is instead failing with a typeclass inference failure. (Not saying there is no connection, I just don't see why these two cases are entangled.) |
Common theme: implicit arguments. Given a constant |
@semorrison Failure above seems to be a CI issue. |
No, genuine failures due to this PR. I'll start minimizing, they don't look too hard. |
Many of the Mathlib failures are because the side conditions coming from e.g.
used to work, but on this toolchain it requires
(At least we'll get some obviously missing tests for |
The Mathlib testing PI is leanprover-community/mathlib4#8076 |
@semorrison Any action items for me? |
@leodemoura yes, see my comment immediately above, with a MWE showing a regression due to this PR. The order of side conditions generated by |
@semorrison I saw it, but you did not make it clear whether the new order is the wrong one or not. We have regressions all the time. Note that we currently don't have Update Even if we make |
I'm not sure (I haven't thought carefully about it) which ordering is the best in an absolute sense, but I know that any change to the order of generated subgoals of |
Ah, I see. I had thought it was clear that That said, I don't think this is as impactful as Mario says above. Note in particular that it manages to compile about 80% of Mathlib without encountering this change, so I suspect it could be done by hand if desired. The change that has occurred is not changing the relative order of the main goal and the introduced side goals, it is only changing the order of the side goals amongst themselves. My preference would be that we change the behaviour to restore the ordering as before. But unless I hear otherwise I will patch Mathlib for the new behaviour, on leanprover-community/mathlib4#8076, hopefully tomorrow. |
@semorrison
Note that the previous order was not Just to clarify, given a function I agree it makes sense to use |
Ah, okay, that description of the goal ordering makes sense, and I agree it's not something worth preserving as is. Shall I fix Mathlib to work with this PR as is, and we can think about moving to |
I will take a look next weekend. I think it is better to try to integrate |
rw
argument elaboration like simp
rw
argument elaboration
I have mathlib working again. It is not too bad, except for a very large number of This is because of the change so See leanprover-community/mathlib4#8076 for the Mathlib diff. |
The regressions in Mathlib seem very similar to the issue reported in #2736. Is this change in Lean actually an improvement? |
- `getFVarId` will create an exception. - `optional` will save, and then restore the state.
@leodemoura, here is the promised minimization:
|
rw [id]
is now elaborated asrw [@id]
Rewrite.Config.newGoals
field for specifying how newrw
goals are ordered. We use the same approach used in theapply
tactic.optParam
torw
andapply
tactics.fixes #2736