This enables the new implementation of justification heuristic by default.
Fixes #5454, fixes #5785. Fixes wishues 114, 115, 149, 160.
finishwith --decision=justification-stoponly --no-arrays-eager-index --arrays-eager-lemmas
;;
QF_S|QF_SLIA)
- trywith 300 --strings-exp --rewrite-divk --strings-fmf
- finishwith --strings-exp --rewrite-divk
+ trywith 300 --strings-exp --rewrite-divk --strings-fmf --no-jh-rlv-order
+ finishwith --strings-exp --rewrite-divk --no-jh-rlv-order
;;
QF_ABVFP|QF_ABVFPLRA)
finishwith --fp-exp
prop::SkolemDefManager* skdm,
ResourceManager* rm)
: d_decEngineOld(new DecisionEngineOld(c, u)),
+ d_jstrat(new JustificationStrategy(c, u, skdm)),
d_resourceManager(rm),
- d_useOld(true)
+ d_useOld(options::decisionMode() != options::DecisionMode::JUSTIFICATION)
{
}
d_decEngineOld->setCnfStream(cs);
return;
}
+ d_jstrat->finishInit(ss, cs);
}
-void DecisionEngine::presolve() {}
+void DecisionEngine::presolve()
+{
+ if (!d_useOld)
+ {
+ d_jstrat->presolve();
+ }
+}
prop::SatLiteral DecisionEngine::getNext(bool& stopSearch)
{
{
return d_decEngineOld->getNext(stopSearch);
}
- return undefSatLiteral;
+ return d_jstrat->getNext(stopSearch);
}
bool DecisionEngine::isDone()
{
return d_decEngineOld->isDone();
}
- return false;
+ return d_jstrat->isDone();
}
void DecisionEngine::addAssertion(TNode assertion)
d_decEngineOld->addAssertion(assertion);
return;
}
+ d_jstrat->addAssertion(assertion);
}
void DecisionEngine::addSkolemDefinition(TNode lem, TNode skolem)
{
d_decEngineOld->addSkolemDefinition(lem, skolem);
}
+ else
+ {
+ d_jstrat->addSkolemDefinition(lem, skolem);
+ }
}
void DecisionEngine::notifyAsserted(TNode n)
{
return;
}
+ // old implementation does not use this
+ d_jstrat->notifyAsserted(n);
}
} // namespace decision
#ifndef CVC5__DECISION__DECISION_ENGINE_H
#define CVC5__DECISION__DECISION_ENGINE_H
+#include "decision/justification_strategy.h"
#include "expr/node.h"
#include "prop/cnf_stream.h"
#include "prop/sat_solver.h"
*/
void addAssertion(TNode assertion);
/**
- * TODO: remove this interface
+ * !!!! temporary until the old justification implementation is deleted.
* Notify this class that lem is the skolem definition for skolem, which is
* a part of the current assertions.
*/
private:
/** The old implementation */
std::unique_ptr<DecisionEngineOld> d_decEngineOld;
+ /** The new implementation */
+ std::unique_ptr<JustificationStrategy> d_jstrat;
/** Pointer to resource manager for associated SmtEngine */
ResourceManager* d_resourceManager;
/** using old implementation? */
d_stack.clear();
}
-SatLiteral JustificationStrategy::getNext()
+SatLiteral JustificationStrategy::getNext(bool& stopSearch)
{
// ensure we have an assertion
if (!refreshCurrentAssertion())
{
Trace("jh-process") << "getNext, already finished" << std::endl;
+ stopSearch = true;
return undefSatLiteral;
}
Assert(d_stack.hasCurrentAssertion());
} while (d_stack.hasCurrentAssertion());
// we exhausted all assertions
Trace("jh-process") << "...exhausted all assertions" << std::endl;
+ stopSearch = true;
return undefSatLiteral;
}
void JustificationStrategy::addAssertion(TNode assertion)
{
+ Trace("jh-assert") << "addAssertion " << assertion << std::endl;
std::vector<TNode> toProcess;
toProcess.push_back(assertion);
insertToAssertionList(toProcess, false);
void JustificationStrategy::addSkolemDefinition(TNode lem, TNode skolem)
{
+ Trace("jh-assert") << "addSkolemDefinition " << lem << " / " << skolem
+ << std::endl;
if (d_jhSkRlvMode == options::JutificationSkolemRlvMode::ALWAYS)
{
// just add to main assertions list
bool JustificationStrategy::refreshCurrentAssertion()
{
+ Trace("jh-process") << "refreshCurrentAssertion" << std::endl;
// if we already have a current assertion, nothing to be done
TNode curr = d_stack.getCurrentAssertion();
if (!curr.isNull())
SatValue currValue;
while (!curr.isNull())
{
+ Trace("jh-process") << "Check assertion " << curr << std::endl;
// we never add theory literals to our assertions lists
Assert(!isTheoryLiteral(curr));
currValue = lookupValue(curr);
* all relevant input assertions are already propositionally satisfied by
* the current assignment.
*
+ * @param stopSearch Set to true if we can stop the search
* @return The next SAT literal to decide on.
*/
- prop::SatLiteral getNext();
+ prop::SatLiteral getNext(bool& stopSearch);
/**
* Are we finished assigning values to literals?
[[option.mode.JUSTIFICATION]]
name = "justification"
help = "An ATGP-inspired justification heuristic."
+[[option.mode.JUSTIFICATION_OLD]]
+ name = "justification-old"
+ help = "Older implementation of an ATGP-inspired justification heuristic."
[[option.mode.RELEVANCY]]
name = "justification-stoponly"
help = "Use the justification heuristic only to stop early, not for decisions."
category = "expert"
long = "jh-rlv-order"
type = "bool"
- default = "false"
+ default = "true"
help = "maintain activity-based ordering for decision justification heuristic"
[[option]]
// If this was a final check, we are satisfiable
if (check_type == CHECK_FINAL)
{
- bool decisionEngineDone = d_proxy->isDecisionEngineDone();
+ // Note that we are done making decisions when there are no pending decisions
+ // on assumptions, and the decision engine indicates it is done.
+ bool decisionEngineDone = (decisionLevel() >= assumptions.size())
+ && d_proxy->isDecisionEngineDone();
// Unless a lemma has added more stuff to the queues
if (!decisionEngineDone
&& (!order_heap.empty() || qhead < trail.size()))
TNode assertion = d_queue.front();
d_queue.pop();
d_theoryEngine->assertFact(assertion);
+ d_decisionEngine->notifyAsserted(assertion);
}
d_theoryEngine->check(effort);
}
}
// should give a proof, if not, then tcpg does not agree with the
// substitution.
- Assert(pfn != nullptr);
if (pfn == nullptr)
{
- AlwaysAssert(false) << "resort to TRUST_SUBS" << std::endl
- << eq << std::endl
- << eqq << std::endl
- << "from " << children << " applied to " << t;
+ Warning() << "resort to TRUST_SUBS" << std::endl
+ << eq << std::endl
+ << eqq << std::endl
+ << "from " << children << " applied to " << t << std::endl;
cdp->addStep(eqq, PfRule::TRUST_SUBS, {}, {eqq});
}
else
regress1/datatypes/tuple_projection.smt2
regress1/decision/bug374a.smtv1.smt2
regress1/decision/error3.smtv1.smt2
+ regress1/decision/issue5454-2.smt2
+ regress1/decision/issue5454-3.smt2
+ regress1/decision/issue5454.smt2
+ regress1/decision/issue5785.smt2
+ regress1/decision/jh-test1.smt2
regress1/decision/quant-Arrays_Q1-noinfer.smt2
+ regress1/decision/wishue114.smt2
+ regress1/decision/wishue115.smt2
+ regress1/decision/wishue116.smt2
+ regress1/decision/wishue149-2.smt2
+ regress1/decision/wishue149-3.smt2
+ regress1/decision/wishue160.smt2
regress1/error.cvc
regress1/errorcrash.smt2
regress1/fp/rti_3_5_bug_report.smt2
regress1/sygus/issue3498.smt2
regress2/arith/miplib-opt1217--27.smt2
regress2/nl/dumortier-050317.smt2
+ # timeout after refactoring justification heuristic
+ regress2/ho/SYO362^5.p
# time out
regress3/unifpi-solve-car_1.lus.sy
regress3/issue4476-ext-rew.smt2
+; COMMAND-LINE: -q
; EXPECT: sat
(set-logic QF_NRA)
(set-info :smt-lib-version 2.6)
; REQUIRES: symfpu
-; COMMAND-LINE:
+; COMMAND-LINE: -q
; EXPECT: sat
(set-logic QF_FPLRA)
(set-info :status sat)
+; COMMAND-LINE: -q
+; EXPECT: sat
; REQUIRES: symfpu
(set-logic ALL)
(set-option :uf-ho true)
-; COMMAND-LINE: -m
+; COMMAND-LINE: -m -q
; EXPECT: sat
; EXPECT: ((IP true))
(set-logic QF_NRA)
(declare-const r16 Real)
(assert (! (distinct (/ 1 r16) r11) :named IP))
(check-sat)
-(get-assignment)
\ No newline at end of file
+(get-assignment)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+(set-logic ANIA)
+(declare-fun i () Int)
+(declare-fun a () (Array Int Bool))
+(declare-fun b () (Array Bool (Array Int Bool)))
+(assert (= (store b (>= i 0) a) (store b false (store (store a 0 true) i true))))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+(set-logic AUFLIA)
+(declare-fun v () Bool)
+(declare-fun i () Int)
+(declare-fun i8 () Int)
+(declare-fun u (Int Int Int Int Int Int) Bool)
+(declare-fun ar () (Array Bool Bool))
+(declare-fun a () (Array Int Int))
+(declare-fun arr-- () (Array Bool Int))
+(declare-fun arr () (Array Bool (Array Int Bool)))
+(declare-fun arr- () (Array Bool (Array Bool (Array Int Bool))))
+(assert (= arr- (store (store arr- false arr) (or (u (- 1) (select a i8) i (- 1) (select arr-- (select ar (= ar (store ar v true)))) 0) (not (u (- 1) (select a i8) i (- 1) (select arr-- (select ar (= ar (store ar v true)))) 0))) arr)))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+(set-logic AUFNIA)
+(declare-fun _substvar_298_ () (Array Int Bool))
+(declare-fun _substvar_379_ () (Array Bool (Array Int Bool)))
+(declare-fun _substvar_400_ () (Array Bool (Array Int Bool)))
+(declare-fun i0 () Int)
+(declare-fun arr--325748303185799905_1467848600759014513-0 () (Array Int Bool))
+(declare-fun arr-1467848600759014513_3143370635870088364-0 () (Array Bool (Array Int Bool)))
+(assert (= _substvar_400_ (store arr-1467848600759014513_3143370635870088364-0 false (store (store arr--325748303185799905_1467848600759014513-0 776 true) i0 true)) (store arr-1467848600759014513_3143370635870088364-0 (>= i0 776) _substvar_298_) _substvar_379_))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --fmf-fun -i --decision=justification
+; EXPECT: sat
+(set-logic ALRA)
+(set-option :fmf-fun true)
+(declare-fun v2 () Bool)
+(declare-sort S0 0)
+(declare-fun arr--1494941102250395870_2811598136228140380-0 () (Array Bool S0))
+(declare-fun arr-2811598136228140380_-1494941102250395870-0 () (Array S0 Bool))
+(push)
+(assert (select arr-2811598136228140380_-1494941102250395870-0 (select arr--1494941102250395870_2811598136228140380-0 false)))
+(push)
+(pop)
+(pop)
+(assert (select arr-2811598136228140380_-1494941102250395870-0 (select (store arr--1494941102250395870_2811598136228140380-0 v2 (select arr--1494941102250395870_2811598136228140380-0 true)) true)))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+(set-logic ALL)
+(declare-const size4 String)
+(declare-const p2_size Int)
+(assert (= 1 (+ 1 (ite (= 1 p2_size) (str.to_code size4) 0))))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+; EXPECT: sat
+; EXPECT: unsat
+; EXPECT: unsat
+; EXPECT: unsat
+(set-logic SAT)
+(set-option :incremental true)
+(declare-fun v1 () Bool)
+(declare-fun v2 () Bool)
+(declare-fun v3 () Bool)
+(declare-fun v4 () Bool)
+(declare-fun v5 () Bool)
+(declare-fun v6 () Bool)
+(declare-fun v7 () Bool)
+(declare-fun v8 () Bool)
+(check-sat)
+(assert (and (and v1 v2) (and (or true (and (or false v1) v1)) (or (and false v1) v3))))
+(assert true)
+(assert (or (and (or (and (or v4 v4) false) v2) (and true (or (and v5 true) (and v6 v5)))) v2))
+(assert v3)
+(check-sat)
+(assert false)
+(assert true)
+(assert (and (or (and v7 (and (and v2 v6) (and false v8))) (and (or (and v8 false) true) (and v6 true))) (and true v3)))
+(push)
+(assert v7)
+(check-sat)
+(assert true)
+(pop)
+(push)
+(check-sat)
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+; EXPECT: sat
+; EXPECT: sat
+; EXPECT: sat
+; EXPECT: sat
+; EXPECT: unsat
+(set-logic SAT)
+(set-option :incremental true)
+(declare-fun v1 () Bool)
+(declare-fun v2 () Bool)
+(declare-fun v3 () Bool)
+(declare-fun v4 () Bool)
+(declare-fun v5 () Bool)
+(check-sat)
+(check-sat)
+(assert (or (not (and (or v1 (and v1 true)) (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool)) (and v1 false)))) false))
+(assert (or (or (not true) (and (and (not v1) (or v1 v1)) v1)) (or (and (not (not v2)) (forall ((q0_1 Bool) (q0_2 Bool)) (and q0_2 q0_2))) (and (not (and true v3)) (or (not v1) v2)))))
+(check-sat)
+(check-sat)
+(assert (not (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool) (q0_4 Bool)) (and (not (forall ((q1_1 Bool) (q1_2 Bool) (q1_3 Bool) (q1_4 Bool)) false)) (not (forall ((q1_1 Bool)) q0_2))))))
+(assert (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool) (q0_4 Bool) (q0_5 Bool)) (not v1)))
+(push)
+(check-sat)
+(assert (and (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool)) (forall ((q1_1 Bool) (q1_2 Bool) (q1_3 Bool) (q1_4 Bool)) (not (forall ((q2_1 Bool)) true)))) (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool)) (not (or q0_3 (forall ((q1_1 Bool)) v4))))))
+(assert (or (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool) (q0_4 Bool)) (forall ((q1_1 Bool) (q1_2 Bool) (q1_3 Bool)) (not q1_1))) v1))
+(assert v5)
+(check-sat)
+(assert (not (forall ((q0_1 Bool)) (and (or (or true q0_1) (and false q0_1)) (not true)))))
+(pop)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+; EXPECT: sat
+; EXPECT: sat
+(set-logic SAT)
+(set-option :incremental true)
+(declare-fun v1 () Bool)
+(declare-fun v2 () Bool)
+(declare-fun v3 () Bool)
+(declare-fun v4 () Bool)
+(declare-fun v5 () Bool)
+(check-sat)
+(assert (and (or (or (and (or false v1) v2) (not (not v3))) (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool)) (forall ((q1_1 Bool)) q1_1))) true))
+(check-sat)
+(assert (or (not v2) (or (and (or (and v4 true) v2) (forall ((q0_1 Bool)) (not true))) (not (forall ((q0_1 Bool) (q0_2 Bool) (q0_3 Bool) (q0_4 Bool)) (forall ((q1_1 Bool) (q1_2 Bool)) v1))))))
+(push)
+(assert (not v5))
+(assert (not true))
+(pop)
+(push)
+(check-sat)
+(pop)
+(assert true)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+(set-logic AUFLIA)
+(declare-const v4 Bool)
+(declare-const v6 Bool)
+(declare-const arr0 (Array Bool Int))
+(declare-const arr1 (Array Bool (Array Bool Int)))
+(assert (= (store arr1 v6 (store arr0 true 0)) (store arr1 true (store (store (store arr0 true 0) v4 0) true 96)) arr1 arr1))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+(set-logic AUFLRA)
+(declare-fun _substvar_323_ () Bool)
+(declare-sort S0 0)
+(declare-const arr-8825057447867329665_7821057345541224443-0 (Array Bool S0))
+(declare-const arr--3985848114402943554_-2673408464765268945-0 (Array Real (Array Bool S0)))
+(assert (not (= (select arr--3985848114402943554_-2673408464765268945-0 0.0) (store (store arr-8825057447867329665_7821057345541224443-0 _substvar_323_ (select arr-8825057447867329665_7821057345541224443-0 true)) false (select arr-8825057447867329665_7821057345541224443-0 false)) arr-8825057447867329665_7821057345541224443-0 arr-8825057447867329665_7821057345541224443-0)))
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --decision=justification
+; EXPECT: sat
+(set-logic ALIA)
+(set-option :repeat-simp true)
+(set-option :sygus-rr-synth-check true)
+(declare-fun v6 () Bool)
+(declare-const arr-7579056739068271278_-8074447279386590332-0 (Array Bool Int))
+(assert (= false false false (= arr-7579056739068271278_-8074447279386590332-0 (store arr-7579056739068271278_-8074447279386590332-0 v6 746)) false false false))
+(check-sat)
-; COMMAND-LINE: --uf-ho --finite-model-find -q
+; COMMAND-LINE: --uf-ho --finite-model-find -q --decision=justification-old
; EXPECT: sat
(set-logic ALL)
+; COMMAND-LINE: --no-jh-rlv-order
; REQUIRES: symfpu
; EXPECT: unsat
(set-logic AUFBVFPDTNIRA)
+; COMMAND-LINE: -q
+; EXPECT: unsat
(set-logic QF_SLIA)
(declare-fun a () String)
(assert
-% COMMAND-LINE: --uf-ho --full-saturate-quant --ho-elim
+% COMMAND-LINE: --uf-ho --full-saturate-quant --ho-elim --decision=justification-old
% EXPECT: % SZS status Theorem for SYO362^5
thf(cK,type,(