1 /********************* */
3 ** Original author: mdeters
4 ** Major contributors: none
5 ** Minor contributors (to current version): dejan
6 ** This file is part of the CVC4 prototype.
7 ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys)
8 ** Courant Institute of Mathematical Sciences
10 ** See the file COPYING in the top-level source directory for licensing
13 ** Base of the theory interface.
16 #ifndef __CVC4__THEORY__THEORY_H
17 #define __CVC4__THEORY__THEORY_H
19 #include "expr/node.h"
20 #include "theory/output_channel.h"
26 * Base class for T-solvers. Abstract DPLL(T).
31 * Return whether a node is shared or not. Used by setup().
33 bool isShared(const Node
& n
);
38 * Subclasses of Theory may add additional efforts. DO NOT CHECK
39 * equality with one of these values (e.g. if STANDARD xxx) but
40 * rather use range checks (or use the helper functions below).
41 * Normally we call QUICK_CHECK or STANDARD; at the leaves we call
51 // TODO add compiler annotation "constant function" here
52 static bool minEffortOnly(Effort e
) { return e
== MIN_EFFORT
; }
53 static bool quickCheckOrMore(Effort e
) { return e
>= QUICK_CHECK
; }
54 static bool quickCheckOnly(Effort e
) { return e
>= QUICK_CHECK
&& e
< STANDARD
; }
55 static bool standardEffortOrMore(Effort e
) { return e
>= STANDARD
; }
56 static bool standardEffortOnly(Effort e
) { return e
>= STANDARD
&& e
< FULL_EFFORT
; }
57 static bool fullEffort(Effort e
) { return e
>= FULL_EFFORT
; }
68 * When get() is called to get the next thing off the theory queue,
69 * setup() is called on its subterms (in TheoryEngine). Then setup()
70 * is called on this node.
72 * This is done in a "context escape" -- that is, at context level 0.
73 * setup() MUST NOT MODIFY context-dependent objects that it hasn't
74 * itself just created.
76 virtual void setup(const Node
& n
) = 0;
79 * Assert a fact in the current context.
81 void assertFact(const Node
& n
);
84 * Check the current assignment's consistency.
86 virtual void check(OutputChannel
& out
,
87 Effort level
= FULL_EFFORT
) = 0;
90 * T-propagate new literal assignments in the current context.
92 virtual void propagate(OutputChannel
& out
,
93 Effort level
= FULL_EFFORT
) = 0;
96 * Return an explanation for the literal represented by parameter n
97 * (which was previously propagated by this theory). Report
98 * explanations to an output channel.
100 virtual void explain(OutputChannel
& out
,
102 Effort level
= FULL_EFFORT
) = 0;
106 }/* CVC4::theory namespace */
107 }/* CVC4 namespace */
109 #endif /* __CVC4__THEORY__THEORY_H */