intros work ds x ni1 ni2 ai a c in_ngamma0.
elim in_ngamma0; clear in_ngamma0 c.
intros n c0 nth; left; apply In_Work with n; assumption.
intros n i j nth; left; apply In_Disjs with n; assumption.
intros n x0 nth.
elim
(inv_nth_app nimp n (nested_imps2nimps ni1) (nested_imps2nimps (x :: ni2))
x0).
intros n0; left; apply In_Nested_Imps with n.
rewrite (nested_imps2nimps_app ni1 ni2).
apply nth_app0; assumption.
intros n'; case n'; clear n'.
intros nth'; right; inversion_clear nth'; trivial.
intros n' nth'; left; apply In_Nested_Imps with (length ni1 + n').
rewrite (nested_imps2nimps_length ni1).
rewrite (nested_imps2nimps_app ni1 ni2).
apply nth_app1.
inversion_clear nth'; assumption.
rewrite <- (nested_imps2nimps_app ni1 (x :: ni2)); assumption.
intros i b n bs lookup nth; left; apply In_Atomic_Imps with n bs; assumption.
intros i lookup; left; apply In_Atoms; assumption.
Qed.

(* Specifications: *)
Lemma in_ngamma_ni_eq :
forall (work : nf_list) (ds : disjs) (ni ni' : nested_imps)
(ai : atomic_imps) (a : atoms) (c : normal_form),
nested_imps2nimps ni = nested_imps2nimps ni' ->
in_ngamma work ds ni ai a c -> in_ngamma work ds ni' ai a c.