intros work ds ni i b ai ai' a c equiv_ins in_ngamma0.
elim in_ngamma0; clear in_ngamma0 c.
intros n c0; left; apply In_Work with n; assumption.
intros n i' j' nth; left; apply In_Disjs with n; assumption.
intros n x nth; left; apply In_Nested_Imps with n; assumption.
intros i0.
elim (equal_dec i0 i).
intro equal.
intros b0 n.
case n; clear n.
intros bs lookup nth.
right.
generalize equiv_ins lookup; clear equiv_ins lookup.
elim ai; clear ai; intros t avl_t.
elim ai'; clear ai'; intros t' avl_t'.
simpl in |- *.
intros equiv_ins lookup.
inversion_clear equiv_ins.
clear H1 H2.
elim (lookup_dec nf_list i0 t avl_t).
intros bs' lookup0.
generalize (H i0 bs' equal lookup0); clear H H0.
intros.
rewrite (lookup_avl_equal nf_list i0 i0 t' bs (b :: bs')) in nth;
try assumption.
inversion_clear nth.
rewrite (equal_eq i0 i).
trivial.
assumption.
apply equal_refl.
intros notlookup0.
generalize (H0 i0 equal notlookup0); clear H H0.
intros.
rewrite (lookup_avl_equal nf_list i0 i0 t' bs (b :: nf_nil)) in nth;
try assumption.
inversion_clear nth.
rewrite (equal_eq i0 i).
trivial.
assumption.
apply equal_refl.
intros n bs lookup nth.
left; apply In_Atomic_Imps with n (tail bs).
generalize equiv_ins lookup; clear equiv_ins lookup.
elim ai; clear ai; intros t avl_t.
elim ai'; clear ai'; intros t' avl_t'.
simpl in |- *.
intros equiv_ins lookup.
inversion_clear equiv_ins.
clear H1 H2.
elim (lookup_dec nf_list i0 t avl_t).
intros bs' lookup0.
generalize (H i0 bs' equal lookup0); clear H H0.
intros.
rewrite (lookup_avl_equal nf_list i0 i0 t' bs (b :: bs')); try assumption.
apply equal_refl.
intros notlookup0.
generalize (H0 i0 equal notlookup0); clear H H0.
intros.
rewrite (lookup_avl_equal nf_list i0 i0 t' bs (b :: nf_nil)) in nth;
try assumption.
inversion_clear nth.
inversion_clear H0.
apply equal_refl.
inversion_clear nth.
assumption.
intros notequal.
intros b0 n bs lookup nth.
left; apply In_Atomic_Imps with n bs.
generalize equiv_ins lookup; clear equiv_ins lookup.
elim ai; clear ai; intros t avl_t.
elim ai'; clear ai'; intros t' avl_t'.
simpl in |- *.
intros equiv_ins lookup.
inversion_clear equiv_ins.
clear H H0.
apply H2; assumption.
assumption.
intros i' lookup; left; apply In_Atoms; assumption.
Qed.

Lemma in_ngamma_del_ai_tail :
forall (work : nf_list) (ds : disjs) (ni : nested_imps)
(i : Int) (ai ai' : atomic_imps) (a : atoms) (c : normal_form),
EQUIV_DEL nf_list i ai' ai ->
in_ngamma work ds ni ai a c -> in_ngamma work ds ni ai' a c.