Пример #1
0
 public SMTAffineTerm addUnchecked(SMTAffineTerm a2, boolean sortCorrect) {
   Map<Term, Rational> summands = new HashMap<Term, Rational>();
   summands.putAll(this.mSummands);
   for (Map.Entry<Term, Rational> entry : a2.mSummands.entrySet()) {
     Term var = entry.getKey();
     if (summands.containsKey(var)) {
       Rational r = summands.get(var).add(entry.getValue());
       if (r.equals(Rational.ZERO)) summands.remove(var);
       else {
         summands.put(var, r);
       }
     } else {
       summands.put(var, entry.getValue());
     }
   }
   return create(
       summands,
       mConstant.add(a2.mConstant),
       sortCorrect ? mSort : a2.getSort().getName().equals("Real") ? a2.getSort() : mSort);
 }
Пример #2
0
 public Term internalize(TermCompiler compiler) {
   SMTAffineTerm res = this;
   if (getTheory().getLogic().isIRA() && mSort.getName().equals("Real") && isAllInt())
     res = create(mSummands, mConstant, getTheory().getSort("Int"));
   return res.normalize(compiler);
 }
Пример #3
0
 public SMTAffineTerm add(SMTAffineTerm a2) {
   assert this.getSort().equals(a2.getSort());
   return addUnchecked(a2, true);
 }