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.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.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.

(* Specifications: *)
Lemma rule_shift_gamma_work : forall (goal : form) (l : list Int) (a : normal_form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal gamma (nvimp l a :: work) context j -> search_spec goal (vimp l (nf2form a) :: gamma) work context j.
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.
Lemma rule_vimp_a_gamma : forall (goal : form) (l : list Int) (a : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp (j :: nil) a :: gamma) (nvimp l (NAtom j) :: work) (vimp l (Atom j) :: Imp (Atom j) a :: context) j1 -> search_spec goal (vimp l a :: gamma) work context j.
Lemma rule_vimp_imp_gamma : forall (goal : form) (l : list Int) (a b : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp l (Imp a (Atom j)) :: vimp (j :: nil) b :: gamma) work (vimp l (Imp a (Atom j)) :: Imp (Atom j) b :: context) j1 -> search_spec goal (vimp l (Imp a b) :: gamma) work context j.
Lemma rule_gamma_falsum : forall (gamma : flist) (work : nf_list) (context : flist) (i j : Int), Less i j -> search_spec (Atom i) gamma work context j -> search_spec Falsum gamma work context i.
Lemma rule_gamma_a_imp_b : forall (a b : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec b (a :: gamma) work (a :: context) j -> search_spec (Imp a b) gamma work context j.
Lemma rule_gamma_a : forall (a : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec (Atom j) (Imp a (Atom j) :: gamma) work (Imp a (Atom j) :: context) j1 -> search_spec a gamma work context j.
Lemma rule_vimp_conj_gamma : forall (goal : form) (l : list Int) (b0 b1 : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal (vimp l b0 :: vimp l b1 :: gamma) work context j -> search_spec goal (vimp l (AndF b0 b1) :: gamma) work context j.
Lemma rule_vimp_conj_gamma_new : forall (goal : form) (l : list Int) (b0 b1 : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp (j :: nil) b0 :: vimp (j :: nil) b1 :: gamma) (nvimp l (NAtom j) :: work) (vimp l (Atom j) :: Imp (Atom j) (AndF b0 b1) :: context) j1 -> search_spec goal (vimp l (AndF b0 b1) :: gamma) work context j.
Lemma rule_vimp_falsum_or_a_gamma : forall (goal : form) (l : list Int) (a : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal (vimp l a :: gamma) work context j -> search_spec goal (vimp l (OrF Falsum a) :: gamma) work context j.
Lemma rule_vimp_a_or_falsum_gamma : forall (goal : form) (l : list Int) (a : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal (vimp l a :: gamma) work context j -> search_spec goal (vimp l (OrF a Falsum) :: gamma) work context j.
Lemma rule_vimp_atom_or_a_gamma : forall (goal : form) (l : list Int) (i : Int) (a : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (Imp (Atom j) a :: gamma) (nvimp l (NDisj i j) :: work) (vimp l (OrF (Atom i) (Atom j)) :: Imp (Atom j) a :: context) j1 -> search_spec goal (vimp l (OrF (Atom i) a) :: gamma) work context j.
Lemma rule_vimp_a_or_b_gamma : forall (goal : form) (l : list Int) (a b : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp l (OrF (Atom j) b) :: vimp (j :: nil) a :: gamma) work (vimp l (OrF (Atom j) b) :: Imp (Atom j) a :: context) j1 -> search_spec goal (vimp l (OrF a b) :: gamma) work context j.
Lemma rule_vimp_falsum_imp_b_gamma : forall (goal : form) (l : list Int) (b : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal gamma work context j -> search_spec goal (vimp l (Imp Falsum b) :: gamma) work context j.
Lemma rule_vimp_atom_imp_b_gamma : forall (goal : form) (l : list Int) (i : Int) (b : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal (vimp (i :: l) b :: gamma) work context j -> search_spec goal (vimp l (Imp (Atom i) b) :: gamma) work context j.
Lemma rule_vimp_and_imp_gamma : forall (goal : form) (l : list Int) (a0 a1 b : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal (vimp l (Imp a0 (Imp a1 b)) :: gamma) work context j -> search_spec goal (vimp l (Imp (AndF a0 a1) b) :: gamma) work context j.
Lemma rule_vimp_or_imp_gamma : forall (goal : form) (l : list Int) (a0 a1 b : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal (vimp l (Imp a0 b) :: vimp l (Imp a1 b) :: gamma) work context j -> search_spec goal (vimp l (Imp (OrF a0 a1) b) :: gamma) work context j.
Lemma rule_vimp_or_imp_gamma_new : forall (goal : form) (l : list Int) (a0 a1 b : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp l (Imp a0 (Atom j)) :: vimp l (Imp a1 (Atom j)) :: vimp (j :: nil) b :: gamma) work (vimp l (Imp (OrF a0 a1) (Atom j)) :: Imp (Atom j) b :: context) j1 -> search_spec goal (vimp l (Imp (OrF a0 a1) b) :: gamma) work context j.
Lemma rule_vimp_falsum_imp_imp_gamma : forall (goal : form) (l : list Int) (b c : form) (gamma : flist) (work : nf_list) (context : flist) (j : Int), search_spec goal (vimp l c :: gamma) work context j -> search_spec goal (vimp l (Imp (Imp Falsum b) c) :: gamma) work context j.
Lemma rule_vimp_imp_falsum_imp_gamma : forall (goal : form) (l : list Int) (a c : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp l (Imp (Imp a (Atom j)) c) :: gamma) work (vimp l (Imp (Imp a (Atom j)) c) :: context) j1 -> search_spec goal (vimp l (Imp (Imp a Falsum) c) :: gamma) work context j.
Lemma rule_atom_imp_atom_imp_c_gamma : forall (goal : form) (l : list Int) (a b : Int) (c : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (Imp (Atom j) c :: gamma) (nvimp l (NImp_NF (NImp a b (NAtom j))) :: work) (vimp l (Imp (Imp (Atom a) (Atom b)) (Atom j)) :: Imp (Atom j) c :: context) j1 -> search_spec goal (vimp l (Imp (Imp (Atom a) (Atom b)) c) :: gamma) work context j.
Lemma rule_atom_imp_b_imp_c_gamma : forall (goal : form) (l : list Int) (a : Int) (b c : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp l (Imp (Imp (Atom a) (Atom j)) c) :: vimp (a :: l) (Imp b (Atom j)) :: gamma) work (vimp l (Imp (Imp (Atom a) (Atom j)) c) :: vimp (a :: l) (Imp b (Atom j)) :: context) j1 -> search_spec goal (vimp l (Imp (Imp (Atom a) b) c) :: gamma) work context j.
Lemma rule_a_imp_b_imp_c_gamma : forall (goal : form) (l : list Int) (a b c : form) (gamma : flist) (work : nf_list) (context : flist) (j j1 : Int), Less j j1 -> search_spec goal (vimp l (Imp (Imp (Atom j) b) c) :: Imp (Atom j) a :: gamma) work (vimp l (Imp (Imp (Atom j) b) c) :: Imp (Atom j) a :: context) j1 -> search_spec goal (vimp l (Imp (Imp a b) c) :: gamma) work context j.