(* general functions that should be moved elsewhere *)
Definition ocons {A : Type} (o : option A) l :=
match o with Some a => a :: l | None => l end.
Fixpoint omapl {A B : Type} (f : A -> option B) (l : list A) : list B :=
match l with
| a :: l' => ocons (f a) (omapl f l')
| nil => nil
end.
Fixpoint merge {A: Type} (cmp : A -> A -> comparison) l1 l2 :=
let fix merge_aux l2 :=
match l1, l2 with
| [], _ => l2
| _, [] => l1
| a1::l1', a2::l2' =>
match cmp a1 a2 with
| Eq => a1 :: merge cmp l1' l2'
| Gt => a1 :: merge cmp l1' l2
| _ => a2 :: merge_aux l2' end
end
in merge_aux l2.
Notation sortu_atms := (rsort_uniq pure_atom_cmp).
Notation insu_atm := (insert_uniq pure_atom_cmp).
Notation sortu_clauses := (rsort_uniq compare_clause).

(* Specifications: *)
Lemma compare_clause_eq_equivalence:
RelationClasses.Equivalence (fun c1 c2 => Eq = compare_clause c1 c2).
Lemma pure_clause_ext:
forall gamma delta p Pp p' Pp',
PureClause gamma delta p Pp = PureClause gamma delta p' Pp'.
Lemma expr_eq_eq' : forall e1 e2, true = expr_eq e1 e2 -> e1=e2.
Lemma mem_spec': forall s x, M.mem x s = false <-> ~M.In x s.
Lemma is_empty_spec': forall s, M.is_empty s = false <-> ~M.Empty s.
Lemma empty_set_elems':
forall s, M.Empty s <-> M.elements s = nil.
Lemma Melements_spec1: forall (s: M.t) x, List.In x (M.elements s) <-> M.In x s.
Lemma Mcardinal_spec': forall s,   cardinal _ (Basics.flip M.In s) (M.cardinal s).
Lemma remove_decreases:
forall giv unselected,
M.In giv unselected ->
M.cardinal  (M.remove giv unselected)  < M.cardinal  unselected.