Fixes for quantifiers + incremental (#2009)
[cvc5.git] / src / theory / quantifiers / local_theory_ext.h
1 /********************* */
2 /*! \file local_theory_ext.h
3 ** \verbatim
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
11 **
12 ** \brief local theory extensions util
13 **/
14
15 #include "cvc4_private.h"
16
17 #ifndef __CVC4__THEORY__LOCAL_THEORY_EXT_H
18 #define __CVC4__THEORY__LOCAL_THEORY_EXT_H
19
20 #include "theory/quantifiers_engine.h"
21 #include "context/cdo.h"
22
23 namespace CVC4 {
24 namespace theory {
25 namespace quantifiers {
26
27 class TermArgTrie;
28
29 class LtePartialInst : public QuantifiersModule {
30 private:
31 // was this module invoked
32 bool d_wasInvoked;
33 // needs check
34 bool d_needsCheck;
35 //representatives per type
36 std::map< TypeNode, std::vector< Node > > d_reps;
37 // should we instantiate quantifier
38 std::map< Node, bool > d_do_inst;
39 // have we instantiated quantifier
40 std::map< Node, bool > d_inst;
41 std::map< Node, std::vector< Node > > d_vars;
42 std::map< Node, std::vector< int > > d_pat_var_order;
43 /** list of relevant quantifiers asserted in the current context */
44 std::vector< Node > d_lte_asserts;
45 /** reset */
46 void reset();
47 /** get instantiations */
48 void getInstantiations( std::vector< Node >& lemmas );
49 void getPartialInstantiations( std::vector< Node >& conj, Node q, Node bvl,
50 std::vector< Node >& vars, std::vector< Node >& inst, std::vector< TypeNode >& types, TermArgTrie * curr,
51 unsigned pindex, unsigned paindex, unsigned iindex );
52 /** get eligible inst variables */
53 void getEligibleInstVars( Node n, std::map< Node, bool >& vars );
54
55 bool addVariableToPatternList( Node v, std::vector< int >& pat_var_order, std::map< Node, int >& var_order );
56 public:
57 LtePartialInst( QuantifiersEngine * qe, context::Context* c );
58 /** determine whether this quantified formula will be reduced */
59 void checkOwnership(Node q) override;
60 /** was invoked */
61 bool wasInvoked() { return d_wasInvoked; }
62
63 /* whether this module needs to check this round */
64 bool needsCheck(Theory::Effort e) override;
65 /* Call during quantifier engine's check */
66 void check(Theory::Effort e, QEffort quant_e) override;
67 /* check complete */
68 bool checkComplete() override { return !d_wasInvoked; }
69 /** Identify this module (for debugging, dynamic configuration, etc..) */
70 std::string identify() const override { return "LtePartialInst"; }
71 };
72
73 }
74 }
75 }
76
77 #endif