Skip to content
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

Fix issue 719 #739

Merged
merged 4 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/bin/common/solving_loop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ let main () =
Options.Time.set_timeout (Options.get_timelimit ());
end;
SAT.reset_refs ();
let partial_model, _, _ =
let partial_model, consistent, _ =
List.fold_left
(FE.process_decl FE.print_status used_context consistent_dep_stack)
(SAT.empty (), true, Explanation.empty) cnf
Expand All @@ -93,7 +93,12 @@ let main () =
(Steps.get_steps ())
(Signals_profiling.get_timers ())
(Options.Output.get_fmt_err ());
Some partial_model
(* If the status of the SAT environment is inconsistent,
we have to drop the partial model in order to prevent
printing wrong model. *)
if consistent then
Some partial_model
else None
with Util.Timeout ->
if not (Options.get_timelimit_per_goal()) then exit 142;
None
Expand Down
3 changes: 3 additions & 0 deletions tests/models/issues/719.models.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

unsat
(error "No model produced.")
18 changes: 18 additions & 0 deletions tests/models/issues/719.models.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(set-logic ALL)
(set-option :produce-models true)
(declare-const a (Array Int Int))
(declare-const s Int)
(assert (and (<= 0 s) (<= s 10)))
(assert (forall ((k Int)) (=> (and (<= 0 k) (< k s)) (<= (select a k) (select a s)))))
(assert (forall ((k Int)) (=> (and (< s k) (<= k 10)) (<= (select a s) (select a k)))))
(assert (
forall ((p Int) (q Int))
(=> (and (<= 0 p) (< p q) (<= q (- s 1))) (<= (select a p) (select a q)))))
(assert (
forall ((p Int) (q Int))
(=> (and (<= (+ s 1) p) (< p q) (<= q 10)) (<= (select a p) (select a q)))))
(assert (not (
forall ((p Int) (q Int))
(=> (and (<= 0 p) (< p q) (<= q 10)) (<= (select a p) (select a q))))))
(check-sat)
(get-model)
Loading