mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-08 12:15:48 -05:00
feat: expose msat.sat as a proper library, with module Int_lit
This commit is contained in:
parent
1136416a7c
commit
aa47a44242
8 changed files with 11 additions and 9 deletions
|
|
@ -59,7 +59,7 @@ module Process = struct
|
||||||
Format.printf "Unsat (%f/%f)@." t t'
|
Format.printf "Unsat (%f/%f)@." t t'
|
||||||
end
|
end
|
||||||
|
|
||||||
let conv_c c = List.rev_map S.Expr.make c
|
let conv_c c = List.rev_map S.Int_lit.make c
|
||||||
|
|
||||||
let add_clauses cs =
|
let add_clauses cs =
|
||||||
S.assume st @@ CCList.map conv_c cs
|
S.assume st @@ CCList.map conv_c cs
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
(** The module defining formulas *)
|
(** {1 The module defining formulas} *)
|
||||||
|
|
||||||
(** SAT Formulas
|
(** SAT Formulas
|
||||||
|
|
||||||
|
|
@ -3,6 +3,6 @@ MSAT is free software, using the Apache license, see file LICENSE
|
||||||
Copyright 2016 Guillaume Bury
|
Copyright 2016 Guillaume Bury
|
||||||
*)
|
*)
|
||||||
|
|
||||||
module Expr = Expr_sat
|
module Int_lit = Int_lit
|
||||||
include Msat.Make_pure_sat(Expr)
|
include Msat.Make_pure_sat(Int_lit)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ Copyright 2016 Guillaume Bury
|
||||||
atomic propositions.
|
atomic propositions.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
module Expr = Expr_sat
|
module Int_lit = Int_lit
|
||||||
|
|
||||||
include Msat.S with type Formula.t = Expr.t and type theory = unit
|
include Msat.S with type Formula.t = Int_lit.t and type theory = unit
|
||||||
(** A functor that can generate as many solvers as needed. *)
|
(** A functor that can generate as many solvers as needed. *)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
(library
|
(library
|
||||||
(name msat_sat)
|
(name msat_sat)
|
||||||
; private
|
(public_name msat.sat)
|
||||||
|
(synopsis "purely boolean interface to Msat")
|
||||||
(libraries msat)
|
(libraries msat)
|
||||||
(flags :standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Msat)
|
(flags :standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Msat)
|
||||||
(ocamlopt_flags :standard -O3 -color always
|
(ocamlopt_flags :standard -O3 -color always
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ end = struct
|
||||||
end
|
end
|
||||||
|
|
||||||
module Solver = struct
|
module Solver = struct
|
||||||
module F = Msat_sat.Expr
|
module F = Msat_sat.Int_lit
|
||||||
module S = Msat_sat
|
module S = Msat_sat
|
||||||
type t = S.t
|
type t = S.t
|
||||||
|
|
||||||
|
|
@ -85,6 +85,7 @@ let solve_with_solver ~debug file : unit =
|
||||||
| Parse.Add_clause c ->
|
| Parse.Add_clause c ->
|
||||||
if debug then (
|
if debug then (
|
||||||
Printf.printf "add_clause %a\n%!" pp_arr c;
|
Printf.printf "add_clause %a\n%!" pp_arr c;
|
||||||
|
Msat.Log.set_debug 5;
|
||||||
);
|
);
|
||||||
let r = Solver.add_clause s c in
|
let r = Solver.add_clause s c in
|
||||||
if r then process_problem()
|
if r then process_problem()
|
||||||
|
|
@ -6,7 +6,7 @@ Copyright 2014 Simon Cruanes
|
||||||
|
|
||||||
(* Tests that require the API *)
|
(* Tests that require the API *)
|
||||||
|
|
||||||
module F = Msat_sat.Expr
|
module F = Msat_sat.Int_lit
|
||||||
module S = Msat_sat
|
module S = Msat_sat
|
||||||
|
|
||||||
let (|>) x f = f x
|
let (|>) x f = f x
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue