(* File: Rules.v  (last edited on 27/10/2000) (c) Klaus Weich  *)
Require Export Minimal.
Require Export Sound.
Require Export NSearch.
Inductive search_spec_aux (goal : form) (gamma : flist)
(work : nf_list) (context : flist) : Set :=
| derivable :
Derivable context goal -> search_spec_aux goal gamma work context
| refutable :
forall k : kripke_tree,
Is_Monotone_kripke_tree k ->
forces_gamma gamma work k ->
(forces_t k goal -> False) -> search_spec_aux goal gamma work context.
Definition search_spec (goal : form) (gamma : flist)
(work : nf_list) (context : flist) (i : Int) :=
below_form goal i ->
below_list gamma i ->
below_list context i ->
sound gamma work context ->
minimal gamma work context -> search_spec_aux goal gamma work context.
(**********************************************************************)
intros goal l a gamma work context j spec0.
rewrite (vimp_eq_nvimp l a).
unfold search_spec in |- *.
intros below_goal below_gamma below_context sound0 minimal0.
elim spec0; clear spec0; try assumption.
intros der_goal; apply derivable; assumption.
intros k k_is_mon k_forces_gamma k_notforces_goal.
apply refutable with k; try assumption.
apply forces_gamma_shift_work_gamma; assumption.
apply below_cons_list_tail with (nf2form (nvimp l a)); assumption.
apply sound_shift_gamma_work; assumption.
apply minimal_shift_gamma_work; assumption.
Qed.
(*********************************************************************)

Lemma search_spec_subst_gamma_pos :
forall (goal : form) (gamma : flist) (work : nf_list)
(context : flist) (j j1 : Int) (a b c : form),
Less j j1 ->
(below_form c j -> below_form a j /\ below_form b j1 /\ subst_form j a b = c) ->
(forall k : kripke_tree,
Is_Monotone_kripke_tree k ->
forces_t k b -> forces_t k (Imp (Atom j) a) -> forces_t k c) ->
search_spec goal (b :: Imp (Atom j) a :: gamma) work
(b :: Imp (Atom j) a :: context) j1 ->
search_spec goal (c :: gamma) work context j.