fix some warnings

This commit is contained in:
Simon Cruanes 2022-07-14 21:56:37 -04:00
parent 96bc3e2340
commit fd500a3d7d
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
11 changed files with 17 additions and 33 deletions

View file

@ -11,10 +11,10 @@ build: [
["dune" "runtest" "-p" name "-j" jobs] {with-test} ["dune" "runtest" "-p" name "-j" jobs] {with-test}
] ]
depends: [ depends: [
"dune" { >= "1.1" } "dune" { >= "2.0" }
"containers" { >= "3.0" & < "4.0" } "containers" { >= "3.6" & < "4.0" }
"iter" { >= "1.0" & < "2.0" } "iter" { >= "1.0" & < "2.0" }
"ocaml" { >= "4.04" } "ocaml" { >= "4.08" }
"zarith" { with-test } "zarith" { with-test }
"alcotest" {with-test} "alcotest" {with-test}
"odoc" {with-doc} "odoc" {with-doc}

View file

@ -308,7 +308,6 @@ module Make (A: CC_ARG)
mutable on_conflict: ev_on_conflict list; mutable on_conflict: ev_on_conflict list;
mutable on_propagate: ev_on_propagate list; mutable on_propagate: ev_on_propagate list;
mutable on_is_subterm : ev_on_is_subterm list; mutable on_is_subterm : ev_on_is_subterm list;
stat: Stat.t;
count_conflict: int Stat.counter; count_conflict: int Stat.counter;
count_props: int Stat.counter; count_props: int Stat.counter;
count_merge: int Stat.counter; count_merge: int Stat.counter;
@ -639,7 +638,7 @@ module Make (A: CC_ARG)
T_tbl.remove cc.tbl t); T_tbl.remove cc.tbl t);
(* add term to the table *) (* add term to the table *)
T_tbl.add cc.tbl t n; T_tbl.add cc.tbl t n;
if CCOpt.is_some sig0 then ( if Option.is_some sig0 then (
(* [n] might be merged with other equiv classes *) (* [n] might be merged with other equiv classes *)
push_pending cc n; push_pending cc n;
); );
@ -1164,7 +1163,6 @@ module Make (A: CC_ARG)
undo=Backtrack_stack.create(); undo=Backtrack_stack.create();
true_; true_;
false_; false_;
stat;
field_marked_explain; field_marked_explain;
count_conflict=Stat.mk_int stat "cc.conflicts"; count_conflict=Stat.mk_int stat "cc.conflicts";
count_props=Stat.mk_int stat "cc.propagations"; count_props=Stat.mk_int stat "cc.propagations";

View file

