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.) *)
|
standard library, which is copyright 1996 INRIA.) *)
|
||||||
|
|
||||||
module type HashedType =
|
module type HashedType =
|
||||||
sig
|
sig
|
||||||
type t
|
type t
|
||||||
val equal : t -> t -> bool
|
val equal : t -> t -> bool
|
||||||
val hash : t -> int
|
val hash : t -> int
|
||||||
val tag : int -> t -> t
|
val tag : int -> t -> t
|
||||||
end
|
end
|
||||||
|
|
||||||
module type S =
|
module type S =
|
||||||
sig
|
sig
|
||||||
type t
|
type t
|
||||||
val hashcons : t -> t
|
val hashcons : t -> t
|
||||||
val iter : (t -> unit) -> unit
|
val iter : (t -> unit) -> unit
|
||||||
val stats : unit -> int * int * int * int * int * int
|
val stats : unit -> int * int * int * int * int * int
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make(H : HashedType) : (S with type t = H.t) =
|
module Make(H : HashedType) : (S with type t = H.t) =
|
||||||
struct
|
struct
|
||||||
|
|
@ -69,19 +69,19 @@ type 'a hash_consed = {
|
||||||
node : 'a }
|
node : 'a }
|
||||||
|
|
||||||
module type HashedType_consed =
|
module type HashedType_consed =
|
||||||
sig
|
sig
|
||||||
type t
|
type t
|
||||||
val equal : t -> t -> bool
|
val equal : t -> t -> bool
|
||||||
val hash : t -> int
|
val hash : t -> int
|
||||||
end
|
end
|
||||||
|
|
||||||
module type S_consed =
|
module type S_consed =
|
||||||
sig
|
sig
|
||||||
type key
|
type key
|
||||||
val hashcons : key -> key hash_consed
|
val hashcons : key -> key hash_consed
|
||||||
val iter : (key hash_consed -> unit) -> unit
|
val iter : (key hash_consed -> unit) -> unit
|
||||||
val stats : unit -> int * int * int * int * int * int
|
val stats : unit -> int * int * int * int * int * int
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make_consed(H : HashedType_consed) : (S_consed with type key = H.t) =
|
module Make_consed(H : HashedType_consed) : (S_consed with type key = H.t) =
|
||||||
struct
|
struct
|
||||||
|
|
|
||||||
|
|
@ -33,15 +33,15 @@
|
||||||
more referenced from anywhere else can be erased by the GC. *)
|
more referenced from anywhere else can be erased by the GC. *)
|
||||||
|
|
||||||
module type HashedType =
|
module type HashedType =
|
||||||
sig
|
sig
|
||||||
type t
|
type t
|
||||||
val equal : t -> t -> bool
|
val equal : t -> t -> bool
|
||||||
val hash : t -> int
|
val hash : t -> int
|
||||||
val tag : int -> t -> t
|
val tag : int -> t -> t
|
||||||
end
|
end
|
||||||
|
|
||||||
module type S =
|
module type S =
|
||||||
sig
|
sig
|
||||||
type t
|
type t
|
||||||
|
|
||||||
val hashcons : t -> t
|
val hashcons : t -> t
|
||||||
|
|
@ -59,7 +59,7 @@ module type S =
|
||||||
table length, number of entries, sum of bucket lengths,
|
table length, number of entries, sum of bucket lengths,
|
||||||
smallest bucket length, median bucket length, biggest
|
smallest bucket length, median bucket length, biggest
|
||||||
bucket length. *)
|
bucket length. *)
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make(H : HashedType) : (S with type t = H.t)
|
module Make(H : HashedType) : (S with type t = H.t)
|
||||||
|
|
||||||
|
|
@ -79,14 +79,14 @@ type 'a hash_consed = private {
|
||||||
node : 'a }
|
node : 'a }
|
||||||
|
|
||||||
module type HashedType_consed =
|
module type HashedType_consed =
|
||||||
sig
|
sig
|
||||||
type t
|
type t
|
||||||
val equal : t -> t -> bool
|
val equal : t -> t -> bool
|
||||||
val hash : t -> int
|
val hash : t -> int
|
||||||
end
|
end
|
||||||
|
|
||||||
module type S_consed =
|
module type S_consed =
|
||||||
sig
|
sig
|
||||||
type key
|
type key
|
||||||
|
|
||||||
val hashcons : key -> key hash_consed
|
val hashcons : key -> key hash_consed
|
||||||
|
|
@ -104,6 +104,6 @@ module type S_consed =
|
||||||
table length, number of entries, sum of bucket lengths,
|
table length, number of entries, sum of bucket lengths,
|
||||||
smallest bucket length, median bucket length, biggest
|
smallest bucket length, median bucket length, biggest
|
||||||
bucket length. *)
|
bucket length. *)
|
||||||
end
|
end
|
||||||
|
|
||||||
module Make_consed(H : HashedType_consed) : (S_consed with type key = H.t)
|
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
|
module Make (F : Formula_intf.S) = struct
|
||||||
|
|
||||||
type formula = F.t
|
type formula = F.t
|
||||||
|
|
||||||
type var =
|
type var =
|
||||||
{ vid : int;
|
{ vid : int;
|
||||||
pa : atom;
|
pa : atom;
|
||||||
na : atom;
|
na : atom;
|
||||||
|
|
@ -37,7 +37,7 @@ type var =
|
||||||
mutable reason: reason;
|
mutable reason: reason;
|
||||||
mutable vpremise : premise}
|
mutable vpremise : premise}
|
||||||
|
|
||||||
and atom =
|
and atom =
|
||||||
{ var : var;
|
{ var : var;
|
||||||
lit : formula;
|
lit : formula;
|
||||||
neg : atom;
|
neg : atom;
|
||||||
|
|
@ -45,7 +45,7 @@ and atom =
|
||||||
mutable is_true : bool;
|
mutable is_true : bool;
|
||||||
aid : int }
|
aid : int }
|
||||||
|
|
||||||
and clause =
|
and clause =
|
||||||
{ name : string;
|
{ name : string;
|
||||||
mutable atoms : atom Vec.t ;
|
mutable atoms : atom Vec.t ;
|
||||||
mutable activity : float;
|
mutable activity : float;
|
||||||
|
|
@ -53,13 +53,13 @@ and clause =
|
||||||
learnt : bool;
|
learnt : bool;
|
||||||
cpremise : premise }
|
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;
|
{ vid = -101;
|
||||||
pa = dummy_atom;
|
pa = dummy_atom;
|
||||||
na = dummy_atom;
|
na = dummy_atom;
|
||||||
|
|
@ -68,14 +68,14 @@ let rec dummy_var =
|
||||||
weight = -1.;
|
weight = -1.;
|
||||||
seen = false;
|
seen = false;
|
||||||
vpremise = [] }
|
vpremise = [] }
|
||||||
and dummy_atom =
|
and dummy_atom =
|
||||||
{ var = dummy_var;
|
{ var = dummy_var;
|
||||||
lit = dummy_lit;
|
lit = dummy_lit;
|
||||||
watched = {Vec.dummy=dummy_clause; data=[||]; sz=0};
|
watched = {Vec.dummy=dummy_clause; data=[||]; sz=0};
|
||||||
neg = dummy_atom;
|
neg = dummy_atom;
|
||||||
is_true = false;
|
is_true = false;
|
||||||
aid = -102 }
|
aid = -102 }
|
||||||
and dummy_clause =
|
and dummy_clause =
|
||||||
{ name = "";
|
{ name = "";
|
||||||
atoms = {Vec.dummy=dummy_atom; data=[||]; sz=0};
|
atoms = {Vec.dummy=dummy_atom; data=[||]; sz=0};
|
||||||
activity = -1.;
|
activity = -1.;
|
||||||
|
|
@ -83,21 +83,21 @@ and dummy_clause =
|
||||||
learnt = false;
|
learnt = false;
|
||||||
cpremise = [] }
|
cpremise = [] }
|
||||||
|
|
||||||
module MA = F.Map
|
module MA = F.Map
|
||||||
type varmap = var MA.t
|
type varmap = var MA.t
|
||||||
|
|
||||||
let ale = Hstring.make "<="
|
let ale = Hstring.make "<="
|
||||||
let alt = Hstring.make "<"
|
let alt = Hstring.make "<"
|
||||||
let agt = Hstring.make ">"
|
let agt = Hstring.make ">"
|
||||||
let is_le n = Hstring.compare n ale = 0
|
let is_le n = Hstring.compare n ale = 0
|
||||||
let is_lt n = Hstring.compare n alt = 0
|
let is_lt n = Hstring.compare n alt = 0
|
||||||
let is_gt n = Hstring.compare n agt = 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 cpt_mk_var = ref 0
|
||||||
let ma = ref MA.empty
|
let ma = ref MA.empty
|
||||||
let make_var =
|
let make_var =
|
||||||
fun lit ->
|
fun lit ->
|
||||||
let lit, negated = normal_form lit in
|
let lit, negated = normal_form lit in
|
||||||
try MA.find lit !ma, negated
|
try MA.find lit !ma, negated
|
||||||
|
|
@ -131,13 +131,13 @@ let make_var =
|
||||||
incr cpt_mk_var;
|
incr cpt_mk_var;
|
||||||
var, negated
|
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
|
let var, negated = make_var lit in
|
||||||
if negated then var.na else var.pa
|
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
|
let atoms = Vec.from_list ali sz_ali dummy_atom in
|
||||||
{ name = name;
|
{ name = name;
|
||||||
atoms = atoms;
|
atoms = atoms;
|
||||||
|
|
@ -146,21 +146,21 @@ let make_clause name ali sz_ali is_learnt premise =
|
||||||
activity = 0.;
|
activity = 0.;
|
||||||
cpremise = premise}
|
cpremise = premise}
|
||||||
|
|
||||||
let fresh_lname =
|
let fresh_lname =
|
||||||
let cpt = ref 0 in
|
let cpt = ref 0 in
|
||||||
fun () -> incr cpt; "L" ^ (string_of_int !cpt)
|
fun () -> incr cpt; "L" ^ (string_of_int !cpt)
|
||||||
|
|
||||||
let fresh_dname =
|
let fresh_dname =
|
||||||
let cpt = ref 0 in
|
let cpt = ref 0 in
|
||||||
fun () -> incr cpt; "D" ^ (string_of_int !cpt)
|
fun () -> incr cpt; "D" ^ (string_of_int !cpt)
|
||||||
|
|
||||||
let fresh_name =
|
let fresh_name =
|
||||||
let cpt = ref 0 in
|
let cpt = ref 0 in
|
||||||
fun () -> incr cpt; "C" ^ (string_of_int !cpt)
|
fun () -> incr cpt; "C" ^ (string_of_int !cpt)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module Clause = struct
|
module Clause = struct
|
||||||
|
|
||||||
let size c = Vec.size c.atoms
|
let size c = Vec.size c.atoms
|
||||||
let pop c = Vec.pop 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 get c i = Vec.get c.atoms i
|
||||||
let set c i v = Vec.set c.atoms i v
|
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;
|
cpt_mk_var := 0;
|
||||||
ma := MA.empty
|
ma := MA.empty
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,10 +171,10 @@ module type S_Term = sig
|
||||||
val true_ : t
|
val true_ : t
|
||||||
val false_ : 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
|
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
|
end
|
||||||
|
|
||||||
module LT : S_Term = struct
|
module LT : S_Term = struct
|
||||||
|
|
@ -194,17 +194,17 @@ module LT : S_Term = struct
|
||||||
make (Eq (t1, Term.false_))
|
make (Eq (t1, Term.false_))
|
||||||
| _ -> L.neg a
|
| _ -> L.neg a
|
||||||
|
|
||||||
(* let terms_of a =
|
(* let terms_of a =
|
||||||
let l = match view a with
|
let l = match view a with
|
||||||
| Eq (t1, t2) -> [t1; t2]
|
| Eq (t1, t2) -> [t1; t2]
|
||||||
| Distinct (_, l) | Builtin (_, _, l) -> l
|
| Distinct (_, l) | Builtin (_, _, l) -> l
|
||||||
in
|
in
|
||||||
List.fold_left Term.subterms Term.Set.empty l
|
List.fold_left Term.subterms Term.Set.empty l
|
||||||
*)
|
*)
|
||||||
|
|
||||||
module SS = Symbols.Set
|
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
|
Term.Set.fold (fun t -> SS.union (Term.vars_of t)) (terms_of a) SS.empty
|
||||||
*)
|
*)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ module ST = T.Set
|
||||||
module SA = Set.Make(struct
|
module SA = Set.Make(struct
|
||||||
type t = Literal.LT.t * Explanation.t
|
type t = Literal.LT.t * Explanation.t
|
||||||
let compare (s1,_) (s2,_) = Literal.LT.compare s1 s2
|
let compare (s1,_) (s2,_) = Literal.LT.compare s1 s2
|
||||||
end)
|
end)
|
||||||
|
|
||||||
type elt = ST.t * SA.t
|
type elt = ST.t * SA.t
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ type elt = ST.t * SA.t
|
||||||
|
|
||||||
module Make :
|
module Make :
|
||||||
functor (X : Sig.X) ->
|
functor (X : Sig.X) ->
|
||||||
sig
|
sig
|
||||||
|
|
||||||
type t
|
type t
|
||||||
val empty : t
|
val empty : t
|
||||||
|
|
@ -35,4 +35,4 @@ sig
|
||||||
|
|
||||||
val up_close_up :t -> X.r -> X.r -> t
|
val up_close_up :t -> X.r -> X.r -> t
|
||||||
val congr_close_up : t -> X.r -> X.r list -> elt
|
val congr_close_up : t -> X.r -> X.r list -> elt
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue