rename to cdcl

This commit is contained in:
Simon Cruanes 2018-01-22 22:09:47 -06:00
parent 8c8209c08c
commit ac396e8cf5
30 changed files with 54 additions and 64 deletions

View file

@ -22,13 +22,14 @@ build-dev:
jbuilder build $(OPTS) @install --dev jbuilder build $(OPTS) @install --dev
build-test: build build-test: build
jbuilder build $(OPTS) src/main_test/msat_test.exe jbuilder build $(OPTS) src/main_test/main_test.exe
test: build-test test: build-test
@echo "run API tests…" @echo "run API tests…"
jbuilder runtest jbuilder runtest
@echo "run benchmarks…" @echo "run benchmarks…"
@/usr/bin/time -f "%e" ./tests/run smt @/usr/bin/time -f "%e" ./tests/run sat
#@/usr/bin/time -f "%e" ./tests/run smt
# @/usr/bin/time -f "%e" ./tests/run mcsat # @/usr/bin/time -f "%e" ./tests/run mcsat
enable_log: enable_log:

View file

@ -1,5 +1,5 @@
opam-version: "1.2" opam-version: "1.2"
name: "msat" name: "cdcl"
license: "Apache" license: "Apache"
version: "dev" version: "dev"
author: ["Sylvain Conchon" "Alain Mebsout" "Stephane Lecuyer" "Simon Cruanes" "Guillaume Bury"] author: ["Sylvain Conchon" "Alain Mebsout" "Stephane Lecuyer" "Simon Cruanes" "Guillaume Bury"]
@ -19,7 +19,7 @@ available: [
ocaml-version >= "4.03.0" ocaml-version >= "4.03.0"
] ]
tags: [ "sat" "smt" ] tags: [ "sat" "smt" ]
homepage: "https://github.com/Gbury/mSAT" homepage: "https://github.com/c-cube/cdcl"
dev-repo: "https://github.com/Gbury/mSAT.git" dev-repo: "https://github.com/c-cube/cdcl.git"
bug-reports: "https://github.com/Gbury/mSAT/issues/" bug-reports: "https://github.com/c-cube/cdcl/issues/"

1
main.exe Symbolic link
View file

@ -0,0 +1 @@
_build/default/src/main_test/main_test.exe

View file

@ -1 +0,0 @@
_build/default/src/main_test/msat_test.exe

View file

@ -2,7 +2,6 @@
MSAT is free software, using the Apache license, see file LICENSE MSAT is free software, using the Apache license, see file LICENSE
Copyright 2015 Guillaume Bury Copyright 2015 Guillaume Bury
*) *)
open Msat
module type S = Backend_intf.S module type S = Backend_intf.S

View file

@ -8,7 +8,6 @@ Copyright 2015 Guillaume Bury
This module provides an easy way to produce coq scripts This module provides an easy way to produce coq scripts
corresponding to the resolution proofs output by the corresponding to the resolution proofs output by the
sat solver. *) sat solver. *)
open Msat
module type S = Backend_intf.S module type S = Backend_intf.S
(** Interface for exporting proofs. *) (** Interface for exporting proofs. *)

View file

@ -3,8 +3,6 @@ MSAT is free software, using the Apache license, see file LICENSE
Copyright 2015 Guillaume Bury Copyright 2015 Guillaume Bury
*) *)
open Msat
module type S = Backend_intf.S module type S = Backend_intf.S
module type Arg = sig module type Arg = sig

View file

@ -9,8 +9,6 @@ Copyright 2014 Simon Cruanes
Work in progress... Work in progress...
*) *)
open Msat
module type S = Backend_intf.S module type S = Backend_intf.S
module type Arg = sig module type Arg = sig

View file

@ -4,8 +4,6 @@ Copyright 2014 Guillaume Bury
Copyright 2014 Simon Cruanes Copyright 2014 Simon Cruanes
*) *)
open Msat
module type S = sig module type S = sig
type st type st

View file

@ -10,8 +10,6 @@ Copyright 2014 Simon Cruanes
iCNF formats. iCNF formats.
*) *)
open Msat
module type S = sig module type S = sig
type st type st

View file

@ -4,8 +4,6 @@ Copyright 2014 Guillaume Bury
Copyright 2014 Simon Cruanes Copyright 2014 Simon Cruanes
*) *)
open Msat
(** Output interface for the backend *) (** Output interface for the backend *)
module type S = Backend_intf.S module type S = Backend_intf.S

View file

