Zulip Chat Archive
Stream: new members
Topic: bullet to focus subgoals
Joachim Breitner (Jan 11 2022 at 13:19):
In Isabelle I am a big fan of named subgoals (I find them more readable and easier to maintain), and in Coq I can at least get close using bullets. In lean I found { … }
allows me to focus on a single goal. Is there something like Coq’s bullets in lean?
Johan Commelin (Jan 11 2022 at 13:22):
Not in Lean 3. We only have { ... }
to structure subproofs.
Johan Commelin (Jan 11 2022 at 13:22):
Well... you can write show your_target, { ... }
which adds readability.
Sebastien Gouezel (Jan 11 2022 at 13:24):
{...}
is really the equivalent of the bullets. What you can also do to improve readability is to state the goal you are going to prove, with show
. Like
-- assume you have 3 goals foo, bar and baz,
show foo,
{ ...,
... },
show bar,
{ ...,
... },
show baz,
{ ...,
... }
Joachim Breitner (Jan 11 2022 at 13:32):
Will show
pick a suitable subgoal? Or will that break if some change means the goals are now in different order or maybe some are solved?
Johan Commelin (Jan 11 2022 at 13:35):
No, it picks the right goal (if it exists)
Johan Commelin (Jan 11 2022 at 13:36):
If some change means the goal no longer exits, of course the proof will complain.
Joachim Breitner (Jan 11 2022 at 13:37):
Great, thanks. And I could have just looked that up on https://leanprover.github.io/reference/tactics.html :blushing:
Eric Wieser (Jan 13 2022 at 00:31):
tactic#case is also handy for named goals produced by cases
or induction
Joachim Breitner (Jan 13 2022 at 10:23):
Ah, this is great, thanks!
Last updated: Dec 20 2023 at 11:08 UTC