1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds |
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 |
|
* Equivalence class info for the theory of strings. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__STRINGS__EQC_INFO_H |
19 |
|
#define CVC5__THEORY__STRINGS__EQC_INFO_H |
20 |
|
|
21 |
|
#include <map> |
22 |
|
|
23 |
|
#include "context/cdo.h" |
24 |
|
#include "context/context.h" |
25 |
|
#include "expr/node.h" |
26 |
|
|
27 |
|
namespace cvc5 { |
28 |
|
namespace theory { |
29 |
|
namespace strings { |
30 |
|
|
31 |
|
/** |
32 |
|
* SAT-context-dependent information about an equivalence class. This |
33 |
|
* information is updated eagerly as assertions are processed by the theory of |
34 |
|
* strings at standard effort. |
35 |
|
*/ |
36 |
|
class EqcInfo |
37 |
|
{ |
38 |
|
public: |
39 |
|
EqcInfo(context::Context* c); |
40 |
57568 |
~EqcInfo() {} |
41 |
|
/** add prefix constant |
42 |
|
* |
43 |
|
* This informs this equivalence class info that a term t in its |
44 |
|
* equivalence class has a constant prefix (if isSuf=true) or suffix |
45 |
|
* (if isSuf=false). The constant c (if non-null) is the value of that |
46 |
|
* constant, if it has been computed already. |
47 |
|
* |
48 |
|
* If this method returns a non-null node ret, then ret is a conjunction |
49 |
|
* corresponding to a conflict that holds in the current context. |
50 |
|
*/ |
51 |
|
Node addEndpointConst(Node t, Node c, bool isSuf); |
52 |
|
/** |
53 |
|
* If non-null, this is a term x from this eq class such that str.len( x ) |
54 |
|
* occurs as a term in this SAT context. |
55 |
|
*/ |
56 |
|
context::CDO<Node> d_lengthTerm; |
57 |
|
/** |
58 |
|
* If non-null, this is a term x from this eq class such that str.code( x ) |
59 |
|
* occurs as a term in this SAT context. |
60 |
|
*/ |
61 |
|
context::CDO<Node> d_codeTerm; |
62 |
|
context::CDO<unsigned> d_cardinalityLemK; |
63 |
|
context::CDO<Node> d_normalizedLength; |
64 |
|
/** |
65 |
|
* If this is a string equivalence class, this is |
66 |
|
* a node that explains the longest constant prefix known of this |
67 |
|
* equivalence class. This can either be: |
68 |
|
* (1) A term from this equivalence class, including a constant "ABC" or |
69 |
|
* concatenation term (str.++ "ABC" ...), or |
70 |
|
* (2) A membership of the form (str.in.re x R) where x is in this |
71 |
|
* equivalence class and R is a regular expression of the form |
72 |
|
* (str.to.re "ABC") or (re.++ (str.to.re "ABC") ...). |
73 |
|
* |
74 |
|
* If this is an integer equivalence class, this is the lower bound |
75 |
|
* of the value of this equivalence class. |
76 |
|
*/ |
77 |
|
context::CDO<Node> d_firstBound; |
78 |
|
/** same as above, for suffix and integer upper bounds. */ |
79 |
|
context::CDO<Node> d_secondBound; |
80 |
|
/** |
81 |
|
* Make merge conflict. Let "bound term" refer to a term that is set |
82 |
|
* as the data member of this class for d_firstBound or d_secondBound. |
83 |
|
* This method is called when this implies that two terms occur in an |
84 |
|
* equivalence class that have conflicting properties. For example, |
85 |
|
* t may be (str.in_re x (re.++ (str.to_re "A") R2)) and prev may be |
86 |
|
* (str.++ "B" y), where the equivalence class of x has merged into |
87 |
|
* the equivalence class of (str.++ "B" y). This method would return |
88 |
|
* the conflict: |
89 |
|
* (and (= x (str.++ "B" y)) (str.in_re x (re.++ (str.to_re "A") R2))) |
90 |
|
* for this input. |
91 |
|
*/ |
92 |
|
static Node mkMergeConflict(Node t, Node prev); |
93 |
|
}; |
94 |
|
|
95 |
|
} // namespace strings |
96 |
|
} // namespace theory |
97 |
|
} // namespace cvc5 |
98 |
|
|
99 |
|
#endif /* CVC5__THEORY__STRINGS__EQC_INFO_H */ |