GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/quant_relevance.cpp Lines: 19 20 95.0 %
Date: 2021-08-01 Branches: 21 36 58.3 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Aina Niemetz
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
 * Implementation of quantifier relevance.
14
 */
15
16
#include "theory/quantifiers/quant_relevance.h"
17
18
using namespace std;
19
using namespace cvc5::kind;
20
using namespace cvc5::context;
21
22
namespace cvc5 {
23
namespace theory {
24
namespace quantifiers {
25
26
344
void QuantRelevance::registerQuantifier(Node f)
27
{
28
  // compute symbols in f
29
688
  std::vector<Node> syms;
30
344
  computeSymbols(f[1], syms);
31
344
  d_syms[f].insert(d_syms[f].begin(), syms.begin(), syms.end());
32
344
}
33
34
/** compute symbols */
35
49809
void QuantRelevance::computeSymbols(Node n, std::vector<Node>& syms)
36
{
37
49809
  if (n.getKind() == APPLY_UF)
38
  {
39
54554
    Node op = n.getOperator();
40
27277
    if (std::find(syms.begin(), syms.end(), op) == syms.end())
41
    {
42
1581
      syms.push_back(op);
43
    }
44
  }
45
49809
  if (n.getKind() != FORALL)
46
  {
47
99211
    for (int i = 0; i < (int)n.getNumChildren(); i++)
48
    {
49
49465
      computeSymbols(n[i], syms);
50
    }
51
  }
52
49809
}
53
54
1452
size_t QuantRelevance::getNumQuantifiersForSymbol(Node s) const
55
{
56
1452
  std::map<Node, std::vector<Node> >::const_iterator it = d_syms_quants.find(s);
57
1452
  if (it == d_syms_quants.end())
58
  {
59
1452
    return 0;
60
  }
61
  return it->second.size();
62
}
63
64
}  // namespace quantifiers
65
}  // namespace theory
66
29280
}  // namespace cvc5