Skip to content

Commit 6a72bae

Browse files
committed
NonlinWork: Fixes according to comments
1 parent eafefbd commit 6a72bae

File tree

14 files changed

+90
-99
lines changed

14 files changed

+90
-99
lines changed

src/api/MainSolver.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "MainSolver.h"
1010

1111
#include <common/ApiException.h>
12+
#include <common/NonLinException.h>
1213
#include <itehandler/IteHandler.h>
1314
#include <logics/ArrayTheory.h>
1415
#include <logics/LATheory.h>
@@ -333,18 +334,22 @@ sstat MainSolver::check() {
333334
StopWatch sw(query_timer);
334335
}
335336
if (isLastFrameUnsat()) { return s_False; }
336-
sstat rval = simplifyFormulas();
337+
sstat rval;
338+
try {
339+
rval = simplifyFormulas();
340+
} catch (opensmt::NonLinException const & error) {
341+
reasonUnknown = error.what();
342+
return s_Undef;
343+
}
337344

338345
if (config.dump_query()) printCurrentAssertionsAsQuery();
339346

340347
if (rval == s_Undef) {
341348
try {
342349
rval = solve();
343-
} catch (std::overflow_error const & error) {
344-
rval = s_Error;
345-
} catch (opensmt::LANonLinearException const & error) {
350+
} catch (std::overflow_error const & error) { rval = s_Error; } catch (opensmt::NonLinException const & error) {
346351
reasonUnknown = error.what();
347-
rval = s_Undef;
352+
return s_Undef;
348353
}
349354
if (rval == s_False) {
350355
assert(not smt_solver->isOK());

src/common/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ include(numbers/CMakeLists.txt)
2424
install(FILES
2525
StringMap.h Timer.h inttypes.h IColor.h
2626
TreeOps.h FlaPartitionMap.h PartitionInfo.h Partitions.h ApiException.h TypeUtils.h
27-
NatSet.h ScopedVector.h TermNames.h
27+
NatSet.h ScopedVector.h TermNames.h NonLinException.h
2828
DESTINATION ${INSTALL_HEADERS_DIR}/common)

src/common/NonLinException.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2024, Konstantin Britikov <britikovki@gmail.com>
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
7+
#ifndef OPENSMT_NONLINEXCEPTION_H
8+
#define OPENSMT_NONLINEXCEPTION_H
9+
10+
namespace opensmt {
11+
class NonLinException : public std::runtime_error {
12+
public:
13+
NonLinException(std::string_view const reason_) : runtime_error(std::string(reason_)) {
14+
msg = "Term " + std::string(reason_) + " is non-linear";
15+
}
16+
virtual char const * what() const noexcept override { return msg.c_str(); }
17+
18+
private:
19+
std::string msg;
20+
};
21+
}
22+
23+
#endif // OPENSMT_NONLINEXCEPTION_H

src/logics/ArithLogic.cc

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ ArithLogic::ArithLogic(Logic_t type)
114114
sym_Real_MINUS(declareFun_NoScoping_LeftAssoc(tk_real_minus, sort_REAL, {sort_REAL, sort_REAL})),
115115
sym_Real_PLUS(declareFun_Commutative_NoScoping_LeftAssoc(tk_real_plus, sort_REAL, {sort_REAL, sort_REAL})),
116116
sym_Real_TIMES(declareFun_Commutative_NoScoping_LeftAssoc(tk_real_times, sort_REAL, {sort_REAL, sort_REAL})),
117-
sym_Real_TIMES_LIN(declareFun_Multiplication_Duplicate(tk_real_times, sort_REAL, {sort_REAL, sort_REAL})),
118-
sym_Real_TIMES_NONLIN(declareFun_Multiplication_Duplicate(tk_real_times, sort_REAL, {sort_REAL, sort_REAL})),
117+
sym_Real_TIMES_LIN(declareFun_Multiplication_LinNonlin(tk_real_times, sort_REAL, {sort_REAL, sort_REAL})),
118+
sym_Real_TIMES_NONLIN(declareFun_Multiplication_LinNonlin(tk_real_times, sort_REAL, {sort_REAL, sort_REAL})),
119119
sym_Real_DIV(declareFun_NoScoping_LeftAssoc(tk_real_div, sort_REAL, {sort_REAL, sort_REAL})),
120120
sym_Real_EQ(sortToEquality[sort_REAL]),
121121
sym_Real_LEQ(declareFun_NoScoping_Chainable(tk_real_leq, sort_BOOL, {sort_REAL, sort_REAL})),
@@ -136,8 +136,8 @@ ArithLogic::ArithLogic(Logic_t type)
136136
sym_Int_MINUS(declareFun_NoScoping_LeftAssoc(tk_int_minus, sort_INT, {sort_INT, sort_INT})),
137137
sym_Int_PLUS(declareFun_Commutative_NoScoping_LeftAssoc(tk_int_plus, sort_INT, {sort_INT, sort_INT})),
138138
sym_Int_TIMES(declareFun_Commutative_NoScoping_LeftAssoc(tk_int_times, sort_INT, {sort_INT, sort_INT})),
139-
sym_Int_TIMES_LIN(declareFun_Multiplication_Duplicate(tk_int_times, sort_INT, {sort_INT, sort_INT})),
140-
sym_Int_TIMES_NONLIN(declareFun_Multiplication_Duplicate(tk_int_times, sort_INT, {sort_INT, sort_INT})),
139+
sym_Int_TIMES_LIN(declareFun_Multiplication_LinNonlin(tk_int_times, sort_INT, {sort_INT, sort_INT})),
140+
sym_Int_TIMES_NONLIN(declareFun_Multiplication_LinNonlin(tk_int_times, sort_INT, {sort_INT, sort_INT})),
141141
sym_Int_DIV(declareFun_NoScoping_LeftAssoc(tk_int_div, sort_INT, {sort_INT, sort_INT})),
142142
sym_Int_MOD(declareFun_NoScoping(tk_int_mod, sort_INT, {sort_INT, sort_INT})),
143143
sym_Int_EQ(sortToEquality[sort_INT]),
@@ -184,11 +184,11 @@ PTRef ArithLogic::getMinusOneForSort(SRef sort) const {
184184
}
185185

186186
bool ArithLogic::isLinearFactor(PTRef tr) const {
187-
if (isNumConst(tr) || isNumVarLike(tr)) { return true; }
187+
if (isNumConst(tr) || isMonomial(tr)) { return true; }
188188
if (isTimesLin(tr)) {
189189
Pterm const & term = getPterm(tr);
190190
return term.size() == 2 &&
191-
((isNumConst(term[0]) && (isNumVarLike(term[1]))) || (isNumConst(term[1]) && (isNumVarLike(term[0]))));
191+
((isNumConst(term[0]) && (isMonomial(term[1]))) || (isNumConst(term[1]) && (isMonomial(term[0]))));
192192
}
193193
return false;
194194
}
@@ -202,15 +202,6 @@ bool ArithLogic::isLinearTerm(PTRef tr) const {
202202
return false;
203203
}
204204

205-
bool ArithLogic::isNonlin(PTRef tr) const {
206-
if (isTimesNonlin(tr)) { return true; }
207-
if (isRealDiv(tr) || isIntDiv(tr) || isMod(getPterm(tr).symb())) {
208-
Pterm const & term = getPterm(tr);
209-
if (not isConstant(term[1])) return true;
210-
}
211-
return false;
212-
};
213-
214205
Number const & ArithLogic::getNumConst(PTRef tr) const {
215206
SymId id = sym_store[getPterm(tr).symb()].getId();
216207
assert(id < static_cast<unsigned int>(numbers.size()) && numbers[id] != nullptr);
@@ -238,19 +229,16 @@ pair<Number, vec<PTRef>> ArithLogic::getConstantAndFactors(PTRef sum) const {
238229
}
239230

240231
pair<PTRef, PTRef> ArithLogic::splitPolyTerm(PTRef term) const {
241-
assert(isTimes(term) || isNumVarLike(term) || isConstant(term));
232+
assert(isTimes(term) || isMonomial(term) || isConstant(term));
242233
if (isTimesLin(term)) {
243234
assert(getPterm(term).size() == 2);
244235
PTRef fac = getPterm(term)[0];
245236
PTRef var = getPterm(term)[1];
246237
if (not isConstant(fac)) { std::swap(fac, var); }
247238
assert(isConstant(fac));
248-
assert(isNumVarLike(var) || isTimesNonlin(var));
239+
assert(isMonomial(var));
249240
return {var, fac};
250-
} else if (isTimesNonlin(term)) {
251-
PTRef one = yieldsSortInt(term) ? getTerm_IntOne() : getTerm_RealOne();
252-
return {term, one};
253-
} else if (isNumVarLike(term)) {
241+
} else if (isMonomial(term)) {
254242
assert(yieldsSortInt(term) or yieldsSortReal(term));
255243
PTRef var = term;
256244
PTRef fac = yieldsSortInt(term) ? getTerm_IntOne() : getTerm_RealOne();
@@ -263,7 +251,7 @@ pair<PTRef, PTRef> ArithLogic::splitPolyTerm(PTRef term) const {
263251

264252
// Normalize a product of the form (* a v) to either v or (* -1 v)
265253
PTRef ArithLogic::normalizeMul(PTRef mul) {
266-
assert(isTimesDefined(mul));
254+
assert(isTimesLinOrNonlin(mul));
267255
auto [v, c] = splitPolyTerm(mul);
268256
if (getNumConst(c) < 0) {
269257
return mkNeg(v);
@@ -426,7 +414,7 @@ lbool ArithLogic::arithmeticElimination(vec<PTRef> const & top_level_arith, Subs
426414
auto coeff = logic.getNumConst(c);
427415
poly.addTerm(var, std::move(coeff));
428416
} else {
429-
assert(logic.isPlus(polyTerm) || logic.isTimesDefined(polyTerm));
417+
assert(logic.isPlus(polyTerm) || logic.isTimesLinOrNonlin(polyTerm));
430418
for (PTRef factor : logic.getPterm(polyTerm)) {
431419
auto [var, c] = logic.splitPolyTerm(factor);
432420
auto coeff = logic.getNumConst(c);
@@ -495,14 +483,14 @@ pair<lbool, Logic::SubstMap> ArithLogic::retrieveSubstitutions(vec<PtAsgn> const
495483
}
496484

497485
uint32_t LessThan_deepPTRef::getVarIdFromProduct(PTRef tr) const {
498-
assert(l.isTimesDefined(tr));
486+
assert(l.isTimesLinOrNonlin(tr));
499487
auto [v, c] = l.splitPolyTerm(tr);
500488
return v.x;
501489
}
502490

503491
bool LessThan_deepPTRef::operator()(PTRef x_, PTRef y_) const {
504-
uint32_t id_x = l.isTimesDefined(x_) ? getVarIdFromProduct(x_) : x_.x;
505-
uint32_t id_y = l.isTimesDefined(y_) ? getVarIdFromProduct(y_) : y_.x;
492+
uint32_t id_x = l.isTimesLinOrNonlin(x_) ? getVarIdFromProduct(x_) : x_.x;
493+
uint32_t id_y = l.isTimesLinOrNonlin(y_) ? getVarIdFromProduct(y_) : y_.x;
506494
return id_x < id_y;
507495
}
508496

@@ -517,10 +505,10 @@ bool ArithLogic::isBuiltinFunction(SymRef const sr) const {
517505
return Logic::isBuiltinFunction(sr);
518506
}
519507
bool ArithLogic::isNumTerm(PTRef tr) const {
520-
if (isNumVarLike(tr)) return true;
508+
if (isMonomial(tr)) return true;
521509
Pterm const & t = getPterm(tr);
522510
if (t.size() == 2 && isTimesLin(tr))
523-
return (isNumVarLike(t[0]) && isConstant(t[1])) || (isNumVarLike(t[1]) && isConstant(t[0]));
511+
return (isMonomial(t[0]) && isConstant(t[1])) || (isMonomial(t[1]) && isConstant(t[0]));
524512
else if (t.size() == 0)
525513
return isNumVar(tr) || isConstant(tr);
526514
else
@@ -530,11 +518,11 @@ bool ArithLogic::isNumTerm(PTRef tr) const {
530518
PTRef ArithLogic::mkNeg(PTRef tr) {
531519
assert(!isNeg(tr)); // MB: The invariant now is that there is no "Minus" node
532520
SymRef symref = getSymRef(tr);
533-
if (isConstant(symref)) {
521+
if (isConstant(tr)) {
534522
Number const & v = getNumConst(tr);
535523
return mkConst(getSortRef(tr), -v);
536524
}
537-
if (isPlus(symref)) {
525+
if (isPlus(tr)) {
538526
vec<PTRef> args;
539527
args.capacity(getPterm(tr).size());
540528
// Note: Do this in two phases to avoid calling mkNeg that invalidates the Pterm reference
@@ -548,16 +536,12 @@ PTRef ArithLogic::mkNeg(PTRef tr) {
548536
PTRef tr_n = mkFun(symref, std::move(args));
549537
return tr_n;
550538
}
551-
if (isTimesLin(symref)) { // constant * (var-like \/ times-nonlin)
539+
if (isTimesLin(tr)) { // constant * monomial
552540
assert(getPterm(tr).size() == 2);
553541
auto [var, constant] = splitPolyTerm(tr);
554542
return constant == getMinusOneForSort(getSortRef(symref)) ? var : mkFun(symref, {var, mkNeg(constant)});
555543
}
556-
if (isTimesNonlin(symref)) {
557-
SRef returnSort = getSortRef(tr);
558-
return mkFun(getTimesLinForSort(returnSort), {tr, getMinusOneForSort(returnSort)});
559-
}
560-
if (isNumVarLike(symref)) {
544+
if (isMonomial(tr)) {
561545
auto sortRef = getSortRef(symref);
562546
return mkFun(getTimesLinForSort(sortRef), {tr, getMinusOneForSort(sortRef)});
563547
}
@@ -744,9 +728,9 @@ PTRef ArithLogic::mkBinaryLeq(PTRef lhs, PTRef rhs) {
744728
Number const & v = this->getNumConst(sum_tmp);
745729
return v.sign() < 0 ? getTerm_false() : getTerm_true();
746730
}
747-
if (isNumVarLike(sum_tmp) ||
748-
isTimesDefined(sum_tmp)) { // "sum_tmp = c * v", just scale to "v" or "-v" without changing the sign
749-
sum_tmp = isTimesDefined(sum_tmp) ? normalizeMul(sum_tmp) : sum_tmp;
731+
if (isMonomial(sum_tmp) ||
732+
isTimesLinOrNonlin(sum_tmp)) { // "sum_tmp = c * v", just scale to "v" or "-v" without changing the sign
733+
sum_tmp = isTimesLinOrNonlin(sum_tmp) ? normalizeMul(sum_tmp) : sum_tmp;
750734
return mkFun(getLeqForSort(argSort), {getZeroForSort(argSort), sum_tmp});
751735
} else if (isPlus(sum_tmp)) {
752736
// Normalize the sum
@@ -817,7 +801,7 @@ PTRef ArithLogic::mkBinaryEq(PTRef lhs, PTRef rhs) {
817801
if (isConstant(diff)) {
818802
Number const & v = this->getNumConst(diff);
819803
return v.isZero() ? getTerm_true() : getTerm_false();
820-
} else if (isNumVarLike(diff) || isTimesDefined(diff)) {
804+
} else if (isMonomial(diff) || isTimesLin(diff)) {
821805
auto [var, constant] = splitPolyTerm(diff);
822806
return Logic::mkBinaryEq(getZeroForSort(eqSort),
823807
var); // Avoid anything that calls Logic::mkEq as this would create a loop
@@ -1014,7 +998,7 @@ void SimplifyConst::simplify(SymRef s, vec<PTRef> const & args, SymRef & s_new,
1014998
}
1015999
// // A single argument for the operator, and the operator is identity
10161000
// // in that case
1017-
if (args_new.size() == 1 && (l.isPlus(s_new) || l.isTimesDefined(s_new))) {
1001+
if (args_new.size() == 1 && (l.isPlus(s_new) || l.isTimesLinOrNonlin(s_new))) {
10181002
PTRef ch_tr = args_new[0];
10191003
args_new.clear();
10201004
s_new = l.getPterm(ch_tr).symb();
@@ -1233,7 +1217,7 @@ pair<Number, PTRef> ArithLogic::sumToNormalizedIntPair(PTRef sum) {
12331217
coeffs.reserve(varFactors.size());
12341218
for (PTRef factor : varFactors) {
12351219
auto [var, coeff] = splitPolyTerm(factor);
1236-
assert((ArithLogic::isNumVarLike(var) || ArithLogic::isTimesDefined(var)) and isNumConst(coeff));
1220+
assert(ArithLogic::isMonomial(var) and isNumConst(coeff));
12371221
vars.push(var);
12381222
coeffs.push_back(getNumConst(coeff));
12391223
}
@@ -1372,8 +1356,8 @@ std::pair<PTRef, PTRef> ArithLogic::leqToConstantAndTerm(PTRef leq) {
13721356
}
13731357

13741358
bool ArithLogic::hasNegativeLeadingVariable(PTRef poly) const {
1375-
if (isNumConst(poly) or isNumVarLike(poly)) { return false; }
1376-
if (isTimesDefined(poly)) {
1359+
if (isNumConst(poly) or isMonomial(poly)) { return false; }
1360+
if (isTimesLinOrNonlin(poly)) {
13771361
auto [var, constant] = splitPolyTerm(poly);
13781362
return isNegative(getNumConst(constant));
13791363
}

src/logics/ArithLogic.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,12 @@ class ArithLogic : public Logic {
164164
bool isIntNeg(SymRef sr) const { return sr == sym_Int_NEG; }
165165
bool isRealNeg(SymRef sr) const { return sr == sym_Real_NEG; }
166166

167-
bool isTimes(SymRef sr) const { return isTimesLin(sr) or isTimesNonlin(sr) or isTimesUnknown(sr); };
168-
bool isTimesDefined(SymRef sr) const { return isTimesLin(sr) or isTimesNonlin(sr); };
167+
bool isTimes(SymRef sr) const { return isTimesLin(sr) or isTimesNonlin(sr) or isIntTimes(sr) or isRealTimes(sr); };
168+
bool isTimesLinOrNonlin(SymRef sr) const { return isTimesLin(sr) or isTimesNonlin(sr); };
169169
bool isTimesLin(SymRef sr) const { return isIntTimesLin(sr) or isRealTimesLin(sr); }
170-
bool isTimesUnknown(SymRef sr) const { return isIntTimes(sr) or isRealTimes(sr); }
171170
bool isTimesNonlin(SymRef sr) const { return isIntTimesNonlin(sr) or isRealTimesNonlin(sr); }
172171
bool isTimes(PTRef tr) const { return isTimes(getPterm(tr).symb()); }
173-
bool isTimesDefined(PTRef tr) const { return isTimesDefined(getPterm(tr).symb()); };
172+
bool isTimesLinOrNonlin(PTRef tr) const { return isTimesLinOrNonlin(getPterm(tr).symb()); };
174173
bool isTimesLin(PTRef tr) const { return isTimesLin(getPterm(tr).symb()); }
175174
bool isTimesNonlin(PTRef tr) const { return isTimesNonlin(getPterm(tr).symb()); }
176175
bool isIntTimesLin(PTRef tr) const { return isIntTimesLin(getPterm(tr).symb()); }
@@ -229,10 +228,10 @@ class ArithLogic : public Logic {
229228

230229
bool isNumVar(SymRef sr) const { return isVar(sr) and (yieldsSortInt(sr) or yieldsSortReal(sr)); }
231230
bool isNumVar(PTRef tr) const { return isNumVar(getPterm(tr).symb()); }
232-
bool isNumVarLike(SymRef sr) const {
233-
return yieldsSortNum(sr) and not isPlus(sr) and not isTimes(sr) and not isNumConst(sr);
231+
bool isMonomial(PTRef tr) const {
232+
SymRef sr = getPterm(tr).symb();
233+
return yieldsSortNum(sr) and not isPlus(sr) and not isTimesLin(sr) and not isNumConst(sr);
234234
}
235-
bool isNumVarLike(PTRef tr) const { return isNumVarLike(getPterm(tr).symb()); }
236235

237236
bool isZero(SymRef sr) const { return isIntZero(sr) or isRealZero(sr); }
238237
bool isZero(PTRef tr) const { return isZero(getSymRef(tr)); }
@@ -252,7 +251,6 @@ class ArithLogic : public Logic {
252251

253252
// Real terms are of form c, a, or (* c a) where c is a constant and a is a variable or Ite.
254253
bool isNumTerm(PTRef tr) const;
255-
bool isNonlin(PTRef tr) const;
256254

257255
PTRef getTerm_IntZero() const { return term_Int_ZERO; }
258256
PTRef getTerm_RealZero() const { return term_Real_ZERO; }
@@ -355,6 +353,7 @@ class ArithLogic : public Logic {
355353
bool isLinearTerm(PTRef tr) const;
356354
bool isLinearFactor(PTRef tr) const;
357355
pair<Number, vec<PTRef>> getConstantAndFactors(PTRef sum) const;
356+
// Given a term `t` is splits the term into monomial and its coefficient
358357
pair<PTRef, PTRef> splitPolyTerm(PTRef term) const;
359358
PTRef normalizeMul(PTRef mul);
360359
// Given a sum term 't' returns a normalized inequality 'c <= s' equivalent to '0 <= t'
@@ -389,6 +388,10 @@ class ArithLogic : public Logic {
389388
PTRef mkBinaryGeq(PTRef lhs, PTRef rhs) { return mkBinaryLeq(rhs, lhs); }
390389
PTRef mkBinaryLt(PTRef lhs, PTRef rhs) { return mkNot(mkBinaryGeq(lhs, rhs)); }
391390
PTRef mkBinaryGt(PTRef lhs, PTRef rhs) { return mkNot(mkBinaryLeq(lhs, rhs)); }
391+
SymRef declareFun_Multiplication_LinNonlin(std::string const & s, SRef rsort, vec<SRef> const & args) {
392+
SymRef sr = sym_store.newInternalSymb(s.c_str(), rsort, args, SymConf::CommutativeNoScopingLeftAssoc);
393+
return sr;
394+
}
392395
PTRef mkBinaryEq(PTRef lhs, PTRef rhs) override;
393396
pair<Number, PTRef> sumToNormalizedPair(PTRef sum);
394397
pair<Number, PTRef> sumToNormalizedIntPair(PTRef sum);

src/logics/Logic.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,6 @@ class Logic {
186186
SymRef declareFun_Commutative_NoScoping_LeftAssoc(std::string const & s, SRef rsort, vec<SRef> const & args) {
187187
return declareFun(s, rsort, args, SymConf::CommutativeNoScopingLeftAssoc);
188188
}
189-
SymRef declareFun_Multiplication_Duplicate(std::string const & s, SRef rsort, vec<SRef> const & args) {
190-
SymRef sr = sym_store.newUnparsableSymb(s.c_str(), rsort, args, SymConf::CommutativeNoScopingLeftAssoc);
191-
return sr;
192-
}
193189
SymRef declareFun_Commutative_NoScoping_Chainable(std::string const & s, SRef rsort, vec<SRef> const & args) {
194190
return declareFun(s, rsort, args, SymConf::CommutativeNoScopingChainable);
195191
}

src/rewriters/DivModRewriter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "Rewriter.h"
1212

1313
#include <common/InternalException.h>
14+
#include <common/NonLinException.h>
1415
#include <logics/ArithLogic.h>
1516

1617
namespace opensmt {
@@ -36,7 +37,7 @@ class DivModConfig : public DefaultRewriterConfig {
3637
PTRef modVar = divMod.mod;
3738
PTRef rewritten = logic.isIntDiv(symRef) ? divVar : modVar;
3839
if (not inCache) {
39-
if (logic.isNonlin(term)) { return term; }
40+
if (!logic.isConstant(divisor)) throw NonLinException(logic.pp(term));
4041
// collect the definitions to add
4142
assert(logic.isConstant(divisor));
4243
auto divisorVal = logic.getNumConst(divisor);

src/simplifiers/LA.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ void LAExpression::initialize(PTRef e, bool do_canonize) {
6363
curr_term.emplace_back(var);
6464
curr_const.emplace_back(std::move(new_c));
6565
} else {
66-
// Otherwise it is a variable, Ite, UF or constant
67-
assert(logic.isNumVarLike(t) || logic.isConstant(t) || logic.isUF(t));
66+
// Otherwise it is a monomial or constant
67+
assert(logic.isMonomial(t) || logic.isConstant(t));
6868
if (logic.isConstant(t)) {
6969
const Real tval = logic.getNumConst(t);
7070
polynome[PTRef_Undef] += tval * c;

src/symbols/SymStore.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ class SymStore {
4141
SymStore & operator=(SymStore &&) = default;
4242
// Constructs a new symbol.
4343

44-
SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig,
45-
bool subSymb = false);
44+
SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig) {
45+
return newSymb(fname, rsort, args, symConfig, false);
46+
};
4647
SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args) {
47-
return newSymb(fname, rsort, args, SymConf::Default);
48+
return newSymb(fname, rsort, args, SymConf::Default, false);
4849
}
49-
SymRef newUnparsableSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig) {
50+
SymRef newInternalSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig) {
5051
return newSymb(fname, rsort, args, symConfig, true);
5152
}
5253
bool contains(char const * fname) const { return symbolTable.has(fname); }
@@ -78,6 +79,9 @@ class SymStore {
7879
vec<SymRef> symbols;
7980
SymbolAllocator ta{1024};
8081
vec<char *> idToName;
82+
83+
SymRef newSymb(char const * fname, SRef rsort, vec<SRef> const & args, SymbolConfig const & symConfig,
84+
bool subSymb);
8185
};
8286
} // namespace opensmt
8387

0 commit comments

Comments
 (0)