GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/quantifiers/fun_def_evaluator.h Lines: 2 2 100.0 %
Date: 2021-03-23 Branches: 0 0 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file fun_def_evaluator.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Andrew Reynolds
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 Techniques for evaluating terms with recursively defined functions.
13
 **/
14
15
#include "cvc4_private.h"
16
17
#ifndef CVC4__QUANTIFIERS_FUN_DEF_EVALUATOR_H
18
#define CVC4__QUANTIFIERS_FUN_DEF_EVALUATOR_H
19
20
#include <map>
21
#include <vector>
22
#include "expr/node.h"
23
#include "theory/evaluator.h"
24
25
namespace CVC4 {
26
namespace theory {
27
namespace quantifiers {
28
29
/**
30
 * Techniques for evaluating recursively defined functions.
31
 */
32
class FunDefEvaluator
33
{
34
 public:
35
  FunDefEvaluator();
36
2188
  ~FunDefEvaluator() {}
37
  /**
38
   * Assert definition of a (recursive) function definition given by quantified
39
   * formula q.
40
   */
41
  void assertDefinition(Node q);
42
  /**
43
   * Simplify node based on the (recursive) function definitions known by this
44
   * class. If n cannot be simplified to a constant, then this method returns
45
   * null.
46
   */
47
  Node evaluate(Node n) const;
48
  /**
49
   * Has a call to assertDefinition been made? If this returns false, then
50
   * the evaluate method is the same as calling the rewriter, and returning
51
   * false if the result is non-constant.
52
   */
53
  bool hasDefinitions() const;
54
55
 private:
56
  /** information cached per function definition */
57
78
  class FunDefInfo
58
  {
59
   public:
60
    /** the body */
61
    Node d_body;
62
    /** the formal argument list */
63
    std::vector<Node> d_args;
64
  };
65
  /** maps functions to the above information */
66
  std::map<Node, FunDefInfo> d_funDefMap;
67
  /** evaluator utility */
68
  Evaluator d_eval;
69
};
70
71
}  // namespace quantifiers
72
}  // namespace theory
73
}  // namespace CVC4
74
75
#endif