d_produceAssertions(false),
d_assertionList(userContext()),
d_assertionListDefs(userContext()),
+ d_globalDefineFunLemmasIndex(userContext(), 0),
d_globalNegation(false),
d_assertions()
{
{
}
+void Assertions::refresh()
+{
+ if (d_globalDefineFunLemmas != nullptr)
+ {
+ // Global definitions are asserted now to ensure they always exist. This is
+ // done at the beginning of preprocessing, to ensure that definitions take
+ // priority over, e.g. solving during preprocessing. See issue #7479.
+ size_t numGlobalDefs = d_globalDefineFunLemmas->size();
+ for (size_t i = d_globalDefineFunLemmasIndex.get(); i < numGlobalDefs; i++)
+ {
+ addFormula((*d_globalDefineFunLemmas)[i], false, true, false);
+ }
+ d_globalDefineFunLemmasIndex = numGlobalDefs;
+ }
+}
+
void Assertions::finishInit()
{
// [MGD 10/20/2011] keep around in incremental mode, due to a
ensureBoolean(n);
addFormula(n, true, false, false);
}
- if (d_globalDefineFunLemmas != nullptr)
- {
- // Global definitions are asserted at check-sat-time because we have to
- // make sure that they are always present (they are essentially level
- // zero assertions)
- for (const Node& lemma : *d_globalDefineFunLemmas)
- {
- addFormula(lemma, false, true, false);
- }
- }
}
void Assertions::assertFormula(const Node& n)
#include <vector>
#include "context/cdlist.h"
+#include "context/cdo.h"
#include "expr/node.h"
#include "preprocessing/assertion_pipeline.h"
#include "smt/env_obj.h"
* without a check-sat.
*/
void clearCurrent();
+ /** refresh
+ *
+ * Ensures that all global declarations have been processed in the current
+ * context. This may trigger substitutions to be added to the top-level
+ * substitution and/or formulas added to the current set of assertions.
+ *
+ * If global declarations are true, this method must be called before
+ * processing assertions.
+ */
+ void refresh();
/*
* Initialize a call to check satisfiability. This adds assumptions to
* the list of assumptions maintained by this class, and finalizes the
* assert this list of definitions in each check-sat call.
*/
std::unique_ptr<std::vector<Node>> d_globalDefineFunLemmas;
+ /** The index of the above list that we have processed */
+ context::CDO<size_t> d_globalDefineFunLemmasIndex;
/**
* The list of assumptions from the previous call to checkSatisfiability.
* Note that if the last call to checkSatisfiability was an entailment check,
regress0/push-pop/issue1986.smt2
regress0/push-pop/issue2137.min.smt2
regress0/push-pop/issue6535-inc-solve.smt2
+ regress0/push-pop/issue7479-global-decls.smt2
regress0/push-pop/quant-fun-proc-unfd.smt2
regress0/push-pop/real-as-int-incremental.smt2
regress0/push-pop/simple_unsat_cores.smt2