mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-10 05:03:59 -05:00
restrict what Msat core lib exposes, provide shortcuts
This commit is contained in:
parent
cbe3750b0d
commit
9bc85160b8
11 changed files with 53 additions and 14 deletions
|
|
@ -32,7 +32,7 @@ module type S = sig
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make(St : Solver_types.S)(Dummy: sig end) = struct
|
module Make(St : Solver_types_intf.S)(Dummy: sig end) = struct
|
||||||
|
|
||||||
(* Dimacs & iCNF export *)
|
(* Dimacs & iCNF export *)
|
||||||
let export_vec name fmt vec =
|
let export_vec name fmt vec =
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,6 @@ module type S = sig
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make(St: Solver_types.S)(Dummy: sig end) : S with type clause := St.clause
|
module Make(St: Solver_types_intf.S)(Dummy: sig end) : S with type clause := St.clause
|
||||||
(** Functor to create a module for exporting probems to the dimacs (& iCNF) formats. *)
|
(** Functor to create a module for exporting probems to the dimacs (& iCNF) formats. *)
|
||||||
|
|
||||||
|
|
|
||||||
39
src/core/Msat.ml
Normal file
39
src/core/Msat.ml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
(** Main API *)
|
||||||
|
|
||||||
|
module Formula_intf = Formula_intf
|
||||||
|
module Plugin_intf = Plugin_intf
|
||||||
|
module Theory_intf = Theory_intf
|
||||||
|
module Expr_intf = Expr_intf
|
||||||
|
module Solver_types_intf = Solver_types_intf
|
||||||
|
|
||||||
|
module Res = Res
|
||||||
|
|
||||||
|
module type S = Solver_intf.S
|
||||||
|
|
||||||
|
type ('term, 'form) sat_state = ('term, 'form) Solver_intf.sat_state = {
|
||||||
|
eval : 'form -> bool;
|
||||||
|
eval_level : 'form -> bool * int;
|
||||||
|
iter_trail : ('form -> unit) -> ('term -> unit) -> unit;
|
||||||
|
model : unit -> ('term * 'term) list;
|
||||||
|
}
|
||||||
|
|
||||||
|
type ('clause, 'proof) unsat_state = ('clause, 'proof) Solver_intf.unsat_state = {
|
||||||
|
unsat_conflict : unit -> 'clause;
|
||||||
|
get_proof : unit -> 'proof;
|
||||||
|
}
|
||||||
|
type 'clause export = 'clause Solver_intf.export = {
|
||||||
|
hyps : 'clause Vec.t;
|
||||||
|
history : 'clause Vec.t;
|
||||||
|
local : 'clause Vec.t;
|
||||||
|
}
|
||||||
|
|
||||||
|
module Make_smt_expr(E : Formula_intf.S) = Solver_types.SatMake(E)
|
||||||
|
module Make_mcsat_expr(E : Expr_intf.S) = Solver_types.McMake(E)
|
||||||
|
|
||||||
|
module Make = Solver.Make
|
||||||
|
|
||||||
|
(**/**)
|
||||||
|
module Vec = Vec
|
||||||
|
module Log = Log
|
||||||
|
(**/**)
|
||||||
|
|
@ -27,7 +27,7 @@ module type S = sig
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make
|
module Make
|
||||||
(S : External.S)
|
(S : Msat.S)
|
||||||
(T : Msat_solver.Type.S with type atom := S.atom)
|
(T : Msat_solver.Type.S with type atom := S.atom)
|
||||||
: sig
|
: sig
|
||||||
val do_task : Dolmen.Statement.t -> unit
|
val do_task : Dolmen.Statement.t -> unit
|
||||||
|
|
@ -42,7 +42,7 @@ module Make
|
||||||
let l = List.map (function a ->
|
let l = List.map (function a ->
|
||||||
Log.debugf 99
|
Log.debugf 99
|
||||||
(fun k -> k "Checking value of %a" S.St.pp_atom (S.St.add_atom a));
|
(fun k -> k "Checking value of %a" S.St.pp_atom (S.St.add_atom a));
|
||||||
state.Solver_intf.eval a) c in
|
state.Msat.eval a) c in
|
||||||
List.exists (fun x -> x) l
|
List.exists (fun x -> x) l
|
||||||
in
|
in
|
||||||
let l = List.map check_clause !hyps in
|
let l = List.map check_clause !hyps in
|
||||||
|
|
@ -60,7 +60,7 @@ module Make
|
||||||
Format.printf "Sat (%f/%f)@." t t'
|
Format.printf "Sat (%f/%f)@." t t'
|
||||||
| S.Unsat state ->
|
| S.Unsat state ->
|
||||||
if !p_check then begin
|
if !p_check then begin
|
||||||
let p = state.Solver_intf.get_proof () in
|
let p = state.Msat.get_proof () in
|
||||||
S.Proof.check p;
|
S.Proof.check p;
|
||||||
if !p_dot_proof <> "" then begin
|
if !p_dot_proof <> "" then begin
|
||||||
let fmt = Format.formatter_of_out_channel (open_out !p_dot_proof) in
|
let fmt = Format.formatter_of_out_channel (open_out !p_dot_proof) in
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ Copyright 2014 Guillaume Bury
|
||||||
Copyright 2014 Simon Cruanes
|
Copyright 2014 Simon Cruanes
|
||||||
*)
|
*)
|
||||||
|
|
||||||
module type S = Solver_intf.S
|
module type S = Msat.S
|
||||||
|
|
||||||
module Make (E : Expr_intf.S)
|
module Make (E : Expr_intf.S)
|
||||||
(Th : Plugin_intf.S with type term = E.Term.t
|
(Th : Plugin_intf.S with type term = E.Term.t
|
||||||
and type formula = E.Formula.t
|
and type formula = E.Formula.t
|
||||||
and type proof = E.proof)
|
and type proof = E.proof)
|
||||||
() =
|
() =
|
||||||
External.Make
|
Msat.Make
|
||||||
(Solver_types.McMake(E)(struct end))
|
(Make_mcsat_expr(E)())
|
||||||
(Th)
|
(Th)
|
||||||
()
|
()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Copyright 2014 Simon Cruanes
|
||||||
This module provides a functor to create an McSAt solver.
|
This module provides a functor to create an McSAt solver.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
module type S = Solver_intf.S
|
module type S = Msat.S
|
||||||
(** The interface exposed by the solver. *)
|
(** The interface exposed by the solver. *)
|
||||||
|
|
||||||
module Make (E : Expr_intf.S)
|
module Make (E : Expr_intf.S)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
module type S = Solver_intf.S
|
module type S = Msat.S
|
||||||
|
|
||||||
module DummyTheory(F : Formula_intf.S) = struct
|
module DummyTheory(F : Formula_intf.S) = struct
|
||||||
(* We don't have anything to do since the SAT Solver already
|
(* We don't have anything to do since the SAT Solver already
|
||||||
|
|
@ -77,8 +77,8 @@ end
|
||||||
module Make (E : Formula_intf.S)
|
module Make (E : Formula_intf.S)
|
||||||
(Th : Theory_intf.S with type formula = E.t and type proof = E.proof)
|
(Th : Theory_intf.S with type formula = E.t and type proof = E.proof)
|
||||||
() =
|
() =
|
||||||
External.Make
|
Msat.Make
|
||||||
(Solver_types.SatMake(E)(struct end))
|
(Make_smt_expr(E)(struct end))
|
||||||
(Plugin(E)(Th))
|
(Plugin(E)(Th))
|
||||||
()
|
()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ Copyright 2014 Simon Cruanes
|
||||||
functor in order to create a pure SAT solver.
|
functor in order to create a pure SAT solver.
|
||||||
*)
|
*)
|
||||||
|
|
||||||
module type S = Solver_intf.S
|
module type S = Msat.S
|
||||||
(** The interface of instantiated solvers. *)
|
(** The interface of instantiated solvers. *)
|
||||||
|
|
||||||
module DummyTheory(F : Formula_intf.S) :
|
module DummyTheory(F : Formula_intf.S) :
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ let mk_solver (): (module BASIC_SOLVER) =
|
||||||
| Sat _ ->
|
| Sat _ ->
|
||||||
R_sat
|
R_sat
|
||||||
| Unsat us ->
|
| Unsat us ->
|
||||||
let p = us.Solver_intf.get_proof () in
|
let p = us.Msat.get_proof () in
|
||||||
Proof.check p;
|
Proof.check p;
|
||||||
R_unsat
|
R_unsat
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue