mirror of
https://github.com/Z3Prover/z3
synced 2025-08-05 19:00:25 +00:00
adding drat
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
505133a4b3
commit
0b711c5ef8
14 changed files with 255 additions and 53 deletions
67
src/sat/sat_drat.cpp
Normal file
67
src/sat/sat_drat.cpp
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*++
|
||||
Copyright (c) 2014 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
sat_drat.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Produce DRAT proofs.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner) 2017-2-3
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include "sat_solver.h"
|
||||
#include "sat_drat.h"
|
||||
|
||||
|
||||
namespace sat {
|
||||
drat::drat(solver& s):
|
||||
s(s),
|
||||
m_out(0)
|
||||
{
|
||||
if (s.m_config.m_drat) {
|
||||
m_out = alloc(std::ofstream, "proof.drat");
|
||||
}
|
||||
}
|
||||
|
||||
drat::~drat() {
|
||||
dealloc(m_out);
|
||||
}
|
||||
void drat::add_empty() {
|
||||
(*m_out) << "0\n";
|
||||
}
|
||||
void drat::add_literal(literal l) {
|
||||
(*m_out) << l << " 0\n";
|
||||
}
|
||||
void drat::add_binary(literal l1, literal l2) {
|
||||
(*m_out) << l1 << " " << l2 << " 0\n";
|
||||
}
|
||||
void drat::add_ternary(literal l1, literal l2, literal l3) {
|
||||
(*m_out) << l1 << " " << l2 << " " << l3 << " 0\n";
|
||||
}
|
||||
void drat::add_clause(clause& c) {
|
||||
unsigned sz = c.size();
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
(*m_out) << c[i] << " ";
|
||||
}
|
||||
(*m_out) << "0\n";
|
||||
}
|
||||
void drat::del_literal(literal l) {
|
||||
(*m_out) << "d ";
|
||||
add_literal(l);
|
||||
}
|
||||
void drat::del_binary(literal l1, literal l2) {
|
||||
(*m_out) << "d ";
|
||||
add_binary(l1, l2);
|
||||
}
|
||||
void drat::del_clause(clause& c) {
|
||||
(*m_out) << "d ";
|
||||
add_clause(c);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue