Skip to content

Commit 7f073a0

Browse files
fix #2452 fix #2451
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent b7a27ca commit 7f073a0

File tree

4 files changed

+303
-301
lines changed

4 files changed

+303
-301
lines changed

src/nlsat/nlsat_solver.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,16 +1408,13 @@ namespace nlsat {
14081408
}
14091409

14101410
void collect(literal_vector const& assumptions, clause_vector& clauses) {
1411-
unsigned n = clauses.size();
14121411
unsigned j = 0;
1413-
for (unsigned i = 0; i < n; i++) {
1414-
clause * c = clauses[i];
1412+
for (clause * c : clauses) {
14151413
if (collect(assumptions, *c)) {
14161414
del_clause(c);
14171415
}
14181416
else {
1419-
clauses[j] = c;
1420-
j++;
1417+
clauses[j++] = c;
14211418
}
14221419
}
14231420
clauses.shrink(j);
@@ -1432,11 +1429,12 @@ namespace nlsat {
14321429
}
14331430
vector<assumption, false> deps;
14341431
m_asm.linearize(asms, deps);
1435-
bool found = false;
1436-
for (unsigned i = 0; !found && i < deps.size(); ++i) {
1437-
found = ptr <= deps[i] && deps[i] < ptr + sz;
1432+
for (auto dep : deps) {
1433+
if (ptr <= dep && dep < ptr + sz) {
1434+
return true;
1435+
}
14381436
}
1439-
return found;
1437+
return false;
14401438
}
14411439

14421440
// -----------------------
@@ -1453,8 +1451,8 @@ namespace nlsat {
14531451
// Conflict resolution invariant: a marked literal is in m_lemma or on the trail stack.
14541452

14551453
bool check_marks() {
1456-
for (unsigned i = 0; i < m_marks.size(); i++) {
1457-
SASSERT(m_marks[i] == 0);
1454+
for (unsigned m : m_marks) {
1455+
SASSERT(m == 0);
14581456
}
14591457
return true;
14601458
}
@@ -1468,14 +1466,13 @@ namespace nlsat {
14681466
void reset_mark(bool_var b) { m_marks[b] = 0; }
14691467

14701468
void reset_marks() {
1471-
unsigned sz = m_lemma.size();
1472-
for (unsigned i = 0; i < sz; i++) {
1473-
reset_mark(m_lemma[i].var());
1469+
for (auto const& l : m_lemma) {
1470+
reset_mark(l.var());
14741471
}
14751472
}
14761473

14771474
void process_antecedent(literal antecedent) {
1478-
bool_var b = antecedent.var();
1475+
bool_var b = antecedent.var();
14791476
TRACE("nlsat_resolve", tout << "resolving antecedent, l:\n"; display(tout, antecedent); tout << "\n";);
14801477
if (assigned_value(antecedent) == l_undef) {
14811478
// antecedent must be false in the current arith interpretation

0 commit comments

Comments
 (0)