mirror of
https://github.com/Z3Prover/z3
synced 2025-08-14 23:05:26 +00:00
Fix uninterpreted sort definition. There was a mismatch in the behavior of the API and SMT front-ends. The SMT front-ends were using user_sorts to be able to support parametric uninterpreted sorts. After this fix, the API also creates user_sorts.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3b8d72beeb
commit
3a15db5244
8 changed files with 23 additions and 14 deletions
|
@ -1816,6 +1816,12 @@ sort * ast_manager::mk_sort(symbol const & name, sort_info * info) {
|
|||
return register_node(new_node);
|
||||
}
|
||||
|
||||
sort * ast_manager::mk_uninterpreted_sort(symbol const & name, unsigned num_parameters, parameter const * parameters) {
|
||||
user_sort_plugin * plugin = get_user_sort_plugin();
|
||||
decl_kind kind = plugin->register_name(name);
|
||||
return plugin->mk_sort(kind, num_parameters, parameters);
|
||||
}
|
||||
|
||||
func_decl * ast_manager::mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range,
|
||||
bool assoc, bool comm, bool inj) {
|
||||
func_decl_info info(null_family_id, null_decl_kind);
|
||||
|
@ -2058,7 +2064,7 @@ sort * ast_manager::mk_fresh_sort(char const * prefix) {
|
|||
string_buffer<32> buffer;
|
||||
buffer << prefix << "!" << m_fresh_id;
|
||||
m_fresh_id++;
|
||||
return mk_sort(symbol(buffer.c_str()));
|
||||
return mk_uninterpreted_sort(symbol(buffer.c_str()));
|
||||
}
|
||||
|
||||
symbol ast_manager::mk_fresh_var_name(char const * prefix) {
|
||||
|
|
|
@ -1622,11 +1622,13 @@ private:
|
|||
sort * mk_sort(symbol const & name, sort_info * info);
|
||||
|
||||
public:
|
||||
sort * mk_sort(symbol const & name) { return mk_sort(name, 0); }
|
||||
sort * mk_uninterpreted_sort(symbol const & name, unsigned num_parameters, parameter const * parameters);
|
||||
|
||||
sort * mk_uninterpreted_sort(symbol const & name) { return mk_uninterpreted_sort(name, 0, 0); }
|
||||
|
||||
sort * mk_sort(symbol const & name, sort_info const & info) {
|
||||
if (info.get_family_id() == null_family_id) {
|
||||
return mk_sort(name, 0);
|
||||
return mk_uninterpreted_sort(name);
|
||||
}
|
||||
else {
|
||||
return mk_sort(name, &const_cast<sort_info &>(info));
|
||||
|
|
|
@ -111,7 +111,10 @@ void ast_translation::mk_sort(sort * s, frame & fr) {
|
|||
sort_info * si = s->get_info();
|
||||
sort * new_s;
|
||||
if (si == 0) {
|
||||
new_s = m_to_manager.mk_sort(s->get_name());
|
||||
// TODO: investigate: this branch is probably unreachable.
|
||||
// It became unreachable after we started using mk_uninterpreted_sort for creating uninterpreted sorts,
|
||||
// and mk_uninterpreted_sort actually creates a user_sort.
|
||||
new_s = m_to_manager.mk_uninterpreted_sort(s->get_name());
|
||||
SASSERT(m_result_stack.size() == fr.m_rpos);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -117,8 +117,8 @@ void seq_decl_plugin::init() {
|
|||
if(m_init) return;
|
||||
ast_manager& m = *m_manager;
|
||||
m_init = true;
|
||||
sort* A = m.mk_sort(symbol((unsigned)0));
|
||||
sort* B = m.mk_sort(symbol((unsigned)1));
|
||||
sort* A = m.mk_uninterpreted_sort(symbol((unsigned)0));
|
||||
sort* B = m.mk_uninterpreted_sort(symbol((unsigned)1));
|
||||
parameter paramA(A);
|
||||
sort* seqA = m.mk_sort(m_family_id, SEQ_SORT, 1, ¶mA);
|
||||
sort* reA = m.mk_sort(m_family_id, RE_SORT, 1, ¶mA);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue