split some features into minismt lib

This commit is contained in:
Simon Cruanes 2017-12-28 19:43:54 +01:00 committed by Guillaume Bury
parent 9bc85160b8
commit eff8ed1c4f
18 changed files with 57 additions and 35 deletions

23
minismt.opam Normal file
View file

@ -0,0 +1,23 @@
opam-version: "1.2"
name: "minismt"
license: "Apache"
version: "dev"
author: ["Sylvain Conchon" "Alain Mebsout" "Stephane Lecuyer" "Simon Cruanes" "Guillaume Bury"]
maintainer: ["guillaume.bury@gmail.com" "simon.cruanes.2007@m4x.org"]
build: ["jbuilder" "build" "@install" "-p" name]
build-doc: ["jbuilder" "build" "@doc" "-p" name]
install: ["jbuilder" "install" name]
remove: ["jbuilder" "uninstall" name]
depends: [
"ocamlfind" {build}
"jbuilder" {build}
"dolmen"
]
available: [
ocaml-version >= "4.03.0"
]
tags: [ "sat" "smt" ]
homepage: "https://github.com/Gbury/mSAT"
dev-repo: "https://github.com/Gbury/mSAT.git"
bug-reports: "https://github.com/Gbury/mSAT/issues/"

View file

@ -6,7 +6,7 @@
((name main) ((name main)
(public_name msat_solver) (public_name msat_solver)
(package msat_solver) (package msat_solver)
(libraries (msat msat.backend msat.sat msat.smt msat.mcsat dolmen)) (libraries (msat msat.backend minismt.sat minismt.smt minismt.mcsat dolmen))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string)) (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string))
(ocamlopt_flags (:standard -O3 -color always (ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20)) -unbox-closures -unbox-closures-factor 20))

View file

@ -28,7 +28,7 @@ end
module Make module Make
(S : Msat.S) (S : Msat.S)
(T : Msat_solver.Type.S with type atom := S.atom) (T : Minismt.Type.S with type atom := S.atom)
: sig : sig
val do_task : Dolmen.Statement.t -> unit val do_task : Dolmen.Statement.t -> unit
end = struct end = struct
@ -106,9 +106,9 @@ module Make
Dolmen.Statement.print s Dolmen.Statement.print s
end end
module Sat = Make(Msat_sat.Make(struct end))(Msat_sat.Type) module Sat = Make(Minismt_sat.Make(struct end))(Minismt_sat.Type)
module Smt = Make(Msat_smt.Make(struct end))(Msat_smt.Type) module Smt = Make(Minismt_smt.Make(struct end))(Minismt_smt.Type)
module Mcsat = Make(Msat_mcsat.Make(struct end))(Msat_smt.Type) module Mcsat = Make(Minismt_mcsat.Make(struct end))(Minismt_smt.Type)
let solver = ref (module Sat : S) let solver = ref (module Sat : S)
let solver_list = [ let solver_list = [
@ -227,8 +227,8 @@ let () =
| Incorrect_model -> | Incorrect_model ->
Format.printf "Internal error : incorrect *sat* model@."; Format.printf "Internal error : incorrect *sat* model@.";
exit 4 exit 4
| Msat_sat.Type.Typing_error (msg, t) | Minismt_sat.Type.Typing_error (msg, t)
| Msat_smt.Type.Typing_error (msg, t) -> | Minismt_smt.Type.Typing_error (msg, t) ->
let b = Printexc.get_backtrace () in let b = Printexc.get_backtrace () in
let loc = match t.Dolmen.Term.loc with let loc = match t.Dolmen.Term.loc with
| Some l -> l | None -> Dolmen.ParseLocation.mk "<>" 0 0 0 0 | Some l -> l | None -> Dolmen.ParseLocation.mk "<>" 0 0 0 0

View file

@ -5,9 +5,9 @@ Copyright 2014 Simon Cruanes
*) *)
module Make() = module Make() =
Msat_solver.Mcsolver.Make(struct Minismt.Mcsolver.Make(struct
type proof = unit type proof = unit
module Term = Msat_smt.Expr.Term module Term = Minismt_smt.Expr.Term
module Formula = Msat_smt.Expr.Atom module Formula = Minismt_smt.Expr.Atom
end)(Plugin_mcsat)() end)(Plugin_mcsat)()

View file

@ -4,5 +4,5 @@ Copyright 2014 Guillaume Bury
Copyright 2014 Simon Cruanes Copyright 2014 Simon Cruanes
*) *)
module Make() : Msat_solver.Solver.S with type St.formula = Msat_smt.Expr.atom module Make() : Minismt.Solver.S with type St.formula = Minismt_smt.Expr.atom

View file

