Documentation

Mathlib.Tactic.ApplyFun

The apply_fun tactic. #

Apply a function to an equality or inequality in either a local hypothesis or the goal.

Future work #

Using the mono tactic, we can attempt to automatically discharge Monotone f goals.

def Mathlib.Tactic.applyFunHyp (f : Lean.Term) (using? : Option Lean.Term) (h : Lean.FVarId) (g : Lean.MVarId) :
Lean.Elab.Tactic.TacticM (List Lean.MVarId)

Apply a function to a hypothesis.

Instances For
    def Mathlib.Tactic.applyFunTargetFailure (f : Lean.Term) :
    Lean.MetaM (List Lean.MVarId)

    Failure message for applyFunTarget.

    Instances For
      def Mathlib.Tactic.maybeProveInjective (ginj : Lean.Expr) (using? : Option Lean.Expr) :
      Lean.MetaM Bool

      Given a metavariable ginj of type Injective f, try to prove it. Returns whether it was successful.

      Instances For
        theorem Mathlib.Tactic.ApplyFun.le_of_le {α : Type u_2} {β : Type u_3} [LE α] [LE β] (e : α ≃o β) {x y : α} :
        e x e yx y

        Alias of the forward direction of OrderIso.le_iff_le.

        theorem Mathlib.Tactic.ApplyFun.lt_of_lt {α : Type u_2} {β : Type u_3} [Preorder α] [Preorder β] (e : α ≃o β) {x y : α} :
        e x < e yx < y

        Alias of the forward direction of OrderIso.lt_iff_lt.

        def Mathlib.Tactic.applyFunTarget (f : Lean.Term) (using? : Option Lean.Term) (g : Lean.MVarId) :
        Lean.Elab.Tactic.TacticM (List Lean.MVarId)

        Apply a function to the main goal.

        Instances For
          def Mathlib.Tactic.applyFun :
          Lean.ParserDescr

          Apply a function to an equality or inequality in either a local hypothesis or the goal.

          • If we have h : a = b, then apply_fun f at h will replace this with h : f a = f b.
          • If we have h : a ≤ b, then apply_fun f at h will replace this with h : f a ≤ f b, and create a subsidiary goal Monotone f. apply_fun will automatically attempt to discharge this subsidiary goal using mono, or an explicit solution can be provided with apply_fun f at h using P, where P : Monotone f.
          • If we have h : a < b, then apply_fun f at h will replace this with h : f a < f b, and create a subsidiary goal StrictMono f and behaves as in the previous case.
          • If we have h : a ≠ b, then apply_fun f at h will replace this with h : f a ≠ f b, and create a subsidiary goal Injective f and behaves as in the previous two cases.
          • If the goal is a ≠ b, apply_fun f will replace this with f a ≠ f b.
          • If the goal is a = b, apply_fun f will replace this with f a = f b, and create a subsidiary goal injective f. apply_fun will automatically attempt to discharge this subsidiary goal using local hypotheses, or if f is actually an Equiv, or an explicit solution can be provided with apply_fun f using P, where P : Injective f.
          • If the goal is a ≤ b (or similarly for a < b), and f is actually an OrderIso, apply_fun f will replace the goal with f a ≤ f b. If f is anything else (e.g. just a function, or an Equiv), apply_fun will 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.

          Instances For