adds incremental for strings; clean-up codes
[cvc5.git] / src / theory / strings / regexp_operation.h
1 /********************* */
2 /*! \file regexp_operation.h
3 ** \verbatim
4 ** Original author: Tianyi Liang
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 project.
8 ** Copyright (c) 2009-2013 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
11 **
12 ** \brief Regular Expression Operations
13 **
14 ** Regular Expression Operations
15 **/
16
17 #include "cvc4_private.h"
18
19 #ifndef __CVC4__THEORY__STRINGS__REGEXP__OPERATION_H
20 #define __CVC4__THEORY__STRINGS__REGEXP__OPERATION_H
21
22 #include <vector>
23 #include "util/hash.h"
24 #include "theory/theory.h"
25 #include "theory/rewriter.h"
26 //#include "context/cdhashmap.h"
27
28 namespace CVC4 {
29 namespace theory {
30 namespace strings {
31
32 class RegExpOpr {
33 typedef std::pair< Node, CVC4::String > PairDvStr;
34
35 private:
36 Node d_emptyString;
37 Node d_true;
38 Node d_false;
39 Node d_emptyRegexp;
40 Node d_zero;
41 Node d_one;
42
43 char d_char_start;
44 char d_char_end;
45 Node d_sigma;
46 Node d_sigma_star;
47
48 std::map< std::pair< Node, Node >, Node > d_simpl_cache;
49 std::map< std::pair< Node, Node >, Node > d_simpl_neg_cache;
50 std::map< Node, Node > d_compl_cache;
51 std::map< Node, int > d_delta_cache;
52 std::map< PairDvStr, Node > d_dv_cache;
53 std::map< Node, bool > d_cstre_cache;
54 //bool checkStarPlus( Node t );
55 void simplifyPRegExp( Node s, Node r, std::vector< Node > &new_nodes );
56 void simplifyNRegExp( Node s, Node r, std::vector< Node > &new_nodes );
57 std::string niceChar( Node r );
58 int gcd ( int a, int b );
59 Node mkAllExceptOne( char c );
60
61 public:
62 RegExpOpr();
63
64 bool checkConstRegExp( Node r );
65 void simplify(Node t, std::vector< Node > &new_nodes, bool polarity);
66 int delta( Node r );
67 Node derivativeSingle( Node r, CVC4::String c );
68 bool guessLength( Node r, int &co );
69 void firstChar( Node r );
70 bool follow( Node r, CVC4::String c, std::vector< char > &vec_chars );
71 std::string mkString( Node r );
72 };
73
74 }/* CVC4::theory::strings namespace */
75 }/* CVC4::theory namespace */
76 }/* CVC4 namespace */
77
78 #endif /* __CVC4__THEORY__STRINGS__REGEXP__OPERATION_H */