Skip to content

[Merged by Bors] - feat: lint against stream-of-conciousness obtain syntax#13220

Closed
grunweg wants to merge 23 commits intomasterfrom
MR-experiment-obtain-syntax
Closed

[Merged by Bors] - feat: lint against stream-of-conciousness obtain syntax#13220
grunweg wants to merge 23 commits intomasterfrom
MR-experiment-obtain-syntax

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented May 25, 2024

Just the syntax replacements are split into #13219.

Most of its occurrences were removed in #11045 and #12850; #13219 removed the last instances.

Why is this removed? In a nutshell, my understanding is that this is preferred against for similar reasons as #10534:

  • it's a Lean3-ism, which can be unlearned now
  • the syntax obtain foo : type := proof is slightly shorter; particularly so when the next tactic is exact
  • when using it as obtain foo : type; · proof, there is an intermediate state with multiple goals right before the focusing dot
    (This gets amplified with the in-flight "multiple goal linter", which in my perception seems generally desired - for many reasons, including teachability. Granted, the linter could be tweaked to not lint in this case... but by now, the "old" syntax is not clearly better.)
  • the old syntax could be slightly nicer when deferring goals: In the 30 replacements of the last PR, this occurred twice (i.e., very rarely). In both cases, suffices or rsuffices can be used, and would imho be clearer.

Alternatively, the obtain tactic in Lean core could also be changed: this change does not block this at all,
but moves forward with something that is doable within mathlib today.


Open in Gitpod

@grunweg grunweg changed the title WIP: linter against stream-of-conciousness obtain syntax feat: lint against stream-of-conciousness obtain syntax May 25, 2024
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented May 26, 2024

Also linted against the analogous rsuffices syntax and added a test.

@grunweg grunweg changed the title feat: lint against stream-of-conciousness obtain syntax feat: lint against stream-of-conciousness obtain or rsuffices syntax May 26, 2024
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 26, 2024
@YaelDillies
Copy link
Copy Markdown
Contributor

May I make you remark that this is really not a feat: PR? feat should be used in PRs containing new mathematical content.

@grunweg grunweg removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 27, 2024
@grunweg grunweg changed the title feat: lint against stream-of-conciousness obtain or rsuffices syntax feat: lint against stream-of-conciousness obtain syntax May 27, 2024
@grunweg grunweg changed the title feat: lint against stream-of-conciousness obtain syntax chore: lint against stream-of-conciousness obtain syntax May 27, 2024
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented May 27, 2024

I would argue it's a feature in the "linters" category - but I'm also happy to change the title. Let me know if you prefer a different category.

@grunweg grunweg force-pushed the MR-experiment-obtain-syntax branch from 5d64b96 to 1957f58 Compare May 27, 2024 07:25
@YaelDillies
Copy link
Copy Markdown
Contributor

Maybe ask the question on Zulip

@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented May 27, 2024

@grunweg grunweg changed the title chore: lint against stream-of-conciousness obtain syntax feat: lint against stream-of-conciousness obtain syntax May 27, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 10, 2024

PR summary 6751058336

Import changes

Dependency changes

File Base Count Head Count Change
Mathlib.Tactic.Basic 9 12 +3 (+33.33%)

Declarations diff

+ foo'
+ foo''
+ getLinterHash
+ is_obtain_without_proof
+ oldObtainLinter
++ foo

You can run this locally as follows
## summary with just the declaration names:
./scripts/no_lost_declarations.sh short <optional_commit>

## more verbose report:
./scripts/no_lost_declarations.sh <optional_commit>

@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 19, 2024
@grunweg grunweg removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 23, 2024
Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that it displays well in the docs...

Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jun 23, 2024

Thanks for the tweaks (just applied them)! In markdown, the previous formatting looked fine to me - but I'll trust your judgement that the generated docs look better this way!

@YaelDillies
Copy link
Copy Markdown
Contributor

Once Bryan updates the Observable notebook, we will be able to preview docs again. For now, I believe this is fine.

maintainer merge

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by YaelDillies.

@github-actions github-actions bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Jun 23, 2024
@j-loreaux
Copy link
Copy Markdown
Contributor

