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 |
|
|
37 |
|
class Rewriter; |
38 |
|
|
39 |
|
namespace arrays { |
40 |
|
|
41 |
|
Node getMostFrequentValue(TNode store); |
42 |
|
uint64_t getMostFrequentValueCount(TNode store); |
43 |
|
void setMostFrequentValue(TNode store, TNode value); |
44 |
|
void setMostFrequentValueCount(TNode store, uint64_t count); |
45 |
|
|
46 |
18935 |
static inline Node mkEqNode(Node a, Node b) { |
47 |
18935 |
return a.eqNode(b); |
48 |
|
} |
49 |
|
|
50 |
15268 |
class TheoryArraysRewriter : public TheoryRewriter |
51 |
|
{ |
52 |
|
public: |
53 |
|
TheoryArraysRewriter(Rewriter* rewriter, ProofNodeManager* pnm); |
54 |
|
|
55 |
|
/** Normalize a constant whose index type has cardinality indexCard */ |
56 |
|
static Node normalizeConstant(TNode node, Cardinality indexCard); |
57 |
|
|
58 |
|
/* Expands the eqrange predicate (eqrange a b i j) to the quantified formula |
59 |
|
* (forall ((x T)) |
60 |
|
* (=> (and (<= i x) (<= x j)) (= (select a x) (select b x)))). |
61 |
|
*/ |
62 |
|
static Node expandEqRange(TNode node); |
63 |
|
|
64 |
|
RewriteResponse postRewrite(TNode node) override; |
65 |
|
|
66 |
|
RewriteResponse preRewrite(TNode node) override; |
67 |
|
|
68 |
|
TrustNode expandDefinition(Node node) override; |
69 |
|
|
70 |
|
static inline void init() {} |
71 |
|
static inline void shutdown() {} |
72 |
|
|
73 |
|
private: |
74 |
|
/** |
75 |
|
* Puts array constant node into normal form. This is so that array constants |
76 |
|
* that are distinct nodes are semantically disequal. |
77 |
|
*/ |
78 |
|
static Node normalizeConstant(TNode node); |
79 |
|
|
80 |
|
/** The associated rewriter. */ |
81 |
|
Rewriter* d_rewriter; |
82 |
|
|
83 |
|
std::unique_ptr<EagerProofGenerator> d_epg; |
84 |
|
}; /* class TheoryArraysRewriter */ |
85 |
|
|
86 |
|
} // namespace arrays |
87 |
|
} // namespace theory |
88 |
|
} // namespace cvc5 |
89 |
|
|
90 |
|
#endif /* CVC5__THEORY__ARRAYS__THEORY_ARRAYS_REWRITER_H */ |