3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2022-05-28 13:57:03 -07:00
parent 4953b95baa
commit 48701826f1
5 changed files with 21 additions and 14 deletions

View file

@ -113,8 +113,9 @@ static void read_clause(Buffer & in, std::ostream& err, sat::literal_vector & li
} }
template<typename Buffer> template<typename Buffer>
static void read_pragma(Buffer & in, std::ostream& err, std::string& p) { static void read_pragma(Buffer & in, std::ostream& err, std::string& p, sat::proof_hint& h) {
skip_whitespace(in); skip_whitespace(in);
h.reset();
if (*in != 'p') if (*in != 'p')
return; return;
++in; ++in;
@ -122,14 +123,16 @@ static void read_pragma(Buffer & in, std::ostream& err, std::string& p) {
++in; ++in;
while (true) { while (true) {
if (*in == EOF) if (*in == EOF)
return; break;
if (*in == '\n') { if (*in == '\n') {
++in; ++in;
return; break;
} }
p.push_back(*in); p.push_back(*in);
++in; ++in;
} }
if (!p.empty())
h.from_string(p);
} }
@ -328,7 +331,7 @@ namespace dimacs {
theory_id = read_theory_id(); theory_id = read_theory_id();
skip_whitespace(in); skip_whitespace(in);
read_clause(in, err, m_record.m_lits); read_clause(in, err, m_record.m_lits);
read_pragma(in, err, m_record.m_pragma); read_pragma(in, err, m_record.m_pragma, m_record.m_hint);
m_record.m_tag = drat_record::tag_t::is_clause; m_record.m_tag = drat_record::tag_t::is_clause;
m_record.m_status = sat::status::th(false, theory_id); m_record.m_status = sat::status::th(false, theory_id);
break; break;

View file

@ -64,6 +64,7 @@ namespace dimacs {
std::string m_name; std::string m_name;
unsigned_vector m_args; unsigned_vector m_args;
std::string m_pragma; std::string m_pragma;
sat::proof_hint m_hint;
}; };
struct drat_pp { struct drat_pp {

View file

@ -932,11 +932,12 @@ namespace sat {
return ous.str(); return ous.str();
} }
proof_hint proof_hint::from_string(char const* s) { void proof_hint::from_string(char const* s) {
proof_hint h; proof_hint& h = *this;
h.reset();
h.m_ty = hint_type::null_h; h.m_ty = hint_type::null_h;
if (!s) if (!s)
return h; return;
auto ws = [&]() { auto ws = [&]() {
while (*s == ' ' || *s == '\n' || *s == '\t') while (*s == ' ' || *s == '\n' || *s == '\t')
++s; ++s;
@ -999,14 +1000,14 @@ namespace sat {
ws(); ws();
if (!parse_type()) if (!parse_type())
return h; return;
ws(); ws();
while (*s) { while (*s) {
if (!parse_coeff_literal()) if (!parse_coeff_literal())
return h; return;
ws(); ws();
} }
return h; return;
} }
} }

View file

@ -102,11 +102,13 @@ namespace sat {
}; };
struct proof_hint { struct proof_hint {
hint_type m_ty; hint_type m_ty = hint_type::null_h;
vector<std::pair<rational, literal>> m_literals; vector<std::pair<rational, literal>> m_literals;
vector<std::tuple<rational, unsigned, unsigned>> m_eqs; vector<std::tuple<rational, unsigned, unsigned>> m_eqs;
void reset() { m_ty = hint_type::null_h; m_literals.reset(); m_eqs.reset(); }
std::string to_string() const; std::string to_string() const;
static proof_hint from_string(char const* s); void from_string(char const* s);
void from_string(std::string const& s) { from_string(s.c_str()); }
}; };
class status { class status {