(*****************************************************************)

Inductive delete_max_spec (t0 : avl_tree) : Set :=
    Del_Max_Spec_Intro :
      forall (k : Int) (d : B) (t : avl_tree),
      lookup k t0 d ->
      is_avl t ->
      is_below_avl t k ->
      lin_avl t0 = lin_avl t ++ (k, d) :: nil ->
      equiv_del k t0 t ->
      {height_avl t0 = height_avl t} + {height_avl t0 = S (height_avl t)} ->
      delete_max_spec t0.(*****************************************************************)

Inductive delete_max_spec (t0 : avl_tree) : Set :=
    Del_Max_Spec_Intro :
      forall (k : Int) (d : B) (t : avl_tree),
      lookup k t0 d ->
      is_avl t ->
      is_below_avl t k ->
      lin_avl t0 = lin_avl t ++ (k, d) :: nil ->
      equiv_del k t0 t ->
      {height_avl t0 = height_avl t} + {height_avl t0 = S (height_avl t)} ->
      delete_max_spec t0.

Lemma delete_max : forall (k0 : Int) (d0 : B) (l0 r0 : avl_tree) (b0 : bal), is_avl (Avl_Node k0 d0 l0 r0 b0) -> delete_max_spec (Avl_Node k0 d0 l0 r0 b0).