-
Notifications
You must be signed in to change notification settings - Fork 715
feat: revert e for arbitrary terms
#8522
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
base: master
Are you sure you want to change the base?
Conversation
This PR adds a feature to `revert` where `revert e` is like `have := e; revert this` when `e` is not a local variable. This is sometimes useful for putting a goal into a particular form for other tactics.
|
Mathlib CI status (docs):
|
| let mut mvarId ← popMainGoal | ||
| for e in toAssertRev do | ||
| mvarId ← mvarId.assert (← Term.mkFreshBinderName) (← inferType e) e | ||
| mvarId ← Prod.snd <$> mvarId.revert fvarIds |
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.
Hmm that means that they aren't always reverted in the order you specify though, doesn't it? It would probably be better if it revert a b was pretty much the same as revert a; revert b.
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.
revert uses local context order, even when there are no dependencies, for example
example (n : Nat) (m : Nat) : True := by revert m nends with the state ⊢ ∀ (n m : Nat), True. Same as revert n m.
Given this, if one imagines that revert is adding the non-fvars to the local context as a first step, then they would come last when reverted.
If you want to control reversion orders, you always can write revert m; revert n manually.
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.
Oh I guess then it makes sense.
This PR adds a feature to
revertwhererevert eis likehave := e; revert thiswheneis not a local variable. This is sometimes useful for putting a goal into a particular form for other tactics.Recall that
revertsorts the fvars to revert by local context order when reverting. The implementation of this new feature acts as if each non-local-variable term is added to the local context in order and then added to the list of fvars to revert. The result of this is that they appear at the end of the reverted telescope, in the provided order.