about summary refs log tree commit diff homepage
path: root/stp/AST/cnftest.cpp
blob: 7ce270c8c108dbb67f6d0c544e45acd4551af716 (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
44
45
46
47
// -*- c++ -*-

// Test program for CNF conversion.

#include "AST.h"

using namespace BEEV;

int main()
{
  const int size = 1;
  
  BeevMgr *bm = new BeevMgr();
  ASTNode s1 = bm->CreateSymbol("x");
  s1.SetValueWidth(size);
  
  cout << "s1" <<  s1 << endl;
  ASTNode s2 = bm->CreateSymbol("y");
  s2.SetValueWidth(size);

  cout << "s2" <<  s2 << endl;
  ASTNode s3 = bm->CreateSymbol("z");
  s3.SetValueWidth(size);
  
  cout << "s3" <<  s3 << endl;

  ASTNode bbs1 = bm->BBForm(s1);
  cout << "bitblasted s1" << endl << bbs1 << endl;
  bm->PrintClauseList(cout, bm->ToCNF(bbs1));

  ASTNode a2 = bm->CreateNode(AND, s1, s2);
  ASTNode bba2 = bm->BBForm(a2);
  cout << "bitblasted a2" << endl << bba2 << endl;
  bm->PrintClauseList(cout, bm->ToCNF(bba2));

  ASTNode a3 = bm->CreateNode(OR, s1, s2);
  ASTNode bba3 = bm->BBForm(a3);
  cout << "bitblasted a3" << endl << bba3 << endl;
  bm->PrintClauseList(cout, bm->ToCNF(bba3));

  ASTNode a4 = bm->CreateNode(EQ, s1, s2);
  ASTNode bba4 = bm->BBForm(a4);
  cout << "bitblasted a4 " << endl << bba4 << endl;

  bm->PrintClauseList(cout, bm->ToCNF(bba4));

}