@ -9,7 +9,6 @@ Copyright 2014 Simon Cruanes
This module provides functions to export proofs into the dot graph format. This module provides functions to export proofs into the dot graph format.
Graphs in dot format can be used to generates images using the graphviz tool. Graphs in dot format can be used to generates images using the graphviz tool.
*) *)
open Msat
module type S = Backend_intf.S module type S = Backend_intf.S
(** Interface for exporting proofs. *) (** Interface for exporting proofs. *)

View file

@ -2,11 +2,11 @@
; main binary ; main binary
(library (library
((name msat_backend) ((name CDCL_backend)
(public_name msat.backend) (public_name cdcl.backend)
(synopsis "proof backends for msat") (synopsis "proof backends for cdcl")
(libraries (msat)) (libraries (cdcl))
(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 -open CDCL))
(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

@ -1,9 +1,9 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name msat) ((name CDCL)
(public_name msat) (public_name cdcl)
(synopsis "core data structures and algorithms for msat") (synopsis "core data structures and algorithms for cdcl")
(libraries ()) (libraries ())
(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 -bin-annot (ocamlopt_flags (:standard -O3 -bin-annot

View file

@ -1,9 +1,9 @@
; vim:ft=lisp: ; vim:ft=lisp:
(executable (executable
((name msat_test) ((name main_test)
(libraries (msat msat.backend msat.tseitin msat.sat dolmen)) (libraries (cdcl cdcl.backend cdcl.tseitin cdcl.sat dolmen))
(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 CDCL))
(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

@ -25,9 +25,9 @@ module type S = sig
end end
module Make module Make
(S : Msat.S) (S : CDCL.S)
(Th : sig (Th : sig
include Msat.Theory_intf.S with type t = S.theory include CDCL.Theory_intf.S with type t = S.theory
end) end)
(T : sig (T : sig
include Type.S with type atom := S.atom include Type.S with type atom := S.atom
@ -37,7 +37,7 @@ module Make
val do_task : Dolmen.Statement.t -> unit val do_task : Dolmen.Statement.t -> unit
end = struct end = struct
module D = Msat_backend.Dot.Make(S.Proof)(Msat_backend.Dot.Default(S.Proof)) module D = CDCL_backend.Dot.Make(S.Proof)(CDCL_backend.Dot.Default(S.Proof))
let hyps = ref [] let hyps = ref []
@ -45,7 +45,7 @@ module Make
let th = S.theory st let th = S.theory st
let t_st = T.create th let t_st = T.create th
let check_model (Msat.Sat_state sat) = let check_model (CDCL.Sat_state sat) =
let check_clause c = let check_clause c =
let l = List.map (function a -> let l = List.map (function a ->
Log.debugf 99 Log.debugf 99
@ -66,7 +66,7 @@ module Make
raise Incorrect_model; raise Incorrect_model;
let t' = Sys.time () -. t in let t' = Sys.time () -. t in
Format.printf "Sat (%f/%f)@." t t' Format.printf "Sat (%f/%f)@." t t'
| S.Unsat (Msat.Unsat_state us) -> | S.Unsat (CDCL.Unsat_state us) ->
if !p_check then begin if !p_check then begin
let p = us.get_proof () in let p = us.get_proof () in
S.Proof.check p; S.Proof.check p;
@ -113,9 +113,9 @@ module Make
Dolmen.Statement.print s Dolmen.Statement.print s
end end
module Sat = Make(Msat_sat)(Msat_sat.Th)(Type_sat) module Sat = Make(CDCL_sat)(CDCL_sat.Th)(Type_sat)
(* (*
module Smt = Make(Minismt_smt)(Msat_sat.Th)(Minismt_smt.Type) module Smt = Make(Minismt_smt)(CDCL_sat.Th)(Minismt_smt.Type)
*) *)
let solver = ref (module Sat : S) let solver = ref (module Sat : S)

View file

@ -10,7 +10,7 @@ Copyright 2014 Simon Cruanes
module Id = Dolmen.Id module Id = Dolmen.Id
module Ast = Dolmen.Term module Ast = Dolmen.Term
module H = Hashtbl.Make(Id) module H = Hashtbl.Make(Id)
module Formula = Msat_tseitin.Make(Msat_sat.Th) module Formula = CDCL_tseitin.Make(CDCL_sat.Th)
(* Exceptions *) (* Exceptions *)
(* ************************************************************************ *) (* ************************************************************************ *)
@ -36,7 +36,7 @@ let find_id st id =
try try
H.find st.symbols id H.find st.symbols id
with Not_found -> with Not_found ->
let res = Msat_sat.Th.fresh st.fresh in let res = CDCL_sat.Th.fresh st.fresh in
H.add st.symbols id res; H.add st.symbols id res;
res res

View file

@ -8,7 +8,7 @@ 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 Type.S with type atom := Msat_sat.Th.formula include Type.S with type atom := CDCL_sat.Th.formula
val create : Msat_sat.Th.t -> t val create : CDCL_sat.Th.t -> t

View file

@ -5,5 +5,5 @@ Copyright 2016 Guillaume Bury
module Th = Th_sat module Th = Th_sat
include Msat.Make(Th) include CDCL.Make(Th)

View file

@ -11,6 +11,6 @@ Copyright 2016 Guillaume Bury
module Th = Th_sat module Th = Th_sat
include module type of Msat.Make(Th) include module type of CDCL.Make(Th)
(** A functor that can generate as many solvers as needed. *) (** A functor that can generate as many solvers as needed. *)

View file

@ -8,7 +8,7 @@ type proof = unit
type formula = int type formula = int
type t = { type t = {
actions: (formula, proof) Msat.actions; actions: (formula, proof) CDCL.actions;
mutable max_index: int; mutable max_index: int;
mutable max_fresh: int; mutable max_fresh: int;
} }
@ -49,9 +49,9 @@ module Form = struct
let norm a = let norm a =
abs a, if a < 0 then abs a, if a < 0 then
Msat.Negated CDCL.Negated
else else
Msat.Same_sign CDCL.Same_sign
let print fmt a = let print fmt a =
Format.fprintf fmt "%s%s%d" Format.fprintf fmt "%s%s%d"
@ -82,6 +82,6 @@ let iter: (t -> unit) -> unit = fun f ->
done done
*) *)
let assume _ _ = Msat.Theory_intf.Sat let assume _ _ = CDCL.Theory_intf.Sat
let if_sat _ _ = Msat.Theory_intf.Sat let if_sat _ _ = CDCL.Theory_intf.Sat

View file

@ -8,7 +8,7 @@
near optimal efficiency (both in terms of space and time). near optimal efficiency (both in terms of space and time).
*) *)
open Msat open CDCL
include Theory_intf.S with type formula = int and type proof = unit include Theory_intf.S with type formula = int and type proof = unit
(** This modules implements the requirements for implementing an SAT Solver. *) (** This modules implements the requirements for implementing an SAT Solver. *)

View file

@ -1,11 +1,11 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name msat_sat) ((name CDCL_sat)
(public_name msat.sat) (public_name cdcl.sat)
(libraries (msat msat.tseitin)) (libraries (cdcl cdcl.tseitin))
(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 CDCL))
(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

@ -1,9 +1,9 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name msat_tseitin) ((name CDCL_tseitin)
(public_name msat.tseitin) (public_name cdcl.tseitin)
(synopsis "Tseitin transformation for msat") (synopsis "Tseitin transformation for CDCL")
(libraries ()) (libraries ())
(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 -bin-annot (ocamlopt_flags (:standard -O3 -bin-annot

View file

@ -2,7 +2,7 @@
(executable (executable
((name test_api) ((name test_api)
(libraries (msat msat.tseitin msat.backend msat.sat)) (libraries (cdcl cdcl.tseitin cdcl.backend cdcl.sat))
(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

@ -1,10 +1,12 @@
#!/bin/bash #!/bin/bash
CURDIR=`dirname $0` CURDIR=`dirname $0`
SOLVER="$CURDIR/../msat.exe" SOLVER="$CURDIR/../main.exe"
solvertest () { solvertest () {
for f in `find -L $1 -type f -name '*.cnf' -o -name '*.smt2'` # FIXME
#for f in `find -L $1 -type f -name '*.cnf' -o -name '*.smt2'`
for f in `find -L $1 -type f -name '*.cnf'`
do do
echo -ne "\r\033[KTesting $f..." echo -ne "\r\033[KTesting $f..."
"$SOLVER" -s $3 -time 30s -size 1G -check $f | grep $2 "$SOLVER" -s $3 -time 30s -size 1G -check $f | grep $2

View file

@ -6,10 +6,10 @@ Copyright 2014 Simon Cruanes
(* Tests that require the API *) (* Tests that require the API *)
open Msat open CDCL
module Th = Msat_sat.Th module Th = CDCL_sat.Th
module F = Msat_tseitin.Make(Th) module F = CDCL_tseitin.Make(Th)
let (|>) x f = f x let (|>) x f = f x
@ -48,7 +48,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 include CDCL_sat
let create() = create() let create() = create()
let solve st ?assumptions () = let solve st ?assumptions () =
match solve st ?assumptions() with match solve st ?assumptions() with