Skip to content

RFC: parser should allow empty (tactic) lists #3555

Closed

Description

@fpvandoorn

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:

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 where
  • mutual end
  • variable
  • universe
  • export Foo ()
  • open Foo ()
  • open Foo hiding
  • open Foo renaming
  • open
  • attribute [attr]
  • do {}
  • do
  • if cond then <-- this one should probably be a warning, unindented code after if cond then is 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

  1. added
    RFC
    on Mar 1, 2024
  2. changed the title [-]RFC: [/-] [+]RFC: parser should allow empty (tactic) lists[/+] on Mar 1, 2024
  3. Kha commented on Mar 1, 2024

    @Kha
    Member

    Potential problematic interaction: #3215 (comment)

  4. added
    new-user-papercuts
    on May 8, 2024
  5. added
    P-medium
    on Sep 13, 2024
  6. TwoFX commented on Mar 21, 2025

    @TwoFX
    Member

    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:

    Image

    Ideally, it should look like this:

    Image

  7. removed
    P-medium
    on Mar 21, 2025
  8. added
    P-high
    on Mar 25, 2025
  9. added 3 commits that reference this issue on Jul 25, 2025
    7d42bf0
    bb2d91f
    3ccc713
  10. nomeata commented on May 6, 2026

    @nomeata
    Collaborator

    #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-highRFCnew-user-papercuts

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions