let rec remove_bad_candidates sys faulty candidates =
let trace = faulty.from in
let cand = Node.origin faulty in
let nc =
List.fold_left
(fun acc c' ->
if node_same cand c'
then
if List.exists (node_same c') sys.t_unsafe then
raise (Safety.Unsafe faulty)
else (register_bad sys c' trace; acc)
else
if Forward.spurious_due_to_cfm sys faulty then
begin
non_cfm_literals := SA.union (Node.litterals cand) !non_cfm_literals;
if not quiet && verbose > 0 then
eprintf "Non CFM literals = %a@." SAtom.print !non_cfm_literals;
remove_non_cfm_cand sys acc
end
else
if Forward.reachable_on_trace_from_init sys c' trace <>
Forward.Unreach
then
(register_bad sys c' []; acc)
else begin
c'.deleted <- false;
c'::acc
end
) [] candidates in
List.rev nc