From 10507bb67177a1e52bdd89535c3c6d77cc62507a Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Wed, 11 Mar 2020 10:13:24 -0500 Subject: [PATCH] Fix duplicate variable issue in sygus-qe-preproc (#4013) --- src/theory/quantifiers/single_inv_partition.cpp | 2 +- src/theory/quantifiers/single_inv_partition.h | 2 +- test/regress/CMakeLists.txt | 1 + test/regress/regress1/sygus/issue4009-qep.smt2 | 7 +++++++ 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 test/regress/regress1/sygus/issue4009-qep.smt2 diff --git a/src/theory/quantifiers/single_inv_partition.cpp b/src/theory/quantifiers/single_inv_partition.cpp index a0e25b756..50831fdac 100644 --- a/src/theory/quantifiers/single_inv_partition.cpp +++ b/src/theory/quantifiers/single_inv_partition.cpp @@ -346,7 +346,7 @@ bool SingleInvocationPartition::init(std::vector& funcs, d_conjuncts[2].push_back(cr); std::unordered_set fvs; expr::getFreeVariables(cr, fvs); - d_all_vars.insert(d_all_vars.end(), fvs.begin(), fvs.end()); + d_all_vars.insert(fvs.begin(), fvs.end()); if (singleInvocation) { // replace with single invocation formulation diff --git a/src/theory/quantifiers/single_inv_partition.h b/src/theory/quantifiers/single_inv_partition.h index 0a4af3185..cdc56d1f0 100644 --- a/src/theory/quantifiers/single_inv_partition.h +++ b/src/theory/quantifiers/single_inv_partition.h @@ -201,7 +201,7 @@ class SingleInvocationPartition std::vector d_si_vars; /** every free variable of conjuncts[2] */ - std::vector d_all_vars; + std::unordered_set d_all_vars; /** map from functions to first-order variables that anti-skolemized them */ std::map d_func_fo_var; /** map from first-order variables to the function it anti-skolemized */ diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index 15728ec1d..83d9ac48c 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -1855,6 +1855,7 @@ set(regress_1_tests regress1/sygus/issue3839-cond-rewrite.smt2 regress1/sygus/issue3944-div-rewrite.smt2 regress1/sygus/issue3947-agg-miniscope.smt2 + regress1/sygus/issue4009-qep.smt2 regress1/sygus/large-const-simp.sy regress1/sygus/let-bug-simp.sy regress1/sygus/list-head-x.sy diff --git a/test/regress/regress1/sygus/issue4009-qep.smt2 b/test/regress/regress1/sygus/issue4009-qep.smt2 new file mode 100644 index 000000000..6f17a0c04 --- /dev/null +++ b/test/regress/regress1/sygus/issue4009-qep.smt2 @@ -0,0 +1,7 @@ +; EXPECT: unsat +; COMMAND-LINE: --sygus-inference --sygus-qe-preproc +(set-logic ALL) +(declare-fun a () Real) +(declare-fun b () Real) +(assert (forall ((c Real)) (and (xor (> c a) (= b 0)) (distinct (+ a b) 0)))) +(check-sat) -- 2.30.2