CBMC
Loading...
Searching...
No Matches
bv_dimacs.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Writing DIMACS Files
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#include "bv_dimacs.h"
13
15
17 const namespacet &_ns,
19 message_handlert &message_handler,
20 std::ostream &_out)
21 : bv_pointerst(_ns, _prop, message_handler), out(_out), dimacs_cnf_prop(_prop)
22{
23}
24
26{
27 dimacs_cnf_prop.write_dimacs_cnf(out);
28
29 // we dump the mapping variable<->literals
30 for(const auto &s : get_symbols())
31 {
32 if(s.second.is_constant())
33 out << "c " << s.first << " " << (s.second.is_true() ? "TRUE" : "FALSE")
34 << "\n";
35 else
36 out << "c " << s.first << " " << s.second.dimacs() << "\n";
37 }
38
39 // dump mapping for selected bit-vectors
40 for(const auto &m : get_map().get_mapping())
41 {
42 const auto &literal_map = m.second.literal_map;
43
44 if(literal_map.empty())
45 continue;
46
47 out << "c " << m.first;
48
49 for(const auto &lit : literal_map)
50 {
51 out << ' ';
52
53 if(lit.is_constant())
54 out << (lit.is_true() ? "TRUE" : "FALSE");
55 else
56 out << lit.dimacs();
57 }
58
59 out << "\n";
60 }
61}
Writing DIMACS Files.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:566
const boolbv_mapt & get_map() const
Definition boolbv.h:100
bv_dimacst(const namespacet &_ns, dimacs_cnft &_prop, message_handlert &message_handler, std::ostream &_out)
Definition bv_dimacs.cpp:16
const dimacs_cnft & dimacs_cnf_prop
Definition bv_dimacs.h:37
void write_dimacs()
Definition bv_dimacs.cpp:25
std::ostream & out
Definition bv_dimacs.h:36
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
const symbolst & get_symbols() const