@ -185,7 +185,6 @@ module Make() : S = struct
val del_clause : t -> Clause.t -> unit val del_clause : t -> Clause.t -> unit
end = struct end = struct
type t = { type t = {
cstore: Clause.store;
assign: Atom.Assign.t; (* atom -> is_true(atom) *) assign: Atom.Assign.t; (* atom -> is_true(atom) *)
trail: Atom.Stack.t; (* current assignment *) trail: Atom.Stack.t; (* current assignment *)
mutable trail_ptr : int; (* offset in trail for propagation *) mutable trail_ptr : int; (* offset in trail for propagation *)
@ -193,10 +192,9 @@ module Make() : S = struct
watches: Clause.t Vec.t Atom.Map.t; (* atom -> clauses it watches *) watches: Clause.t Vec.t Atom.Map.t; (* atom -> clauses it watches *)
} }
let create cstore : t = let create _cstore : t =
{ trail=Atom.Stack.create(); { trail=Atom.Stack.create();
trail_ptr = 0; trail_ptr = 0;
cstore;
active_clauses=Clause.Tbl.create 32; active_clauses=Clause.Tbl.create 32;
assign=Atom.Assign.create(); assign=Atom.Assign.create();
watches=Atom.Map.create(); watches=Atom.Map.create();

View file

@ -173,7 +173,7 @@ module Make(A : ARG)
while Z.(!n <= n0) do while Z.(!n <= n0) do
if is_prime !n then k !n if is_prime !n then k !n
done done
end end [@@warning "-60"]
module Op = struct module Op = struct

View file

@ -1,5 +1,4 @@
open Sidekick_core
module type RATIONAL = Sidekick_arith.RATIONAL module type RATIONAL = Sidekick_arith.RATIONAL
module type INT = Sidekick_arith.INT module type INT = Sidekick_arith.INT

View file

@ -157,7 +157,6 @@ module Make(A : ARG) : S with module A = A = struct
let mk_lit _ _ _ = assert false let mk_lit _ _ _ = assert false
end) end)
module Subst = SimpSolver.Subst module Subst = SimpSolver.Subst
module Q_tbl = CCHashtbl.Make(A.Q)
module Comb_map = CCMap.Make(LE_.Comb) module Comb_map = CCMap.Make(LE_.Comb)
@ -243,7 +242,6 @@ module Make(A : ARG) : S with module A = A = struct
mutable encoded_le: T.t Comb_map.t; (* [le] -> var encoding [le] *) mutable encoded_le: T.t Comb_map.t; (* [le] -> var encoding [le] *)
simplex: SimpSolver.t; simplex: SimpSolver.t;
mutable last_res: SimpSolver.result option; mutable last_res: SimpSolver.result option;
stat_th_comb: int Stat.counter;
} }
let create ?(stat=Stat.create()) (si:SI.t) : state = let create ?(stat=Stat.create()) (si:SI.t) : state =
@ -262,7 +260,6 @@ module Make(A : ARG) : S with module A = A = struct
encoded_le=Comb_map.empty; encoded_le=Comb_map.empty;
simplex=SimpSolver.create ~stat (); simplex=SimpSolver.create ~stat ();
last_res=None; last_res=None;
stat_th_comb=Stat.mk_int stat "lra.th-comb";
} }
let[@inline] reset_res_ (self:state) : unit = let[@inline] reset_res_ (self:state) : unit =
@ -537,8 +534,6 @@ module Make(A : ARG) : S with module A = A = struct
) )
| _ -> None | _ -> None
module Q_map = CCMap.Make(A.Q)
(* raise conflict from certificate *) (* raise conflict from certificate *)
let fail_with_cert si acts cert : 'a = let fail_with_cert si acts cert : 'a =
Profile.with1 "lra.simplex.check-cert" SimpSolver._check_cert cert; Profile.with1 "lra.simplex.check-cert" SimpSolver._check_cert cert;
@ -624,7 +619,7 @@ module Make(A : ARG) : S with module A = A = struct
(* evaluate a term directly, as a variable *) (* evaluate a term directly, as a variable *)
let eval_in_subst_ subst t = match A.view_as_lra t with let eval_in_subst_ subst t = match A.view_as_lra t with
| LRA_const n -> n | LRA_const n -> n
| _ -> Subst.eval subst t |> CCOpt.get_or ~default:A.Q.zero | _ -> Subst.eval subst t |> Option.value ~default:A.Q.zero
(* evaluate a linear expression *) (* evaluate a linear expression *)
let eval_le_in_subst_ subst (le:LE.t) = let eval_le_in_subst_ subst (le:LE.t) =
@ -754,7 +749,7 @@ module Make(A : ARG) : S with module A = A = struct
begin match A.view_as_lra t with begin match A.view_as_lra t with
| LRA_const n -> Some n (* always eval constants to themselves *) | LRA_const n -> Some n (* always eval constants to themselves *)
| _ -> SimpSolver.V_map.get t m | _ -> SimpSolver.V_map.get t m
end |> CCOpt.map (t_const self) end |> Option.map (t_const self)
| _ -> None | _ -> None
end end

View file

@ -730,10 +730,6 @@ module Make(Plugin : PLUGIN)
(* learnt clauses (tautologies true at any time, whatever the user level). (* learnt clauses (tautologies true at any time, whatever the user level).
GC'd regularly. *) GC'd regularly. *)
clauses_dead : CVec.t;
(* dead clauses, to be removed at next GC.
invariant: all satisfy [Clause.dead store c]. *)
clause_pools : clause_pool Vec.t; clause_pools : clause_pool Vec.t;
(* custom clause pools *) (* custom clause pools *)
@ -754,7 +750,7 @@ module Make(Plugin : PLUGIN)
var_levels : VecSmallInt.t; var_levels : VecSmallInt.t;
(* decision levels in [trail] *) (* decision levels in [trail] *)
mutable assumptions: AVec.t; assumptions: AVec.t;
(* current assumptions *) (* current assumptions *)
mutable th_head : int; mutable th_head : int;
@ -824,7 +820,6 @@ module Make(Plugin : PLUGIN)
~descr:(fun () -> "cp.learnt-clauses") ~descr:(fun () -> "cp.learnt-clauses")
~max_size:max_clauses_learnt (); ~max_size:max_clauses_learnt ();
delayed_actions=Delayed_actions.create(); delayed_actions=Delayed_actions.create();
clauses_dead = CVec.create();
clause_pools = Vec.create(); clause_pools = Vec.create();
to_clear=Vec.create(); to_clear=Vec.create();

View file

@ -146,7 +146,7 @@ module Make(C : COEFF)(Var : VAR) = struct
} }
let compare c c' = let compare c c' =
CCOrd.(compare c.op c'.op CCOrd.(poly c.op c'.op
<?> (Expr.compare, c.expr, c'.expr)) <?> (Expr.compare, c.expr, c'.expr))
let pp_op out o = let pp_op out o =

