mirror of
https://github.com/c-cube/sidekick.git
synced 2026-01-29 04:44:52 -05:00
Everything has now been properly indented with ocp-indent.
This commit is contained in:
parent
a00506b95f
commit
dc43c28a02
34 changed files with 2944 additions and 2941 deletions
3
.ocp-indent
Normal file
3
.ocp-indent
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
base=2
|
||||
type=2
|
||||
max_indent=4
|
||||
|
|
@ -21,20 +21,20 @@
|
|||
standard library, which is copyright 1996 INRIA.) *)
|
||||
|
||||
module type HashedType =
|
||||
sig
|
||||
sig
|
||||
type t
|
||||
val equal : t -> t -> bool
|
||||
val hash : t -> int
|
||||
val tag : int -> t -> t
|
||||
end
|
||||
end
|
||||
|
||||
module type S =
|
||||
sig
|
||||
sig
|
||||
type t
|
||||
val hashcons : t -> t
|
||||
val iter : (t -> unit) -> unit
|
||||
val stats : unit -> int * int * int * int * int * int
|
||||
end
|
||||
end
|
||||
|
||||
module Make(H : HashedType) : (S with type t = H.t) =
|
||||
struct
|
||||
|
|
@ -69,19 +69,19 @@ type 'a hash_consed = {
|
|||
node : 'a }
|
||||
|
||||
module type HashedType_consed =
|
||||
sig
|
||||
sig
|
||||
type t
|
||||
val equal : t -> t -> bool
|
||||
val hash : t -> int
|
||||
end
|
||||
end
|
||||
|
||||
module type S_consed =
|
||||
sig
|
||||
sig
|
||||
type key
|
||||
val hashcons : key -> key hash_consed
|
||||
val iter : (key hash_consed -> unit) -> unit
|
||||
val stats : unit -> int * int * int * int * int * int
|
||||
end
|
||||
end
|
||||
|
||||
module Make_consed(H : HashedType_consed) : (S_consed with type key = H.t) =
|
||||
struct
|
||||
|
|
|
|||
|
|
@ -33,15 +33,15 @@
|
|||
more referenced from anywhere else can be erased by the GC. *)
|
||||
|
||||
module type HashedType =
|
||||
sig
|
||||
sig
|
||||
type t
|
||||
val equal : t -> t -> bool
|
||||
val hash : t -> int
|
||||
val tag : int -> t -> t
|
||||
end
|
||||
end
|
||||
|
||||
module type S =
|
||||
sig
|
||||
sig
|
||||
type t
|
||||
|
||||
val hashcons : t -> t
|
||||
|
|
@ -59,7 +59,7 @@ module type S =
|
|||
table length, number of entries, sum of bucket lengths,
|
||||
smallest bucket length, median bucket length, biggest
|
||||
bucket length. *)
|
||||
end
|
||||
end
|
||||
|
||||
module Make(H : HashedType) : (S with type t = H.t)
|
||||
|
||||
|
|
@ -79,14 +79,14 @@ type 'a hash_consed = private {
|
|||
node : 'a }
|
||||
|
||||
module type HashedType_consed =
|
||||
sig
|
||||
sig
|
||||
type t
|
||||
val equal : t -> t -> bool
|
||||
val hash : t -> int
|
||||
end
|
||||
end
|
||||
|
||||
module type S_consed =
|
||||
sig
|
||||
sig
|
||||
type key
|
||||
|
||||
val hashcons : key -> key hash_consed
|
||||
|
|
@ -104,6 +104,6 @@ module type S_consed =
|
|||
table length, number of entries, sum of bucket lengths,
|
||||
smallest bucket length, median bucket length, biggest
|
||||
bucket length. *)
|
||||
end
|
||||
end
|
||||
|
||||
module Make_consed(H : HashedType_consed) : (S_consed with type key = H.t)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ module type S = Solver_types_intf.S
|
|||
|
||||
module Make (F : Formula_intf.S) = struct
|
||||
|
||||
type formula = F.t
|
||||
type formula = F.t
|
||||
|
||||
type var =
|
||||
type var =
|
||||
{ vid : int;
|
||||
pa : atom;
|
||||
na : atom;
|
||||
|
|
@ -37,7 +37,7 @@ type var =
|
|||
mutable reason: reason;
|
||||
mutable vpremise : premise}
|
||||
|
||||
and atom =
|
||||
and atom =
|
||||
{ var : var;
|
||||
lit : formula;
|
||||
neg : atom;
|
||||
|
|
@ -45,7 +45,7 @@ and atom =
|
|||
mutable is_true : bool;
|
||||
aid : int }
|
||||
|
||||
and clause =
|
||||
and clause =
|
||||
{ name : string;
|
||||
mutable atoms : atom Vec.t ;
|
||||
mutable activity : float;
|
||||
|
|
@ -53,13 +53,13 @@ and clause =
|
|||
learnt : bool;
|
||||
cpremise : premise }
|
||||
|
||||
and reason = clause option
|
||||
and reason = clause option
|
||||
|
||||
and premise = clause list
|
||||
and premise = clause list
|
||||
|
||||
let dummy_lit = F.dummy
|
||||
let dummy_lit = F.dummy
|
||||
|
||||
let rec dummy_var =
|
||||
let rec dummy_var =
|
||||
{ vid = -101;
|
||||
pa = dummy_atom;
|
||||
na = dummy_atom;
|
||||
|
|
@ -68,14 +68,14 @@ let rec dummy_var =
|
|||
weight = -1.;
|
||||
seen = false;
|
||||
vpremise = [] }
|
||||
and dummy_atom =
|
||||
and dummy_atom =
|
||||
{ var = dummy_var;
|
||||
lit = dummy_lit;
|
||||
watched = {Vec.dummy=dummy_clause; data=[||]; sz=0};
|
||||
neg = dummy_atom;
|
||||
is_true = false;
|
||||
aid = -102 }
|
||||
and dummy_clause =
|
||||
and dummy_clause =
|
||||
{ name = "";
|
||||
atoms = {Vec.dummy=dummy_atom; data=[||]; sz=0};
|
||||
activity = -1.;
|
||||
|
|
@ -83,21 +83,21 @@ and dummy_clause =
|
|||
learnt = false;
|
||||
cpremise = [] }
|
||||
|
||||
module MA = F.Map
|
||||
type varmap = var MA.t
|
||||
module MA = F.Map
|
||||
type varmap = var MA.t
|
||||
|
||||
let ale = Hstring.make "<="
|
||||
let alt = Hstring.make "<"
|
||||
let agt = Hstring.make ">"
|
||||
let is_le n = Hstring.compare n ale = 0
|
||||
let is_lt n = Hstring.compare n alt = 0
|
||||
let is_gt n = Hstring.compare n agt = 0
|
||||
let ale = Hstring.make "<="
|
||||
let alt = Hstring.make "<"
|
||||
let agt = Hstring.make ">"
|
||||
let is_le n = Hstring.compare n ale = 0
|
||||
let is_lt n = Hstring.compare n alt = 0
|
||||
let is_gt n = Hstring.compare n agt = 0
|
||||
|
||||
let normal_form = F.norm
|
||||
let normal_form = F.norm
|
||||
|
||||
let cpt_mk_var = ref 0
|
||||
let ma = ref MA.empty
|
||||
let make_var =
|
||||
let cpt_mk_var = ref 0
|
||||
let ma = ref MA.empty
|
||||
let make_var =
|
||||
fun lit ->
|
||||
let lit, negated = normal_form lit in
|
||||
try MA.find lit !ma, negated
|
||||
|
|
@ -131,13 +131,13 @@ let make_var =
|
|||
incr cpt_mk_var;
|
||||
var, negated
|
||||
|
||||
let made_vars_info () = !cpt_mk_var, MA.fold (fun lit var acc -> var::acc)!ma []
|
||||
let made_vars_info () = !cpt_mk_var, MA.fold (fun lit var acc -> var::acc)!ma []
|
||||
|
||||
let add_atom lit =
|
||||
let add_atom lit =
|
||||
let var, negated = make_var lit in
|
||||
if negated then var.na else var.pa
|
||||
|
||||
let make_clause name ali sz_ali is_learnt premise =
|
||||
let make_clause name ali sz_ali is_learnt premise =
|
||||
let atoms = Vec.from_list ali sz_ali dummy_atom in
|
||||
{ name = name;
|
||||
atoms = atoms;
|
||||
|
|
@ -146,21 +146,21 @@ let make_clause name ali sz_ali is_learnt premise =
|
|||
activity = 0.;
|
||||
cpremise = premise}
|
||||
|
||||
let fresh_lname =
|
||||
let fresh_lname =
|
||||
let cpt = ref 0 in
|
||||
fun () -> incr cpt; "L" ^ (string_of_int !cpt)
|
||||
|
||||
let fresh_dname =
|
||||
let fresh_dname =
|
||||
let cpt = ref 0 in
|
||||
fun () -> incr cpt; "D" ^ (string_of_int !cpt)
|
||||
|
||||
let fresh_name =
|
||||
let fresh_name =
|
||||
let cpt = ref 0 in
|
||||
fun () -> incr cpt; "C" ^ (string_of_int !cpt)
|
||||
|
||||
|
||||
|
||||
module Clause = struct
|
||||
module Clause = struct
|
||||
|
||||
let size c = Vec.size c.atoms
|
||||
let pop c = Vec.pop c.atoms
|
||||
|
|
@ -169,13 +169,13 @@ module Clause = struct
|
|||
let get c i = Vec.get c.atoms i
|
||||
let set c i v = Vec.set c.atoms i v
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
let to_float i = float_of_int i
|
||||
let to_float i = float_of_int i
|
||||
|
||||
let to_int f = int_of_float f
|
||||
let to_int f = int_of_float f
|
||||
|
||||
let clear () =
|
||||
let clear () =
|
||||
cpt_mk_var := 0;
|
||||
ma := MA.empty
|
||||
|
||||
|
|
|
|||
|
|
@ -171,10 +171,10 @@ module type S_Term = sig
|
|||
val true_ : t
|
||||
val false_ : t
|
||||
|
||||
(* val terms_of : t -> Term.Set.t
|
||||
(* val terms_of : t -> Term.Set.t
|
||||
val vars_of : t -> Symbols.Set.t
|
||||
*)
|
||||
(* module SetEq : Set.S with type elt = t * Term.t * Term.t*)
|
||||
*)
|
||||
(* module SetEq : Set.S with type elt = t * Term.t * Term.t*)
|
||||
end
|
||||
|
||||
module LT : S_Term = struct
|
||||
|
|
@ -194,17 +194,17 @@ module LT : S_Term = struct
|
|||
make (Eq (t1, Term.false_))
|
||||
| _ -> L.neg a
|
||||
|
||||
(* let terms_of a =
|
||||
(* let terms_of a =
|
||||
let l = match view a with
|
||||
| Eq (t1, t2) -> [t1; t2]
|
||||
| Distinct (_, l) | Builtin (_, _, l) -> l
|
||||
in
|
||||
List.fold_left Term.subterms Term.Set.empty l
|
||||
*)
|
||||
*)
|
||||
|
||||
module SS = Symbols.Set
|
||||
(* let vars_of a =
|
||||
(* let vars_of a =
|
||||
Term.Set.fold (fun t -> SS.union (Term.vars_of t)) (terms_of a) SS.empty
|
||||
*)
|
||||
*)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ module ST = T.Set
|
|||
module SA = Set.Make(struct
|
||||
type t = Literal.LT.t * Explanation.t
|
||||
let compare (s1,_) (s2,_) = Literal.LT.compare s1 s2
|
||||
end)
|
||||
end)
|
||||
|
||||
type elt = ST.t * SA.t
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ type elt = ST.t * SA.t
|
|||
|
||||
module Make :
|
||||
functor (X : Sig.X) ->
|
||||
sig
|
||||
sig
|
||||
|
||||
type t
|
||||
val empty : t
|
||||
|
|
@ -35,4 +35,4 @@ sig
|
|||
|
||||
val up_close_up :t -> X.r -> X.r -> t
|
||||
val congr_close_up : t -> X.r -> X.r list -> elt
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue