Documentation

Lean.Meta.Transform

def Lean.Core.transform {m : TypeType} [inst : Monad m] [inst : MonadLiftT Lean.CoreM m] [inst : MonadControlT Lean.CoreM m] (input : Lean.Expr) (pre : optParam (Lean.Exprm Lean.TransformStep) fun e => pure (Lean.TransformStep.visit e)) (post : optParam (Lean.Exprm Lean.TransformStep) fun e => pure (Lean.TransformStep.done e)) :

Tranform the expression input using pre and post.

  • pre s is invoked before visiting the children of subterm 's'. If the result is TransformStep.visit sNew, then sNew is traversed by transform. If the result is TransformStep.done sNew, then s is just replaced with sNew. In both cases, sNew must be definitionally equal to s
  • post s is invoked after visiting the children of subterm s.

The term s in both pre s and post s may contain loose bound variables. So, this method is not appropriate for if one needs to apply operations (e.g., whnf, inferType) that do not handle loose bound variables. Consider using Meta.transform to avoid loose bound variables.

This method is useful for applying transformations such as beta-reduction and delta-reduction.

Equations
def Lean.Meta.transform {m : TypeType} [inst : Monad m] [inst : MonadLiftT Lean.MetaM m] [inst : MonadControlT Lean.MetaM m] [inst : Lean.MonadTrace m] [inst : Lean.MonadRef m] [inst : Lean.MonadOptions m] [inst : Lean.AddMessageContext m] (input : Lean.Expr) (pre : optParam (Lean.Exprm Lean.TransformStep) fun e => pure (Lean.TransformStep.visit e)) (post : optParam (Lean.Exprm Lean.TransformStep) fun e => pure (Lean.TransformStep.done e)) (usedLetOnly : optParam Bool false) :

Similar to Core.transform, but terms provided to pre and post do not contain loose bound variables. So, it is safe to use any MetaM method at pre and post.

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

Unfold definitions and theorems in e that are not in the current environment, but are in biggerEnv.

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