Basic Definitions for RefinedDiscrTree
#
Definitions #
Discrimination tree key.
- star : Nat → Lean.Meta.RefinedDiscrTree.Key
A metavariable. This key matches with anything. It stores an index.
- opaque : Lean.Meta.RefinedDiscrTree.Key
An opaque variable. This key only matches with itself or
Key.star
. - const : Lean.Name → Nat → Lean.Meta.RefinedDiscrTree.Key
A constant. It stores the name and the arity.
- fvar : Lean.FVarId → Nat → Lean.Meta.RefinedDiscrTree.Key
A free variable. It stores the
FVarId
and the arity. - bvar : Nat → Nat → Lean.Meta.RefinedDiscrTree.Key
A bound variable, from a lambda or forall binder. It stores the De Bruijn index and the arity.
- lit : Lean.Literal → Lean.Meta.RefinedDiscrTree.Key
A literal.
- sort : Lean.Meta.RefinedDiscrTree.Key
A sort. Universe levels are ignored.
- lam : Lean.Meta.RefinedDiscrTree.Key
A lambda function.
- forall : Lean.Meta.RefinedDiscrTree.Key
A dependent arrow.
- proj : Lean.Name → Nat → Nat → Lean.Meta.RefinedDiscrTree.Key
A projection. It stores the structure name, the projection index and the arity.
Instances For
Equations
Constructor index used for ordering Key
.
Note that the index of the star pattern is 0, so that when looking up in a Trie
,
we can look at the start of the sorted array for all .star
patterns.
Equations
- (Lean.Meta.RefinedDiscrTree.Key.star a).ctorIdx = 0
- Lean.Meta.RefinedDiscrTree.Key.opaque.ctorIdx = 1
- (Lean.Meta.RefinedDiscrTree.Key.const a a_1).ctorIdx = 2
- (Lean.Meta.RefinedDiscrTree.Key.fvar a a_1).ctorIdx = 3
- (Lean.Meta.RefinedDiscrTree.Key.bvar a a_1).ctorIdx = 4
- (Lean.Meta.RefinedDiscrTree.Key.lit a).ctorIdx = 5
- Lean.Meta.RefinedDiscrTree.Key.sort.ctorIdx = 6
- Lean.Meta.RefinedDiscrTree.Key.lam.ctorIdx = 7
- Lean.Meta.RefinedDiscrTree.Key.forall.ctorIdx = 8
- (Lean.Meta.RefinedDiscrTree.Key.proj a a_1 a_2).ctorIdx = 9
Instances For
Equations
- Lean.Meta.RefinedDiscrTree.instLTKey = { lt := fun (a b : Lean.Meta.RefinedDiscrTree.Key) => Lean.Meta.RefinedDiscrTree.Key.lt✝ a b = true }
Return the number of arguments that the Key
takes.
Equations
- (Lean.Meta.RefinedDiscrTree.Key.const a a_1).arity = a_1
- (Lean.Meta.RefinedDiscrTree.Key.fvar a a_1).arity = a_1
- (Lean.Meta.RefinedDiscrTree.Key.bvar a a_1).arity = a_1
- Lean.Meta.RefinedDiscrTree.Key.lam.arity = 1
- Lean.Meta.RefinedDiscrTree.Key.forall.arity = 2
- (Lean.Meta.RefinedDiscrTree.Key.proj a a_1 a_2).arity = 1 + a_2
- x✝.arity = 0
Instances For
Discrimination tree trie. See RefinedDiscrTree
.
- node {α : Type} (children : Array (Lean.Meta.RefinedDiscrTree.Key × Lean.Meta.RefinedDiscrTree.Trie α)) : Lean.Meta.RefinedDiscrTree.Trie α
- path
{α : Type}
(keys : Array Lean.Meta.RefinedDiscrTree.Key)
(child : Lean.Meta.RefinedDiscrTree.Trie α)
: Lean.Meta.RefinedDiscrTree.Trie α
Sequence of nodes with only one child.
keys
is anArray
of size at least 1. - values {α : Type} (vs : Array α) : Lean.Meta.RefinedDiscrTree.Trie α
Instances For
Equations
- Lean.Meta.RefinedDiscrTree.instInhabitedTrie = { default := Lean.Meta.RefinedDiscrTree.Trie.node #[] }
Trie.path
constructor that only inserts the path if it is non-empty.
Equations
- Lean.Meta.RefinedDiscrTree.Trie.mkPath keys child = if keys.isEmpty = true then child else Lean.Meta.RefinedDiscrTree.Trie.path keys child
Instances For
Trie
constructor for a single value, taking the keys starting at index i
.
Equations
- Lean.Meta.RefinedDiscrTree.Trie.singleton keys value i = Lean.Meta.RefinedDiscrTree.Trie.mkPath (let a := keys; ↑(a.toSubarray i)) (Lean.Meta.RefinedDiscrTree.Trie.values #[value])
Instances For
Trie.node
constructor for combining two Key
, Trie α
pairs.
Equations
- Lean.Meta.RefinedDiscrTree.Trie.mkNode2 k1 t1 k2 t2 = if k1 < k2 then Lean.Meta.RefinedDiscrTree.Trie.node #[(k1, t1), (k2, t2)] else Lean.Meta.RefinedDiscrTree.Trie.node #[(k2, t2), (k1, t1)]
Instances For
Return the values from a Trie α
, assuming that it is a leaf
Equations
- (Lean.Meta.RefinedDiscrTree.Trie.values vs).values! = vs
- x✝.values! = panicWithPosWithDecl "Mathlib.Lean.Meta.RefinedDiscrTree.Basic" "Lean.Meta.RefinedDiscrTree.Trie.values!" 139 9 "expected .values constructor"
Instances For
Return the children of a Trie α
, assuming that it is not a leaf.
The result is sorted by the Key
's
Equations
- One or more equations did not get rendered due to their size.
- (Lean.Meta.RefinedDiscrTree.Trie.node cs).children! = cs
- (Lean.Meta.RefinedDiscrTree.Trie.path ks c).children! = #[(ks[0]!, Lean.Meta.RefinedDiscrTree.Trie.mkPath (let a := ks; ↑(a.toSubarray 1)) c)]
Instances For
Equations
Discrimination tree. It is an index from expressions to values of type α
.
The underlying
PersistentHashMap
of aRefinedDiscrTree
.
Instances For
Equations
- Lean.Meta.RefinedDiscrTree.instInhabited = { default := { root := { root := Lean.PersistentHashMap.Node.entries Lean.PersistentHashMap.mkEmptyEntriesArray } } }