From 164e5274e3135b245b8ce5576841bb6c329eecfe Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Thu, 30 Jan 2020 14:05:06 -0600 Subject: [PATCH] Ensure literals in FMF decision strategies are in the CNF stream (#3669) --- src/theory/decision_strategy.cpp | 9 +++++++-- test/regress/CMakeLists.txt | 1 + test/regress/regress0/fmf/issue3661-ccard-dec.smt2 | 11 +++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/regress/regress0/fmf/issue3661-ccard-dec.smt2 diff --git a/src/theory/decision_strategy.cpp b/src/theory/decision_strategy.cpp index b14936ee9..504cafc16 100644 --- a/src/theory/decision_strategy.cpp +++ b/src/theory/decision_strategy.cpp @@ -114,11 +114,16 @@ Node DecisionStrategyFmf::getLiteral(unsigned n) if (!lit.isNull()) { lit = Rewriter::rewrite(lit); - lit = d_valuation.ensureLiteral(lit); } d_literals.push_back(lit); } - return d_literals[n]; + Node ret = d_literals[n]; + if (!ret.isNull()) + { + // always ensure it is in the CNF stream + ret = d_valuation.ensureLiteral(ret); + } + return ret; } DecisionStrategySingleton::DecisionStrategySingleton( diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index c744227e4..74121ecbd 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -460,6 +460,7 @@ set(regress_0_tests regress0/fmf/fmc_unsound_model.smt2 regress0/fmf/fmf-strange-bounds-2.smt2 regress0/fmf/forall_unit_data2.smt2 + regress0/fmf/issue3661-ccard-dec.smt2 regress0/fmf/krs-sat.smt2 regress0/fmf/no-minimal-sat.smt2 regress0/fmf/quant_real_univ.cvc diff --git a/test/regress/regress0/fmf/issue3661-ccard-dec.smt2 b/test/regress/regress0/fmf/issue3661-ccard-dec.smt2 new file mode 100644 index 000000000..4b120fc9d --- /dev/null +++ b/test/regress/regress0/fmf/issue3661-ccard-dec.smt2 @@ -0,0 +1,11 @@ +; COMMAND-LINE: --fmf-fun -i +; EXPECT: sat +; EXPECT: sat +(set-logic ALL) +(declare-fun a (Int) Bool) +(declare-fun b (Int) Bool) +(assert (= (a 0) (b 0))) +(push) +(check-sat) +(pop) +(check-sat) -- 2.30.2