-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
seq_axioms.h
104 lines (80 loc) · 3.67 KB
/
seq_axioms.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*++
Copyright (c) 2011 Microsoft Corporation
Module Name:
seq_axioms.h
Abstract:
Axiomatize string operations that can be reduced to
more basic operations.
Author:
Nikolaj Bjorner (nbjorner) 2020-4-16
Revision History:
--*/
#pragma once
#include "ast/seq_decl_plugin.h"
#include "ast/arith_decl_plugin.h"
#include "ast/rewriter/th_rewriter.h"
#include "ast/rewriter/seq_skolem.h"
namespace seq {
class axioms {
ast_manager& m;
th_rewriter& m_rewrite;
arith_util a;
seq_util seq;
skolem m_sk;
expr_ref_vector m_clause;
std::function<void(expr_ref_vector const&)> m_add_clause;
expr_ref mk_len(expr* s);
expr_ref mk_sub(expr* x, expr* y);
expr_ref mk_concat(expr* e1, expr* e2, expr* e3) { return expr_ref(seq.str.mk_concat(e1, e2, e3), m); }
expr_ref mk_concat(expr* e1, expr* e2) { return expr_ref(seq.str.mk_concat(e1, e2), m); }
expr_ref mk_nth(expr* e, unsigned i) { return expr_ref(seq.str.mk_nth_i(e, a.mk_int(i)), m); }
expr_ref mk_eq(expr* a, expr* b) { return expr_ref(m.mk_eq(a, b), m); }
expr_ref mk_seq_eq(expr* a, expr* b) { SASSERT(seq.is_seq(a) && seq.is_seq(b)); return expr_ref(m_sk.mk_eq(a, b), m); }
expr_ref mk_eq_empty(expr* e) { return expr_ref(m.mk_eq(seq.str.mk_empty(e->get_sort()), e), m); }
expr_ref mk_ge(expr* x, unsigned n) { return expr_ref(a.mk_ge(x, a.mk_int(n)), m); }
expr_ref mk_le(expr* x, unsigned n) { return expr_ref(a.mk_le(x, a.mk_int(n)), m); }
expr_ref mk_ge(expr* x, rational const& n) { return expr_ref(a.mk_ge(x, a.mk_int(n)), m); }
expr_ref mk_le(expr* x, rational const& n) { return expr_ref(a.mk_le(x, a.mk_int(n)), m); }
expr_ref is_digit(expr* ch);
expr_ref purify(expr* e);
expr_ref mk_digit2int(expr* ch);
void add_clause(expr_ref const& a);
void add_clause(expr_ref const& a, expr_ref const& b);
void add_clause(expr_ref const& a, expr_ref const& b, expr_ref const& c);
void add_clause(expr_ref const& a, expr_ref const& b, expr_ref const& c, expr_ref const & d);
void add_clause(expr_ref const& a, expr_ref const& b, expr_ref const& c, expr_ref const & d, expr_ref const& e);
bool is_drop_last(expr* s, expr* i, expr* l);
bool is_tail(expr* s, expr* i, expr* l);
bool is_extract_prefix0(expr* s, expr* i, expr* l);
bool is_extract_suffix(expr* s, expr* i, expr* l);
void tail_axiom(expr* e, expr* s);
void drop_last_axiom(expr* e, expr* s);
void extract_prefix_axiom(expr* e, expr* s, expr* l);
void extract_suffix_axiom(expr* e, expr* s, expr* l);
void tightest_prefix(expr* s, expr* x);
public:
axioms(th_rewriter& rw);
void set_add_clause(std::function<void(expr_ref_vector const&)>& ac) { m_add_clause = ac; }
void suffix_axiom(expr* n);
void prefix_axiom(expr* n);
void extract_axiom(expr* n);
void indexof_axiom(expr* n);
void last_indexof_axiom(expr* n);
void replace_axiom(expr* n);
void at_axiom(expr* n);
void nth_axiom(expr* n);
void itos_axiom(expr* n);
void stoi_axiom(expr* n);
void stoi_axiom(expr* e, unsigned k);
void itos_axiom(expr* s, unsigned k);
void lt_axiom(expr* n);
void le_axiom(expr* n);
void is_digit_axiom(expr* n);
void str_to_code_axiom(expr* n);
void str_from_code_axiom(expr* n);
void unit_axiom(expr* n);
void length_axiom(expr* n);
void unroll_not_contains(expr* e);
expr_ref length_limit(expr* s, unsigned k);
};
};