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.Widget.Conv

24 declarations. Mathlib docs · Source

Conv widget

This is a slightly improved version of one of the examples that used to be in the ProofWidgets library. It defines a conv? tactic that displays a widget panel allowing to generate a conv call zooming to the subexpression selected in the goal.

abbrev Mathlib.Tactic.Conv.Path.brecOn.go E1 #

{motive : Mathlib.Tactic.Conv.Path → Sort u} →
  (t : Mathlib.Tactic.Conv.Path) →
    ((t : Mathlib.Tactic.Conv.Path) → Mathlib.Tactic.Conv.Path.below t → motive t) →
      motive t ×' Mathlib.Tactic.Conv.Path.below t

theorem Mathlib.Tactic.Conv.Path.fun.inj E1 #

∀ {depth depth_1 : ℕ}, Mathlib.Tactic.Conv.Path.fun depth = Mathlib.Tactic.Conv.Path.fun depth_1 → depth = depth_1

theorem Mathlib.Tactic.Conv.Path.brecOn.eq E1 #

∀ {motive : Mathlib.Tactic.Conv.Path → Sort u} (t : Mathlib.Tactic.Conv.Path)
  (F_1 : (t : Mathlib.Tactic.Conv.Path) → Mathlib.Tactic.Conv.Path.below t → motive t),
  Mathlib.Tactic.Conv.Path.brecOn t F_1 = F_1 t (Mathlib.Tactic.Conv.Path.brecOn.go t F_1).2

abbrev Mathlib.Tactic.Conv.Path.ctorElimType E1 #

{motive : Mathlib.Tactic.Conv.Path → Sort u} → ℕ → Sort (max 1 u)

theorem Mathlib.Tactic.Conv.Path.arg.injEq E0 #

∀ (arg : ℕ) (all : Bool) (next : Mathlib.Tactic.Conv.Path) (arg_1 : ℕ) (all_1 : Bool)
  (next_1 : Mathlib.Tactic.Conv.Path),
  (Mathlib.Tactic.Conv.Path.arg arg all next = Mathlib.Tactic.Conv.Path.arg arg_1 all_1 next_1) =
    (arg = arg_1 ∧ all = all_1 ∧ next = next_1)

theorem Mathlib.Tactic.Conv.Path.body.injEq E0 #

∀ (name : Lean.Name) (next : Mathlib.Tactic.Conv.Path) (name_1 : Lean.Name) (next_1 : Mathlib.Tactic.Conv.Path),
  (Mathlib.Tactic.Conv.Path.body name next = Mathlib.Tactic.Conv.Path.body name_1 next_1) =
    (name = name_1 ∧ next = next_1)

theorem Mathlib.Tactic.Conv.Path.arg.inj E1 #

∀ {arg : ℕ} {all : Bool} {next : Mathlib.Tactic.Conv.Path} {arg_1 : ℕ} {all_1 : Bool}
  {next_1 : Mathlib.Tactic.Conv.Path},
  Mathlib.Tactic.Conv.Path.arg arg all next = Mathlib.Tactic.Conv.Path.arg arg_1 all_1 next_1 →
    arg = arg_1 ∧ all = all_1 ∧ next = next_1

theorem Mathlib.Tactic.Conv.Path.type.injEq E0 #

∀ (next next_1 : Mathlib.Tactic.Conv.Path), (next.type = next_1.type) = (next = next_1)

def Mathlib.Tactic.Conv.Path.ctorIdx E1 #

Mathlib.Tactic.Conv.Path → ℕ

theorem Mathlib.Tactic.Conv.Path.type.inj E1 #

∀ {next next_1 : Mathlib.Tactic.Conv.Path}, next.type = next_1.type → next = next_1

theorem Mathlib.Tactic.Conv.Path.body.inj E1 #

∀ {name : Lean.Name} {next : Mathlib.Tactic.Conv.Path} {name_1 : Lean.Name} {next_1 : Mathlib.Tactic.Conv.Path},
  Mathlib.Tactic.Conv.Path.body name next = Mathlib.Tactic.Conv.Path.body name_1 next_1 → name = name_1 ∧ next = next_1

theorem Mathlib.Tactic.Conv.Path.fun.injEq E0 #

