Binary tree #
Provides binary tree storage for values of any type, with O(lg n) retrieval.
See also Lean.Data.RBTree
for red-black trees - this version allows more operations
to be defined and is better suited for in-kernel computation.
We also specialize for Tree Unit
, which is a binary tree without any
additional data. We provide the notation a △ b
for making a Tree Unit
with children
a
and b
.
TODO #
Implement a Traversable
instance for Tree
.
References #
https://leanprover-community.github.io/archive/stream/113488-general/topic/tactic.20question.html
Equations
Equations
- instReprTree = { reprPrec := reprTree✝ }
Equations
- Tree.instInhabited = { default := Tree.nil }
A node with Unit
data
Equations
- Tree.«term_△_» = Lean.ParserDescr.trailingNode `Tree.«term_△_» 65 66 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " △ ") (Lean.ParserDescr.cat `term 65))