GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/inst_match.h Lines: 1 14 7.1 %
Date: 2021-03-23 Branches: 0 8 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file inst_match.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Andrew Reynolds, Morgan Deters, Mathias Preiner
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief inst match class
13
 **/
14
15
#include "cvc4_private.h"
16
17
#ifndef CVC4__THEORY__QUANTIFIERS__INST_MATCH_H
18
#define CVC4__THEORY__QUANTIFIERS__INST_MATCH_H
19
20
#include <vector>
21
22
#include "expr/node.h"
23
24
namespace CVC4 {
25
namespace theory {
26
27
namespace quantifiers {
28
class QuantifiersState;
29
}
30
31
namespace inst {
32
33
/** Inst match
34
 *
35
 * This is the basic class specifying an instantiation. Its domain size (the
36
 * size of d_vals) is the number of bound variables of the quantified formula
37
 * that is passed to its constructor.
38
 *
39
 * The values of d_vals may be null, which indicate that the field has
40
 * yet to be initialized.
41
 */
42
120908
class InstMatch {
43
public:
44
  InstMatch(){}
45
  explicit InstMatch(TNode q);
46
  InstMatch( InstMatch* m );
47
  /* map from variable to ground terms */
48
  std::vector<Node> d_vals;
49
  /** add match m
50
   *
51
   * This adds the initialized fields of m to this match for each field that is
52
   * not already initialized in this match.
53
   */
54
  void add(InstMatch& m);
55
  /** is this complete, i.e. are all fields non-null? */
56
  bool isComplete();
57
  /** is this empty, i.e. are all fields the null node? */
58
  bool empty();
59
  /** clear the instantiation, i.e. set all fields to the null node */
60
  void clear();
61
  /** debug print method */
62
  void debugPrint(const char* c);
63
  /** to stream */
64
  inline void toStream(std::ostream& out) const {
65
    out << "INST_MATCH( ";
66
    bool printed = false;
67
    for( unsigned i=0; i<d_vals.size(); i++ ){
68
      if( !d_vals[i].isNull() ){
69
        if( printed ){ out << ", "; }
70
        out << i << " -> " << d_vals[i];
71
        printed = true;
72
      }
73
    }
74
    out << " )";
75
  }
76
  /** get the i^th term in the instantiation */
77
  Node get(size_t i) const;
78
  /** set/overwrites the i^th field in the instantiation with n */
79
  void setValue(size_t i, TNode n);
80
  /** set the i^th term in the instantiation to n
81
   *
82
   * This method returns true if the i^th field was previously uninitialized,
83
   * or is equivalent to n modulo the equalities given by q.
84
   */
85
  bool set(quantifiers::QuantifiersState& qs, size_t i, TNode n);
86
};
87
88
inline std::ostream& operator<<(std::ostream& out, const InstMatch& m) {
89
  m.toStream(out);
90
  return out;
91
}
92
93
}/* CVC4::theory::inst namespace */
94
95
typedef CVC4::theory::inst::InstMatch InstMatch;
96
97
}/* CVC4::theory namespace */
98
}/* CVC4 namespace */
99
100
#endif /* CVC4__THEORY__QUANTIFIERS__INST_MATCH_H */