1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Clark Barrett, Morgan Deters, Andres Noetzli |
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 |
|
* [[ Add one-line brief description here ]] |
14 |
|
* |
15 |
|
* [[ Add lengthier description here ]] |
16 |
|
* \todo document this file |
17 |
|
*/ |
18 |
|
|
19 |
|
#include "cvc5_private.h" |
20 |
|
|
21 |
|
#ifndef CVC5__THEORY__ARRAYS__THEORY_ARRAYS_REWRITER_H |
22 |
|
#define CVC5__THEORY__ARRAYS__THEORY_ARRAYS_REWRITER_H |
23 |
|
|
24 |
|
#include <unordered_map> |
25 |
|
#include <unordered_set> |
26 |
|
|
27 |
|
#include "theory/rewriter.h" |
28 |
|
#include "theory/theory_rewriter.h" |
29 |
|
#include "theory/type_enumerator.h" |
30 |
|
|
31 |
|
namespace cvc5 { |
32 |
|
|
33 |
|
class EagerProofGenerator; |
34 |
|
|
35 |
|
namespace theory { |
36 |
|
namespace arrays { |
37 |
|
|
38 |
|
Node getMostFrequentValue(TNode store); |
39 |
|
uint64_t getMostFrequentValueCount(TNode store); |
40 |
|
void setMostFrequentValue(TNode store, TNode value); |
41 |
|
void setMostFrequentValueCount(TNode store, uint64_t count); |
42 |
|
|
43 |
18874 |
static inline Node mkEqNode(Node a, Node b) { |
44 |
18874 |
return a.eqNode(b); |
45 |
|
} |
46 |
|
|
47 |
9853 |
class TheoryArraysRewriter : public TheoryRewriter |
48 |
|
{ |
49 |
|
public: |
50 |
|
TheoryArraysRewriter(ProofNodeManager* pnm); |
51 |
|
|
52 |
|
/** Normalize a constant whose index type has cardinality indexCard */ |
53 |
|
static Node normalizeConstant(TNode node, Cardinality indexCard); |
54 |
|
|
55 |
|
/* Expands the eqrange predicate (eqrange a b i j) to the quantified formula |
56 |
|
* (forall ((x T)) |
57 |
|
* (=> (and (<= i x) (<= x j)) (= (select a x) (select b x)))). |
58 |
|
*/ |
59 |
|
static Node expandEqRange(TNode node); |
60 |
|
|
61 |
|
RewriteResponse postRewrite(TNode node) override; |
62 |
|
|
63 |
|
RewriteResponse preRewrite(TNode node) override; |
64 |
|
|
65 |
|
TrustNode expandDefinition(Node node) override; |
66 |
|
|
67 |
|
static inline void init() {} |
68 |
|
static inline void shutdown() {} |
69 |
|
|
70 |
|
private: |
71 |
|
/** |
72 |
|
* Puts array constant node into normal form. This is so that array constants |
73 |
|
* that are distinct nodes are semantically disequal. |
74 |
|
*/ |
75 |
|
static Node normalizeConstant(TNode node); |
76 |
|
|
77 |
|
std::unique_ptr<EagerProofGenerator> d_epg; |
78 |
|
}; /* class TheoryArraysRewriter */ |
79 |
|
|
80 |
|
} // namespace arrays |
81 |
|
} // namespace theory |
82 |
|
} // namespace cvc5 |
83 |
|
|
84 |
|
#endif /* CVC5__THEORY__ARRAYS__THEORY_ARRAYS_REWRITER_H */ |