The areas / V33. Data structures and computation
Mathlib.Data.Tree.Get
3 declarations and 3 deprecated aliases. Mathlib docs · Source
Binary tree get operation
In this file we define Tree.indexOf, Tree.get, and Tree.getOrElse.
These definitions were moved from the main file to avoid a dependency on Num.
References
def BinaryTree.indexOf E1 #
{α : Type u_1} → (lt : α → α → Prop) → [DecidableRel lt] → α → BinaryTree α → Option PosNum
Finds the index of an element in the tree assuming the tree has been constructed according to the provided decidable order on its elements. If it hasn't, the result will be incorrect. If it has, but the element is not in the tree, returns none.
def BinaryTree.get E1 #
{α : Type u_1} → PosNum → BinaryTree α → Option α
Retrieves an element uniquely determined by a PosNum from the tree,
taking the following path to get to the element:
bit0- go to left childbit1- go to right childPosNum.one- retrieve from here
def BinaryTree.getOrElse E1 #
{α : Type u_1} → PosNum → BinaryTree α → α → α
Retrieves an element from the tree, or the provided default value
if the index is invalid. See BinaryTree.get.
Deprecated aliases
| Name | New name | Since |
|---|---|---|
Tree.get | BinaryTree.get | 2026-06-07 |
Tree.getOrElse | BinaryTree.getOrElse | 2026-06-07 |
Tree.indexOf | BinaryTree.indexOf | 2026-06-07 |