(***************************************************************************)
(*  equiv                                                                  *)


Fixpoint lin_avl (t : avl_tree) : list (Int * B) :=
  match t with
  | Avl_Nil => nil (A:=Int * B)
  | Avl_Node k d l r _ => lin_avl l ++ (k, d) :: lin_avl r
  end.Inductive equiv : avl_tree -> avl_tree -> Prop :=
    equiv_intro :
      forall t0 t1 : avl_tree,
      (forall (key : Int) (data : B),
       lookup key t0 data -> lookup key t1 data) ->
      (forall (key : Int) (data : B),
       lookup key t1 data -> lookup key t0 data) -> 
      equiv t0 t1.Inductive equiv : avl_tree -> avl_tree -> Prop :=
    equiv_intro :
      forall t0 t1 : avl_tree,
      (forall (key : Int) (data : B),
       lookup key t0 data -> lookup key t1 data) ->
      (forall (key : Int) (data : B),
       lookup key t1 data -> lookup key t0 data) -> 
      equiv t0 t1.

Lemma equiv_refl : forall (k : Int) (d : B) (l r : avl_tree) (b b' : bal), equiv (Avl_Node k d l r b) (Avl_Node k d l r b').