3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 16:45:31 +00:00

Add Z3_is_recursive_datatype_sort to the API (#7615)

It does not seem to be possible to test if a datatype sort is recursive.
This commit is contained in:
Josh Berdine 2025-04-08 22:36:57 +01:00 committed by GitHub
parent 14e2aadad0
commit d792840739
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -443,6 +443,16 @@ extern "C" {
Z3_CATCH;
}
bool Z3_API Z3_is_recursive_datatype_sort(Z3_context c, Z3_sort t) {
Z3_TRY;
LOG_Z3_is_recursive_datatype_sort(c, t);
RESET_ERROR_CODE();
sort * s = to_sort(t);
datatype_util& dt_util = mk_c(c)->dtutil();
return dt_util.is_datatype(s) && dt_util.is_recursive(s);
Z3_CATCH_RETURN(false);
}
unsigned Z3_API Z3_get_datatype_sort_num_constructors(Z3_context c, Z3_sort t) {
Z3_TRY;
LOG_Z3_get_datatype_sort_num_constructors(c, t);

View file

@ -4588,6 +4588,13 @@ extern "C" {
*/
Z3_func_decl Z3_API Z3_get_tuple_sort_field_decl(Z3_context c, Z3_sort t, unsigned i);
/**
\brief Check if \c s is a recursive datatype sort.
def_API('Z3_is_recursive_datatype_sort', BOOL, (_in(CONTEXT), _in(SORT)))
*/
bool Z3_API Z3_is_recursive_datatype_sort(Z3_context c, Z3_sort s);
/**
\brief Return number of constructors for datatype.