@ -1,9 +1,9 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name msat_mcsat) ((name minismt_mcsat)
(public_name msat.mcsat) (public_name minismt.mcsat)
(libraries (msat msat.solver msat.smt)) (libraries (msat minismt minismt.smt))
(synopsis "mcsat interface") (synopsis "mcsat interface")
(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 -bin-annot (ocamlopt_flags (:standard -O3 -bin-annot

View file

@ -1,7 +1,7 @@
(* Module initialization *) (* Module initialization *)
module Expr_smt = Msat_smt.Expr module Expr_smt = Minismt_smt.Expr
module E = Eclosure.Make(Expr_smt.Term) module E = Eclosure.Make(Expr_smt.Term)
module H = Backtrack.Hashtbl(Expr_smt.Term) module H = Backtrack.Hashtbl(Expr_smt.Term)

View file

@ -7,5 +7,5 @@ module Expr = Expr_sat
module Type = Type_sat module Type = Type_sat
module Make() = module Make() =
Msat_solver.Solver.Make(Expr)(Msat_solver.Solver.DummyTheory(Expr))() Minismt.Solver.Make(Expr)(Minismt.Solver.DummyTheory(Expr))()

View file

@ -12,6 +12,6 @@ Copyright 2016 Guillaume Bury
module Expr = Expr_sat module Expr = Expr_sat
module Type = Type_sat module Type = Type_sat
module Make() : Msat_solver.Solver.S with type St.formula = Expr.t module Make() : Minismt.Solver.S with type St.formula = Expr.t
(** A functor that can generate as many solvers as needed. *) (** A functor that can generate as many solvers as needed. *)

View file

@ -1,9 +1,9 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name msat_sat) ((name minismt_sat)
(public_name msat.sat) (public_name minismt.sat)
(libraries (msat msat.tseitin msat.solver)) (libraries (msat msat.tseitin minismt dolmen))
(synopsis "sat interface") (synopsis "sat interface")
(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 -bin-annot (ocamlopt_flags (:standard -O3 -bin-annot

View file

@ -8,5 +8,5 @@ Copyright 2014 Simon Cruanes
This module provides functions to parse terms from the untyped syntax tree This module provides functions to parse terms from the untyped syntax tree
defined in Dolmen, and generate formulas as defined in the Expr_sat module. *) defined in Dolmen, and generate formulas as defined in the Expr_sat module. *)
include Msat_solver.Type.S with type atom := Expr_sat.t include Minismt.Type.S with type atom := Expr_sat.t

View file

@ -7,8 +7,7 @@ Copyright 2014 Simon Cruanes
module Expr = Expr_smt module Expr = Expr_smt
module Type = Type_smt module Type = Type_smt
module Th = Msat_solver.Solver.DummyTheory(Expr_smt.Atom) module Th = Minismt.Solver.DummyTheory(Expr.Atom)
module Make() = module Make() = Minismt.Solver.Make(Expr.Atom)(Th)()
Msat_solver.Solver.Make(Expr_smt.Atom)(Th)()

View file

@ -7,5 +7,5 @@ Copyright 2014 Simon Cruanes
module Expr = Expr_smt module Expr = Expr_smt
module Type = Type_smt module Type = Type_smt
module Make() : Msat_solver.Solver.S with type St.formula = Expr_smt.atom module Make() : Minismt.Solver.S with type St.formula = Expr_smt.atom

View file

@ -1,9 +1,9 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name msat_smt) ((name minismt_smt)
(public_name msat.smt) (public_name minismt.smt)
(libraries (msat msat.solver msat.tseitin dolmen)) (libraries (msat minismt msat.tseitin dolmen))
(synopsis "smt interface") (synopsis "smt interface")
(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 -bin-annot (ocamlopt_flags (:standard -O3 -bin-annot

View file

@ -3,5 +3,5 @@
This module provides functions to parse terms from the untyped syntax tree This module provides functions to parse terms from the untyped syntax tree
defined in Dolmen, and generate formulas as defined in the Expr_smt module. *) defined in Dolmen, and generate formulas as defined in the Expr_smt module. *)
include Msat_solver.Type.S with type atom := Expr_smt.Atom.t include Minismt.Type.S with type atom := Expr_smt.Atom.t

View file

@ -1,10 +1,10 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name msat_solver) ((name minismt)
(public_name msat.solver) (public_name minismt)
(libraries (msat dolmen)) (libraries (msat dolmen))
(synopsis "mcsat solver util") (synopsis "minismt")
(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 -bin-annot (ocamlopt_flags (:standard -O3 -bin-annot
-unbox-closures -unbox-closures-factor 20)) -unbox-closures -unbox-closures-factor 20))

View file

@ -2,7 +2,7 @@
(executable (executable
((name test_api) ((name test_api)
(libraries (msat msat.backend msat.sat msat.smt msat.mcsat dolmen)) (libraries (msat msat.tseitin msat.backend minismt.sat minismt.smt minismt.mcsat dolmen))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string)) (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string))
(ocamlopt_flags (:standard -O3 -color always (ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20)) -unbox-closures -unbox-closures-factor 20))

View file

@ -8,7 +8,7 @@ Copyright 2014 Simon Cruanes
open Msat open Msat
module F = Msat_sat.Expr module F = Minismt_sat.Expr
module T = Msat_tseitin.Make(F) module T = Msat_tseitin.Make(F)
let (|>) x f = f x let (|>) x f = f x
@ -46,7 +46,7 @@ end
let mk_solver (): (module BASIC_SOLVER) = let mk_solver (): (module BASIC_SOLVER) =
let module S = struct let module S = struct
include Msat_sat.Make(struct end) include Minismt_sat.Make(struct end)
let solve ?assumptions ()= match solve ?assumptions() with let solve ?assumptions ()= match solve ?assumptions() with
| Sat _ -> | Sat _ ->
R_sat R_sat