View file

@ -88,7 +88,6 @@ module Make(A : ARG)
module Term = T.Term module Term = T.Term
module Lit = A.Lit module Lit = A.Lit
type term = Term.t type term = Term.t
type value = term
type ty = Ty.t type ty = Ty.t
type proof = A.proof type proof = A.proof
type proof_step = A.proof_step type proof_step = A.proof_step
@ -354,8 +353,8 @@ module Make(A : ARG)
let on_th_combination self f = self.on_th_combination <- f :: self.on_th_combination let on_th_combination self f = self.on_th_combination <- f :: self.on_th_combination
let on_preprocess self f = self.preprocess <- f :: self.preprocess let on_preprocess self f = self.preprocess <- f :: self.preprocess
let on_model ?ask ?complete self = let on_model ?ask ?complete self =
CCOpt.iter (fun f -> self.model_ask <- f :: self.model_ask) ask; Option.iter (fun f -> self.model_ask <- f :: self.model_ask) ask;
CCOpt.iter (fun f -> self.model_complete <- f :: self.model_complete) complete; Option.iter (fun f -> self.model_complete <- f :: self.model_complete) complete;
() ()
let[@inline] raise_conflict self (acts:theory_actions) c proof : 'a = let[@inline] raise_conflict self (acts:theory_actions) c proof : 'a =
@ -472,7 +471,7 @@ module Make(A : ARG)
(* simplify a literal, then preprocess it *) (* simplify a literal, then preprocess it *)
let[@inline] simp_lit lit = let[@inline] simp_lit lit =
let lit, pr = simplify_and_preproc_lit_ self lit in let lit, pr = simplify_and_preproc_lit_ self lit in
CCOpt.iter (fun pr -> steps := pr :: !steps) pr; Option.iter (fun pr -> steps := pr :: !steps) pr;
lit lit
in in
let c' = A.map simp_lit c in let c' = A.map simp_lit c in
@ -1014,7 +1013,7 @@ module Make(A : ARG)
(fun k->k "(@[sidekick.smt-solver: SAT@ actual: UNKNOWN@ :reason incomplete-fragment@])"); (fun k->k "(@[sidekick.smt-solver: SAT@ actual: UNKNOWN@ :reason incomplete-fragment@])");
Unknown Unknown.U_incomplete Unknown Unknown.U_incomplete
| Sat_solver.Sat (module SAT) -> | Sat_solver.Sat _ ->
Log.debug 1 "(sidekick.smt-solver: SAT)"; Log.debug 1 "(sidekick.smt-solver: SAT)";
Log.debugf 5 Log.debugf 5

View file

@ -156,8 +156,8 @@ let solve
let should_stop = match time, memory with let should_stop = match time, memory with
| None, None -> None | None, None -> None
| _ -> | _ ->
let time = CCOpt.get_or ~default:3600. time in (* default: 1 hour *) let time = Option.value ~default:3600. time in (* default: 1 hour *)
let memory = CCOpt.get_or ~default:4e9 memory in (* default: 4 GB *) let memory = Option.value ~default:4e9 memory in (* default: 4 GB *)
let stop _ _ = let stop _ _ =
Sys.time () -. t1 > time || Sys.time () -. t1 > time ||
(Gc.quick_stat()).Gc.major_words *. 8. > memory (Gc.quick_stat()).Gc.major_words *. 8. > memory

View file

@ -167,7 +167,7 @@ module Make(A : ARG) : S with module A = A = struct
(* directly simplify [a] so that maybe we never will simplify one (* directly simplify [a] so that maybe we never will simplify one
of the branches *) of the branches *)
let a, prf_a = SI.Simplify.normalize_t simp a in let a, prf_a = SI.Simplify.normalize_t simp a in
CCOpt.iter add_step_ prf_a; Option.iter add_step_ prf_a;
begin match A.view_as_bool a with begin match A.view_as_bool a with
| B_bool true -> | B_bool true ->
add_step_eq t b ~using:(Iter.of_opt prf_a) add_step_eq t b ~using:(Iter.of_opt prf_a)