Skip to content

feat: forbid persistent omit commands - #45017

Draft
kim-em wants to merge 11 commits into
leanprover-community:masterfrom
kim-em:lint-plain-omit
Draft

kim-em wants to merge 11 commits into
leanprover-community:masterfrom
kim-em:lint-plain-omit

Conversation

@kim-em

@kim-em kim-em commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Warn on persistent omit commands and require per-declaration omit ... in. Add linter.style.omit to linter.mathlibStandardSet.

The check lives in the existing style-linter module and follows command wrappers only. It does not traverse declaration bodies or syntax quotations, read source files separately, or add imports. Scoped set_option settings are respected, and elaborator errors suppress additional lint warnings.

The exact policy remains under discussion, especially an exception for plain omit at the start of a section or namespace. This draft retains the original strict rule pending that decision. The confusing omit ... in section idiom is no longer recommended or used by the cleanup.


The linter-specific changes are in this diff (four files).

🤖 prepared with Codex

@kim-em

kim-em commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Prerequisite: #45016 must merge first. This PR targets master and carries the cleanup commits. The omit ... in section grouping has been reverted; the exception for plain omissions at the beginning of a scope remains under discussion. The linter-specific changes are in kim-em/mathlib4@a90cb66...2d535b2 (four files).

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

PR summary 2d535b28cb

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ OmitField
+ omitLinter

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 2d535b2).

  • +1 new declarations
  • −0 removed declarations
+Mathlib.Linter.linter.style.omit

No changes to strong technical debt.
No changes to weak technical debt.

Current commit 2d535b28cb
Reference commit 5b040b83e2

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

raresbuhai pushed a commit to raresbuhai/TauCeti that referenced this pull request Oct 19, 2026
…Project#18426)

Remove all 42 persistent `omit` commands from 39 library files. Matching `include`/`omit` pairs use local `include ... in` commands where appropriate; other omissions become `omit ... in` at the affected declarations. Existing scoped omissions remain allowed.

This makes assumptions visible at each declaration without leaving an omission active for later declarations. Proofs and declaration order are unchanged.

Validation: all 39 affected modules build successfully (13,105 jobs including dependencies/cache restores); all 1,636 compiled declaration types have identical normalized fingerprints before and after, including implicit parameter order. Text style, copyright headers, the source-option guard, and `git diff --check` pass. The full downstream CI build/audits remain for CI.

[The upstream Mathlib linter proposal](leanprover-community/mathlib4#45017) would lint persistent `omit` commands while allowing `omit ... in`.

Roadmap: none
@grunweg grunweg added blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) LLM-generated PRs with substantial input from LLMs - review accordingly t-linter Linter labels Oct 26, 2026
@grunweg grunweg changed the title feat(linter): forbid persistent omit commands feat: forbid persistent omit commands Oct 26, 2026
@grunweg grunweg added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Oct 26, 2026
@grunweg

grunweg commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

If/When you turn to this PR again, can you reword the PR description in concise English prose, please? The current one is quite verbose and does not explain to my why we're doing this. Thanks!

@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@mathlib-merge-conflicts mathlib-merge-conflicts Bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 26, 2026
@mathlib-merge-conflicts

Copy link
Copy Markdown

This pull request has conflicts, please merge master and resolve them.

This branch has not been deployed

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

Labels

awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) LLM-generated PRs with substantial input from LLMs - review accordingly merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-linter Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants