Documentation

Batteries.Linter.Misc

Various linters #

This file defines several small linters.

A linter for checking for unused arguments. We skip all declarations that contain sorry in their value, and allow arguments starting with _ to be unused.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    A linter for checking definition doc strings.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      A linter for checking theorem doc strings.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        A linter for checking whether statements of declarations are well-typed, with the elaborator's type checker Meta.check (at .all transparency) rather than the kernel.

        This linter is disabled by default. The kernel has normally accepted every statement already, so the linter mostly reports statements that the elaborator's checker rejects although the kernel accepted them, or that were added with kernel checking disabled. It has flagged statements in the past, for example lemmas generated by simps, but rarely, and it is expensive: about a third of Mathlib's linter heartbeats. To replay the kernel's checks of a library, use leanchecker; for a check by an independent kernel, use lean4lean (https://github.com/digama0/lean4lean).

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          A linter for checking that declarations aren't syntactic tautologies. Checks whether a lemma is a declaration of the form ∀ a b ... z, e₁ = e₂ where e₁ and e₂ are identical exprs. We call declarations of this form syntactic tautologies. Such lemmas are (mostly) useless and sometimes introduced unintentionally when proving basic facts with rfl when elaboration results in a different term than the user intended.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Return a list of unused let_fun terms in an expression that introduce proofs.

            Equations
            Instances For

              A linter for checking that declarations don't have unused term mode have statements.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                A linter for checking if variables appearing on both sides of an iff are explicit. Ideally, such variables should be implicit instead.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Deprecated aliases for the former Batteries.Tactic.Lint namespace.

                  @[deprecated Batteries.Linter.checkType (since := "2026-10-10")]

                  Alias of Batteries.Linter.checkType.


                  A linter for checking whether statements of declarations are well-typed, with the elaborator's type checker Meta.check (at .all transparency) rather than the kernel.

                  This linter is disabled by default. The kernel has normally accepted every statement already, so the linter mostly reports statements that the elaborator's checker rejects although the kernel accepted them, or that were added with kernel checking disabled. It has flagged statements in the past, for example lemmas generated by simps, but rarely, and it is expensive: about a third of Mathlib's linter heartbeats. To replay the kernel's checks of a library, use leanchecker; for a check by an independent kernel, use lean4lean (https://github.com/digama0/lean4lean).

                  Equations
                  Instances For
                    @[deprecated Batteries.Linter.docBlame (since := "2026-10-10")]

                    Alias of Batteries.Linter.docBlame.


                    A linter for checking definition doc strings.

                    Equations
                    Instances For
                      @[deprecated Batteries.Linter.docBlameThm (since := "2026-10-10")]

                      Alias of Batteries.Linter.docBlameThm.


                      A linter for checking theorem doc strings.

                      Equations
                      Instances For
                        @[deprecated Batteries.Linter.explicitVarsOfIff (since := "2026-10-10")]

                        Alias of Batteries.Linter.explicitVarsOfIff.


                        A linter for checking if variables appearing on both sides of an iff are explicit. Ideally, such variables should be implicit instead.

                        Equations
                        Instances For
                          @[deprecated Batteries.Linter.findUnusedHaves (since := "2026-10-10")]

                          Alias of Batteries.Linter.findUnusedHaves.


                          Return a list of unused let_fun terms in an expression that introduce proofs.

                          Equations
                          Instances For
                            @[deprecated Batteries.Linter.synTaut (since := "2026-10-10")]

                            Alias of Batteries.Linter.synTaut.


                            A linter for checking that declarations aren't syntactic tautologies. Checks whether a lemma is a declaration of the form ∀ a b ... z, e₁ = e₂ where e₁ and e₂ are identical exprs. We call declarations of this form syntactic tautologies. Such lemmas are (mostly) useless and sometimes introduced unintentionally when proving basic facts with rfl when elaboration results in a different term than the user intended.

                            Equations
                            Instances For
                              @[deprecated Batteries.Linter.unusedArguments (since := "2026-10-10")]

                              Alias of Batteries.Linter.unusedArguments.


                              A linter for checking for unused arguments. We skip all declarations that contain sorry in their value, and allow arguments starting with _ to be unused.

                              Equations
                              Instances For
                                @[deprecated Batteries.Linter.unusedHavesSuffices (since := "2026-10-10")]

                                Alias of Batteries.Linter.unusedHavesSuffices.


                                A linter for checking that declarations don't have unused term mode have statements.

                                Equations
                                Instances For