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

13 declarations. Mathlib docs · Source

Tracking uses of sorry

This file provides a #print sorries command to help find out why a given declaration is not sorry-free. #print sorries foo returns a non-sorry-free declaration bar which foo depends on, if such a bar exists.

The #print sorries in CMD combinator prints all sorries appearing in the declarations defined by the given command.

TODO

  • Add configuration options. #print sorries +positions -types would print file/line/col information and not print the types.
  • Make versions for other axioms/constants. The #print sorries command itself shouldn't be generalized, since sorry is a special concept, representing unfinished proofs, and it has special support for "go to definition", etc.
  • Move to ImportGraph?

theorem Mathlib.PrintSorries.State.mk.injEq E0 #

∀ (visited : Lean.NameSet) (sorries : Std.HashSet Lean.Expr) (sorryMsgs : Array Lean.MessageData)
  (visited_1 : Lean.NameSet) (sorries_1 : Std.HashSet Lean.Expr) (sorryMsgs_1 : Array Lean.MessageData),
  ({ visited := visited, sorries := sorries, sorryMsgs := sorryMsgs } =
      { visited := visited_1, sorries := sorries_1, sorryMsgs := sorryMsgs_1 }) =
    (visited = visited_1 ∧ sorries = sorries_1 ∧ sorryMsgs = sorryMsgs_1)

def Mathlib.PrintSorries.State.ctorIdx E1 #

Mathlib.PrintSorries.State → ℕ

theorem Mathlib.PrintSorries.State.mk.inj E1 #

∀ {visited : Lean.NameSet} {sorries : Std.HashSet Lean.Expr} {sorryMsgs : Array Lean.MessageData}
  {visited_1 : Lean.NameSet} {sorries_1 : Std.HashSet Lean.Expr} {sorryMsgs_1 : Array Lean.MessageData},
  { visited := visited, sorries := sorries, sorryMsgs := sorryMsgs } =
      { visited := visited_1, sorries := sorries_1, sorryMsgs := sorryMsgs_1 } →
    visited = visited_1 ∧ sorries = sorries_1 ∧ sorryMsgs = sorryMsgs_1

structure Mathlib.PrintSorries.State E1 #

Type

Type of intermediate computation of sorry-tracking.

ctor Mathlib.PrintSorries.State.mk E0 #

Lean.NameSet → Std.HashSet Lean.Expr → Array Lean.MessageData → Mathlib.PrintSorries.State

abbrev Mathlib.PrintSorries.State.visited E1 #

Mathlib.PrintSorries.State → Lean.NameSet

The set of already visited declarations.

abbrev Mathlib.PrintSorries.State.sorries E1 #

Mathlib.PrintSorries.State → Std.HashSet Lean.Expr

The set of sorry expressions that have been found. Note that unlabeled sorries will only be reported in the first declaration that uses them, even if a later definition independently has a direct use of sorryAx.

abbrev Mathlib.PrintSorries.State.sorryMsgs E1 #

Mathlib.PrintSorries.State → Array Lean.MessageData

The uses of sorry that were found.

opaque Mathlib.PrintSorries.collect E1 #

Lean.Name → StateT Mathlib.PrintSorries.State Lean.MetaM Unit

Collects all uses of sorry by the declaration c. It finds all transitive uses as well.

This is a version of Lean.CollectAxioms.collect that keeps track of enough information to print each use of sorry.

def Mathlib.PrintSorries.collectSorries E1 #

Array Lean.Name → Lean.MetaM (Array Lean.MessageData)

Prints all uses of sorry inside a list of declarations. Displayed sorries are hoverable and support "go to definition".

def Mathlib.PrintSorries.printSorriesStx E1 #

Lean.ParserDescr
  • #print sorries prints all sorries that the current module depends on.
  • #print sorries id1 id2 ... idn prints all sorries that the provided declarations depend on.
  • #print sorries in CMD prints all the sorries in declarations added by the command.

Displayed sorries are hoverable and support "go to definition".

def Mathlib.PrintSorries.evalCollectSorries E1 #

Array Lean.Name → Lean.Elab.Command.CommandElabM Unit

Collects sorries in the given constants and logs a message.

def Mathlib.PrintSorries.«command#printSorriesIn_» E1 #

Lean.ParserDescr
  • #print sorries prints all sorries that the current module depends on.
  • #print sorries id1 id2 ... idn prints all sorries that the provided declarations depend on.
  • #print sorries in CMD prints all the sorries in declarations added by the command.

Displayed sorries are hoverable and support "go to definition".