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

2 declarations. Mathlib docs · Source

The #defeq_abuse tactic and command combinators

WARNING: #defeq_abuse is an experimental tool intended to assist with breaking changes to transparency handling (associated with backward.isDefEq.respectTransparency). Its syntax may change at any time, and it may not behave as expected. Please report unexpected behavior on Zulip.

#defeq_abuse in tac runs tac with backward.isDefEq.respectTransparency both true and false. If the tactic succeeds with false but fails with true, it identifies the specific isDefEq checks that fail with the stricter setting, helping to diagnose where Mathlib relies on definitional equality that isn't available at instance transparency.

#defeq_abuse in cmd does the same for commands (e.g. instance declarations), where type class synthesis failures may occur during elaboration rather than during a tactic. It additionally traces Meta.synthInstance to group isDefEq failures by the synthesis application that triggered them.

Usage

Tactic mode

#defeq_abuse in rw [Set.disjoint_singleton_right]

will report something like:

Tactic fails with `backward.isDefEq.respectTransparency true` but succeeds with `false`.
The following isDefEq checks are the root causes of the failure:
  (i : ℕ) → (fun a ↦ Prop) i =?= Set ℕ

Command mode

#defeq_abuse in
instance {V : Type} [AddCommGroup V] [Module ℝ V] {l : Submodule ℝ V} :
    Module.Free ℝ l := Module.Free.of_divisionRing ℝ l

will report the synthesis failures grouped by instance application.

def Mathlib.Tactic.DefEqAbuse.defeqAbuse E1 #

Lean.ParserDescr

WARNING: #defeq_abuse is an experimental tool intended to assist with breaking changes to transparency handling. Its syntax may change at any time, and it may not behave as expected. Please report unexpected behavior on Zulip.

#defeq_abuse in tac runs tac with backward.isDefEq.respectTransparency both true and false. If the tactic succeeds with false but fails with true, it identifies the specific isDefEq checks that fail with the stricter setting.

The tactic still executes (using the permissive setting if needed), so proofs remain valid during debugging.

def Mathlib.Tactic.DefEqAbuse.defeqAbuseCmd E1 #

Lean.ParserDescr

WARNING: #defeq_abuse is an experimental tool intended to assist with breaking changes to transparency handling. Its syntax may change at any time, and it may not behave as expected. Please report unexpected behavior on Zulip.

#defeq_abuse in cmd runs cmd with backward.isDefEq.respectTransparency both true and false. If the command succeeds with false but fails with true, it identifies the specific synthesis applications and isDefEq checks that fail with the stricter setting.

This is useful for diagnosing instance declarations or other commands where type class synthesis failures occur during elaboration rather than within a tactic.

The command is re-executed with the permissive setting so that it actually takes effect.