- done
(e : Lean.Expr)
: Lean.TransformStep
Return expression without visiting any subexpressions.
- visit
(e : Lean.Expr)
: Lean.TransformStep
Visit expression (which should be different from current expression) instead. The new expression
e
is passed topre
again. - continue
(e? : Option Lean.Expr := none)
: Lean.TransformStep
Continue transformation with the given expression (defaults to current expression). For
pre
, this means visiting the children of the expression. Forpost
, this is equivalent to returningdone
.
Instances For
Equations
- Lean.instInhabitedTransformStep = { default := Lean.TransformStep.done default }
Equations
- Lean.instReprTransformStep = { reprPrec := Lean.reprTransformStep✝ }
Transform the expression input
using pre
and post
.
- First
pre
is invoked with the current expression and recursion is continued according to theTransformStep
result. In all cases, the expression contained in the result, if any, must be definitionally equal to the current expression. - After recursion, if any,
post
is invoked on the resulting expression.
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
- Lean.Core.transform input pre post = (Lean.Core.transform.visit pre post { } { monadLift := fun {α : Type} (x : ST IO.RealWorld α) => liftM (liftM x) } input).run
Instances For
Equations
- Lean.Core.betaReduce e = Lean.Core.transform e fun (e : Lean.Expr) => pure (if e.isHeadBetaTarget = true then Lean.TransformStep.visit e.headBeta else Lean.TransformStep.continue)
Instances For
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
.
If skipConstInApp := true
, then for an expression mkAppN (.const f) args
, the subexpression
.const f
is not visited again. Put differently: every .const f
is visited once, with its
arguments if present, on its own otherwise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Zeta reduces only the provided fvars, beta reducing the substitutions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.