diff options
Diffstat (limited to 'src/trace')
-rw-r--r-- | src/trace/smtCertif.ml | 31 | ||||
-rw-r--r-- | src/trace/smtCertif.mli | 1 | ||||
-rw-r--r-- | src/trace/smtForm.ml | 4 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/trace/smtCertif.ml b/src/trace/smtCertif.ml index a0af59d..275f6d1 100644 --- a/src/trace/smtCertif.ml +++ b/src/trace/smtCertif.ml @@ -146,7 +146,7 @@ let used_clauses r = | EqTr _ | EqCgr _ | EqCgrP _ | LiaMicromega _ | LiaDiseq _ -> [] -(* for debugging *) +(* For debugging certif processing purposes : <add_scertif> <select> <occur> <alloc> *) let to_string r = match r with Root -> "Root" @@ -181,3 +181,32 @@ let to_string r = | Forall_inst _ -> "Forall_inst" end ^ ")" + +(* To use <print_certif>, pass, as first and second argument, <Form.to_smt> and <Atom.to_string> *) +let print_certif form_to_smt atom_to_string c where= + let rec start c = + match c.prev with + | None -> c + | Some c -> start c in + let r = ref (start c) in + let out_channel = open_out where in + let fmt = Format.formatter_of_out_channel out_channel in + let continue = ref true in + while !continue do + let kind = to_string (!r.kind) in + let id = !r.id in + let pos = match !r.pos with + | None -> "None" + | Some p -> string_of_int p in + let used = !r.used in + Format.fprintf fmt "id:%i kind:%s pos:%s used:%i value:" id kind pos used; + begin match !r.value with + | None -> Format.fprintf fmt "None" + | Some l -> List.iter (fun f -> form_to_smt atom_to_string fmt f; + Format.fprintf fmt " ") l end; + Format.fprintf fmt "\n"; + match !r.next with + | None -> continue := false + | Some n -> r := n + done; + Format.fprintf fmt "@."; close_out out_channel diff --git a/src/trace/smtCertif.mli b/src/trace/smtCertif.mli index 942262c..010934a 100644 --- a/src/trace/smtCertif.mli +++ b/src/trace/smtCertif.mli @@ -44,3 +44,4 @@ and 'hform resolution = { } val used_clauses : 'a rule -> 'a clause list val to_string : 'a clause_kind -> string +val print_certif : ('a -> Format.formatter -> 'b -> 'c) -> 'a -> 'b clause -> string -> unit diff --git a/src/trace/smtForm.ml b/src/trace/smtForm.ml index c408343..d2e039b 100644 --- a/src/trace/smtForm.ml +++ b/src/trace/smtForm.ml @@ -449,7 +449,9 @@ module Make (Atom:ATOM) = (** Producing Coq terms *) - let to_coq hf = mkInt (to_lit hf) + let to_coq hf = let i = to_lit hf in + if i < 0 then failwith "This formula should'nt be in Coq" + else mkInt i let args_to_coq args = let cargs = Array.make (Array.length args + 1) (mkInt 0) in |