Section PARTIAL_TREES.
Variable V : Type.
Variable default: V.
Inductive partial_tree : Type :=
| H : partial_tree
| L : partial_tree -> key -> V -> tree V -> partial_tree
| R : tree V -> key -> V -> partial_tree -> partial_tree.
Fixpoint partial_tree_tree (pt: partial_tree): tree V -> tree V :=
match pt with
| H => fun t => t
| L ptl k v t2 => fun t => T (partial_tree_tree ptl t) k v t2
| R t1 k v pt2 => fun t => T t1 k v (partial_tree_tree pt2 t)
end.
Fixpoint partial_tree_partial_tree (pt: partial_tree): partial_tree -> partial_tree :=
match pt with
| H => fun pt0 => pt0
| L ptl k v t2 => fun pt0 => L (partial_tree_partial_tree ptl pt0) k v t2
| R t1 k v pt2 => fun pt0 => R t1 k v (partial_tree_partial_tree pt2 pt0)
end.

Lemma partial_tree_partial_tree_tree: forall pt1 pt2,
partial_tree_tree (partial_tree_partial_tree pt1 pt2) = Basics.compose (partial_tree_tree pt1) (partial_tree_tree pt2).