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

1 declarations. Mathlib docs · Source

def Mathlib.Tactic.replace' E1 #

Lean.ParserDescr

replace h := e is like have h := e, but it removes a previous hypothesis of the same name as this one if possible. For example, if the state is:

f : α → β
h : α
⊢ goal

Then after replace h := f h the state will be:

f : α → β
h : β
⊢ goal

whereas have h := f h would result in:

f : α → β
h† : α
h : β
⊢ goal

The tactic specialize h a₁ ... aₙ is a way to write replace h := h a₁ ... aₙ, automatically inferring which hypothesis should be replaced.

The replace tactic can be used to simulate Rocq's apply at tactic.

Extensions:

  • replace h : t, without a subsequent proof, creates a new main goal case h : ... ⊢ t. This form is considered deprecated in Mathlib: use replace h : t := _ instead.