Encoding an Expr as a sequence of Keys #
DTExpr is a simplified form of Expr.
It is the intermediate step for converting from Expr to Array Key.
- star : Option Lean.MVarId → Lean.Meta.RefinedDiscrTree.DTExprA metavariable. It optionally stores an MVarId.
- opaque : Lean.Meta.RefinedDiscrTree.DTExprAn opaque variable or a let-expression in the case WhnfCoreConfig.zeta := false.
- const : Lean.Name → Array Lean.Meta.RefinedDiscrTree.DTExpr → Lean.Meta.RefinedDiscrTree.DTExprA constant. It stores the name and the arguments. 
- fvar : Lean.FVarId → Array Lean.Meta.RefinedDiscrTree.DTExpr → Lean.Meta.RefinedDiscrTree.DTExprA free variable. It stores the FVarIdand the arguments
- bvar : ℕ → Array Lean.Meta.RefinedDiscrTree.DTExpr → Lean.Meta.RefinedDiscrTree.DTExprA bound variable. It stores the De Bruijn index and the arguments 
- lit : Lean.Literal → Lean.Meta.RefinedDiscrTree.DTExprA literal. 
- sort : Lean.Meta.RefinedDiscrTree.DTExprA sort. 
- lam : Lean.Meta.RefinedDiscrTree.DTExpr → Lean.Meta.RefinedDiscrTree.DTExprA lambda function. It stores the body. 
- forall : Lean.Meta.RefinedDiscrTree.DTExpr → Lean.Meta.RefinedDiscrTree.DTExpr → Lean.Meta.RefinedDiscrTree.DTExprA dependent arrow. It stores the domain and body. 
- proj : Lean.Name →
  ℕ → Lean.Meta.RefinedDiscrTree.DTExpr → Array Lean.Meta.RefinedDiscrTree.DTExpr → Lean.Meta.RefinedDiscrTree.DTExprA 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.
Determine if two DTExprs are equivalent.
Equations
- a.eqv b = StateT.run' (Lean.Meta.RefinedDiscrTree.DTExpr.eqv.go a b) ∅
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Encoding an Expr #
Given a DTExpr, return the linearized encoding in terms of Key,
which is used for RefinedDiscrTree indexing.
Equations
- e.flatten initCapacity = StateT.run' (Lean.Meta.RefinedDiscrTree.DTExpr.flattenAux✝ (Array.mkEmpty initCapacity) e) { stars := #[] }
Instances For
Reduction procedure for the RefinedDiscrTree indexing.
Repeatedly apply reduce while stripping lambda binders and introducing their variables
Check whether the expression is represented by Key.star and has arg as an argument.
Equations
- Lean.Meta.RefinedDiscrTree.isStarWithArg arg (f.app a) = if (a == arg) = true then Lean.Meta.RefinedDiscrTree.isStar f else Lean.Meta.RefinedDiscrTree.isStarWithArg arg f
- Lean.Meta.RefinedDiscrTree.isStarWithArg arg x✝ = false
Instances For
Return true if e contains a loose bound variable.
Equations
- e.hasLooseBVars = Lean.Meta.RefinedDiscrTree.DTExpr.hasLooseBVarsAux✝ 0 e
Instances For
Return for each argument whether it should be ignored.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return whether the argument should be ignored.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Return the encoding of e as a DTExpr.
If root = false, then e is a strict sub expression of the original expression.
Equations
- One or more equations did not get rendered due to their size.
Return all pairs of body, bound variables that could possibly appear due to η-reduction
Equations
- One or more equations did not get rendered due to their size.
- Lean.Meta.RefinedDiscrTree.MkDTExpr.etaPossibilities e lambdas k = (k e lambdas <|> failure)
Instances For
run etaPossibilities, and cache the result if there are multiple possibilities.
Equations
- One or more equations did not get rendered due to their size.
- Lean.Meta.RefinedDiscrTree.MkDTExpr.cacheEtaPossibilities e original lambdas k = k e lambdas
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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
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.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Similar to mkDTExpr.
Return all encodings of e as a DTExpr, taking potential further η-reductions into account.
Equations
- One or more equations did not get rendered due to their size.