CBMC
equality.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_FLATTENING_EQUALITY_H
11 #define CPROVER_SOLVERS_FLATTENING_EQUALITY_H
12 
13 #include <map>
14 
15 #include <util/expr.h>
16 
18 
20 {
21 public:
22  equalityt(propt &_prop, message_handlert &message_handler)
23  : prop_conv_solvert(_prop, message_handler)
24  {
25  }
26 
27  virtual literalt equality(const exprt &e1, const exprt &e2);
28 
30 
31  void finish_eager_conversion() override
32  {
35  typemap.clear(); // if called incrementally, don't do it twice
36  }
37 
38 protected:
39  typedef std::unordered_map<const exprt, unsigned, irep_hash> elementst;
40  typedef std::map<std::pair<unsigned, unsigned>, literalt> equalitiest;
41  typedef std::map<unsigned, exprt> elements_revt;
42 
43  struct typestructt
44  {
48  };
49 
50  typedef std::unordered_map<const typet, typestructt, irep_hash> typemapt;
51 
53 
54  virtual literalt equality2(const exprt &e1, const exprt &e2);
55 
56  // an eager conversion of the transitivity constraints
57  virtual void add_equality_constraints();
58  virtual void add_equality_constraints(const typestructt &typestruct);
59 };
60 
61 #endif // CPROVER_SOLVERS_FLATTENING_EQUALITY_H
std::map< std::pair< unsigned, unsigned >, literalt > equalitiest
Definition: equality.h:40
void finish_eager_conversion() override
Definition: equality.h:31
std::unordered_map< const exprt, unsigned, irep_hash > elementst
Definition: equality.h:39
virtual void add_equality_constraints()
Definition: equality.cpp:89
std::unordered_map< const typet, typestructt, irep_hash > typemapt
Definition: equality.h:50
equalityt(propt &_prop, message_handlert &message_handler)
Definition: equality.h:22
typemapt typemap
Definition: equality.h:52
std::map< unsigned, exprt > elements_revt
Definition: equality.h:41
virtual literalt equality2(const exprt &e1, const exprt &e2)
Definition: equality.cpp:25
virtual literalt equality(const exprt &e1, const exprt &e2)
Definition: equality.cpp:17
Base class for all expressions.
Definition: expr.h:56
prop_conv_solvert(propt &_prop, message_handlert &message_handler)
virtual void finish_eager_conversion()
TO_BE_DOCUMENTED.
Definition: prop.h:25
elements_revt elements_rev
Definition: equality.h:46
elementst elements
Definition: equality.h:45
equalitiest equalities
Definition: equality.h:47