-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bubble printing model #932
Changes from 4 commits
f934b75
c8e4fa1
dbfed1b
29c3841
9cc2fd6
1b77978
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,6 +153,23 @@ let main () = | |
O.get_sat_solver (), | ||
(module SatCont.Make(TH) : Sat_solver_sig.S) | ||
in | ||
|
||
let print_model ppf (Model ((module SAT), env)) = | ||
let ur = SAT.get_unknown_reason env in | ||
Printer.print_fmt (Options.Output.get_fmt_diagnostic ()) | ||
"@[<v 0>; Returned unknown reason = %a@]" | ||
Sat_solver_sig.pp_unknown_reason_opt ur; | ||
match SAT.get_model env with | ||
| None -> | ||
Printer.print_fmt (Options.Output.get_fmt_diagnostic ()) | ||
"@[<v 0>It seems that no model has been computed so \ | ||
bclement-ocp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
far. You may need to change your model generation strategy \ | ||
or to increase your timeouts." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why change the error message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't change it but I print the timeout reason just before. Now, if we don't print always the |
||
|
||
| Some (lazy model) -> | ||
Models.output_concrete_model ppf model | ||
in | ||
|
||
let solve (module SAT : Sat_solver_sig.S) all_context (cnf, goal_name) = | ||
let module FE = Frontend.Make (SAT) in | ||
if Options.get_debug_commands () then | ||
|
@@ -186,7 +203,12 @@ let main () = | |
printing wrong model. *) | ||
match ftdn_env.FE.res with | ||
| `Sat partial_model | `Unknown partial_model -> | ||
Some (Model ((module SAT), partial_model)) | ||
begin | ||
let mdl = Model ((module SAT), partial_model) in | ||
if Options.(get_interpretation () && get_dump_models ()) then | ||
print_model (Options.Output.get_fmt_models ()) mdl; | ||
Some mdl | ||
end | ||
| `Unsat -> None | ||
with Util.Timeout -> | ||
if not (Options.get_timelimit_per_goal()) then exit_as_timeout (); | ||
|
@@ -675,10 +697,8 @@ let main () = | |
| Some Model ((module SAT), sat) -> | ||
match SAT.get_unknown_reason sat with | ||
| None -> err () | ||
| Some s -> | ||
print_std | ||
Format.pp_print_string | ||
(Frontend.unknown_reason_to_string s) | ||
| Some ur -> | ||
print_std Sat_solver_sig.pp_unknown_reason ur | ||
in | ||
match name with | ||
| ":authors" -> | ||
|
@@ -837,21 +857,14 @@ let main () = | |
|
||
| {contents = `Get_model; _ } -> | ||
if Options.get_interpretation () then | ||
match State.get partial_model_key st with | ||
| Some Model ((module SAT), partial_model) -> | ||
begin | ||
match SAT.get_model partial_model with | ||
| Some (lazy model) -> | ||
Models.output_concrete_model | ||
(Options.Output.get_fmt_regular ()) model; | ||
st | ||
| _ -> | ||
(* TODO: is it reachable? *) | ||
st | ||
end | ||
| None -> | ||
(* TODO: add the location of the statement. *) | ||
recoverable_error "No model produced."; st | ||
let _ = match State.get partial_model_key st with | ||
| Some model -> | ||
print_model (Options.Output.get_fmt_regular ()) model | ||
| None -> | ||
(* TODO: add the location of the statement. *) | ||
recoverable_error "No model produced." | ||
in | ||
st | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not convinced we should print the unknown reason when we have a model, it will just be noise. If the user wants to see the unkonwn reason, they can call (For |
||
else | ||
begin | ||
(* TODO: add the location of the statement. *) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,12 +35,22 @@ type timeout_reason = | |
| Assume | ||
| ProofSearch | ||
| ModelGen | ||
[@@deriving show] | ||
|
||
type unknown_reason = | ||
| Incomplete | ||
| Memout | ||
| Timeout of timeout_reason | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure to understand your remark :D |
||
|
||
let pp_unknown_reason ppf = function | ||
| Incomplete -> Fmt.pf ppf "Incomplete" | ||
| Memout -> Fmt.pf ppf "Memout" | ||
| Timeout t -> Fmt.pf ppf "Timeout:%a" pp_timeout_reason t | ||
|
||
let pp_unknown_reason_opt ppf = function | ||
| None -> Fmt.pf ppf "Decided" | ||
| Some ur -> pp_unknown_reason ppf ur | ||
|
||
module type S = sig | ||
type t | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There shouldn't be
;
comments on the diagnostic channel.