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"
21 #include "context/context.h"
27 * Base class for T-solvers. Abstract DPLL(T).
32 * Return whether a node is shared or not. Used by setup().
34 bool isShared(const Node
& n
);
39 * Subclasses of Theory may add additional efforts. DO NOT CHECK
40 * equality with one of these values (e.g. if STANDARD xxx) but
41 * rather use range checks (or use the helper functions below).
42 * Normally we call QUICK_CHECK or STANDARD; at the leaves we call
52 // TODO add compiler annotation "constant function" here
53 static bool minEffortOnly(Effort e
) { return e
== MIN_EFFORT
; }
54 static bool quickCheckOrMore(Effort e
) { return e
>= QUICK_CHECK
; }
55 static bool quickCheckOnly(Effort e
) { return e
>= QUICK_CHECK
&& e
< STANDARD
; }
56 static bool standardEffortOrMore(Effort e
) { return e
>= STANDARD
; }
57 static bool standardEffortOnly(Effort e
) { return e
>= STANDARD
&& e
< FULL_EFFORT
; }
58 static bool fullEffort(Effort e
) { return e
>= FULL_EFFORT
; }
67 * Destructs a Theory. This implementation does nothing, but we
68 * need a virtual destructor for safety in case subclasses have a
77 * When get() is called to get the next thing off the theory queue,
78 * setup() is called on its subterms (in TheoryEngine). Then setup()
79 * is called on this node.
81 * This is done in a "context escape" -- that is, at context level 0.
82 * setup() MUST NOT MODIFY context-dependent objects that it hasn't
83 * itself just created.
85 virtual void setup(const Node
& n
) = 0;
88 * Assert a fact in the current context.
90 void assertFact(const Node
& n
);
93 * Check the current assignment's consistency.
95 virtual void check(OutputChannel
& out
,
96 Effort level
= FULL_EFFORT
) = 0;
99 * T-propagate new literal assignments in the current context.
101 virtual void propagate(OutputChannel
& out
,
102 Effort level
= FULL_EFFORT
) = 0;
105 * Return an explanation for the literal represented by parameter n
106 * (which was previously propagated by this theory). Report
107 * explanations to an output channel.
109 virtual void explain(OutputChannel
& out
,
111 Effort level
= FULL_EFFORT
) = 0;
115 * Returns the next atom in the assertFact() queue.
116 * Guarentees that registerTerm is called on the theory specific subterms.
117 * @return the next atom in the assertFact() queue.
122 * Returns true if the assertFactQueue is empty
124 bool done() { return true; }
128 }/* CVC4::theory namespace */
129 }/* CVC4 namespace */
131 #endif /* __CVC4__THEORY__THEORY_H */