cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
resolution_proof.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module:
4
5
Author: Daniel Kroening, kroening@kroening.com
6
7
\*******************************************************************/
8
9
#include "
resolution_proof.h
"
10
11
#include <
util/invariant.h
>
12
13
#include <stack>
14
15
template
<
class
T>
16
void
resolution_prooft<T>::build_core
(std::vector<bool> &in_core)
17
{
18
PRECONDITION
(!
clauses
.empty());
19
20
std::stack<typename clausest::size_type> s;
21
std::vector<bool> seen;
22
23
seen.resize(
clauses
.size(),
false
);
24
25
s.push(
clauses
.size()-1);
26
27
while
(!s.empty())
28
{
29
typename
clausest::size_type c_id=s.top();
30
s.pop();
31
32
if
(seen[c_id])
33
continue
;
34
seen[c_id]=
true
;
35
36
const
T &c=
clauses
[c_id];
37
38
if
(c.is_root)
39
{
40
for
(std::size_t i=0; i<c.root_clause.size(); i++)
41
{
42
unsigned
v=c.root_clause[i].var_no();
43
INVARIANT
(
44
v < in_core.size(),
"variable number should be within bounds"
);
45
in_core[v]=
true
;
46
}
47
}
48
else
49
{
50
INVARIANT
(
51
c.first_clause_id < c_id,
52
"id of the clause to be pushed onto the clause stack shall be smaller "
53
"than the id of the current clause"
);
54
s.push(c.first_clause_id);
55
56
for
(clauset::stepst::size_type i=0; i<c.steps.size(); i++)
57
{
58
// must decrease
59
INVARIANT
(
60
c.steps[i].clause_id < c_id,
61
"id of the clause to be pushed onto the clause stack shall be "
62
"smaller than the id of the current clause"
);
63
s.push(c.steps[i].clause_id);
64
}
65
}
66
}
67
}
68
69
template
class
resolution_prooft<clauset>
;
resolution_prooft
Definition
resolution_proof.h:39
resolution_prooft::build_core
void build_core(std::vector< bool > &in_core)
Definition
resolution_proof.cpp:16
resolution_prooft::clauses
clausest clauses
Definition
resolution_proof.h:42
resolution_proof.h
invariant.h
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
INVARIANT
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition
invariant.h:423
solvers
sat
resolution_proof.cpp
Generated by
1.17.0