Fold the keys and values stored in a Trie.
Equations
- Lean.Meta.DiscrTree.Trie.fold initialKeys f init t = (Lean.Meta.DiscrTree.Trie.foldM initialKeys (fun (s : σ) (k : Array Lean.Meta.DiscrTree.Key) (a : α) => pure (f s k a)) init t).run
Instances For
Fold the values stored in a Trie.
Equations
- Lean.Meta.DiscrTree.Trie.foldValues f init t = (Lean.Meta.DiscrTree.Trie.foldValuesM (fun (x1 : σ) (x2 : α) => pure (f x1 x2)) init t).run
Instances For
The number of values stored in a Trie.
Generate a trie node from values and an array of children.
Equations
Instances For
Returns the values stored at the current trie node.
Equivalent to t.asNode.1.
Equations
- (Lean.Meta.DiscrTree.Trie.node vs children).nodeValues = vs
Instances For
Returns the child nodes of the current trie node.
Equivalent to t.asNode.2.
Equations
- (Lean.Meta.DiscrTree.Trie.node vs children).nodeChildren = children
Instances For
Checks whether a trie node is empty (no values and no children).
This is only a check for actual trie emptiness (t.size = 0) if all operations maintain the
invariant that no trie node has an empty child node.
Equations
- (Lean.Meta.DiscrTree.Trie.node vs children).isEmptyNode = (vs.isEmpty && children.isEmpty)
Instances For
Monadically fold over the keys and values stored in a DiscrTree.
Equations
- Lean.Meta.DiscrTree.foldM f init t = t.root.foldlM (fun (s : σ) (k : Lean.Meta.DiscrTree.Key) (t : Lean.Meta.DiscrTree.Trie α) => Lean.Meta.DiscrTree.Trie.foldM #[k] f s t) init
Instances For
Fold over the keys and values stored in a DiscrTree
Equations
- Lean.Meta.DiscrTree.fold f init t = (Lean.Meta.DiscrTree.foldM (fun (s : σ) (keys : Array Lean.Meta.DiscrTree.Key) (a : α) => pure (f s keys a)) init t).run
Instances For
Fold over the values stored in a DiscrTree.
Equations
- Lean.Meta.DiscrTree.foldValues f init t = (Lean.Meta.DiscrTree.foldValuesM (fun (x1 : σ) (x2 : α) => pure (f x1 x2)) init t).run
Instances For
Check for the presence of a value satisfying a predicate.
Equations
- t.containsValueP f = Lean.Meta.DiscrTree.foldValues (fun (r : Bool) (a : α) => r || f a) false t
Instances For
Extract the keys and values stored in a DiscrTree.
Equations
- t.toArray = Lean.Meta.DiscrTree.fold (fun (as : Array (Array Lean.Meta.DiscrTree.Key × α)) (keys : Array Lean.Meta.DiscrTree.Key) (a : α) => as.push (keys, a)) #[] t
Instances For
Get the number of values stored in a DiscrTree. O(n) in the size of the tree.
Equations
- t.size = t.root.foldl (fun (n : Nat) (x : Lean.Meta.DiscrTree.Key) (t : Lean.Meta.DiscrTree.Trie α) => n + t.size) 0
Instances For
Apply a monadic function to the array of values at each node in a DiscrTree.
Equations
- One or more equations did not get rendered due to their size.