-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathSAT2FO.hpp
59 lines (45 loc) · 1.37 KB
/
SAT2FO.hpp
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
48
49
50
51
52
53
54
55
56
57
58
59
/*
* This file is part of the source code of the software program
* Vampire. It is protected by applicable
* copyright laws.
*
* This source code is distributed under the licence found here
* https://vprover.github.io/license.html
* and in the source directory
*/
/**
* @file SAT2FO.hpp
* Defines class SAT2FO.
*/
#ifndef __SAT2FO__
#define __SAT2FO__
#include "Forwards.hpp"
#include "Lib/Numbering.hpp"
#include "Kernel/Inference.hpp"
namespace SAT {
using namespace Lib;
using namespace Kernel;
/**
* Performs conversion between SAT and first-order literals
* assuming it is a one-to-one relation
*
* Also has other utility functions related to the correspondence
* between SAT and first-order literals
*/
class SAT2FO {
public:
SATLiteral toSAT(Literal* l);
SATClause* toSAT(Clause* cl);
Literal* toFO(SATLiteral sl) const;
unsigned createSpareSatVar();
void collectAssignment(SATSolver& solver, LiteralStack& res) const;
SATClause* createConflictClause(LiteralStack& unsatCore, InferenceRule rule=InferenceRule::THEORY_TAUTOLOGY_SAT_CONFLICT);
unsigned maxSATVar() const { return _posMap.getNumberUpperBound(); }
void reset(){ _posMap.reset(); }
friend std::ostream& operator<<(std::ostream& out, SAT2FO const& self);
private:
typedef Numbering<Literal *, 1 /* variables start from 1 */ > TwoWayMap;
TwoWayMap _posMap;
};
}
#endif // __SAT2FO__