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.Simps.NotationClass

21 declarations. Mathlib docs · Source

@[notation_class] attribute for @[simps]

This declares the @[notation_class] attribute, which is used to give smarter default projections for @[simps].

For further documentation, see Tactic.Simps.Basic.

theorem Simps.AutomaticProjectionData.mk.injEq E0 #

∀ (className : Lean.Name) (isNotation : Bool) (findArgs className_1 : Lean.Name) (isNotation_1 : Bool)
  (findArgs_1 : Lean.Name),
  ({ className := className, isNotation := isNotation, findArgs := findArgs } =
      { className := className_1, isNotation := isNotation_1, findArgs := findArgs_1 }) =
    (className = className_1 ∧ isNotation = isNotation_1 ∧ findArgs = findArgs_1)

def Simps.AutomaticProjectionData.ctorIdx E1 #

Simps.AutomaticProjectionData → ℕ

def Simps.instInhabitedAutomaticProjectionData.default E1 #

Simps.AutomaticProjectionData

theorem Simps.AutomaticProjectionData.mk.inj E1 #

∀ {className : Lean.Name} {isNotation : Bool} {findArgs className_1 : Lean.Name} {isNotation_1 : Bool}
  {findArgs_1 : Lean.Name},
  { className := className, isNotation := isNotation, findArgs := findArgs } =
      { className := className_1, isNotation := isNotation_1, findArgs := findArgs_1 } →
    className = className_1 ∧ isNotation = isNotation_1 ∧ findArgs = findArgs_1

def notation_class E1 #

Lean.ParserDescr

The @[notation_class] attribute specifies that this is a notation class, and this notation should be used instead of projections by @[simps].

  • This is only important if the projection is written differently using notation, e.g. + uses HAdd.hAdd, not Add.add and 0 uses OfNat.ofNat not Zero.zero. We also add it to non-heterogeneous notation classes, like Neg, but it doesn't do much for any class that extends Neg.
  • @[notation_class* <projName> Simps.findCoercionArgs] is used to configure the SetLike and DFunLike coercions.
  • The first name argument is the projection name we use as the key to search for this class (default: name of first projection of the class).
  • The second argument is the name of a declaration that has type findArgType which is defined to be Name → Name → Array Expr → MetaM (Array (Option Expr)). This declaration specifies how to generate the arguments of the notation class from the arguments of classes that use the projection.

def Simps.findArgType E1 #

Type

The type of methods to find arguments for automatic projections for simps. We partly define this as a separate definition so that the unused arguments linter doesn't complain.

def Simps.defaultfindArgs E1 #

Simps.findArgType

Find arguments for a notation class

def Simps.copyFirst E1 #

Simps.findArgType

Find arguments by duplicating the first argument. Used for pow.

def Simps.copySecond E1 #

Simps.findArgType

Find arguments by duplicating the first argument. Used for smul.

def Simps.nsmulArgs E1 #

Simps.findArgType

Find arguments by prepending ℕ and duplicating the first argument. Used for nsmul.

def Simps.zsmulArgs E1 #

Simps.findArgType

Find arguments by prepending ℤ and duplicating the first argument. Used for zsmul.

def Simps.findZeroArgs E1 #

Simps.findArgType

Find arguments for the Zero class.

def Simps.findOneArgs E1 #

Simps.findArgType

Find arguments for the One class.

def Simps.findCoercionArgs E1 #

Simps.findArgType

Find arguments of a coercion class (DFunLike or SetLike)

structure Simps.AutomaticProjectionData E1 #

Type

Data needed to generate automatic projections. This data is associated to a name of a projection in a structure that must be used to trigger the search.

ctor Simps.AutomaticProjectionData.mk E0 #

Lean.Name → Bool → Lean.Name → Simps.AutomaticProjectionData

abbrev Simps.AutomaticProjectionData.className E1 #

Simps.AutomaticProjectionData → Lean.Name

className is the name of the class we are looking for.

abbrev Simps.AutomaticProjectionData.isNotation E1 #

Simps.AutomaticProjectionData → Bool

isNotation is a Boolean that specifies whether this is notation (false for the coercions DFunLike and SetLike). If this is set to true, we add the current class as hypothesis during type-class synthesis.

abbrev Simps.AutomaticProjectionData.findArgs E1 #

Simps.AutomaticProjectionData → Lean.Name

The method to find the arguments of the class.

instance Simps.instInhabitedAutomaticProjectionData E0 #

Inhabited Simps.AutomaticProjectionData

opaque Simps.notationClassAttr E1 #

Lean.NameMapExtension Simps.AutomaticProjectionData

@[notation_class] attribute. Note: this is not a NameMapAttribute because we key on the argument of the attribute, not the declaration name.