Parse datatypes and define-funs from string #5743
-
If I give the following file to z3 it parses it correctly: https://gist.github.com/leonardoalt/dd99670d70726b10367f0fd2df1e7d16 . |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This isn't a supported scenario at this point. The pretty printer for the solver object will not even show you all declarations that were used in the string passed to solver::from_string(..). The rationale for not going there is that you can call the C++ API directly to create datatypes. The following methods are available over the C API:
They are: Z3_get_datatype_sort_num_constructors and I added C++ versions of these functions to the C++ API. They still require that you have some sorts to start out with, that is the sorts you declare are used somewhere (add dummy assertions). Example usage:
where leo.smt2 contains:
|
Beta Was this translation helpful? Give feedback.
-
Alright, thanks @NikolajBjorner ! Yea I was going the direction of the dummy assertions already, so sounds good. |
Beta Was this translation helpful? Give feedback.
This isn't a supported scenario at this point.
The pretty printer for the solver object will not even show you all declarations that were used in the string passed to solver::from_string(..).
The rationale for not going there is that you can call the C++ API directly to create datatypes.
There are maybe SMTLIB2 tools that can give you back an abstract syntax tree that can be used to then call C++ API functions that create Datatypes.
The following methods are available over the C API:
They are:
Z3_get_datatype_sort_num_constructors
Z3_get_datatype_sort_constructor