A position of a subexpression in an expression.
We use a simple encoding scheme for expression positions Pos
:
every Expr
constructor has at most 3 direct expression children. Considering an expression's type
to be one extra child as well, we can injectively map a path of childIdxs
to a natural number
by computing the value of the 4-ary representation 1 :: childIdxs
, since n-ary representations
without leading zeros are unique. Note that pos
is initialized to 1
(case childIdxs == []
).
See also SubExpr
.
Equations
Instances For
The coordinate 3 = maxChildren - 1
is
reserved to denote the type of the expression.
Equations
Instances For
The Pos representing the root subexpression.
Equations
Instances For
The coordinate deepest in the Pos.
Equations
Instances For
Fold over the position starting at the root and heading to the leaf
Fold over the position starting at the leaf and heading to the root
Creates a subexpression Pos
from an array of 'coordinates'.
Each coordinate is a number {0,1,2} expressing which child subexpression should be explored.
The first coordinate in the array corresponds to the root of the expression tree.
Equations
Instances For
Decodes a subexpression Pos
as a sequence of coordinates cs : Array Nat
. See Pos.ofArray
for details.
cs[0]
is the coordinate for the root expression.
Equations
Instances For
A subexpression of some root expression. Both its value and its position within the root are stored.
Instances For
Returns true if the selected subexpression is the topmost one.
Equations
Instances For
Map from subexpr positions to values.
Equations
Instances For
A location within a goal.
- hyp : FVarId → GoalLocation
One of the hypotheses.
- hypType : FVarId → Pos → GoalLocation
A subexpression of the type of one of the hypotheses.
- hypValue : FVarId → Pos → GoalLocation
A subexpression of the value of one of the let-bound hypotheses.
- target : Pos → GoalLocation
A subexpression of the goal type.
Instances For
A location within a goal state. It identifies a specific goal together with a GoalLocation
within it.
- mvarId : MVarId
Which goal the location is in.
- loc : GoalLocation
Instances For
Same as Expr.traverseApp
but also includes a
SubExpr.Pos
argument for tracking subexpression position.