1 /********************* */
2 /*! \file candidate_generator.h
4 ** Original author: ajreynol
5 ** Major contributors: mdeters
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009-2012 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
12 ** \brief Theory uf candidate generator
15 #include "cvc4_private.h"
17 #ifndef __CVC4__THEORY__QUANTIFIERS__CANDIDATE_GENERATOR_H
18 #define __CVC4__THEORY__QUANTIFIERS__CANDIDATE_GENERATOR_H
20 #include "theory/theory.h"
21 #include "theory/uf/equality_engine.h"
26 class QuantifiersEngine
;
30 /** base class for generating candidates for matching */
31 class CandidateGenerator
{
33 CandidateGenerator(){}
34 ~CandidateGenerator(){}
36 /** Get candidates functions. These set up a context to get all match candidates.
39 Node cand = cg->getNextCandidate();
41 }while( !cand.isNull() );
43 eqc is the equivalence class you are searching in
45 virtual void reset( Node eqc
) = 0;
46 virtual Node
getNextCandidate() = 0;
47 /** add candidate to list of nodes returned by this generator */
48 virtual void addCandidate( Node n
) {}
49 /** call this at the beginning of each instantiation round */
50 virtual void resetInstantiationRound() = 0;
52 /** legal candidate */
53 static bool isLegalCandidate( Node n
);
54 };/* class CandidateGenerator */
56 /** candidate generator queue (for manual candidate generation) */
57 class CandidateGeneratorQueue
: public CandidateGenerator
{
59 std::vector
< Node
> d_candidates
;
60 int d_candidate_index
;
62 CandidateGeneratorQueue() : d_candidate_index( 0 ){}
63 ~CandidateGeneratorQueue(){}
65 void addCandidate( Node n
);
67 void resetInstantiationRound(){}
68 void reset( Node eqc
);
69 Node
getNextCandidate();
70 };/* class CandidateGeneratorQueue */
72 class CandidateGeneratorQEDisequal
;
76 class CandidateGeneratorQE
: public CandidateGenerator
78 friend class CandidateGeneratorQEDisequal
;
80 //operator you are looking for
82 //instantiator pointer
83 QuantifiersEngine
* d_qe
;
84 //the equality class iterator
85 eq::EqClassIterator d_eqc
;
87 int d_term_iter_limit
;
91 CandidateGeneratorQE( QuantifiersEngine
* qe
, Node op
);
92 ~CandidateGeneratorQE(){}
94 void resetInstantiationRound();
95 void reset( Node eqc
);
96 Node
getNextCandidate();
101 class CandidateGeneratorQE
: public CandidateGenerator
103 friend class CandidateGeneratorQEDisequal
;
105 //operator you are looking for
107 //instantiator pointer
108 QuantifiersEngine
* d_qe
;
109 //the equality class iterator
110 std::vector
< Node
> d_eqc
;
112 int d_term_iter_limit
;
113 bool d_using_term_db
;
115 CandidateGeneratorQE( QuantifiersEngine
* qe
, Node op
);
116 ~CandidateGeneratorQE(){}
118 void resetInstantiationRound();
119 void reset( Node eqc
);
120 Node
getNextCandidate();
125 //class CandidateGeneratorQEDisequal : public CandidateGenerator
128 // //equivalence class
130 // //equivalence class info
131 // EqClassInfo* d_eci;
132 // //equivalence class iterator
133 // EqClassInfo::BoolMap::const_iterator d_eqci_iter;
134 // //instantiator pointer
135 // QuantifiersEngine* d_qe;
137 // CandidateGeneratorQEDisequal( QuantifiersEngine* qe, Node eqc );
138 // ~CandidateGeneratorQEDisequal(){}
140 // void resetInstantiationRound();
141 // void reset( Node eqc ); //should be what you want to be disequal from
142 // Node getNextCandidate();
145 class CandidateGeneratorQELitEq
: public CandidateGenerator
148 //the equality classes iterator
149 eq::EqClassesIterator d_eq
;
150 //equality you are trying to match equalities for
151 Node d_match_pattern
;
152 //einstantiator pointer
153 QuantifiersEngine
* d_qe
;
155 CandidateGeneratorQELitEq( QuantifiersEngine
* qe
, Node mpat
);
156 ~CandidateGeneratorQELitEq(){}
158 void resetInstantiationRound();
159 void reset( Node eqc
);
160 Node
getNextCandidate();
163 class CandidateGeneratorQELitDeq
: public CandidateGenerator
166 //the equality class iterator for false
167 eq::EqClassIterator d_eqc_false
;
168 //equality you are trying to match disequalities for
169 Node d_match_pattern
;
170 //einstantiator pointer
171 QuantifiersEngine
* d_qe
;
173 CandidateGeneratorQELitDeq( QuantifiersEngine
* qe
, Node mpat
);
174 ~CandidateGeneratorQELitDeq(){}
176 void resetInstantiationRound();
177 void reset( Node eqc
);
178 Node
getNextCandidate();
181 }/* CVC4::theory::inst namespace */
182 }/* CVC4::theory namespace */
183 }/* CVC4 namespace */
185 #endif /* __CVC4__THEORY__QUANTIFIERS__CANDIDATE_GENERATOR_H */