# CEGQI applied to general quantified formulas
option cbqi --cbqi bool :read-write :default false
turns on counterexample-based quantifier instantiation
+option cbqiFullEffort --cbqi-full bool :read-write :default false
+ turns on full effort counterexample-based quantifier instantiation, which may resort to model-value instantiation
option recurseCbqi --cbqi-recurse bool :default true
turns on recursive counterexample-based quantifier instantiation
option cbqiSat --cbqi-sat bool :read-write :default true
use matching heuristics for EPR instantiation
# CEGQI for BV
-option cbqiBv --cbqi-bv bool :read-write :default false
+option cbqiBv --cbqi-bv bool :read-write :default true
use word-level inversion approach for counterexample-guided quantifier instantiation for bit-vectors
option cbqiBvInterleaveValue --cbqi-bv-interleave-value bool :read-write :default false
interleave model value instantiation with word-level inversion approach
-option cbqiBvIneqMode --cbqi-bv-ineq=MODE CVC4::theory::quantifiers::CbqiBvIneqMode :read-write :default CVC4::theory::quantifiers::CBQI_BV_INEQ_EQ_SLACK :include "options/quantifiers_modes.h" :handler stringToCbqiBvIneqMode
+option cbqiBvIneqMode --cbqi-bv-ineq=MODE CVC4::theory::quantifiers::CbqiBvIneqMode :read-write :default CVC4::theory::quantifiers::CBQI_BV_INEQ_EQ_BOUNDARY :include "options/quantifiers_modes.h" :handler stringToCbqiBvIneqMode
choose mode for handling bit-vector inequalities with counterexample-guided instantiation
-option cbqiBvRmExtract --cbqi-bv-rm-extract bool :read-write :default false
+option cbqiBvRmExtract --cbqi-bv-rm-extract bool :read-write :default true
replaces extract terms with variables for counterexample-guided instantiation for bit-vectors
### local theory extensions options
if( !options::cbqi.wasSetByUser() ){
options::cbqi.set( true );
}
+ // check whether we should apply full cbqi
+ if (d_logic.isPure(THEORY_BV))
+ {
+ if (!options::cbqiFullEffort.wasSetByUser())
+ {
+ options::cbqiFullEffort.set(true);
+ }
+ }
}
if( options::cbqi() ){
//must rewrite divk
options::instWhenMode.set( quantifiers::INST_WHEN_LAST_CALL );
}
}else{
- //only supported in pure arithmetic
- options::cbqiNestedQE.set(false);
+ // only supported in pure arithmetic or pure BV
+ if (d_logic.isPure(THEORY_BV))
+ {
+ options::cbqiNestedQE.set(false);
+ }
}
}
//implied options...
}
//[4] resort to using value in model. We do so if:
- // - we are in a higher effort than CEG_INST_EFFORT_STANDARD,
- // - if the variable is Boolean, or
- // - if we are solving for a subfield of a datatype.
- bool use_model_value = vinst->useModelValue(this, sf, pv, d_effort);
- if ((d_effort > CEG_INST_EFFORT_STANDARD || use_model_value || is_cv)
+ // - if the instantiator uses model values at this effort, or
+ // - if we are solving for a subfield of a datatype (is_cv).
+ if ((vinst->useModelValue(this, sf, pv, d_effort) || is_cv)
&& vinst->allowModelValue(this, sf, pv, d_effort))
{
#ifdef CVC4_ASSERTIONS
Trace("cbqi-inst-debug") << "[4] " << i << "...try model value " << mv << std::endl;
d_curr_iphase[pv] = CEG_INST_PHASE_MVALUE;
CegInstEffort prev = d_effort;
- if (!use_model_value)
+ if (d_effort < CEG_INST_EFFORT_STANDARD_MV)
{
// update the effort level to indicate we have used a model value
d_effort = CEG_INST_EFFORT_STANDARD_MV;
Node pv,
CegInstEffort effort)
{
- return false;
+ return effort > CEG_INST_EFFORT_STANDARD;
}
/** do we allow the model value as instantiation for pv? */
virtual bool allowModelValue(CegInstantiator* ci,
CegInstantiator * d_ci;
};
-
-BvInstantiator::BvInstantiator( QuantifiersEngine * qe, TypeNode tn ) : Instantiator( qe, tn ){
+BvInstantiator::BvInstantiator(QuantifiersEngine* qe, TypeNode tn)
+ : Instantiator(qe, tn), d_tried_assertion_inst(false)
+{
// get the global inverter utility
// this must be global since we need to:
// * process Skolem functions properly across multiple variables within the same quantifier
d_inst_id_to_alit.clear();
d_var_to_curr_inst_id.clear();
d_alit_to_model_slack.clear();
+ d_tried_assertion_inst = false;
}
void BvInstantiator::processLiteral(CegInstantiator* ci,
Node lit,
CegInstEffort effort)
{
+ if (effort == CEG_INST_EFFORT_FULL)
+ {
+ // always use model values at full effort
+ return Node::null();
+ }
Node atom = lit.getKind() == NOT ? lit[0] : lit;
bool pol = lit.getKind() != NOT;
Kind k = atom.getKind();
return false;
}
+bool BvInstantiator::useModelValue(CegInstantiator* ci,
+ SolvedForm& sf,
+ Node pv,
+ CegInstEffort effort)
+{
+ return !d_tried_assertion_inst
+ && (effort < CEG_INST_EFFORT_FULL || options::cbqiFullEffort());
+}
+
bool BvInstantiator::processAssertions(CegInstantiator* ci,
SolvedForm& sf,
Node pv,
Trace("cegqi-bv") << "*** try " << pv << " -> " << inst_term
<< std::endl;
d_var_to_curr_inst_id[pv] = inst_id;
+ d_tried_assertion_inst = true;
if (ci->constructInstantiationInc(
pv, inst_term, pv_prop_bv, sf, revertOnSuccess))
{
SolvedForm& sf,
Node pv,
CegInstEffort effort) override;
+ /** use model value
+ *
+ * We allow model values if we have not already tried an assertion,
+ * and only at levels below full if cbqiFullEffort is false.
+ */
virtual bool useModelValue(CegInstantiator* ci,
SolvedForm& sf,
Node pv,
- CegInstEffort effort) override
- {
- return true;
- }
+ CegInstEffort effort) override;
virtual std::string identify() const { return "Bv"; }
private:
// point to the bv inverter class
std::unordered_map< Node, unsigned, NodeHashFunction > d_var_to_curr_inst_id;
/** the amount of slack we added for asserted literals */
std::unordered_map<Node, Node, NodeHashFunction> d_alit_to_model_slack;
+ /** whether we have tried an instantiation based on assertion in this round */
+ bool d_tried_assertion_inst;
/** rewrite assertion for solve pv
* returns a literal that is equivalent to lit that leads to best solved form for pv
*/