CBMC
qdimacs_cnf.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_SOLVERS_QBF_QDIMACS_CNF_H
11 #define CPROVER_SOLVERS_QBF_QDIMACS_CNF_H
12 
13 #include <iosfwd>
14 
15 #include <solvers/sat/dimacs_cnf.h>
16 
18 {
19 public:
20  explicit qdimacs_cnft(message_handlert &message_handler)
21  : dimacs_cnft(message_handler)
22  {
23  }
24 
25  virtual void write_qdimacs_cnf(std::ostream &out);
26 
27  // dummy functions
28 
29  std::string solver_text() const override
30  {
31  return "QDIMACS CNF";
32  }
33 
35  {
36  public:
37  enum class typet { NONE, EXISTENTIAL, UNIVERSAL };
39  unsigned var_no;
40 
42  {
43  }
44 
45  quantifiert(typet _type, literalt _l):type(_type), var_no(_l.var_no())
46  {
47  }
48 
49  bool operator==(const quantifiert &other) const
50  {
51  return type==other.type && var_no==other.var_no;
52  }
53 
54  size_t hash() const
55  {
56  return var_no^(static_cast<int>(type)<<24);
57  }
58  };
59 
60  // quantifiers
61  typedef std::vector<quantifiert> quantifierst;
63 
64  virtual void add_quantifier(const quantifiert &quantifier)
65  {
66  quantifiers.push_back(quantifier);
67  }
68 
69  void add_quantifier(const quantifiert::typet type, const literalt l)
70  {
71  add_quantifier(quantifiert(type, l));
72  }
73 
75  {
77  }
78 
80  {
82  }
83 
84  bool is_quantified(const literalt l) const;
85  bool find_quantifier(const literalt l, quantifiert &q) const;
86 
87  virtual void set_quantifier(const quantifiert::typet type, const literalt l);
88  void copy_to(qdimacs_cnft &cnf) const;
89 
90  bool operator==(const qdimacs_cnft &other) const;
91 
92  size_t hash() const;
93 
94 protected:
95  void write_prefix(std::ostream &out) const;
96 };
97 
98 #endif // CPROVER_SOLVERS_QBF_QDIMACS_CNF_H
quantifiert(typet _type, literalt _l)
Definition: qdimacs_cnf.h:45
bool operator==(const quantifiert &other) const
Definition: qdimacs_cnf.h:49
virtual void add_quantifier(const quantifiert &quantifier)
Definition: qdimacs_cnf.h:64
bool find_quantifier(const literalt l, quantifiert &q) const
void write_prefix(std::ostream &out) const
Definition: qdimacs_cnf.cpp:22
virtual void write_qdimacs_cnf(std::ostream &out)
Definition: qdimacs_cnf.cpp:15
void add_universal_quantifier(const literalt l)
Definition: qdimacs_cnf.h:79
size_t hash() const
virtual void set_quantifier(const quantifiert::typet type, const literalt l)
Definition: qdimacs_cnf.cpp:73
std::vector< quantifiert > quantifierst
Definition: qdimacs_cnf.h:61
void add_quantifier(const quantifiert::typet type, const literalt l)
Definition: qdimacs_cnf.h:69
bool operator==(const qdimacs_cnft &other) const
Definition: qdimacs_cnf.cpp:68
std::string solver_text() const override
Definition: qdimacs_cnf.h:29
quantifierst quantifiers
Definition: qdimacs_cnf.h:62
void copy_to(qdimacs_cnft &cnf) const
Definition: qdimacs_cnf.cpp:90
void add_existential_quantifier(const literalt l)
Definition: qdimacs_cnf.h:74
qdimacs_cnft(message_handlert &message_handler)
Definition: qdimacs_cnf.h:20
bool is_quantified(const literalt l) const
The type of an expression, extends irept.
Definition: type.h:29