GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/quant_util.h Lines: 4 6 66.7 %
Date: 2021-05-22 Branches: 0 0 0.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
 * quantifier util
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__QUANT_UTIL_H
19
#define CVC5__THEORY__QUANT_UTIL_H
20
21
#include <iostream>
22
#include <map>
23
#include <vector>
24
25
#include "expr/node.h"
26
#include "theory/incomplete_id.h"
27
#include "theory/theory.h"
28
29
namespace cvc5 {
30
namespace theory {
31
32
/** Quantifiers utility
33
 *
34
 * This is a lightweight version of a quantifiers module that does not implement
35
 * methods for checking satisfiability.
36
 */
37
class QuantifiersUtil {
38
public:
39
47387
  QuantifiersUtil(){}
40
47387
  virtual ~QuantifiersUtil(){}
41
  /* reset
42
   * Called at the beginning of an instantiation round
43
   * Returns false if the reset failed. When reset fails, the utility should
44
   * have added a lemma via a call to d_qim.addPendingLemma.
45
   */
46
  virtual bool reset(Theory::Effort e) { return true; }
47
  /* Called for new quantifiers */
48
  virtual void registerQuantifier(Node q) {}
49
  /** Identify this module (for debugging, dynamic configuration, etc..) */
50
  virtual std::string identify() const = 0;
51
  /** Check complete?
52
   *
53
   * Returns false if the utility's reasoning was globally incomplete
54
   * (e.g. "sat" must be replaced with "incomplete"). If this method returns
55
   * false, it should update incId to the reason for incompleteness.
56
   */
57
10875
  virtual bool checkComplete(IncompleteId& incId) { return true; }
58
};
59
60
class QuantPhaseReq
61
{
62
private:
63
  /** helper functions compute phase requirements */
64
  void computePhaseReqs( Node n, bool polarity, std::map< Node, int >& phaseReqs );
65
public:
66
  QuantPhaseReq(){}
67
  QuantPhaseReq( Node n, bool computeEq = false );
68
99069
  ~QuantPhaseReq(){}
69
  void initialize( Node n, bool computeEq );
70
  /** is phase required */
71
  bool isPhaseReq( Node lit ) { return d_phase_reqs.find( lit )!=d_phase_reqs.end(); }
72
  /** get phase requirement */
73
  bool getPhaseReq( Node lit ) { return d_phase_reqs.find( lit )==d_phase_reqs.end() ? false : d_phase_reqs[ lit ]; }
74
  /** phase requirements for each quantifier for each instantiation literal */
75
  std::map< Node, bool > d_phase_reqs;
76
  std::map< Node, bool > d_phase_reqs_equality;
77
  std::map< Node, Node > d_phase_reqs_equality_term;
78
79
  static void getPolarity( Node n, int child, bool hasPol, bool pol, bool& newHasPol, bool& newPol );
80
  static void getEntailPolarity( Node n, int child, bool hasPol, bool pol, bool& newHasPol, bool& newPol );
81
};
82
83
}
84
}  // namespace cvc5
85
86
#endif /* CVC5__THEORY__QUANT_UTIL_H */