about summary refs log tree commit diff homepage
path: root/lib/SMT/main.cpp
blob: 034c4ce437bd63e57e82395a95ba8a716b61815c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "SMTParser.h"

#include "klee/ExprBuilder.h"

#include <iostream>

using namespace std;
using namespace klee;

int main(int argc, char** argv) {
  if (argc != 2) {
    cout << "Usage: " << argv[0] << " <smt-filename>\n";
    return 1;
  }
  
  enum BuilderKinds {
    DefaultBuilder,
    ConstantFoldingBuilder,
    SimplifyingBuilder
  } BuilderKind = SimplifyingBuilder;

  ExprBuilder *Builder = 0;
  switch (BuilderKind) {
  case DefaultBuilder:
    Builder = createDefaultExprBuilder();
    break;
  case ConstantFoldingBuilder:
    Builder = createDefaultExprBuilder();
    Builder = createConstantFoldingExprBuilder(Builder);
    break;
  case SimplifyingBuilder:
    Builder = createDefaultExprBuilder();
    Builder = createConstantFoldingExprBuilder(Builder);
    Builder = createSimplifyingExprBuilder(Builder);
    break;
  }
  
  klee::expr::SMTParser smtParser(argv[1], Builder);
  smtParser.Parse();
  int result = smtParser.Solve();
  
  cout << (result ? "UNSAT":"SAT") << "\n"; 
}