Skip to content

Commit f5e5502

Browse files
committed
Nested Loops: fixes
1 parent 68062a8 commit f5e5502

File tree

8 files changed

+8
-19
lines changed

8 files changed

+8
-19
lines changed

src/api/MainSolver.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ sstat MainSolver::check() {
339339
rval = simplifyFormulas();
340340
} catch (opensmt::NonLinException const & error) {
341341
reasonUnknown = error.what();
342-
rval = s_Undef;
343-
return rval;
342+
return s_Undef;
344343
}
345344

346345
if (config.dump_query()) printCurrentAssertionsAsQuery();
@@ -350,7 +349,7 @@ sstat MainSolver::check() {
350349
rval = solve();
351350
} catch (std::overflow_error const & error) { rval = s_Error; } catch (opensmt::NonLinException const & error) {
352351
reasonUnknown = error.what();
353-
rval = s_Undef;
352+
return s_Undef;
354353
}
355354
if (rval == s_False) {
356355
assert(not smt_solver->isOK());

src/logics/ArithLogic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ class ArithLogic : public Logic {
355355
bool isLinearTerm(PTRef tr) const;
356356
bool isLinearFactor(PTRef tr) const;
357357
pair<Number, vec<PTRef>> getConstantAndFactors(PTRef sum) const;
358+
// Given a term `t` is splits the term into monomial and its coefficient
358359
pair<PTRef, PTRef> splitPolyTerm(PTRef term) const;
359360
PTRef normalizeMul(PTRef mul);
360361
// Given a sum term 't' returns a normalized inequality 'c <= s' equivalent to '0 <= t'

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.isMonomial(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/tsolvers/lasolver/LASolver.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ void LASolver::isProperLeq(PTRef tr)
9292
assert(logic.isLeq(tr));
9393
auto [cons, sum] = logic.leqToConstantAndTerm(tr);
9494
assert(logic.isConstant(cons));
95-
assert(logic.isNumVar(sum) || logic.isPlus(sum) || logic.isTimesLinNonlin(sum) || logic.isMod(logic.getPterm(sum).symb()) ||
96-
logic.isRealDiv(sum) || logic.isIntDiv(sum));
95+
assert(logic.isNumVar(sum) || logic.isPlus(sum) || logic.isTimesLinNonlin(sum) || logic.isRealDiv(sum));
9796
(void) cons; (void)sum;
9897
}
9998

@@ -244,7 +243,7 @@ LVRef LASolver::getVarForLeq(PTRef ref) const {
244243
}
245244

246245
LVRef LASolver::getLAVar_single(PTRef expr_in) {
247-
246+
if (logic.isNonlin(expr_in)) throw NonLinException(logic.pp(expr_in));
248247
assert(logic.isLinearTerm(expr_in));
249248
PTId id = logic.getPterm(expr_in).getId();
250249

@@ -288,13 +287,6 @@ std::unique_ptr<Tableau::Polynomial> LASolver::expressionToLVarPoly(PTRef term)
288287
//
289288
// Returns internalized reference for the term
290289
LVRef LASolver::registerArithmeticTerm(PTRef expr) {
291-
if (logic.isTimesNonlin(expr)) throw NonLinException(logic.pp(expr));
292-
else if(logic.isTimesLin(expr) || logic.isPlus(expr)) {
293-
Pterm const & subterms = logic.getPterm(expr);
294-
for(auto subterm: subterms) {
295-
if (logic.isNonlin(subterm)) throw NonLinException(logic.pp(subterm));
296-
}
297-
}
298290
LVRef x = LVRef::Undef;
299291
if (laVarMapper.hasVar(expr)){
300292
x = getVarForTerm(expr);

src/tsolvers/lasolver/LASolver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <unordered_set>
2525

2626
namespace opensmt {
27-
2827
class LAVarStore;
2928
class Delta;
3029
class PartitionManager;

test/regression/base/arithmetic/miniexample3.smt2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
(declare-fun x () Int)
33
(declare-fun y () Int)
44
(define-fun uninterp_mul ((a Int) (b Int)) Int (+ (* a b) 10))
5-
(assert (= x x))
65
(assert (= (uninterp_mul y x) 30))
76
(check-sat)
87
(exit)

test/regression/base/arithmetic/miniexample3_Ok.smt2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
(declare-fun x () Int)
33
(declare-fun y () Int)
44
(define-fun uninterp_mul ((a Int) (b Int)) Int (+ (* a b) 10))
5-
(assert (= x x))
65
(assert (= (uninterp_mul y 5) 30))
76
(check-sat)
87
(get-model)

test/unit/test_Ites.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ TEST_F(IteManagerTest, test_IteTimesVar) {
136136
PTRef c2 = logic.mkConst("2");
137137
PTRef ite = logic.mkIte(cond, c1, c2);
138138

139-
EXPECT_NO_THROW(logic.mkTimes(ite,x));
139+
EXPECT_NO_THROW(logic.mkTimes(ite, x));
140140

141141
}
142142

0 commit comments

Comments
 (0)