Zulip Chat Archive
Stream: batteries
Topic: multiple goals
Kim Morrison (Sep 30 2024 at 09:00):
I was perhaps slightly hasty in merging batteries#895, which I see now as I'm repairing it on nightly-testing
has a number of proofs that have multiple goals that are not managed using focus notation, e.g. at https://github.com/leanprover-community/batteries/pull/895/files#diff-7f6f2022caefd253ab58d36270f54286b95fdf21e1e8199626ab9f22f3d1e5efR190
- I presume we agree this isn't great style and should be avoided where possible.
- Does Mathlib have a linter for it? Can we have it?
Damiano Testa (Sep 30 2024 at 09:03):
The linter is written, and @Michael Rothgang has been helping to push it through, but there are a huge number of exceptions.
Damiano Testa (Sep 30 2024 at 09:04):
Btw, Michael is not subscribed to this channel, so he won't feel summoned.
Damiano Testa (Sep 30 2024 at 09:05):
It is called the multiGoals linter but I'm on mobile and can't give you the PR number.
Damiano Testa (Sep 30 2024 at 09:09):
Actually, #12339 may be it
Damiano Testa (Sep 30 2024 at 09:11):
The linter only checks for missing focusing dots, not for unnecessary ones.
Damiano Testa (Sep 30 2024 at 09:12):
There is a PR with an extension to the linter that does that, but since progress on the initial multiGoal linter was slow, I left it dormant.
Kim Morrison (Sep 30 2024 at 09:28):
Thanks for the update. No urgency on this, mostly this gets caught in review (and in this case I was the reviewer so I'm not blaming anyone! :-)
Mario Carneiro (Sep 30 2024 at 09:57):
Agreed we should enable and enforce this on batteries
Damiano Testa (Sep 30 2024 at 11:55):
As far as testing goes, I was quite pleased with how the linter worked on Mathlib. If you want to try it out on batteries, at least to add some focusing dots, it should be pretty smooth sailing.
Damiano Testa (Sep 30 2024 at 11:56):
I forget exactly what happens, but I seem to recall that if you blindly add a focusing dot on the first line flagged by the linter and indent all the lines flagged by the linter, it should magically work.
Damiano Testa (Sep 30 2024 at 11:56):
(Recursively, sometimes.)
Damiano Testa (Sep 30 2024 at 12:00):
The intention was to make it as self-correcting as possible. I was going to plug it into a "refactor"-like step, but that is on hold for both the linter and refactor! :smile:
Damiano Testa (Sep 30 2024 at 23:20):
I'm giving the PR another push, but splitting out the focusing dots into 3 smaller PRs: #17313, #17314, #17315. I'm mentioning it here, in case someone might be interested in reviewing... :smile:
Kim Morrison (Oct 01 2024 at 00:26):
Left comments on all of them. I find the on_goal
s confusing.
Damiano Testa (Oct 01 2024 at 00:52):
I removed most of the on_goal
s: their use, in the context of the linter, is usually to maintain a proof where a tactic generates multiple goals, you massage the first goal a bit, and then you discharge all goals (the massaged one and the remaining ones) with all_goals
or something similar.
Damiano Testa (Oct 01 2024 at 00:53):
There was discussion about making this proof startegy (delaying side-goals until something has happened), and a couple of prototypes, but nothing concrete.
So, I resorted to using on_goal
s, to not drag the process further.
Damiano Testa (Oct 01 2024 at 00:58):
For reference, this conversation (and the one linked from there) was the discussion about the side-goals.
Last updated: May 02 2025 at 03:31 UTC