Repository navigation
Description
After you write by or · (focus on 1 goal), you often look at the goal state for a while before deciding what tactic to apply next. It is annoying that these two pieces of syntax are illegal by themselves, since they require a nonempty sequence of tactics to follow. This has 2 negative consequences:
- A distracting parser error is shown
- Potential other errors are not shown (EDIT: after RFC: Show elaboration error in type even with parse errors in proof #3556 is fixed, this is probably not an issue anymore)
Suggestion: can the parser allow by or · (focus) followed by an empty sequence of tactics? The elaborator can still throw an warning/error of course.
The following MWE shows some examples of parser errors even though there is a "more important" error to show in both cases.
example (p : Prop) : p ∧ 3 := by
example (p q : Prop) : p ∧ q := by
rw [doesntExist]
constructor
·
done@digama0 also suggested that the parser allows an empty list in the following cases:
def foo : type wheremutual endvariableuniverseexport Foo ()open Foo ()open Foo hidingopen Foo renamingopenattribute [attr]do {}doif cond then<-- this one should probably be a warning, unindented code afterif cond thenis almost certainly a bug
Related RFC: #3556
Community Feedback
The Zulip thread shows a lot of support.
Impact
Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.
Activity
[-]RFC: [/-][+]RFC: parser should allow empty (tactic) lists[/+]Kha commentedon Mar 1, 2024
Potential problematic interaction: #3215 (comment)
feat: let `induction` take zero alteratives
feat: let `induction` take zero alteratives (#6486)
feat: let `induction` take zero alteratives (leanprover#6486)
feat: let `induction` take zero alteratives (leanprover#6486)
TwoFX commentedon Mar 21, 2025
The combination of the new editor decorations and error lens (which is common in the Lean community) mean that due to this issue you get some pretty chaotic and visually overloaded situations in your editor:
Ideally, it should look like this:
first version of empty tactic sequences
first version of empty tactic sequences
first version of empty tactic sequences
nomeata commentedon May 6, 2026
#13229 fixes the original RFC. It does not address the extended laundry list of other sequence-like things that could handle the empty case better. If that these are important maybe a separate RFC is useful, but I feel like the empty tactic sequence is UX wise important enough to be its own RFC and fix.