Subexpr utilities for delaborator. #
This file defines utilities for MetaM
computations to traverse subexpressions of an expression
in sync with the Nat
"position" values that refer to them.
Equations
- optionsPerPos.insertAt pos name value = Lean.RBMap.insert optionsPerPos pos (Lean.KVMap.insert ((Lean.RBMap.find? optionsPerPos pos).getD { }) name value)
Merges two collections of options, where the second overrides the first.
Equations
- Lean.PrettyPrinter.Delaborator.OptionsPerPos.merge = Lean.RBMap.mergeBy fun (x : Lean.SubExpr.Pos) => Lean.KVMap.mergeBy fun (x : Lean.Name) (x dv : Lean.DataValue) => dv
Equations
- Lean.PrettyPrinter.Delaborator.SubExpr.getExpr = do let __do_lift ← readThe Lean.SubExpr pure __do_lift.expr
Equations
- Lean.PrettyPrinter.Delaborator.SubExpr.getPos = do let __do_lift ← readThe Lean.SubExpr pure __do_lift.pos
Equations
- Lean.PrettyPrinter.Delaborator.SubExpr.descend child childIdx x = withTheReader Lean.SubExpr (fun (cfg : Lean.SubExpr) => { expr := child, pos := cfg.pos.push childIdx }) x
Equations
- Lean.PrettyPrinter.Delaborator.SubExpr.withAppFn x = do let __do_lift ← Lean.PrettyPrinter.Delaborator.SubExpr.getExpr Lean.PrettyPrinter.Delaborator.SubExpr.descend __do_lift.appFn! 0 x
Equations
- Lean.PrettyPrinter.Delaborator.SubExpr.withAppArg x = do let __do_lift ← Lean.PrettyPrinter.Delaborator.SubExpr.getExpr Lean.PrettyPrinter.Delaborator.SubExpr.descend __do_lift.appArg! 1 x
Equations
- One or more equations did not get rendered due to their size.
Uses xa
to compute the fold across the arguments of an application,
where xf
provides the initial value and is evaluated in the context of the head of the application.
Uses xa
to compute the fold across up to maxArgs
outermost arguments of an application,
where xf
provides the initial value and is evaluated in the context of the application minus
the arguments being folded across.
Runs xf
in the context of Lean.Expr.getBoundedAppFn maxArgs
.
This is equivalent to withBoundedAppFnArgs maxArgs xf pure
.
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.
Assumes the SubExpr
is a lambda or forall.
- Creates a local declaration for this binder using the name
n
. - Evaluates
v
using the fvar for the local declaration. - Enters the binding body, and evaluates
x
using this result.
Equations
- One or more equations did not get rendered due to their size.
Assumes the SubExpr
is a lambda or forall.
Creates a local declaration for this binder using the name n
, enters the binding body, and evaluates x
.
Equations
- Lean.PrettyPrinter.Delaborator.SubExpr.withBindingBody n x = Lean.PrettyPrinter.Delaborator.SubExpr.withBindingBody' n (fun (x : Lean.Expr) => pure ()) fun (x_1 : Unit) => x
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.
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.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.PrettyPrinter.Delaborator.SubExpr.instInhabitedHoleIterator = { default := { curr := default, top := default } }
The positioning scheme guarantees that there will be an infinite number of extra positions
which are never used by Expr
s. The HoleIterator
always points at the next such "hole".
We use these to attach additional Elab.Info
.
Note: these positions are incompatible with Lean.SubExpr.Pos.push
since the iterator
will eventually yield every child of every returned position.
Equations
- One or more equations did not get rendered due to their size.