Documentation

Mathlib.Lean.Meta.Basic

Additions to Lean.Meta.Basic #

Likely these already exist somewhere. Pointers welcome.

def Lean.Meta.preservingMCtx {α : Type} (x : MetaM α) :

Restore the metavariable context after execution.

Equations
Instances For

    This function is similar to forallMetaTelescopeReducing: Given e of the form forall ..xs, A, this combinator will create a new metavariable for each x in xs until it reaches an x whose type is defeq to t, and instantiate A with these, while also reducing A if needed. It uses forallMetaTelescopeReducing.

    This function returns a triple (mvs, bis, out) where

    • mvs is an array containing the new metavariables.
    • bis is an array containing the binder infos for the mvs.
    • out is e but instantiated with the mvs.
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[inline]

      pureIsDefEq e₁ e₂ is short for withNewMCtxDepth <| isDefEq e₁ e₂. Determines whether two expressions are definitionally equal to each other when metavariables are not assignable.

      Equations
      Instances For
        def Lean.Meta.mkRel (n : Name) (lhs rhs : Expr) :

        mkRel n lhs rhs is mkAppM n #[lhs, rhs], but with optimizations for Eq and Iff.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def Lean.Meta.withEnsuringLocalInstance {α : Type} (inst : MVarId) (k : MetaM (Expr × α)) :

          Given a metavariable inst whose type is a class, tries to synthesize the instance then runs k. If synthesis fails, then runs k with inst as a local instance and then substitutes inst into the resulting expression.

          Example: reassocExprHom operates by applying simp lemmas that assume a Category instance. The category might not yet be known, which can prevent simp lemmas from applying. We can add inst as a local instance to deal with this. However, if the instance is synthesizable, we prefer running k directly so that the local instance doesn't affect typeclass inference.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For