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 / V01. The language of Mathlib

Mathlib.Util.Delaborators

9 declarations. Mathlib docs · Source

Pi type notation

Provides the Π x : α, β x notation as an alternative to Lean 4's built-in (x : α) → β x notation. To get all non-∀ pi types to pretty print this way then do open scoped PiNotation.

The notation also accepts extended binders, like Π x ∈ s, β x for Π x, x ∈ s → β x. This can be disabled with the pp.mathlib.binderPredicates option.

def PiNotation.piNotation.formatter E1 #

Lean.PrettyPrinter.Formatter

def PiNotation.piNotation.parenthesizer E1 #

Lean.PrettyPrinter.Parenthesizer

def PiNotation.piNotation E1 #

Lean.Parser.Parser

Dependent function type (a "pi type"). The notation Π x : α, β x can also be written as (x : α) → β x.

def PiNotation.«termΠ__,_» E1 #

Lean.ParserDescr

Dependent function type (a "pi type"). The notation Π x ∈ s, β x is short for Π x, x ∈ s → β x.

def PiNotation.replacePiNotation E1 #

Lean.Macro

Since pi notation and forall notation are interchangeable, we can parse it by simply using the pre-existing forall parser.

def PiNotation.delabPi E1 #

Lean.PrettyPrinter.Delaborator.Delab

Override the Lean 4 pi notation delaborator with one that prints cute binders such as ∀ ε > 0.

def PiNotation.delabPi' E1 #

Lean.PrettyPrinter.Delaborator.Delab

Override the Lean 4 pi notation delaborator with one that uses Π and prints cute binders such as ∀ ε > 0. Note that this takes advantage of the fact that (x : α) → p x notation is never used for propositions, so we can match on this result and rewrite it.

def exists_delab E1 #

Lean.PrettyPrinter.Delaborator.Delab

Delaborator for existential quantifier, including extended binders.

def delabNotIn E1 #

Lean.PrettyPrinter.Delaborator.Delab

Delaborator for ∉.