The areas / V34. The tactics of Mathlib
Mathlib.Tactic.ApplyFun
7 declarations. Mathlib docs · Source
The apply_fun tactic.
Apply a function to an equality or inequality in either a local hypothesis or the goal.
TODO
Using the mono tactic, we can attempt to automatically discharge Monotone f goals.
def Mathlib.Tactic.applyFunHyp E1 #
Lean.Term → Option Lean.Term → Lean.FVarId → Lean.MVarId → Lean.Elab.Tactic.TacticM (List Lean.MVarId)
Apply a function to a hypothesis.
def Mathlib.Tactic.applyFunTargetFailure E1 #
Lean.Term → Lean.MetaM (List Lean.MVarId)
Failure message for applyFunTarget.
def Mathlib.Tactic.maybeProveInjective E1 #
Lean.Expr → Option Lean.Expr → Lean.MetaM Bool
Given a metavariable ginj of type Injective f, try to prove it.
Returns whether it was successful.
theorem Mathlib.Tactic.ApplyFun.le_of_le E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : LE α] [inst_1 : LE β] (e : α ≃o β) {x y : α}, e x ≤ e y → x ≤ y
Alias of the forward direction of OrderIso.le_iff_le.
theorem Mathlib.Tactic.ApplyFun.lt_of_lt E1 #
∀ {α : Type u_2} {β : Type u_3} [inst : Preorder α] [inst_1 : Preorder β] (e : α ≃o β) {x y : α}, e x < e y → x < y
Alias of the forward direction of OrderIso.lt_iff_lt.
def Mathlib.Tactic.applyFunTarget E1 #
Lean.Term → Option Lean.Term → Lean.MVarId → Lean.Elab.Tactic.TacticM (List Lean.MVarId)
Apply a function to the main goal.
def Mathlib.Tactic.applyFun E1 #
Lean.ParserDescr
Apply a function to an equality or inequality in either a local hypothesis or the goal.
- If we have
h : a = b, thenapply_fun f at hwill replace this withh : f a = f b. - If we have
h : a ≤ b, thenapply_fun f at hwill replace this withh : f a ≤ f b, and create a subsidiary goalMonotone f.apply_funwill automatically attempt to discharge this subsidiary goal usingmono, or an explicit solution can be provided withapply_fun f at h using P, whereP : Monotone f. - If we have
h : a < b, thenapply_fun f at hwill replace this withh : f a < f b, and create a subsidiary goalStrictMono fand behaves as in the previous case. - If we have
h : a ≠ b, thenapply_fun f at hwill replace this withh : f a ≠ f b, and create a subsidiary goalInjective fand behaves as in the previous two cases. - If the goal is
a ≠ b,apply_fun fwill replace this withf a ≠ f b. - If the goal is
a = b,apply_fun fwill replace this withf a = f b, and create a subsidiary goalinjective f.apply_funwill automatically attempt to discharge this subsidiary goal using local hypotheses, or iffis actually anEquiv, or an explicit solution can be provided withapply_fun f using P, whereP : Injective f. - If the goal is
a ≤ b(or similarly fora < b), andfis actually anOrderIso,apply_fun fwill replace the goal withf a ≤ f b. Iffis anything else (e.g. just a function, or anEquiv),apply_funwill fail.
Typical usage is:
open Function
example (X Y Z : Type) (f : X → Y) (g : Y → Z) (H : Injective <| g ∘ f) :
Injective f := by
intro x x' h
apply_fun g at h
exact H h
The function f is handled similarly to how it would be handled by refine in that f can contain
placeholders. Named placeholders (like ?a or ?_) will produce new goals.