Trace("cbqi-inst") << pv_coeff << " * ";
}
Trace("cbqi-inst") << pv << " -> " << n << std::endl;
+ Assert( n.getType().isSubtypeOf( pv.getType() ) );
}
//must ensure variables have been computed for n
computeProgVars( n );
std::vector< Node > new_has_coeff;
Trace("cbqi-inst-debug2") << "Applying substitutions..." << std::endl;
for( unsigned j=0; j<sf.d_subs.size(); j++ ){
+ Trace("cbqi-inst-debug2") << " Apply for " << sf.d_subs[j] << std::endl;
Assert( d_prog_var.find( sf.d_subs[j] )!=d_prog_var.end() );
if( d_prog_var[sf.d_subs[j]].find( pv )!=d_prog_var[sf.d_subs[j]].end() ){
prev_subs[j] = sf.d_subs[j];
real_part.push_back( msum[it->first].isNull() ? it->first : NodeManager::currentNM()->mkNode( MULT, msum[it->first], it->first ) );
}
}
- for( unsigned t=0; t<2; t++ ){
- if( !vts_coeff[t].isNull() ){
- vts_coeff[t] = Rewriter::rewrite( NodeManager::currentNM()->mkNode( MULT, rcoeff, vts_coeff[t] ) );
- }
+ //remove delta TODO: check this
+ vts_coeff[1] = Node::null();
+ //multiply inf
+ if( !vts_coeff[0].isNull() ){
+ vts_coeff[0] = Rewriter::rewrite( NodeManager::currentNM()->mkNode( MULT, rcoeff, vts_coeff[0] ) );
}
realPart = real_part.empty() ? d_zero : ( real_part.size()==1 ? real_part[0] : NodeManager::currentNM()->mkNode( PLUS, real_part ) );
Assert( d_out->isEligibleForInstantiation( realPart ) );
int ires_use = ( msum[pv].isNull() || msum[pv].getConst<Rational>().sgn()==1 ) ? 1 : -1;
val = Rewriter::rewrite( NodeManager::currentNM()->mkNode( ires_use==-1 ? PLUS : MINUS,
NodeManager::currentNM()->mkNode( ires_use==-1 ? MINUS : PLUS, val, realPart ),
- NodeManager::currentNM()->mkNode( TO_INTEGER, realPart ) ) );
+ NodeManager::currentNM()->mkNode( TO_INTEGER, realPart ) ) ); //TODO: round up for upper bounds?
Trace("cbqi-inst-debug") << "result : " << val << std::endl;
Assert( val.getType().isInteger() );
}
} else {
if (first) {
rep = (*eqc_i);
+ //add the term (this is specifically for the case of singleton equivalence classes)
+ if( !rep.getType().isRegExp() ){
+ d_equalityEngine->addTerm( rep );
+ Trace("model-builder-debug") << "Add term to ee within assertEqualityEngine: " << rep << std::endl;
+ }
first = false;
}
else {
// Assign representative for this EC
if (!const_rep.isNull()) {
// Theories should not specify a rep if there is already a constant in the EC
- Assert(rep.isNull() || rep == const_rep);
+ //AJR: I believe this assertion is too strict, eqc with asserted reps may merge with constant eqc
+ //Assert(rep.isNull() || rep == const_rep);
assignConstantRep( tm, constantReps, eqc, const_rep, fullModel );
typeConstSet.add(eqct.getBaseType(), const_rep);
}
//get properties of this type
bool isCorecursive = false;
- bool isUSortFiniteRestricted = false;
if( t.isDatatype() ){
const Datatype& dt = ((DatatypeType)(t).toType()).getDatatype();
isCorecursive = dt.isCodatatype() && ( !dt.isFinite() || dt.isRecursiveSingleton() );
}
+#ifdef CVC4_ASSERTIONS
+ bool isUSortFiniteRestricted = false;
if( options::finiteModelFind() ){
isUSortFiniteRestricted = !t.isSort() && involvesUSort( t );
}
+#endif
set<Node>* repSet = typeRepSet.getSet(t);
TypeNode tb = t.getBaseType();
Assert( !n.isNull() );
success = true;
Trace("model-builder-debug") << "Check if excluded : " << n << std::endl;
- if( isUSortFiniteRestricted ){
#ifdef CVC4_ASSERTIONS
+ if( isUSortFiniteRestricted ){
//must not involve uninterpreted constants beyond cardinality bound (which assumed to coincide with #eqc)
//this is just an assertion now, since TypeEnumeratorProperties should ensure that only legal values are enumerated wrt this constraint.
std::map< Node, bool > visited;
Trace("model-builder") << "Excluded value for " << t << " : " << n << " due to out of range uninterpreted constant." << std::endl;
}
Assert( success );
-#endif
}
+#endif
if( success && isCorecursive ){
if (repSet != NULL && !repSet->empty()) {
// in the case of codatatypes, check if it is in the set of values that we cannot assign
//modelBuilder-specific initialization
processBuildModel( tm, fullModel );
- // Collect model comments from the theories
+ // Do post-processing of model from the theories (used for THEORY_SEP to construct heap model)
if( fullModel ){
- Trace("model-builder") << "TheoryEngineModelBuilder: Collect model comments..." << std::endl;
+ Trace("model-builder") << "TheoryEngineModelBuilder: Post-process model..." << std::endl;
d_te->postProcessModel(tm);
}
retNode = NodeManager::currentNM()->mkNode( r.getKind(), children );
if (childrenConst) {
retNode = Rewriter::rewrite(retNode);
- Assert(retNode.getKind()==kind::APPLY_UF || retNode.getKind()==kind::REGEXP_RANGE || retNode.isConst());
+ Assert(retNode.getKind()==kind::APPLY_UF || retNode.getType().isRegExp() || retNode.isConst());
}
}
d_normalizedCache[r] = retNode;