The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V34. The tactics of Mathlib

Mathlib.Tactic.Linter.MinImports

5 declarations. Mathlib docs · Source

The minImports linter

The minImports linter incrementally computes the minimal imports needed for each file to build. Whenever it detects that a new command requires an increase in the (transitive) imports that it computed so far, it emits a warning mentioning the bigger minimal imports.

Unlike the related #min_imports command, the linter takes into account notation and tactic information. It also works incrementally, accumulating increasing import information. This is better suited, for instance, to split files.

The "minImports" linter

The "minImports" linter tracks information about minimal imports over several commands.

def Mathlib.Linter.instInhabitedImportState.default E1 #

Mathlib.Linter.ImportState✝

def Mathlib.Linter.«command#reset_min_imports» E1 #

Lean.ParserDescr

#reset_min_imports sets to empty the current list of cumulative imports.

opaque Mathlib.Linter.linter.minImports E1 #

Lean.Option Bool

The minImports linter incrementally computes the minimal imports needed for each file to build. Whenever it detects that a new command requires an increase in the (transitive) imports that it computed so far, it emits a warning mentioning the bigger minimal imports.

Unlike the related #min_imports command, the linter takes into account notation and tactic information. It also works incrementally, providing information that is better suited, for instance, to split files.

Another important difference is that the minImports linter starts counting imports from where the option is set to true downwards, whereas the #min_imports command looks at the imports needed from the command upwards.

opaque Mathlib.Linter.linter.minImports.increases E1 #

Lean.Option Bool

The linter.minImports.increases regulates whether the minImports linter reports the change in number of imports, when it reports import changes. Setting this option to false helps with test stability.

def Mathlib.Linter.MinImports.«command#import_bumps» E1 #

Lean.ParserDescr

The minImports linter incrementally computes the minimal imports needed for each file to build. Whenever it detects that a new command requires an increase in the (transitive) imports that it computed so far, it emits a warning mentioning the bigger minimal imports.

Unlike the related #min_imports command, the linter takes into account notation and tactic information. It also works incrementally, providing information that is better suited, for instance, to split files.

Another important difference is that the minImports linter starts counting imports from where the option is set to true downwards, whereas the #min_imports command looks at the imports needed from the command upwards.