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

1 declarations. Mathlib docs ยท Source

def Mathlib.Tactic.to_fun E1 #

Lean.ParserDescr

Generate an eta-expanded version of a lemma. Adding @[to_fun] to a lemma written in "point-free" form, e.g.

theorem Differentiable.mul (hf : Differentiable ๐•œ f) (hg : Differentiable ๐•œ g) :
    Differentiable ๐•œ (f * g)

will generate a new lemma Differentiable.fun_mul with conclusion Differentiable ๐•œ fun x => f x * g x.

You can specify the name of the new declaration manually, as in @[to_fun Differentiable.fun_mul]. If you do so, the newly generated name is namespaced to match the original declaration's name: tagging Foo.bar with to_fun baz generates Foo.baz; tagging Foo.Bar.baz with Bars.baz generates Foo.Bars.baz, etc.

Use the to_fun (attr := ...) (or to_fun (attr := ...) new_name) syntax to add the same attribute to both declarations.