The areas / V34. The tactics of Mathlib
Mathlib.Tactic.Basify.Attr
17 declarations. Mathlib docs · Source
Attributes for the basify tactic
This file declares the three attributes that drive basify, together with the two environment
extensions backing them. They live in their own file because Lean cannot use an attribute in the
file that declares it; Mathlib/Tactic/Basify.lean documents the tactic itself.
The registries
def Mathlib.Tactic.Basify.ElimEntry.ctorIdx E1 #
Mathlib.Tactic.Basify.ElimEntry → ℕ
def Mathlib.Tactic.Basify.instInhabitedElimEntry.default E1 #
Mathlib.Tactic.Basify.ElimEntry
theorem Mathlib.Tactic.Basify.ElimEntry.mk.injEq E0 #
∀ (elimName : Lean.Name) (altBinders : Array (Array (Option Lean.Name))) (elimName_1 : Lean.Name)
(altBinders_1 : Array (Array (Option Lean.Name))),
({ elimName := elimName, altBinders := altBinders } = { elimName := elimName_1, altBinders := altBinders_1 }) =
(elimName = elimName_1 ∧ altBinders = altBinders_1)
theorem Mathlib.Tactic.Basify.ElimEntry.mk.inj E1 #
∀ {elimName : Lean.Name} {altBinders : Array (Array (Option Lean.Name))} {elimName_1 : Lean.Name}
{altBinders_1 : Array (Array (Option Lean.Name))},
{ elimName := elimName, altBinders := altBinders } = { elimName := elimName_1, altBinders := altBinders_1 } →
elimName = elimName_1 ∧ altBinders = altBinders_1
def Parser.Attr.basify_simp_proc E1 #
Lean.ParserDescr
Simplification procedure
def Parser.Attr.basify_simp E1 #
Lean.ParserDescr
The simp set basify runs, after each case split and once at the end: the lemmas that clear
away the degenerate branches, where some atom is ⊤ or ⊥, and those that translate a proposition
down, such as ↑a ≤ ↑b ↔ a ≤ b. Lemmas tagged @[basify_op] are added here as well.
structure Mathlib.Tactic.Basify.ElimEntry E1 #
Type
Information about an eliminator registered with @[basify_elim].
ctor Mathlib.Tactic.Basify.ElimEntry.mk E0 #
Lean.Name → Array (Array (Option Lean.Name)) → Mathlib.Tactic.Basify.ElimEntry
abbrev Mathlib.Tactic.Basify.ElimEntry.elimName E1 #
Mathlib.Tactic.Basify.ElimEntry → Lean.Name
The name of the eliminator, used as cases x using elimName.
abbrev Mathlib.Tactic.Basify.ElimEntry.altBinders E1 #
Mathlib.Tactic.Basify.ElimEntry → Array (Array (Option Lean.Name))
How to name what each minor premise introduces, one entry per premise and then one per
binder, in order. none marks the binder carrying the value -- the one occurring in the
alternative's pattern -- which takes the name of the atom being split; any other binder takes
that name with its own appended. Splitting x : ℕ+ with an alternative
∀ (n : ℕ) (_pos : 0 < n), C n.toPNat' yields x and x_pos.
instance Mathlib.Tactic.Basify.instInhabitedElimEntry E0 #
Inhabited Mathlib.Tactic.Basify.ElimEntry
opaque Mathlib.Tactic.Basify.elimExt E1 #
Lean.SimpleScopedEnvExtension (Lean.Name × Mathlib.Tactic.Basify.ElimEntry)
(Lean.NameMap Mathlib.Tactic.Basify.ElimEntry)
The eliminators registered with @[basify_elim], indexed by the head symbol of the type
they destruct.
opaque Mathlib.Tactic.Basify.opExt E1 #
Lean.SimpleScopedEnvExtension (Lean.Name × Lean.Name) (Lean.NameMap Lean.NameSet)
The operations registered with @[basify_op], indexed by the head symbol of the type they
act on. These are the applications basify looks inside of when searching for atoms.
def Mathlib.Tactic.Basify.analyzeElim E1 #
Lean.Name → Lean.MetaM (Lean.Name × Mathlib.Tactic.Basify.ElimEntry)
Read off, from the type of the eliminator elimName, the head symbol of the type it destructs
together with how to name what each of its alternatives introduces.
def Mathlib.Tactic.Basify.analyzeOp E1 #
Lean.Name → Lean.MetaM (Array (Lean.Name × Lean.Name))
The operations related by an @[basify_op] lemma ↑(f a₁ … aₙ) = g ↑a₁ … ↑aₙ, namely f and
g, each paired with the type it operates on.
def Mathlib.Tactic.Basify.basifyElim E1 #
Lean.ParserDescr
@[basify_elim] registers an eliminator for basify to case split with. The declaration must
be usable as cases x using foo: it takes a motive, some minor premises and a single target. The
type it destructs and the shape of each of its cases are read off from its type.
A subtype is registered the same way, with an eliminator that has a single minor premise. It must
present the value through a properly typed constructor rather than Subtype.mk: ℝ≥0 and ℕ+ are
semireducible definitions, so a goal mentioning ⟨x, hx⟩ : ℝ≥0 is not type-correct at the
transparency simp checks at. See NNReal.recToNNReal, which uses Real.toNNReal.
def Mathlib.Tactic.Basify.basifyOp E1 #
Lean.ParserDescr
@[basify_op] registers an operation of a registered type as one that basify knows
how to see inside of, by tagging the lemma that relates it to the corresponding operation of the
underlying type, such as ENNReal.coe_add : ↑(a + b) = ↑a + ↑b. Anything else of a registered type
is an atom: basify generalizes it and case splits on it rather than descending into it.
The lemma is also added to basify_simp, reversed if ← is given, so that what basify looks
inside of it can also rewrite through. That rules out a lemma unusable as a rewrite:
ENNReal.coe_ofNat has a no_indexed right-hand side that would match everything when reversed,
so Mathlib/Tactic/Basify/ENNReal.lean restates it.