Zulip Chat Archive

Stream: general

Topic: Tool for extracting current goal into a dedicated lemma?


aprilgrimoire (Dec 08 2024 at 12:19):

Hi! Sometimes I need to write long proofs due to things with many parameters, for example, Subfield.closure_induction. In such cases, I need to split some of the proof into a dedicated lemma to prevent timeout at whnf. Just like simp?, is there a tactic or tool that could help me formulate such lemmas?

Luigi Massacci (Dec 08 2024 at 12:34):

Yes, it's called extract_goal ; )

Luigi Massacci (Dec 08 2024 at 12:35):

https://leanprover-community.github.io/mathlib4_docs/Mathlib/Tactic/ExtractGoal.html

Eric Wieser (Dec 08 2024 at 12:40):

Note that when using Subfield.closure_induction, you probably want to write it using induction hx using Subfield.closure_induction, which might also help simplify your proof / make it easier to follow.

aprilgrimoire (Dec 08 2024 at 12:41):

Thanks!
image.png
Why did it contain omits? Where can I see the full version?

Eric Wieser (Dec 08 2024 at 12:43):

I think if you hover over the ..., lean will tell you the setting to make it show that detail

aprilgrimoire (Dec 08 2024 at 12:44):

Yeah, but then I can't simply copy the statement out. How can I invoke the linter in a terminal?

aprilgrimoire (Dec 08 2024 at 12:46):

Oh sorry seems the link you provided contained info about it

Eric Wieser (Dec 08 2024 at 13:19):

I don't really understand your question; did you solve it?

Eric Wieser (Dec 08 2024 at 13:20):

In the particular example you gave above, I think running dsimp before extract_goal will help

aprilgrimoire (Dec 10 2024 at 18:21):

Yeah I solved it. set_option pp.proofs true in extract_goal worked. Sorry for the late reply, I was working on an assignment yesterday.


Last updated: May 02 2025 at 03:31 UTC