let simplifyClauses clauses =
try
List.fold_left
(fun acc c ->
(* If 2 clauses are C and not C then their disjunction implies true *)
if List.exists (clausesAreEqual (negativeClause c)) acc then
raise Exit
(* If an observed clause c2 is included inside the current clause
then the current is not added *)
else if (List.exists (fun c2 -> clausesAreSubSetEq c2 c) acc) then
acc
(* If the current clause is included inside an observed clause
c2 then the current is add and c2 is removed *)
else if (List.exists (fun c2 -> clausesAreSubSetEq c c2) acc) then
c::(removeClause acc c)
(* If no simplification then c is add to the list *)
else c::acc
)
[] clauses
with Exit -> [[]]