intros goal work i j ds ni ai a context left_premiss right_premiss.
unfold nsearch_spec in |- *; intros complete sound mon.
elim (filter_deco i ni).
intros ni1 le1 forces_i.
elim (left_premiss ni1 le1); clear left_premiss.
clear forces_i.
intros ni2 le2 complete2 spec2.
elim (inf_deco ni ni2).
intros ni3 le30 le32 inf3.
elim spec2; clear spec2.
(* left_premiss yields a derivation *)
intros der2.
elim (filter_deco j ni3).
intros ni4 le4 forces_j.
elim (right_premiss ni4); clear right_premiss.
clear forces_j inf3.
intros ni5 le5 complete5 spec5.
elim (inf_deco ni ni5).
intros ni6 le60 le65 inf6.
apply NSearch_Res with ni6.
assumption.
apply deco_sound_inf with ni ni5; try assumption.
apply deco_sound_shift_work_ds.
apply deco_sound_cons_work_weak with (NAtom j); try assumption.
intros; right; assumption.
clear inf6.
elim spec5; clear spec5.
clear complete complete2 complete5 mon le65 le60 le5 le4 le30 le32 le2 le1.
intros der5.
apply NDerivable.
elim der2; clear der2; intros s der_s.
elim der5; clear der5; intros t der_t.
elim (sound (NDisj i j)); clear sound.
intros r der_r.
apply Derivable_Intro with (Cas (Atom i) (Atom j) r s t).
apply OrFElim; assumption.
apply In_Disjs with 0; apply My_NthO.
clear der2 mon sound.
intros k k_is_mon k_forces_ngamma k_notforces_goal.
apply NRefutable with k; try assumption.
apply forces_ngamma_eqv with ni5; try assumption.
apply forces_ngamma_shift_work_ds.
apply forces_ngamma_cons_work_weak with (NAtom j); try assumption.
intros; right; assumption.
apply eqv_ni_trans with ni4.
apply eqv_ni_trans with ni3.
apply ge_eqv; assumption.
apply le_eqv; assumption.
apply ge_eqv; assumption.
apply eqv_ni_trans with ni3.
apply ge_eqv; assumption.
apply le_eqv; assumption.
(* side premisses: Elim right_premiss.  *)
apply deco_sound_filter_deco; try assumption.
apply deco_sound_le with ni3; try assumption.
apply deco_sound_inf with ni ni2; try assumption.
apply deco_sound_cons_ds_tail with i j; assumption.
apply deco_sound_cons_work_tail with (NAtom i); assumption.
clear forces_j complete2 complete inf3 mon.
apply nsound_eqv with ni.
apply eqv_ni_trans with ni3.
apply ge_eqv; assumption.
apply le_eqv; assumption.
apply nsound_cons_work_cons_context with (c := NAtom j).
apply nsound_cons_ds_tail with i j; assumption.
clear forces_j complete2 complete inf3 sound.
apply nminimal_eqv with ni.
apply eqv_ni_trans with ni3.
apply ge_eqv; assumption.
apply le_eqv; assumption.
apply nminimal_shift_ds_work_context with (c := NAtom j) (i := i) (j := j);
try assumption.
intros; right; assumption.
(* left_premiss yields a counter--model *)
clear right_premiss.
intros k k_is_mon k_forces_ngamma k_notforces_goal.
apply NSearch_Res with ni3.
assumption.
clear sound mon.
apply deco_sound_inf with ni ni2; try assumption.
apply deco_sound_shift_work_ds.
apply deco_sound_cons_work_weak with (NAtom i); try assumption.
intros; left; assumption.
apply NRefutable with k.
assumption.
apply forces_ngamma_eqv with ni2; try assumption.
apply forces_ngamma_shift_work_ds.
apply forces_ngamma_cons_work_weak with (NAtom i); try assumption.
intros; left; assumption.
assumption.
(* side premiss: Elim inf???? *)
clear right_premiss.
apply eqv_ni_trans with ni1.
apply le_eqv; assumption.
apply ge_eqv; assumption.
(* side premisses: Elim left_premiss.  *)
apply deco_sound_filter_deco.
assumption.
apply deco_sound_le with ni.
assumption.
apply deco_sound_cons_ds_tail with i j; assumption.
apply nsound_le with ni.
assumption.
apply nsound_cons_work_cons_context with (c := NAtom i).
apply nsound_cons_ds_tail with i j; assumption.
apply nminimal_eqv with ni.
apply le_eqv; assumption.
apply nminimal_shift_ds_work_context with (c := NAtom i) (i := i) (j := j).
intros; left; assumption.
assumption.
Qed.
(**********************************************************************)

(* Specifications: *)
Lemma left_nimp :
forall (goal : Int) (work : nf_list) (ds : disjs)
(a0 a1 : Int) (b : normal_form) (ni : nested_imps)
(dni : decorated_nested_imps) (ai : atomic_imps)
(a : atoms) (context : flist),
(forall ni1 : nested_imps,
le_ni (rev_app dni ni) ni1 ->
nsearch_spec a1 (AImp a1 b :: NAtom a0 :: work) ds ni1 ai a
(Atom a0 :: context)) ->
(forall ni1 : nested_imps,
le_ni ni1 (rev_app dni ni) ->
nsearch_spec goal (b :: work) ds ni1 ai a context) ->
(forall (ni1 : nested_imps) (k : kripke_tree),
le_ni ni1 (rev_app ((NImp a0 a1 b, k) :: dni) ni) ->
nsearch_spec goal work ds ni1 ai a context) ->
nsearch_spec goal work ds (rev_app dni (Undecorated (NImp a0 a1 b) :: ni))
ai a context.