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

29 declarations. Mathlib docs · Source

def Mathlib.VersoRoles.Citation.ctorIdx E1 #

Mathlib.VersoRoles.Citation → ℕ

def url.getArgs E1 #

Lean.TSyntaxArray `Lean.Doc.Parser.inline →
  StateT (Array (Lean.TSyntax `Lean.Doc.Parser.arg)) Lean.Doc.DocM (Lean.Doc.Inline Lean.ElabInline)

A link to a URL.

The code literal contains the target, which is also used as the link text, as in {url}`https://leanprover.org`.

def cite.getArgs E1 #

Lean.TSyntaxArray `Lean.Doc.Parser.inline →
  StateT (Array (Lean.TSyntax `Lean.Doc.Parser.arg)) Lean.Doc.DocM (Lean.Doc.Inline Lean.ElabInline)

A reference to a bibliography entry.

The positional argument is the entry's key in docs/references.bib, and the bracketed content is the text to render, as in {cite "Adamek_Rosicky_1994"}[Adámek–Rosický]. A warning is emitted when the key is not found in docs/references.bib.

TODO: this performs an O(n) lookup of bibliographic entries for every reference appearing in each docstring. For potential optimization, see: https://github.com/leanprover-community/mathlib4/pull/44135/changes#r4258754031

def code.getArgs E1 #

Lean.Doc.VersoCodeBlock →
  StateT (Array (Lean.TSyntax `Lean.Doc.Parser.arg)) Lean.Doc.DocM (Lean.Doc.Block Lean.ElabInline Lean.ElabBlock)

A verbatim code listing in the language named by the positional argument, as in ```code python.

The language is recorded for later use; the listing itself is rendered verbatim.

def library_note.getArgs E1 #

Lean.TSyntaxArray `Lean.Doc.Parser.inline →
  StateT (Array (Lean.TSyntax `Lean.Doc.Parser.arg)) Lean.Doc.DocM (Lean.Doc.Inline Lean.ElabInline)

A reference to a library note.

The code literal contains the note's label, as in {library_note}`partially-applied ext lemmas`. A warning is reported when no library note with this label is in scope, so that references to notes defined later are allowed. Set the option doc.verso.libraryNote.warnOnMissing to false to disable this warning.

theorem Mathlib.VersoRoles.CodeWithLanguage.mk.inj E1 #

∀ {language language_1 : String}, { language := language } = { language := language_1 } → language = language_1

def Mathlib.VersoRoles.CodeWithLanguage.ctorIdx E1 #

Mathlib.VersoRoles.CodeWithLanguage → ℕ

theorem Mathlib.VersoRoles.CodeWithLanguage.mk.injEq E0 #

∀ (language language_1 : String), ({ language := language } = { language := language_1 }) = (language = language_1)

theorem Mathlib.VersoRoles.Citation.mk.injEq E0 #

∀ (key key_1 : String), ({ key := key } = { key := key_1 }) = (key = key_1)

theorem Mathlib.VersoRoles.Citation.mk.inj E1 #

∀ {key key_1 : String}, { key := key } = { key := key_1 } → key = key_1

structure Mathlib.VersoRoles.Citation E1 #

Type

A reference to a bibliography entry in docs/references.bib.

ctor Mathlib.VersoRoles.Citation.mk E0 #

String → Mathlib.VersoRoles.Citation

abbrev Mathlib.VersoRoles.Citation.key E1 #

Mathlib.VersoRoles.Citation → String

The citation key, as it appears in docs/references.bib.

def Mathlib.VersoRoles.instReprCitation.repr E1 #

Mathlib.VersoRoles.Citation → ℕ → Std.Format

instance Mathlib.VersoRoles.instTypeNameCitation E0 #

TypeName Mathlib.VersoRoles.Citation

instance Mathlib.VersoRoles.instReprCitation E0 #

Repr Mathlib.VersoRoles.Citation

structure Mathlib.VersoRoles.CodeWithLanguage E1 #

Type

A verbatim code listing together with the name of its language.

ctor Mathlib.VersoRoles.CodeWithLanguage.mk E0 #

String → Mathlib.VersoRoles.CodeWithLanguage

abbrev Mathlib.VersoRoles.CodeWithLanguage.language E1 #

Mathlib.VersoRoles.CodeWithLanguage → String

The language of the code listing.

def Mathlib.VersoRoles.instReprCodeWithLanguage.repr E1 #

Mathlib.VersoRoles.CodeWithLanguage → ℕ → Std.Format

instance Mathlib.VersoRoles.instReprCodeWithLanguage E0 #

Repr Mathlib.VersoRoles.CodeWithLanguage

instance Mathlib.VersoRoles.instTypeNameCodeWithLanguage E0 #

TypeName Mathlib.VersoRoles.CodeWithLanguage

def Mathlib.VersoRoles.soleCode E1 #

Array Lean.Doc.VersoInline → Lean.Doc.DocM Lean.Doc.VersoCode

Extracts the single code literal from the contents of a role, such as the `x` in {role}`x`.

def Mathlib.VersoRoles.bibContainsKey E1 #

String → String → Bool

Whether bib (the contents of docs/references.bib) contains an entry with the given key.

def url E1 #

Lean.TSyntaxArray `Lean.Doc.Parser.inline → Lean.Doc.DocM (Lean.Doc.Inline Lean.ElabInline)

A link to a URL.

The code literal contains the target, which is also used as the link text, as in {url}`https://leanprover.org`.

opaque doc.verso.libraryNote.warnOnMissing E1 #

Lean.Option Bool

If doc.verso.libraryNote.warnOnMissing is enabled, a {library_note} reference that is not in scope generates a warning.

def library_note E1 #

Lean.TSyntaxArray `Lean.Doc.Parser.inline → Lean.Doc.DocM (Lean.Doc.Inline Lean.ElabInline)

A reference to a library note.

The code literal contains the note's label, as in {library_note}`partially-applied ext lemmas`. A warning is reported when no library note with this label is in scope, so that references to notes defined later are allowed. Set the option doc.verso.libraryNote.warnOnMissing to false to disable this warning.

def cite E1 #

Lean.StrLit → Lean.TSyntaxArray `Lean.Doc.Parser.inline → Lean.Doc.DocM (Lean.Doc.Inline Lean.ElabInline)

A reference to a bibliography entry.

The positional argument is the entry's key in docs/references.bib, and the bracketed content is the text to render, as in {cite "Adamek_Rosicky_1994"}[Adámek–Rosický]. A warning is emitted when the key is not found in docs/references.bib.

TODO: this performs an O(n) lookup of bibliographic entries for every reference appearing in each docstring. For potential optimization, see: https://github.com/leanprover-community/mathlib4/pull/44135/changes#r4258754031

def code E3 #

Lean.Ident → Lean.Doc.VersoCodeBlock → Lean.Doc.DocM (Lean.Doc.Block Lean.ElabInline Lean.ElabBlock)

A verbatim code listing in the language named by the positional argument, as in ```code python.

The language is recorded for later use; the listing itself is rendered verbatim.