GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/quant_split.h Lines: 2 2 100.0 %
Date: 2021-09-16 Branches: 1 2 50.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Mathias Preiner
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 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.
11
 * ****************************************************************************
12
 *
13
 * dynamic quantifiers splitting
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__QUANT_SPLIT_H
19
#define CVC5__THEORY__QUANT_SPLIT_H
20
21
#include "context/cdo.h"
22
#include "smt/env_obj.h"
23
#include "theory/quantifiers/quant_module.h"
24
25
namespace cvc5 {
26
namespace theory {
27
28
class QuantifiersEngine;
29
30
namespace quantifiers {
31
32
/** Quantifiers dynamic splitting
33
 *
34
 * This module identifies quantified formulas that should be "split", e.g.
35
 * based on datatype constructor case splitting.
36
 *
37
 * An example of a quantified formula that we may split is the following. Let:
38
 *   optionPair := mkPair( U, U ) | none
39
 * where U is an uninterpreted sort. The quantified formula:
40
 *   forall x : optionPair. P( x )
41
 * may be "split" via the lemma:
42
 *   forall x : optionPair. P( x ) <=>
43
 *   ( forall xy : U. P( mkPair( x, y ) ) OR P( none ) )
44
 *
45
 * Notice that such splitting may lead to exponential behavior, say if we
46
 * quantify over 32 variables of type optionPair above gives 2^32 disjuncts.
47
 * This class is used to compute this splitting dynamically, by splitting
48
 * one variable per quantified formula at a time.
49
 */
50
11034
class QuantDSplit : public QuantifiersModule {
51
  typedef context::CDHashSet<Node> NodeSet;
52
53
 public:
54
  QuantDSplit(Env& env,
55
              QuantifiersState& qs,
56
              QuantifiersInferenceManager& qim,
57
              QuantifiersRegistry& qr,
58
              TermRegistry& tr);
59
  /** determine whether this quantified formula will be reduced */
60
  void checkOwnership(Node q) override;
61
  /* whether this module needs to check this round */
62
  bool needsCheck(Theory::Effort e) override;
63
  /* Call during quantifier engine's check */
64
  void check(Theory::Effort e, QEffort quant_e) override;
65
  /** check complete for */
66
  bool checkCompleteFor(Node q) override;
67
  /** Identify this module (for debugging, dynamic configuration, etc..) */
68
54248
  std::string identify() const override { return "QuantDSplit"; }
69
70
 private:
71
  /** list of relevant quantifiers asserted in the current context */
72
  std::map<Node, int> d_quant_to_reduce;
73
  /** whether we have instantiated quantified formulas */
74
  NodeSet d_added_split;
75
};
76
77
}
78
}
79
}  // namespace cvc5
80
81
#endif