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.Whitespace

4 declarations. Mathlib docs · Source

The whitespace linter

The whitespace linter emits a warning if

  • either a command does not start at the beginning of a line;
  • or the "hypotheses segment" of a declaration does not coincide with its pretty-printed version.

def Mathlib.Linter.instInhabitedFormatError.default E1 #

Mathlib.Linter.FormatError✝

opaque Mathlib.Linter.linter.style.whitespace E1 #

Lean.Option Bool

The whitespace linter emits a warning if

  • either a command does not start at the beginning of a line;
  • or the "hypotheses segment" of a declaration does not coincide with its pretty-printed version.

In practice, this makes sure that the spacing in a typical declaration looks like

example (a : Nat) {R : Type} [Add R] : <not linted part>

as opposed to

example (a: Nat) {R:Type}  [Add  R] : <not linted part>

opaque Mathlib.Linter.linter.style.whitespace.verbose E1 #

Lean.Option Bool

If the linter.style.whitespace.verbose option is true, the whitespace linter reports some helpful diagnostic information.

def Mathlib.Linter.Style.Whitespace.mkWindow E1 #

String → ℕ → ℕ → String

mkWindow orig start ctx extracts from orig a string that starts at the first non-whitespace character before start, then expands to cover ctx more characters and continues still until the first non-whitespace character.

In essence, it extracts the substring of orig that begins at start, continues for ctx characters plus expands left and right until it encounters the first whitespace character, to avoid cutting into "words".

Note. start is the number of characters from the right where our focus is!