(***************************************************************************)
(*  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.

(* Specifications: *)
Lemma inv_equiv_t0_t1 : forall (t0 t1 : avl_tree) (key : Int) (data : B), equiv t0 t1 -> lookup key t0 data -> lookup key t1 data.
Lemma inv_equiv_t1_t0 : forall (t0 t1 : avl_tree) (key : Int) (data : B), equiv t0 t1 -> lookup key t1 data -> lookup key t0 data.
Lemma equiv_sym : forall t t0 : avl_tree, equiv t t0 -> equiv t0 t.
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').