summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers/quant_split.h
blob: bea0c34390b9e770e6574208c13b6ae560d637a3 (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
/*********************                                                        */
/*! \file quant_split.h
 ** \verbatim
 ** Top contributors (to current version):
 **   Andrew Reynolds, Mathias Preiner
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2019 by the authors listed in the file AUTHORS
 ** in the top-level source directory) and their institutional affiliations.
 ** All rights reserved.  See the file COPYING in the top-level source
 ** directory for licensing information.\endverbatim
 **
 ** \brief dynamic quantifiers splitting
 **/

#include "cvc4_private.h"

#ifndef CVC4__THEORY__QUANT_SPLIT_H
#define CVC4__THEORY__QUANT_SPLIT_H

#include "context/cdo.h"
#include "theory/quantifiers/quant_util.h"

namespace CVC4 {
namespace theory {

class QuantifiersEngine;

namespace quantifiers {

/** Quantifiers dynamic splitting
 *
 * This module identifies quantified formulas that should be "split", e.g.
 * based on datatype constructor case splitting.
 *
 * An example of a quantified formula that we may split is the following. Let:
 *   optionPair := mkPair( U, U ) | none
 * where U is an uninterpreted sort. The quantified formula:
 *   forall x : optionPair. P( x )
 * may be "split" via the lemma:
 *   forall x : optionPair. P( x ) <=>
 *   ( forall xy : U. P( mkPair( x, y ) ) OR P( none ) )
 *
 * Notice that such splitting may lead to exponential behavior, say if we
 * quantify over 32 variables of type optionPair above gives 2^32 disjuncts.
 * This class is used to compute this splitting dynamically, by splitting
 * one variable per quantified formula at a time.
 */
class QuantDSplit : public QuantifiersModule {
  typedef context::CDHashSet<Node, NodeHashFunction> NodeSet;

 public:
  QuantDSplit( QuantifiersEngine * qe, context::Context* c );
  /** determine whether this quantified formula will be reduced */
  void checkOwnership(Node q) override;
  /* whether this module needs to check this round */
  bool needsCheck(Theory::Effort e) override;
  /* Call during quantifier engine's check */
  void check(Theory::Effort e, QEffort quant_e) override;
  /** check complete for */
  bool checkCompleteFor(Node q) override;
  /** Identify this module (for debugging, dynamic configuration, etc..) */
  std::string identify() const override { return "QuantDSplit"; }

 private:
  /** list of relevant quantifiers asserted in the current context */
  std::map<Node, int> d_quant_to_reduce;
  /** whether we have instantiated quantified formulas */
  NodeSet d_added_split;
};

}
}
}

#endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback