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.Lean.MessageData.Trace

2 declarations. Mathlib docs · Source

Utilities for analyzing MessageData

Utility functions for working with trace messages.

withTraceNode (in Lean.Util.Trace) stores a TraceResult in TraceData.result? and prepends emoji to the rendered header:

  • ✅️ (checkEmoji) for success
  • ❌️ (crossEmoji) for failure
  • 💥️ (bombEmoji) for exceptions

The traceResultOf function provides backward-compatible parsing of rendered headers.

def Lean.MessageData.extractInstName E1 #

String → String

Extract the instance name from a rendered apply @Foo to Goal trace header. Returns the string between "apply " and " to ".

Note: this is fragile string matching against Lean's Meta.synthInstance trace format. If the trace format changes, this function will silently return the original string. Once lean4#12699 is available, these nodes will have trace class Meta.synthInstance.apply and can be identified structurally via td.cls instead of string-matching on the header.

def Lean.MessageData.dedupByString E1 #

Array Lean.MessageData → BaseIO (Array Lean.MessageData)

Deduplicate an array of MessageData by their rendered string representations.