lean icon indicating copy to clipboard operation
lean copied to clipboard

primed tactics from mathlib

Open bryangingechen opened this issue 5 years ago • 6 comments

Here's a list of "primed" tactics in mathlib which fix bugs or add features to tactics in the core library. I'm not sure which of these should replace their counterparts, if someone else can review this that'd be great. (Feel free to edit this list directly!)

I can try to tackle the ones from tactic.core and tactic.interactive which don't require modifying C++.

Primed tactics in mathlib's tactic.core:

~- [ ] iterate', compare iterate in init.meta.tactic.~

~- [ ] target' is a wrapper around target (C++ implementation here) that instantiates mvars and calls whnf.~

Primed tactics in mathlib's tactic.interactive:

  • [ ] congr' behaves like congr but takes an optional argument specifying the depth of recursive applications.

  • [ ] guard_hyp' fixes guard_hyp by instantiating meta variables.

~- [ ] guard_expr_eq' uses is_def_eq, whereas guard_expr_eq uses alpha_eqv.~

~- [ ] guard_target' uses guard_expr_eq', whereas guard_target uses guard_expr_eq.~

  • [ ] change' "mimics the behavior of change, except in the case of change x with y at l. In this case, it will correctly replace occurences of x with y at all possible hypotheses in l. As long as x and y are defeq, it should never fail."

Other primed tactics in mathlib:

Any others?

bryangingechen avatar Feb 22 '20 03:02 bryangingechen

Since a couple of hours: generalize' and its corresponding interactive version (not completely backwards compatible, since it already apply intro1).

fpvandoorn avatar Feb 22 '20 07:02 fpvandoorn

@fpvandoorn Ah, cool! Do you mind making a PR to core either replacing generalize with generalize' or just fixing it?

bryangingechen avatar Feb 22 '20 07:02 bryangingechen

I think target' should not replace target. We don't need to instantiate mvars and normalize the goal every time we query it. It is a much slower version of target.

cipher1024 avatar Feb 26 '20 07:02 cipher1024

iterate', compare iterate in init.meta.tactic.

They do different things.

guard_target' uses guard_expr_eq', whereas guard_target uses guard_expr_eq.

:-1: This is mainly used for testing, where you explicitly do not want to compare modulo definitional equality.

gebner avatar Feb 26 '20 08:02 gebner

Thanks, I crossed those out in the post above!

bryangingechen avatar Feb 26 '20 14:02 bryangingechen

revert_deps could also be a candidate. It works like revert_kdependencies, but takes the bodies of local definitions into account. It would have to be generalised a bit to properly replace revert_kdependencies.

JLimperg avatar Jul 03 '20 17:07 JLimperg