The areas / V34. The tactics of Mathlib
Mathlib.Tactic.FBinop
13 declarations. Mathlib docs · Source
Elaborator for functorial binary operators
fbinop% f x y elaborates f x y for x : S α and y : S' β, taking into account
any coercions that the "functors" S and S' possess.
While binop% tries to solve for a single minimal type, fbinop% tries to solve
the parameterized problem of solving for a single minimal "functor."
The code is drawn from the Lean 4 core binop% elaborator. Two simplifications made were
- It is assumed that every
fhas a "homogeneous" instance (thinkSet.prod : Set α → Set β → Set (α × β)). - It is assumed that there are no "non-homogeneous" default instances.
It also makes the assumption that the binop wants to be as homogeneous as possible.
For example, when the type of an argument is unknown it will try to unify the argument's type
with S _, which can help certain elaboration problems proceed (like for {a,b,c} notation).
The main goal is to support generic set product notation and have it elaborate in a convenient way.
def FBinopElab.instInhabitedSRec.default E1 #
FBinopElab.SRec
def FBinopElab.SRec.ctorIdx E1 #
FBinopElab.SRec → ℕ
theorem FBinopElab.SRec.mk.inj E1 #
∀ {name : Lean.Name} {args : Array Lean.Expr} {name_1 : Lean.Name} {args_1 : Array Lean.Expr},
{ name := name, args := args } = { name := name_1, args := args_1 } → name = name_1 ∧ args = args_1
theorem FBinopElab.SRec.mk.injEq E0 #
∀ (name : Lean.Name) (args : Array Lean.Expr) (name_1 : Lean.Name) (args_1 : Array Lean.Expr),
({ name := name, args := args } = { name := name_1, args := args_1 }) = (name = name_1 ∧ args = args_1)
def FBinopElab.prodSyntax E1 #
Lean.ParserDescr
fbinop% f x y elaborates f x y for x : S α and y : S' β, taking into account
any coercions that the "functors" S and S' possess.
structure FBinopElab.SRec E1 #
Type
Records a "functor", which is some function Type u → Type v. We only
allow c a1 ... an for c a constant. This is so we can abstract out the universe variables.
ctor FBinopElab.SRec.mk E0 #
Lean.Name → Array Lean.Expr → FBinopElab.SRec
abbrev FBinopElab.SRec.name E1 #
FBinopElab.SRec → Lean.Name
abbrev FBinopElab.SRec.args E1 #
FBinopElab.SRec → Array Lean.Expr
def FBinopElab.instToExprSRec.toExpr E1 #
FBinopElab.SRec → Lean.Expr
instance FBinopElab.instToExprSRec E0 #
Lean.ToExpr FBinopElab.SRec
instance FBinopElab.instInhabitedSRec E0 #
Inhabited FBinopElab.SRec
def FBinopElab.elabBinOp E1 #
Lean.Elab.Term.TermElab