Zulip Chat Archive
Stream: mathlib4
Topic: Version of exact? giving all matching results
Sébastien Gouëzel (Sep 28 2024 at 08:18):
Often, I find that exact?
is able to close the goal, but by applying a lemma which is obviously not the right one (e.g., taking advantages of weird defeqs, or using one direction of an iff
lemma while the direction exists as a standalone lemma, or suggesting rfl
when there is a lemma saying exactly what I need, that I could use in a sequence of rewrites for instance). MWE:
def foo {α : Type} (x : α) : α := x
theorem foo_def {α : Type} (x : α) : foo x = x := rfl
theorem foo_def2 {α : Type} (x : α) : foo x = x := by exact?
The exact?
suggests rfl
, while a suggestion to use foo_def
would clearly be better.
Would it be easy to have a variant exact!?
or exact??
that gives all the working results, instead of only the first one, to let the user pick whichever is best?
Kim Morrison (Sep 28 2024 at 09:04):
Yes, this should be easy, and I would merge a PR that does this. I would suggest exact?*
as the syntax perhaps? Not sure there.
Filippo A. E. Nuccio (Sep 28 2024 at 11:14):
I like exact?!
as "a stronger version of exact?
"
Ruben Van de Velde (Sep 28 2024 at 11:33):
Not a general solution, but often rw?
finds something better
Patrick Massot (Sep 28 2024 at 13:35):
This wouldn’t really be stronger, I think exact?*
is better.
Kim Morrison (Sep 28 2024 at 22:15):
Exactly --- I don't like the !
because we're not asking it to try any harder, just to not stop at the first successful result. I suspect it really is a small change to implement, and you wouldn't need to go into the internals at all.
Eric Wieser (Sep 28 2024 at 22:15):
Would a with_reducible exact?
be possible, for this specific case?
Kyle Miller (Sep 28 2024 at 22:15):
How about exact??
?
Kyle Miller (Sep 28 2024 at 22:16):
Oh, sorry, Sébastien already suggested that :-)
Vincent Beffara (Sep 28 2024 at 23:03):
How about exact‽
?
Kim Morrison (Sep 29 2024 at 00:00):
I will happily merge a PR implementing either exact?*
or exact??
(hint hint :-)
Last updated: May 02 2025 at 03:31 UTC