Skip to content

Commit

Permalink
finish encoding of n'th root
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Feb 5, 2024
1 parent 8555f25 commit 683070a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/nlsat/nlsat_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3182,10 +3182,24 @@ namespace nlsat {
std::string y2 = std::string("y") + std::to_string(j+1);
out << "(< " << y1 << " " << y2 << ")\n";
}

std::string yn = "y" + std::to_string(a.i() - 1);

// TODO we need (forall z : z < yn . p(z) => z = y1 or ... z = y_{n-1})
// to say y1, .., yn are the first n distinct roots.
//
std::string yn = "y" + std::to_string(a.i() - 1);
out << "(forall ((z Real)) (=> (and (< z " << yn << ") "; display_poly_root(out, "z", a, proc) << ") ";
if (a.i() == 1) {
out << "false))\n";
}
else {
out << "(or ";
for (unsigned j = 0; j + 1 < a.i(); ++j) {
std::string y1 = std::string("y") + std::to_string(j);
out << "(= z " << y1 << ") ";
}
out << ")))\n";
}
switch (a.get_kind()) {
case atom::ROOT_LT: out << "(< "; proc(out, a.x()); out << " " << yn << ")"; break;
case atom::ROOT_GT: out << "(> "; proc(out, a.x()); out << " " << yn << ")"; break;
Expand Down

0 comments on commit 683070a

Please sign in to comment.