3db8db74ed21c5e1d058e29a2397ca67408e7794
1 /********************* */
2 /*! \file inst_match.cpp
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Morgan Deters, Francois Bobot
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
12 ** \brief Implementation of inst match class
15 #include "theory/quantifiers/inst_match.h"
17 #include "theory/quantifiers/quantifiers_state.h"
21 namespace quantifiers
{
23 InstMatch::InstMatch(TNode q
)
25 d_vals
.resize(q
[0].getNumChildren());
26 Assert(!d_vals
.empty());
27 // resize must initialize with null nodes
28 Assert(d_vals
[0].isNull());
31 InstMatch::InstMatch( InstMatch
* m
) {
32 d_vals
.insert( d_vals
.end(), m
->d_vals
.begin(), m
->d_vals
.end() );
35 void InstMatch::add(InstMatch
& m
)
37 for (unsigned i
= 0, size
= d_vals
.size(); i
< size
; i
++)
39 if( d_vals
[i
].isNull() ){
40 d_vals
[i
] = m
.d_vals
[i
];
45 void InstMatch::debugPrint( const char* c
){
46 for (unsigned i
= 0, size
= d_vals
.size(); i
< size
; i
++)
48 if( !d_vals
[i
].isNull() ){
49 Debug( c
) << " " << i
<< " -> " << d_vals
[i
] << std::endl
;
54 bool InstMatch::isComplete() {
55 for (Node
& v
: d_vals
)
65 bool InstMatch::empty() {
66 for (Node
& v
: d_vals
)
76 void InstMatch::clear() {
77 for( unsigned i
=0; i
<d_vals
.size(); i
++ ){
78 d_vals
[i
] = Node::null();
82 Node
InstMatch::get(size_t i
) const
84 Assert(i
< d_vals
.size());
88 void InstMatch::setValue(size_t i
, TNode n
)
90 Assert(i
< d_vals
.size());
93 bool InstMatch::set(QuantifiersState
& qs
, size_t i
, TNode n
)
95 Assert(i
< d_vals
.size());
96 if( !d_vals
[i
].isNull() ){
97 return qs
.areEqual(d_vals
[i
], n
);
103 } // namespace quantifiers
104 } // namespace theory