GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/preprocessing/passes/bv_to_bool.h Lines: 1 1 100.0 %
Date: 2021-05-22 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Liana Hadarean, Yoni Zohar, 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
 * Preprocessing pass that lifts bit-vectors of size 1 to booleans.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__PREPROCESSING__PASSES__BV_TO_BOOL_H
19
#define CVC5__PREPROCESSING__PASSES__BV_TO_BOOL_H
20
21
#include "expr/node.h"
22
#include "preprocessing/preprocessing_pass.h"
23
#include "util/statistics_stats.h"
24
25
namespace cvc5 {
26
namespace preprocessing {
27
namespace passes {
28
29
typedef std::unordered_map<Node, Node> NodeNodeMap;
30
31
18918
class BVToBool : public PreprocessingPass
32
{
33
34
 public:
35
  BVToBool(PreprocessingPassContext* preprocContext);
36
37
 protected:
38
  PreprocessingPassResult applyInternal(
39
      AssertionPipeline* assertionsToPreprocess) override;
40
41
 private:
42
  struct Statistics
43
  {
44
    IntStat d_numTermsLifted;
45
    IntStat d_numAtomsLifted;
46
    IntStat d_numTermsForcedLifted;
47
    Statistics();
48
  };
49
  void addToBoolCache(TNode term, Node new_term);
50
  Node getBoolCache(TNode term) const;
51
  bool hasBoolCache(TNode term) const;
52
53
  void addToLiftCache(TNode term, Node new_term);
54
  Node getLiftCache(TNode term) const;
55
  bool hasLiftCache(TNode term) const;
56
57
  bool isConvertibleBvTerm(TNode node);
58
  bool isConvertibleBvAtom(TNode node);
59
  Node convertBvAtom(TNode node);
60
  Node convertBvTerm(TNode node);
61
  Node liftNode(TNode current);
62
  void liftBvToBool(const std::vector<Node>& assertions,
63
                    std::vector<Node>& new_assertions);
64
65
  NodeNodeMap d_liftCache;
66
  NodeNodeMap d_boolCache;
67
  Node d_one;
68
  Node d_zero;
69
  Statistics d_statistics;
70
};
71
72
}  // namespace passes
73
}  // namespace preprocessing
74
}  // namespace cvc5
75
76
#endif /* CVC5__PREPROCESSING__PASSES__BV_TO_BOOL_H */