// score is lexographic ( bound vars, shared vars )
int score_max_1 = -1;
int score_max_2 = -1;
- int score_index = -1;
+ unsigned score_index = 0;
+ bool set_score_index = false;
for( unsigned i=0; i<pats.size(); i++ ){
Node p = pats[i];
if( std::find( pats_ordered.begin(), pats_ordered.end(), p )==pats_ordered.end() ){
score_2++;
}
}
- if( score_index==-1 || score_1>score_max_1 || ( score_1==score_max_1 && score_2>score_max_2 ) ){
+ if (!set_score_index || score_1 > score_max_1
+ || (score_1 == score_max_1 && score_2 > score_max_2))
+ {
score_index = i;
+ set_score_index = true;
score_max_1 = score_1;
score_max_2 = score_2;
}
}
}
+ Assert(set_score_index);
//update the variable bounds
Node mp = pats[score_index];
for( unsigned i=0; i<var_contains[mp].size(); i++ ){
return x;
}else if( n.getKind()==PLUS || n.getKind()==MULT ){
int cindex = -1;
+ bool cindexSet = false;
for( unsigned i=0; i<n.getNumChildren(); i++ ){
if( !quantifiers::TermUtil::hasInstConstAttr(n[i]) ){
if( n.getKind()==PLUS ){
}
x = Rewriter::rewrite( x );
}else{
- Assert( cindex==-1 );
+ Assert(!cindexSet);
cindex = i;
+ cindexSet = true;
}
}
- Assert( cindex!=-1 );
- return getInversion( n[cindex], x );
+ if (cindexSet)
+ {
+ return getInversion(n[cindex], x);
+ }
}
return Node::null();
}
CegConjecture* d_parent;
/** is the syntax restricted? */
bool d_is_syntax_restricted;
- /** does the syntax allow ITE expressions? */
- bool d_has_ite;
/** collect terms */
void collectTerms( Node n, std::map< TypeNode, std::vector< Node > >& consts );
/** convert node n based on deep embedding (Section 4 of Reynolds et al CAV 2015) */
class EvalSygusInvarianceTest : public SygusInvarianceTest
{
public:
- EvalSygusInvarianceTest() : d_kind(kind::UNDEFINED_KIND) {}
+ EvalSygusInvarianceTest()
+ : d_kind(kind::UNDEFINED_KIND), d_is_conjunctive(false)
+ {
+ }
/** initialize this invariance test
*
// for ITE
Node split_cond_enum;
- int split_cond_res_index = -1;
+ unsigned split_cond_res_index = 0;
+ bool set_split_cond_res_index = false;
for (unsigned sc = 0, size = etis->d_cenum.size(); sc < size; sc++)
{
if (strat == strat_ITE && sc > 0)
{
EnumCache& ecache_cond = d_ecache[split_cond_enum];
- Assert(split_cond_res_index >= 0);
- Assert(split_cond_res_index
- < (int)ecache_cond.d_enum_vals_res.size());
+ Assert(set_split_cond_res_index);
+ Assert(split_cond_res_index < ecache_cond.d_enum_vals_res.size());
prev = x.d_vals;
bool ret = x.updateContext(
this,
Assert(ecache_child.d_enum_val_to_index.find(rec_c)
!= ecache_child.d_enum_val_to_index.end());
split_cond_res_index = ecache_child.d_enum_val_to_index[rec_c];
+ set_split_cond_res_index = true;
split_cond_enum = ce;
- Assert(split_cond_res_index >= 0);
Assert(split_cond_res_index
- < (int)ecache_child.d_enum_vals_res.size());
+ < ecache_child.d_enum_vals_res.size());
}
}
else
* register a new value for an enumerator.
*/
bool d_check_sol;
- /** whether we have solved the overall conjecture */
- bool d_solved;
/** The number of values we have enumerated for all enumerators. */
unsigned d_cond_count;
/** The solution for the function of this class, if one has been found */
class DecisionTreeInfo
{
public:
- DecisionTreeInfo() {}
+ DecisionTreeInfo()
+ : d_unif(nullptr), d_strategy(nullptr), d_strategy_index(0)
+ {
+ }
~DecisionTreeInfo() {}
/** initializes this class */
void initialize(Node cond_enum,
class SygusUnifStrategy
{
public:
- SygusUnifStrategy() {}
+ SygusUnifStrategy() : d_qe(nullptr) {}
/** initialize
*
* This initializes this class with function-to-synthesize f. We also call
}
if( !pinfer.empty() ){
//now, determine which of the possible inferences we want to add
- int use_index = -1;
+ unsigned use_index = 0;
+ bool set_use_index = false;
Trace("strings-solve") << "Possible inferences (" << pinfer.size() << ") : " << std::endl;
unsigned min_id = 9;
unsigned max_index = 0;
Trace("strings-solve") << "From " << pinfer[i].d_i << " / " << pinfer[i].d_j << " (rev=" << pinfer[i].d_rev << ") : ";
Trace("strings-solve")
<< pinfer[i].d_conc << " by " << pinfer[i].d_id << std::endl;
- if( use_index==-1 || pinfer[i].d_id<min_id || ( pinfer[i].d_id==min_id && pinfer[i].d_index>max_index ) ){
+ if (!set_use_index || pinfer[i].d_id < min_id
+ || (pinfer[i].d_id == min_id && pinfer[i].d_index > max_index))
+ {
min_id = pinfer[i].d_id;
max_index = pinfer[i].d_index;
use_index = i;
+ set_use_index = true;
}
}
//send the inference