The areas / V01. The language of Mathlib
Mathlib.Lean.Meta.RefinedDiscrTree.Basic
94 declarations. Mathlib docs · Source
Basic Definitions for RefinedDiscrTree
We define
Key, the discrimination tree keyLazyEntry, the partial, lazy computation of a sequence ofKeysTrie, a node of the discrimination tree, which is indexed withKeys and stores an array of pendingLazyEntrysRefinedDiscrTree, the discrimination tree itself.
theorem Lean.Meta.RefinedDiscrTree.Trie.node.inj E1 #
∀ {α : Type} {values : Array α} {star : Option Lean.Meta.RefinedDiscrTree.TrieIndex}
{labelledStars : Std.HashMap ℕ Lean.Meta.RefinedDiscrTree.TrieIndex}
{children : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex}
{pending : Array (Lean.Meta.RefinedDiscrTree.LazyEntry × α)} {values_1 : Array α}
{star_1 : Option Lean.Meta.RefinedDiscrTree.TrieIndex}
{labelledStars_1 : Std.HashMap ℕ Lean.Meta.RefinedDiscrTree.TrieIndex}
{children_1 : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex}
{pending_1 : Array (Lean.Meta.RefinedDiscrTree.LazyEntry × α)},
{ values := values, star := star, labelledStars := labelledStars, children := children, pending := pending } =
{ values := values_1, star := star_1, labelledStars := labelledStars_1, children := children_1,
pending := pending_1 } →
values = values_1 ∧ star = star_1 ∧ labelledStars = labelledStars_1 ∧ children = children_1 ∧ pending = pending_1
def Lean.Meta.RefinedDiscrTree.ctorIdx E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree α → ℕ
def Lean.Meta.RefinedDiscrTree.instInhabitedLazyEntry.default E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry
theorem Lean.Meta.RefinedDiscrTree.Trie.node.injEq E0 #
∀ {α : Type} (values : Array α) (star : Option Lean.Meta.RefinedDiscrTree.TrieIndex)
(labelledStars : Std.HashMap ℕ Lean.Meta.RefinedDiscrTree.TrieIndex)
(children : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex)
(pending : Array (Lean.Meta.RefinedDiscrTree.LazyEntry × α)) (values_1 : Array α)
(star_1 : Option Lean.Meta.RefinedDiscrTree.TrieIndex)
(labelledStars_1 : Std.HashMap ℕ Lean.Meta.RefinedDiscrTree.TrieIndex)
(children_1 : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex)
(pending_1 : Array (Lean.Meta.RefinedDiscrTree.LazyEntry × α)),
({ values := values, star := star, labelledStars := labelledStars, children := children, pending := pending } =
{ values := values_1, star := star_1, labelledStars := labelledStars_1, children := children_1,
pending := pending_1 }) =
(values = values_1 ∧ star = star_1 ∧ labelledStars = labelledStars_1 ∧ children = children_1 ∧ pending = pending_1)
def Lean.Meta.RefinedDiscrTree.LazyEntry.ctorIdx E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry → ℕ
theorem Lean.Meta.RefinedDiscrTree.Key.lit.injEq E0 #
∀ (v v_1 : Lean.Literal), (Lean.Meta.RefinedDiscrTree.Key.lit v = Lean.Meta.RefinedDiscrTree.Key.lit v_1) = (v = v_1)
theorem Lean.Meta.RefinedDiscrTree.Key.bvar.injEq E0 #
∀ (deBruijnIndex nargs deBruijnIndex_1 nargs_1 : ℕ),
(Lean.Meta.RefinedDiscrTree.Key.bvar deBruijnIndex nargs =
Lean.Meta.RefinedDiscrTree.Key.bvar deBruijnIndex_1 nargs_1) =
(deBruijnIndex = deBruijnIndex_1 ∧ nargs = nargs_1)
abbrev Lean.Meta.RefinedDiscrTree.Key.ctorElimType E1 #
{motive : Lean.Meta.RefinedDiscrTree.Key → Sort u} → ℕ → Sort (max 1 u)
def Lean.Meta.instInhabitedRefinedDiscrTree.default E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree α
theorem Lean.Meta.RefinedDiscrTree.mk.injEq E0 #
∀ {α : Type} (root : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex)
(tries : Array (Lean.Meta.RefinedDiscrTree.Trie α))
(root_1 : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex)
(tries_1 : Array (Lean.Meta.RefinedDiscrTree.Trie α)),
({ root := root, tries := tries } = { root := root_1, tries := tries_1 }) = (root = root_1 ∧ tries = tries_1)
theorem Lean.Meta.RefinedDiscrTree.Key.lit.inj E1 #
∀ {v v_1 : Lean.Literal}, Lean.Meta.RefinedDiscrTree.Key.lit v = Lean.Meta.RefinedDiscrTree.Key.lit v_1 → v = v_1
def Lean.Meta.RefinedDiscrTree.ExprInfo.ctorIdx E1 #
Lean.Meta.RefinedDiscrTree.ExprInfo → ℕ
theorem Lean.Meta.RefinedDiscrTree.Key.bvar.inj E1 #
∀ {deBruijnIndex nargs deBruijnIndex_1 nargs_1 : ℕ},
Lean.Meta.RefinedDiscrTree.Key.bvar deBruijnIndex nargs =
Lean.Meta.RefinedDiscrTree.Key.bvar deBruijnIndex_1 nargs_1 →
deBruijnIndex = deBruijnIndex_1 ∧ nargs = nargs_1
theorem Lean.Meta.RefinedDiscrTree.Key.labelledStar.inj E1 #
∀ {id id_1 : ℕ},
Lean.Meta.RefinedDiscrTree.Key.labelledStar id = Lean.Meta.RefinedDiscrTree.Key.labelledStar id_1 → id = id_1
def Lean.Meta.RefinedDiscrTree.Trie.ctorIdx E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree.Trie α → ℕ
theorem Lean.Meta.RefinedDiscrTree.ExprInfo.mk.inj E1 #
∀ {expr : Lean.Expr} {bvars : List Lean.FVarId} {lctx : Lean.LocalContext} {localInsts : Lean.LocalInstances}
{cfg : Lean.Meta.Config} {expr_1 : Lean.Expr} {bvars_1 : List Lean.FVarId} {lctx_1 : Lean.LocalContext}
{localInsts_1 : Lean.LocalInstances} {cfg_1 : Lean.Meta.Config},
{ expr := expr, bvars := bvars, lctx := lctx, localInsts := localInsts, cfg := cfg } =
{ expr := expr_1, bvars := bvars_1, lctx := lctx_1, localInsts := localInsts_1, cfg := cfg_1 } →
expr = expr_1 ∧ bvars = bvars_1 ∧ lctx = lctx_1 ∧ localInsts = localInsts_1 ∧ cfg = cfg_1
theorem Lean.Meta.RefinedDiscrTree.Key.proj.inj E1 #
∀ {typeName : Lean.Name} {idx nargs : ℕ} {typeName_1 : Lean.Name} {idx_1 nargs_1 : ℕ},
Lean.Meta.RefinedDiscrTree.Key.proj typeName idx nargs =
Lean.Meta.RefinedDiscrTree.Key.proj typeName_1 idx_1 nargs_1 →
typeName = typeName_1 ∧ idx = idx_1 ∧ nargs = nargs_1
def Lean.Meta.RefinedDiscrTree.StackEntry.ctorIdx E1 #
Lean.Meta.RefinedDiscrTree.StackEntry → ℕ
theorem Lean.Meta.RefinedDiscrTree.Key.fvar.injEq E0 #
∀ (fvarId : Lean.FVarId) (nargs : ℕ) (fvarId_1 : Lean.FVarId) (nargs_1 : ℕ),
(Lean.Meta.RefinedDiscrTree.Key.fvar fvarId nargs = Lean.Meta.RefinedDiscrTree.Key.fvar fvarId_1 nargs_1) =
(fvarId = fvarId_1 ∧ nargs = nargs_1)
theorem Lean.Meta.RefinedDiscrTree.StackEntry.expr.inj E1 #
∀ {info info_1 : Lean.Meta.RefinedDiscrTree.ExprInfo},
Lean.Meta.RefinedDiscrTree.StackEntry.expr info = Lean.Meta.RefinedDiscrTree.StackEntry.expr info_1 → info = info_1
theorem Lean.Meta.RefinedDiscrTree.Key.labelledStar.injEq E0 #
∀ (id id_1 : ℕ),
(Lean.Meta.RefinedDiscrTree.Key.labelledStar id = Lean.Meta.RefinedDiscrTree.Key.labelledStar id_1) = (id = id_1)
theorem Lean.Meta.RefinedDiscrTree.Key.const.inj E1 #
∀ {declName : Lean.Name} {nargs : ℕ} {declName_1 : Lean.Name} {nargs_1 : ℕ},
Lean.Meta.RefinedDiscrTree.Key.const declName nargs = Lean.Meta.RefinedDiscrTree.Key.const declName_1 nargs_1 →
declName = declName_1 ∧ nargs = nargs_1
theorem Lean.Meta.RefinedDiscrTree.LazyEntry.mk.inj E1 #
∀ {previous : Option Lean.Meta.RefinedDiscrTree.ExprInfo} {stack : List Lean.Meta.RefinedDiscrTree.StackEntry}
{mctx : Lean.MetavarContext} {labelledStars? : Option (Array Lean.MVarId)}
{computedKeys : List Lean.Meta.RefinedDiscrTree.Key} {previous_1 : Option Lean.Meta.RefinedDiscrTree.ExprInfo}
{stack_1 : List Lean.Meta.RefinedDiscrTree.StackEntry} {mctx_1 : Lean.MetavarContext}
{labelledStars?_1 : Option (Array Lean.MVarId)} {computedKeys_1 : List Lean.Meta.RefinedDiscrTree.Key},
{ previous := previous, stack := stack, mctx := mctx, labelledStars? := labelledStars?,
computedKeys := computedKeys } =
{ previous := previous_1, stack := stack_1, mctx := mctx_1, labelledStars? := labelledStars?_1,
computedKeys := computedKeys_1 } →
previous = previous_1 ∧
stack = stack_1 ∧ mctx = mctx_1 ∧ labelledStars? = labelledStars?_1 ∧ computedKeys = computedKeys_1
theorem Lean.Meta.RefinedDiscrTree.Key.fvar.inj E1 #
∀ {fvarId : Lean.FVarId} {nargs : ℕ} {fvarId_1 : Lean.FVarId} {nargs_1 : ℕ},
Lean.Meta.RefinedDiscrTree.Key.fvar fvarId nargs = Lean.Meta.RefinedDiscrTree.Key.fvar fvarId_1 nargs_1 →
fvarId = fvarId_1 ∧ nargs = nargs_1
def Lean.Meta.RefinedDiscrTree.instInhabitedKey.default E1 #
Lean.Meta.RefinedDiscrTree.Key
abbrev Lean.Meta.RefinedDiscrTree.StackEntry.ctorElimType E1 #
{motive : Lean.Meta.RefinedDiscrTree.StackEntry → Sort u} → ℕ → Sort (max 1 u)
theorem Lean.Meta.RefinedDiscrTree.StackEntry.expr.injEq E0 #
∀ (info info_1 : Lean.Meta.RefinedDiscrTree.ExprInfo),
(Lean.Meta.RefinedDiscrTree.StackEntry.expr info = Lean.Meta.RefinedDiscrTree.StackEntry.expr info_1) =
(info = info_1)
theorem Lean.Meta.RefinedDiscrTree.LazyEntry.mk.injEq E0 #
∀ (previous : Option Lean.Meta.RefinedDiscrTree.ExprInfo) (stack : List Lean.Meta.RefinedDiscrTree.StackEntry)
(mctx : Lean.MetavarContext) (labelledStars? : Option (Array Lean.MVarId))
(computedKeys : List Lean.Meta.RefinedDiscrTree.Key) (previous_1 : Option Lean.Meta.RefinedDiscrTree.ExprInfo)
(stack_1 : List Lean.Meta.RefinedDiscrTree.StackEntry) (mctx_1 : Lean.MetavarContext)
(labelledStars?_1 : Option (Array Lean.MVarId)) (computedKeys_1 : List Lean.Meta.RefinedDiscrTree.Key),
({ previous := previous, stack := stack, mctx := mctx, labelledStars? := labelledStars?,
computedKeys := computedKeys } =
{ previous := previous_1, stack := stack_1, mctx := mctx_1, labelledStars? := labelledStars?_1,
computedKeys := computedKeys_1 }) =
(previous = previous_1 ∧
stack = stack_1 ∧ mctx = mctx_1 ∧ labelledStars? = labelledStars?_1 ∧ computedKeys = computedKeys_1)
def Lean.Meta.RefinedDiscrTree.Key.ctorIdx E1 #
Lean.Meta.RefinedDiscrTree.Key → ℕ
theorem Lean.Meta.RefinedDiscrTree.Key.proj.injEq E0 #
∀ (typeName : Lean.Name) (idx nargs : ℕ) (typeName_1 : Lean.Name) (idx_1 nargs_1 : ℕ),
(Lean.Meta.RefinedDiscrTree.Key.proj typeName idx nargs =
Lean.Meta.RefinedDiscrTree.Key.proj typeName_1 idx_1 nargs_1) =
(typeName = typeName_1 ∧ idx = idx_1 ∧ nargs = nargs_1)
theorem Lean.Meta.RefinedDiscrTree.Key.const.injEq E0 #
∀ (declName : Lean.Name) (nargs : ℕ) (declName_1 : Lean.Name) (nargs_1 : ℕ),
(Lean.Meta.RefinedDiscrTree.Key.const declName nargs = Lean.Meta.RefinedDiscrTree.Key.const declName_1 nargs_1) =
(declName = declName_1 ∧ nargs = nargs_1)
theorem Lean.Meta.RefinedDiscrTree.ExprInfo.mk.injEq E0 #
∀ (expr : Lean.Expr) (bvars : List Lean.FVarId) (lctx : Lean.LocalContext) (localInsts : Lean.LocalInstances)
(cfg : Lean.Meta.Config) (expr_1 : Lean.Expr) (bvars_1 : List Lean.FVarId) (lctx_1 : Lean.LocalContext)
(localInsts_1 : Lean.LocalInstances) (cfg_1 : Lean.Meta.Config),
({ expr := expr, bvars := bvars, lctx := lctx, localInsts := localInsts, cfg := cfg } =
{ expr := expr_1, bvars := bvars_1, lctx := lctx_1, localInsts := localInsts_1, cfg := cfg_1 }) =
(expr = expr_1 ∧ bvars = bvars_1 ∧ lctx = lctx_1 ∧ localInsts = localInsts_1 ∧ cfg = cfg_1)
theorem Lean.Meta.RefinedDiscrTree.mk.inj E1 #
∀ {α : Type} {root : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex}
{tries : Array (Lean.Meta.RefinedDiscrTree.Trie α)}
{root_1 : Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex}
{tries_1 : Array (Lean.Meta.RefinedDiscrTree.Trie α)},
{ root := root, tries := tries } = { root := root_1, tries := tries_1 } → root = root_1 ∧ tries = tries_1
inductive Lean.Meta.RefinedDiscrTree.Key E1 #
Type
Discrimination tree key.
ctor Lean.Meta.RefinedDiscrTree.Key.star E0 #
Lean.Meta.RefinedDiscrTree.Key
A metavariable. This key matches with anything.
ctor Lean.Meta.RefinedDiscrTree.Key.labelledStar E0 #
ℕ → Lean.Meta.RefinedDiscrTree.Key
A metavariable. This key matches with anything. It stores an identifier.
ctor Lean.Meta.RefinedDiscrTree.Key.opaque E0 #
Lean.Meta.RefinedDiscrTree.Key
An opaque variable. This key only matches with Key.star.
ctor Lean.Meta.RefinedDiscrTree.Key.const E0 #
Lean.Name → ℕ → Lean.Meta.RefinedDiscrTree.Key
A constant. It stores the name and the arity.
ctor Lean.Meta.RefinedDiscrTree.Key.fvar E0 #
Lean.FVarId → ℕ → Lean.Meta.RefinedDiscrTree.Key
A free variable. It stores the FVarId and the arity.
ctor Lean.Meta.RefinedDiscrTree.Key.bvar E0 #
ℕ → ℕ → Lean.Meta.RefinedDiscrTree.Key
A bound variable, from a lambda or forall binder. It stores the De Bruijn index and the arity.
ctor Lean.Meta.RefinedDiscrTree.Key.lit E0 #
Lean.Literal → Lean.Meta.RefinedDiscrTree.Key
A literal.
ctor Lean.Meta.RefinedDiscrTree.Key.sort E0 #
Lean.Meta.RefinedDiscrTree.Key
A sort. Universe levels are ignored.
ctor Lean.Meta.RefinedDiscrTree.Key.lam E0 #
Lean.Meta.RefinedDiscrTree.Key
A lambda function.
ctor Lean.Meta.RefinedDiscrTree.Key.forall E0 #
Lean.Meta.RefinedDiscrTree.Key
A dependent arrow.
ctor Lean.Meta.RefinedDiscrTree.Key.proj E0 #
Lean.Name → ℕ → ℕ → Lean.Meta.RefinedDiscrTree.Key
A projection. It stores the structure name, the projection index and the arity.
instance Lean.Meta.RefinedDiscrTree.instInhabitedKey E0 #
Inhabited Lean.Meta.RefinedDiscrTree.Key
instance Lean.Meta.RefinedDiscrTree.instBEqKey E0 #
BEq Lean.Meta.RefinedDiscrTree.Key
def Lean.Meta.RefinedDiscrTree.instBEqKey.beq E1 #
Lean.Meta.RefinedDiscrTree.Key → Lean.Meta.RefinedDiscrTree.Key → Bool
def Lean.Meta.RefinedDiscrTree.Key.hash E1 #
Lean.Meta.RefinedDiscrTree.Key → UInt64
Compute the hash of a RefinedDiscrTree.Key.
Note: at the root, .const is the most common key, and it is very uncommon
to get the same constant name with a different arity.
So for performance, we just use hash name to hash .const name _.
instance Lean.Meta.RefinedDiscrTree.instHashableKey E0 #
Hashable Lean.Meta.RefinedDiscrTree.Key
def Lean.Meta.RefinedDiscrTree.Key.format E1 #
Lean.Meta.RefinedDiscrTree.Key → Std.Format
Format a RefinedDiscrTree.Key.
instance Lean.Meta.RefinedDiscrTree.instToFormatKey E0 #
Std.ToFormat Lean.Meta.RefinedDiscrTree.Key
def Lean.Meta.RefinedDiscrTree.keysAsPattern E1 #
Array Lean.Meta.RefinedDiscrTree.Key → Lean.CoreM Lean.MessageData
Converts an entry (i.e., List Key) to the discrimination tree into
MessageData that is more user-friendly.
This is a copy of Lean.Meta.DiscrTree.keysAsPattern
def Lean.Meta.RefinedDiscrTree.Key.arity E1 #
Lean.Meta.RefinedDiscrTree.Key → ℕ
Return the number of arguments that the Key takes.
structure Lean.Meta.RefinedDiscrTree.ExprInfo E1 #
Type
The information for computing the keys of a subexpression.
ctor Lean.Meta.RefinedDiscrTree.ExprInfo.mk E0 #
Lean.Expr →
List Lean.FVarId → Lean.LocalContext → Lean.LocalInstances → Lean.Meta.Config → Lean.Meta.RefinedDiscrTree.ExprInfo
abbrev Lean.Meta.RefinedDiscrTree.ExprInfo.expr E1 #
Lean.Meta.RefinedDiscrTree.ExprInfo → Lean.Expr
The expression
abbrev Lean.Meta.RefinedDiscrTree.ExprInfo.bvars E1 #
Lean.Meta.RefinedDiscrTree.ExprInfo → List Lean.FVarId
Variables that come from a lambda or forall binder. The list index gives the De Bruijn index.
abbrev Lean.Meta.RefinedDiscrTree.ExprInfo.lctx E1 #
Lean.Meta.RefinedDiscrTree.ExprInfo → Lean.LocalContext
The local context, which contains the introduced bound variables.
abbrev Lean.Meta.RefinedDiscrTree.ExprInfo.localInsts E1 #
Lean.Meta.RefinedDiscrTree.ExprInfo → Lean.LocalInstances
The local instances, which may contain the introduced bound variables.
abbrev Lean.Meta.RefinedDiscrTree.ExprInfo.cfg E1 #
Lean.Meta.RefinedDiscrTree.ExprInfo → Lean.Meta.Config
The Meta.Config used by this entry.
def Lean.Meta.RefinedDiscrTree.mkExprInfo E1 #
Lean.Expr → List Lean.FVarId → Lean.MetaM Lean.Meta.RefinedDiscrTree.ExprInfo
Creates an ExprInfo using the current context.
inductive Lean.Meta.RefinedDiscrTree.StackEntry E1 #
Type
The possible values that can appear in the stack
ctor Lean.Meta.RefinedDiscrTree.StackEntry.star E0 #
Lean.Meta.RefinedDiscrTree.StackEntry
.star is an expression that will not be explicitly indexed.
ctor Lean.Meta.RefinedDiscrTree.StackEntry.expr E0 #
Lean.Meta.RefinedDiscrTree.ExprInfo → Lean.Meta.RefinedDiscrTree.StackEntry
.expr is an expression that will be indexed.
def Lean.Meta.RefinedDiscrTree.StackEntry.format E1 #
Lean.Meta.RefinedDiscrTree.StackEntry → Std.Format
Format a RefinedDiscrTree.StackEntry.
instance Lean.Meta.RefinedDiscrTree.instToFormatStackEntry E0 #
Std.ToFormat Lean.Meta.RefinedDiscrTree.StackEntry
structure Lean.Meta.RefinedDiscrTree.LazyEntry E1 #
Type
A LazyEntry represents a snapshot of the computation of encoding an Expr as Array Key.
This is used for computing the keys one by one.
ctor Lean.Meta.RefinedDiscrTree.LazyEntry.mk E0 #
Option Lean.Meta.RefinedDiscrTree.ExprInfo →
List Lean.Meta.RefinedDiscrTree.StackEntry →
Lean.MetavarContext →
Option (Array Lean.MVarId) → List Lean.Meta.RefinedDiscrTree.Key → Lean.Meta.RefinedDiscrTree.LazyEntry
abbrev Lean.Meta.RefinedDiscrTree.LazyEntry.previous E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry → Option Lean.Meta.RefinedDiscrTree.ExprInfo
If an expression creates more entries in the stack, for example because it is an application,
then instead of pushing to the stack greedily, we only extend the stack once we need to.
So, the field previous is used to extend the stack before looking in the stack.
For example in 10.add (20.add 30), after computing the key ⟨Nat.add, 2⟩, the stack is still
empty, and previous will be 10.add (20.add 30).
abbrev Lean.Meta.RefinedDiscrTree.LazyEntry.stack E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry → List Lean.Meta.RefinedDiscrTree.StackEntry
The stack, used to emulate recursion. It contains the list of all expressions for which the keys still need to be computed, in that order.
For example in 10.add (20.add 30), after computing the keys ⟨Nat.add, 2⟩ and 10, the stack
will be a list of length 1 containing the expression 20.add 30.
abbrev Lean.Meta.RefinedDiscrTree.LazyEntry.mctx E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry → Lean.MetavarContext
The metavariable context, which may contain variables appearing in this entry.
abbrev Lean.Meta.RefinedDiscrTree.LazyEntry.labelledStars? E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry → Option (Array Lean.MVarId)
MVarIds corresponding to the .labelledStar labels. The index in the array is the label.
It is none if we use .star instead of labelledStar,
for example when encoding the lookup expression.
abbrev Lean.Meta.RefinedDiscrTree.LazyEntry.computedKeys E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry → List Lean.Meta.RefinedDiscrTree.Key
The Keys that have already been computed.
Sometimes, more than one Key ends up being computed in one go. This happens when
there are lambda binders (because it depends on the body whether the lambda key
should be indexed or not). In that case the remaining Keys are stored in results.
instance Lean.Meta.RefinedDiscrTree.instInhabitedLazyEntry E0 #
Inhabited Lean.Meta.RefinedDiscrTree.LazyEntry
def Lean.Meta.RefinedDiscrTree.mkInitLazyEntry E1 #
Bool → Lean.MetaM Lean.Meta.RefinedDiscrTree.LazyEntry
Creates a LazyEntry using the current metavariable context.
def Lean.Meta.RefinedDiscrTree.LazyEntry.format E1 #
Lean.Meta.RefinedDiscrTree.LazyEntry → Std.Format
Format a RefinedDiscrTree.LazyEntry.
instance Lean.Meta.RefinedDiscrTree.instToFormatLazyEntry E0 #
Std.ToFormat Lean.Meta.RefinedDiscrTree.LazyEntry
abbrev Lean.Meta.RefinedDiscrTree.TrieIndex E1 #
Type
Array index of a Trie α in the tries of a RefinedDiscrTree.
structure Lean.Meta.RefinedDiscrTree.Trie E1 #
Type → Type
Discrimination tree trie. See RefinedDiscrTree.
A Trie will normally have exactly one of the following
- nonempty
values - nonempty
stars,labelledStarsand/orchildren - nonempty
pendingBut defining it as a structure that can have all at the same time turns out to be easier.
ctor Lean.Meta.RefinedDiscrTree.Trie.node E0 #
{α : Type} →
Array α →
Option Lean.Meta.RefinedDiscrTree.TrieIndex →
Std.HashMap ℕ Lean.Meta.RefinedDiscrTree.TrieIndex →
Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex →
Array (Lean.Meta.RefinedDiscrTree.LazyEntry × α) → Lean.Meta.RefinedDiscrTree.Trie α
abbrev Lean.Meta.RefinedDiscrTree.Trie.values E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree.Trie α → Array α
Return values, at a leaf
abbrev Lean.Meta.RefinedDiscrTree.Trie.star E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree.Trie α → Option Lean.Meta.RefinedDiscrTree.TrieIndex
Following Tries based on a Key.star.
abbrev Lean.Meta.RefinedDiscrTree.Trie.labelledStars E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree.Trie α → Std.HashMap ℕ Lean.Meta.RefinedDiscrTree.TrieIndex
Following Tries based on a Key.labelledStar.
abbrev Lean.Meta.RefinedDiscrTree.Trie.children E1 #
{α : Type} →
Lean.Meta.RefinedDiscrTree.Trie α → Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex
Following Tries based on the Key.
abbrev Lean.Meta.RefinedDiscrTree.Trie.pending E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree.Trie α → Array (Lean.Meta.RefinedDiscrTree.LazyEntry × α)
Lazy entries that still have to be evaluated.
instance Lean.Meta.RefinedDiscrTree.instInhabitedTrie E0 #
{α : Type} → Inhabited (Lean.Meta.RefinedDiscrTree.Trie α)
structure Lean.Meta.RefinedDiscrTree E1 #
Type → Type
Lazy refined discrimination tree. It is an index from expressions to values of type α.
We store all of the nodes in one Array, tries, instead of using a 'normal' inductive type.
This is so that we can modify the tree globally, which is very useful when evaluating lazy
entries and saving the result globally.
ctor Lean.Meta.RefinedDiscrTree.mk E0 #
{α : Type} →
Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex →
Array (Lean.Meta.RefinedDiscrTree.Trie α) → Lean.Meta.RefinedDiscrTree α
abbrev Lean.Meta.RefinedDiscrTree.root E1 #
{α : Type} →
Lean.Meta.RefinedDiscrTree α → Std.HashMap Lean.Meta.RefinedDiscrTree.Key Lean.Meta.RefinedDiscrTree.TrieIndex
Tries at the root based of the Key.
abbrev Lean.Meta.RefinedDiscrTree.tries E1 #
{α : Type} → Lean.Meta.RefinedDiscrTree α → Array (Lean.Meta.RefinedDiscrTree.Trie α)
Array of trie entries. Should be owned by this trie.
instance Lean.Meta.instInhabitedRefinedDiscrTree E0 #
{a : Type} → Inhabited (Lean.Meta.RefinedDiscrTree a)
def Lean.Meta.RefinedDiscrTree.format E1 #
{α : Type} → [Std.ToFormat α] → Lean.Meta.RefinedDiscrTree α → Std.Format
Format a RefinedDiscrTree as a flowchart.
- Non-terminal nodes are of the form
{key} =>, followed by all of the following nodes, indented with 2 more spaces. - Terminal nodes have either "entries", containing the return values, or "pending entries", for nodes that have not been evaluated/expanded.
For example:
Discrimination tree flowchart:
⟨HMul.hMul, 6⟩ =>
⟨Int, 0⟩ =>
⟨Int, 0⟩ =>
* =>
* =>
*0 =>
*0 =>
pending entries: #[mul_self]
*1 =>
entries: #[mul_comm]
⟨Neg.neg, 3⟩ =>
⟨Int, 0⟩ =>
* =>
*1 =>
entries: #[mul_neg]
1 =>
pending entries: #[mul_one]
⟨Neg.neg, 3⟩ =>
pending entries: #[neg_mul]
1 =>
*0 =>
entries: #[one_mul]
instance Lean.Meta.RefinedDiscrTree.instToFormat E0 #
{α : Type} → [Std.ToFormat α] → Std.ToFormat (Lean.Meta.RefinedDiscrTree α)