From d552ca179b8723a93c6e0dae61242ceb1ccaa717 Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Mon, 27 Nov 2017 19:23:49 -0600 Subject: [PATCH] Fix models for --solve-real-as-int. (#1371) --- src/smt/smt_engine.cpp | 2 ++ test/regress/regress0/nl/Makefile.am | 1 + test/regress/regress0/nl/real-as-int.smt2 | 10 ++++++++++ 3 files changed, 13 insertions(+) create mode 100644 test/regress/regress0/nl/real-as-int.smt2 diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index 1a35c9901..65dae6b8f 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -2805,6 +2805,8 @@ Node SmtEnginePrivate::realToInt(TNode n, NodeMap& cache, std::vector< Node >& v if( !n.getType().isInteger() ){ ret = NodeManager::currentNM()->mkSkolem("__realToInt_var", NodeManager::currentNM()->integerType(), "Variable introduced in realToInt pass"); var_eq.push_back( n.eqNode( ret ) ); + TheoryModel* m = d_smt.d_theoryEngine->getModel(); + m->addSubstitution(n,ret); } } } diff --git a/test/regress/regress0/nl/Makefile.am b/test/regress/regress0/nl/Makefile.am index 9881b3e72..9fb581565 100644 --- a/test/regress/regress0/nl/Makefile.am +++ b/test/regress/regress0/nl/Makefile.am @@ -51,6 +51,7 @@ TESTS = \ div-mod-partial.smt2 \ all-logic.smt2 \ sqrt-problem-1.smt2 \ + real-as-int.smt2 \ nta/bad-050217.smt2 \ nta/cos-bound.smt2 \ nta/cos-sig-value.smt2 \ diff --git a/test/regress/regress0/nl/real-as-int.smt2 b/test/regress/regress0/nl/real-as-int.smt2 new file mode 100644 index 000000000..9599b6e6b --- /dev/null +++ b/test/regress/regress0/nl/real-as-int.smt2 @@ -0,0 +1,10 @@ +; COMMAND-LINE: --solve-real-as-int +; EXPECT: sat +(set-logic QF_NRA) +(set-info :status sat) +(declare-fun a () Real) +(declare-fun b () Real) +(assert (= (* a a) 4)) +(assert (= (* b b) 0)) +(assert (= (+ (* a a) (* b b)) 4)) +(check-sat) -- 2.30.2