3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-18 02:16:40 +00:00

add basic rewriting to strings

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-12-05 12:02:33 -08:00
parent c04f75cdbb
commit 75359c580e
10 changed files with 323 additions and 8 deletions

View file

@ -0,0 +1,67 @@
/*++
Copyright (c) 2015 Microsoft Corporation
Module Name:
seq_rewriter.h
Abstract:
Basic rewriting rules for sequences constraints.
Author:
Nikolaj Bjorner (nbjorner) 2015-12-5
Notes:
--*/
#ifndef SEQ_REWRITER_H_
#define SEQ_REWRITER_H_
#include"seq_decl_plugin.h"
#include"rewriter_types.h"
#include"params.h"
#include"lbool.h"
/**
\brief Cheap rewrite rules for seq constraints
*/
class seq_rewriter {
seq_util m_util;
br_status mk_str_concat(expr* a, expr* b, expr_ref& result);
br_status mk_str_length(expr* a, expr_ref& result);
br_status mk_str_substr(expr* a, expr* b, expr* c, expr_ref& result);
br_status mk_str_strctn(expr* a, expr* b, expr_ref& result);
br_status mk_str_charat(expr* a, expr* b, expr_ref& result);
br_status mk_str_stridof(expr* a, expr* b, expr_ref& result);
br_status mk_str_strrepl(expr* a, expr* b, expr* c, expr_ref& result);
br_status mk_str_prefix(expr* a, expr* b, expr_ref& result);
br_status mk_str_suffix(expr* a, expr* b, expr_ref& result);
br_status mk_str_itos(expr* a, expr_ref& result);
br_status mk_str_stoi(expr* a, expr_ref& result);
br_status mk_str_in_regexp(expr* a, expr* b, expr_ref& result);
br_status mk_str_to_regexp(expr* a, expr_ref& result);
br_status mk_re_concat(expr* a, expr* b, expr_ref& result);
br_status mk_re_union(expr* a, expr* b, expr_ref& result);
br_status mk_re_star(expr* a, expr_ref& result);
br_status mk_re_plus(expr* a, expr_ref& result);
br_status mk_re_opt(expr* a, expr_ref& result);
public:
seq_rewriter(ast_manager & m, params_ref const & p = params_ref()):
m_util(m) {
}
ast_manager & m() const { return m_util.get_manager(); }
family_id get_fid() const { return m_util.get_family_id(); }
void updt_params(params_ref const & p) {}
static void get_param_descrs(param_descrs & r) {}
br_status mk_app_core(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result);
};
#endif