Commit 2026-05-28 11:17 a953f2ee
View on Github āfeat(Tactic/Linter): add auxLemma linter for auto-generated declaration references (#37364)
This PR adds a syntax linter that flags explicit references to auto-generated auxiliary declarations such as _proof_N, match_N, _sizeOf_N or _aux_N. These names are internal to the Lean elaborator and are not stable across refactors (e.g. reordering fields in a structure can renumber _proof_ indices).
The linter matches precisely: it requires the suffix after the prefix to be all digits, so _proof_helper would not be flagged. It only inspects identifier syntax nodes, so references in comments and docstrings are ignored.
Current hits in Mathlib (suppressed with set_option linter.style.auxLemma false):
Mathlib/CategoryTheory/Functor/Category.leanāhcomp._proof_2Mathlib/Analysis/Calculus/FormalMultilinearSeries.leanāconstFormalMultilinearSeries.match_1.eq_2Mathlib/Data/List/Sigma.leanā_sizeOf_1Companion PR to track these suppressions in the tech debt report: https://github.com/leanprover-community/mathlib-ci/pull/17 š¤ Prepared with Claude Code