Zulip Chat Archive
Stream: lean4
Topic: Aesop? suggestions on multi arm tactics
Shreyas Srinivas (Apr 15 2025 at 13:12):
one Screenshot from 2025-04-15 15-10-00.png
I have an induction goal that I can close with aesop. Even though I don't need this, I would like to use the output of aesop?
instead. However, aesop?
provides me five separate try this?
s instead of one. Each suggestion is meant to work for one branch of the induction tactic. Is there a way to just one common suggestion?
Shreyas Srinivas (Apr 15 2025 at 13:13):
To make it clear, I have already solved the problem by taking the simp lemmas suggested in each try this and pasting them together in a try simp_all
:
Screenshot from 2025-04-15 15-13-00.png
Shreyas Srinivas (Apr 15 2025 at 13:13):
I just wish to know if I can instead get one try this
which gives a common proof that works on all branches
Jannis Limperg (Apr 15 2025 at 13:17):
I'm not sure whether I can detect, from within each Aesop call, that the different calls belong together. If so, something could be done, though I would likely just generate first | alt1 | alt2 | ...
, which is maybe not much better. Please feel free to open an issue.
Shreyas Srinivas (Apr 15 2025 at 13:18):
So one trick might be to merge all the proofs by concatenating them in sequence with try
on each suggestion
Shreyas Srinivas (Apr 15 2025 at 13:19):
Oh I just remembered that first | ..
does that
EDIT : maybe first | try alt1 | try alt2 |..
?
Eric Wieser (Apr 15 2025 at 13:20):
As a much simpler test-case:
import Aesop
example (p : P) (q : Q) (r : R) (s : S) : (P × Q) × (R × S) := by
constructor <;> constructor <;> aesop?
Eric Wieser (Apr 15 2025 at 13:21):
In this particular case you could produce
example (p : P) (q : Q) (r : R) (s : S) : (P × Q) × (R × S) := by
constructor <;> constructor <;> [(· exact p); (· exact q); (· exact r); (· exact s)]
but this doesn't work if the proof started as
example (p : P) (q : Q) (r : R) (s : S) : (P × Q) × (R × S) := by
constructor <;> (constructor <;> aesop?)
Shreyas Srinivas (Apr 15 2025 at 13:21):
And the results of aesop? suggestions can be concatentated as :
import Aesop
example (p : P) (q : Q) (r : R) (s : S) : (P × Q) × (R × S) := by
constructor <;>
constructor <;>
try exact p; try exact q; try exact r; try exact s
Eric Wieser (Apr 15 2025 at 13:23):
@Shreyas Srinivas, this is just first | exact p | exact q | exact r | exact s
which was what Jannis suggested earlier
Shreyas Srinivas (Apr 15 2025 at 13:26):
Anyway, in my example all I had to do was put a try
in front of the terminal simp_all suggestion and concatenate the lemma list. I guess this is harder to infer in general.
Eric Wieser (Apr 15 2025 at 13:27):
try
is worse than putting first |
Shreyas Srinivas (Apr 15 2025 at 13:52):
alternatively, maybe aesop could look at the named goals, generate the arms and fill them in like you already showed
Last updated: May 02 2025 at 03:31 UTC