(*****************************************************************)
(*           height_avl                                          *)

Fixpoint height_avl (t : avl_tree) : nat :=
  match t with
  | Avl_Nil => 0
  | Avl_Node _ _ l _ Left_Balanced => S (height_avl l)
  | Avl_Node _ _ l _ Balanced => S (height_avl l)
  | Avl_Node _ _ _ r Right_Balanced => S (height_avl r)
  end.

Lemma height_avl_O_nil : forall t : avl_tree, height_avl t = 0 -> t = Avl_Nil.