cprover
graphml_witness.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Witnesses for Traces and Proofs
4 
5 Author: Daniel Kroening
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_GOTO_PROGRAMS_GRAPHML_WITNESS_H
13 #define CPROVER_GOTO_PROGRAMS_GRAPHML_WITNESS_H
14 
15 #include <xmllang/graphml.h>
16 
18 
19 #include "goto_trace.h"
20 
22 {
23 public:
24  explicit graphml_witnesst(const namespacet &_ns)
25  : ns(_ns)
26  {
27  }
28 
29  void operator()(const goto_tracet &goto_trace);
30  void operator()(const symex_target_equationt &equation);
31 
32  const graphmlt &graph()
33  {
34  return graphml;
35  }
36 
37 protected:
38  const namespacet &ns;
40 
41  void remove_l0_l1(exprt &expr);
42  std::string convert_assign_rec(
43  const irep_idt &identifier,
44  const code_assignt &assign);
45 
46  template <typename T>
47  static void hash_combine(std::size_t &seed, const T &v)
48  {
49  std::hash<T> hasher;
50  seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
51  }
52 
53  template <typename S, typename T>
54  struct pair_hash // NOLINT(readability/identifiers)
55  {
56  std::size_t operator()(const std::pair<S, T> &v) const
57  {
58  std::size_t seed = 0;
59  hash_combine(seed, v.first);
60  hash_combine(seed, v.second);
61  return seed;
62  }
63  };
64  std::unordered_map<
65  std::pair<unsigned int, const irept::dt *>,
66  std::string,
67  pair_hash<unsigned int, const irept::dt *>>
69 };
70 
71 #endif // CPROVER_GOTO_PROGRAMS_GRAPHML_WITNESS_H
A codet representing an assignment in the program.
Definition: std_code.h:295
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
Base class for all expressions.
Definition: expr.h:54
Trace of a GOTO program.
Definition: goto_trace.h:177
const namespacet & ns
const graphmlt & graph()
static void hash_combine(std::size_t &seed, const T &v)
void operator()(const goto_tracet &goto_trace)
counterexample witness
std::unordered_map< std::pair< unsigned int, const irept::dt * >, std::string, pair_hash< unsigned int, const irept::dt * > > cache
graphml_witnesst(const namespacet &_ns)
void remove_l0_l1(exprt &expr)
std::string convert_assign_rec(const irep_idt &identifier, const code_assignt &assign)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:92
Inheriting the interface of symex_targett this class represents the SSA form of the input program as ...
Traces of GOTO Programs.
Read/write graphs as GraphML.
std::size_t operator()(const std::pair< S, T > &v) const
Generate Equation using Symbolic Execution.