Zulip Chat Archive
Stream: new members
Topic: Any powerful tactics I should know about besides `omega`?
Philogy (Oct 31 2024 at 01:58):
Without omega
by most recent and first non-trivial proof in lean would've been basically impossible. Was such a life saver.
I've heard about aesop
but it doesn't seem to work very well, always applying simp
and getting stuck because it can't find anything to simplify. I tried linarith
a few times and also no help at all.
Wonder if there's any powerful tactic I've been missing out on that people frequently use. My proofs mainly consist of simp
, rw
, have
, intro
, apply
, simp_rw
and of course omega
.
Because my first takeaway from writing a larger proof is "omg this is so tedious", I had to prove a lot of "obvious" lemmas just so I could rw
/ simp
parts away like x / (x + 1) = 0
and wonder if it's the way of lean or just a skill issue on my part.
David Loeffler (Oct 31 2024 at 08:47):
My proofs mainly consist of
simp
,rw
,have
,intro
,apply
,simp_rw
and of courseomega
.
I think the difference between novices and seasoned lean/mathlib power-users is more about the lemmas in their vocabulary, not the tactics. Most of the proofs I write are also using those same basic tactics (although I would also add refine
to the list). But most of those tactics are just ways of using lemmas; so the more lemmas you know, the more you can achieve with the tactics.
Ruben Van de Velde (Oct 31 2024 at 08:49):
Though even more than using lemmas, I think it's about knowing what kind of lemmas you can and can't expect to find in the library, and how to find them (either by guessing the name of using the search tools)
Yaël Dillies (Oct 31 2024 at 08:50):
David Loeffler said:
I think the difference between novices and seasoned lean/mathlib power-users is more about the lemmas in their vocabulary, not the tactics.
I believe Heather would (like to) strongly disagree
Michael Rothgang (Oct 31 2024 at 09:51):
- A very useful "basic" skill: know which tactic could apply when. (For instance, do you already know when to apply rw vs apply/refine? How about simp? There is also the norm_num tactic; do you know when to use omega vs norm_num?)
- Depending on what kinds of results you'd like to prove, some more specialized tactics can be useful.
For analysis proofs, the tacticsnorm_num
,linarith
,gcongr
andpositivity
are useful.fun_prop
/continuity
/measurability
can also be pretty useful there. For "simple logic" arguments,tauto
can be useful.
Alex Mobius (Oct 31 2024 at 09:56):
Aesop at base is not much more powerful than simp, can do basic splitting and such, but doesn't even know about tauto
or much more lemmas than simp
. You can however tag the stuff you need a lot (your own or imported) and have it fill in the gaps in the proof structure for you.
Philogy (Oct 31 2024 at 11:21):
David Loeffler said:
My proofs mainly consist of
simp
,rw
,have
,intro
,apply
,simp_rw
and of courseomega
.I think the difference between novices and seasoned lean/mathlib power-users is more about the lemmas in their vocabulary, not the tactics. Most of the proofs I write are also using those same basic tactics (although I would also add
refine
to the list). But most of those tactics are just ways of using lemmas; so the more lemmas you know, the more you can achieve with the tactics.
Interesting, I suppose that's why, I spent a lot of time searching for simple lemmas in the list of Nat
lemmas that I had to end up creating myself via just by omega
. Sometimes I think it'd be useful to see what omega
did, similar to how aesop has aesop?
to see what lemmas it used and learn from it.
Philogy (Oct 31 2024 at 11:22):
Michael Rothgang said:
- A very useful "basic" skill: know which tactic could apply when. (For instance, do you already know when to apply rw vs apply/refine? How about simp? There is also the norm_num tactic; do you know when to use omega vs norm_num?)
- Depending on what kinds of results you'd like to prove, some more specialized tactics can be useful.
For analysis proofs, the tacticsnorm_num
,linarith
,gcongr
andpositivity
are useful.fun_prop
/continuity
/measurability
can also be pretty useful there. For "simple logic" arguments,tauto
can be useful.
Interesting, I did not know about norm_num
, where do I learn?
Yaël Dillies (Oct 31 2024 at 11:22):
Philogy said:
Sometimes I think it'd be useful to see what
omega
did, similar to how aesop hasaesop?
to see what lemmas it used and learn from it.
omega
does not really use lemmas, so your idea can't really work
Philogy (Oct 31 2024 at 11:23):
Yaël Dillies said:
Philogy said:
Sometimes I think it'd be useful to see what
omega
did, similar to how aesop hasaesop?
to see what lemmas it used and learn from it.
omega
does not really use lemmas, so your idea can't really work
Oh I see.
Yaël Dillies (Oct 31 2024 at 11:24):
... by which I mean that the proof term generated by omega
will be a mumble-jumble of applications of docs#Nat.succ_le_iff, docs#Nat.lt_succ_iff and various other things
Kyle Miller (Oct 31 2024 at 16:51):
If you want to inspect it @Philogy, you can do show_term omega
to see the proof term it creates.
Kyle Miller (Oct 31 2024 at 16:53):
example
(@Yaël Dillies I'm not sure what it means to use or not use lemmas, but certainly omega uses omega-specific theory.)
Yaël Dillies (Oct 31 2024 at 16:56):
I mean that it doesn't use library lemmas the way Philogy is expecting
Last updated: May 02 2025 at 03:31 UTC