Definition share_metric (n : nat) (s : canonTree) : nat :=
 match n with
 | 0 => 0
 | S n => match le_dec (height s) n with
          | left _ => countBLeafCT n s + 1
          | right _ => 0
         end
 end.

(* Specifications: *)
Lemma share_metric_nerr : forall s n, height s < n -> 0 < share_metric n s.
Lemma share_metric_err : forall s n, n <= height s -> share_metric n s = 0.
Lemma share_metric_height_monotonic : forall s n1 n2, n1<=n2 -> share_metric n1 s <= share_metric n2 s.
Lemma share_metric_lub : forall s s' n, ~(s'<=s)%ba-> 0 < share_metric n s -> 0 < share_metric n (lub s s') -> (share_metric n s<share_metric n (lub s s')).
Lemma share_metric_glb : forall s s' n, ~(s<=s')%ba-> 0 < share_metric n s -> 0 < share_metric n (glb s s') -> (share_metric n (glb s s') < share_metric n s)%nat.
Lemma share_metric_dif_monotonic: forall s1 s2 n n0, (s1<=s2)%ba -> n<=n0 -> height s1 < n -> height s2 < n -> (share_metric n s2 - share_metric n s1 <= share_metric n0 s2 - share_metric n0 s1).
Lemma shareTreeOrd_dec: forall t1 t2 : ShareTree, {shareTreeOrd t1 t2} + {~shareTreeOrd t1 t2}.
Lemma leq_dec : forall (x y : t), {(x <= y)%ba} + {~ (x <= y)%ba}.
Lemma height_top : height top = 0.
Lemma height_bot: height bot = 0.
Lemma height_zero_eq: forall t, height t = 0 -> {t = top} + {t = bot}.