(* File: niMinimal.v  (last edited on 27/10/2000) (c) Klaus Weich  *)
Require Export Forces_NGamma.
Require Export Derivable_Tools.
Definition nminimal (work : nf_list) (ds : disjs) (ni : nested_imps)
(ai : atomic_imps) (a : atoms) (context : flist) :=
forall (c : form) (k : kripke_tree),
Is_Monotone_kripke_tree k ->
forces_ngamma work ds ni ai a k -> In c context -> forces_t k c.
(*********************************************************************)
intros work ds ni ai a context k k_is_mon k_forces_ngamma mon c der_c.
elim der_c; clear der_c.
intros t der_t.
apply soundness_t with t context; try assumption.
intros c0 in_c0.
apply mon; assumption.
Qed.
(*********************************************************************)
intros work ds ni1 ni2 ai a context eq12 mon.
unfold nminimal in |- *.
intros c k k_is_mon k_forces in_a.
apply mon; try assumption.
apply forces_ngamma_eqv with ni2; assumption.
Qed.
(************************************************************************)
intros i j work ds ni ai a context mon.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_a.
apply mon; try assumption.
apply forces_ngamma_shift_ds_work; assumption.
Qed.
intros x work ds ni ai a context mon.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_a.
apply mon; try assumption.
apply forces_ngamma_shift_ni_work; assumption.
Qed.
intros i b work ds ni ai ai' a context lookup equiv_ins mon.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_a.
apply mon; try assumption.
apply forces_ngamma_shift_ai_work_new with ai'; assumption.
Qed.
intros i b work ds ni bs ai ai' a context notlookup equiv_ins mon.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_a.
apply mon; try assumption.
apply forces_ngamma_shift_ai_work_old with bs ai'; assumption.
Qed.
intros i work ds ni ai a a' context equiv_ins mon.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_a.
apply mon; try assumption.
apply forces_ngamma_shift_a_work with a'; assumption.
Qed.
intros x work ds ni1 ni2 ai a context min.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_c.
apply min; try assumption.
apply forces_ngamma_shift_ni_x_ni_work; assumption.
Qed.
intros x work ds ni1 ni2 ai a context min.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_c.
apply min; try assumption.
apply forces_ngamma_shift_work_ni_x_ni; assumption.
Qed.
(********************************************************************)
intros b c work ds ni ai a context forces_cb minimal.
unfold nminimal in |- *.
intros c0 k k_is_mon k_forces_ngamma in_c0.
apply minimal; try assumption.
apply forces_ngamma_cons_work_weak with c; try assumption.
intros forces_c.
apply forces_cb; assumption.
Qed.
intros b c work ds ni ai a context forces_cb minimal.
unfold nminimal in |- *.
intros c0 k k_is_mon k_forces_ngamma in_c0.
apply minimal; try assumption.
apply forces_ngamma_cons_work_weak with c; try assumption.
intros forces_c.
apply forces_cb; assumption.
Qed.
intros i bs work ds ni ai ai' a context lookup equiv_del min.
unfold nminimal in |- *.
intros c k k_is_mon k_forces_ngamma in_c.
apply min; try assumption.
apply forces_ngamma_del_ai_rev with i bs ai'; try assumption.
intros n b nth.
simpl in |- *; apply forces_b__forces_a_imp_b_t; try assumption.
apply k_forces_ngamma.
apply In_Work with n.
apply nth_app0; assumption.
apply forces_ngamma_app_work_tail with bs; assumption.
Qed.
intros work c i j ds ni ai a context forces_ij mon.
unfold nminimal in |- *.
intros c0 k k_is_mon k_forces_ngamma in_context.
inversion_clear in_context.
rewrite <- H; clear H c0.
apply k_forces_ngamma.
apply in_ngamma_cons_work_head.
apply mon; try assumption.
apply forces_ngamma_shift_work_ds.
apply forces_ngamma_cons_work_weak with c; try assumption.
intro forces_c.
apply forces_ij; assumption.
Qed.

Lemma nminimal_cons_work_cons_context :
forall (c : normal_form) (work : nf_list) (ds : disjs)
(ni : nested_imps) (ai : atomic_imps) (a : atoms)
(context : flist),
nminimal work ds ni ai a context ->
nminimal (c :: work) ds ni ai a (nf2form c :: context).