Thanks for writing this syntax linter!

bors merge

@github-actions github-actions bot added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Jun 24, 2024
mathlib-bors bot pushed a commit that referenced this pull request Jun 24, 2024
Just the syntax replacements are split into #13219.

Most of its occurrences were removed in #11045 and #12850; #13219 removed the last instances.

**Why is this removed?** In a nutshell, my understanding is that this is preferred against for similar reasons as #10534:
- it's a Lean3-ism, which can be unlearned now
- the syntax `obtain foo : type := proof` is slightly shorter; particularly so when the next tactic is `exact`
- when using it as `obtain foo : type; · proof`, there is an intermediate state with multiple goals right before the focusing dot
(This gets amplified with the in-flight "multiple goal linter", which in my perception seems generally desired - for many reasons, including teachability. Granted, the linter could be tweaked to not lint in this case... but by now, the "old" syntax is not clearly better.) 
- the old syntax *could* be slightly nicer when deferring goals: In the 30 replacements of the last PR, this occurred *twice* (i.e., very rarely). In both cases, `suffices` or `rsuffices` can be used, and would imho be clearer.

Alternatively, the `obtain` tactic in Lean core could also be changed: this change does not block this at all,
but moves forward with something that is doable within mathlib today.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jun 24, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat: lint against stream-of-conciousness obtain syntax [Merged by Bors] - feat: lint against stream-of-conciousness obtain syntax Jun 24, 2024
@mathlib-bors mathlib-bors bot closed this Jun 24, 2024
@mathlib-bors mathlib-bors bot deleted the MR-experiment-obtain-syntax branch June 24, 2024 22:12
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented Jun 25, 2024

Thank you for reviewing it!

kbuzzard pushed a commit that referenced this pull request Jun 26, 2024
Just the syntax replacements are split into #13219.

Most of its occurrences were removed in #11045 and #12850; #13219 removed the last instances.

**Why is this removed?** In a nutshell, my understanding is that this is preferred against for similar reasons as #10534:
- it's a Lean3-ism, which can be unlearned now
- the syntax `obtain foo : type := proof` is slightly shorter; particularly so when the next tactic is `exact`
- when using it as `obtain foo : type; · proof`, there is an intermediate state with multiple goals right before the focusing dot
(This gets amplified with the in-flight "multiple goal linter", which in my perception seems generally desired - for many reasons, including teachability. Granted, the linter could be tweaked to not lint in this case... but by now, the "old" syntax is not clearly better.) 
- the old syntax *could* be slightly nicer when deferring goals: In the 30 replacements of the last PR, this occurred *twice* (i.e., very rarely). In both cases, `suffices` or `rsuffices` can be used, and would imho be clearer.

Alternatively, the `obtain` tactic in Lean core could also be changed: this change does not block this at all,
but moves forward with something that is doable within mathlib today.
dagurtomas pushed a commit that referenced this pull request Jul 2, 2024
Just the syntax replacements are split into #13219.

Most of its occurrences were removed in #11045 and #12850; #13219 removed the last instances.

**Why is this removed?** In a nutshell, my understanding is that this is preferred against for similar reasons as #10534:
- it's a Lean3-ism, which can be unlearned now
- the syntax `obtain foo : type := proof` is slightly shorter; particularly so when the next tactic is `exact`
- when using it as `obtain foo : type; · proof`, there is an intermediate state with multiple goals right before the focusing dot
(This gets amplified with the in-flight "multiple goal linter", which in my perception seems generally desired - for many reasons, including teachability. Granted, the linter could be tweaked to not lint in this case... but by now, the "old" syntax is not clearly better.) 
- the old syntax *could* be slightly nicer when deferring goals: In the 30 replacements of the last PR, this occurred *twice* (i.e., very rarely). In both cases, `suffices` or `rsuffices` can be used, and would imho be clearer.

Alternatively, the `obtain` tactic in Lean core could also be changed: this change does not block this at all,
but moves forward with something that is doable within mathlib today.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. ready-to-merge This PR has been sent to bors. t-linter Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants