SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
ValidationPoint.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <map>
4 #include <sstream>
5 #include <algorithm>
6 #include <assert.h>
7 #include <tuple>
8 
9 #include "../types.h"
10 
11 #define VALIDATION_STORE_STRINGS
12 
13 
14 #ifdef VALIDATION_STORE_STRINGS
15 #include <carl-io/SMTLIBStream.h>
16 #endif
17 
18 namespace smtrat {
19 namespace validation {
20 
22 private:
23  std::string m_channel;
24  std::string m_file;
25  int m_line;
26  #ifndef VALIDATION_STORE_STRINGS
27  std::vector<std::tuple<FormulaT, bool, std::string>> m_formulas;
28  #else
29  std::vector<std::tuple<std::string, bool, std::string>> m_formulas;
30  #endif
31 public:
32  void set_identifier(const std::string& channel, const std::string& file, int line) {
34  m_file = file;
35  m_line = line;
36  }
37  const auto& channel() const {
38  return m_channel;
39  }
40  auto identifier() const {
41  return m_channel + " " + m_file + ":" + std::to_string(m_line);
42  }
43  const auto& formulas() const {
44  return m_formulas;
45  }
46  std::size_t add(const FormulaT& f, bool consistent, const std::string& name) {
47  #ifndef VALIDATION_STORE_STRINGS
48  m_formulas.emplace_back(f, consistent, name);
49  #else
50  carl::io::SMTLIBStream sls;
51  sls.declare(f.logic());
52  sls.declare(carl::variables(f));
53  sls.assertFormula(f);
54  m_formulas.emplace_back(sls.str(), consistent, name);
55  #endif
56  return m_formulas.size() - 1;
57  }
58  std::size_t add(const FormulasT& fs, bool consistent, const std::string& name) {
59  return add(FormulaT(carl::FormulaType::AND, fs), consistent, name);
60  }
61  std::size_t add(const FormulaSetT& fss, bool consistent, const std::string& name) {
62  FormulasT fs(fss.begin(), fss.end());
63  return add(FormulaT(carl::FormulaType::AND, std::move(fs)), consistent, name);
64  }
65  std::size_t add(const ConstraintT& c, bool consistent, const std::string& name) {
66  return add(FormulaT(c), consistent, name);
67  }
68  std::size_t add(const ConstraintsT& cs, bool consistent, const std::string& name) {
69  FormulasT fs;
70  for (const auto& c: cs) {
71  fs.emplace_back(c);
72  }
73  return add(FormulaT(carl::FormulaType::AND, std::move(fs)), consistent, name);
74  }
75 };
76 
77 }
78 }
std::size_t add(const ConstraintsT &cs, bool consistent, const std::string &name)
std::size_t add(const FormulasT &fs, bool consistent, const std::string &name)
void set_identifier(const std::string &channel, const std::string &file, int line)
std::vector< std::tuple< std::string, bool, std::string > > m_formulas
std::size_t add(const FormulaT &f, bool consistent, const std::string &name)
std::size_t add(const FormulaSetT &fss, bool consistent, const std::string &name)
std::size_t add(const ConstraintT &c, bool consistent, const std::string &name)
Class to create the formulas for axioms.
carl::Constraints< Poly > ConstraintsT
Definition: types.h:31
carl::FormulaSet< Poly > FormulaSetT
Definition: types.h:41
carl::Formula< Poly > FormulaT
Definition: types.h:37
carl::Constraint< Poly > ConstraintT
Definition: types.h:29
carl::Formulas< Poly > FormulasT
Definition: types.h:39