intros key k0 k l0 l r0 b0 d d0 equal_key equiv_del_l lookup_l below_l0
above_r0 avl_l0.
rewrite (equal_eq key k0 equal_key); clear equal_key key.
apply equiv_del_intro.
intros k1 equal_k1 d1 lookup_d1.
rewrite (equal_eq k1 k0 equal_k1) in lookup_d1; clear equal_k1 k1.
inversion lookup_d1.
apply lookup_below_false with k l0 d.
assumption.
rewrite <- H0.
assumption.
clear H0 H4 H3 H2 H1 H data b r l1 d2 k1 lookup_d1.
apply lookup_below_false with k0 l0 d1.
inversion_clear equiv_del_l.
apply H1.
unfold not in |- *; intro u0.
apply H with k0 d1; assumption.
assumption.
assumption.
clear H0 H4 H3 H2 H1 H data b r l1 d2 k1 lookup_d1.
apply lookup_above_false with k0 r0 d1.
assumption.
assumption.
intros k1 d1 notequal lookup_t0.
inversion lookup_t0; clear lookup_t0.
elimtype False.
apply notequal.
rewrite H0.
apply equal_refl.
clear H0 H4 H3 H2 H1 H data b r l1 d2 k2.
elim (equal_dec k1 k).
intro equal_k1.
rewrite (equal_eq k1 k equal_k1).
rewrite <- (lookup_avl_equal k1 k l0 d1 d); try assumption.
apply Lookup_Equal.
intros notequal0.
apply Lookup_Left.
inversion_clear equiv_del_l.
apply H0; assumption.
clear H0 H4 H3 H2 H1 H data b r l1 d2 k2.
apply Lookup_Right.
assumption.
intros k1 d1 notequal lookup_k1.
inversion lookup_k1.
rewrite <- H5.
apply Lookup_Left; assumption.
clear H0 H4 H3 H2 H1 H data b r l1 d2 k2.
apply Lookup_Left.
inversion_clear equiv_del_l.
elim (equal_dec k1 k).
intro equal_k1.
elimtype False.
apply H with k1 d1; assumption.
intro notequal_k1.
apply H1; assumption.
apply Lookup_Right; assumption.
Qed.

Lemma is_balanced_avl_is_balanced_avl_right_shift_left :
forall (l l0 r0 : avl_tree) (b0 : bal),
is_balanced_avl l0 r0 b0 ->
S (height_avl l) = height_avl l0 -> is_balanced_avl_right_shift l r0 b0.