mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-07 03:35:38 -05:00
Fix for compilation on older ocaml compiler
This commit is contained in:
parent
e059441347
commit
c1af34823c
6 changed files with 37 additions and 13 deletions
|
|
@ -71,13 +71,21 @@ module Make(L : Log_intf.S)(St : Mcsolver_types.S) = struct
|
|||
let resolved, new_clause = aux [] [] l in
|
||||
resolved, List.rev new_clause
|
||||
|
||||
(* List.sort_uniq is only since 4.02.0 *)
|
||||
let sort_uniq compare l =
|
||||
let rec aux = function
|
||||
| x :: ((y :: _) as r) -> if compare x y = 0 then aux r else x :: aux r
|
||||
| l -> l
|
||||
in
|
||||
aux (List.sort compare l)
|
||||
|
||||
let to_list c =
|
||||
let v = St.(c.atoms) in
|
||||
let l = ref [] in
|
||||
for i = 0 to Vec.size v - 1 do
|
||||
l := (Vec.get v i) :: !l
|
||||
done;
|
||||
let res = List.sort_uniq compare_atoms !l in
|
||||
let res = sort_uniq compare_atoms !l in
|
||||
let l, _ = resolve res in
|
||||
if l <> [] then
|
||||
L.debug 3 "Input clause is a tautology";
|
||||
|
|
@ -251,7 +259,7 @@ module Make(L : Log_intf.S)(St : Mcsolver_types.S) = struct
|
|||
| Resolution (proof1, proof2, _) ->
|
||||
aux (aux acc proof1) proof2
|
||||
in
|
||||
List.sort_uniq compare_cl (aux [] proof)
|
||||
sort_uniq compare_cl (aux [] proof)
|
||||
|
||||
(* Print proof graph *)
|
||||
let _i = ref 0
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ Copyright 2014 Simon Cruanes
|
|||
|
||||
module type S = Res_intf.S
|
||||
|
||||
module Make : functor (L : Log_intf.S)(St : Mcsolver_types.S)
|
||||
-> S with type atom = St.atom and type clause = St.clause and type lemma = St.proof
|
||||
module Make :
|
||||
functor (L : Log_intf.S) ->
|
||||
functor (St : Mcsolver_types.S) ->
|
||||
S with type atom = St.atom and type clause = St.clause and type lemma = St.proof
|
||||
(** Functor to create a module building proofs from a sat-solver unsat trace. *)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@
|
|||
|
||||
module type S = Mcsolver_types_intf.S
|
||||
|
||||
module Make : functor (L : Log_intf.S)(E : Expr_intf.S)(Th : Plugin_intf.S with
|
||||
type term = E.Term.t and type formula = E.Formula.t)
|
||||
-> S with type term = E.Term.t and type formula = E.Formula.t and type proof = Th.proof
|
||||
module Make :
|
||||
functor (L : Log_intf.S) ->
|
||||
functor (E : Expr_intf.S) ->
|
||||
functor (Th : Plugin_intf.S with type term = E.Term.t and type formula = E.Formula.t) ->
|
||||
S with type term = E.Term.t and type formula = E.Formula.t and type proof = Th.proof
|
||||
(** Functor to instantiate the types of clauses for the Solver. *)
|
||||
|
|
|
|||
|
|
@ -71,13 +71,21 @@ module Make(L : Log_intf.S)(St : Solver_types.S) = struct
|
|||
let resolved, new_clause = aux [] [] l in
|
||||
resolved, List.rev new_clause
|
||||
|
||||
(* List.sort_uniq is only since 4.02.0 *)
|
||||
let sort_uniq compare l =
|
||||
let rec aux = function
|
||||
| x :: ((y :: _) as r) -> if compare x y = 0 then aux r else x :: aux r
|
||||
| l -> l
|
||||
in
|
||||
aux (List.sort compare l)
|
||||
|
||||
let to_list c =
|
||||
let v = St.(c.atoms) in
|
||||
let l = ref [] in
|
||||
for i = 0 to Vec.size v - 1 do
|
||||
l := (Vec.get v i) :: !l
|
||||
done;
|
||||
let l, res = resolve (List.sort_uniq compare_atoms !l) in
|
||||
let l, res = resolve (sort_uniq compare_atoms !l) in
|
||||
if l <> [] then
|
||||
raise (Resolution_error "Input clause is a tautology");
|
||||
res
|
||||
|
|
@ -250,7 +258,7 @@ module Make(L : Log_intf.S)(St : Solver_types.S) = struct
|
|||
| Resolution (proof1, proof2, _) ->
|
||||
aux (aux acc proof1) proof2
|
||||
in
|
||||
List.sort_uniq compare_cl (aux [] proof)
|
||||
sort_uniq compare_cl (aux [] proof)
|
||||
|
||||
(* Print proof graph *)
|
||||
let _i = ref 0
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ Copyright 2014 Simon Cruanes
|
|||
|
||||
module type S = Res_intf.S
|
||||
|
||||
module Make : functor (L : Log_intf.S)(St : Solver_types.S)
|
||||
-> S with type atom= St.atom and type clause = St.clause and type lemma = St.proof
|
||||
module Make :
|
||||
functor (L : Log_intf.S) ->
|
||||
functor (St : Solver_types.S) ->
|
||||
S with type atom= St.atom and type clause = St.clause and type lemma = St.proof
|
||||
(** Functor to create a module building proofs from a sat-solver unsat trace. *)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
module type S = Solver_types_intf.S
|
||||
|
||||
module Make : functor (F : Formula_intf.S)(Th : Theory_intf.S)
|
||||
-> S with type formula = F.t and type proof = Th.proof
|
||||
module Make :
|
||||
functor (F : Formula_intf.S) ->
|
||||
functor (Th : Theory_intf.S) ->
|
||||
S with type formula = F.t and type proof = Th.proof
|
||||
(** Functor to instantiate the types of clauses for the Solver. *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue