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

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