blob: 5c50c7a3730f11ec0dca2f6fbd356fed11ce205e (
plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/********************* -*- C++ -*- */
/** theory.h
** This file is part of the CVC4 prototype.
**
** The Analysis of Computer Systems Group (ACSys)
** Courant Institute of Mathematical Sciences
** New York University
**/
#ifndef __CVC4_THEORY_H
#define __CVC4_THEORY_H
#include "expr.h"
#include "literal.h"
namespace CVC4 {
/**
* Base class for T-solvers. Abstract DPLL(T).
*/
class Theory {
public:
/**
* Subclasses of Theory may add additional efforts. DO NOT CHECK
* equality with one of these values (e.g. if STANDARD xxx) but
* rather use range checks (or use the helper functions below).
* Normally we call QUICK_CHECK or STANDARD; at the leaves we call
* with MAX_EFFORT.
*/
enum Effort {
MIN_EFFORT = 0,
QUICK_CHECK = 10,
STANDARD = 50,
FULL_EFFORT = 100
};/* enum Effort */
// TODO add compiler annotation "constant function" here
static bool minEffortOnly(Effort e) { return e == MIN_EFFORT; }
static bool quickCheckOrMore(Effort e) { return e >= QUICK_CHECK; }
static bool quickCheckOnly(Effort e) { return e >= QUICK_CHECK && e < STANDARD; }
static bool standardEffortOrMore(Effort e) { return e >= STANDARD; }
static bool standardEffortOnly(Effort e) { return e >= STANDARD && e < FULL_EFFORT; }
static bool fullEffort(Effort e) { return e >= FULL_EFFORT; }
/**
* Prepare for an Expr.
*/
virtual void setup(Expr) = 0;
/**
* Assert a literal in the current context.
*/
virtual void assert(Literal) = 0;
/**
* Check the current assignment's consistency. Return false iff inconsistent.
*/
virtual bool check(Effort level = FULL_EFFORT) = 0;
/**
* T-propagate new literal assignments in the current context.
*/
// TODO design decision: instead of returning a set of literals
// here, perhaps we have an interface back into the prop engine
// where we assert directly. we might sometimes unknowingly assert
// something clearly inconsistent (esp. in a parallel context).
// This would allow the PropEngine to cancel our further work since
// we're already inconsistent---also could strategize dynamically on
// whether enough theory prop work has occurred.
virtual void propagate(Effort level = FULL_EFFORT) = 0;
/**
* Return an explanation for the literal (which was previously propagated by this theory)..
*/
virtual Expr explain(Literal) = 0;
};/* class Theory */
}/* CVC4 namespace */
#endif /* __CVC4_THEORY_H */
|