rename to sidekick

This commit is contained in:
Simon Cruanes 2018-05-09 19:28:41 -05:00
parent eb40cfa5e3
commit 24bbe97ceb
38 changed files with 85 additions and 85 deletions

View file

@ -1,6 +1,6 @@
# dagon [![Build Status](https://travis-ci.org/c-cube/cdcl.svg?branch=master)](https://travis-ci.org/c-cube/CDCL) # Sidekick [![Build Status](https://travis-ci.org/c-cube/sidekick.svg?branch=master)](https://travis-ci.org/c-cube/sidekick)
Dagon is an OCaml library with a functor to create SMT solvers following Sidekick is an OCaml library with a functor to create SMT solvers following
the CDCL(T) approach (so called "lazy SMT"). the CDCL(T) approach (so called "lazy SMT").
It derives from [Alt-Ergo Zero](http://cubicle.lri.fr/alt-ergo-zero) It derives from [Alt-Ergo Zero](http://cubicle.lri.fr/alt-ergo-zero)
@ -9,16 +9,16 @@ and its fork [mSAT](https://github.com/gbury/msat).
## Documentation ## Documentation
See https://c-cube.github.io/dagon/ See https://c-cube.github.io/sidekick/
## Installation ## Installation
### Via opam ### Via opam
Once the package is on [opam](http://opam.ocaml.org), just `opam install dagon`. Once the package is on [opam](http://opam.ocaml.org), just `opam install sidekick`.
For the development version, use: For the development version, use:
opam pin add dagon https://github.com/c-cube/dagon.git opam pin https://github.com/c-cube/sidekick.git
### Manual installation ### Manual installation

View file

@ -1,5 +1,5 @@
opam-version: "1.2" opam-version: "1.2"
name: "dagon" name: "sidekick"
license: "Apache" license: "Apache"
version: "dev" version: "dev"
author: ["Simon Cruanes" "Guillaume Bury" "Sylvain Conchon" "Alain Mebsout" "Stephane Lecuyer"] author: ["Simon Cruanes" "Guillaume Bury" "Sylvain Conchon" "Alain Mebsout" "Stephane Lecuyer"]
@ -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/c-cube/dagon" homepage: "https://github.com/c-cube/sidekick"
dev-repo: "https://github.com/c-cube/dagon.git" dev-repo: "https://github.com/c-cube/sidekick.git"
bug-reports: "https://github.com/c-cube/dagon/issues/" bug-reports: "https://github.com/c-cube/sidekick/issues/"

View file

@ -2,11 +2,11 @@
; main binary ; main binary
(library (library
((name Dagon_backend) ((name Sidekick_backend)
(public_name dagon.backend) (public_name sidekick.backend)
(synopsis "proof backends for Dagon") (synopsis "proof backends for Sidekick")
(libraries (dagon.sat)) (libraries (sidekick.sat))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Dagon_sat)) (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Sidekick_sat))
(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,6 +1,6 @@
(* Copyright 2005 INRIA *) (* Copyright 2005 INRIA *)
{ {
open Dagon_util open Sidekick_util
open Parser open Parser
} }

View file

@ -1,7 +1,7 @@
/* Copyright 2005 INRIA */ /* Copyright 2005 INRIA */
%{ %{
open Dagon_util open Sidekick_util
let lnum pos = pos.Lexing.pos_lnum let lnum pos = pos.Lexing.pos_lnum
let cnum pos = pos.Lexing.pos_cnum - pos.Lexing.pos_bol let cnum pos = pos.Lexing.pos_cnum - pos.Lexing.pos_bol

View file

@ -4,10 +4,10 @@
; main binary ; main binary
(library (library
((name dagon_dimacs) ((name sidekick_dimacs)
(public_name dagon.dimacs) (public_name sidekick.dimacs)
(optional) ; only if deps present (optional) ; only if deps present
(libraries (containers dagon.util)) (libraries (containers sidekick.util))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8)) (flags (:standard -w +a-4-42-44-48-50-58-32-60@8))
(ocamlopt_flags (:standard -O3 -color always -bin-annot (ocamlopt_flags (:standard -O3 -color always -bin-annot
-unbox-closures -unbox-closures-factor 20)) -unbox-closures -unbox-closures-factor 20))

View file

@ -5,13 +5,13 @@
; main binary ; main binary
(executable (executable
((name main) ((name main)
(public_name dagon) (public_name sidekick)
(package dagon) (package sidekick)
(libraries (containers sequence result (libraries (containers sequence result
dagon.sat dagon.smt dagon.smtlib dagon.backend sidekick.sat sidekick.smt sidekick.smtlib sidekick.backend
dagon.dimacs)) sidekick.dimacs))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 (flags (:standard -w +a-4-42-44-48-50-58-32-60@8
-safe-string -color always -open Dagon_util)) -safe-string -color always -open Sidekick_util))
(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,10 +8,10 @@ open CCResult.Infix
module E = CCResult module E = CCResult
module Fmt = CCFormat module Fmt = CCFormat
module Term = Dagon_smt.Term module Term = Sidekick_smt.Term
module Ast = Dagon_smt.Ast module Ast = Sidekick_smt.Ast
module Solver = Dagon_smt.Solver module Solver = Sidekick_smt.Solver
module Process = Dagon_smtlib.Process module Process = Sidekick_smtlib.Process
type 'a or_error = ('a, string) E.t type 'a or_error = ('a, string) E.t
@ -34,7 +34,7 @@ let p_progress = ref false
let hyps : Ast.term list ref = ref [] let hyps : Ast.term list ref = ref []
module Dot = Dagon_backend.Dot.Make(Solver.Sat_solver.Proof)(Dagon_backend.Dot.Default(Solver.Sat_solver.Proof)) module Dot = Sidekick_backend.Dot.Make(Solver.Sat_solver.Proof)(Sidekick_backend.Dot.Default(Solver.Sat_solver.Proof))
let check_model _state = let check_model _state =
let check_clause _c = let check_clause _c =
@ -43,7 +43,7 @@ let check_model _state =
let l = let l =
List.map List.map
(fun a -> (fun a ->
Dagon_sat.Log.debugf 99 Sidekick_sat.Log.debugf 99
(fun k -> k "Checking value of %a" Term.pp (Sat.Atom.term a)); (fun k -> k "Checking value of %a" Term.pp (Sat.Atom.term a));
Sat_solver.Sat_state.eval state a) Sat_solver.Sat_state.eval state a)
c c
@ -98,7 +98,7 @@ let argspec = Arg.align [
"-no-p", Arg.Clear p_progress, " no progress bar"; "-no-p", Arg.Clear p_progress, " no progress bar";
"-size", Arg.String (int_arg size_limit), " <s>[kMGT] sets the size limit for the sat solver"; "-size", Arg.String (int_arg size_limit), " <s>[kMGT] sets the size limit for the sat solver";
"-time", Arg.String (int_arg time_limit), " <t>[smhd] sets the time limit for the sat solver"; "-time", Arg.String (int_arg time_limit), " <t>[smhd] sets the time limit for the sat solver";
"-v", Arg.Int Dagon_sat.Log.set_debug, "<lvl> sets the debug verbose level"; "-v", Arg.Int Sidekick_sat.Log.set_debug, "<lvl> sets the debug verbose level";
] ]
type syntax = type syntax =
@ -122,19 +122,19 @@ let main () =
let solver = let solver =
let theories = match syn with let theories = match syn with
| Dimacs -> | Dimacs ->
[Dagon_th_bool.th] [Sidekick_th_bool.th]
| Smtlib -> | Smtlib ->
[Dagon_th_bool.th] (* TODO: more theories *) [Sidekick_th_bool.th] (* TODO: more theories *)
in in
Dagon_smt.Solver.create ~theories () Sidekick_smt.Solver.create ~theories ()
in in
let dot_proof = if !p_dot_proof = "" then None else Some !p_dot_proof in let dot_proof = if !p_dot_proof = "" then None else Some !p_dot_proof in
begin match syn with begin match syn with
| Smtlib -> | Smtlib ->
(* parse pb *) (* parse pb *)
Dagon_smtlib.parse !file Sidekick_smtlib.parse !file
| Dimacs -> | Dimacs ->
Dagon_dimacs.parse !file >|= fun cs -> Sidekick_dimacs.parse !file >|= fun cs ->
List.rev_append List.rev_append
(List.rev_map (fun c -> Ast.Assert_bool c) cs) (List.rev_map (fun c -> Ast.Assert_bool c) cs)
[Ast.CheckSat] [Ast.CheckSat]
@ -155,7 +155,7 @@ let main () =
E.return() E.return()
in in
if !p_stat then ( if !p_stat then (
Format.printf "%a@." Dagon_smt.Solver.pp_stats solver; Format.printf "%a@." Sidekick_smt.Solver.pp_stats solver;
); );
if !p_gc_stat then ( if !p_gc_stat then (
Printf.printf "(gc_stats\n%t)\n" Gc.print_stat; Printf.printf "(gc_stats\n%t)\n" Gc.print_stat;

View file

@ -2,8 +2,8 @@
(executable (executable
((name main_test) ((name main_test)
(libraries (dagon_sat dagon.backend dagon.th_sat dolmen)) (libraries (sidekick_sat sidekick.backend sidekick.th_sat dolmen))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Dagon_sat)) (flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -color always -safe-string -open Sidekick_sat))
(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,12 +1,12 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name Dagon_sat) ((name Sidekick_sat)
(public_name dagon.sat) (public_name sidekick.sat)
(synopsis "core SAT solver for Dagon") (synopsis "core SAT solver for Sidekick")
(libraries (dagon.util)) (libraries (sidekick.util))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 (flags (:standard -w +a-4-42-44-48-50-58-32-60@8
-color always -safe-string -open Dagon_util)) -color always -safe-string -open Sidekick_util))
(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,6 +1,6 @@
module Vec = Dagon_sat.Vec module Vec = Sidekick_sat.Vec
module Log = Dagon_sat.Log module Log = Sidekick_sat.Log
open Solver_types open Solver_types
type node = Equiv_class.t type node = Equiv_class.t

View file

@ -53,7 +53,7 @@ let pp = pp_lit
let print = pp let print = pp
let norm l = let norm l =
if l.lit_sign then l, Dagon_sat.Same_sign else neg l, Dagon_sat.Negated if l.lit_sign then l, Sidekick_sat.Same_sign else neg l, Sidekick_sat.Negated
module Set = CCSet.Make(struct type t = lit let compare=compare end) module Set = CCSet.Make(struct type t = lit let compare=compare end)
module Tbl = CCHashtbl.Make(struct type t = lit let equal=equal let hash=hash end) module Tbl = CCHashtbl.Make(struct type t = lit let equal=equal let hash=hash end)

View file

@ -28,7 +28,7 @@ val compare : t -> t -> int
val equal : t -> t -> bool val equal : t -> t -> bool
val print : t Fmt.printer val print : t Fmt.printer
val pp : t Fmt.printer val pp : t Fmt.printer
val norm : t -> t * Dagon_sat.negated val norm : t -> t * Sidekick_sat.negated
module Set : CCSet.S with type elt = t module Set : CCSet.S with type elt = t
module Tbl : CCHashtbl.S with type key = t module Tbl : CCHashtbl.S with type key = t

View file

@ -162,7 +162,7 @@ let equal_as_values (_:A.term) (_:A.term) : partial_eq =
@param st the "stack trace" (terms around currently being evaluated) @param st the "stack trace" (terms around currently being evaluated)
@param t the term to eval *) @param t the term to eval *)
let rec eval_whnf (m:t) (st:term list) (subst:subst) (t:term): term = let rec eval_whnf (m:t) (st:term list) (subst:subst) (t:term): term =
Dagon_sat.Log.debugf 5 Sidekick_sat.Log.debugf 5
(fun k->k "%s@[<2>eval_whnf `@[%a@]`@ in @[%a@]@]" (fun k->k "%s@[<2>eval_whnf `@[%a@]`@ in @[%a@]@]"
(String.make (List.length st) ' ') (* indent *) (String.make (List.length st) ' ') (* indent *)
A.pp_term t pp_subst subst); A.pp_term t pp_subst subst);

View file

@ -11,7 +11,7 @@ let get_time : unit -> float = Sys.time
type level = int type level = int
module Sat_solver = Dagon_sat.Make(Theory_combine) module Sat_solver = Sidekick_sat.Make(Theory_combine)
let[@inline] clause_of_mclause (c:Sat_solver.clause): Lit.t IArray.t = let[@inline] clause_of_mclause (c:Sat_solver.clause): Lit.t IArray.t =
Sat_solver.Clause.atoms c Sat_solver.Clause.atoms c
@ -407,14 +407,14 @@ type unsat_core = Sat.clause list
let solve ?on_exit:(_=[]) ?check:(_=true) ~assumptions (self:t) : res = let solve ?on_exit:(_=[]) ?check:(_=true) ~assumptions (self:t) : res =
let r = Sat_solver.solve ~assumptions (solver self) () in let r = Sat_solver.solve ~assumptions (solver self) () in
match r with match r with
| Sat_solver.Sat (Dagon_sat.Sat_state _st) -> | Sat_solver.Sat (Sidekick_sat.Sat_state _st) ->
Log.debugf 0 (fun k->k "SAT"); Log.debugf 0 (fun k->k "SAT");
Unknown U_incomplete (* TODO *) Unknown U_incomplete (* TODO *)
(* (*
let env = Ast.env_empty in let env = Ast.env_empty in
let m = Model.make ~env let m = Model.make ~env
Sat m *) Sat m *)
| Sat_solver.Unsat (Dagon_sat.Unsat_state us) -> | Sat_solver.Unsat (Sidekick_sat.Unsat_state us) ->
let pr = us.get_proof () in let pr = us.get_proof () in
Unsat pr Unsat pr

View file

@ -5,7 +5,7 @@
The solving algorithm, based on MCSat *) The solving algorithm, based on MCSat *)
module Sat_solver : Dagon_sat.S module Sat_solver : Sidekick_sat.S
with type formula = Lit.t with type formula = Lit.t
and type theory = Theory_combine.t and type theory = Theory_combine.t
and type Proof.lemma = Theory_combine.proof and type Proof.lemma = Theory_combine.proof

View file

@ -3,7 +3,7 @@
(** Combine the congruence closure with a number of plugins *) (** Combine the congruence closure with a number of plugins *)
module Sat_solver = Dagon_sat module Sat_solver = Sidekick_sat
open Solver_types open Solver_types
module Proof = struct module Proof = struct

View file

@ -7,7 +7,7 @@ module Proof : sig
type t = Proof type t = Proof
end end
include Dagon_sat.Theory_intf.S include Sidekick_sat.Theory_intf.S
with type formula = Lit.t with type formula = Lit.t
and type proof = Proof.t and type proof = Proof.t

View file

@ -1,10 +1,10 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name Dagon_smt) ((name Sidekick_smt)
(public_name dagon.smt) (public_name sidekick.smt)
(libraries (containers containers.data sequence dagon.util dagon.sat zarith)) (libraries (containers containers.data sequence sidekick.util sidekick.sat zarith))
(flags (:standard -w +a-4-44-48-58-60@8 (flags (:standard -w +a-4-44-48-58-60@8
-color always -safe-string -short-paths -open Dagon_util)) -color always -safe-string -short-paths -open Sidekick_util))
(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,7 +1,7 @@
(** {1 Theory of Booleans} *) (** {1 Theory of Booleans} *)
open Dagon_smt open Sidekick_smt
module Fmt = CCFormat module Fmt = CCFormat

View file

@ -1,7 +1,7 @@
(** {1 Theory of Booleans} *) (** {1 Theory of Booleans} *)
open Dagon_smt open Sidekick_smt
type term = Term.t type term = Term.t
@ -45,4 +45,4 @@ module Lit : sig
val neq : Term.state -> term -> term -> t val neq : Term.state -> term -> term -> t
end end
val th : Dagon_smt.Theory.t val th : Sidekick_smt.Theory.t

View file

@ -1,10 +1,10 @@
; vim:ft=lisp: ; vim:ft=lisp:
(library (library
((name Dagon_th_bool) ((name Sidekick_th_bool)
(public_name dagon.smt.th_bool) (public_name sidekick.smt.th_bool)
(libraries (containers dagon.smt)) (libraries (containers sidekick.smt))
(flags (:standard -w +a-4-44-48-58-60@8 (flags (:standard -w +a-4-44-48-58-60@8
-color always -safe-string -short-paths -open Dagon_util)) -color always -safe-string -short-paths -open Sidekick_util))
(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,13 +1,13 @@
(** {2 Conversion into {!Term.t}} *) (** {2 Conversion into {!Term.t}} *)
open Dagon_smt open Sidekick_smt
type 'a or_error = ('a, string) CCResult.t type 'a or_error = ('a, string) CCResult.t
module E = CCResult module E = CCResult
module A = Ast module A = Ast
module Form = Dagon_th_bool module Form = Sidekick_th_bool
module Fmt = CCFormat module Fmt = CCFormat
module Subst = struct module Subst = struct

View file

@ -1,7 +1,7 @@
(** {1 Process Statements} *) (** {1 Process Statements} *)
open Dagon_smt open Sidekick_smt
type 'a or_error = ('a, string) CCResult.t type 'a or_error = ('a, string) CCResult.t

View file

@ -2,7 +2,7 @@
(** {1 Process Statements} *) (** {1 Process Statements} *)
module Fmt = CCFormat module Fmt = CCFormat
module Ast = Dagon_smt.Ast module Ast = Sidekick_smt.Ast
module E = CCResult module E = CCResult
module Loc = Locations module Loc = Locations
module Process = Process module Process = Process

View file

@ -7,7 +7,7 @@
type 'a or_error = ('a, string) CCResult.t type 'a or_error = ('a, string) CCResult.t
module Ast = Dagon_smt.Ast module Ast = Sidekick_smt.Ast
module Process = Process module Process = Process
val parse : string -> Ast.statement list or_error val parse : string -> Ast.statement list or_error

View file

@ -6,7 +6,7 @@
module Loc = Locations module Loc = Locations
module Fmt = CCFormat module Fmt = CCFormat
module A = Dagon_smt.Ast module A = Sidekick_smt.Ast
module PA = Parse_ast module PA = Parse_ast
type 'a or_error = ('a, string) CCResult.t type 'a or_error = ('a, string) CCResult.t
@ -314,7 +314,7 @@ let rec conv_term ctx (t:PA.term) : A.term = match t with
errorf_ctx ctx "unsupported term %a" PA.pp_term t errorf_ctx ctx "unsupported term %a" PA.pp_term t
let find_file_ name ~dir : string option = let find_file_ name ~dir : string option =
Dagon_sat.Log.debugf 2 (fun k->k "search %s in %s" name dir); Sidekick_sat.Log.debugf 2 (fun k->k "search %s in %s" name dir);
let abs_path = Filename.concat dir name in let abs_path = Filename.concat dir name in
if Sys.file_exists abs_path if Sys.file_exists abs_path
then Some abs_path then Some abs_path

View file

@ -16,7 +16,7 @@ module Ctx : sig
end end
module PA = Parse_ast module PA = Parse_ast
module A = Dagon_smt.Ast module A = Sidekick_smt.Ast
val conv_term : Ctx.t -> PA.term -> A.term val conv_term : Ctx.t -> PA.term -> A.term

View file

@ -4,12 +4,12 @@
; main binary ; main binary
(library (library
((name dagon_smtlib) ((name sidekick_smtlib)
(public_name dagon.smtlib) (public_name sidekick.smtlib)
(optional) ; only if deps present (optional) ; only if deps present
(libraries (containers dagon.smt dagon.util dagon.smt.th_bool zarith)) (libraries (containers sidekick.smt sidekick.util sidekick.smt.th_bool zarith))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 (flags (:standard -w +a-4-42-44-48-50-58-32-60@8
-safe-string -color always -open Dagon_util)) -safe-string -color always -open Sidekick_util))
(ocamlopt_flags (:standard -O3 -color always -bin-annot (ocamlopt_flags (:standard -O3 -color always -bin-annot
-unbox-closures -unbox-closures-factor 20)) -unbox-closures -unbox-closures-factor 20))
)) ))

View file

@ -11,6 +11,6 @@ Copyright 2016 Guillaume Bury
module Th = Th_sat module Th = Th_sat
include module type of Dagon_sat.Make(Th) include module type of Sidekick_sat.Make(Th)
(** 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 Dagon_th_sat) ((name Sidekick_th_sat)
(public_name dagon.th_sat) (public_name sidekick.th_sat)
(libraries (dagon.sat cdcl.tseitin)) (libraries (sidekick.sat 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 CDCL)) (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

View file

@ -2,7 +2,7 @@
(library (library
((name CDCL_tseitin) ((name CDCL_tseitin)
(public_name dagon.tseitin) (public_name sidekick.tseitin)
(synopsis "Tseitin transformation for CDCL") (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))

View file

@ -1,6 +1,6 @@
(library (library
((name dagon_util) ((name sidekick_util)
(public_name dagon.util) (public_name sidekick.util)
(libraries (containers sequence)) (libraries (containers sequence))
(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