∀ (depth depth_1 : ℕ), (Mathlib.Tactic.Conv.Path.fun depth = Mathlib.Tactic.Conv.Path.fun depth_1) = (depth = depth_1)

inductive Mathlib.Tactic.Conv.Path E1 #

Type

A path to a subexpression from a root expression. The constructors are chosen to be easily translatable into conv directions.

ctor Mathlib.Tactic.Conv.Path.arg E0 #

ℕ → Bool → Mathlib.Tactic.Conv.Path → Mathlib.Tactic.Conv.Path

Accesses the argth implicit or explicit argument, depending on whether all is true or false, respectively. Corresponds to the conv tactic arg. For example, Path.arg 3 true next is arg @3 followed by next, and Path.arg 0 false next is arg 0 followed by next.

ctor Mathlib.Tactic.Conv.Path.fun E0 #

ℕ → Mathlib.Tactic.Conv.Path

End a conv sequence with depth-many repetitions of the conv tactic fun. For example, Path.fun 3 corresponds to the conv sequence fun; fun; fun, and Path.fun 0 just terminates a Path without any extra conv tactics.

ctor Mathlib.Tactic.Conv.Path.type E0 #

Mathlib.Tactic.Conv.Path → Mathlib.Tactic.Conv.Path

Traverses into the binder type of a forall, let, or lambda. Currently out of these three options conv only supports going into the binder type of a forall, but in the future if conv gets support for going into let or lambda binding types with different conv tactics we may add additional arguments to specify whether the binder is a forall, let, or lambda. Corresponds to the conv tactics lhs or arg.

ctor Mathlib.Tactic.Conv.Path.body E0 #

Lean.Name → Mathlib.Tactic.Conv.Path → Mathlib.Tactic.Conv.Path

Traverses into the body of a forall, let, or lambda. Corresponds to the conv tactics intro or ext.

def Mathlib.Tactic.Conv.Path.ofSubExprPos E1 #

Lean.Expr → Lean.SubExpr.Pos → Lean.MetaM Mathlib.Tactic.Conv.Path

Given an e : Expr and pos : SubExpr.Pos, Path.ofSubExprPos expr pos generates the Path corresponding to traversing pos starting at the reference expression e.

def Mathlib.Tactic.Conv.pathToStx E1 #

{m : Type → Type} →
  [Monad m] →
    [Lean.MonadQuotation m] →
      Lean.TSyntax `conv →
        Mathlib.Tactic.Conv.Path →
          Option Lean.Name →
            optParam (Lean.Syntax.TSepArray `Lean.Parser.Tactic.Conv.enterArg ",") ∅ → m (Lean.TSyntax `tactic)

Given a path : Path and xs : TSepArray ``enterArg ",", generate the conv syntax corresponding to enter [xs,*] followed by traversing path. If loc is some fvar, start with conv at fvar =>, otherwise if loc is none start with conv =>.

def Mathlib.Tactic.Conv.insertEnterSyntax E1 #

Array Lean.SubExpr.GoalsLocation → Lean.Expr → Lean.MetaM Lean.Syntax

Return the syntax to insert for the conv widget. Factored out of insertEnter for easy testing.

def Mathlib.Tactic.Conv.insertEnter E1 #

Array Lean.SubExpr.GoalsLocation →
  Lean.Expr → SelectInsertParams → Lean.MetaM (String × String × Option (String.Pos.Raw × String.Pos.Raw))

Return the text for the link in the conv widget that inserts the replacement, and also return the replacement, and the range within the file to highlight after the replacement is inserted. The highlighted range will always be the trailing skip.

def Mathlib.Tactic.Conv.SelectionPanel.rpc E1 #

SelectInsertParams → Lean.Server.RequestM (Lean.Server.RequestTask ProofWidgets.Html)

Rpc function for the conv widget.

def Mathlib.Tactic.Conv.SelectionPanel E1 #

ProofWidgets.Component SelectInsertParams

The conv widget.

def Mathlib.Tactic.Conv.tacticConv? E1 #

Lean.ParserDescr

Display a widget panel allowing to generate a conv call zooming to the subexpression selected in the goal or in the type of a local hypothesis or let-decl.