Encoding an Expr
as a sequence of Key
s #
DTExpr
is a simplified form of Expr
.
It is the intermediate step for converting from Expr
to Array Key
.
- star : Option MVarId → DTExpr
A metavariable. It optionally stores an
MVarId
. - opaque : DTExpr
An opaque variable or a let-expression in the case
WhnfCoreConfig.zeta := false
. - const : Name → Array DTExpr → DTExpr
A constant. It stores the name and the arguments.
- fvar : FVarId → Array DTExpr → DTExpr
A free variable. It stores the
FVarId
and the arguments - bvar : ℕ → Array DTExpr → DTExpr
A bound variable. It stores the De Bruijn index and the arguments
- lit : Literal → DTExpr
A literal.
- sort : DTExpr
A sort.
- lam : DTExpr → DTExpr
A lambda function. It stores the body.
- forall : DTExpr → DTExpr → DTExpr
A dependent arrow. It stores the domain and body.
- proj : Name → ℕ → DTExpr → Array DTExpr → DTExpr
A projection. It stores the structure name, projection index, struct body and arguments.
Instances For
Return the size of the DTExpr
. This is used for calculating the matching score when two
expressions are equal.
The score is not incremented at a lambda, which is so that the expressions
∀ x, p[x]
and ∃ x, p[x]
get the same size.
Equations
Instances For
Encoding an Expr #
Reduction procedure for the RefinedDiscrTree
indexing.
Repeatedly apply reduce while stripping lambda binders and introducing their variables
Return true
if e
contains a loose bound variable.
Equations
Instances For
Return whether the argument should be ignored.
Equations
Instances For
Return the encoding of e
as a DTExpr
.
If root = false
, then e
is a strict sub expression of the original expression.
Return all pairs of body, bound variables that could possibly appear due to η-reduction
Equations
Instances For
run etaPossibilities
, and cache the result if there are multiple possibilities.
Equations
Instances For
Return all encodings of e
as a DTExpr
, taking possible η-reductions into account.
If root = false
, then e
is a strict sub expression of the original expression.
Return the encoding of e
as a DTExpr
.
Warning: to account for potential η-reductions of e
, use mkDTExprs
instead.
The argument fvarInContext
allows you to specify which free variables in e
will still be
in the context when the RefinedDiscrTree
is being used for lookup.
It should return true only if the RefinedDiscrTree
is built and used locally.