File tree 1 file changed +19
-15
lines changed
1 file changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -603,6 +603,24 @@ module Make (User : USER) = struct
603
603
AddedClause clause
604
604
;;
605
605
606
+ let simplify lits =
607
+ let seen =
608
+ LitSet. clear () ;
609
+ LitSet. temp
610
+ in
611
+ let rec simplify unique = function
612
+ | [] -> Some unique
613
+ | x :: _ when LitSet. mem seen (neg x) -> None (* X or not(X) is always True *)
614
+ | x :: xs when LitSet. mem seen x -> simplify unique xs (* Skip duplicates *)
615
+ | x :: xs when lit_value x = False ->
616
+ simplify unique xs (* Skip values known to be False *)
617
+ | x :: xs ->
618
+ LitSet. add seen x;
619
+ simplify (x :: unique) xs
620
+ in
621
+ simplify [] lits
622
+ ;;
623
+
606
624
(* * Public interface. Only used before the solve starts. *)
607
625
let at_least_one problem ?(reason = " input fact" ) lits =
608
626
if List. is_empty lits
@@ -612,22 +630,8 @@ module Make (User : USER) = struct
612
630
then (* Trivially true already if any literal is True. *)
613
631
()
614
632
else (
615
- let seen =
616
- LitSet. clear () ;
617
- LitSet. temp
618
- in
619
- let rec simplify unique = function
620
- | [] -> Some unique
621
- | x :: _ when LitSet. mem seen (neg x) -> None (* X or not(X) is always True *)
622
- | x :: xs when LitSet. mem seen x -> simplify unique xs (* Skip duplicates *)
623
- | x :: xs when lit_value x = False ->
624
- simplify unique xs (* Skip values known to be False *)
625
- | x :: xs ->
626
- LitSet. add seen x;
627
- simplify (x :: unique) xs
628
- in
629
633
(* At this point, [unique] contains only [Undefined] literals. *)
630
- match simplify [] lits with
634
+ match simplify lits with
631
635
| None -> ()
632
636
| Some [] ->
633
637
problem.toplevel_conflict < - true (* Everything in the list was False *)
You can’t perform that action at this time.
0 commit comments