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);
 }
 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);
 }
 public SMTAffineTerm add(SMTAffineTerm a2) {
   assert this.getSort().equals(a2.getSort());
   return addUnchecked(a2, true);
 }