mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-08 04:05:43 -05:00
Indentation + some debug output in res.ml
This commit is contained in:
parent
a13029f96c
commit
62835b35d0
9 changed files with 263 additions and 257 deletions
24
sat/res.ml
24
sat/res.ml
|
|
@ -43,6 +43,15 @@ module Make(St : Solver_types.S)(Proof : sig type proof end) = struct
|
|||
let equal_atoms a b = St.(a.aid) = St.(b.aid)
|
||||
let compare_atoms a b = Pervasives.compare St.(a.aid) St.(b.aid)
|
||||
|
||||
(* Printing functions *)
|
||||
let print_atom fmt a =
|
||||
Format.fprintf fmt "%s%d" St.(if a.var.pa == a then "" else "-") St.(a.var.vid + 1)
|
||||
|
||||
let rec print_cl fmt = function
|
||||
| [] -> Format.fprintf fmt "[]"
|
||||
| [a] -> print_atom fmt a
|
||||
| a :: ((_ :: _) as r) -> Format.fprintf fmt "%a \\/ %a" print_atom a print_cl r
|
||||
|
||||
(* Compute resolution of 2 clauses *)
|
||||
let resolve l =
|
||||
let rec aux resolved acc = function
|
||||
|
|
@ -93,7 +102,12 @@ module Make(St : Solver_types.S)(Proof : sig type proof end) = struct
|
|||
match l with
|
||||
| a :: ((_ :: _) as r) ->
|
||||
let new_c, new_cl = List.fold_left add_res a r in
|
||||
assert (equal_cl cl new_cl)
|
||||
if not (equal_cl cl new_cl) then begin
|
||||
Log.debug 0 "Expected the following clauses to be equal :";
|
||||
Log.debug 0 "expected : %s" (Log.on_fmt print_cl cl);
|
||||
Log.debug 0 "found : %a" St.pp_clause new_c;
|
||||
assert false
|
||||
end
|
||||
| _ -> assert false
|
||||
|
||||
let need_clause (c, cl) =
|
||||
|
|
@ -209,14 +223,6 @@ module Make(St : Solver_types.S)(Proof : sig type proof end) = struct
|
|||
assert (not b);
|
||||
Hashtbl.replace ids c (true, id)
|
||||
|
||||
let print_atom fmt a =
|
||||
Format.fprintf fmt "%s%d" St.(if a.var.pa == a then "" else "-") St.(a.var.vid + 1)
|
||||
|
||||
let rec print_cl fmt = function
|
||||
| [] -> Format.fprintf fmt "[]"
|
||||
| [a] -> print_atom fmt a
|
||||
| a :: ((_ :: _) as r) -> Format.fprintf fmt "%a \\/ %a" print_atom a print_cl r
|
||||
|
||||
let print_clause fmt c = print_cl fmt (to_list c)
|
||||
|
||||
let print_dot_rule f arg fmt cl =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue