3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 20:18:18 +00:00

formatting theory_str.h

This commit is contained in:
Murphy Berzish 2017-05-05 19:29:53 -04:00
parent 21c8f4aae0
commit f904b033ad

View file

@ -1,19 +1,19 @@
/*++ /*++
Module Name: Module Name:
theory_str.h theory_str.h
Abstract: Abstract:
String Theory Plugin String Theory Plugin
Author: Author:
Murphy Berzish and Yunhui Zheng Murphy Berzish and Yunhui Zheng
Revision History: Revision History:
--*/ --*/
#ifndef _THEORY_STR_H_ #ifndef _THEORY_STR_H_
#define _THEORY_STR_H_ #define _THEORY_STR_H_
@ -33,14 +33,14 @@ Revision History:
namespace smt { namespace smt {
typedef hashtable<symbol, symbol_hash_proc, symbol_eq_proc> symbol_set; typedef hashtable<symbol, symbol_hash_proc, symbol_eq_proc> symbol_set;
class str_value_factory : public value_factory { class str_value_factory : public value_factory {
seq_util u; seq_util u;
symbol_set m_strings; symbol_set m_strings;
std::string delim; std::string delim;
unsigned m_next; unsigned m_next;
public: public:
str_value_factory(ast_manager & m, family_id fid) : str_value_factory(ast_manager & m, family_id fid) :
value_factory(m, fid), value_factory(m, fid),
u(m), delim("!"), m_next(0) {} u(m), delim("!"), m_next(0) {}
@ -73,11 +73,11 @@ namespace smt {
UNREACHABLE(); return NULL; UNREACHABLE(); return NULL;
} }
virtual void register_value(expr * n) { /* Ignore */ } virtual void register_value(expr * n) { /* Ignore */ }
}; };
// rather than modify obj_pair_map I inherit from it and add my own helper methods // rather than modify obj_pair_map I inherit from it and add my own helper methods
class theory_str_contain_pair_bool_map_t : public obj_pair_map<expr, expr, expr*> { class theory_str_contain_pair_bool_map_t : public obj_pair_map<expr, expr, expr*> {
public: public:
expr * operator[](std::pair<expr*, expr*> key) const { expr * operator[](std::pair<expr*, expr*> key) const {
expr * value; expr * value;
bool found = this->find(key.first, key.second, value); bool found = this->find(key.first, key.second, value);
@ -93,13 +93,13 @@ namespace smt {
expr * unused; expr * unused;
return this->find(key.first, key.second, unused); return this->find(key.first, key.second, unused);
} }
}; };
template<typename Ctx> template<typename Ctx>
class binary_search_trail : public trail<Ctx> { class binary_search_trail : public trail<Ctx> {
obj_map<expr, ptr_vector<expr> > & target; obj_map<expr, ptr_vector<expr> > & target;
expr * entry; expr * entry;
public: public:
binary_search_trail(obj_map<expr, ptr_vector<expr> > & target, expr * entry) : binary_search_trail(obj_map<expr, ptr_vector<expr> > & target, expr * entry) :
target(target), entry(entry) {} target(target), entry(entry) {}
virtual ~binary_search_trail() {} virtual ~binary_search_trail() {}
@ -115,11 +115,11 @@ namespace smt {
TRACE("t_str_binary_search", tout << "WARNING: attempt to access length tester map via invalid key" << std::endl;); TRACE("t_str_binary_search", tout << "WARNING: attempt to access length tester map via invalid key" << std::endl;);
} }
} }
}; };
class nfa { class nfa {
protected: protected:
bool m_valid; bool m_valid;
unsigned m_next_id; unsigned m_next_id;
@ -146,9 +146,9 @@ namespace smt {
// Convert a regular expression to an e-NFA using Thompson's construction // Convert a regular expression to an e-NFA using Thompson's construction
void convert_re(expr * e, unsigned & start, unsigned & end, seq_util & u); void convert_re(expr * e, unsigned & start, unsigned & end, seq_util & u);
public: public:
nfa(seq_util & u, expr * e) nfa(seq_util & u, expr * e)
: m_valid(true), m_next_id(0), m_start_state(0), m_end_state(0) { : m_valid(true), m_next_id(0), m_start_state(0), m_end_state(0) {
convert_re(e, m_start_state, m_end_state, u); convert_re(e, m_start_state, m_end_state, u);
} }
@ -161,9 +161,9 @@ namespace smt {
void epsilon_closure(unsigned start, std::set<unsigned> & closure); void epsilon_closure(unsigned start, std::set<unsigned> & closure);
bool matches(zstring input); bool matches(zstring input);
}; };
class theory_str : public theory { class theory_str : public theory {
struct T_cut struct T_cut
{ {
int level; int level;
@ -185,7 +185,7 @@ namespace smt {
}; };
typedef map<zstring, expr*, zstring_hash_proc, default_eq<zstring> > string_map; typedef map<zstring, expr*, zstring_hash_proc, default_eq<zstring> > string_map;
protected: protected:
theory_str_params const & m_params; theory_str_params const & m_params;
/* /*
@ -390,7 +390,7 @@ namespace smt {
// finite model finding data // finite model finding data
// maps a finite model tester var to a list of variables that will be tested // maps a finite model tester var to a list of variables that will be tested
obj_map<expr, ptr_vector<expr> > finite_model_test_varlists; obj_map<expr, ptr_vector<expr> > finite_model_test_varlists;
protected: protected:
void assert_axiom(expr * e); void assert_axiom(expr * e);
void assert_implication(expr * premise, expr * conclusion); void assert_implication(expr * premise, expr * conclusion);
expr * rewrite_implication(expr * premise, expr * conclusion); expr * rewrite_implication(expr * premise, expr * conclusion);
@ -604,7 +604,7 @@ namespace smt {
expr_ref set_up_finite_model_test(expr * lhs, expr * rhs); expr_ref set_up_finite_model_test(expr * lhs, expr * rhs);
void finite_model_test(expr * v, expr * c); void finite_model_test(expr * v, expr * c);
public: public:
theory_str(ast_manager & m, theory_str_params const & params); theory_str(ast_manager & m, theory_str_params const & params);
virtual ~theory_str(); virtual ~theory_str();
@ -617,7 +617,7 @@ namespace smt {
void merge_eh(theory_var, theory_var, theory_var v1, theory_var v2) {} void merge_eh(theory_var, theory_var, theory_var v1, theory_var v2) {}
void after_merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) { } void after_merge_eh(theory_var r1, theory_var r2, theory_var v1, theory_var v2) { }
void unmerge_eh(theory_var v1, theory_var v2) {} void unmerge_eh(theory_var v1, theory_var v2) {}
protected: protected:
virtual bool internalize_atom(app * atom, bool gate_ctx); virtual bool internalize_atom(app * atom, bool gate_ctx);
virtual bool internalize_term(app * term); virtual bool internalize_term(app * term);
virtual enode* ensure_enode(expr* e); virtual enode* ensure_enode(expr* e);
@ -645,7 +645,7 @@ namespace smt {
virtual void init_model(model_generator & m); virtual void init_model(model_generator & m);
virtual model_value_proc * mk_value(enode * n, model_generator & mg); virtual model_value_proc * mk_value(enode * n, model_generator & mg);
virtual void finalize_model(model_generator & mg); virtual void finalize_model(model_generator & mg);
}; };
}; };