Documentation

Mathlib.Tactic.Basic

Basic tactics and utilities for tactic writing #

This file defines some basic utilities for tactic writing, and also

def Mathlib.Tactic.variables :
Lean.ParserDescr

Syntax for the variables command: this command is just a stub, and merely warns that it has been renamed to variable in Lean 4.

Instances For
    def Mathlib.Tactic.elabVariables :
    Lean.Elab.Command.CommandElab

    The variables command: this is just a stub, and merely warns that it has been renamed to variable in Lean 4.

    Instances For
      def Mathlib.Tactic.pushFVarAliasInfo {m : TypeType} [Monad m] [Lean.Elab.MonadInfoTree m] (oldFVars newFVars : Array Lean.FVarId) (newLCtx : Lean.LocalContext) :
      m Unit

      Given two arrays of FVarIds, one from an old local context and the other from a new local context, pushes FVarAliasInfos into the info tree for corresponding pairs of FVarIds. Recall that variables linked this way should be considered to be semantically identical.

      The effect of this is, for example, the unused variable linter will see that variables from the first array are used if corresponding variables in the second array are used.

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

        The tactic introv allows the user to automatically introduce the variables of a theorem and explicitly name the non-dependent hypotheses. Any dependent hypotheses are assigned their default names.

        Examples:

        example : ∀ a b : Nat, a = b → b = a := by
          introv h,
          exact h.symm
        

        The state after introv h is

        a b : ℕ,
        h : a = b
        ⊢ b = a
        
        example : ∀ a b : Nat, a = b → ∀ c, b = c → a = c := by
          introv h₁ h₂,
          exact h₁.trans h₂
        

        The state after introv h₁ h₂ is

        a b : ℕ,
        h₁ : a = b,
        c : ℕ,
        h₂ : b = c
        ⊢ a = c
        
        Instances For
          def Mathlib.Tactic.evalIntrov :
          Lean.Elab.Tactic.Tactic
          Instances For
            def Mathlib.Tactic.tacticAssumption' :
            Lean.ParserDescr

            Try calling assumption on all goals; succeeds if it closes at least one goal.

            Instances For
              @[deprecated "Use `guard_target =~` instead." (since := "2025-12-11")]

              Deprecated: use guard_target =~ t instead.

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

                This tactic clears all auxiliary declarations from the context.

                Instances For

                  Result of withResetServerInfo.

                  • result? : Option α

                    Return value of the executed tactic.

                  • msgs : Lean.MessageLog

                    Messages produced by the executed tactic.

                  • trees : Lean.PersistentArray Lean.Elab.InfoTree

                    Info trees produced by the executed tactic, wrapped in CommandContextInfo.save.

                  Instances For
                    def Mathlib.Tactic.withResetServerInfo {α : Type} (t : Lean.Elab.Tactic.TacticM α) :
                    Lean.Elab.Tactic.TacticM (withResetServerInfo.Result α)

                    Runs a tactic, returning any new messages and info trees rather than adding them to the state.

                    Instances For