3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-31 19:52:29 +00:00

Fix finite_set::is_fully_interp to check element sort interpretation (#7982)

* Initial plan

* Implement finite_set is_fully_interp to check element sort

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Refine is_fully_interp implementation with SASSERT

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
Copilot 2025-10-15 21:47:32 +02:00 committed by GitHub
parent e781648499
commit 2bb22c6489
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 1 deletions

View file

@ -183,7 +183,9 @@ expr * finite_set_decl_plugin::get_some_value(sort * s) {
}
bool finite_set_decl_plugin::is_fully_interp(sort * s) const {
return false;
SASSERT(is_finite_set(s));
sort* element_sort = get_element_sort(s);
return element_sort && m_manager->is_fully_interp(element_sort);
}
bool finite_set_decl_plugin::is_value(app * e) const {

View file

@ -127,7 +127,40 @@ static void tst_finite_set_map_select() {
ENSURE(selected_set->get_sort() == finite_set_int.get());
}
static void tst_finite_set_is_fully_interp() {
ast_manager m;
reg_decl_plugins(m);
finite_set_util fsets(m);
arith_util arith(m);
// Test with Int sort (should be fully interpreted)
sort_ref int_sort(arith.mk_int(), m);
parameter int_param(int_sort.get());
sort_ref finite_set_int(m.mk_sort(fsets.get_family_id(), FINITE_SET_SORT, 1, &int_param), m);
ENSURE(m.is_fully_interp(int_sort));
ENSURE(m.is_fully_interp(finite_set_int));
// Test with Bool sort (should be fully interpreted)
sort_ref bool_sort(m.mk_bool_sort(), m);
parameter bool_param(bool_sort.get());
sort_ref finite_set_bool(m.mk_sort(fsets.get_family_id(), FINITE_SET_SORT, 1, &bool_param), m);
ENSURE(m.is_fully_interp(bool_sort));
ENSURE(m.is_fully_interp(finite_set_bool));
// Test with uninterpreted sort (should not be fully interpreted)
sort_ref uninterp_sort(m.mk_uninterpreted_sort(symbol("U")), m);
parameter uninterp_param(uninterp_sort.get());
sort_ref finite_set_uninterp(m.mk_sort(fsets.get_family_id(), FINITE_SET_SORT, 1, &uninterp_param), m);
ENSURE(!m.is_fully_interp(uninterp_sort));
ENSURE(!m.is_fully_interp(finite_set_uninterp));
}
void tst_finite_set() {
tst_finite_set_basic();
tst_finite_set_map_select();
tst_finite_set_is_fully_interp();
}