feat(sat): check proofs if asked to

This commit is contained in:
Simon Cruanes 2021-08-02 23:13:18 -04:00
parent eb23644195
commit ed114f8abe
2 changed files with 10 additions and 3 deletions

View file

@ -152,8 +152,10 @@ let main_cnf () : _ result =
~on_new_atom:(fun _ -> incr n_atoms)
~size:`Big ()
in
Pure_sat_solver.Dimacs.parse_file solver !file >>= fun () ->
let r = Pure_sat_solver.solve solver in
let r = Pure_sat_solver.solve ~check:!check solver in
if !p_stat then (
Fmt.printf "; n-atoms: %d n-conflicts: %d n-decisions: %d@."
!n_atoms !n_confl !n_decision;

View file

@ -40,7 +40,7 @@ module Dimacs = struct
E.of_exn_trace e
end
let solve (solver:SAT.t) : (unit, string) result =
let solve ?(check=false) (solver:SAT.t) : (unit, string) result =
let res =
Profile.with_ "solve" (fun () -> SAT.solve solver)
in
@ -50,7 +50,12 @@ let solve (solver:SAT.t) : (unit, string) result =
| SAT.Sat _ ->
let t3 = Sys.time () -. t2 in
Format.printf "Sat (%.3f/%.3f)@." t2 t3;
| SAT.Unsat _ ->
| SAT.Unsat (module US) ->
if check then (
let pr = US.get_proof() in
SAT.Proof.check pr;
);
let t3 = Sys.time () -. t2 in
Format.printf "Unsat (%.3f/%.3f)@." t2 t3;