From 1744dc5f3140f9dc2aeb71f99c530feb83264a04 Mon Sep 17 00:00:00 2001 From: makaimann Date: Thu, 14 Mar 2019 00:08:15 -0700 Subject: [PATCH] check for null assumption in query and replace with false (#2858) The default assumption argument in query was a null `Expr`, but the implementation asserted that the assumption is not null: declaration: https://github.com/CVC4/CVC4/blob/68174dedcb4bf9d91241585ab1cc876d2fa83d62/src/smt/smt_engine.h#L593 implementation: https://github.com/CVC4/CVC4/blob/68174dedcb4bf9d91241585ab1cc876d2fa83d62/src/smt/smt_engine.cpp#L3548 The change is to simply check if the assumption is null and replaces it with the `false` expression if it is. It should be `false` not `true` because it is negated in checkSatisfiability (when it's a query) as seen here: https://github.com/CVC4/CVC4/blob/68174dedcb4bf9d91241585ab1cc876d2fa83d62/src/smt/smt_engine.cpp#L3607 Note: I couldn't find a clean way to make `false` the default argument of assumption, because the expression manager is non-static. --- src/smt/smt_engine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index bac2f2f50..9914992ef 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -3559,8 +3559,10 @@ Result SmtEngine::checkSat(const vector& assumptions, bool inUnsatCore) Result SmtEngine::query(const Expr& assumption, bool inUnsatCore) { - Assert(!assumption.isNull()); - return checkSatisfiability(assumption, inUnsatCore, true); + return checkSatisfiability( + assumption.isNull() ? d_exprManager->mkConst(false) : assumption, + inUnsatCore, + true); } Result SmtEngine::query(const vector& assumptions, bool inUnsatCore) -- 2.30.2