Module VSM := VSM.Local Notation "'inter'" := (@andp _).Definition positive_superposition (c d : clause) l0 : list clause :=
  match c , d with
  | PureClause nil (Eqv s t :: pos) _ _ ,
    PureClause nil (Eqv s' v :: pos') _ _ =>
    if expr_eq s s' && expr_lt t s && expr_lt v s' &&
       pure_atom_gt1 (Eqv s t) pos && pure_atom_gt1 (Eqv s' v) pos' &&
       pure_atom_gt (Eqv s' v) (Eqv s t)
    then mkPureClause nil (insert_uniq pure_atom_cmp (norm_pure_atom (Eqv t v))
                          (merge pure_atom_cmp pos pos')) :: l0
    else l0
  | _ , _ => l0
  end.Definition negative_superposition (c d : clause) l0 : list clause :=
  match c , d with
  | PureClause nil (Eqv s t :: pos) _ _,
    PureClause (Eqv s' v :: neg') pos' _ _ =>
    if expr_eq s s' && expr_lt t s && expr_lt v s'
    then mkPureClause (insert_uniq pure_atom_cmp (norm_pure_atom (Eqv t v)) neg')
                      (merge pure_atom_cmp pos pos') :: l0
    else l0
  | _ , _ => l0
  end.Definition reflexivity_resolution (d : clause) l0 : list clause :=
  match d with
  | PureClause (Eqv u v :: neg) pos _ _ =>
    if expr_eq u v then mkPureClause neg pos :: l0 else l0
  | _ => l0
  end.Definition ordered_factoring (c : clause) l0 : list clause :=
  match c with
  | PureClause nil (Eqv s t :: Eqv u v :: pos) _ _ =>
    if pure_atom_eq (Eqv s t) (Eqv u v)
    then mkPureClause nil
            (insert_uniq pure_atom_cmp (norm_pure_atom (Eqv s t)) pos)
                :: l0
    else l0
  | _ => l0
  end.

(* Specifications: *)
Lemma positive_superposition_sound c d l0 s : clause_denote c s -> clause_denote d s -> listd clause_denote inter TT l0 s -> listd clause_denote inter TT (positive_superposition c d l0) s.
Lemma negative_superposition_sound c d l0 s : clause_denote c s -> clause_denote d s -> listd clause_denote inter TT l0 s -> listd clause_denote inter TT (negative_superposition c d l0) s.
Lemma reflexivity_resolution_sound c l0 s : clause_denote c s -> listd clause_denote inter TT l0 s -> listd clause_denote inter TT (reflexivity_resolution c l0) s.
Lemma ordered_factoring_sound c l0 s : clause_denote c s -> listd clause_denote inter TT l0 s -> listd clause_denote inter TT (ordered_factoring c l0) s.
Lemma equality_factoring_sound c l0 s : clause_denote c s -> listd clause_denote inter TT l0 s -> listd clause_denote inter TT (equality_factoring c l0) s.
Lemma sp_sound c d l0 s : clause_denote c s -> clause_denote d s -> listd clause_denote inter TT l0 s -> listd clause_denote inter TT (sp c d l0) s.
Lemma superpose_sound c d l0 s : clause_denote c s -> clause_denote d s -> listd clause_denote inter TT l0 s -> listd clause_denote inter TT (superpose c d l0) s.
Lemma remove_trivial_atoms_sound b atms s : listd pure_atom_denote inter b atms s -> listd pure_atom_denote inter b (remove_trivial_atoms atms) s.
Lemma remove_trivial_atoms_equiv b atms s : listd pure_atom_denote inter b (remove_trivial_atoms atms) s <-> listd pure_atom_denote inter b atms s.
Lemma delete_resolved_sound c s : clause_denote c s -> clause_denote (delete_resolved c) s.
Lemma demodulate_sound c d s : clause_denote c s -> clause_denote d s -> clause_denote (demodulate c d) s.
Lemma clause_denote_foldl (f: clause -> clause -> clause) l c0 s : listd clause_denote inter TT l s -> clause_denote c0 s -> (forall c d, clause_denote c s -> clause_denote d s -> clause_denote (f c d) s) -> clause_denote (fold_left f l c0) s.
Lemma simplify_sound l c s : listd clause_denote inter TT l s -> clause_denote c s -> clause_denote (simplify l c) s.
Lemma infer_list_sound c l s : clause_denote c s -> listd clause_denote inter TT l s -> listd clause_denote inter TT (infer_list c l) s.
Lemma insert_uniq_In {A} cmp (l : list A) a a' : In a' (insert_uniq cmp a l) -> a = a' \/ In a' l.
Lemma rsort_uniq_In {A} cmp (l : list A) a : In a (rsort_uniq cmp l) -> In a l.
Lemma pick_In (cls : M.t) cl : M.min_elt cls = Some cl -> In cl (M.elements cls).
Lemma pick_sound (cls : M.t) c s : setd clause_denote inter TT cls s -> M.min_elt cls = Some c -> clause_denote c s.
Lemma setd_mem_add c cls cls' s : clause_denote c s -> setd clause_denote inter TT cls s -> mem_add c cls = Some cls' -> setd clause_denote inter TT cls' s.
Lemma one_inference_step_sound given unselected given' unselected' s : setd clause_denote inter TT given s -> setd clause_denote inter TT unselected s -> one_inference_step (given, unselected) = (given', unselected') -> setd clause_denote inter TT given' s /\ setd clause_denote inter TT unselected' s.
Lemma simple_loop_induction (P : M.t*M.t -> Prop) given unselected r given' unselected' : (forall g u g' u', P (g, u) -> one_inference_step (g, u) = (g', u') -> P (g', u')) -> P (given, unselected) -> loop (given, unselected) = (r, given', unselected') -> P (given', unselected').
Lemma loop_sound given unselected given' unselected' r s : setd clause_denote inter TT given s -> setd clause_denote inter TT unselected s -> loop (given, unselected) = (r, given', unselected') -> setd clause_denote inter TT given' s /\ setd clause_denote inter TT unselected' s.
Lemma loop_Valid_empty_clause g u g' u' : loop (g, u) = (Valid, g', u') -> M.In empty_clause g' \/ M.In empty_clause u'.
Lemma clauses_gen_sound1 R R' cs cs' s : listd clause_denote inter TT cs s -> clauses_generate R cs = (R', cs') -> setd clause_denote inter TT cs' s.
Lemma loop_Cexample_model given unselected given' unselected' R sel : loop (given, unselected) = (C_example R sel, given', unselected') -> (R, sel) = clauses_generate nil (rsort_uniq (rev_cmp compare_clause) (M.elements given')).
Lemma loop_Cexample_sel g u g' u' s R sel : setd clause_denote inter TT g s -> setd clause_denote inter TT u s -> loop (g, u) = (C_example R sel, g', u') -> setd clause_denote inter TT sel s.
Lemma loop_Valid_sound given unselected given' unselected' s : setd clause_denote inter TT given s -> setd clause_denote inter TT unselected s -> loop (given, unselected) = (Valid, given', unselected') -> clause_denote empty_clause s.
Lemma loop_Cexample_sound given unselected given' unselected' s R selected : setd clause_denote inter TT given s -> setd clause_denote inter TT unselected s -> loop (given, unselected) = (C_example R selected, given', unselected') -> setd clause_denote inter TT selected s /\ setd clause_denote inter TT given' s.
Lemma check_clauseset_Cexample_model init final empty R selected : check_clauseset init = (C_example R selected, final, empty) -> (R, selected) = clauses_generate nil (rsort_uniq (rev_cmp compare_clause) (M.elements final)).