Inductive Indexed Binary Trees #
A Note about Process/API when working with this #
I am trying to follow a process of making simp theorems and procedures that decompose the trees as much as possible.
- Use casework to take a tree of a known structure and specify the parts of that structure
- Push maps or other functions on this down to the bottom of the (tree / syntax tree)
- I then have e.g.
FullData.internal value1 left1 right1 = FullData.internal value2 left2 right2 - and then I can congruence the values and subtrees
Notes & TODOs #
aesopextension for the above?Split off a
Defs.leanfileFunctions for navigating tree
- Go to parent if it exists
- Go to left child if it exists
- Go to right child if it exists
- Go to sibling if it exists
- Return pair of left and right children if they exist
Define a datatype for indices of trees agnostic of the skeleton,
- This type has an equivalence to lists of bools,
- and maps from the the other indexing types.
- get? functions
Type of indices of leaves of a skeleton
- ofLeaf : SkeletonLeafIndex Skeleton.leaf
- ofLeft {left right : Skeleton} (idxLeft : SkeletonLeafIndex left) : SkeletonLeafIndex (left.internal right)
- ofRight {left right : Skeleton} (idxRight : SkeletonLeafIndex right) : SkeletonLeafIndex (left.internal right)
Instances For
Type of indices of internal nodes of a skeleton
- ofInternal {left right : Skeleton} : SkeletonInternalIndex (left.internal right)
- ofLeft {left right : Skeleton} (idxLeft : SkeletonInternalIndex left) : SkeletonInternalIndex (left.internal right)
- ofRight {left right : Skeleton} (idxRight : SkeletonInternalIndex right) : SkeletonInternalIndex (left.internal right)
Instances For
Type of indices of any node of a skeleton
- ofLeaf : SkeletonNodeIndex Skeleton.leaf
- ofInternal {left right : Skeleton} : SkeletonNodeIndex (left.internal right)
- ofLeft {left right : Skeleton} (idxLeft : SkeletonNodeIndex left) : SkeletonNodeIndex (left.internal right)
- ofRight {left right : Skeleton} (idxRight : SkeletonNodeIndex right) : SkeletonNodeIndex (left.internal right)
Instances For
Construct a SkeletonNodeIndex from a SkeletonLeafIndex
Instances For
Construct a SkeletonNodeIndex from a SkeletonInternalIndex
Instances For
This section contains predicates about indices determined by their neighborhood in the tree.
Check whether a leaf index is the root of its tree.
Instances For
Check whether an internal-node index is the root of its tree.
Instances For
Check whether a node index is the root of its tree.
Instances For
Every SkeletonLeafIndex points to a leaf.
Instances For
No SkeletonInternalIndex points to a leaf.
Instances For
Check whether a node index points to a leaf of the tree.
Instances For
Instances For
A binary tree with values stored in internal nodes.
- leaf {α : Type u_1} : InternalData α Skeleton.leaf
- internal {α : Type u_1} {left right : Skeleton} (value : α) (leftData : InternalData α left) (rightData : InternalData α right) : InternalData α (left.internal right)
Instances For
Instances For
Instances For
Get the left subtree of a InternalData.
Instances For
Get the right subtree of a InternalData.
Instances For
Get a value of a LeafData at an index.
Instances For
Get a value of a InternalData at an index.
Instances For
Get a value of a FullData at an index.
Instances For
Convert a FullData to a InternalData by dropping the leaf node values.
Instances For
Get the root index of a skeleton.
Instances For
Get the root value of a FullData.
Instances For
Depth of a SkeletonLeafIndex
Instances For
Depth of a SkeletonInternalIndex
Instances For
Depth of a SkeletonNodeIndex
Instances For
Get the parent of a SkeletonNodeIndex, or none if the index is the root.
Instances For
Return the sibling node index of a given SkeletonNodeIndex. Or none if the node is the root.
Instances For
Return the left child of a SkeletonNodeIndex, or none if the index is a leaf.
Instances For
Return the right child of a SkeletonNodeIndex, or none if the index is a leaf.
Instances For
Given a Skeleton, and a node index of the skeleton,
return a list of node indices which are the ancestors of the node,
starting with the root node, and going down to but not including the node itself.
Instances For
Find the siblings of a node and its ancestors, starting with the child of the root
Instances For
Apply a function to every value stored in an InternalData.
Instances For
Build #
This section contains theorems about building full trees from leaf trees.