SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
ValidationPrinter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ValidationPoint.h"
4 #include "ValidationCollector.h"
5 #include <carl-io/SMTLIBStream.h>
6 
7 #include <fstream>
8 #include <iostream>
9 #include <iomanip>
10 
11 namespace smtrat {
12 namespace validation {
13 
15  SMTLIB
16 };
17 
18 template<ValidationOutputFormat SOF>
20 
21 template<ValidationOutputFormat SOF>
22 std::ostream& operator<<(std::ostream& os, ValidationPrinter<SOF>);
23 
24 template<>
26  carl::io::SMTLIBStream sls;
27  sls.setInfo("smt-lib-version", "2.0");
28  for (const auto& s: ValidationCollector::getInstance().points()) {
29  if (s->formulas().empty()) continue;
30  int id = 0;
31  for (const auto& kv: s->formulas()) {
32  sls.reset();
33  sls.comment(s->identifier() + " #" + std::to_string(id) + " (" + std::get<2>(kv) + ")");
34  sls.echo(s->identifier() + " #" + std::to_string(id) + " (" + std::get<2>(kv) + ")");
35  sls.setOption("interactive-mode", "true");
36  sls.setInfo("status", (std::get<1>(kv) ? "sat" : "unsat"));
37  #ifndef VALIDATION_STORE_STRINGS
38  sls.declare(std::get<0>(kv).logic());
39  sls.declare(carl::variables(std::get<0>(kv)));
40  sls.assertFormula(std::get<0>(kv));
41  #else
42  sls << std::get<0>(kv);
43  #endif
44  sls.getAssertions();
45  sls.checkSat();
46  id++;
47  }
48  }
49  sls.exit();
50  os << sls;
51  return os;
52 }
53 
56 }
57 
58 void validation_formulas_to_smtlib_file(const std::string& filename) {
59  std::ofstream file;
60  file.open(filename, std::ios::out);
62  file.close();
63 }
64 
65 
66 }
67 }
void validation_formulas_to_smtlib_file(const std::string &filename)
auto validation_formulas_as_smtlib()
std::ostream & operator<<(std::ostream &os, ValidationPrinter< SOF >)
Class to create the formulas for axioms.