Fixes #4437.
This is a simpler fix that aborts the preprocessing pass when a quantifier is encountered.
It also updates our smt2 parser to throw a logic exception when forall/exists is used in non-quantified logics. This is required to ensure that unconstrained simplification does not throw an exception to a user as a result of accidentally setting the wrong logic.
long = "unconstrained-simp"
type = "bool"
default = "false"
- help = "turn on unconstrained simplification (see Bruttomesso/Brummayer PhD thesis)"
+ help = "turn on unconstrained simplification (see Bruttomesso/Brummayer PhD thesis). Fully supported only in (subsets of) the logic QF_ABV."
[[option]]
name = "repeatSimp"
std::vector<api::Sort> argTypes;
}
: LPAREN_TOK quantOp[kind]
- { PARSER_STATE->pushScope(true); }
+ {
+ if (!PARSER_STATE->isTheoryEnabled(theory::THEORY_QUANTIFIERS))
+ {
+ PARSER_STATE->parseError("Quantifier used in non-quantified logic.");
+ }
+ PARSER_STATE->pushScope(true);
+ }
boundVarList[bvl]
term[f, f2] RPAREN_TOK
{
d_unconstrained.insert(current);
}
}
+ else if (current.isClosure())
+ {
+ // Throw an exception. This should never happen in practice unless the
+ // user specifically enabled unconstrained simplification in an illegal
+ // logic.
+ throw LogicException(
+ "Cannot use unconstrained simplification in this logic, due to "
+ "(possibly internally introduced) quantified formula.");
+ }
else
{
for (TNode childNode : current)
theory::SubstitutionMap d_substitutions;
const LogicInfo& d_logicInfo;
-
+ /**
+ * Visit all subterms in assertion. This method throws a LogicException if
+ * there is a subterm that is unhandled by this preprocessing pass (e.g. a
+ * quantified formula).
+ */
void visitAll(TNode assertion);
Node newUnconstrainedVar(TypeNode t, TNode var);
void processUnconstrained();
regress0/quantifiers/issue3655.smt2
regress0/quantifiers/issue4086-infs.smt2
regress0/quantifiers/issue4275-qcf-cegqi-rep.smt2
+ regress0/quantifiers/issue4437-unc-quant.smt2
regress0/quantifiers/issue4476-ext-rew.smt2
regress0/quantifiers/lra-triv-gn.smt2
regress0/quantifiers/macros-int-real.smt2
regress0/uflra/simple.03.cvc
regress0/uflra/simple.04.cvc
regress0/unconstrained/4481.smt2
- regress0/unconstrained/4484.smt2
- regress0/unconstrained/4486.smt2
regress0/unconstrained/arith.smt2
regress0/unconstrained/arith3.smt2
regress0/unconstrained/arith4.smt2
--- /dev/null
+; EXPECT: (error "Parse Error: issue4437-unc-quant.smt2:6.15: Quantifier used in non-quantified logic.")
+; EXIT: 1
+(set-logic QF_AUFBVLIA)
+(declare-fun a () (_ BitVec 8))
+(declare-fun b () (_ BitVec 8))
+(assert (forall ((c (_ BitVec 8))) (= (bvashr c a) b)))
+(check-sat)
; COMMAND-LINE: --unconstrained-simp
-; EXPECT: unsat
+; EXPECT: (error "Cannot use unconstrained simplification in this logic, due to (possibly internally introduced) quantified formula.")
+; EXIT: 1
(set-logic ALL)
(set-info :status unsat)
(declare-fun a () Int)
+++ /dev/null
-; COMMAND-LINE: --unconstrained-simp
-; EXPECT: unsat
-(set-logic QF_NIRA)
-(set-info :status unsat)
-(declare-fun a () Real)
-(assert (= (to_int a) 2))
-(assert (= (to_int (/ a 2.0)) 2))
-(check-sat)
+++ /dev/null
-; COMMAND-LINE: --unconstrained-simp
-; EXPECT: sat
-(set-logic ALL)
-(set-info :status sat)
-(declare-fun x () Real)
-(assert (is_int x))
-(assert (is_int (+ x 1)))
-(check-sat)
(set-info :smt-lib-version 2.6)
-(set-logic QF_SLIA)
+(set-logic SLIA)
(set-info :status unsat)
(set-option :strings-exp true)