API reference

Low-Level C API Reference (z3_mojo.c, Z3 5.3.3)

z3_mojo.c exposes a verified 1-to-1 binding of all 817 functions across Z3 5.3.3's nine C headers, all 29 raw Z3_* handle types, all 10 enums, and low-level FFI helpers. Every function is called as api[].Z3_*(...) after var api = c_api(). See the Low-level C API guide for manual refcounting (Z3_mk_context_rc) and raw callbacks.

from z3_mojo.c import c_api, null
var api = c_api()
var cfg = api[].Z3_mk_config()
var ctx = api[].Z3_mk_context_rc(cfg)
api[].Z3_del_config(cfg)
api[].Z3_set_error_handler(ctx, null[NoneType]())

Commonly Used C API Groups

Entry Point & FFI Helpers

Symbol Role
c_api() raises -> CApiPtr Loads libz3 once per process and returns the cached pointer to CApi.
CApi / CApiPtr Struct holding resolved function pointers for all 817 Z3_* C functions; checks Z3_get_error_code(ctx) after context calls and raises Mojo Error.
c_bytes(s: String) raises -> List[Int8] Copies a Mojo String into a NUL-terminated C byte buffer (rejects embedded NULs).
to_string(p: CChars) raises -> String Copies a const char* returned by Z3 into an owned Mojo String ("" on NULL).
null[T]() -> Pointer[T, MutUntrackedOrigin] Constructs a typed NULL pointer for optional C parameters (such as Z3_set_error_handler(ctx, null[NoneType]())).
to_c_uint32(v: Int) raises -> UInt32 Checked conversion to C unsigned.
to_c_int32(v: Int) raises -> Int32 Checked conversion to C int.

Raw Handle Structs (29)

Every raw handle is a thin ImplicitlyCopyable wrapper around an opaque Ptr with .is_null() and == comparison:

Raw C Handle Safe Mojo Counterpart Ownership Policy
Z3_app App context_managed
Z3_apply_result ApplyResult refcounted
Z3_ast Ast context_managed
Z3_ast_map AstMap refcounted
Z3_ast_vector AstVector refcounted
Z3_config Config explicit_del
Z3_constructor Constructor explicit_del
Z3_constructor_list ConstructorList explicit_del
Z3_context Context explicit_del
Z3_fixedpoint Fixedpoint refcounted
Z3_func_decl FuncDecl context_managed
Z3_func_entry FuncEntry refcounted
Z3_func_interp FuncInterp refcounted
Z3_goal Goal refcounted
Z3_model Model refcounted
Z3_optimize Optimize refcounted
Z3_param_descrs ParamDescrs refcounted
Z3_params Params refcounted
Z3_parser_context ParserContext refcounted
Z3_pattern Pattern context_managed
Z3_probe Probe refcounted
Z3_rcf_num RcfNum explicit_del
Z3_simplifier Simplifier refcounted
Z3_solver Solver refcounted
Z3_solver_callback SolverCallback borrowed
Z3_sort Sort context_managed
Z3_stats Stats refcounted
Z3_symbol Symbol context_managed
Z3_tactic Tactic refcounted

z3_api.h (585 functions)

Global Parameters (3)

Z3_global_param_get

def Z3_global_param_get(self, param_id: Pointer[Int8, _], param_value: Pointer[mut=True, Pointer[Int8, MutUntrackedOrigin], _]) -> Bool

Get a global (or module) parameter.

Returns false if the parameter value does not exist.

Note: This function cannot be invoked simultaneously from different threads without synchronization. The result string stored in param_value is stored in shared location.

See also: Z3_global_param_reset_all, Z3_global_param_set

Safe wrapper: global_param_get (manual)

Z3_global_param_reset_all

def Z3_global_param_reset_all(self)

Restore the value of all global (and module) parameters. This command will not affect already created objects (such as tactics and solvers).

Z3_global_param_set

def Z3_global_param_set(self, param_id: Pointer[Int8, _], param_value: Pointer[Int8, _])

Set a global (or module) parameter. This setting is shared by all Z3 contexts.

When a Z3 module is initialized it will use the value of these parameters when Z3_params objects are not provided.

The name of parameter can be composed of characters [a-z][A-Z], digits [0-9], '-' and '_'. The character '.' is a delimiter (more later).

The parameter names are case-insensitive. The character '-' should be viewed as an "alias" for '_'. Thus, the following parameter names are considered equivalent: "pp.decimal-precision" and "PP.DECIMAL_PRECISION".

This function can be used to set parameters for a specific Z3 module. This can be done by using <module-name>.<parameter-name>. For example: Z3_global_param_set('pp.decimal', 'true') will set the parameter "decimal" in the module "pp" to true.

Create configuration (2)

Z3_mk_config

def Z3_mk_config(self) -> Z3_config

Create a configuration object for the Z3 context object.

Configurations are created in order to assign parameters prior to creating contexts for Z3 interaction. For example, if the users wishes to use proof generation, then call:

Z3_set_param_value(cfg, "proof", "true")

The following parameters can be set:

  • proof (Boolean) Enable proof generation
  • debug_ref_count (Boolean) Enable debug support for Z3_ast reference counting
  • trace (Boolean) Tracing support for VCC
  • trace_file_name (String) Trace out file for VCC traces
  • timeout (unsigned) default timeout (in milliseconds) used for solvers
  • well_sorted_check type checker
  • auto_config use heuristics to automatically select solver and configure it
  • model model generation for solvers, this parameter can be overwritten when creating a solver
  • model_validate validate models produced by solvers
  • unsat_core unsat-core generation for solvers, this parameter can be overwritten when creating a solver
  • encoding the string encoding used internally (must be either "unicode" - 18 bit, "bmp" - 16 bit or "ascii" - 8 bit)

Note: In previous versions of Z3, the Z3_config was used to store global and module configurations. Now, we should use Z3_global_param_set.

See also: Z3_set_param_value, Z3_del_config

Safe wrapper: Config.__init__ (manual)

Z3_set_param_value

def Z3_set_param_value(self, c: Z3_config, param_id: Pointer[Int8, _], param_value: Pointer[Int8, _])

Set a configuration parameter.

The following parameters can be set for

See also: Z3_mk_config

Safe wrapper: Config.set_param_value (manual)

Context and AST Reference Counting (9)

Z3_dec_ref

def Z3_dec_ref(self, c: Z3_context, a: Z3_ast)

Decrement the reference counter of the given AST. The context c should have been created using Z3_mk_context_rc. This function is a NOOP if c was created using Z3_mk_context.

Safe wrapper: raw-only (z3_mojo.c) — Manual AST refcounting for Z3_mk_context_rc; available via c_api()

Z3_enable_concurrent_dec_ref

def Z3_enable_concurrent_dec_ref(self, c: Z3_context) raises

use concurrency control for dec-ref. Reference counting decrements are allowed in separate threads from the context. If this setting is not invoked, reference counting decrements are not going to be thread safe.

Safe wrapper: Context.enable_concurrent_dec_ref (auto)

Z3_get_global_param_descrs

def Z3_get_global_param_descrs(self, c: Z3_context) raises -> Z3_param_descrs

Retrieve description of global parameters.

Safe wrapper: Context.get_global_param_descrs (auto)

Z3_inc_ref

def Z3_inc_ref(self, c: Z3_context, a: Z3_ast) raises

Increment the reference counter of the given AST. The context c should have been created using Z3_mk_context_rc. This function is a NOOP if c was created using Z3_mk_context.

Safe wrapper: raw-only (z3_mojo.c) — Manual AST refcounting for Z3_mk_context_rc; available via c_api()

Z3_interrupt

def Z3_interrupt(self, c: Z3_context) raises

Interrupt the execution of a Z3 procedure. This procedure can be used to interrupt: solvers, simplifiers and tactics.

Safe wrapper: Context.interrupt (auto)

Z3_mk_context

def Z3_mk_context(self, c: Z3_config) -> Z3_context

Create a context using the given configuration.

After a context is created, the configuration cannot be changed, although some parameters can be changed using Z3_update_param_value. All main interaction with Z3 happens in the context of a Z3_context.

In contrast to Z3_mk_context_rc the life time of Z3_ast objects persists with the life time of the context.

Note that all other reference counted objects, including Z3_model, Z3_solver, Z3_func_interp have to be managed by the caller. Their reference counts are not handled by the context.

Notes:

  • Thread safety: objects created using a given context should not be accessed from different threads without synchronization. In other words, operations on a context are not thread safe. To use Z3 from different threads create separate context objects. The Z3_translate, Z3_solver_translate, Z3_model_translate, Z3_goal_translate methods are exposed to allow copying state from one context to another.
    • Z3_sort, Z3_func_decl, Z3_app, Z3_pattern are Z3_ast's. - Z3 uses hash-consing, i.e., when the same Z3_ast is created twice, Z3 will return the same pointer twice.

See also: Z3_del_context, Z3_set_error_handler

Safe wrapper: Context.__init__ (manual)

Z3_mk_context_rc

def Z3_mk_context_rc(self, c: Z3_config) -> Z3_context

Create a context using the given configuration. This function is similar to Z3_mk_context. However, in the context returned by this function, the user is responsible for managing Z3_ast reference counters. Managing reference counters is a burden and error-prone, but allows the user to use the memory more efficiently. The user must invoke Z3_inc_ref for any Z3_ast returned by Z3, and Z3_dec_ref whenever the Z3_ast is not needed anymore. This idiom is similar to the one used in BDD (binary decision diagrams) packages such as CUDD.

Remarks:

  • Z3_sort, Z3_func_decl, Z3_app, Z3_pattern are Z3_ast's.
  • After a context is created, the configuration cannot be changed.
  • All main interaction with Z3 happens in the context of a Z3_context.
  • Z3 uses hash-consing, i.e., when the same Z3_ast is created twice, Z3 will return the same pointer twice.

See also: Z3_del_context, Z3_set_error_handler

Safe wrapper: raw-only (z3_mojo.c) — Public Context uses Z3_mk_context; manual AST RC is available via c_api()

Z3_set_proof_check_callback

def Z3_set_proof_check_callback(self, c: Z3_context, user_context: Pointer[mut=True, NoneType, _], callback: Ptr) raises

Register a client proof checker for c.

Replaces the previous callback and user data. Passing a null callback unregisters it. The client owns the callback and user data and must keep them alive until replacement, unregistration, or context destruction.

SMT-LIB evaluation through Z3_eval_smtlib2_string invokes the callback after an unsatisfiable check-sat, check-sat-assuming, or check-sat-using command. Automatic reports go to the command context's diagnostic stream, included in the returned evaluation text. Ordinary Z3_solver_check calls do not invoke it automatically.

Automatic checking requires proof production to be enabled before assertions are added. An unavailable proof is reported as a command error. The automatic assertion vector contains the active input assertions and current check assumptions. Named assertions tracked for unsat cores are represented by their guarded assertions and tracking literals, matching the proof premises.

Registration survives SMT-LIB reset commands. The report is opaque: Z3 does not interpret it or change the solver's satisfiability result.

Safe wrapper: raw-only (z3_mojo.c) — Raw C callback registration (void* + Z3_proof_check_eh); available via c_api()

Z3_update_param_value

def Z3_update_param_value(self, c: Z3_context, param_id: Pointer[Int8, _], param_value: Pointer[Int8, _]) raises

Set a value of a context parameter.

See also: Z3_global_param_set

Safe wrapper: Context.update_param (manual)

Parameters (7)

Z3_mk_params

def Z3_mk_params(self, c: Z3_context) raises -> Z3_params

Create a Z3 (empty) parameter set. Starting at Z3 4.0, parameter sets are used to configure many components such as: simplifiers, tactics, solvers, etc.

Note: Reference counting must be used to manage parameter sets, even when the Z3_context was created using Z3_mk_context instead of Z3_mk_context_rc.

Safe wrapper: Params.create (manual)

Z3_params_set_bool

def Z3_params_set_bool(self, c: Z3_context, p: Z3_params, k: Z3_symbol, v: Bool) raises

Add a Boolean parameter k with value v to the parameter set p.

Safe wrapper: Params.set_bool (manual)

Z3_params_set_double

def Z3_params_set_double(self, c: Z3_context, p: Z3_params, k: Z3_symbol, v: Float64) raises

Add a double parameter k with value v to the parameter set p.

Safe wrapper: Params.set_double (manual)

Z3_params_set_symbol

def Z3_params_set_symbol(self, c: Z3_context, p: Z3_params, k: Z3_symbol, v: Z3_symbol) raises

Add a symbol parameter k with value v to the parameter set p.

Safe wrapper: Params.set_symbol (manual)

Z3_params_set_uint

def Z3_params_set_uint(self, c: Z3_context, p: Z3_params, k: Z3_symbol, v: UInt32) raises

Add a unsigned parameter k with value v to the parameter set p.

Safe wrapper: Params.set_uint (manual)

Z3_params_to_string

def Z3_params_to_string(self, c: Z3_context, p: Z3_params) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert a parameter set into a string. This function is mainly used for printing the contents of a parameter set.

Safe wrapper: Params.to_string (manual)

Z3_params_validate

def Z3_params_validate(self, c: Z3_context, p: Z3_params, d: Z3_param_descrs) raises

Validate the parameter set p against the parameter description set d.

The procedure invokes the error handler if p is invalid.

Safe wrapper: Params.validate (auto)

Parameter Descriptions (5)

Z3_param_descrs_get_documentation

def Z3_param_descrs_get_documentation(self, c: Z3_context, p: Z3_param_descrs, s: Z3_symbol) raises -> Pointer[Int8, MutUntrackedOrigin]

Retrieve documentation string corresponding to parameter name s.

Safe wrapper: ParamDescrs.get_documentation (auto)

Z3_param_descrs_get_kind

def Z3_param_descrs_get_kind(self, c: Z3_context, p: Z3_param_descrs, n: Z3_symbol) raises -> ParamKind

Return the kind associated with the given parameter name n.

Safe wrapper: ParamDescrs.get_kind (auto)

Z3_param_descrs_get_name

def Z3_param_descrs_get_name(self, c: Z3_context, p: Z3_param_descrs, i: UInt32) raises -> Z3_symbol

Return the name of the parameter at given index i.

Precondition: i < Z3_param_descrs_size(c, p)

Safe wrapper: ParamDescrs.get_name (auto)

Z3_param_descrs_size

def Z3_param_descrs_size(self, c: Z3_context, p: Z3_param_descrs) raises -> UInt32

Return the number of parameters in the given parameter description set.

Safe wrapper: ParamDescrs.size (auto)

Z3_param_descrs_to_string

def Z3_param_descrs_to_string(self, c: Z3_context, p: Z3_param_descrs) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert a parameter description set into a string. This function is mainly used for printing the contents of a parameter description set.

Safe wrapper: ParamDescrs.to_string (auto)

Symbols (2)

Z3_mk_int_symbol

def Z3_mk_int_symbol(self, c: Z3_context, i: Int32) raises -> Z3_symbol

Create a Z3 symbol using an integer.

Symbols are used to name several term and type constructors.

NB. Not all integers can be passed to this function. The legal range of unsigned integers is 0 to 2^30-1.

See also: Z3_get_symbol_int, Z3_mk_string_symbol

Safe wrapper: Context.mk_int_symbol (manual)

Z3_mk_string_symbol

def Z3_mk_string_symbol(self, c: Z3_context, s: Pointer[Int8, _]) raises -> Z3_symbol

Create a Z3 symbol using a C string.

Symbols are used to name several term and type constructors.

See also: Z3_get_symbol_string, Z3_mk_int_symbol

Safe wrapper: Context.mk_symbol (manual)

Sorts (30)

Z3_constructor_num_fields

def Z3_constructor_num_fields(self, c: Z3_context, constr: Z3_constructor) raises -> UInt32

Retrieve the number of fields of a constructor

Parameters:

  • c — logical context.
  • constr — constructor.

Safe wrapper: Constructor.num_fields (auto)

Z3_get_finite_field_sort_size

def Z3_get_finite_field_sort_size(self, c: Z3_context, s: Z3_sort) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the decimal modulus of a finite-field sort.

Safe wrapper: Context.get_finite_field_sort_size (auto)

Z3_mk_array_sort

def Z3_mk_array_sort(self, c: Z3_context, domain: Z3_sort, range: Z3_sort) raises -> Z3_sort

Create an array type.

We usually represent the array type as: [domain -> range]. Arrays are usually used to model the heap/memory in software verification.

See also: Z3_mk_select, Z3_mk_store

Safe wrapper: Context.array_sort (manual)

Z3_mk_array_sort_n

def Z3_mk_array_sort_n(self, c: Z3_context, n: UInt32, domain: Pointer[Z3_sort, _], range: Z3_sort) raises -> Z3_sort

Create an array type with N arguments

See also: Z3_mk_select_n, Z3_mk_store_n

Safe wrapper: Context.mk_array_sort_n (auto)

Z3_mk_bool_sort

def Z3_mk_bool_sort(self, c: Z3_context) raises -> Z3_sort

Create the Boolean type.

This type is used to create propositional variables and predicates.

Safe wrapper: Context.bool_sort (manual)

Z3_mk_bv_sort

def Z3_mk_bv_sort(self, c: Z3_context, sz: UInt32) raises -> Z3_sort

Create a bit-vector type of the given size.

This type can also be seen as a machine integer.

Note: The size of the bit-vector type must be greater than zero.

Safe wrapper: Context.bv_sort (manual)

Z3_mk_complex

def Z3_mk_complex(self, c: Z3_context, re: Z3_ast, im: Z3_ast) raises -> Z3_ast

Create a complex number with the given real and imaginary components. Integer components are coerced to Real.

Safe wrapper: Context.mk_complex (auto)

Z3_mk_complex_sort

def Z3_mk_complex_sort(self, c: Z3_context) raises -> Z3_sort

Create the Complex sort. Complex numbers are pairs of Reals.

Use Z3_mk_complex to construct values and Z3_mk_real_part and Z3_mk_imag_part to access their components. The arithmetic APIs for addition, subtraction, multiplication, negation, and division accept Complex expressions. Ordering and exponentiation do not.

Safe wrapper: Context.mk_complex_sort (auto)

Z3_mk_constructor

def Z3_mk_constructor(self, c: Z3_context, name: Z3_symbol, recognizer: Z3_symbol, num_fields: UInt32, field_names: Pointer[Z3_symbol, _], sorts: Pointer[Z3_sort, _], sort_refs: Pointer[mut=True, UInt32, _]) raises -> Z3_constructor

Create a constructor.

Parameters:

  • c — logical context.
  • name — constructor name.
  • recognizer — name of recognizer function.
  • num_fields — number of fields in constructor.
  • field_names — names of the constructor fields.
  • sorts — field sorts, 0 if the field sort refers to a recursive sort.
  • sort_refs — reference to datatype sort that is an argument to the constructor; if the corresponding sort reference is 0, then the value in sort_refs should be an index referring to one of the recursive datatypes that is declared.

See also: Z3_del_constructor, Z3_mk_constructor_list, Z3_query_constructor

Safe wrapper: Context.mk_constructor (auto)

Z3_mk_constructor_list

def Z3_mk_constructor_list(self, c: Z3_context, num_constructors: UInt32, constructors: Pointer[Z3_constructor, _]) raises -> Z3_constructor_list

Create list of constructors.

Parameters:

  • c — logical context.
  • num_constructors — number of constructors in list.
  • constructors — list of constructors.

See also: Z3_del_constructor_list, Z3_mk_constructor

Safe wrapper: Context.mk_constructor_list (auto)

Z3_mk_datatype

def Z3_mk_datatype(self, c: Z3_context, name: Z3_symbol, num_constructors: UInt32, constructors: Pointer[mut=True, Z3_constructor, _]) raises -> Z3_sort

Create datatype, such as lists, trees, records, enumerations or unions of records. The datatype may be recursive. Return the datatype sort.

Parameters:

  • c — logical context.
  • name — name of datatype.
  • num_constructors — number of constructors passed in.
  • constructors — array of constructor containers.

See also: Z3_mk_constructor, Z3_mk_constructor_list, Z3_mk_datatypes

Safe wrapper: Context.mk_datatype (manual)

Z3_mk_datatype_sort

def Z3_mk_datatype_sort(self, c: Z3_context, name: Z3_symbol, num_params: UInt32, params: Pointer[Z3_sort, _]) raises -> Z3_sort

create a forward reference to a recursive datatype being declared. The forward reference can be used in a nested occurrence: the range of an array or as element sort of a sequence. The forward reference should only be used when used in an accessor for a recursive datatype that gets declared.

Forward references can replace the use sort references, that are unsigned integers in the Z3_mk_constructor call

Parameters:

  • c — logical context
  • name — name of the datatype
  • num_params — number of sort parameters
  • params — array of sort parameters

Safe wrapper: Context.mk_datatype_sort (auto)

Z3_mk_datatypes

def Z3_mk_datatypes(self, c: Z3_context, num_sorts: UInt32, sort_names: Pointer[Z3_symbol, _], sorts: Pointer[mut=True, Z3_sort, _], constructor_lists: Pointer[mut=True, Z3_constructor_list, _]) raises

Create mutually recursive datatypes.

Parameters:

  • c — logical context.
  • num_sorts — number of datatype sorts.
  • sort_names — names of datatype sorts.
  • sorts — array of datatype sorts.
  • constructor_lists — list of constructors, one list per sort.

See also: Z3_mk_constructor, Z3_mk_constructor_list, Z3_mk_datatype

Safe wrapper: Context.mk_datatypes (manual)

Z3_mk_enumeration_sort

def Z3_mk_enumeration_sort(self, c: Z3_context, name: Z3_symbol, n: UInt32, enum_names: Pointer[Z3_symbol, _], enum_consts: Pointer[mut=True, Z3_func_decl, _], enum_testers: Pointer[mut=True, Z3_func_decl, _]) raises -> Z3_sort

Create a enumeration sort.

An enumeration sort with n elements. This function will also declare the functions corresponding to the enumerations.

For example, if this function is called with three symbols A, B, C and the name S, then s is a sort whose name is S, and the function returns three terms corresponding to A, B, C in enum_consts. The array enum_testers has three predicates of type (s -> Bool). The first predicate (corresponding to A) is true when applied to A, and false otherwise. Similarly for the other predicates.

Parameters:

  • c — logical context
  • name — name of the enumeration sort.
  • n — number of elements in enumeration sort.
  • enum_names — names of the enumerated elements.
  • enum_consts — constants corresponding to the enumerated elements.
  • enum_testers — predicates testing if terms of the enumeration sort correspond to an enumeration.

Safe wrapper: Context.mk_enumeration_sort (manual)

Z3_mk_ff_add

def Z3_mk_ff_add(self, c: Z3_context, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Sum at least two elements of the same prime field.

Safe wrapper: Context.mk_ff_add (auto)

Z3_mk_ff_bitsum

def Z3_mk_ff_bitsum(self, c: Z3_context, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Weighted sum a0 + 2a1 + 4a2 + ... (does not constrain arguments to bits).

Safe wrapper: Context.mk_ff_bitsum (auto)

Z3_mk_ff_mul

def Z3_mk_ff_mul(self, c: Z3_context, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Multiply at least two elements of the same prime field.

Safe wrapper: Context.mk_ff_mul (auto)

Z3_mk_ff_neg

def Z3_mk_ff_neg(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Additive inverse in a prime field.

Safe wrapper: Context.mk_ff_neg (auto)

Z3_mk_finite_domain_sort

def Z3_mk_finite_domain_sort(self, c: Z3_context, name: Z3_symbol, size: UInt64) raises -> Z3_sort

Create a named finite domain sort.

To create constants that belong to the finite domain, use the APIs for creating numerals and pass a numeric constant together with the sort returned by this call. The numeric constant should be between 0 and the less than the size of the domain.

Z3_mk_finite_field_sort

def Z3_mk_finite_field_sort(self, c: Z3_context, prime: Pointer[Int8, _]) raises -> Z3_sort

Create a prime-field sort. Large moduli undergo probable-prime screening.

Safe wrapper: Context.mk_finite_field_sort (auto)

Z3_mk_imag_part

def Z3_mk_imag_part(self, c: Z3_context, z: Z3_ast) raises -> Z3_ast

Return the imaginary component of a Complex expression.

Safe wrapper: Context.mk_imag_part (auto)

Z3_mk_int_sort

def Z3_mk_int_sort(self, c: Z3_context) raises -> Z3_sort

Create the integer type.

This type is not the int type found in programming languages. A machine integer can be represented using bit-vectors. The function Z3_mk_bv_sort creates a bit-vector type.

See also: Z3_mk_bv_sort

Safe wrapper: Context.int_sort (manual)

Z3_mk_list_sort

def Z3_mk_list_sort(self, c: Z3_context, name: Z3_symbol, elem_sort: Z3_sort, nil_decl: Pointer[mut=True, Z3_func_decl, _], is_nil_decl: Pointer[mut=True, Z3_func_decl, _], cons_decl: Pointer[mut=True, Z3_func_decl, _], is_cons_decl: Pointer[mut=True, Z3_func_decl, _], head_decl: Pointer[mut=True, Z3_func_decl, _], tail_decl: Pointer[mut=True, Z3_func_decl, _]) raises -> Z3_sort

Create a list sort

A list sort over elem_sort This function declares the corresponding constructors and testers for lists.

Parameters:

  • c — logical context
  • name — name of the list sort.
  • elem_sort — sort of list elements.
  • nil_decl — declaration for the empty list.
  • is_nil_decl — test for the empty list.
  • cons_decl — declaration for a cons cell.
  • is_cons_decl — cons cell test.
  • head_decl — list head.
  • tail_decl — list tail.

Safe wrapper: Context.mk_list_sort (manual)

Z3_mk_polymorphic_datatype

def Z3_mk_polymorphic_datatype(self, c: Z3_context, name: Z3_symbol, num_parameters: UInt32, parameters: Pointer[mut=True, Z3_sort, _], num_constructors: UInt32, constructors: Pointer[mut=True, Z3_constructor, _]) raises -> Z3_sort

Create a parametric datatype with explicit type parameters.

This function is similar to Z3_mk_datatype, except it takes an explicit set of type parameters. The parameters can be type variables created with Z3_mk_type_variable, allowing the definition of polymorphic datatypes that can be instantiated with different concrete types.

Parameters:

  • c — logical context
  • name — name of the datatype
  • num_parameters — number of type parameters (can be 0)
  • parameters — array of type parameters (type variables or concrete sorts)
  • num_constructors — number of constructors
  • constructors — array of constructor specifications

See also: Z3_mk_datatype, Z3_mk_type_variable, Z3_mk_datatype_sort

Safe wrapper: Context.mk_polymorphic_datatype (manual)

Z3_mk_real_part

def Z3_mk_real_part(self, c: Z3_context, z: Z3_ast) raises -> Z3_ast

Return the real component of a Complex expression.

Safe wrapper: Context.mk_real_part (auto)

Z3_mk_real_sort

def Z3_mk_real_sort(self, c: Z3_context) raises -> Z3_sort

Create the real type.

Note that this type is not a floating point number.

Safe wrapper: Context.real_sort (manual)

Z3_mk_tuple_sort

def Z3_mk_tuple_sort(self, c: Z3_context, mk_tuple_name: Z3_symbol, num_fields: UInt32, field_names: Pointer[Z3_symbol, _], field_sorts: Pointer[Z3_sort, _], mk_tuple_decl: Pointer[mut=True, Z3_func_decl, _], proj_decl: Pointer[mut=True, Z3_func_decl, _]) raises -> Z3_sort

Create a tuple type.

A tuple with n fields has a constructor and n projections. This function will also declare the constructor and projection functions.

Parameters:

  • c — logical context
  • mk_tuple_name — name of the constructor function associated with the tuple type.
  • num_fields — number of fields in the tuple type.
  • field_names — name of the projection functions.
  • field_sorts — type of the tuple fields.
  • mk_tuple_decl — output parameter that will contain the constructor declaration.
  • proj_decl — output parameter that will contain the projection function declarations. This field must be a buffer of size num_fields allocated by the user.

Safe wrapper: Context.mk_tuple_sort (manual)

Z3_mk_type_variable

def Z3_mk_type_variable(self, c: Z3_context, s: Z3_symbol) raises -> Z3_sort

Create a type variable.

Functions using type variables can be applied to instantiations that match the signature of the function. Assertions using type variables correspond to assertions over all possible instantiations.

Safe wrapper: Context.mk_type_variable (auto)

Z3_mk_uninterpreted_sort

def Z3_mk_uninterpreted_sort(self, c: Z3_context, s: Z3_symbol) raises -> Z3_sort

Create a free (uninterpreted) type using the given name (symbol).

Two free types are considered the same iff the have the same name.

Safe wrapper: Context.uninterpreted_sort (manual)

Z3_query_constructor

def Z3_query_constructor(self, c: Z3_context, constr: Z3_constructor, num_fields: UInt32, constructor: Pointer[mut=True, Z3_func_decl, _], tester: Pointer[mut=True, Z3_func_decl, _], accessors: Pointer[mut=True, Z3_func_decl, _]) raises

Query constructor for declared functions.

Parameters:

  • c — logical context.
  • constr — constructor container. The container must have been passed into a Z3_mk_datatype call.
  • num_fields — number of accessor fields in the constructor.
  • constructor — constructor function declaration, allocated by user.
  • tester — constructor test function declaration, allocated by user.
  • accessors — array of accessor function declarations allocated by user. The array must contain num_fields elements.

See also: Z3_mk_constructor

Safe wrapper: Context.query_constructor (manual)

Constants and Applications (7)

Z3_add_rec_def

def Z3_add_rec_def(self, c: Z3_context, f: Z3_func_decl, n: UInt32, args: Pointer[mut=True, Z3_ast, _], body: Z3_ast) raises

Define the body of a recursive function.

After declaring a recursive function or a collection of mutually recursive functions, use this function to provide the definition for the recursive function.

Parameters:

  • c — logical context.
  • f — function declaration.
  • n — number of arguments to the function
  • args — constants that are used as arguments to the recursive function in the definition.
  • body — body of the recursive function

See also: Z3_mk_rec_func_decl

Safe wrapper: Context.add_rec_def (auto)

Z3_mk_app

def Z3_mk_app(self, c: Z3_context, d: Z3_func_decl, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create a constant or function application.

Z3_mk_const

def Z3_mk_const(self, c: Z3_context, s: Z3_symbol, ty: Z3_sort) raises -> Z3_ast

Declare and create a constant.

This function is a shorthand for:

Z3_func_decl d = Z3_mk_func_decl(c, s, 0, 0, ty);
Z3_ast n            = Z3_mk_app(c, d, 0, 0);

See also: Z3_mk_app, Z3_mk_fresh_const, Z3_mk_func_decl

Safe wrapper: Context.mk_const (manual)

Z3_mk_fresh_const

def Z3_mk_fresh_const(self, c: Z3_context, prefix: Pointer[Int8, _], ty: Z3_sort) raises -> Z3_ast

Declare and create a fresh constant.

This function is a shorthand for:

Z3_func_decl d = Z3_mk_fresh_func_decl(c, prefix, 0, 0, ty); Z3_ast n = Z3_mk_app(c, d, 0, 0);

Note: If prefix is NULL, then it is assumed to be the empty string.

See also: Z3_mk_app, Z3_mk_const, Z3_mk_fresh_func_decl, Z3_mk_func_decl

Safe wrapper: Context.mk_fresh_const (auto)

Z3_mk_fresh_func_decl

def Z3_mk_fresh_func_decl(self, c: Z3_context, prefix: Pointer[Int8, _], domain_size: UInt32, domain: Pointer[Z3_sort, _], range: Z3_sort) raises -> Z3_func_decl

Declare a fresh constant or function.

Z3 will generate an unique name for this function declaration. If prefix is different from NULL, then the name generate by Z3 will start with prefix.

Note: If prefix is NULL, then it is assumed to be the empty string.

See also: Z3_mk_func_decl

Safe wrapper: Context.mk_fresh_func_decl (auto)

Z3_mk_func_decl

def Z3_mk_func_decl(self, c: Z3_context, s: Z3_symbol, domain_size: UInt32, domain: Pointer[Z3_sort, _], range: Z3_sort) raises -> Z3_func_decl

Declare a constant or function.

After declaring a constant or function, the function Z3_mk_app can be used to create a constant or function application.

Parameters:

  • c — logical context.
  • s — name of the constant or function.
  • domain_size — number of arguments. It is 0 when declaring a constant.
  • domain — array containing the sort of each argument. The array must contain domain_size elements. It is 0 when declaring a constant.
  • range — sort of the constant or the return sort of the function.

See also: Z3_mk_app, Z3_mk_fresh_func_decl, Z3_mk_rec_func_decl

Safe wrapper: Context.mk_func_decl (manual)

Z3_mk_rec_func_decl

def Z3_mk_rec_func_decl(self, c: Z3_context, s: Z3_symbol, domain_size: UInt32, domain: Pointer[Z3_sort, _], range: Z3_sort) raises -> Z3_func_decl

Declare a recursive function

After declaring recursive function, it should be associated with a recursive definition Z3_add_rec_def. The function Z3_mk_app can be used to create a constant or function application.

Parameters:

  • c — logical context.
  • s — name of the function.
  • domain_size — number of arguments. It should be greater than 0.
  • domain — array containing the sort of each argument. The array must contain domain_size elements.
  • range — sort of the constant or the return sort of the function.

See also: Z3_add_rec_def, Z3_mk_app, Z3_mk_func_decl

Safe wrapper: Context.mk_rec_func_decl (auto)

Propositional Logic and Equality (11)

Z3_mk_and

def Z3_mk_and(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create an AST node representing args[0] and ... and args[num_args-1].

The array args must have num_args elements. All arguments must have Boolean sort.

Note: The number of arguments must be greater than zero.

Safe wrapper: Context.mk_and (manual)

Z3_mk_distinct

def Z3_mk_distinct(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create an AST node representing distinct(args[0], ..., args[num_args-1]).

The distinct construct is used for declaring the arguments pairwise distinct. That is, Forall 0 <= i < j < num_args. not args[i] = args[j].

All arguments must have the same sort.

Note: The number of arguments of a distinct construct must be greater than one.

Safe wrapper: Context.mk_distinct (manual)

Z3_mk_eq

def Z3_mk_eq(self, c: Z3_context, l: Z3_ast, r: Z3_ast) raises -> Z3_ast

Create an AST node representing l = r.

The nodes l and r must have the same type.

Safe wrapper: Context.mk_eq (manual)

Z3_mk_false

def Z3_mk_false(self, c: Z3_context) raises -> Z3_ast

Create an AST node representing false.

Safe wrapper: Context.mk_false (manual)

Z3_mk_iff

def Z3_mk_iff(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create an AST node representing t1 iff t2.

The nodes t1 and t2 must have Boolean sort.

Safe wrapper: Context.mk_iff (manual)

Z3_mk_implies

def Z3_mk_implies(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create an AST node representing t1 implies t2.

The nodes t1 and t2 must have Boolean sort.

Safe wrapper: Context.mk_implies (manual)

Z3_mk_ite

def Z3_mk_ite(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast, t3: Z3_ast) raises -> Z3_ast

Create an AST node representing an if-then-else: ite(t1, t2, t3).

The node t1 must have Boolean sort, t2 and t3 must have the same sort. The sort of the new node is equal to the sort of t2 and t3.

Safe wrapper: Context.mk_ite (manual)

Z3_mk_not

def Z3_mk_not(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Create an AST node representing not(a).

The node a must have Boolean sort.

Safe wrapper: Context.mk_not (manual)

Z3_mk_or

def Z3_mk_or(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create an AST node representing args[0] or ... or args[num_args-1].

The array args must have num_args elements. All arguments must have Boolean sort.

Note: The number of arguments must be greater than zero.

Safe wrapper: Context.mk_or (manual)

Z3_mk_true

def Z3_mk_true(self, c: Z3_context) raises -> Z3_ast

Create an AST node representing true.

Safe wrapper: Context.mk_true (manual)

Z3_mk_xor

def Z3_mk_xor(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create an AST node representing t1 xor t2.

The nodes t1 and t2 must have Boolean sort.

Safe wrapper: Context.mk_xor (manual)

Integers and Reals (17)

Z3_mk_abs

def Z3_mk_abs(self, c: Z3_context, arg: Z3_ast) raises -> Z3_ast

Take the absolute value of an integer

Safe wrapper: Context.mk_abs (auto)

Z3_mk_add

def Z3_mk_add(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create an AST node representing args[0] + ... + args[num_args-1].

The array args must have num_args elements. All arguments must have Int, Real, or Complex sort.

Note: The number of arguments must be greater than zero.

Safe wrapper: Context.mk_add (manual)

Z3_mk_div

def Z3_mk_div(self, c: Z3_context, arg1: Z3_ast, arg2: Z3_ast) raises -> Z3_ast

Create an AST node representing arg1 div arg2.

The arguments must have Int, Real, or Complex sort. Int arguments use integer division. Real and Complex arguments use their respective division operations, with Int embedded in Real and Int/Real embedded in Complex. Complex division is lowered to Real component division; at a zero Complex denominator, both components are the same totalized Real 0/0 value.

Safe wrapper: Context.mk_div (manual)

Z3_mk_divides

def Z3_mk_divides(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create division predicate.

The nodes t1 and t2 must be of integer sort. The predicate is true when t1 divides t2. For the predicate to be part of linear integer arithmetic, the first argument t1 must be a non-zero integer.

Safe wrapper: Context.mk_divides (auto)

Z3_mk_ge

def Z3_mk_ge(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create greater than or equal to.

The nodes t1 and t2 must have the same sort, and must be int or real.

Safe wrapper: Context.mk_ge (manual)

Z3_mk_gt

def Z3_mk_gt(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create greater than.

The nodes t1 and t2 must have the same sort, and must be int or real.

Safe wrapper: Context.mk_gt (manual)

Z3_mk_int2real

def Z3_mk_int2real(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Coerce an integer to a real.

There is also a converse operation exposed. It follows the semantics prescribed by the SMT-LIB standard.

You can take the floor of a real by creating an auxiliary integer constant k and and asserting mk_int2real(k) <= t1 < mk_int2real(k)+1.

The node t1 must have sort integer.

See also: Z3_mk_real2int, Z3_mk_is_int

Safe wrapper: Context.mk_int2real (manual)

Z3_mk_is_int

def Z3_mk_is_int(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Check if a real number is an integer.

See also: Z3_mk_int2real, Z3_mk_real2int

Safe wrapper: Context.mk_is_int (manual)

Z3_mk_le

def Z3_mk_le(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create less than or equal to.

The nodes t1 and t2 must have the same sort, and must be int or real.

Safe wrapper: Context.mk_le (manual)

Z3_mk_lt

def Z3_mk_lt(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create less than.

The nodes t1 and t2 must have the same sort, and must be int or real.

Safe wrapper: Context.mk_lt (manual)

Z3_mk_mod

def Z3_mk_mod(self, c: Z3_context, arg1: Z3_ast, arg2: Z3_ast) raises -> Z3_ast

Create an AST node representing arg1 mod arg2.

The arguments must have int type.

Safe wrapper: Context.mk_mod (manual)

Z3_mk_mul

def Z3_mk_mul(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create an AST node representing args[0] * ... * args[num_args-1].

The array args must have num_args elements. All arguments must have Int, Real, or Complex sort.

Notes:

  • Z3 has limited support for non-linear arithmetic.
  • The number of arguments must be greater than zero.

Safe wrapper: Context.mk_mul (manual)

Z3_mk_power

def Z3_mk_power(self, c: Z3_context, arg1: Z3_ast, arg2: Z3_ast) raises -> Z3_ast

Create an AST node representing arg1 ^ arg2.

The arguments must have int or real type.

Safe wrapper: Context.mk_pow (manual)

Z3_mk_real2int

def Z3_mk_real2int(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Coerce a real to an integer.

The semantics of this function follows the SMT-LIB standard for the function to_int

See also: Z3_mk_int2real, Z3_mk_is_int

Safe wrapper: Context.mk_real2int (manual)

Z3_mk_rem

def Z3_mk_rem(self, c: Z3_context, arg1: Z3_ast, arg2: Z3_ast) raises -> Z3_ast

Create an AST node representing arg1 rem arg2.

The arguments must have int type.

Safe wrapper: Context.mk_rem (manual)

Z3_mk_sub

def Z3_mk_sub(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create an AST node representing args[0] - ... - args[num_args - 1].

The array args must have num_args elements. All arguments must have Int, Real, or Complex sort.

Note: The number of arguments must be greater than zero.

Safe wrapper: Context.mk_sub (manual)

Z3_mk_unary_minus

def Z3_mk_unary_minus(self, c: Z3_context, arg: Z3_ast) raises -> Z3_ast

Create an AST node representing - arg.

The argument must have Int, Real, or Complex sort.

Safe wrapper: Context.mk_neg (manual)

Bit-vectors (49)

Z3_mk_bit2bool

def Z3_mk_bit2bool(self, c: Z3_context, i: UInt32, t1: Z3_ast) raises -> Z3_ast

Extracts the bit at position i of a bit-vector and yields a boolean.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_bit2bool (auto)

Z3_mk_bv2int

def Z3_mk_bv2int(self, c: Z3_context, t1: Z3_ast, is_signed: Bool) raises -> Z3_ast

Create an integer from the bit-vector argument t1. If is_signed is false, then the bit-vector t1 is treated as unsigned. So the result is non-negative and in the range [0..2^N-1], where N are the number of bits in t1. If is_signed is true, t1 is treated as a signed bit-vector.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_bv2int (auto)

Z3_mk_bvadd

def Z3_mk_bvadd(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Standard two's complement addition.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvadd (manual)

Z3_mk_bvadd_no_overflow

def Z3_mk_bvadd_no_overflow(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast, is_signed: Bool) raises -> Z3_ast

Create a predicate that checks that the bit-wise addition of t1 and t2 does not overflow.

The nodes t1 and t2 must have the same bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvadd_no_overflow (auto)

Z3_mk_bvadd_no_underflow

def Z3_mk_bvadd_no_underflow(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create a predicate that checks that the bit-wise signed addition of t1 and t2 does not underflow.

The nodes t1 and t2 must have the same bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvadd_no_underflow (auto)

Z3_mk_bvand

def Z3_mk_bvand(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Bitwise and.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvand (manual)

Z3_mk_bvashr

def Z3_mk_bvashr(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Arithmetic shift right.

It is like logical shift right except that the most significant bits of the result always copy the most significant bit of the second argument.

The semantics of shift operations varies between environments. This definition does not necessarily capture directly the semantics of the programming language or assembly architecture you are modeling.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvashr (auto)

Z3_mk_bvlshr

def Z3_mk_bvlshr(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Logical shift right.

It is equivalent to unsigned division by 2^x where x is the value of the third argument.

NB. The semantics of shift operations varies between environments. This definition does not necessarily capture directly the semantics of the programming language or assembly architecture you are modeling.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvlshr (auto)

Z3_mk_bvmul

def Z3_mk_bvmul(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Standard two's complement multiplication.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvmul (manual)

Z3_mk_bvmul_no_overflow

def Z3_mk_bvmul_no_overflow(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast, is_signed: Bool) raises -> Z3_ast

Create a predicate that checks that the bit-wise multiplication of t1 and t2 does not overflow.

The nodes t1 and t2 must have the same bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvmul_no_overflow (auto)

Z3_mk_bvmul_no_underflow

def Z3_mk_bvmul_no_underflow(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create a predicate that checks that the bit-wise signed multiplication of t1 and t2 does not underflow.

The nodes t1 and t2 must have the same bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvmul_no_underflow (auto)

Z3_mk_bvnand

def Z3_mk_bvnand(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Bitwise nand.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvnand (auto)

Z3_mk_bvneg

def Z3_mk_bvneg(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Standard two's complement unary minus.

The node t1 must have bit-vector sort.

Safe wrapper: Context.mk_bvneg (manual)

Z3_mk_bvneg_no_overflow

def Z3_mk_bvneg_no_overflow(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Check that bit-wise negation does not overflow when t1 is interpreted as a signed bit-vector.

The node t1 must have bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvneg_no_overflow (auto)

Z3_mk_bvnor

def Z3_mk_bvnor(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Bitwise nor.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvnor (auto)

Z3_mk_bvnot

def Z3_mk_bvnot(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Bitwise negation.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_bvnot (manual)

Z3_mk_bvor

def Z3_mk_bvor(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Bitwise or.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvor (manual)

Z3_mk_bvredand

def Z3_mk_bvredand(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Take conjunction of bits in vector, return vector of length 1.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_bvredand (auto)

Z3_mk_bvredor

def Z3_mk_bvredor(self, c: Z3_context, t1: Z3_ast) raises -> Z3_ast

Take disjunction of bits in vector, return vector of length 1.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_bvredor (auto)

Z3_mk_bvsdiv

def Z3_mk_bvsdiv(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Two's complement signed division.

It is defined in the following way:

  • The floor of t1/t2 if t2 is different from zero, and t1*t2 >= 0.

  • The ceiling of t1/t2 if t2 is different from zero, and t1*t2 < 0.

If t2 is zero, then the result is undefined.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvsdiv (auto)

Z3_mk_bvsdiv_no_overflow

def Z3_mk_bvsdiv_no_overflow(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create a predicate that checks that the bit-wise signed division of t1 and t2 does not overflow.

The nodes t1 and t2 must have the same bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvsdiv_no_overflow (auto)

Z3_mk_bvsge

def Z3_mk_bvsge(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Two's complement signed greater than or equal to.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvsge (auto)

Z3_mk_bvsgt

def Z3_mk_bvsgt(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Two's complement signed greater than.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvsgt (auto)

Z3_mk_bvshl

def Z3_mk_bvshl(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Shift left.

It is equivalent to multiplication by 2^x where x is the value of the third argument.

NB. The semantics of shift operations varies between environments. This definition does not necessarily capture directly the semantics of the programming language or assembly architecture you are modeling.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvshl (auto)

Z3_mk_bvsle

def Z3_mk_bvsle(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Two's complement signed less than or equal to.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvsle (manual)

Z3_mk_bvslt

def Z3_mk_bvslt(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Two's complement signed less than.

It abbreviates:

(or (and (= (extract[|m-1|:|m-1|] t1) bit1)
        (= (extract[|m-1|:|m-1|] t2) bit0))
    (and (= (extract[|m-1|:|m-1|] t1) (extract[|m-1|:|m-1|] t2))
        (bvult t1 t2)))

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvslt (manual)

Z3_mk_bvsmod

def Z3_mk_bvsmod(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Two's complement signed remainder (sign follows divisor).

If t2 is zero, then the result is undefined.

The nodes t1 and t2 must have the same bit-vector sort.

See also: Z3_mk_bvsrem

Safe wrapper: Context.mk_bvsmod (auto)

Z3_mk_bvsrem

def Z3_mk_bvsrem(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Two's complement signed remainder (sign follows dividend).

It is defined as t1 - (t1 /s t2) * t2, where /s represents signed division. The most significant bit (sign) of the result is equal to the most significant bit of t1.

If t2 is zero, then the result is undefined.

The nodes t1 and t2 must have the same bit-vector sort.

See also: Z3_mk_bvsmod

Safe wrapper: Context.mk_bvsrem (auto)

Z3_mk_bvsub

def Z3_mk_bvsub(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Standard two's complement subtraction.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvsub (manual)

Z3_mk_bvsub_no_overflow

def Z3_mk_bvsub_no_overflow(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Create a predicate that checks that the bit-wise signed subtraction of t1 and t2 does not overflow.

The nodes t1 and t2 must have the same bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvsub_no_overflow (auto)

Z3_mk_bvsub_no_underflow

def Z3_mk_bvsub_no_underflow(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast, is_signed: Bool) raises -> Z3_ast

Create a predicate that checks that the bit-wise subtraction of t1 and t2 does not underflow.

The nodes t1 and t2 must have the same bit-vector sort. The returned node is of sort Bool.

Safe wrapper: Context.mk_bvsub_no_underflow (auto)

Z3_mk_bvudiv

def Z3_mk_bvudiv(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Unsigned division.

It is defined as the floor of t1/t2 if t2 is different from zero. If t2 is zero, then the result is undefined.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvudiv (auto)

Z3_mk_bvuge

def Z3_mk_bvuge(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Unsigned greater than or equal to.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvuge (auto)

Z3_mk_bvugt

def Z3_mk_bvugt(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Unsigned greater than.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvugt (auto)

Z3_mk_bvule

def Z3_mk_bvule(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Unsigned less than or equal to.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvule (manual)

Z3_mk_bvult

def Z3_mk_bvult(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Unsigned less than.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvult (manual)

Z3_mk_bvurem

def Z3_mk_bvurem(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Unsigned remainder.

It is defined as t1 - (t1 /u t2) * t2, where /u represents unsigned division.

If t2 is zero, then the result is undefined.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvurem (auto)

Z3_mk_bvxnor

def Z3_mk_bvxnor(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Bitwise xnor.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvxnor (auto)

Z3_mk_bvxor

def Z3_mk_bvxor(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Bitwise exclusive-or.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_bvxor (manual)

Z3_mk_concat

def Z3_mk_concat(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Concatenate the given bit-vectors.

The nodes t1 and t2 must have (possibly different) bit-vector sorts

The result is a bit-vector of size n1+n2, where n1 (n2) is the size of t1 (t2).

Safe wrapper: Context.mk_concat (manual)

Z3_mk_ext_rotate_left

def Z3_mk_ext_rotate_left(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Rotate bits of t1 to the left t2 times.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_ext_rotate_left (auto)

Z3_mk_ext_rotate_right

def Z3_mk_ext_rotate_right(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Rotate bits of t1 to the right t2 times.

The nodes t1 and t2 must have the same bit-vector sort.

Safe wrapper: Context.mk_ext_rotate_right (auto)

Z3_mk_extract

def Z3_mk_extract(self, c: Z3_context, high: UInt32, low: UInt32, t1: Z3_ast) raises -> Z3_ast

Extract the bits high down to low from a bit-vector of size m to yield a new bit-vector of size n, where n = high - low + 1.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_extract (manual)

Z3_mk_int2bv

def Z3_mk_int2bv(self, c: Z3_context, n: UInt32, t1: Z3_ast) raises -> Z3_ast

Create an n bit bit-vector from the integer argument t1.

The resulting bit-vector has n bits, where the i'th bit (counting from 0 to n-1) is 1 if (t1 div 2^i) mod 2 is 1.

The node t1 must have integer sort.

Safe wrapper: Context.mk_int2bv (auto)

Z3_mk_repeat

def Z3_mk_repeat(self, c: Z3_context, i: UInt32, t1: Z3_ast) raises -> Z3_ast

Repeat the given bit-vector up length i.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_repeat (auto)

Z3_mk_rotate_left

def Z3_mk_rotate_left(self, c: Z3_context, i: UInt32, t1: Z3_ast) raises -> Z3_ast

Rotate bits of t1 to the left i times.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_rotate_left (auto)

Z3_mk_rotate_right

def Z3_mk_rotate_right(self, c: Z3_context, i: UInt32, t1: Z3_ast) raises -> Z3_ast

Rotate bits of t1 to the right i times.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_rotate_right (auto)

Z3_mk_sign_ext

def Z3_mk_sign_ext(self, c: Z3_context, i: UInt32, t1: Z3_ast) raises -> Z3_ast

Sign-extend of the given bit-vector to the (signed) equivalent bit-vector of size m+i, where m is the size of the given bit-vector.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_sign_ext (auto)

Z3_mk_zero_ext

def Z3_mk_zero_ext(self, c: Z3_context, i: UInt32, t1: Z3_ast) raises -> Z3_ast

Extend the given bit-vector with zeros to the (unsigned) equivalent bit-vector of size m+i, where m is the size of the given bit-vector.

The node t1 must have a bit-vector sort.

Safe wrapper: Context.mk_zero_ext (auto)

Arrays (8)

Z3_mk_array_default

def Z3_mk_array_default(self, c: Z3_context, array: Z3_ast) raises -> Z3_ast

Access the array default value. Produces the default range value, for arrays that can be represented as finite maps with a default range value.

Parameters:

  • c — logical context.
  • array — array value whose default range value is accessed.

Safe wrapper: Context.mk_array_default (auto)

Z3_mk_as_array

def Z3_mk_as_array(self, c: Z3_context, f: Z3_func_decl) raises -> Z3_ast

Create array with the same interpretation as a function. The array satisfies the property (f x) = (select (_ as-array f) x) for every argument x.

Safe wrapper: Context.mk_as_array (auto)

Z3_mk_const_array

def Z3_mk_const_array(self, c: Z3_context, domain: Z3_sort, v: Z3_ast) raises -> Z3_ast

Create the constant array.

The resulting term is an array, such that a select on an arbitrary index produces the value v.

Parameters:

  • c — logical context.
  • domain — domain sort for the array.
  • v — value that the array maps to.

Safe wrapper: Context.mk_const_array (auto)

Z3_mk_map

def Z3_mk_map(self, c: Z3_context, f: Z3_func_decl, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Map f on the argument arrays.

The n nodes args must be of array sorts [domain_i -> range_i]. The function declaration f must have type range_1 .. range_n -> range. v must have sort range. The sort of the result is [domain_i -> range].

See also: Z3_mk_array_sort, Z3_mk_store, Z3_mk_select

Safe wrapper: Context.mk_map (auto)

Z3_mk_select

def Z3_mk_select(self, c: Z3_context, a: Z3_ast, i: Z3_ast) raises -> Z3_ast

Array read. The argument a is the array and i is the index of the array that gets read.

The node a must have an array sort [domain -> range], and i must have the sort domain. The sort of the result is range.

See also: Z3_mk_array_sort, Z3_mk_store

Safe wrapper: Context.mk_select (manual)

Z3_mk_select_n

def Z3_mk_select_n(self, c: Z3_context, a: Z3_ast, n: UInt32, idxs: Pointer[Z3_ast, _]) raises -> Z3_ast

n-ary Array read. The argument a is the array and idxs are the indices of the array that gets read.

Safe wrapper: Context.mk_select_n (auto)

Z3_mk_store

def Z3_mk_store(self, c: Z3_context, a: Z3_ast, i: Z3_ast, v: Z3_ast) raises -> Z3_ast

Array update.

The node a must have an array sort [domain -> range], i must have sort domain, v must have sort range. The sort of the result is [domain -> range]. The semantics of this function is given by the theory of arrays described in the SMT-LIB standard. See http://smtlib.org for more details. The result of this function is an array that is equal to a (with respect to select) on all indices except for i, where it maps to v (and the select of a with respect to i may be a different value).

See also: Z3_mk_array_sort, Z3_mk_select

Safe wrapper: Context.mk_store (manual)

Z3_mk_store_n

def Z3_mk_store_n(self, c: Z3_context, a: Z3_ast, n: UInt32, idxs: Pointer[Z3_ast, _], v: Z3_ast) raises -> Z3_ast

n-ary Array update.

Safe wrapper: Context.mk_store_n (auto)

Sets (12)

Z3_mk_array_ext

def Z3_mk_array_ext(self, c: Z3_context, arg1: Z3_ast, arg2: Z3_ast) raises -> Z3_ast

Create array extensionality index given two arrays with the same sort. The meaning is given by the axiom: (=> (= (select A (array-ext A B)) (select B (array-ext A B))) (= A B))

Safe wrapper: Context.mk_array_ext (auto)

Z3_mk_empty_set

def Z3_mk_empty_set(self, c: Z3_context, domain: Z3_sort) raises -> Z3_ast

Create the empty set.

Safe wrapper: Context.mk_empty_set (auto)

Z3_mk_full_set

def Z3_mk_full_set(self, c: Z3_context, domain: Z3_sort) raises -> Z3_ast

Create the full set.

Safe wrapper: Context.mk_full_set (auto)

Z3_mk_set_add

def Z3_mk_set_add(self, c: Z3_context, set: Z3_ast, elem: Z3_ast) raises -> Z3_ast

Add an element to a set.

The first argument must be a set, the second an element.

Safe wrapper: Context.mk_set_add (auto)

Z3_mk_set_complement

def Z3_mk_set_complement(self, c: Z3_context, arg: Z3_ast) raises -> Z3_ast

Take the complement of a set.

Safe wrapper: Context.mk_set_complement (auto)

Z3_mk_set_del

def Z3_mk_set_del(self, c: Z3_context, set: Z3_ast, elem: Z3_ast) raises -> Z3_ast

Remove an element to a set.

The first argument must be a set, the second an element.

Safe wrapper: Context.mk_set_del (auto)

Z3_mk_set_difference

def Z3_mk_set_difference(self, c: Z3_context, arg1: Z3_ast, arg2: Z3_ast) raises -> Z3_ast

Take the set difference between two sets.

Safe wrapper: Context.mk_set_difference (auto)

Z3_mk_set_intersect

def Z3_mk_set_intersect(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Take the intersection of a list of sets.

Safe wrapper: Context.mk_set_intersect (auto)

Z3_mk_set_member

def Z3_mk_set_member(self, c: Z3_context, elem: Z3_ast, set: Z3_ast) raises -> Z3_ast

Check for set membership.

The first argument should be an element type of the set.

Safe wrapper: Context.mk_set_member (auto)

Z3_mk_set_sort

def Z3_mk_set_sort(self, c: Z3_context, ty: Z3_sort) raises -> Z3_sort

Create Set type.

Safe wrapper: Context.mk_set_sort (auto)

Z3_mk_set_subset

def Z3_mk_set_subset(self, c: Z3_context, arg1: Z3_ast, arg2: Z3_ast) raises -> Z3_ast

Check for subsetness of sets.

Safe wrapper: Context.mk_set_subset (auto)

Z3_mk_set_union

def Z3_mk_set_union(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Take the union of a list of sets.

Safe wrapper: Context.mk_set_union (auto)

Finite Sets (14)

Z3_get_finite_set_sort_basis

def Z3_get_finite_set_sort_basis(self, c: Z3_context, s: Z3_sort) raises -> Z3_sort

Get the element sort of a finite set sort.

Safe wrapper: Context.get_finite_set_sort_basis (auto)

Z3_is_finite_set_sort

def Z3_is_finite_set_sort(self, c: Z3_context, s: Z3_sort) raises -> Bool

Check if a sort is a finite set sort.

Safe wrapper: Context.is_finite_set_sort (auto)

Z3_mk_finite_set_difference

def Z3_mk_finite_set_difference(self, c: Z3_context, s1: Z3_ast, s2: Z3_ast) raises -> Z3_ast

Create the set difference of two finite sets.

Safe wrapper: Context.mk_finite_set_difference (auto)

Z3_mk_finite_set_empty

def Z3_mk_finite_set_empty(self, c: Z3_context, set_sort: Z3_sort) raises -> Z3_ast

Create an empty finite set of the given sort.

Safe wrapper: Context.mk_finite_set_empty (auto)

Z3_mk_finite_set_filter

def Z3_mk_finite_set_filter(self, c: Z3_context, f: Z3_ast, set: Z3_ast) raises -> Z3_ast

Filter a finite set using a predicate.

Safe wrapper: Context.mk_finite_set_filter (auto)

Z3_mk_finite_set_intersect

def Z3_mk_finite_set_intersect(self, c: Z3_context, s1: Z3_ast, s2: Z3_ast) raises -> Z3_ast

Create the intersection of two finite sets.

Safe wrapper: Context.mk_finite_set_intersect (auto)

Z3_mk_finite_set_map

def Z3_mk_finite_set_map(self, c: Z3_context, f: Z3_ast, set: Z3_ast) raises -> Z3_ast

Apply a function to all elements of a finite set.

Safe wrapper: Context.mk_finite_set_map (auto)

Z3_mk_finite_set_member

def Z3_mk_finite_set_member(self, c: Z3_context, elem: Z3_ast, set: Z3_ast) raises -> Z3_ast

Check if an element is a member of a finite set.

Safe wrapper: Context.mk_finite_set_member (auto)

Z3_mk_finite_set_range

def Z3_mk_finite_set_range(self, c: Z3_context, low: Z3_ast, high: Z3_ast) raises -> Z3_ast

Create a finite set of integers in the range [low, high].

Safe wrapper: Context.mk_finite_set_range (auto)

Z3_mk_finite_set_singleton

def Z3_mk_finite_set_singleton(self, c: Z3_context, elem: Z3_ast) raises -> Z3_ast

Create a singleton finite set.

Safe wrapper: Context.mk_finite_set_singleton (auto)

Z3_mk_finite_set_size

def Z3_mk_finite_set_size(self, c: Z3_context, set: Z3_ast) raises -> Z3_ast

Get the size (cardinality) of a finite set.

Safe wrapper: Context.mk_finite_set_size (auto)

Z3_mk_finite_set_sort

def Z3_mk_finite_set_sort(self, c: Z3_context, elem_sort: Z3_sort) raises -> Z3_sort

Create a finite set sort.

Safe wrapper: Context.mk_finite_set_sort (auto)

Z3_mk_finite_set_subset

def Z3_mk_finite_set_subset(self, c: Z3_context, s1: Z3_ast, s2: Z3_ast) raises -> Z3_ast

Check if one finite set is a subset of another.

Safe wrapper: Context.mk_finite_set_subset (auto)

Z3_mk_finite_set_union

def Z3_mk_finite_set_union(self, c: Z3_context, s1: Z3_ast, s2: Z3_ast) raises -> Z3_ast

Create the union of two finite sets.

Safe wrapper: Context.mk_finite_set_union (auto)

Numerals (8)

Z3_mk_bv_numeral

def Z3_mk_bv_numeral(self, c: Z3_context, sz: UInt32, bits: Pointer[UInt8, _]) raises -> Z3_ast

create a bit-vector numeral from a vector of Booleans.

See also: Z3_mk_numeral

Safe wrapper: Context.mk_bv_numeral (auto)

Z3_mk_int

def Z3_mk_int(self, c: Z3_context, v: Int32, ty: Z3_sort) raises -> Z3_ast

Create a numeral of an int, bit-vector, or finite-domain sort.

This function can be used to create numerals that fit in a machine integer. It is slightly faster than Z3_mk_numeral since it is not necessary to parse a string.

See also: Z3_mk_numeral

Safe wrapper: Context.Z3_mk_int (auto)

Z3_mk_int64

def Z3_mk_int64(self, c: Z3_context, v: Int64, ty: Z3_sort) raises -> Z3_ast

Create a numeral of a int, bit-vector, or finite-domain sort.

This function can be used to create numerals that fit in a machine int64_t integer. It is slightly faster than Z3_mk_numeral since it is not necessary to parse a string.

See also: Z3_mk_numeral

Safe wrapper: Context.mk_int (manual)

Z3_mk_numeral

def Z3_mk_numeral(self, c: Z3_context, numeral: Pointer[Int8, _], ty: Z3_sort) raises -> Z3_ast

Create a numeral of a given sort.

Parameters:

  • c — logical context.
  • numeral — A string representing the numeral value in decimal notation. The string may be of the form [num]*[.[num]*][E[+|-][num]+]. If the given sort is a real, then the numeral can be a rational, that is, a string of the form [num]* / [num]* .
  • ty — The sort of the numeral. In the current implementation, the given sort can be an int, real, finite-domain, or bit-vectors of arbitrary size.

See also: Z3_mk_int, Z3_mk_unsigned_int

Safe wrapper: Context.mk_numeral (manual)

Z3_mk_real

def Z3_mk_real(self, c: Z3_context, num: Int32, den: Int32) raises -> Z3_ast

Create a real from a fraction.

Parameters:

  • c — logical context.
  • num — numerator of rational.
  • den — denominator of rational.

Precondition: den != 0

See also: Z3_mk_numeral, Z3_mk_int, Z3_mk_real_int64, Z3_mk_unsigned_int

Safe wrapper: Context.mk_real_frac (manual)

Z3_mk_real_int64

def Z3_mk_real_int64(self, c: Z3_context, num: Int64, den: Int64) raises -> Z3_ast

Create a real from a fraction of int64.

See also: Z3_mk_real

Safe wrapper: Context.mk_real (manual)

Z3_mk_unsigned_int

def Z3_mk_unsigned_int(self, c: Z3_context, v: UInt32, ty: Z3_sort) raises -> Z3_ast

Create a numeral of a int, bit-vector, or finite-domain sort.

This function can be used to create numerals that fit in a machine unsigned integer. It is slightly faster than Z3_mk_numeral since it is not necessary to parse a string.

See also: Z3_mk_numeral

Safe wrapper: Context.mk_unsigned_int (auto)

Z3_mk_unsigned_int64

def Z3_mk_unsigned_int64(self, c: Z3_context, v: UInt64, ty: Z3_sort) raises -> Z3_ast

Create a numeral of a int, bit-vector, or finite-domain sort.

This function can be used to create numerals that fit in a machine uint64_t integer. It is slightly faster than Z3_mk_numeral since it is not necessary to parse a string.

See also: Z3_mk_numeral

Safe wrapper: Context.mk_unsigned_int64 (auto)

Sequences and regular expressions (69)

Z3_get_lstring

def Z3_get_lstring(self, c: Z3_context, s: Z3_ast, length: Pointer[mut=True, UInt32, _]) raises -> Pointer[Int8, MutUntrackedOrigin]

Retrieve the string constant stored in s. The string can contain escape sequences. Characters in the range 1 to 255 are literal. Characters in the range 0, and 256 above are escaped.

Precondition: Z3_is_string(c, s)

Safe wrapper: Context.get_lstring (manual)

Z3_get_re_sort_basis

def Z3_get_re_sort_basis(self, c: Z3_context, s: Z3_sort) raises -> Z3_sort

Retrieve basis sort for regex sort.

Safe wrapper: Context.get_re_sort_basis (auto)

Z3_get_seq_sort_basis

def Z3_get_seq_sort_basis(self, c: Z3_context, s: Z3_sort) raises -> Z3_sort

Retrieve basis sort for sequence sort.

Safe wrapper: Context.get_seq_sort_basis (auto)

Z3_get_string

def Z3_get_string(self, c: Z3_context, s: Z3_ast) raises -> Pointer[Int8, MutUntrackedOrigin]

Retrieve the string constant stored in s. Characters outside the basic printable ASCII range are escaped.

Precondition: Z3_is_string(c, s)

Safe wrapper: Context.get_string (auto)

Z3_get_string_contents

def Z3_get_string_contents(self, c: Z3_context, s: Z3_ast, length: UInt32, contents: Pointer[mut=True, UInt32, _]) raises

Retrieve the unescaped string constant stored in s.

Preconditions:

  • Z3_is_string(c, s)
  • length contains the number of characters in s

Safe wrapper: Context.get_string_contents (manual)

Z3_get_string_length

def Z3_get_string_length(self, c: Z3_context, s: Z3_ast) raises -> UInt32

Retrieve the length of the unescaped string constant stored in s.

Precondition: Z3_is_string(c, s)

Safe wrapper: Context.get_string_length (auto)

Z3_is_char_sort

def Z3_is_char_sort(self, c: Z3_context, s: Z3_sort) raises -> Bool

Check if s is a character sort.

Safe wrapper: Context.is_char_sort (auto)

Z3_is_re_sort

def Z3_is_re_sort(self, c: Z3_context, s: Z3_sort) raises -> Bool

Check if s is a regular expression sort.

Safe wrapper: Context.is_re_sort (auto)

Z3_is_seq_sort

def Z3_is_seq_sort(self, c: Z3_context, s: Z3_sort) raises -> Bool

Check if s is a sequence sort.

Safe wrapper: Context.is_seq_sort (auto)

Z3_is_string

def Z3_is_string(self, c: Z3_context, s: Z3_ast) raises -> Bool

Determine if s is a string constant.

Safe wrapper: Context.is_string (auto)

Z3_is_string_sort

def Z3_is_string_sort(self, c: Z3_context, s: Z3_sort) raises -> Bool

Check if s is a string sort.

Safe wrapper: Context.is_string_sort (auto)

Z3_mk_char

def Z3_mk_char(self, c: Z3_context, ch: UInt32) raises -> Z3_ast

Create a character literal

Safe wrapper: Context.mk_char (auto)

Z3_mk_char_from_bv

def Z3_mk_char_from_bv(self, c: Z3_context, bv: Z3_ast) raises -> Z3_ast

Create a character from a bit-vector (code point).

Safe wrapper: Context.mk_char_from_bv (auto)

Z3_mk_char_is_digit

def Z3_mk_char_is_digit(self, c: Z3_context, ch: Z3_ast) raises -> Z3_ast

Create a check if the character is a digit.

Safe wrapper: Context.mk_char_is_digit (auto)

Z3_mk_char_le

def Z3_mk_char_le(self, c: Z3_context, ch1: Z3_ast, ch2: Z3_ast) raises -> Z3_ast

Create less than or equal to between two characters.

Safe wrapper: Context.mk_char_le (auto)

Z3_mk_char_sort

def Z3_mk_char_sort(self, c: Z3_context) raises -> Z3_sort

Create a sort for unicode characters.

The sort for characters can be changed to ASCII by setting the global parameter encoding to ascii, or alternative to 16 bit characters by setting encoding to bmp.

Safe wrapper: Context.mk_char_sort (auto)

Z3_mk_char_to_bv

def Z3_mk_char_to_bv(self, c: Z3_context, ch: Z3_ast) raises -> Z3_ast

Create a bit-vector (code point) from character.

Safe wrapper: Context.mk_char_to_bv (auto)

Z3_mk_char_to_int

def Z3_mk_char_to_int(self, c: Z3_context, ch: Z3_ast) raises -> Z3_ast

Create an integer (code point) from character.

Safe wrapper: Context.mk_char_to_int (auto)

Z3_mk_int_to_str

def Z3_mk_int_to_str(self, c: Z3_context, s: Z3_ast) raises -> Z3_ast

Integer to string conversion.

Safe wrapper: Context.mk_int_to_str (auto)

Z3_mk_lstring

def Z3_mk_lstring(self, c: Z3_context, len: UInt32, s: Pointer[Int8, _]) raises -> Z3_ast

Create a string constant out of the string that is passed in It takes the length of the string as well to take into account 0 characters. The string is treated as if it is unescaped so a sequence of characters \u{0} is treated as 5 characters and not the character 0.

Safe wrapper: Context.mk_lstring (auto)

Z3_mk_re_allchar

def Z3_mk_re_allchar(self, c: Z3_context, regex_sort: Z3_sort) raises -> Z3_ast

Create a regular expression that accepts all singleton sequences of the regular expression sort

Safe wrapper: Context.mk_re_allchar (auto)

Z3_mk_re_complement

def Z3_mk_re_complement(self, c: Z3_context, re: Z3_ast) raises -> Z3_ast

Create the complement of the regular language re.

Safe wrapper: Context.mk_re_complement (auto)

Z3_mk_re_concat

def Z3_mk_re_concat(self, c: Z3_context, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create the concatenation of the regular languages.

Precondition: n > 0

Safe wrapper: Context.mk_re_concat (auto)

Z3_mk_re_diff

def Z3_mk_re_diff(self, c: Z3_context, re1: Z3_ast, re2: Z3_ast) raises -> Z3_ast

Create the difference of regular expressions.

Safe wrapper: Context.mk_re_diff (auto)

Z3_mk_re_empty

def Z3_mk_re_empty(self, c: Z3_context, re: Z3_sort) raises -> Z3_ast

Create an empty regular expression of sort re.

Precondition: re is a regular expression sort.

Safe wrapper: Context.mk_re_empty (auto)

Z3_mk_re_full

def Z3_mk_re_full(self, c: Z3_context, re: Z3_sort) raises -> Z3_ast

Create an universal regular expression of sort re.

Precondition: re is a regular expression sort.

Safe wrapper: Context.mk_re_full (auto)

Z3_mk_re_intersect

def Z3_mk_re_intersect(self, c: Z3_context, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create the intersection of the regular languages.

Precondition: n > 0

Safe wrapper: Context.mk_re_intersect (auto)

Z3_mk_re_loop

def Z3_mk_re_loop(self, c: Z3_context, r: Z3_ast, lo: UInt32, hi: UInt32) raises -> Z3_ast

Create a regular expression loop. The supplied regular expression r is repeated between lo and hi times. The lo should be below hi with one exception: when supplying the value hi as 0, the meaning is to repeat the argument r at least lo number of times, and with an unbounded upper bound.

Safe wrapper: Context.mk_re_loop (auto)

Z3_mk_re_option

def Z3_mk_re_option(self, c: Z3_context, re: Z3_ast) raises -> Z3_ast

Create the regular language [re].

Safe wrapper: Context.mk_re_option (auto)

Z3_mk_re_plus

def Z3_mk_re_plus(self, c: Z3_context, re: Z3_ast) raises -> Z3_ast

Create the regular language re+.

Safe wrapper: Context.mk_re_plus (auto)

Z3_mk_re_power

def Z3_mk_re_power(self, c: Z3_context, re: Z3_ast, n: UInt32) raises -> Z3_ast

Create a power regular expression.

Safe wrapper: Context.mk_re_power (auto)

Z3_mk_re_range

def Z3_mk_re_range(self, c: Z3_context, lo: Z3_ast, hi: Z3_ast) raises -> Z3_ast

Create the range regular expression over two sequences of length 1.

Safe wrapper: Context.mk_re_range (auto)

Z3_mk_re_sort

def Z3_mk_re_sort(self, c: Z3_context, seq: Z3_sort) raises -> Z3_sort

Create a regular expression sort out of a sequence sort.

Safe wrapper: Context.mk_re_sort (auto)

Z3_mk_re_star

def Z3_mk_re_star(self, c: Z3_context, re: Z3_ast) raises -> Z3_ast

Create the regular language re*.

Safe wrapper: Context.mk_re_star (auto)

Z3_mk_re_union

def Z3_mk_re_union(self, c: Z3_context, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Create the union of the regular languages.

Precondition: n > 0

Safe wrapper: Context.mk_re_union (auto)

Z3_mk_sbv_to_str

def Z3_mk_sbv_to_str(self, c: Z3_context, s: Z3_ast) raises -> Z3_ast

Signed bit-vector to string conversion.

Safe wrapper: Context.mk_sbv_to_str (auto)

Z3_mk_seq_at

def Z3_mk_seq_at(self, c: Z3_context, s: Z3_ast, index: Z3_ast) raises -> Z3_ast

Retrieve from s the unit sequence positioned at position index. The sequence is empty if the index is out of bounds.

Safe wrapper: Context.mk_seq_at (auto)

Z3_mk_seq_concat

def Z3_mk_seq_concat(self, c: Z3_context, n: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Concatenate sequences.

Precondition: n > 0

Safe wrapper: Context.mk_seq_concat (auto)

Z3_mk_seq_contains

def Z3_mk_seq_contains(self, c: Z3_context, container: Z3_ast, containee: Z3_ast) raises -> Z3_ast

Check if container contains containee.

Precondition: container and containee are the same sequence sorts.

Safe wrapper: Context.mk_seq_contains (auto)

Z3_mk_seq_empty

def Z3_mk_seq_empty(self, c: Z3_context, seq: Z3_sort) raises -> Z3_ast

Create an empty sequence of the sequence sort seq.

Precondition: s is a sequence sort.

Safe wrapper: Context.mk_seq_empty (auto)

Z3_mk_seq_extract

def Z3_mk_seq_extract(self, c: Z3_context, s: Z3_ast, offset: Z3_ast, length: Z3_ast) raises -> Z3_ast

Extract subsequence starting at offset of length.

Safe wrapper: Context.mk_seq_extract (auto)

Z3_mk_seq_foldl

def Z3_mk_seq_foldl(self, c: Z3_context, f: Z3_ast, a: Z3_ast, s: Z3_ast) raises -> Z3_ast

Create a fold of the function f over the sequence s with accumulator a.

Safe wrapper: Context.mk_seq_foldl (auto)

Z3_mk_seq_foldli

def Z3_mk_seq_foldli(self, c: Z3_context, f: Z3_ast, i: Z3_ast, a: Z3_ast, s: Z3_ast) raises -> Z3_ast

Create a fold with index tracking of the function f over the sequence s with accumulator a starting at index i.

Safe wrapper: Context.mk_seq_foldli (auto)

Z3_mk_seq_in_re

def Z3_mk_seq_in_re(self, c: Z3_context, seq: Z3_ast, re: Z3_ast) raises -> Z3_ast

Check if seq is in the language generated by the regular expression re.

Safe wrapper: Context.mk_seq_in_re (auto)

Z3_mk_seq_index

def Z3_mk_seq_index(self, c: Z3_context, s: Z3_ast, substr: Z3_ast, offset: Z3_ast) raises -> Z3_ast

Return index of the first occurrence of substr in s starting from offset offset. If s does not contain substr, then the value is -1, if offset is the length of s, then the value is -1 as well. The value is -1 if offset is negative or larger than the length of s.

Safe wrapper: Context.mk_seq_index (auto)

Z3_mk_seq_last_index

def Z3_mk_seq_last_index(self, c: Z3_context, s: Z3_ast, substr: Z3_ast) raises -> Z3_ast

Return index of the last occurrence of substr in s. If s does not contain substr, then the value is -1,

Safe wrapper: Context.mk_seq_last_index (auto)

Z3_mk_seq_length

def Z3_mk_seq_length(self, c: Z3_context, s: Z3_ast) raises -> Z3_ast

Return the length of the sequence s.

Safe wrapper: Context.mk_seq_length (auto)

Z3_mk_seq_map

def Z3_mk_seq_map(self, c: Z3_context, f: Z3_ast, s: Z3_ast) raises -> Z3_ast

Create a map of the function f over the sequence s.

Safe wrapper: Context.mk_seq_map (auto)

Z3_mk_seq_mapi

def Z3_mk_seq_mapi(self, c: Z3_context, f: Z3_ast, i: Z3_ast, s: Z3_ast) raises -> Z3_ast

Create a map of the function f over the sequence s starting at index i.

Safe wrapper: Context.mk_seq_mapi (auto)

Z3_mk_seq_nth

def Z3_mk_seq_nth(self, c: Z3_context, s: Z3_ast, index: Z3_ast) raises -> Z3_ast

Retrieve from s the element positioned at position index. The function is under-specified if the index is out of bounds.

Safe wrapper: Context.mk_seq_nth (auto)

Z3_mk_seq_power

def Z3_mk_seq_power(self, c: Z3_context, s: Z3_ast, n: Z3_ast) raises -> Z3_ast

Create the sequence s concatenated n times with itself. The result is the empty sequence when n is not positive.

Safe wrapper: Context.mk_seq_power (auto)

Z3_mk_seq_prefix

def Z3_mk_seq_prefix(self, c: Z3_context, prefix: Z3_ast, s: Z3_ast) raises -> Z3_ast

Check if prefix is a prefix of s.

Precondition: prefix and s are the same sequence sorts.

Safe wrapper: Context.mk_seq_prefix (auto)

Z3_mk_seq_replace

def Z3_mk_seq_replace(self, c: Z3_context, s: Z3_ast, src: Z3_ast, dst: Z3_ast) raises -> Z3_ast

Replace the first occurrence of src with dst in s.

Safe wrapper: Context.mk_seq_replace (auto)

Z3_mk_seq_replace_all

def Z3_mk_seq_replace_all(self, c: Z3_context, s: Z3_ast, src: Z3_ast, dst: Z3_ast) raises -> Z3_ast

Replace all occurrences of src with dst in s.

Safe wrapper: Context.mk_seq_replace_all (auto)

Z3_mk_seq_replace_re

def Z3_mk_seq_replace_re(self, c: Z3_context, s: Z3_ast, re: Z3_ast, dst: Z3_ast) raises -> Z3_ast

Replace the first occurrence of regular expression re with dst in s.

Safe wrapper: Context.mk_seq_replace_re (auto)

Z3_mk_seq_replace_re_all

def Z3_mk_seq_replace_re_all(self, c: Z3_context, s: Z3_ast, re: Z3_ast, dst: Z3_ast) raises -> Z3_ast

Replace all occurrences of regular expression re with dst in s.

Safe wrapper: Context.mk_seq_replace_re_all (auto)

Z3_mk_seq_sort

def Z3_mk_seq_sort(self, c: Z3_context, s: Z3_sort) raises -> Z3_sort

Create a sequence sort out of the sort for the elements.

Safe wrapper: Context.mk_seq_sort (auto)

Z3_mk_seq_suffix

def Z3_mk_seq_suffix(self, c: Z3_context, suffix: Z3_ast, s: Z3_ast) raises -> Z3_ast

Check if suffix is a suffix of s.

Precondition: suffix and s are the same sequence sorts.

Safe wrapper: Context.mk_seq_suffix (auto)

Z3_mk_seq_to_re

def Z3_mk_seq_to_re(self, c: Z3_context, seq: Z3_ast) raises -> Z3_ast

Create a regular expression that accepts the sequence seq.

Safe wrapper: Context.mk_seq_to_re (auto)

Z3_mk_seq_unit

def Z3_mk_seq_unit(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Create a unit sequence of a.

Safe wrapper: Context.mk_seq_unit (auto)

Z3_mk_str_le

def Z3_mk_str_le(self, c: Z3_context, prefix: Z3_ast, s: Z3_ast) raises -> Z3_ast

Check if s1 is equal or lexicographically strictly less than s2.

Precondition: s1 and s2 are strings

Safe wrapper: Context.mk_str_le (auto)

Z3_mk_str_lt

def Z3_mk_str_lt(self, c: Z3_context, prefix: Z3_ast, s: Z3_ast) raises -> Z3_ast

Check if s1 is lexicographically strictly less than s2.

Precondition: s1 and s2 are strings

Safe wrapper: Context.mk_str_lt (auto)

Z3_mk_str_to_int

def Z3_mk_str_to_int(self, c: Z3_context, s: Z3_ast) raises -> Z3_ast

Convert string to integer.

Safe wrapper: Context.mk_str_to_int (auto)

Z3_mk_string

def Z3_mk_string(self, c: Z3_context, s: Pointer[Int8, _]) raises -> Z3_ast

Create a string constant out of the string that is passed in The string may contain escape encoding for non-printable characters or characters outside of the basic printable ASCII range. For example, the escape encoding \u{0} represents the character 0 and the encoding \u{100} represents the character 256.

Safe wrapper: Context.mk_string (auto)

Z3_mk_string_from_code

def Z3_mk_string_from_code(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Code to string conversion.

Safe wrapper: Context.mk_string_from_code (auto)

Z3_mk_string_sort

def Z3_mk_string_sort(self, c: Z3_context) raises -> Z3_sort

Create a sort for unicode strings.

The sort for characters can be changed to ASCII by setting the global parameter encoding to ascii, or alternative to 16 bit characters by setting encoding to bmp.

Safe wrapper: Context.string_sort (manual)

Z3_mk_string_to_code

def Z3_mk_string_to_code(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

String to code conversion.

Safe wrapper: Context.mk_string_to_code (auto)

Z3_mk_u32string

def Z3_mk_u32string(self, c: Z3_context, len: UInt32, chars: Pointer[UInt32, _]) raises -> Z3_ast

Create a string constant out of the string that is passed in It takes the length of the string as well to take into account 0 characters. The string is unescaped.

Safe wrapper: Context.mk_u32string (auto)

Z3_mk_ubv_to_str

def Z3_mk_ubv_to_str(self, c: Z3_context, s: Z3_ast) raises -> Z3_ast

Unsigned bit-vector to string conversion.

Safe wrapper: Context.mk_ubv_to_str (auto)

Special relations (5)

Z3_mk_linear_order

def Z3_mk_linear_order(self, c: Z3_context, a: Z3_sort, id: UInt32) raises -> Z3_func_decl

create a linear ordering relation over signature a. The relation is identified by the index id.

Safe wrapper: Context.mk_linear_order (auto)

Z3_mk_partial_order

def Z3_mk_partial_order(self, c: Z3_context, a: Z3_sort, id: UInt32) raises -> Z3_func_decl

create a partial ordering relation over signature a and index id.

Safe wrapper: Context.mk_partial_order (auto)

Z3_mk_piecewise_linear_order

def Z3_mk_piecewise_linear_order(self, c: Z3_context, a: Z3_sort, id: UInt32) raises -> Z3_func_decl

create a piecewise linear ordering relation over signature a and index id.

Safe wrapper: Context.mk_piecewise_linear_order (auto)

Z3_mk_transitive_closure

def Z3_mk_transitive_closure(self, c: Z3_context, f: Z3_func_decl) raises -> Z3_func_decl

create transitive closure of binary relation.

The resulting relation f+ represents the transitive closure of f.

Precondition: f is a binary relation, such that the two arguments have the same sorts.

Safe wrapper: Context.mk_transitive_closure (auto)

Z3_mk_tree_order

def Z3_mk_tree_order(self, c: Z3_context, a: Z3_sort, id: UInt32) raises -> Z3_func_decl

create a tree ordering relation over signature a identified using index id.

Safe wrapper: Context.mk_tree_order (auto)

Quantifiers (12)

Z3_mk_bound

def Z3_mk_bound(self, c: Z3_context, index: UInt32, ty: Z3_sort) raises -> Z3_ast

Create a variable.

Variables are intended to be bound by a scope created by a quantifier. So we call them bound variables even if they appear as free variables in the expression produced by Z3_mk_bound.

Bound variables are indexed by de-Bruijn indices. It is perhaps easiest to explain the meaning of de-Bruijn indices by indicating the compilation process from non-de-Bruijn formulas to de-Bruijn format.

abs(forall (x1) phi) = forall (x1) abs1(phi, x1, 0)
abs(forall (x1, x2) phi) = abs(forall (x1) abs(forall (x2) phi))
abs1(x, x, n) = b_n
abs1(y, x, n) = y
abs1(f(t1,...,tn), x, n) = f(abs1(t1,x,n), ..., abs1(tn,x,n))
abs1(forall (x1) phi, x, n) = forall (x1) (abs1(phi, x, n+1))

The last line is significant: the index of a bound variable is different depending on the scope in which it appears. The deeper x appears, the higher is its index.

Parameters:

  • c — logical context
  • index — de-Bruijn index
  • ty — sort of the bound variable

See also: Z3_mk_forall, Z3_mk_exists

Safe wrapper: Context.mk_bound (auto)

Z3_mk_exists

def Z3_mk_exists(self, c: Z3_context, weight: UInt32, num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], num_decls: UInt32, sorts: Pointer[Z3_sort, _], decl_names: Pointer[Z3_symbol, _], body: Z3_ast) raises -> Z3_ast

Create an exists formula. Similar to Z3_mk_forall.

Z3_mk_exists_const

def Z3_mk_exists_const(self, c: Z3_context, weight: UInt32, num_bound: UInt32, bound: Pointer[Z3_app, _], num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], body: Z3_ast) raises -> Z3_ast

Similar to Z3_mk_forall_const.

Create an existential quantifier using a list of constants that will form the set of bound variables.

Parameters:

  • c — logical context.
  • weight — quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. By default, pass the weight 0.
  • num_bound — number of constants to be abstracted into bound variables.
  • bound — array of constants to be abstracted into bound variables.
  • num_patterns — number of patterns.
  • patterns — array containing the patterns created using Z3_mk_pattern.
  • body — the body of the quantifier.

See also: Z3_mk_pattern, Z3_mk_forall_const

Safe wrapper: Context.mk_exists (manual)

Z3_mk_forall

def Z3_mk_forall(self, c: Z3_context, weight: UInt32, num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], num_decls: UInt32, sorts: Pointer[Z3_sort, _], decl_names: Pointer[Z3_symbol, _], body: Z3_ast) raises -> Z3_ast

Create a forall formula. It takes an expression body that contains bound variables of the same sorts as the sorts listed in the array sorts. The bound variables are de-Bruijn indices created using Z3_mk_bound. The array decl_names contains the names that the quantified formula uses for the bound variables. Z3 applies the convention that the last element in the decl_names and sorts array refers to the variable with index 0, the second to last element of decl_names and sorts refers to the variable with index 1, etc.

Parameters:

  • c — logical context.
  • weight — quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. By default, pass the weight 0.
  • num_patterns — number of patterns.
  • patterns — array containing the patterns created using Z3_mk_pattern.
  • num_decls — number of variables to be bound.
  • sorts — the sorts of the bound variables.
  • decl_names — names of the bound variables
  • body — the body of the quantifier.

See also: Z3_mk_pattern, Z3_mk_bound, Z3_mk_exists

Safe wrapper: Context.Z3_mk_forall (auto)

Z3_mk_forall_const

def Z3_mk_forall_const(self, c: Z3_context, weight: UInt32, num_bound: UInt32, bound: Pointer[Z3_app, _], num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], body: Z3_ast) raises -> Z3_ast

Create a universal quantifier using a list of constants that will form the set of bound variables.

Parameters:

  • c — logical context.
  • weight — quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. By default, pass the weight 0.
  • num_bound — number of constants to be abstracted into bound variables.
  • bound — array of constants to be abstracted into bound variables.
  • num_patterns — number of patterns.
  • patterns — array containing the patterns created using Z3_mk_pattern.
  • body — the body of the quantifier.

See also: Z3_mk_pattern, Z3_mk_exists_const

Safe wrapper: Context.mk_forall (manual)

Z3_mk_lambda

def Z3_mk_lambda(self, c: Z3_context, num_decls: UInt32, sorts: Pointer[Z3_sort, _], decl_names: Pointer[Z3_symbol, _], body: Z3_ast) raises -> Z3_ast

Create a lambda expression. It takes an expression body that contains bound variables of the same sorts as the sorts listed in the array sorts. The bound variables are de-Bruijn indices created using Z3_mk_bound. The array decl_names contains the names that the quantified formula uses for the bound variables. Z3 applies the convention that the last element in the decl_names and sorts array refers to the variable with index 0, the second to last element of decl_names and sorts refers to the variable with index 1, etc. The sort of the resulting expression is (Array sorts range) where range is the sort of body. For example, if the lambda binds two variables of sort Int and Bool, and the body has sort Real, the sort of the expression is (Array Int Bool Real).

Parameters:

  • c — logical context
  • num_decls — number of variables to be bound.
  • sorts — the sorts of the bound variables.
  • decl_names — names of the bound variables
  • body — the body of the lambda expression.

See also: Z3_mk_bound, Z3_mk_forall, Z3_mk_lambda_const

Safe wrapper: Context.mk_lambda (auto)

Z3_mk_lambda_const

def Z3_mk_lambda_const(self, c: Z3_context, num_bound: UInt32, bound: Pointer[Z3_app, _], body: Z3_ast) raises -> Z3_ast

Create a lambda expression using a list of constants that form the set of bound variables

Parameters:

  • c — logical context.
  • num_bound — number of constants to be abstracted into bound variables.
  • bound — array of constants to be abstracted into bound variables.
  • body — the body of the lambda expression.

See also: Z3_mk_bound, Z3_mk_forall, Z3_mk_lambda

Safe wrapper: Context.mk_lambda_const (auto)

Z3_mk_pattern

def Z3_mk_pattern(self, c: Z3_context, num_patterns: UInt32, terms: Pointer[Z3_ast, _]) raises -> Z3_pattern

Create a pattern for quantifier instantiation.

Z3 uses pattern matching to instantiate quantifiers. If a pattern is not provided for a quantifier, then Z3 will automatically compute a set of patterns for it. However, for optimal performance, the user should provide the patterns.

Patterns comprise a list of terms. The list should be non-empty. If the list comprises of more than one term, it is a called a multi-pattern.

In general, one can pass in a list of (multi-)patterns in the quantifier constructor.

See also: Z3_mk_forall, Z3_mk_exists

Safe wrapper: Context.mk_pattern (auto)

Z3_mk_quantifier

def Z3_mk_quantifier(self, c: Z3_context, is_forall: Bool, weight: UInt32, num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], num_decls: UInt32, sorts: Pointer[Z3_sort, _], decl_names: Pointer[Z3_symbol, _], body: Z3_ast) raises -> Z3_ast

Create a quantifier - universal or existential, with pattern hints. See the documentation for Z3_mk_forall for an explanation of the parameters.

Parameters:

  • c — logical context.
  • is_forall — flag to indicate if this is a universal or existential quantifier.
  • weight — quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. By default, pass the weight 0.
  • num_patterns — number of patterns.
  • patterns — array containing the patterns created using Z3_mk_pattern.
  • num_decls — number of variables to be bound.
  • sorts — array of sorts of the bound variables.
  • decl_names — names of the bound variables.
  • body — the body of the quantifier.

See also: Z3_mk_pattern, Z3_mk_bound, Z3_mk_forall, Z3_mk_exists

Safe wrapper: Context.mk_quantifier (auto)

Z3_mk_quantifier_const

def Z3_mk_quantifier_const(self, c: Z3_context, is_forall: Bool, weight: UInt32, num_bound: UInt32, bound: Pointer[Z3_app, _], num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], body: Z3_ast) raises -> Z3_ast

Create a universal or existential quantifier using a list of constants that will form the set of bound variables.

Safe wrapper: Context.mk_quantifier_const (auto)

Z3_mk_quantifier_const_ex

def Z3_mk_quantifier_const_ex(self, c: Z3_context, is_forall: Bool, weight: UInt32, quantifier_id: Z3_symbol, skolem_id: Z3_symbol, num_bound: UInt32, bound: Pointer[Z3_app, _], num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], num_no_patterns: UInt32, no_patterns: Pointer[Z3_ast, _], body: Z3_ast) raises -> Z3_ast

Create a universal or existential quantifier using a list of constants that will form the set of bound variables.

Safe wrapper: Context.mk_quantifier_const_ex (auto)

Z3_mk_quantifier_ex

def Z3_mk_quantifier_ex(self, c: Z3_context, is_forall: Bool, weight: UInt32, quantifier_id: Z3_symbol, skolem_id: Z3_symbol, num_patterns: UInt32, patterns: Pointer[Z3_pattern, _], num_no_patterns: UInt32, no_patterns: Pointer[Z3_ast, _], num_decls: UInt32, sorts: Pointer[Z3_sort, _], decl_names: Pointer[Z3_symbol, _], body: Z3_ast) raises -> Z3_ast

Create a quantifier - universal or existential, with pattern hints, no patterns, and attributes

Parameters:

  • c — logical context.
  • is_forall — flag to indicate if this is a universal or existential quantifier.
  • quantifier_id — identifier to identify quantifier
  • skolem_id — identifier to identify skolem constants introduced by quantifier.
  • weight — quantifiers are associated with weights indicating the importance of using the quantifier during instantiation. By default, pass the weight 0.
  • num_patterns — number of patterns.
  • patterns — array containing the patterns created using Z3_mk_pattern.
  • num_no_patterns — number of no_patterns.
  • no_patterns — array containing subexpressions to be excluded from inferred patterns.
  • num_decls — number of variables to be bound.
  • sorts — array of sorts of the bound variables.
  • decl_names — names of the bound variables.
  • body — the body of the quantifier.

See also: Z3_mk_pattern, Z3_mk_bound, Z3_mk_forall, Z3_mk_exists

Safe wrapper: Context.mk_quantifier_ex (auto)

Accessors (102)

Z3_app_to_ast

def Z3_app_to_ast(self, c: Z3_context, a: Z3_app) raises -> Z3_ast

Convert a Z3_app into Z3_ast. This is just type casting.

Safe wrapper: Context.app_to_ast (auto)

Z3_datatype_update_field

def Z3_datatype_update_field(self, c: Z3_context, field_access: Z3_func_decl, t: Z3_ast, value: Z3_ast) raises -> Z3_ast

Update record field with a value.

This corresponds to the 'with' construct in OCaml. It has the effect of updating a record field with a given value. The remaining fields are left unchanged. It is the record equivalent of an array store (see Z3_mk_store). If the datatype has more than one constructor, then the update function behaves as identity if there is a mismatch between the accessor and constructor. For example ((_ update-field car) nil 1) is nil, while ((_ update-field car) (cons 2 nil) 1) is (cons 1 nil).

Preconditions:

  • Z3_get_sort_kind(Z3_get_sort(c, t)) == Z3_get_domain(c, field_access, 1) == Z3_DATATYPE_SORT
  • Z3_get_sort(c, value) == Z3_get_range(c, field_access)

See also: Z3_mk_store

Safe wrapper: Context.datatype_update_field (auto)

Z3_func_decl_to_ast

def Z3_func_decl_to_ast(self, c: Z3_context, f: Z3_func_decl) raises -> Z3_ast

Convert a Z3_func_decl into Z3_ast. This is just type casting.

Safe wrapper: Context.func_decl_to_ast (auto)

Z3_get_algebraic_number_lower

def Z3_get_algebraic_number_lower(self, c: Z3_context, a: Z3_ast, precision: UInt32) raises -> Z3_ast

Return a lower bound for the given real algebraic number. The interval isolating the number is smaller than 1/10^precision. The result is a numeral AST of sort Real.

Precondition: Z3_is_algebraic_number(c, a)

Safe wrapper: Context.get_algebraic_number_lower (auto)

Z3_get_algebraic_number_upper

def Z3_get_algebraic_number_upper(self, c: Z3_context, a: Z3_ast, precision: UInt32) raises -> Z3_ast

Return a upper bound for the given real algebraic number. The interval isolating the number is smaller than 1/10^precision. The result is a numeral AST of sort Real.

Precondition: Z3_is_algebraic_number(c, a)

Safe wrapper: Context.get_algebraic_number_upper (auto)

Z3_get_app_arg

def Z3_get_app_arg(self, c: Z3_context, a: Z3_app, i: UInt32) raises -> Z3_ast

Return the i-th argument of the given application.

Precondition: i < Z3_get_app_num_args(c, a)

See also: Z3_get_app_num_args

Safe wrapper: Context.get_app_arg (auto)

Z3_get_app_decl

def Z3_get_app_decl(self, c: Z3_context, a: Z3_app) raises -> Z3_func_decl

Return the declaration of a constant or function application.

Safe wrapper: Context.get_app_decl (auto)

Z3_get_app_num_args

def Z3_get_app_num_args(self, c: Z3_context, a: Z3_app) raises -> UInt32

Return the number of argument of an application. If t is an constant, then the number of arguments is 0.

See also: Z3_get_app_arg

Safe wrapper: Context.get_app_num_args (auto)

Z3_get_arity

def Z3_get_arity(self, c: Z3_context, d: Z3_func_decl) raises -> UInt32

Alias for Z3_get_domain_size.

See also: Z3_get_domain_size

Safe wrapper: Context.get_arity (auto)

Z3_get_array_arity

def Z3_get_array_arity(self, c: Z3_context, s: Z3_sort) raises -> UInt32

Return the arity (number of dimensions) of the given array sort.

Precondition: Z3_get_sort_kind(s) == Z3_ARRAY_SORT

See also: Z3_get_array_sort_domain_n

Safe wrapper: Context.get_array_arity (auto)

Z3_get_array_sort_domain

def Z3_get_array_sort_domain(self, c: Z3_context, t: Z3_sort) raises -> Z3_sort

Return the domain of the given array sort. In the case of a multi-dimensional array, this function returns the sort of the first dimension.

Precondition: Z3_get_sort_kind(c, t) == Z3_ARRAY_SORT

See also: Z3_mk_array_sort, Z3_get_sort_kind, Z3_get_array_sort_domain_n

Safe wrapper: Context.get_array_sort_domain (auto)

Z3_get_array_sort_domain_n

def Z3_get_array_sort_domain_n(self, c: Z3_context, t: Z3_sort, idx: UInt32) raises -> Z3_sort

Return the i'th domain sort of an n-dimensional array.

Precondition: Z3_get_sort_kind(c, t) == Z3_ARRAY_SORT

See also: Z3_mk_array_sort, Z3_get_sort_kind, Z3_get_array_sort_domain

Safe wrapper: Context.get_array_sort_domain_n (auto)

Z3_get_array_sort_range

def Z3_get_array_sort_range(self, c: Z3_context, t: Z3_sort) raises -> Z3_sort

Return the range of the given array sort.

Precondition: Z3_get_sort_kind(c, t) == Z3_ARRAY_SORT

See also: Z3_mk_array_sort, Z3_get_sort_kind

Safe wrapper: Context.get_array_sort_range (auto)

Z3_get_ast_hash

def Z3_get_ast_hash(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Return a hash code for the given AST. The hash code is structural but two different AST objects can map to the same hash. The result of Z3_get_ast_id returns an identifier that is unique over the set of live AST objects.

Safe wrapper: Context.get_ast_hash (auto)

Z3_get_ast_id

def Z3_get_ast_id(self, c: Z3_context, t: Z3_ast) raises -> UInt32

Return a unique identifier for t. The identifier is unique up to structural equality. Thus, two ast nodes created by the same context and having the same children and same function symbols have the same identifiers. Ast nodes created in the same context, but having different children or different functions have different identifiers. Variables and quantifiers are also assigned different identifiers according to their structure.

Safe wrapper: Context.get_ast_id (auto)

Z3_get_ast_kind

def Z3_get_ast_kind(self, c: Z3_context, a: Z3_ast) raises -> AstKind

Return the kind of the given AST.

Safe wrapper: Context.get_ast_kind (auto)

Z3_get_bool_value

def Z3_get_bool_value(self, c: Z3_context, a: Z3_ast) raises -> Lbool

Return Z3_L_TRUE if a is true, Z3_L_FALSE if it is false, and Z3_L_UNDEF otherwise.

Safe wrapper: Context.get_bool_value (auto)

Z3_get_bv_sort_size

def Z3_get_bv_sort_size(self, c: Z3_context, t: Z3_sort) raises -> UInt32

Return the size of the given bit-vector sort.

Precondition: Z3_get_sort_kind(c, t) == Z3_BV_SORT

See also: Z3_mk_bv_sort, Z3_get_sort_kind

Safe wrapper: Context.get_bv_sort_size (auto)

Z3_get_datatype_sort_constructor

def Z3_get_datatype_sort_constructor(self, c: Z3_context, t: Z3_sort, idx: UInt32) raises -> Z3_func_decl

Return idx'th constructor.

Preconditions:

  • Z3_get_sort_kind(t) == Z3_DATATYPE_SORT
  • idx < Z3_get_datatype_sort_num_constructors(c, t)

See also: Z3_get_datatype_sort_num_constructors, Z3_get_datatype_sort_recognizer, Z3_get_datatype_sort_constructor_accessor

Safe wrapper: Context.get_datatype_sort_constructor (auto)

Z3_get_datatype_sort_constructor_accessor

def Z3_get_datatype_sort_constructor_accessor(self, c: Z3_context, t: Z3_sort, idx_c: UInt32, idx_a: UInt32) raises -> Z3_func_decl

Return idx_a'th accessor for the idx_c'th constructor.

Preconditions:

  • Z3_get_sort_kind(t) == Z3_DATATYPE_SORT
  • idx_c < Z3_get_datatype_sort_num_constructors(c, t)
  • idx_a < Z3_get_domain_size(c, Z3_get_datatype_sort_constructor(c, idx_c))

See also: Z3_get_datatype_sort_num_constructors, Z3_get_datatype_sort_constructor, Z3_get_datatype_sort_recognizer

Safe wrapper: Context.get_datatype_sort_constructor_accessor (auto)

Z3_get_datatype_sort_num_constructors

def Z3_get_datatype_sort_num_constructors(self, c: Z3_context, t: Z3_sort) raises -> UInt32

Return number of constructors for datatype.

Z3_get_datatype_sort_recognizer

def Z3_get_datatype_sort_recognizer(self, c: Z3_context, t: Z3_sort, idx: UInt32) raises -> Z3_func_decl

Return idx'th recognizer.

Preconditions:

  • Z3_get_sort_kind(t) == Z3_DATATYPE_SORT
  • idx < Z3_get_datatype_sort_num_constructors(c, t)

See also: Z3_get_datatype_sort_num_constructors, Z3_get_datatype_sort_constructor, Z3_get_datatype_sort_constructor_accessor

Safe wrapper: Context.get_datatype_sort_recognizer (auto)

Z3_get_decl_ast_parameter

def Z3_get_decl_ast_parameter(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> Z3_ast

Return the expression value associated with an expression parameter.

Precondition: Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_AST

Safe wrapper: Context.get_decl_ast_parameter (auto)

Z3_get_decl_double_parameter

def Z3_get_decl_double_parameter(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> Float64

Return the double value associated with an double parameter.

Precondition: Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_DOUBLE

Safe wrapper: Context.get_decl_double_parameter (auto)

Z3_get_decl_func_decl_parameter

def Z3_get_decl_func_decl_parameter(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> Z3_func_decl

Return the expression value associated with an expression parameter.

Precondition: Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_FUNC_DECL

Safe wrapper: Context.get_decl_func_decl_parameter (auto)

Z3_get_decl_int_parameter

def Z3_get_decl_int_parameter(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> Int32

Return the integer value associated with an integer parameter.

Precondition: Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_INT

Safe wrapper: Context.get_decl_int_parameter (auto)

Z3_get_decl_kind

def Z3_get_decl_kind(self, c: Z3_context, d: Z3_func_decl) raises -> DeclKind

Return declaration kind corresponding to declaration.

Safe wrapper: Context.get_decl_kind (auto)

Z3_get_decl_name

def Z3_get_decl_name(self, c: Z3_context, d: Z3_func_decl) raises -> Z3_symbol

Return the constant declaration name as a symbol.

Safe wrapper: Context.get_decl_name (auto)

Z3_get_decl_num_parameters

def Z3_get_decl_num_parameters(self, c: Z3_context, d: Z3_func_decl) raises -> UInt32

Return the number of parameters associated with a declaration.

Safe wrapper: Context.get_decl_num_parameters (auto)

Z3_get_decl_parameter_kind

def Z3_get_decl_parameter_kind(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> ParameterKind

Return the parameter type associated with a declaration.

Parameters:

  • c — the context
  • d — the function declaration
  • idx — is the index of the named parameter it should be between 0 and the number of parameters.

Safe wrapper: Context.get_decl_parameter_kind (auto)

Z3_get_decl_rational_parameter

def Z3_get_decl_rational_parameter(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the rational value, as a string, associated with a rational parameter.

Precondition: Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_RATIONAL

Safe wrapper: Context.get_decl_rational_parameter (auto)

Z3_get_decl_sort_parameter

def Z3_get_decl_sort_parameter(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> Z3_sort

Return the sort value associated with a sort parameter.

Precondition: Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_SORT

Safe wrapper: Context.get_decl_sort_parameter (auto)

Z3_get_decl_symbol_parameter

def Z3_get_decl_symbol_parameter(self, c: Z3_context, d: Z3_func_decl, idx: UInt32) raises -> Z3_symbol

Return the double value associated with an double parameter.

Precondition: Z3_get_decl_parameter_kind(c, d, idx) == Z3_PARAMETER_SYMBOL

Safe wrapper: Context.get_decl_symbol_parameter (auto)

Z3_get_denominator

def Z3_get_denominator(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Return the denominator (as a numeral AST) of a numeral AST of sort Real.

Precondition: Z3_get_ast_kind(c, a) == Z3_NUMERAL_AST

Safe wrapper: Context.get_denominator (auto)

Z3_get_depth

def Z3_get_depth(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Safe wrapper: Context.get_depth (auto)

Z3_get_domain

def Z3_get_domain(self, c: Z3_context, d: Z3_func_decl, i: UInt32) raises -> Z3_sort

Return the sort of the i-th parameter of the given function declaration.

Precondition: i < Z3_get_domain_size(d)

See also: Z3_get_domain_size

Safe wrapper: Context.get_domain (auto)

Z3_get_domain_size

def Z3_get_domain_size(self, c: Z3_context, d: Z3_func_decl) raises -> UInt32

Return the number of parameters of the given declaration.

See also: Z3_get_arity

Safe wrapper: Context.get_domain_size (auto)

Z3_get_finite_domain_sort_size

def Z3_get_finite_domain_sort_size(self, c: Z3_context, s: Z3_sort, r: Pointer[mut=True, UInt64, _]) raises -> Bool

Store the size of the sort in r. Return false if the call failed. That is, Z3_get_sort_kind(s) == Z3_FINITE_DOMAIN_SORT

Z3_get_func_decl_id

def Z3_get_func_decl_id(self, c: Z3_context, f: Z3_func_decl) raises -> UInt32

Return a unique identifier for f.

Safe wrapper: Context.get_func_decl_id (auto)

Z3_get_index_value

def Z3_get_index_value(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Return index of de-Bruijn bound variable.

Precondition: Z3_get_ast_kind(a) == Z3_VAR_AST

Safe wrapper: Context.get_index_value (auto)

Z3_get_numeral_binary_string

def Z3_get_numeral_binary_string(self, c: Z3_context, a: Z3_ast) raises -> Pointer[Int8, MutUntrackedOrigin]

Return numeral value, as a binary string of a numeric constant term

Preconditions:

  • Z3_get_ast_kind(c, a) == Z3_NUMERAL_AST
  • a represents a non-negative integer

Safe wrapper: Context.get_numeral_binary_string (auto)

Z3_get_numeral_decimal_string

def Z3_get_numeral_decimal_string(self, c: Z3_context, a: Z3_ast, precision: UInt32) raises -> Pointer[Int8, MutUntrackedOrigin]

Return numeral as a string in decimal notation. The result has at most precision decimal places.

Precondition: Z3_get_ast_kind(c, a) == Z3_NUMERAL_AST || Z3_is_algebraic_number(c, a)

Safe wrapper: Context.get_numeral_decimal_string (auto)

Z3_get_numeral_double

def Z3_get_numeral_double(self, c: Z3_context, a: Z3_ast) raises -> Float64

Return numeral as a double.

Precondition: Z3_get_ast_kind(c, a) == Z3_NUMERAL_AST || Z3_is_algebraic_number(c, a)

Safe wrapper: Context.get_numeral_double (auto)

Z3_get_numeral_int

def Z3_get_numeral_int(self, c: Z3_context, v: Z3_ast, i: Pointer[mut=True, Int32, _]) raises -> Bool

Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine int. Return true if the call succeeded.

Precondition: Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST

See also: Z3_get_numeral_string

Safe wrapper: Context.get_numeral_int (auto)

Z3_get_numeral_int64

def Z3_get_numeral_int64(self, c: Z3_context, v: Z3_ast, i: Pointer[mut=True, Int64, _]) raises -> Bool

Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine int64_t int. Return true if the call succeeded.

Precondition: Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST

See also: Z3_get_numeral_string

Safe wrapper: Context.get_numeral_int64 (auto)

Z3_get_numeral_rational_int64

def Z3_get_numeral_rational_int64(self, c: Z3_context, v: Z3_ast, num: Pointer[mut=True, Int64, _], den: Pointer[mut=True, Int64, _]) raises -> Bool

Similar to Z3_get_numeral_string, but only succeeds if the value can fit as a rational number as machine int64_t int. Return true if the call succeeded.

Precondition: Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST

See also: Z3_get_numeral_string

Safe wrapper: Context.get_numeral_rational_int64 (auto)

Z3_get_numeral_small

def Z3_get_numeral_small(self, c: Z3_context, a: Z3_ast, num: Pointer[mut=True, Int64, _], den: Pointer[mut=True, Int64, _]) raises -> Bool

Return numeral value, as a pair of 64 bit numbers if the representation fits.

Return true if the numeral value fits in 64 bit numerals, false otherwise.

Equivalent to Z3_get_numeral_rational_int64 except that for unsupported expression arguments Z3_get_numeral_small signals an error while Z3_get_numeral_rational_int64 returns false.

Parameters:

  • c — logical context.
  • a — term.
  • num — numerator.
  • den — denominator.

Precondition: Z3_get_ast_kind(a) == Z3_NUMERAL_AST

Safe wrapper: Context.get_numeral_small (auto)

Z3_get_numeral_string

def Z3_get_numeral_string(self, c: Z3_context, a: Z3_ast) raises -> Pointer[Int8, MutUntrackedOrigin]

Return numeral value, as a decimal string of a numeric constant term

Precondition: Z3_get_ast_kind(c, a) == Z3_NUMERAL_AST

Safe wrapper: Context.get_numeral_string (auto)

Z3_get_numeral_uint

def Z3_get_numeral_uint(self, c: Z3_context, v: Z3_ast, u: Pointer[mut=True, UInt32, _]) raises -> Bool

Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine unsigned int. Return true if the call succeeded.

Precondition: Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST

See also: Z3_get_numeral_string

Safe wrapper: Context.get_numeral_uint (auto)

Z3_get_numeral_uint64

def Z3_get_numeral_uint64(self, c: Z3_context, v: Z3_ast, u: Pointer[mut=True, UInt64, _]) raises -> Bool

Similar to Z3_get_numeral_string, but only succeeds if the value can fit in a machine uint64_t int. Return true if the call succeeded.

Precondition: Z3_get_ast_kind(c, v) == Z3_NUMERAL_AST

See also: Z3_get_numeral_string

Safe wrapper: Context.get_numeral_uint64 (auto)

Z3_get_numerator

def Z3_get_numerator(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Return the numerator (as a numeral AST) of a numeral AST of sort Real.

Precondition: Z3_get_ast_kind(c, a) == Z3_NUMERAL_AST

Safe wrapper: Context.get_numerator (auto)

Z3_get_pattern

def Z3_get_pattern(self, c: Z3_context, p: Z3_pattern, idx: UInt32) raises -> Z3_ast

Return i'th ast in pattern.

Safe wrapper: Context.get_pattern (auto)

Z3_get_pattern_num_terms

def Z3_get_pattern_num_terms(self, c: Z3_context, p: Z3_pattern) raises -> UInt32

Return number of terms in pattern.

Safe wrapper: Context.get_pattern_num_terms (auto)

Z3_get_quantifier_body

def Z3_get_quantifier_body(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Return body of quantifier.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_body (auto)

Z3_get_quantifier_bound_name

def Z3_get_quantifier_bound_name(self, c: Z3_context, a: Z3_ast, i: UInt32) raises -> Z3_symbol

Return symbol of the i'th bound variable.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_bound_name (auto)

Z3_get_quantifier_bound_sort

def Z3_get_quantifier_bound_sort(self, c: Z3_context, a: Z3_ast, i: UInt32) raises -> Z3_sort

Return sort of the i'th bound variable.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_bound_sort (auto)

Z3_get_quantifier_id

def Z3_get_quantifier_id(self, c: Z3_context, a: Z3_ast) raises -> Z3_symbol

Obtain id of quantifier.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_id (auto)

Z3_get_quantifier_no_pattern_ast

def Z3_get_quantifier_no_pattern_ast(self, c: Z3_context, a: Z3_ast, i: UInt32) raises -> Z3_ast

Return i'th no_pattern.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_no_pattern_ast (auto)

Z3_get_quantifier_num_bound

def Z3_get_quantifier_num_bound(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Return number of bound variables of quantifier.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_num_bound (auto)

Z3_get_quantifier_num_no_patterns

def Z3_get_quantifier_num_no_patterns(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Return number of no_patterns used in quantifier.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_num_no_patterns (auto)

Z3_get_quantifier_num_patterns

def Z3_get_quantifier_num_patterns(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Return number of patterns used in quantifier.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_num_patterns (auto)

Z3_get_quantifier_pattern_ast

def Z3_get_quantifier_pattern_ast(self, c: Z3_context, a: Z3_ast, i: UInt32) raises -> Z3_pattern

Return i'th pattern.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_pattern_ast (auto)

Z3_get_quantifier_skolem_id

def Z3_get_quantifier_skolem_id(self, c: Z3_context, a: Z3_ast) raises -> Z3_symbol

Obtain skolem id of quantifier.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_skolem_id (auto)

Z3_get_quantifier_weight

def Z3_get_quantifier_weight(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Obtain weight of quantifier.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.get_quantifier_weight (auto)

Z3_get_range

def Z3_get_range(self, c: Z3_context, d: Z3_func_decl) raises -> Z3_sort

Return the range of the given declaration.

If d is a constant (i.e., has zero arguments), then this function returns the sort of the constant.

Safe wrapper: Context.get_range (auto)

Z3_get_relation_arity

def Z3_get_relation_arity(self, c: Z3_context, s: Z3_sort) raises -> UInt32

Return arity of relation.

Precondition: Z3_get_sort_kind(s) == Z3_RELATION_SORT

See also: Z3_get_relation_column

Safe wrapper: Context.get_relation_arity (auto)

Z3_get_relation_column

def Z3_get_relation_column(self, c: Z3_context, s: Z3_sort, col: UInt32) raises -> Z3_sort

Return sort at i'th column of relation sort.

Preconditions:

  • Z3_get_sort_kind(c, s) == Z3_RELATION_SORT
  • col < Z3_get_relation_arity(c, s)

See also: Z3_get_relation_arity

Safe wrapper: Context.get_relation_column (auto)

Z3_get_sort

def Z3_get_sort(self, c: Z3_context, a: Z3_ast) raises -> Z3_sort

Return the sort of an AST node.

The AST node must be a constant, application, numeral, bound variable, or quantifier.

Safe wrapper: Context.get_sort (auto)

Z3_get_sort_id

def Z3_get_sort_id(self, c: Z3_context, s: Z3_sort) raises -> UInt32

Return a unique identifier for s.

Safe wrapper: Context.get_sort_id (auto)

Z3_get_sort_kind

def Z3_get_sort_kind(self, c: Z3_context, t: Z3_sort) raises -> SortKind

Return the sort kind (e.g., array, tuple, int, bool, etc).

See also: Z3_sort_kind

Safe wrapper: Context.get_sort_kind (auto)

Z3_get_sort_name

def Z3_get_sort_name(self, c: Z3_context, d: Z3_sort) raises -> Z3_symbol

Return the sort name as a symbol.

Safe wrapper: Context.get_sort_name (auto)

Z3_get_symbol_int

def Z3_get_symbol_int(self, c: Z3_context, s: Z3_symbol) raises -> Int32

Return the symbol int value.

Precondition: Z3_get_symbol_kind(s) == Z3_INT_SYMBOL

See also: Z3_mk_int_symbol

Safe wrapper: Context.get_symbol_int (auto)

Z3_get_symbol_kind

def Z3_get_symbol_kind(self, c: Z3_context, s: Z3_symbol) raises -> SymbolKind

Return Z3_INT_SYMBOL if the symbol was constructed using Z3_mk_int_symbol, and Z3_STRING_SYMBOL if the symbol was constructed using Z3_mk_string_symbol.

Safe wrapper: Context.get_symbol_kind (auto)

Z3_get_symbol_string

def Z3_get_symbol_string(self, c: Z3_context, s: Z3_symbol) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the symbol name.

Precondition: Z3_get_symbol_kind(s) == Z3_STRING_SYMBOL

Warning: The returned buffer is statically allocated by Z3. It will be automatically deallocated when Z3_del_context is invoked. So, the buffer is invalidated in the next call to Z3_get_symbol_string.

See also: Z3_mk_string_symbol

Safe wrapper: Context.get_symbol_string (auto)

Z3_get_tuple_sort_field_decl

def Z3_get_tuple_sort_field_decl(self, c: Z3_context, t: Z3_sort, i: UInt32) raises -> Z3_func_decl

Return the i-th field declaration (i.e., projection function declaration) of the given tuple sort.

Preconditions:

  • Z3_get_sort_kind(t) == Z3_DATATYPE_SORT
  • i < Z3_get_tuple_sort_num_fields(c, t)

See also: Z3_mk_tuple_sort, Z3_get_sort_kind

Safe wrapper: Context.get_tuple_sort_field_decl (auto)

Z3_get_tuple_sort_mk_decl

def Z3_get_tuple_sort_mk_decl(self, c: Z3_context, t: Z3_sort) raises -> Z3_func_decl

Return the constructor declaration of the given tuple sort.

Precondition: Z3_get_sort_kind(c, t) == Z3_DATATYPE_SORT

See also: Z3_mk_tuple_sort, Z3_get_sort_kind

Safe wrapper: Context.get_tuple_sort_mk_decl (auto)

Z3_get_tuple_sort_num_fields

def Z3_get_tuple_sort_num_fields(self, c: Z3_context, t: Z3_sort) raises -> UInt32

Return the number of fields of the given tuple sort.

Precondition: Z3_get_sort_kind(c, t) == Z3_DATATYPE_SORT

See also: Z3_mk_tuple_sort, Z3_get_sort_kind

Safe wrapper: Context.get_tuple_sort_num_fields (auto)

Z3_is_algebraic_number

def Z3_is_algebraic_number(self, c: Z3_context, a: Z3_ast) raises -> Bool

Return true if the given AST is a real algebraic number.

Safe wrapper: Context.is_algebraic_number (auto)

Z3_is_app

def Z3_is_app(self, c: Z3_context, a: Z3_ast) raises -> Bool

Safe wrapper: Context.is_app (auto)

Z3_is_eq_ast

def Z3_is_eq_ast(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Bool

Compare terms.

Safe wrapper: Context.is_eq_ast (auto)

Z3_is_eq_func_decl

def Z3_is_eq_func_decl(self, c: Z3_context, f1: Z3_func_decl, f2: Z3_func_decl) raises -> Bool

Compare terms.

Safe wrapper: Context.is_eq_func_decl (auto)

Z3_is_eq_sort

def Z3_is_eq_sort(self, c: Z3_context, s1: Z3_sort, s2: Z3_sort) raises -> Bool

compare sorts.

Safe wrapper: Context.is_eq_sort (auto)

Z3_is_ground

def Z3_is_ground(self, c: Z3_context, a: Z3_ast) raises -> Bool

Safe wrapper: Context.is_ground (auto)

Z3_is_lambda

def Z3_is_lambda(self, c: Z3_context, a: Z3_ast) raises -> Bool

Determine if ast is a lambda expression.

Precondition: Z3_get_ast_kind(a) == Z3_QUANTIFIER_AST

Safe wrapper: Context.is_lambda (auto)

Z3_is_numeral_ast

def Z3_is_numeral_ast(self, c: Z3_context, a: Z3_ast) raises -> Bool

Safe wrapper: Context.is_numeral_ast (auto)

Z3_is_quantifier_exists

def Z3_is_quantifier_exists(self, c: Z3_context, a: Z3_ast) raises -> Bool

Determine if ast is an existential quantifier.

Safe wrapper: Context.is_quantifier_exists (auto)

Z3_is_quantifier_forall

def Z3_is_quantifier_forall(self, c: Z3_context, a: Z3_ast) raises -> Bool

Determine if an ast is a universal quantifier.

Safe wrapper: Context.is_quantifier_forall (auto)

Z3_is_recursive_datatype_sort

def Z3_is_recursive_datatype_sort(self, c: Z3_context, s: Z3_sort) raises -> Bool

Check if s is a recursive datatype sort.

Safe wrapper: Context.is_recursive_datatype_sort (auto)

Z3_is_well_sorted

def Z3_is_well_sorted(self, c: Z3_context, t: Z3_ast) raises -> Bool

Return true if the given expression t is well sorted.

Safe wrapper: Context.is_well_sorted (auto)

Z3_mk_atleast

def Z3_mk_atleast(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _], k: UInt32) raises -> Z3_ast

Pseudo-Boolean relations.

Encode p1 + p2 + ... + pn >= k

Safe wrapper: Context.mk_atleast (auto)

Z3_mk_atmost

def Z3_mk_atmost(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _], k: UInt32) raises -> Z3_ast

Pseudo-Boolean relations.

Encode p1 + p2 + ... + pn <= k

Safe wrapper: Context.mk_atmost (auto)

Z3_mk_pbeq

def Z3_mk_pbeq(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _], coeffs: Pointer[Int32, _], k: Int32) raises -> Z3_ast

Pseudo-Boolean relations.

Encode k1p1 + k2p2 + ... + kn*pn = k

Safe wrapper: Context.mk_pbeq (auto)

Z3_mk_pbge

def Z3_mk_pbge(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _], coeffs: Pointer[Int32, _], k: Int32) raises -> Z3_ast

Pseudo-Boolean relations.

Encode k1p1 + k2p2 + ... + kn*pn >= k

Safe wrapper: Context.mk_pbge (auto)

Z3_mk_pble

def Z3_mk_pble(self, c: Z3_context, num_args: UInt32, args: Pointer[Z3_ast, _], coeffs: Pointer[Int32, _], k: Int32) raises -> Z3_ast

Pseudo-Boolean relations.

Encode k1p1 + k2p2 + ... + kn*pn <= k

Safe wrapper: Context.mk_pble (auto)

Z3_pattern_to_ast

def Z3_pattern_to_ast(self, c: Z3_context, p: Z3_pattern) raises -> Z3_ast

Convert a Z3_pattern into Z3_ast. This is just type casting.

Safe wrapper: Context.pattern_to_ast (auto)

Z3_simplify

def Z3_simplify(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast

Interface to simplifier.

Provides an interface to the AST simplifier used by Z3. It returns an AST object which is equal to the argument. The returned AST is simplified using algebraic simplification rules, such as constant propagation (propagating true/false over logical connectives).

See also: Z3_simplify_ex

Safe wrapper: Context.simplify (auto)

Z3_simplify_ex

def Z3_simplify_ex(self, c: Z3_context, a: Z3_ast, p: Z3_params) raises -> Z3_ast

Interface to simplifier.

Provides an interface to the AST simplifier used by Z3. This procedure is similar to Z3_simplify, but the behavior of the simplifier can be configured using the given parameter set.

Z3_simplify_get_help

def Z3_simplify_get_help(self, c: Z3_context) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string describing all available parameters.

Z3_simplify_get_param_descrs

def Z3_simplify_get_param_descrs(self, c: Z3_context) raises -> Z3_param_descrs

Return the parameter description set for the simplify procedure.

Z3_sort_to_ast

def Z3_sort_to_ast(self, c: Z3_context, s: Z3_sort) raises -> Z3_ast

Convert a Z3_sort into Z3_ast. This is just type casting.

Safe wrapper: Context.sort_to_ast (auto)

Z3_to_app

def Z3_to_app(self, c: Z3_context, a: Z3_ast) raises -> Z3_app

Convert an ast into an APP_AST. This is just type casting.

Precondition: Z3_get_ast_kind(c, a) == \c Z3_APP_AST

Safe wrapper: Context.to_app (auto)

Z3_to_func_decl

def Z3_to_func_decl(self, c: Z3_context, a: Z3_ast) raises -> Z3_func_decl

Convert an AST into a FUNC_DECL_AST. This is just type casting.

Precondition: Z3_get_ast_kind(c, a) == Z3_FUNC_DECL_AST

Safe wrapper: Context.to_func_decl (auto)

Modifiers (5)

Z3_substitute

def Z3_substitute(self, c: Z3_context, a: Z3_ast, num_exprs: UInt32, from_: Pointer[Z3_ast, _], to: Pointer[Z3_ast, _]) raises -> Z3_ast

Substitute every occurrence of from[i] in a with to[i], for i smaller than num_exprs. The result is the new AST. The arrays from and to must have size num_exprs. For every i smaller than num_exprs, we must have that sort of from[i] must be equal to sort of to[i].

Safe wrapper: Context.substitute (auto)

Z3_substitute_funs

def Z3_substitute_funs(self, c: Z3_context, a: Z3_ast, num_funs: UInt32, from_: Pointer[Z3_func_decl, _], to: Pointer[Z3_ast, _]) raises -> Z3_ast

Substitute functions in from with new expressions in to.

The expressions in to can have free variables. The free variable in to at index 0 refers to the first argument of from, the free variable at index 1 corresponds to the second argument.

Safe wrapper: Context.substitute_funs (auto)

Z3_substitute_vars

def Z3_substitute_vars(self, c: Z3_context, a: Z3_ast, num_exprs: UInt32, to: Pointer[Z3_ast, _]) raises -> Z3_ast

Substitute the variables in a with the expressions in to. For every i smaller than num_exprs, the variable with de-Bruijn index i is replaced with term to[i]. Note that a variable is created using the function Z3_mk_bound.

Safe wrapper: Context.substitute_vars (auto)

Z3_translate

def Z3_translate(self, source: Z3_context, a: Z3_ast, target: Z3_context) raises -> Z3_ast

Translate/Copy the AST a from context source to context target. AST a must have been created using context source.

Precondition: source != target

Safe wrapper: Context.translate (auto)

Z3_update_term

def Z3_update_term(self, c: Z3_context, a: Z3_ast, num_args: UInt32, args: Pointer[Z3_ast, _]) raises -> Z3_ast

Update the arguments of term a using the arguments args. The number of arguments num_args should coincide with the number of arguments to a. If a is a quantifier, then num_args has to be 1.

Safe wrapper: Context.update_term (auto)

Models (26)

Z3_add_const_interp

def Z3_add_const_interp(self, c: Z3_context, m: Z3_model, f: Z3_func_decl, a: Z3_ast) raises

Add a constant interpretation.

Safe wrapper: Context.add_const_interp (auto)

Z3_add_func_interp

def Z3_add_func_interp(self, c: Z3_context, m: Z3_model, f: Z3_func_decl, default_value: Z3_ast) raises -> Z3_func_interp

Create a fresh func_interp object, add it to a model for a specified function. It has reference count 0.

Parameters:

  • c — context
  • m — model
  • f — function declaration
  • default_value — default value for function interpretation

Safe wrapper: Context.add_func_interp (auto)

Z3_func_entry_get_arg

def Z3_func_entry_get_arg(self, c: Z3_context, e: Z3_func_entry, i: UInt32) raises -> Z3_ast

Return an argument of a Z3_func_entry object.

Precondition: i < Z3_func_entry_get_num_args(c, e)

See also: Z3_func_entry_get_num_args, Z3_func_interp_get_entry

Safe wrapper: FuncEntry.get_arg (auto)

Z3_func_entry_get_num_args

def Z3_func_entry_get_num_args(self, c: Z3_context, e: Z3_func_entry) raises -> UInt32

Return the number of arguments in a Z3_func_entry object.

Z3_func_entry_get_value

def Z3_func_entry_get_value(self, c: Z3_context, e: Z3_func_entry) raises -> Z3_ast

Return the value of this point.

A Z3_func_entry object represents an element in the finite map used to encode a function interpretation.

See also: Z3_func_interp_get_entry

Safe wrapper: FuncEntry.get_value (auto)

Z3_func_interp_add_entry

def Z3_func_interp_add_entry(self, c: Z3_context, fi: Z3_func_interp, args: Z3_ast_vector, value: Z3_ast) raises

add a function entry to a function interpretation.

It is assumed that entries added to a function cover disjoint arguments. If an two entries are added with the same arguments, only the second insertion survives and the first inserted entry is removed.

Parameters:

  • c — logical context
  • fi — a function interpretation to be updated.
  • args — list of arguments. They should be constant values (such as integers) and be of the same types as the domain of the function.
  • value — value of the function when the parameters match args.

Safe wrapper: FuncInterp.add_entry (auto)

Z3_func_interp_get_arity

def Z3_func_interp_get_arity(self, c: Z3_context, f: Z3_func_interp) raises -> UInt32

Return the arity (number of arguments) of the given function interpretation.

Safe wrapper: FuncInterp.get_arity (auto)

Z3_func_interp_get_else

def Z3_func_interp_get_else(self, c: Z3_context, f: Z3_func_interp) raises -> Z3_ast

Return the 'else' value of the given function interpretation.

A function interpretation is represented as a finite map and an 'else' value. This procedure returns the 'else' value.

Safe wrapper: FuncInterp.get_else (auto)

Z3_func_interp_get_entry

def Z3_func_interp_get_entry(self, c: Z3_context, f: Z3_func_interp, i: UInt32) raises -> Z3_func_entry

Return a "point" of the given function interpretation. It represents the value of f in a particular point.

Precondition: i < Z3_func_interp_get_num_entries(c, f)

See also: Z3_func_interp_get_num_entries

Safe wrapper: FuncInterp.get_entry (auto)

Z3_func_interp_get_num_entries

def Z3_func_interp_get_num_entries(self, c: Z3_context, f: Z3_func_interp) raises -> UInt32

Return the number of entries in the given function interpretation.

A function interpretation is represented as a finite map and an 'else' value. Each entry in the finite map represents the value of a function given a set of arguments. This procedure return the number of element in the finite map of f.

See also: Z3_func_interp_get_entry

Safe wrapper: FuncInterp.get_num_entries (auto)

Z3_func_interp_set_else

def Z3_func_interp_set_else(self, c: Z3_context, f: Z3_func_interp, else_value: Z3_ast) raises

Return the 'else' value of the given function interpretation.

A function interpretation is represented as a finite map and an 'else' value. This procedure can be used to update the 'else' value.

Safe wrapper: FuncInterp.set_else (auto)

Z3_get_as_array_func_decl

def Z3_get_as_array_func_decl(self, c: Z3_context, a: Z3_ast) raises -> Z3_func_decl

Return the function declaration f associated with a (_ as_array f) node.

See also: Z3_is_as_array

Safe wrapper: Context.get_as_array_func_decl (auto)

Z3_is_as_array

def Z3_is_as_array(self, c: Z3_context, a: Z3_ast) raises -> Bool

The (_ as-array f) AST node is a construct for assigning interpretations for arrays in Z3. It is the array such that forall indices i we have that (select (_ as-array f) i) is equal to (f i). This procedure returns true if the a is an as-array AST node.

Z3 current solvers have minimal support for as_array nodes.

See also: Z3_get_as_array_func_decl

Safe wrapper: Context.is_as_array (auto)

Z3_mk_model

def Z3_mk_model(self, c: Z3_context) raises -> Z3_model

Create a fresh model object. It has reference count 0.

Safe wrapper: Context.mk_model (auto)

Z3_model_eval

def Z3_model_eval(self, c: Z3_context, m: Z3_model, t: Z3_ast, model_completion: Bool, v: Pointer[mut=True, Z3_ast, _]) raises -> Bool

Evaluate the AST node t in the given model. Return true if succeeded, and store the result in v.

If model_completion is true, then Z3 will assign an interpretation for any constant or function that does not have an interpretation in m. These constants and functions were essentially don't cares.

If model_completion is false, then Z3 will not assign interpretations to constants for functions that do not have interpretations in m. Evaluation behaves as the identify function in this case.

The evaluation may fail for the following reasons:

  • t contains a quantifier.

  • the model m is partial, that is, it doesn't have a complete interpretation for uninterpreted functions. That is, the option MODEL_PARTIAL=true was used.

  • t is type incorrect.

  • Z3_interrupt was invoked during evaluation.

Safe wrapper: Model.eval (manual)

Z3_model_get_const_decl

def Z3_model_get_const_decl(self, c: Z3_context, m: Z3_model, i: UInt32) raises -> Z3_func_decl

Return the i-th constant in the given model.

Precondition: i < Z3_model_get_num_consts(c, m)

See also: Z3_model_eval, Z3_model_get_num_consts

Safe wrapper: Model.const_decl (manual)

Z3_model_get_const_interp

def Z3_model_get_const_interp(self, c: Z3_context, m: Z3_model, a: Z3_func_decl) raises -> Z3_ast

Return the interpretation (i.e., assignment) of constant a in the model m. Return NULL, if the model does not assign an interpretation for a. That should be interpreted as: the value of a does not matter.

Precondition: Z3_get_arity(c, a) == 0

Safe wrapper: Model.get_const_interp (auto)

Z3_model_get_func_decl

def Z3_model_get_func_decl(self, c: Z3_context, m: Z3_model, i: UInt32) raises -> Z3_func_decl

Return the declaration of the i-th function in the given model.

Precondition: i < Z3_model_get_num_funcs(c, m)

See also: Z3_model_get_num_funcs

Safe wrapper: Model.get_func_decl (auto)

Z3_model_get_func_interp

def Z3_model_get_func_interp(self, c: Z3_context, m: Z3_model, f: Z3_func_decl) raises -> Z3_func_interp

Return the interpretation of the function f in the model m. Return NULL, if the model does not assign an interpretation for f. That should be interpreted as: the f does not matter.

Precondition: Z3_get_arity(c, f) > 0

Note: Reference counting must be used to manage Z3_func_interp objects, even when the Z3_context was created using Z3_mk_context instead of Z3_mk_context_rc.

Safe wrapper: Model.get_func_interp (auto)

Z3_model_get_num_consts

def Z3_model_get_num_consts(self, c: Z3_context, m: Z3_model) raises -> UInt32

Return the number of constants assigned by the given model.

See also: Z3_model_get_const_decl

Safe wrapper: Model.num_consts (manual)

Z3_model_get_num_funcs

def Z3_model_get_num_funcs(self, c: Z3_context, m: Z3_model) raises -> UInt32

Return the number of function interpretations in the given model.

A function interpretation is represented as a finite map and an 'else' value. Each entry in the finite map represents the value of a function given a set of arguments.

See also: Z3_model_get_func_decl

Safe wrapper: Model.get_num_funcs (auto)

Z3_model_get_num_sorts

def Z3_model_get_num_sorts(self, c: Z3_context, m: Z3_model) raises -> UInt32

Return the number of uninterpreted sorts that m assigns an interpretation to.

Z3 also provides an interpretation for uninterpreted sorts used in a formula. The interpretation for a sort s is a finite set of distinct values. We say this finite set is the "universe" of s.

Z3_model_get_sort

def Z3_model_get_sort(self, c: Z3_context, m: Z3_model, i: UInt32) raises -> Z3_sort

Return a uninterpreted sort that m assigns an interpretation.

Precondition: i < Z3_model_get_num_sorts(c, m)

See also: Z3_model_get_num_sorts, Z3_model_get_sort_universe

Safe wrapper: Model.get_sort (auto)

Z3_model_get_sort_universe

def Z3_model_get_sort_universe(self, c: Z3_context, m: Z3_model, s: Z3_sort) raises -> Z3_ast_vector

Return the finite set of distinct values that represent the interpretation for sort s.

Z3_model_has_interp

def Z3_model_has_interp(self, c: Z3_context, m: Z3_model, a: Z3_func_decl) raises -> Bool

Test if there exists an interpretation (i.e., assignment) for a in the model m.

Safe wrapper: Model.has_interp (auto)

Z3_model_translate

def Z3_model_translate(self, c: Z3_context, m: Z3_model, dst: Z3_context) raises -> Z3_model

translate model from context c to context dst.

Note: Use this method for cloning state between contexts. Note that operations on contexts are not thread safe and therefore all operations that related to a given context have to be synchronized (or run in the same thread).

Safe wrapper: Model.translate (auto)

Interaction logging (4)

Z3_append_log

def Z3_append_log(self, string: Pointer[Int8, _])

Append user-defined string to interaction log.

The interaction log is opened using Z3_open_log. It contains the formulas that are checked using Z3. You can use this command to append comments, for instance.

See also: Z3_open_log, Z3_close_log

Safe wrapper: append_log (auto)

Z3_close_log

def Z3_close_log(self)

Close interaction log.

See also: Z3_open_log, Z3_append_log

Safe wrapper: close_log (auto)

Z3_open_log

def Z3_open_log(self, filename: Pointer[Int8, _]) -> Bool

Log interaction to a file.

See also: Z3_append_log, Z3_close_log

Safe wrapper: open_log (auto)

Z3_toggle_warning_messages

def Z3_toggle_warning_messages(self, enabled: Bool)

Enable/disable printing warning messages to the console.

Warnings are printed after passing true, warning messages are suppressed after calling this method with false.

Safe wrapper: toggle_warning_messages (auto)

String conversion (7)

Z3_ast_to_string

def Z3_ast_to_string(self, c: Z3_context, a: Z3_ast) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert the given AST node into a string.

Warning: The result buffer is statically allocated by Z3. It will be automatically deallocated when Z3_del_context is invoked. So, the buffer is invalidated in the next call to Z3_ast_to_string.

See also: Z3_pattern_to_string, Z3_sort_to_string

Safe wrapper: Context.ast_to_string (auto)

Z3_benchmark_to_smtlib_string

def Z3_benchmark_to_smtlib_string(self, c: Z3_context, name: Pointer[Int8, _], logic: Pointer[Int8, _], status: Pointer[Int8, _], attributes: Pointer[Int8, _], num_assumptions: UInt32, assumptions: Pointer[Z3_ast, _], formula: Z3_ast) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert the given benchmark into SMT-LIB formatted string.

Parameters:

  • c — - context.
  • name — - name of benchmark. The argument is optional.
  • logic — - the benchmark logic.
  • status — - the status string (sat, unsat, or unknown)
  • attributes — - other attributes, such as source, difficulty or category.
  • num_assumptions — - number of assumptions.
  • assumptions — - auxiliary assumptions.
  • formula — - formula to be checked for consistency in conjunction with assumptions.

Warning: The result buffer is statically allocated by Z3. It will be automatically deallocated when Z3_del_context is invoked. So, the buffer is invalidated in the next call to Z3_benchmark_to_smtlib_string.

Safe wrapper: Context.benchmark_to_smtlib_string (auto)

Z3_func_decl_to_string

def Z3_func_decl_to_string(self, c: Z3_context, d: Z3_func_decl) raises -> Pointer[Int8, MutUntrackedOrigin]

Safe wrapper: Context.func_decl_to_string (auto)

Z3_model_to_string

def Z3_model_to_string(self, c: Z3_context, m: Z3_model) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert the given model into a string.

Warning: The result buffer is statically allocated by Z3. It will be automatically deallocated when Z3_del_context is invoked. So, the buffer is invalidated in the next call to Z3_model_to_string.

Safe wrapper: Model.to_string (manual)

Z3_pattern_to_string

def Z3_pattern_to_string(self, c: Z3_context, p: Z3_pattern) raises -> Pointer[Int8, MutUntrackedOrigin]

Safe wrapper: Context.pattern_to_string (auto)

Z3_set_ast_print_mode

def Z3_set_ast_print_mode(self, c: Z3_context, mode: AstPrintMode) raises

Select mode for the format used for pretty-printing AST nodes.

The default mode for pretty printing AST nodes is to produce SMT-LIB style output where common subexpressions are printed at each occurrence. The mode is called Z3_PRINT_SMTLIB_FULL. To print shared common subexpressions only once, use the Z3_PRINT_LOW_LEVEL mode. To print in way that conforms to SMT-LIB standards and uses let expressions to share common sub-expressions use Z3_PRINT_SMTLIB2_COMPLIANT.

Z3_sort_to_string

def Z3_sort_to_string(self, c: Z3_context, s: Z3_sort) raises -> Pointer[Int8, MutUntrackedOrigin]

Safe wrapper: Context.sort_to_string (auto)

Parser interface (7)

Z3_eval_smtlib2_string

def Z3_eval_smtlib2_string(self, c: Z3_context, str: Pointer[Int8, _]) raises -> Pointer[Int8, MutUntrackedOrigin]

Parse and evaluate and SMT-LIB2 command sequence. The state from a previous call is saved so the next evaluation builds on top of the previous call.

Returns: output generated from processing commands.

Safe wrapper: Context.eval_smtlib2_string (auto)

Z3_mk_parser_context

def Z3_mk_parser_context(self, c: Z3_context) raises -> Z3_parser_context

Create a parser context.

A parser context maintains state between calls to Z3_parser_context_parse_string where the caller can pass in a set of SMTLIB2 commands. It maintains all the declarations from previous calls together with of sorts and function declarations (including 0-ary) that are added directly to the context.

Safe wrapper: Context.mk_parser_context (auto)

Z3_parse_smtlib2_file

def Z3_parse_smtlib2_file(self, c: Z3_context, file_name: Pointer[Int8, _], num_sorts: UInt32, sort_names: Pointer[Z3_symbol, _], sorts: Pointer[Z3_sort, _], num_decls: UInt32, decl_names: Pointer[Z3_symbol, _], decls: Pointer[Z3_func_decl, _]) raises -> Z3_ast_vector

Similar to Z3_parse_smtlib2_string, but reads the benchmark from a file.

Safe wrapper: Context.parse_smtlib2_file (auto)

Z3_parse_smtlib2_string

def Z3_parse_smtlib2_string(self, c: Z3_context, str: Pointer[Int8, _], num_sorts: UInt32, sort_names: Pointer[Z3_symbol, _], sorts: Pointer[Z3_sort, _], num_decls: UInt32, decl_names: Pointer[Z3_symbol, _], decls: Pointer[Z3_func_decl, _]) raises -> Z3_ast_vector

Parse the given string using the SMT-LIB2 parser.

It returns a formula comprising of the conjunction of assertions in the scope (up to push/pop) at the end of the string.

Safe wrapper: Context.parse_smtlib2_string (auto)

Z3_parser_context_add_decl

def Z3_parser_context_add_decl(self, c: Z3_context, pc: Z3_parser_context, f: Z3_func_decl) raises

Add a function declaration.

Safe wrapper: ParserContext.add_decl (auto)

Z3_parser_context_add_sort

def Z3_parser_context_add_sort(self, c: Z3_context, pc: Z3_parser_context, s: Z3_sort) raises

Add a sort declaration.

Safe wrapper: ParserContext.add_sort (auto)

Z3_parser_context_from_string

def Z3_parser_context_from_string(self, c: Z3_context, pc: Z3_parser_context, s: Pointer[Int8, _]) raises -> Z3_ast_vector

Parse a string of SMTLIB2 commands. Return assertions.

Safe wrapper: ParserContext.from_string (auto)

Error Handling (3)

Z3_get_error_code

def Z3_get_error_code(self, c: Z3_context) -> ErrorCode

Return the error code for the last API call.

A call to a Z3 function may return a non Z3_OK error code, when it is not used correctly.

See also: Z3_set_error_handler

Safe wrapper: Context.get_error_code (auto)

Z3_get_error_msg

def Z3_get_error_msg(self, c: Z3_context, err: ErrorCode) -> Pointer[Int8, MutUntrackedOrigin]

Return a string describing the given error code.

Safe wrapper: Context.get_error_msg (auto)

Z3_set_error

def Z3_set_error(self, c: Z3_context, e: ErrorCode)

Set an error.

Safe wrapper: Context.set_error (auto)

Miscellaneous (6)

Z3_disable_trace

def Z3_disable_trace(self, tag: Pointer[Int8, _])

Disable tracing messages tagged as tag when Z3 is compiled in debug mode. It is a NOOP otherwise

See also: Z3_enable_trace

Safe wrapper: disable_trace (auto)

Z3_enable_trace

def Z3_enable_trace(self, tag: Pointer[Int8, _])

Enable tracing messages tagged as tag when Z3 is compiled in debug mode. It is a NOOP otherwise

See also: Z3_disable_trace

Safe wrapper: enable_trace (auto)

Z3_finalize_memory

def Z3_finalize_memory(self)

Destroy all allocated resources.

Any pointers previously returned by the API become invalid. Can be used for memory leak detection.

Safe wrapper: finalize_memory (auto)

Z3_get_full_version

def Z3_get_full_version(self) -> Pointer[Int8, MutUntrackedOrigin]

Return a string that fully describes the version of Z3 in use.

See also: Z3_get_version

Safe wrapper: get_full_version (manual)

Z3_get_version

def Z3_get_version(self, major: Pointer[mut=True, UInt32, _], minor: Pointer[mut=True, UInt32, _], build_number: Pointer[mut=True, UInt32, _], revision_number: Pointer[mut=True, UInt32, _])

Return Z3 version number information.

See also: Z3_get_full_version

Safe wrapper: get_version (manual)

Z3_reset_memory

def Z3_reset_memory(self)

Reset all allocated resources.

Use this facility on out-of memory errors. It allows discharging the previous state and resuming afresh. Any pointers previously returned by the API become invalid.

Safe wrapper: reset_memory (auto)

Goals (15)

Z3_goal_assert

def Z3_goal_assert(self, c: Z3_context, g: Z3_goal, a: Z3_ast) raises

Add a new formula a to the given goal. The formula is split according to the following procedure that is applied until a fixed-point: Conjunctions are split into separate formulas. Negations are distributed over disjunctions, resulting in separate formulas. If the goal is false, adding new formulas is a no-op. If the formula a is true, then nothing is added. If the formula a is false, then the entire goal is replaced by the formula false.

Safe wrapper: Goal.assert_formula (manual)

Z3_goal_convert_model

def Z3_goal_convert_model(self, c: Z3_context, g: Z3_goal, m: Z3_model) raises -> Z3_model

Convert a model of the formulas of a goal to a model of an original goal. The model may be null, in which case the returned model is valid if the goal was established satisfiable.

When using this feature it is advisable to set the parameter model.compact to false. It is by default true, which erases variables created by the solver from models. Without access to model values for intermediary variables, values of other variables may end up having the wrong values.

Safe wrapper: Goal.convert_model (auto)

Z3_goal_depth

def Z3_goal_depth(self, c: Z3_context, g: Z3_goal) raises -> UInt32

Return the depth of the given goal. It tracks how many transformations were applied to it.

Safe wrapper: Goal.depth (auto)

Z3_goal_formula

def Z3_goal_formula(self, c: Z3_context, g: Z3_goal, idx: UInt32) raises -> Z3_ast

Return a formula from the given goal.

Precondition: idx < Z3_goal_size(c, g)

Safe wrapper: Goal.formula (manual)

Z3_goal_inconsistent

def Z3_goal_inconsistent(self, c: Z3_context, g: Z3_goal) raises -> Bool

Return true if the given goal contains the formula false.

Safe wrapper: Goal.inconsistent (auto)

Z3_goal_is_decided_sat

def Z3_goal_is_decided_sat(self, c: Z3_context, g: Z3_goal) raises -> Bool

Return true if the goal is empty, and it is precise or the product of a under approximation.

Safe wrapper: Goal.is_decided_sat (auto)

Z3_goal_is_decided_unsat

def Z3_goal_is_decided_unsat(self, c: Z3_context, g: Z3_goal) raises -> Bool

Return true if the goal contains false, and it is precise or the product of an over approximation.

Safe wrapper: Goal.is_decided_unsat (auto)

Z3_goal_num_exprs

def Z3_goal_num_exprs(self, c: Z3_context, g: Z3_goal) raises -> UInt32

Return the number of formulas, subformulas and terms in the given goal.

Safe wrapper: Goal.num_exprs (auto)

Z3_goal_precision

def Z3_goal_precision(self, c: Z3_context, g: Z3_goal) raises -> GoalPrec

Return the "precision" of the given goal. Goals can be transformed using over and under approximations. A under approximation is applied when the objective is to find a model for a given goal. An over approximation is applied when the objective is to find a proof for a given goal.

Safe wrapper: Goal.precision (auto)

Z3_goal_reset

def Z3_goal_reset(self, c: Z3_context, g: Z3_goal) raises

Erase all formulas from the given goal.

Safe wrapper: Goal.reset (auto)

Z3_goal_size

def Z3_goal_size(self, c: Z3_context, g: Z3_goal) raises -> UInt32

Return the number of formulas in the given goal.

Safe wrapper: Goal.size (manual)

Z3_goal_to_dimacs_string

def Z3_goal_to_dimacs_string(self, c: Z3_context, g: Z3_goal, include_names: Bool) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert a goal into a DIMACS formatted string. The goal must be in CNF. You can convert a goal to CNF by applying the tseitin-cnf tactic. Bit-vectors are not automatically converted to Booleans either, so if the caller intends to preserve satisfiability, it should apply bit-blasting tactics. Quantifiers and theory atoms will not be encoded.

Safe wrapper: Goal.to_dimacs_string (auto)

Z3_goal_to_string

def Z3_goal_to_string(self, c: Z3_context, g: Z3_goal) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert a goal into a string.

Safe wrapper: Goal.to_string (manual)

Z3_goal_translate

def Z3_goal_translate(self, source: Z3_context, g: Z3_goal, target: Z3_context) raises -> Z3_goal

Copy a goal g from the context source to the context target.

Safe wrapper: Goal.translate (auto)

Z3_mk_goal

def Z3_mk_goal(self, c: Z3_context, models: Bool, unsat_cores: Bool, proofs: Bool) raises -> Z3_goal

Create a goal (aka problem). A goal is essentially a set of formulas, that can be solved and/or transformed using tactics and solvers.

If models is true, then model generation is enabled for the new goal.

If unsat_cores is true, then unsat core generation is enabled for the new goal.

If proofs is true, then proof generation is enabled for the new goal. Remark, the Z3 context c must have been created with proof generation support.

Note: Reference counting must be used to manage goals, even when the Z3_context was created using Z3_mk_context instead of Z3_mk_context_rc.

Safe wrapper: Goal.create (manual)

Tactics, Simplifiers and Probes (47)

Z3_apply_result_get_num_subgoals

def Z3_apply_result_get_num_subgoals(self, c: Z3_context, r: Z3_apply_result) raises -> UInt32

Return the number of subgoals in the Z3_apply_result object returned by Z3_tactic_apply.

See also: Z3_apply_result_get_subgoal

Safe wrapper: ApplyResult.num_subgoals (manual)

Z3_apply_result_get_subgoal

def Z3_apply_result_get_subgoal(self, c: Z3_context, r: Z3_apply_result, i: UInt32) raises -> Z3_goal

Return one of the subgoals in the Z3_apply_result object returned by Z3_tactic_apply.

Precondition: i < Z3_apply_result_get_num_subgoals(c, r)

See also: Z3_apply_result_get_num_subgoals

Safe wrapper: ApplyResult.subgoal (manual)

Z3_apply_result_to_string

def Z3_apply_result_to_string(self, c: Z3_context, r: Z3_apply_result) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert the Z3_apply_result object returned by Z3_tactic_apply into a string.

Safe wrapper: ApplyResult.to_string (auto)

Z3_get_num_probes

def Z3_get_num_probes(self, c: Z3_context) raises -> UInt32

Return the number of builtin probes available in Z3.

See also: Z3_get_probe_name

Safe wrapper: Context.get_num_probes (auto)

Z3_get_num_simplifiers

def Z3_get_num_simplifiers(self, c: Z3_context) raises -> UInt32

Return the number of builtin simplifiers available in Z3.

See also: Z3_get_simplifier_name

Safe wrapper: Context.get_num_simplifiers (auto)

Z3_get_num_tactics

def Z3_get_num_tactics(self, c: Z3_context) raises -> UInt32

Return the number of builtin tactics available in Z3.

See also: Z3_get_tactic_name

Safe wrapper: Context.get_num_tactics (auto)

Z3_get_probe_name

def Z3_get_probe_name(self, c: Z3_context, i: UInt32) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the name of the i probe.

Precondition: i < Z3_get_num_probes(c)

See also: Z3_get_num_probes

Safe wrapper: Context.get_probe_name (auto)

Z3_get_simplifier_name

def Z3_get_simplifier_name(self, c: Z3_context, i: UInt32) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the name of the idx simplifier.

Precondition: i < Z3_get_num_simplifiers(c)

See also: Z3_get_num_simplifiers

Safe wrapper: Context.get_simplifier_name (auto)

Z3_get_tactic_name

def Z3_get_tactic_name(self, c: Z3_context, i: UInt32) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the name of the idx tactic.

Precondition: i < Z3_get_num_tactics(c)

See also: Z3_get_num_tactics

Safe wrapper: Context.get_tactic_name (auto)

Z3_mk_probe

def Z3_mk_probe(self, c: Z3_context, name: Pointer[Int8, _]) raises -> Z3_probe

Return a probe associated with the given name. The complete list of probes may be obtained using the procedures Z3_get_num_probes and Z3_get_probe_name. It may also be obtained using the command (help-tactic) in the SMT 2.0 front-end.

Probes are used to inspect a goal (aka problem) and collect information that may be used to decide which solver and/or preprocessing step will be used.

Safe wrapper: Context.mk_probe (auto)

Z3_mk_simplifier

def Z3_mk_simplifier(self, c: Z3_context, name: Pointer[Int8, _]) raises -> Z3_simplifier

Return a simplifier associated with the given name. The complete list of simplifiers may be obtained using the procedures Z3_get_num_simplifiers and Z3_get_simplifier_name. It may also be obtained using the command (help-simplifier) in the SMT 2.0 front-end.

Simplifiers are the basic building block for creating custom solvers for specific problem domains.

Safe wrapper: Context.mk_simplifier (auto)

Z3_mk_tactic

def Z3_mk_tactic(self, c: Z3_context, name: Pointer[Int8, _]) raises -> Z3_tactic

Return a tactic associated with the given name. The complete list of tactics may be obtained using the procedures Z3_get_num_tactics and Z3_get_tactic_name. It may also be obtained using the command (help-tactic) in the SMT 2.0 front-end.

Tactics are the basic building block for creating custom solvers for specific problem domains.

Safe wrapper: Tactic.create (manual)

Z3_probe_and

def Z3_probe_and(self, x: Z3_context, p1: Z3_probe, p2: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when p1 and p2 evaluates to true.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.and_ (auto)

Z3_probe_apply

def Z3_probe_apply(self, c: Z3_context, p: Z3_probe, g: Z3_goal) raises -> Float64

Execute the probe over the goal. The probe always produce a double value. "Boolean" probes return 0.0 for false, and a value different from 0.0 for true.

Safe wrapper: Probe.apply (auto)

Z3_probe_const

def Z3_probe_const(self, x: Z3_context, val: Float64) raises -> Z3_probe

Return a probe that always evaluates to val.

Safe wrapper: Context.probe_const (auto)

Z3_probe_eq

def Z3_probe_eq(self, x: Z3_context, p1: Z3_probe, p2: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when the value returned by p1 is equal to the value returned by p2.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.eq (auto)

Z3_probe_ge

def Z3_probe_ge(self, x: Z3_context, p1: Z3_probe, p2: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when the value returned by p1 is greater than or equal to the value returned by p2.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.ge (auto)

Z3_probe_get_descr

def Z3_probe_get_descr(self, c: Z3_context, name: Pointer[Int8, _]) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string containing a description of the probe with the given name.

Safe wrapper: Context.probe_get_descr (auto)

Z3_probe_gt

def Z3_probe_gt(self, x: Z3_context, p1: Z3_probe, p2: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when the value returned by p1 is greater than the value returned by p2.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.gt (auto)

Z3_probe_le

def Z3_probe_le(self, x: Z3_context, p1: Z3_probe, p2: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when the value returned by p1 is less than or equal to the value returned by p2.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.le (auto)

Z3_probe_lt

def Z3_probe_lt(self, x: Z3_context, p1: Z3_probe, p2: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when the value returned by p1 is less than the value returned by p2.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.lt (auto)

Z3_probe_not

def Z3_probe_not(self, x: Z3_context, p: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when p does not evaluate to true.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.not_ (auto)

Z3_probe_or

def Z3_probe_or(self, x: Z3_context, p1: Z3_probe, p2: Z3_probe) raises -> Z3_probe

Return a probe that evaluates to "true" when p1 or p2 evaluates to true.

Note: For probes, "true" is any value different from 0.0.

Safe wrapper: Probe.or_ (auto)

Z3_simplifier_and_then

def Z3_simplifier_and_then(self, c: Z3_context, t1: Z3_simplifier, t2: Z3_simplifier) raises -> Z3_simplifier

Return a simplifier that applies t1 to a given goal and t2 to every subgoal produced by t1.

Safe wrapper: Simplifier.and_then (auto)

Z3_simplifier_get_descr

def Z3_simplifier_get_descr(self, c: Z3_context, name: Pointer[Int8, _]) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string containing a description of the simplifier with the given name.

Safe wrapper: Context.simplifier_get_descr (auto)

Z3_simplifier_get_help

def Z3_simplifier_get_help(self, c: Z3_context, t: Z3_simplifier) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string containing a description of parameters accepted by the given simplifier.

Safe wrapper: Simplifier.get_help (auto)

Z3_simplifier_get_param_descrs

def Z3_simplifier_get_param_descrs(self, c: Z3_context, t: Z3_simplifier) raises -> Z3_param_descrs

Return the parameter description set for the given simplifier object.

Safe wrapper: Simplifier.get_param_descrs (auto)

Z3_simplifier_using_params

def Z3_simplifier_using_params(self, c: Z3_context, t: Z3_simplifier, p: Z3_params) raises -> Z3_simplifier

Return a simplifier that applies t using the given set of parameters.

Safe wrapper: Simplifier.using_params (auto)

Z3_solver_add_simplifier

def Z3_solver_add_simplifier(self, c: Z3_context, solver: Z3_solver, simplifier: Z3_simplifier) raises -> Z3_solver

Attach simplifier to a solver. The solver will use the simplifier for incremental pre-processing.

Safe wrapper: Solver.add_simplifier (auto)

Z3_tactic_and_then

def Z3_tactic_and_then(self, c: Z3_context, t1: Z3_tactic, t2: Z3_tactic) raises -> Z3_tactic

Return a tactic that applies t1 to a given goal and t2 to every subgoal produced by t1.

Safe wrapper: Tactic.and_then (manual)

Z3_tactic_apply

def Z3_tactic_apply(self, c: Z3_context, t: Z3_tactic, g: Z3_goal) raises -> Z3_apply_result

Apply tactic t to the goal g.

See also: Z3_tactic_apply_ex

Safe wrapper: Tactic.apply (manual)

Z3_tactic_apply_ex

def Z3_tactic_apply_ex(self, c: Z3_context, t: Z3_tactic, g: Z3_goal, p: Z3_params) raises -> Z3_apply_result

Apply tactic t to the goal g using the parameter set p.

See also: Z3_tactic_apply

Safe wrapper: Tactic.apply_ex (auto)

Z3_tactic_cond

def Z3_tactic_cond(self, c: Z3_context, p: Z3_probe, t1: Z3_tactic, t2: Z3_tactic) raises -> Z3_tactic

Return a tactic that applies t1 to a given goal if the probe p evaluates to true, and t2 if p evaluates to false.

Safe wrapper: Context.tactic_cond (auto)

Z3_tactic_fail

def Z3_tactic_fail(self, c: Z3_context) raises -> Z3_tactic

Return a tactic that always fails.

Safe wrapper: Context.tactic_fail (auto)

Z3_tactic_fail_if

def Z3_tactic_fail_if(self, c: Z3_context, p: Z3_probe) raises -> Z3_tactic

Return a tactic that fails if the probe p evaluates to false.

Safe wrapper: Context.tactic_fail_if (auto)

Z3_tactic_fail_if_not_decided

def Z3_tactic_fail_if_not_decided(self, c: Z3_context) raises -> Z3_tactic

Return a tactic that fails if the goal is not trivially satisfiable (i.e., empty) or trivially unsatisfiable (i.e., contains false).

Safe wrapper: Context.tactic_fail_if_not_decided (auto)

Z3_tactic_get_descr

def Z3_tactic_get_descr(self, c: Z3_context, name: Pointer[Int8, _]) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string containing a description of the tactic with the given name.

Safe wrapper: Context.tactic_get_descr (auto)

Z3_tactic_get_help

def Z3_tactic_get_help(self, c: Z3_context, t: Z3_tactic) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string containing a description of parameters accepted by the given tactic.

Safe wrapper: Tactic.get_help (auto)

Z3_tactic_get_param_descrs

def Z3_tactic_get_param_descrs(self, c: Z3_context, t: Z3_tactic) raises -> Z3_param_descrs

Return the parameter description set for the given tactic object.

Safe wrapper: Tactic.get_param_descrs (auto)

Z3_tactic_or_else

def Z3_tactic_or_else(self, c: Z3_context, t1: Z3_tactic, t2: Z3_tactic) raises -> Z3_tactic

Return a tactic that first applies t1 to a given goal, if it fails then returns the result of t2 applied to the given goal.

Safe wrapper: Tactic.or_else (manual)

Z3_tactic_par_and_then

def Z3_tactic_par_and_then(self, c: Z3_context, t1: Z3_tactic, t2: Z3_tactic) raises -> Z3_tactic

Return a tactic that applies t1 to a given goal and then t2 to every subgoal produced by t1. The subgoals are processed in parallel.

Safe wrapper: Tactic.par_and_then (auto)

Z3_tactic_par_or

def Z3_tactic_par_or(self, c: Z3_context, num: UInt32, ts: Pointer[Z3_tactic, _]) raises -> Z3_tactic

Return a tactic that applies the given tactics in parallel.

Safe wrapper: Context.tactic_par_or (auto)

Z3_tactic_repeat

def Z3_tactic_repeat(self, c: Z3_context, t: Z3_tactic, max: UInt32) raises -> Z3_tactic

Return a tactic that keeps applying t until the goal is not modified anymore or the maximum number of iterations max is reached.

Safe wrapper: Tactic.repeat (auto)

Z3_tactic_skip

def Z3_tactic_skip(self, c: Z3_context) raises -> Z3_tactic

Return a tactic that just return the given goal.

Safe wrapper: Context.tactic_skip (auto)

Z3_tactic_try_for

def Z3_tactic_try_for(self, c: Z3_context, t: Z3_tactic, ms: UInt32) raises -> Z3_tactic

Return a tactic that applies t to a given goal for ms milliseconds. If t does not terminate in ms milliseconds, then it fails.

Safe wrapper: Tactic.try_for (manual)

Z3_tactic_using_params

def Z3_tactic_using_params(self, c: Z3_context, t: Z3_tactic, p: Z3_params) raises -> Z3_tactic

Return a tactic that applies t using the given set of parameters.

Safe wrapper: Tactic.with_params (manual)

Z3_tactic_when

def Z3_tactic_when(self, c: Z3_context, p: Z3_probe, t: Z3_tactic) raises -> Z3_tactic

Return a tactic that applies t to a given goal is the probe p evaluates to true. If p evaluates to false, then the new tactic behaves like the skip tactic.

Safe wrapper: Context.tactic_when (auto)

Solvers (54)

Z3_get_implied_equalities

def Z3_get_implied_equalities(self, c: Z3_context, s: Z3_solver, num_terms: UInt32, terms: Pointer[Z3_ast, _], class_ids: Pointer[mut=True, UInt32, _]) raises -> Lbool

Retrieve congruence class representatives for terms.

The function can be used for relying on Z3 to identify equal terms under the current set of assumptions. The array of terms and array of class identifiers should have the same length. The class identifiers are numerals that are assigned to the same value for their corresponding terms if the current context forces the terms to be equal. You cannot deduce that terms corresponding to different numerals must be all different, (especially when using non-convex theories). All implied equalities are returned by this call. This means that two terms map to the same class identifier if and only if the current context implies that they are equal.

A side-effect of the function is a satisfiability check on the assertions on the solver that is passed in. The function return Z3_L_FALSE if the current assertions are not satisfiable.

Safe wrapper: Solver.get_implied_equalities (manual)

Z3_mk_simple_solver

def Z3_mk_simple_solver(self, c: Z3_context) raises -> Z3_solver

Create a new incremental solver.

This is equivalent to applying the "smt" tactic.

Unlike Z3_mk_solver() this solver

  • Does not attempt to apply any logic specific tactics.
  • Does not change its behaviour based on whether it used incrementally/non-incrementally.

Note that these differences can result in very different performance compared to Z3_mk_solver().

The function Z3_solver_get_model retrieves a model if the assertions is satisfiable (i.e., the result is Z3_L_TRUE) and model construction is enabled. The function Z3_solver_get_model can also be used even if the result is Z3_L_UNDEF, but the returned model is not guaranteed to satisfy quantified assertions.

Note: User must use Z3_solver_inc_ref and Z3_solver_dec_ref to manage solver objects. Even if the context was created using Z3_mk_context instead of Z3_mk_context_rc.

See also: Z3_mk_solver, Z3_mk_solver_for_logic, Z3_mk_solver_from_tactic

Safe wrapper: Context.mk_simple_solver (auto)

Z3_mk_solver

def Z3_mk_solver(self, c: Z3_context) raises -> Z3_solver

Create a new solver. This solver is a "combined solver" (see combined_solver module) that internally uses a non-incremental (solver1) and an incremental solver (solver2). This combined solver changes its behaviour based on how it is used and how its parameters are set.

If the solver is used in a non incremental way (i.e. no calls to Z3_solver_push() or Z3_solver_pop(), and no calls to Z3_solver_assert() or Z3_solver_assert_and_track() after checking satisfiability without an intervening Z3_solver_reset()) then solver1 will be used. This solver will apply Z3's "default" tactic.

The "default" tactic will attempt to probe the logic used by the assertions and will apply a specialized tactic if one is supported. Otherwise the general (and-then simplify smt) tactic will be used.

If the solver is used in an incremental way then the combined solver will switch to using solver2 (which behaves similarly to the general "smt" tactic).

Note however it is possible to set the solver2_timeout, solver2_unknown, and ignore_solver1 parameters of the combined solver to change its behaviour.

The function Z3_solver_get_model retrieves a model if the assertions is satisfiable (i.e., the result is Z3_L_TRUE) and model construction is enabled. The function Z3_solver_get_model can also be used even if the result is Z3_L_UNDEF, but the returned model is not guaranteed to satisfy quantified assertions.

Note: User must use Z3_solver_inc_ref and Z3_solver_dec_ref to manage solver objects. Even if the context was created using Z3_mk_context instead of Z3_mk_context_rc.

See also: Z3_mk_simple_solver, Z3_mk_solver_for_logic, Z3_mk_solver_from_tactic

Safe wrapper: Solver.__init__ (manual)

Z3_mk_solver_for_logic

def Z3_mk_solver_for_logic(self, c: Z3_context, logic: Z3_symbol) raises -> Z3_solver

Create a new solver customized for the given logic. It behaves like Z3_mk_solver if the logic is unknown or unsupported.

Note: User must use Z3_solver_inc_ref and Z3_solver_dec_ref to manage solver objects. Even if the context was created using Z3_mk_context instead of Z3_mk_context_rc.

See also: Z3_mk_solver, Z3_mk_simple_solver, Z3_mk_solver_from_tactic

Safe wrapper: Solver.for_logic (manual)

Z3_mk_solver_from_tactic

def Z3_mk_solver_from_tactic(self, c: Z3_context, t: Z3_tactic) raises -> Z3_solver

Create a new solver that is implemented using the given tactic. The solver supports the commands Z3_solver_push and Z3_solver_pop, but it will always solve each Z3_solver_check from scratch.

Note: User must use Z3_solver_inc_ref and Z3_solver_dec_ref to manage solver objects. Even if the context was created using Z3_mk_context instead of Z3_mk_context_rc.

See also: Z3_mk_solver, Z3_mk_simple_solver, Z3_mk_solver_for_logic

Safe wrapper: Tactic.to_solver (manual)

Z3_solver_assert

def Z3_solver_assert(self, c: Z3_context, s: Z3_solver, a: Z3_ast) raises

Assert a constraint into the solver.

The functions Z3_solver_check and Z3_solver_check_assumptions should be used to check whether the logical context is consistent or not.

Z3_solver_assert_and_track

def Z3_solver_assert_and_track(self, c: Z3_context, s: Z3_solver, a: Z3_ast, p: Z3_ast) raises

Assert a constraint a into the solver, and track it (in the unsat) core using the Boolean constant p.

This API is an alternative to Z3_solver_check_assumptions for extracting unsat cores. Both APIs can be used in the same solver. The unsat core will contain a combination of the Boolean variables provided using Z3_solver_assert_and_track and the Boolean literals provided using Z3_solver_check_assumptions.

Preconditions:

  • a must be a Boolean expression
  • p must be a Boolean constant (aka variable).

See also: Z3_solver_assert, Z3_solver_reset

Safe wrapper: Solver.assert_and_track (manual)

Z3_solver_check

def Z3_solver_check(self, c: Z3_context, s: Z3_solver) raises -> Lbool

Check whether the assertions in a given solver are consistent or not.

The function Z3_solver_get_model retrieves a model if the assertions is satisfiable (i.e., the result is Z3_L_TRUE) and model construction is enabled. Note that if the call returns Z3_L_UNDEF, Z3 does not ensure that calls to Z3_solver_get_model succeed and any models produced in this case are not guaranteed to satisfy the assertions.

The function Z3_solver_get_proof retrieves a proof if proof generation was enabled when the context was created, and the assertions are unsatisfiable (i.e., the result is Z3_L_FALSE).

See also: Z3_solver_check_assumptions

Safe wrapper: Solver.check (manual)

Z3_solver_check_assumptions

def Z3_solver_check_assumptions(self, c: Z3_context, s: Z3_solver, num_assumptions: UInt32, assumptions: Pointer[Z3_ast, _]) raises -> Lbool

Check whether the assertions in the given solver and optional assumptions are consistent or not.

The function Z3_solver_get_unsat_core retrieves the subset of the assumptions used in the unsatisfiability proof produced by Z3.

See also: Z3_solver_check

Safe wrapper: Solver.check_assumptions (manual)

Z3_solver_congruence_explain

def Z3_solver_congruence_explain(self, c: Z3_context, s: Z3_solver, a: Z3_ast, b: Z3_ast) raises -> Z3_ast

retrieve explanation for congruence.

Precondition: root(a) = root(b)

Safe wrapper: Solver.congruence_explain (auto)

Z3_solver_congruence_next

def Z3_solver_congruence_next(self, c: Z3_context, s: Z3_solver, a: Z3_ast) raises -> Z3_ast

retrieve the next expression in the congruence class. The set of congruent siblings form a cyclic list. Repeated calls on the siblings will result in returning to the original expression.

Safe wrapper: Solver.congruence_next (auto)

Z3_solver_congruence_root

def Z3_solver_congruence_root(self, c: Z3_context, s: Z3_solver, a: Z3_ast) raises -> Z3_ast

retrieve the congruence closure root of an expression. The root is retrieved relative to the state where the solver was in when it completed. If it completed during a set of case splits, the congruence roots are relative to these case splits. That is, the congruences are not consequences but they are true under the current state.

Safe wrapper: Solver.congruence_root (auto)

Z3_solver_cube

def Z3_solver_cube(self, c: Z3_context, s: Z3_solver, vars: Z3_ast_vector, backtrack_level: UInt32) raises -> Z3_ast_vector

extract a next cube for a solver. The last cube is the constant true or false. The number of (non-constant) cubes is by default 1. For the sat solver cubing is controlled using parameters sat.lookahead.cube.cutoff and sat.lookahead.cube.fraction.

The third argument is a vector of variables that may be used for cubing. The contents of the vector is only used in the first call. The initial list of variables is used in subsequent calls until it returns the unsatisfiable cube. The vector is modified to contain a set of Autarky variables that occur in clauses that are affected by the (last literal in the) cube. These variables could be used by a different cuber (on a different solver object) for further recursive cubing.

The last argument is a backtracking level. It instructs the cube process to backtrack below the indicated level for the next cube.

Safe wrapper: Solver.cube (auto)

Z3_solver_from_file

def Z3_solver_from_file(self, c: Z3_context, s: Z3_solver, file_name: Pointer[Int8, _]) raises

load solver assertions from a file.

Z3_solver_from_string

def Z3_solver_from_string(self, c: Z3_context, s: Z3_solver, str: Pointer[Int8, _]) raises

load solver assertions from a string.

See also: Z3_solver_from_file, Z3_solver_to_string

Safe wrapper: Solver.from_string (manual)

Z3_solver_get_assertions

def Z3_solver_get_assertions(self, c: Z3_context, s: Z3_solver) raises -> Z3_ast_vector

Return the set of asserted formulas on the solver.

Safe wrapper: Solver.assertions (manual)

Z3_solver_get_consequences

def Z3_solver_get_consequences(self, c: Z3_context, s: Z3_solver, assumptions: Z3_ast_vector, variables: Z3_ast_vector, consequences: Z3_ast_vector) raises -> Lbool

retrieve consequences from solver that determine values of the supplied function symbols.

Safe wrapper: Solver.get_consequences (auto)

Z3_solver_get_help

def Z3_solver_get_help(self, c: Z3_context, s: Z3_solver) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string describing all solver available parameters.

Z3_solver_get_levels

def Z3_solver_get_levels(self, c: Z3_context, s: Z3_solver, literals: Z3_ast_vector, sz: UInt32, levels: Pointer[mut=True, UInt32, _]) raises

retrieve the decision depth of Boolean literals (variables or their negations). Assumes a check-sat call and no other calls (to extract models) have been invoked.

Safe wrapper: Solver.get_levels (manual)

Z3_solver_get_model

def Z3_solver_get_model(self, c: Z3_context, s: Z3_solver) raises -> Z3_model

Retrieve the model for the last Z3_solver_check or Z3_solver_check_assumptions

The error handler is invoked if a model is not available because the commands above were not invoked for the given solver, or if the result was Z3_L_FALSE.

Safe wrapper: Solver.get_model (manual)

Z3_solver_get_non_units

def Z3_solver_get_non_units(self, c: Z3_context, s: Z3_solver) raises -> Z3_ast_vector

Return the set of non units in the solver state.

Safe wrapper: Solver.get_non_units (auto)

Z3_solver_get_num_scopes

def Z3_solver_get_num_scopes(self, c: Z3_context, s: Z3_solver) raises -> UInt32

Return the number of backtracking points.

See also: Z3_solver_push, Z3_solver_pop

Safe wrapper: Solver.get_num_scopes (auto)

Z3_solver_get_param_descrs

def Z3_solver_get_param_descrs(self, c: Z3_context, s: Z3_solver) raises -> Z3_param_descrs

Return the parameter description set for the given solver object.

Z3_solver_get_proof

def Z3_solver_get_proof(self, c: Z3_context, s: Z3_solver) raises -> Z3_ast

Retrieve the proof for the last Z3_solver_check or Z3_solver_check_assumptions

The error handler is invoked if proof generation is not enabled, or if the commands above were not invoked for the given solver, or if the result was different from Z3_L_FALSE.

Safe wrapper: Solver.get_proof (auto)

Z3_solver_get_reason_unknown

def Z3_solver_get_reason_unknown(self, c: Z3_context, s: Z3_solver) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a brief justification for an "unknown" result (i.e., Z3_L_UNDEF) for the commands Z3_solver_check and Z3_solver_check_assumptions

Safe wrapper: Solver.reason_unknown (manual)

Z3_solver_get_statistics

def Z3_solver_get_statistics(self, c: Z3_context, s: Z3_solver) raises -> Z3_stats

Return statistics for the given solver.

Note: User must use Z3_stats_inc_ref and Z3_stats_dec_ref to manage Z3_stats objects.

Safe wrapper: Solver.get_statistics (auto)

Z3_solver_get_trail

def Z3_solver_get_trail(self, c: Z3_context, s: Z3_solver) raises -> Z3_ast_vector

Return the trail modulo model conversion, in order of decision level The decision level can be retrieved using Z3_solver_get_level based on the trail.

Safe wrapper: Solver.get_trail (auto)

Z3_solver_get_units

def Z3_solver_get_units(self, c: Z3_context, s: Z3_solver) raises -> Z3_ast_vector

Return the set of units modulo model conversion.

Safe wrapper: Solver.get_units (auto)

Z3_solver_get_unsat_core

def Z3_solver_get_unsat_core(self, c: Z3_context, s: Z3_solver) raises -> Z3_ast_vector

Retrieve the unsat core for the last Z3_solver_check_assumptions The unsat core is a subset of the assumptions a.

By default, the unsat core will not be minimized. Generation of a minimized unsat core can be enabled via the "sat.core.minimize" and "smt.core.minimize" settings for SAT and SMT cores respectively. Generation of minimized unsat cores will be more expensive.

Safe wrapper: Solver.get_unsat_core (manual)

Z3_solver_import_model_converter

def Z3_solver_import_model_converter(self, ctx: Z3_context, src: Z3_solver, dst: Z3_solver) raises

Ad-hoc method for importing model conversion from solver.

This method is used for scenarios where src has been used to solve a set of formulas and was interrupted. The dst solver may be a strengthening of src obtained from cubing (assigning a subset of literals or adding constraints over the assertions available in src). If dst ends up being satisfiable, the model for dst may not correspond to a model of the original formula due to inprocessing in src. This method is used to take the side-effect of inprocessing into account when returning a model for dst.

Safe wrapper: Solver.import_model_converter (auto)

Z3_solver_interrupt

def Z3_solver_interrupt(self, c: Z3_context, s: Z3_solver) raises

Solver local interrupt. Normally you should use Z3_interrupt to cancel solvers because only one solver is enabled concurrently per context. However, per GitHub issue #1006, there are use cases where it is more convenient to cancel a specific solver. Solvers that are not selected for interrupts are left alone.

Safe wrapper: Solver.interrupt (auto)

Z3_solver_next_split

def Z3_solver_next_split(self, c: Z3_context, cb: Z3_solver_callback, t: Z3_ast, idx: UInt32, phase: Lbool) raises -> Bool

Sets the next (registered) expression to split on. The function returns false and ignores the given expression in case the expression is already assigned internally (due to relevancy propagation, this assignments might not have been reported yet by the fixed callback). In case the function is called in the decide callback, it overrides the currently selected variable and phase.

Safe wrapper: Context.solver_next_split (auto)

Z3_solver_pop

def Z3_solver_pop(self, c: Z3_context, s: Z3_solver, n: UInt32) raises

Backtrack n backtracking points.

Precondition: n <= Z3_solver_get_num_scopes(c, s)

See also: Z3_solver_get_num_scopes, Z3_solver_push

Safe wrapper: Solver.pop (manual)

Z3_solver_propagate_consequence

def Z3_solver_propagate_consequence(self, c: Z3_context, cb: Z3_solver_callback, num_fixed: UInt32, fixed: Pointer[Z3_ast, _], num_eqs: UInt32, eq_lhs: Pointer[Z3_ast, _], eq_rhs: Pointer[Z3_ast, _], conseq: Z3_ast) raises -> Bool

propagate a consequence based on fixed values and equalities. A client may invoke it during the propagate_fixed, propagate_eq, propagate_diseq, and propagate_final callbacks. The callback adds a propagation consequence based on the fixed values passed in fixed and equalities between eq_lhs and eq_rhs.

The solver might discard the propagation in case it is true in the current state. The function returns false in this case; otw. the function returns true. At least one propagation in the final callback has to return true in order to prevent the solver from finishing.

Parameters:

  • c — - context
  • cb — - solver callback
  • num_fixed — - number of fixed terms used as premise to propagation
  • fixed — - array of length num_fixed containing terms that are fixed in the current scope
  • num_eqs — - number of equalities used as premise to propagation
  • eq_lhs — - left side of equalities
  • eq_rhs — - right side of equalities
  • conseq — - consequence to propagate. It is typically an atomic formula, but it can be an arbitrary formula.

Safe wrapper: SolverCallback.consequence (auto)

Z3_solver_propagate_created

def Z3_solver_propagate_created(self, c: Z3_context, s: Z3_solver, created_eh: Ptr) raises

register a callback when a new expression with a registered function is used by the solver The registered function appears at the top level and is created using Z3_solver_propagate_declare.

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_decide

def Z3_solver_propagate_decide(self, c: Z3_context, s: Z3_solver, decide_eh: Ptr) raises

register a callback when the solver decides to split on a registered expression. The callback may change the arguments by providing other values by calling Z3_solver_next_split

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_declare

def Z3_solver_propagate_declare(self, c: Z3_context, name: Z3_symbol, n: UInt32, domain: Pointer[mut=True, Z3_sort, _], range: Z3_sort) raises -> Z3_func_decl

Create uninterpreted function declaration for the user propagator. When expressions using the function are created by the solver invoke a callback to Z3_solver_propagate_created with arguments

  1. context and callback solve
  2. declared_expr: expression using function that was used as the top-level symbol
  3. declared_id: a unique identifier (unique within the current scope) to track the expression.

Safe wrapper: Context.solver_propagate_declare (auto)

Z3_solver_propagate_diseq

def Z3_solver_propagate_diseq(self, c: Z3_context, s: Z3_solver, eq_eh: Ptr) raises

register a callback on expression dis-equalities.

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_eq

def Z3_solver_propagate_eq(self, c: Z3_context, s: Z3_solver, eq_eh: Ptr) raises

register a callback on expression equalities.

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_final

def Z3_solver_propagate_final(self, c: Z3_context, s: Z3_solver, final_eh: Ptr) raises

register a callback on final check. This provides freedom to the propagator to delay actions or implement a branch-and bound solver. The final check is invoked when all decision variables have been assigned by the solver.

The final_eh callback takes as argument the original user_context that was used when calling Z3_solver_propagate_init, and it takes a callback context with the opaque type Z3_solver_callback. The callback context is passed as argument to invoke the Z3_solver_propagate_consequence function. The callback context can only be accessed (for propagation and for dynamically registering expressions) within a callback. If the callback context gets used for propagation or conflicts, those propagations take effect and may trigger new decision variables to be set.

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_fixed

def Z3_solver_propagate_fixed(self, c: Z3_context, s: Z3_solver, fixed_eh: Ptr) raises

register a callback for when an expression is bound to a fixed value. The supported expression types are - Booleans - Bit-vectors

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_init

def Z3_solver_propagate_init(self, c: Z3_context, s: Z3_solver, user_context: Pointer[mut=True, NoneType, _], push_eh: Ptr, pop_eh: Ptr, fresh_eh: Ptr) raises

register a user-propagator with the solver.

Parameters:

  • c — - context.
  • s — - solver object.
  • user_context — - a context used to maintain state for callbacks.
  • push_eh — - a callback invoked when scopes are pushed
  • pop_eh — - a callback invoked when scopes are popped
  • fresh_eh — - a solver may spawn new solvers internally. This callback is used to produce a fresh user_context to be associated with fresh solvers.

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_on_binding

def Z3_solver_propagate_on_binding(self, c: Z3_context, s: Z3_solver, on_binding_eh: Ptr) raises

register a callback when the solver instantiates a quantifier. If the callback returns false, the actual instantiation of the quantifier is blocked. This allows the user propagator selectively prioritize instantiations without relying on default or configured weights.

Safe wrapper: Solver.set_propagator (manual)

Z3_solver_propagate_register

def Z3_solver_propagate_register(self, c: Z3_context, s: Z3_solver, e: Z3_ast) raises

register an expression to propagate on with the solver. Only expressions of type Bool and type Bit-Vector can be registered for propagation.

Safe wrapper: Solver.propagate_register (auto)

Z3_solver_propagate_register_cb

def Z3_solver_propagate_register_cb(self, c: Z3_context, cb: Z3_solver_callback, e: Z3_ast) raises

register an expression to propagate on with the solver. Only expressions of type Bool and type Bit-Vector can be registered for propagation. Unlike Z3_solver_propagate_register, this function takes a solver callback context as argument. It can be invoked during a callback to register new expressions.

Safe wrapper: SolverCallback.register_cb (auto)

Z3_solver_push

def Z3_solver_push(self, c: Z3_context, s: Z3_solver) raises

Create a backtracking point.

The solver contains a stack of assertions.

See also: Z3_solver_get_num_scopes, Z3_solver_pop

Safe wrapper: Solver.push (manual)

Z3_solver_register_on_clause

def Z3_solver_register_on_clause(self, c: Z3_context, s: Z3_solver, user_context: Pointer[mut=True, NoneType, _], on_clause_eh: Ptr) raises

register a callback to that retrieves assumed, inferred and deleted clauses during search.

Parameters:

  • c — - context.
  • s — - solver object.
  • user_context — - a context used to maintain state for callbacks.
  • on_clause_eh — - a callback that is invoked by when a clause is - asserted to the CDCL engine (corresponding to an input clause after pre-processing) - inferred by CDCL(T) using either a SAT or theory conflict/propagation - deleted by the CDCL(T) engine

Safe wrapper: Solver.register_on_clause (manual)

Z3_solver_reset

def Z3_solver_reset(self, c: Z3_context, s: Z3_solver) raises

Remove all assertions from the solver.

See also: Z3_solver_assert, Z3_solver_assert_and_track

Safe wrapper: Solver.reset (manual)

Z3_solver_set_initial_value

def Z3_solver_set_initial_value(self, c: Z3_context, s: Z3_solver, v: Z3_ast, val: Z3_ast) raises

provide an initialization hint to the solver. The initialization hint is used to calibrate an initial value of the expression that represents a variable. If the variable is Boolean, the initial phase is set according to value. If the variable is an integer or real, the initial Simplex tableau is recalibrated to attempt to follow the value assignment.

Safe wrapper: Solver.set_initial_value (auto)

Z3_solver_set_params

def Z3_solver_set_params(self, c: Z3_context, s: Z3_solver, p: Z3_params) raises

Set the given solver using the given parameters.

Z3_solver_solve_for

def Z3_solver_solve_for(self, c: Z3_context, s: Z3_solver, variables: Z3_ast_vector, terms: Z3_ast_vector, guards: Z3_ast_vector) raises

retrieve a 'solution' for variables as defined by equalities in maintained by solvers. At this point, only linear solution are supported. The solution to variables may be presented in triangular form, such that variables used in solutions themselves have solutions.

Safe wrapper: Solver.solve_for (auto)

Z3_solver_to_dimacs_string

def Z3_solver_to_dimacs_string(self, c: Z3_context, s: Z3_solver, include_names: Bool) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert a solver into a DIMACS formatted string.

See also: Z3_goal_to_dimacs_string

Safe wrapper: Solver.to_dimacs_string (auto)

Z3_solver_to_string

def Z3_solver_to_string(self, c: Z3_context, s: Z3_solver) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert a solver into a string.

See also: Z3_solver_from_file, Z3_solver_from_string

Safe wrapper: Solver.to_string (manual)

Z3_solver_translate

def Z3_solver_translate(self, source: Z3_context, s: Z3_solver, target: Z3_context) raises -> Z3_solver

Copy a solver s from the context source to the context target.

Safe wrapper: Solver.translate (auto)

Statistics (8)

Z3_get_estimated_alloc_size

def Z3_get_estimated_alloc_size(self) -> UInt64

Return the estimated allocated memory in bytes.

Safe wrapper: get_estimated_alloc_size (auto)

Z3_stats_get_double_value

def Z3_stats_get_double_value(self, c: Z3_context, s: Z3_stats, idx: UInt32) raises -> Float64

Return the double value of the given statistical data.

Precondition: idx < Z3_stats_size(c, s) && Z3_stats_is_double(c, s)

Safe wrapper: Stats.get_double_value (auto)

Z3_stats_get_key

def Z3_stats_get_key(self, c: Z3_context, s: Z3_stats, idx: UInt32) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the key (a string) for a particular statistical data.

Precondition: idx < Z3_stats_size(c, s)

Safe wrapper: Stats.get_key (auto)

Z3_stats_get_uint_value

def Z3_stats_get_uint_value(self, c: Z3_context, s: Z3_stats, idx: UInt32) raises -> UInt32

Return the unsigned value of the given statistical data.

Precondition: idx < Z3_stats_size(c, s) && Z3_stats_is_uint(c, s)

Safe wrapper: Stats.get_uint_value (auto)

Z3_stats_is_double

def Z3_stats_is_double(self, c: Z3_context, s: Z3_stats, idx: UInt32) raises -> Bool

Return true if the given statistical data is a double.

Precondition: idx < Z3_stats_size(c, s)

Safe wrapper: Stats.is_double (auto)

Z3_stats_is_uint

def Z3_stats_is_uint(self, c: Z3_context, s: Z3_stats, idx: UInt32) raises -> Bool

Return true if the given statistical data is a unsigned integer.

Precondition: idx < Z3_stats_size(c, s)

Safe wrapper: Stats.is_uint (auto)

Z3_stats_size

def Z3_stats_size(self, c: Z3_context, s: Z3_stats) raises -> UInt32

Return the number of statistical data in s.

Safe wrapper: Stats.size (auto)

Z3_stats_to_string

def Z3_stats_to_string(self, c: Z3_context, s: Z3_stats) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert a statistics into a string.

Safe wrapper: Stats.to_string (auto)

Lifecycle & refcounting (31 functions — handled automatically by RAII)
C Function Mojo CApi Signature
Z3_apply_result_dec_ref def Z3_apply_result_dec_ref(self, c: Z3_context, r: Z3_apply_result)
Z3_apply_result_inc_ref def Z3_apply_result_inc_ref(self, c: Z3_context, r: Z3_apply_result) raises
Z3_del_config def Z3_del_config(self, c: Z3_config)
Z3_del_constructor def Z3_del_constructor(self, c: Z3_context, constr: Z3_constructor)
Z3_del_constructor_list def Z3_del_constructor_list(self, c: Z3_context, clist: Z3_constructor_list)
Z3_del_context def Z3_del_context(self, c: Z3_context)
Z3_func_entry_dec_ref def Z3_func_entry_dec_ref(self, c: Z3_context, e: Z3_func_entry)
Z3_func_entry_inc_ref def Z3_func_entry_inc_ref(self, c: Z3_context, e: Z3_func_entry) raises
Z3_func_interp_dec_ref def Z3_func_interp_dec_ref(self, c: Z3_context, f: Z3_func_interp)
Z3_func_interp_inc_ref def Z3_func_interp_inc_ref(self, c: Z3_context, f: Z3_func_interp) raises
Z3_goal_dec_ref def Z3_goal_dec_ref(self, c: Z3_context, g: Z3_goal)
Z3_goal_inc_ref def Z3_goal_inc_ref(self, c: Z3_context, g: Z3_goal) raises
Z3_model_dec_ref def Z3_model_dec_ref(self, c: Z3_context, m: Z3_model)
Z3_model_inc_ref def Z3_model_inc_ref(self, c: Z3_context, m: Z3_model) raises
Z3_param_descrs_dec_ref def Z3_param_descrs_dec_ref(self, c: Z3_context, p: Z3_param_descrs)
Z3_param_descrs_inc_ref def Z3_param_descrs_inc_ref(self, c: Z3_context, p: Z3_param_descrs) raises
Z3_params_dec_ref def Z3_params_dec_ref(self, c: Z3_context, p: Z3_params)
Z3_params_inc_ref def Z3_params_inc_ref(self, c: Z3_context, p: Z3_params) raises
Z3_parser_context_dec_ref def Z3_parser_context_dec_ref(self, c: Z3_context, pc: Z3_parser_context)
Z3_parser_context_inc_ref def Z3_parser_context_inc_ref(self, c: Z3_context, pc: Z3_parser_context) raises
Z3_probe_dec_ref def Z3_probe_dec_ref(self, c: Z3_context, p: Z3_probe)
Z3_probe_inc_ref def Z3_probe_inc_ref(self, c: Z3_context, p: Z3_probe) raises
Z3_set_error_handler def Z3_set_error_handler(self, c: Z3_context, h: Ptr)
Z3_simplifier_dec_ref def Z3_simplifier_dec_ref(self, c: Z3_context, g: Z3_simplifier)
Z3_simplifier_inc_ref def Z3_simplifier_inc_ref(self, c: Z3_context, t: Z3_simplifier) raises
Z3_solver_dec_ref def Z3_solver_dec_ref(self, c: Z3_context, s: Z3_solver)
Z3_solver_inc_ref def Z3_solver_inc_ref(self, c: Z3_context, s: Z3_solver) raises
Z3_stats_dec_ref def Z3_stats_dec_ref(self, c: Z3_context, s: Z3_stats)
Z3_stats_inc_ref def Z3_stats_inc_ref(self, c: Z3_context, s: Z3_stats) raises
Z3_tactic_dec_ref def Z3_tactic_dec_ref(self, c: Z3_context, g: Z3_tactic)
Z3_tactic_inc_ref def Z3_tactic_inc_ref(self, c: Z3_context, t: Z3_tactic) raises

z3_algebraic.h (21 functions)

Algebraic Numbers (21)

Z3_algebraic_add

def Z3_algebraic_add(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Z3_ast

Return the value a + b.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Postcondition: Z3_algebraic_is_value(c, result)

Safe wrapper: Context.algebraic_add (auto)

Z3_algebraic_div

def Z3_algebraic_div(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Z3_ast

Return the value a / b.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)
  • !Z3_algebraic_is_zero(c, b)

Postcondition: Z3_algebraic_is_value(c, result)

Safe wrapper: Context.algebraic_div (auto)

Z3_algebraic_eq

def Z3_algebraic_eq(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Bool

Return true if a == b, and false otherwise.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Safe wrapper: Context.algebraic_eq (auto)

Z3_algebraic_eval

def Z3_algebraic_eval(self, c: Z3_context, p: Z3_ast, n: UInt32, a: Pointer[mut=True, Z3_ast, _]) raises -> Int32

Given a multivariate polynomial p(x_0, ..., x_{n-1}), return the sign of p(a[0], ..., a[n-1]).

Preconditions:

  • p is a Z3 expression that contains only arithmetic terms and free variables.
  • forall i in [0, n) Z3_algebraic_is_value(c, a[i])

Safe wrapper: Context.algebraic_eval (auto)

Z3_algebraic_ge

def Z3_algebraic_ge(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Bool

Return true if a >= b, and false otherwise.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Safe wrapper: Context.algebraic_ge (auto)

Z3_algebraic_get_i

def Z3_algebraic_get_i(self, c: Z3_context, a: Z3_ast) raises -> UInt32

Return which root of the polynomial the algebraic number represents.

Precondition: Z3_is_algebraic_number(c, a)

Safe wrapper: Context.algebraic_get_i (auto)

Z3_algebraic_get_poly

def Z3_algebraic_get_poly(self, c: Z3_context, a: Z3_ast) raises -> Z3_ast_vector

Return the coefficients of the defining polynomial.

Precondition: Z3_is_algebraic_number(c, a)

Safe wrapper: Context.algebraic_get_poly (auto)

Z3_algebraic_gt

def Z3_algebraic_gt(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Bool

Return true if a > b, and false otherwise.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Safe wrapper: Context.algebraic_gt (auto)

Z3_algebraic_is_neg

def Z3_algebraic_is_neg(self, c: Z3_context, a: Z3_ast) raises -> Bool

Return true if a is negative, and false otherwise.

Precondition: Z3_algebraic_is_value(c, a)

Safe wrapper: Context.algebraic_is_neg (auto)

Z3_algebraic_is_pos

def Z3_algebraic_is_pos(self, c: Z3_context, a: Z3_ast) raises -> Bool

Return true if a is positive, and false otherwise.

Precondition: Z3_algebraic_is_value(c, a)

Safe wrapper: Context.algebraic_is_pos (auto)

Z3_algebraic_is_value

def Z3_algebraic_is_value(self, c: Z3_context, a: Z3_ast) raises -> Bool

Return true if a can be used as value in the Z3 real algebraic number package.

Safe wrapper: Context.algebraic_is_value (auto)

Z3_algebraic_is_zero

def Z3_algebraic_is_zero(self, c: Z3_context, a: Z3_ast) raises -> Bool

Return true if a is zero, and false otherwise.

Precondition: Z3_algebraic_is_value(c, a)

Safe wrapper: Context.algebraic_is_zero (auto)

Z3_algebraic_le

def Z3_algebraic_le(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Bool

Return true if a <= b, and false otherwise.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Safe wrapper: Context.algebraic_le (auto)

Z3_algebraic_lt

def Z3_algebraic_lt(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Bool

Return true if a < b, and false otherwise.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Safe wrapper: Context.algebraic_lt (auto)

Z3_algebraic_mul

def Z3_algebraic_mul(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Z3_ast

Return the value a * b.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Postcondition: Z3_algebraic_is_value(c, result)

Safe wrapper: Context.algebraic_mul (auto)

Z3_algebraic_neq

def Z3_algebraic_neq(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Bool

Return true if a != b, and false otherwise.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Safe wrapper: Context.algebraic_neq (auto)

Z3_algebraic_power

def Z3_algebraic_power(self, c: Z3_context, a: Z3_ast, k: UInt32) raises -> Z3_ast

Return the a^k

Precondition: Z3_algebraic_is_value(c, a)

Postcondition: Z3_algebraic_is_value(c, result)

Safe wrapper: Context.algebraic_power (auto)

Z3_algebraic_root

def Z3_algebraic_root(self, c: Z3_context, a: Z3_ast, k: UInt32) raises -> Z3_ast

Return the a^(1/k)

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • k is even => !Z3_algebraic_is_neg(c, a)

Postcondition: Z3_algebraic_is_value(c, result)

Safe wrapper: Context.algebraic_root (auto)

Z3_algebraic_roots

def Z3_algebraic_roots(self, c: Z3_context, p: Z3_ast, n: UInt32, a: Pointer[mut=True, Z3_ast, _]) raises -> Z3_ast_vector

Given a multivariate polynomial p(x_0, ..., x_{n-1}, x_n), returns the roots of the univariate polynomial p(a[0], ..., a[n-1], x_n).

Preconditions:

  • p is a Z3 expression that contains only arithmetic terms and free variables.
  • forall i in [0, n) Z3_algebraic_is_value(c, a[i])

Postcondition: forall r in result Z3_algebraic_is_value(c, result)

Safe wrapper: Context.algebraic_roots (auto)

Z3_algebraic_sign

def Z3_algebraic_sign(self, c: Z3_context, a: Z3_ast) raises -> Int32

Return 1 if a is positive, 0 if a is zero, and -1 if a is negative.

Precondition: Z3_algebraic_is_value(c, a)

Safe wrapper: Context.algebraic_sign (auto)

Z3_algebraic_sub

def Z3_algebraic_sub(self, c: Z3_context, a: Z3_ast, b: Z3_ast) raises -> Z3_ast

Return the value a - b.

Preconditions:

  • Z3_algebraic_is_value(c, a)
  • Z3_algebraic_is_value(c, b)

Postcondition: Z3_algebraic_is_value(c, result)

Safe wrapper: Context.algebraic_sub (auto)

z3_ast_containers.h (21 functions)

AST vectors (8)

Z3_ast_vector_get

def Z3_ast_vector_get(self, c: Z3_context, v: Z3_ast_vector, i: UInt32) raises -> Z3_ast

Return the AST at position i in the AST vector v.

Precondition: i < Z3_ast_vector_size(c, v)

Safe wrapper: AstVector.get (auto)

Z3_ast_vector_push

def Z3_ast_vector_push(self, c: Z3_context, v: Z3_ast_vector, a: Z3_ast) raises

Add the AST a in the end of the AST vector v. The size of v is increased by one.

Safe wrapper: AstVector.push (auto)

Z3_ast_vector_resize

def Z3_ast_vector_resize(self, c: Z3_context, v: Z3_ast_vector, n: UInt32) raises

Resize the AST vector v.

Safe wrapper: AstVector.resize (auto)

Z3_ast_vector_set

def Z3_ast_vector_set(self, c: Z3_context, v: Z3_ast_vector, i: UInt32, a: Z3_ast) raises

Update position i of the AST vector v with the AST a.

Precondition: i < Z3_ast_vector_size(c, v)

Safe wrapper: AstVector.set (auto)

Z3_ast_vector_size

def Z3_ast_vector_size(self, c: Z3_context, v: Z3_ast_vector) raises -> UInt32

Return the size of the given AST vector.

Safe wrapper: AstVector.size (auto)

Z3_ast_vector_to_string

def Z3_ast_vector_to_string(self, c: Z3_context, v: Z3_ast_vector) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert AST vector into a string.

Safe wrapper: AstVector.to_string (auto)

Z3_ast_vector_translate

def Z3_ast_vector_translate(self, s: Z3_context, v: Z3_ast_vector, t: Z3_context) raises -> Z3_ast_vector

Translate the AST vector v from context s into an AST vector in context t.

Safe wrapper: AstVector.translate (auto)

Z3_mk_ast_vector

def Z3_mk_ast_vector(self, c: Z3_context) raises -> Z3_ast_vector

Return an empty AST vector.

Note: Reference counting must be used to manage AST vectors, even when the Z3_context was created using Z3_mk_context instead of Z3_mk_context_rc.

Safe wrapper: Context.mk_ast_vector (auto)

AST maps (9)

Z3_ast_map_contains

def Z3_ast_map_contains(self, c: Z3_context, m: Z3_ast_map, k: Z3_ast) raises -> Bool

Return true if the map m contains the AST key k.

Safe wrapper: AstMap.contains (auto)

Z3_ast_map_erase

def Z3_ast_map_erase(self, c: Z3_context, m: Z3_ast_map, k: Z3_ast) raises

Erase a key from the map.

Safe wrapper: AstMap.erase (auto)

Z3_ast_map_find

def Z3_ast_map_find(self, c: Z3_context, m: Z3_ast_map, k: Z3_ast) raises -> Z3_ast

Return the value associated with the key k.

The procedure invokes the error handler if k is not in the map.

Safe wrapper: AstMap.find (auto)

Z3_ast_map_insert

def Z3_ast_map_insert(self, c: Z3_context, m: Z3_ast_map, k: Z3_ast, v: Z3_ast) raises

Store/Replace a new key, value pair in the given map.

Safe wrapper: AstMap.insert (auto)

Z3_ast_map_keys

def Z3_ast_map_keys(self, c: Z3_context, m: Z3_ast_map) raises -> Z3_ast_vector

Return the keys stored in the given map.

Safe wrapper: AstMap.keys (auto)

Z3_ast_map_reset

def Z3_ast_map_reset(self, c: Z3_context, m: Z3_ast_map) raises

Remove all keys from the given map.

Safe wrapper: AstMap.reset (auto)

Z3_ast_map_size

def Z3_ast_map_size(self, c: Z3_context, m: Z3_ast_map) raises -> UInt32

Return the size of the given map.

Safe wrapper: AstMap.size (auto)

Z3_ast_map_to_string

def Z3_ast_map_to_string(self, c: Z3_context, m: Z3_ast_map) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert the given map into a string.

Safe wrapper: AstMap.to_string (auto)

Z3_mk_ast_map

def Z3_mk_ast_map(self, c: Z3_context) raises -> Z3_ast_map

Return an empty mapping from AST to AST

Note: Reference counting must be used to manage AST maps, even when the Z3_context was created using Z3_mk_context instead of Z3_mk_context_rc.

Safe wrapper: Context.mk_ast_map (auto)

Lifecycle & refcounting (4 functions — handled automatically by RAII)
C Function Mojo CApi Signature
Z3_ast_map_dec_ref def Z3_ast_map_dec_ref(self, c: Z3_context, m: Z3_ast_map)
Z3_ast_map_inc_ref def Z3_ast_map_inc_ref(self, c: Z3_context, m: Z3_ast_map) raises
Z3_ast_vector_dec_ref def Z3_ast_vector_dec_ref(self, c: Z3_context, v: Z3_ast_vector)
Z3_ast_vector_inc_ref def Z3_ast_vector_inc_ref(self, c: Z3_context, v: Z3_ast_vector) raises

z3_fixedpoint.h (30 functions)

Fixedpoint facilities (28)

Z3_fixedpoint_add_callback

def Z3_fixedpoint_add_callback(self, ctx: Z3_context, f: Z3_fixedpoint, state: Pointer[mut=True, NoneType, _], new_lemma_eh: Ptr, predecessor_eh: Ptr, unfold_eh: Ptr) raises

set export callback for lemmas

Safe wrapper: raw-only (z3_mojo.c) — Raw C callback registration (void* + 3 handlers); available via c_api()

Z3_fixedpoint_add_constraint

def Z3_fixedpoint_add_constraint(self, c: Z3_context, d: Z3_fixedpoint, e: Z3_ast, lvl: UInt32) raises

Safe wrapper: Fixedpoint.add_constraint (auto)

Z3_fixedpoint_add_cover

def Z3_fixedpoint_add_cover(self, c: Z3_context, d: Z3_fixedpoint, level: Int32, pred: Z3_func_decl, property: Z3_ast) raises

Add property about the predicate pred. Add a property of predicate pred at level. It gets pushed forward when possible.

Note: level = -1 is treated as the fixedpoint. So passing -1 for the level means that the property is true of the fixed-point unfolding with respect to pred.

Note: this functionality is PDR specific.

Safe wrapper: Fixedpoint.add_cover (auto)

Z3_fixedpoint_add_fact

def Z3_fixedpoint_add_fact(self, c: Z3_context, d: Z3_fixedpoint, r: Z3_func_decl, num_args: UInt32, args: Pointer[mut=True, UInt32, _]) raises

Add a Database fact.

The number of arguments num_args should be equal to the number of sorts in the domain of r. Each sort in the domain should be an integral (bit-vector, Boolean or or finite domain sort).

The call has the same effect as adding a rule where r is applied to the arguments.

Parameters:

  • c — - context
  • d — - fixed point context
  • r — - relation signature for the row.
  • num_args — - number of columns for the given row.
  • args — - array of the row elements.

Safe wrapper: Fixedpoint.add_fact (auto)

Z3_fixedpoint_add_rule

def Z3_fixedpoint_add_rule(self, c: Z3_context, d: Z3_fixedpoint, rule: Z3_ast, name: Z3_symbol) raises

Add a universal Horn clause as a named rule. The horn_rule should be of the form:

horn_rule ::= (forall (bound-vars) horn_rule)
           |  (=> atoms horn_rule)
           |  atom

Safe wrapper: Fixedpoint.add_rule (auto)

Z3_fixedpoint_assert

def Z3_fixedpoint_assert(self, c: Z3_context, d: Z3_fixedpoint, axiom: Z3_ast) raises

Assert a constraint to the fixedpoint context.

The constraints are used as background axioms when the fixedpoint engine uses the PDR mode. They are ignored for standard Datalog mode.

Safe wrapper: Fixedpoint.assert_ (auto)

Z3_fixedpoint_from_file

def Z3_fixedpoint_from_file(self, c: Z3_context, f: Z3_fixedpoint, s: Pointer[Int8, _]) raises -> Z3_ast_vector

Parse an SMT-LIB2 file with fixedpoint rules. Add the rules to the current fixedpoint context. Return the set of queries in the file.

Parameters:

  • c — - context.
  • f — - fixedpoint context.
  • s — - path to file containing SMT2 specification.

See also: Z3_fixedpoint_from_string, Z3_fixedpoint_to_string

Safe wrapper: Fixedpoint.from_file (auto)

Z3_fixedpoint_from_string

def Z3_fixedpoint_from_string(self, c: Z3_context, f: Z3_fixedpoint, s: Pointer[Int8, _]) raises -> Z3_ast_vector

Parse an SMT-LIB2 string with fixedpoint rules. Add the rules to the current fixedpoint context. Return the set of queries in the string.

Parameters:

  • c — - context.
  • f — - fixedpoint context.
  • s — - string containing SMT2 specification.

See also: Z3_fixedpoint_from_file, Z3_fixedpoint_to_string

Safe wrapper: Fixedpoint.from_string (auto)

Z3_fixedpoint_get_answer

def Z3_fixedpoint_get_answer(self, c: Z3_context, d: Z3_fixedpoint) raises -> Z3_ast

Retrieve a formula that encodes satisfying answers to the query.

When used in Datalog mode, the returned answer is a disjunction of conjuncts. Each conjunct encodes values of the bound variables of the query that are satisfied. In PDR mode, the returned answer is a single conjunction.

When used in Datalog mode the previous call to Z3_fixedpoint_query must have returned Z3_L_TRUE. When used with the PDR engine, the previous call must have been either Z3_L_TRUE or Z3_L_FALSE.

Safe wrapper: Fixedpoint.get_answer (auto)

Z3_fixedpoint_get_assertions

def Z3_fixedpoint_get_assertions(self, c: Z3_context, f: Z3_fixedpoint) raises -> Z3_ast_vector

Retrieve set of background assertions from fixedpoint context.

Safe wrapper: Fixedpoint.get_assertions (auto)

Z3_fixedpoint_get_cover_delta

def Z3_fixedpoint_get_cover_delta(self, c: Z3_context, d: Z3_fixedpoint, level: Int32, pred: Z3_func_decl) raises -> Z3_ast

Retrieve the current cover of pred up to level unfoldings. Return just the delta that is known at level. To obtain the full set of properties of pred one should query at level+1 , level+2 etc, and include level=-1.

Note: this functionality is PDR specific.

Safe wrapper: Fixedpoint.get_cover_delta (auto)

Z3_fixedpoint_get_help

def Z3_fixedpoint_get_help(self, c: Z3_context, f: Z3_fixedpoint) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string describing all fixedpoint available parameters.

Z3_fixedpoint_get_num_levels

def Z3_fixedpoint_get_num_levels(self, c: Z3_context, d: Z3_fixedpoint, pred: Z3_func_decl) raises -> UInt32

Query the PDR engine for the maximal levels properties are known about predicate.

This call retrieves the maximal number of relevant unfoldings of pred with respect to the current exploration state. Note: this functionality is PDR specific.

Safe wrapper: Fixedpoint.get_num_levels (auto)

Z3_fixedpoint_get_param_descrs

def Z3_fixedpoint_get_param_descrs(self, c: Z3_context, f: Z3_fixedpoint) raises -> Z3_param_descrs

Return the parameter description set for the given fixedpoint object.

Z3_fixedpoint_get_reason_unknown

def Z3_fixedpoint_get_reason_unknown(self, c: Z3_context, d: Z3_fixedpoint) raises -> Pointer[Int8, MutUntrackedOrigin]

Retrieve a string that describes the last status returned by Z3_fixedpoint_query.

Use this method when Z3_fixedpoint_query returns Z3_L_UNDEF.

Safe wrapper: Fixedpoint.get_reason_unknown (auto)

Z3_fixedpoint_get_rules

def Z3_fixedpoint_get_rules(self, c: Z3_context, f: Z3_fixedpoint) raises -> Z3_ast_vector

Retrieve set of rules from fixedpoint context.

Safe wrapper: Fixedpoint.get_rules (auto)

Z3_fixedpoint_get_statistics

def Z3_fixedpoint_get_statistics(self, c: Z3_context, d: Z3_fixedpoint) raises -> Z3_stats

Retrieve statistics information from the last call to Z3_fixedpoint_query.

Safe wrapper: Fixedpoint.get_statistics (auto)

Z3_fixedpoint_init

def Z3_fixedpoint_init(self, c: Z3_context, d: Z3_fixedpoint, state: Pointer[mut=True, NoneType, _]) raises

Initialize the context with a user-defined state.

Safe wrapper: raw-only (z3_mojo.c) — Raw C void* state pointer for fixedpoint callbacks; available via c_api()

Z3_fixedpoint_query

def Z3_fixedpoint_query(self, c: Z3_context, d: Z3_fixedpoint, query: Z3_ast) raises -> Lbool

Pose a query against the asserted rules.

query ::= (exists (bound-vars) query)
      |  literals

query returns

  • Z3_L_FALSE if the query is unsatisfiable.
  • Z3_L_TRUE if the query is satisfiable. Obtain the answer by calling Z3_fixedpoint_get_answer.
  • Z3_L_UNDEF if the query was interrupted, timed out or otherwise failed.

Safe wrapper: Fixedpoint.query (auto)

Z3_fixedpoint_query_relations

def Z3_fixedpoint_query_relations(self, c: Z3_context, d: Z3_fixedpoint, num_relations: UInt32, relations: Pointer[Z3_func_decl, _]) raises -> Lbool

Pose multiple queries against the asserted rules.

The queries are encoded as relations (function declarations).

query returns

  • Z3_L_FALSE if the query is unsatisfiable.
  • Z3_L_TRUE if the query is satisfiable. Obtain the answer by calling Z3_fixedpoint_get_answer.
  • Z3_L_UNDEF if the query was interrupted, timed out or otherwise failed.

Safe wrapper: Fixedpoint.query_relations (auto)

Z3_fixedpoint_register_relation

def Z3_fixedpoint_register_relation(self, c: Z3_context, d: Z3_fixedpoint, f: Z3_func_decl) raises

Register relation as Fixedpoint defined. Fixedpoint defined relations have least-fixedpoint semantics. For example, the relation is empty if it does not occur in a head or a fact.

Safe wrapper: Fixedpoint.register_relation (auto)

Z3_fixedpoint_set_params

def Z3_fixedpoint_set_params(self, c: Z3_context, f: Z3_fixedpoint, p: Z3_params) raises

Set parameters on fixedpoint context.

Z3_fixedpoint_set_predicate_representation

def Z3_fixedpoint_set_predicate_representation(self, c: Z3_context, d: Z3_fixedpoint, f: Z3_func_decl, num_relations: UInt32, relation_kinds: Pointer[Z3_symbol, _]) raises

Configure the predicate representation.

It sets the predicate to use a set of domains given by the list of symbols. The domains given by the list of symbols must belong to a set of built-in domains.

Z3_fixedpoint_set_reduce_app_callback

def Z3_fixedpoint_set_reduce_app_callback(self, c: Z3_context, d: Z3_fixedpoint, cb: Ptr) raises

Register a callback for building terms based on the relational operators.

Safe wrapper: raw-only (z3_mojo.c) — Raw C callback registration; available via c_api()

Z3_fixedpoint_set_reduce_assign_callback

def Z3_fixedpoint_set_reduce_assign_callback(self, c: Z3_context, d: Z3_fixedpoint, cb: Ptr) raises

Register a callback to destructive updates.

Registers are identified with terms encoded as fresh constants,

Safe wrapper: raw-only (z3_mojo.c) — Raw C callback registration; available via c_api()

Z3_fixedpoint_to_string

def Z3_fixedpoint_to_string(self, c: Z3_context, f: Z3_fixedpoint, num_queries: UInt32, queries: Pointer[mut=True, Z3_ast, _]) raises -> Pointer[Int8, MutUntrackedOrigin]

Print the current rules and background axioms as a string.

Parameters:

  • c — - context.
  • f — - fixedpoint context.
  • num_queries — - number of additional queries to print.
  • queries — - additional queries.

See also: Z3_fixedpoint_from_file, Z3_fixedpoint_from_string

Safe wrapper: Fixedpoint.to_string (auto)

Z3_fixedpoint_update_rule

def Z3_fixedpoint_update_rule(self, c: Z3_context, d: Z3_fixedpoint, a: Z3_ast, name: Z3_symbol) raises

Update a named rule. A rule with the same name must have been previously created.

Safe wrapper: Fixedpoint.update_rule (auto)

Z3_mk_fixedpoint

def Z3_mk_fixedpoint(self, c: Z3_context) raises -> Z3_fixedpoint

Create a new fixedpoint context.

Note: User must use Z3_fixedpoint_inc_ref and Z3_fixedpoint_dec_ref to manage fixedpoint objects. Even if the context was created using Z3_mk_context instead of Z3_mk_context_rc.

Safe wrapper: Context.mk_fixedpoint (auto)

Lifecycle & refcounting (2 functions — handled automatically by RAII)
C Function Mojo CApi Signature
Z3_fixedpoint_dec_ref def Z3_fixedpoint_dec_ref(self, c: Z3_context, d: Z3_fixedpoint)
Z3_fixedpoint_inc_ref def Z3_fixedpoint_inc_ref(self, c: Z3_context, d: Z3_fixedpoint) raises

z3_fpa.h (81 functions)

Floating-Point Arithmetic (61)

Z3_mk_fpa_abs

def Z3_mk_fpa_abs(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Floating-point absolute value

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_is_negative, Z3_mk_fpa_is_positive, Z3_mk_fpa_neg

Safe wrapper: Context.mk_fpa_abs (auto)

Z3_mk_fpa_add

def Z3_mk_fpa_add(self, c: Z3_context, rm: Z3_ast, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point addition

rm must be of RoundingMode sort, t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_add (auto)

Z3_mk_fpa_div

def Z3_mk_fpa_div(self, c: Z3_context, rm: Z3_ast, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point division

The nodes rm must be of RoundingMode sort, t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t1 — term of FloatingPoint sort.
  • t2 — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_div (auto)

Z3_mk_fpa_eq

def Z3_mk_fpa_eq(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point equality.

Note that this is IEEE 754 equality (as opposed to SMT-LIB =).

t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

See also: Z3_mk_fpa_geq, Z3_mk_fpa_gt, Z3_mk_fpa_leq, Z3_mk_fpa_lt

Safe wrapper: Context.mk_fpa_eq (auto)

Z3_mk_fpa_fma

def Z3_mk_fpa_fma(self, c: Z3_context, rm: Z3_ast, t1: Z3_ast, t2: Z3_ast, t3: Z3_ast) raises -> Z3_ast

Floating-point fused multiply-add.

The result is round((t1 * t2) + t3).

rm must be of RoundingMode sort, t1, t2, and t3 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort
  • t3 — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_fma (auto)

Z3_mk_fpa_fp

def Z3_mk_fpa_fp(self, c: Z3_context, sgn: Z3_ast, exp: Z3_ast, sig: Z3_ast) raises -> Z3_ast

Create an expression of FloatingPoint sort from three bit-vector expressions.

This is the operator named fp' in the SMT FP theory definition. Note thatsgn` is required to be a bit-vector of size 1. Significand and exponent are required to be longer than 1 and 2 respectively. The FloatingPoint sort of the resulting expression is automatically determined from the bit-vector sizes of the arguments. The exponent is assumed to be in IEEE-754 biased representation.

Parameters:

  • c — logical context
  • sgn — sign
  • exp — exponent
  • sig — significand

See also: Z3_mk_fpa_numeral_double, Z3_mk_fpa_numeral_float, Z3_mk_fpa_numeral_int, Z3_mk_fpa_numeral_int_uint, Z3_mk_fpa_numeral_int64_uint64, Z3_mk_numeral

Safe wrapper: Context.mk_fpa_fp (auto)

Z3_mk_fpa_geq

def Z3_mk_fpa_geq(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point greater than or equal.

t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

See also: Z3_mk_fpa_eq, Z3_mk_fpa_gt, Z3_mk_fpa_leq, Z3_mk_fpa_lt

Safe wrapper: Context.mk_fpa_geq (auto)

Z3_mk_fpa_gt

def Z3_mk_fpa_gt(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point greater than.

t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

See also: Z3_mk_fpa_eq, Z3_mk_fpa_geq, Z3_mk_fpa_leq, Z3_mk_fpa_lt

Safe wrapper: Context.mk_fpa_gt (auto)

Z3_mk_fpa_inf

def Z3_mk_fpa_inf(self, c: Z3_context, s: Z3_sort, negative: Bool) raises -> Z3_ast

Create a floating-point infinity of sort s.

When negative is true, -oo will be generated instead of +oo.

Parameters:

  • c — logical context
  • s — target sort
  • negative — indicates whether the result should be negative

See also: Z3_mk_fpa_is_infinite, Z3_mk_fpa_nan, Z3_mk_fpa_zero

Safe wrapper: Context.mk_fpa_inf (auto)

Z3_mk_fpa_is_infinite

def Z3_mk_fpa_is_infinite(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Predicate indicating whether t is a floating-point number representing +oo or -oo.

t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_inf, Z3_mk_fpa_is_nan, Z3_mk_fpa_is_normal, Z3_mk_fpa_is_subnormal, Z3_mk_fpa_is_zero

Safe wrapper: Context.mk_fpa_is_infinite (auto)

Z3_mk_fpa_is_nan

def Z3_mk_fpa_is_nan(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Predicate indicating whether t is a NaN.

t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_is_infinite, Z3_mk_fpa_is_normal, Z3_mk_fpa_is_subnormal, Z3_mk_fpa_is_zero, Z3_mk_fpa_nan

Safe wrapper: Context.mk_fpa_is_nan (auto)

Z3_mk_fpa_is_negative

def Z3_mk_fpa_is_negative(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Predicate indicating whether t is a negative floating-point number.

t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_abs, Z3_mk_fpa_is_positive, Z3_mk_fpa_neg

Safe wrapper: Context.mk_fpa_is_negative (auto)

Z3_mk_fpa_is_normal

def Z3_mk_fpa_is_normal(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Predicate indicating whether t is a normal floating-point number.

t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_is_infinite, Z3_mk_fpa_is_nan, Z3_mk_fpa_is_subnormal, Z3_mk_fpa_is_zero

Safe wrapper: Context.mk_fpa_is_normal (auto)

Z3_mk_fpa_is_positive

def Z3_mk_fpa_is_positive(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Predicate indicating whether t is a positive floating-point number.

t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_abs, Z3_mk_fpa_is_negative, Z3_mk_fpa_neg

Safe wrapper: Context.mk_fpa_is_positive (auto)

Z3_mk_fpa_is_subnormal

def Z3_mk_fpa_is_subnormal(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Predicate indicating whether t is a subnormal floating-point number.

t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_is_infinite, Z3_mk_fpa_is_nan, Z3_mk_fpa_is_normal, Z3_mk_fpa_is_zero

Safe wrapper: Context.mk_fpa_is_subnormal (auto)

Z3_mk_fpa_is_zero

def Z3_mk_fpa_is_zero(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Predicate indicating whether t is a floating-point number with zero value, i.e., +zero or -zero.

t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_is_infinite, Z3_mk_fpa_is_nan, Z3_mk_fpa_is_normal, Z3_mk_fpa_is_subnormal, Z3_mk_fpa_zero

Safe wrapper: Context.mk_fpa_is_zero (auto)

Z3_mk_fpa_leq

def Z3_mk_fpa_leq(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point less than or equal.

t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

See also: Z3_mk_fpa_eq, Z3_mk_fpa_geq, Z3_mk_fpa_gt, Z3_mk_fpa_lt

Safe wrapper: Context.mk_fpa_leq (auto)

Z3_mk_fpa_lt

def Z3_mk_fpa_lt(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point less than.

t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

See also: Z3_mk_fpa_eq, Z3_mk_fpa_geq, Z3_mk_fpa_gt, Z3_mk_fpa_leq

Safe wrapper: Context.mk_fpa_lt (auto)

Z3_mk_fpa_max

def Z3_mk_fpa_max(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Maximum of floating-point numbers.

t1, t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

See also: Z3_mk_fpa_min

Safe wrapper: Context.mk_fpa_max (auto)

Z3_mk_fpa_min

def Z3_mk_fpa_min(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Minimum of floating-point numbers.

t1, t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

See also: Z3_mk_fpa_max

Safe wrapper: Context.mk_fpa_min (auto)

Z3_mk_fpa_mul

def Z3_mk_fpa_mul(self, c: Z3_context, rm: Z3_ast, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point multiplication

rm must be of RoundingMode sort, t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_mul (auto)

Z3_mk_fpa_nan

def Z3_mk_fpa_nan(self, c: Z3_context, s: Z3_sort) raises -> Z3_ast

Create a floating-point NaN of sort s.

Parameters:

  • c — logical context
  • s — target sort

See also: Z3_mk_fpa_inf, Z3_mk_fpa_is_nan, Z3_mk_fpa_zero

Safe wrapper: Context.mk_fpa_nan (auto)

Z3_mk_fpa_neg

def Z3_mk_fpa_neg(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Floating-point negation

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

See also: Z3_mk_fpa_abs, Z3_mk_fpa_is_negative, Z3_mk_fpa_is_positive

Safe wrapper: Context.mk_fpa_neg (auto)

Z3_mk_fpa_numeral_double

def Z3_mk_fpa_numeral_double(self, c: Z3_context, v: Float64, ty: Z3_sort) raises -> Z3_ast

Create a numeral of FloatingPoint sort from a double.

This function is used to create numerals that fit in a double value. It is slightly faster than Z3_mk_numeral since it is not necessary to parse a string.

ty must be a FloatingPoint sort

Z3_mk_fpa_numeral_float

def Z3_mk_fpa_numeral_float(self, c: Z3_context, v: Float32, ty: Z3_sort) raises -> Z3_ast

Create a numeral of FloatingPoint sort from a float.

This function is used to create numerals that fit in a float value. It is slightly faster than Z3_mk_numeral since it is not necessary to parse a string.

ty must be a FloatingPoint sort

Z3_mk_fpa_numeral_int

def Z3_mk_fpa_numeral_int(self, c: Z3_context, v: Int32, ty: Z3_sort) raises -> Z3_ast

Create a numeral of FloatingPoint sort from a signed integer.

ty must be a FloatingPoint sort

Parameters:

  • c — logical context
  • v — value
  • ty — result sort

See also: Z3_mk_fpa_fp, Z3_mk_fpa_numeral_double, Z3_mk_fpa_numeral_float, Z3_mk_fpa_numeral_int_uint, Z3_mk_fpa_numeral_int64_uint64, Z3_mk_numeral

Safe wrapper: Context.mk_fpa_numeral_int (auto)

Z3_mk_fpa_numeral_int64_uint64

def Z3_mk_fpa_numeral_int64_uint64(self, c: Z3_context, sgn: Bool, exp: Int64, sig: UInt64, ty: Z3_sort) raises -> Z3_ast

Create a numeral of FloatingPoint sort from a sign bit and two 64-bit integers.

ty must be a FloatingPoint sort

Parameters:

  • c — logical context
  • sgn — sign bit (true == negative)
  • sig — significand
  • exp — exponent
  • ty — result sort

See also: Z3_mk_fpa_fp, Z3_mk_fpa_numeral_double, Z3_mk_fpa_numeral_float, Z3_mk_fpa_numeral_int, Z3_mk_fpa_numeral_int_uint, Z3_mk_numeral

Safe wrapper: Context.mk_fpa_numeral_int64_uint64 (auto)

Z3_mk_fpa_numeral_int_uint

def Z3_mk_fpa_numeral_int_uint(self, c: Z3_context, sgn: Bool, exp: Int32, sig: UInt32, ty: Z3_sort) raises -> Z3_ast

Create a numeral of FloatingPoint sort from a sign bit and two integers.

ty must be a FloatingPoint sort

Parameters:

  • c — logical context
  • sgn — sign bit (true == negative)
  • sig — significand
  • exp — exponent
  • ty — result sort

See also: Z3_mk_fpa_fp, Z3_mk_fpa_numeral_double, Z3_mk_fpa_numeral_float, Z3_mk_fpa_numeral_int, Z3_mk_fpa_numeral_int64_uint64, Z3_mk_numeral

Safe wrapper: Context.mk_fpa_numeral_int_uint (auto)

Z3_mk_fpa_rem

def Z3_mk_fpa_rem(self, c: Z3_context, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point remainder

t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_rem (auto)

Z3_mk_fpa_rna

def Z3_mk_fpa_rna(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.

This is the same as Z3_mk_fpa_round_nearest_ties_to_away.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_rounding_mode_sort, Z3_mk_fpa_rne, Z3_mk_fpa_rtn, Z3_mk_fpa_rtp, Z3_mk_fpa_rtz

Safe wrapper: Context.mk_fpa_rna (auto)

Z3_mk_fpa_rne

def Z3_mk_fpa_rne(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.

This is the same as Z3_mk_fpa_round_nearest_ties_to_even.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_rounding_mode_sort, Z3_mk_fpa_rna, Z3_mk_fpa_rtn, Z3_mk_fpa_rtp, Z3_mk_fpa_rtz

Safe wrapper: Context.mk_fpa_rne (auto)

Z3_mk_fpa_round_nearest_ties_to_away

def Z3_mk_fpa_round_nearest_ties_to_away(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the NearestTiesToAway rounding mode.

This is the same as Z3_mk_fpa_rna.

Z3_mk_fpa_round_nearest_ties_to_even

def Z3_mk_fpa_round_nearest_ties_to_even(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the NearestTiesToEven rounding mode.

This is the same as Z3_mk_fpa_rne.

Z3_mk_fpa_round_to_integral

def Z3_mk_fpa_round_to_integral(self, c: Z3_context, rm: Z3_ast, t: Z3_ast) raises -> Z3_ast

Floating-point roundToIntegral. Rounds a floating-point number to the closest integer, again represented as a floating-point number.

t must be of FloatingPoint sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_round_to_integral (auto)

Z3_mk_fpa_round_toward_negative

def Z3_mk_fpa_round_toward_negative(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the TowardNegative rounding mode.

This is the same as Z3_mk_fpa_rtn.

Z3_mk_fpa_round_toward_positive

def Z3_mk_fpa_round_toward_positive(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the TowardPositive rounding mode.

This is the same as Z3_mk_fpa_rtp.

Z3_mk_fpa_round_toward_zero

def Z3_mk_fpa_round_toward_zero(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the TowardZero rounding mode.

This is the same as Z3_mk_fpa_rtz.

Z3_mk_fpa_rounding_mode_sort

def Z3_mk_fpa_rounding_mode_sort(self, c: Z3_context) raises -> Z3_sort

Create the RoundingMode sort.

Z3_mk_fpa_rtn

def Z3_mk_fpa_rtn(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the TowardNegative rounding mode.

This is the same as Z3_mk_fpa_round_toward_negative.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_rounding_mode_sort, Z3_mk_fpa_rna, Z3_mk_fpa_rne, Z3_mk_fpa_rtp, Z3_mk_fpa_rtz

Safe wrapper: Context.mk_fpa_rtn (auto)

Z3_mk_fpa_rtp

def Z3_mk_fpa_rtp(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the TowardPositive rounding mode.

This is the same as Z3_mk_fpa_round_toward_positive.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_rounding_mode_sort, Z3_mk_fpa_rna, Z3_mk_fpa_rne, Z3_mk_fpa_rtn, Z3_mk_fpa_rtz

Safe wrapper: Context.mk_fpa_rtp (auto)

Z3_mk_fpa_rtz

def Z3_mk_fpa_rtz(self, c: Z3_context) raises -> Z3_ast

Create a numeral of RoundingMode sort which represents the TowardZero rounding mode.

This is the same as Z3_mk_fpa_round_toward_zero.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_rounding_mode_sort, Z3_mk_fpa_rna, Z3_mk_fpa_rne, Z3_mk_fpa_rtn, Z3_mk_fpa_rtp

Safe wrapper: Context.mk_fpa_rtz (auto)

Z3_mk_fpa_sort

def Z3_mk_fpa_sort(self, c: Z3_context, ebits: UInt32, sbits: UInt32) raises -> Z3_sort

Create a FloatingPoint sort.

Parameters:

  • c — logical context
  • ebits — number of exponent bits
  • sbits — number of significand bits

Note: ebits must be larger than 1 and sbits must be larger than 2.

See also: Z3_mk_fpa_sort_half, Z3_mk_fpa_sort_16, Z3_mk_fpa_sort_single, Z3_mk_fpa_sort_32, Z3_mk_fpa_sort_double, Z3_mk_fpa_sort_64, Z3_mk_fpa_sort_quadruple, Z3_mk_fpa_sort_128

Safe wrapper: Context.mk_fpa_sort (auto)

Z3_mk_fpa_sort_128

def Z3_mk_fpa_sort_128(self, c: Z3_context) raises -> Z3_sort

Create the quadruple-precision (128-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_quadruple.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_16, Z3_mk_fpa_sort_32, Z3_mk_fpa_sort_64

Safe wrapper: Context.mk_fpa_sort_128 (auto)

Z3_mk_fpa_sort_16

def Z3_mk_fpa_sort_16(self, c: Z3_context) raises -> Z3_sort

Create the half-precision (16-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_half.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_32, Z3_mk_fpa_sort_64, Z3_mk_fpa_sort_128

Safe wrapper: Context.mk_fpa_sort_16 (auto)

Z3_mk_fpa_sort_32

def Z3_mk_fpa_sort_32(self, c: Z3_context) raises -> Z3_sort

Create the single-precision (32-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_single.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_16, Z3_mk_fpa_sort_64, Z3_mk_fpa_sort_128

Safe wrapper: Context.mk_fpa_sort_32 (auto)

Z3_mk_fpa_sort_64

def Z3_mk_fpa_sort_64(self, c: Z3_context) raises -> Z3_sort

Create the double-precision (64-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_double.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_16, Z3_mk_fpa_sort_32, Z3_mk_fpa_sort_128

Safe wrapper: Context.mk_fpa_sort_64 (auto)

Z3_mk_fpa_sort_double

def Z3_mk_fpa_sort_double(self, c: Z3_context) raises -> Z3_sort

Create the double-precision (64-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_64.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_half, Z3_mk_fpa_sort_single, Z3_mk_fpa_sort_quadruple

Safe wrapper: Context.mk_fpa_sort_double (auto)

Z3_mk_fpa_sort_half

def Z3_mk_fpa_sort_half(self, c: Z3_context) raises -> Z3_sort

Create the half-precision (16-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_16.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_single, Z3_mk_fpa_sort_double, Z3_mk_fpa_sort_quadruple

Safe wrapper: Context.mk_fpa_sort_half (auto)

Z3_mk_fpa_sort_quadruple

def Z3_mk_fpa_sort_quadruple(self, c: Z3_context) raises -> Z3_sort

Create the quadruple-precision (128-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_128.

Parameters:

  • c — logical context

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_half, Z3_mk_fpa_sort_single, Z3_mk_fpa_sort_double

Safe wrapper: Context.mk_fpa_sort_quadruple (auto)

Z3_mk_fpa_sort_single

def Z3_mk_fpa_sort_single(self, c: Z3_context) raises -> Z3_sort

Create the single-precision (32-bit) FloatingPoint sort.

This is the same as Z3_mk_fpa_sort_32.

Parameters:

  • c — logical context.

See also: Z3_mk_fpa_sort, Z3_mk_fpa_sort_half, Z3_mk_fpa_sort_double, Z3_mk_fpa_sort_quadruple

Safe wrapper: Context.mk_fpa_sort_single (auto)

Z3_mk_fpa_sqrt

def Z3_mk_fpa_sqrt(self, c: Z3_context, rm: Z3_ast, t: Z3_ast) raises -> Z3_ast

Floating-point square root

rm must be of RoundingMode sort, t must have FloatingPoint sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_sqrt (auto)

Z3_mk_fpa_sub

def Z3_mk_fpa_sub(self, c: Z3_context, rm: Z3_ast, t1: Z3_ast, t2: Z3_ast) raises -> Z3_ast

Floating-point subtraction

rm must be of RoundingMode sort, t1 and t2 must have the same FloatingPoint sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t1 — term of FloatingPoint sort
  • t2 — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_sub (auto)

Z3_mk_fpa_to_fp_bv

def Z3_mk_fpa_to_fp_bv(self, c: Z3_context, bv: Z3_ast, s: Z3_sort) raises -> Z3_ast

Conversion of a single IEEE 754-2008 bit-vector into a floating-point number.

Produces a term that represents the conversion of a bit-vector term bv to a floating-point term of sort s.

s must be a FloatingPoint sort, t must be of bit-vector sort, and the bit-vector size of bv must be equal to ebits+sbits of s. The format of the bit-vector is as defined by the IEEE 754-2008 interchange format.

Parameters:

  • c — logical context
  • bv — a bit-vector term
  • s — floating-point sort

Safe wrapper: Context.mk_fpa_to_fp_bv (auto)

Z3_mk_fpa_to_fp_float

def Z3_mk_fpa_to_fp_float(self, c: Z3_context, rm: Z3_ast, t: Z3_ast, s: Z3_sort) raises -> Z3_ast

Conversion of a FloatingPoint term into another term of different FloatingPoint sort.

Produces a term that represents the conversion of a floating-point term t to a floating-point term of sort s. If necessary, the result will be rounded according to rounding mode rm.

s must be a FloatingPoint sort, rm must be of RoundingMode sort, t must be of floating-point sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of FloatingPoint sort
  • s — floating-point sort

Safe wrapper: Context.mk_fpa_to_fp_float (auto)

Z3_mk_fpa_to_fp_real

def Z3_mk_fpa_to_fp_real(self, c: Z3_context, rm: Z3_ast, t: Z3_ast, s: Z3_sort) raises -> Z3_ast

Conversion of a term of real sort into a term of FloatingPoint sort.

Produces a term that represents the conversion of term t of real sort into a floating-point term of sort s. If necessary, the result will be rounded according to rounding mode rm.

s must be a FloatingPoint sort, rm must be of RoundingMode sort, t must be of real sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of Real sort
  • s — floating-point sort

Safe wrapper: Context.mk_fpa_to_fp_real (auto)

Z3_mk_fpa_to_fp_signed

def Z3_mk_fpa_to_fp_signed(self, c: Z3_context, rm: Z3_ast, t: Z3_ast, s: Z3_sort) raises -> Z3_ast

Conversion of a 2's complement signed bit-vector term into a term of FloatingPoint sort.

Produces a term that represents the conversion of the bit-vector term t into a floating-point term of sort s. The bit-vector t is taken to be in signed 2's complement format. If necessary, the result will be rounded according to rounding mode rm.

s must be a FloatingPoint sort, rm must be of RoundingMode sort, t must be of bit-vector sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of bit-vector sort
  • s — floating-point sort

Safe wrapper: Context.mk_fpa_to_fp_signed (auto)

Z3_mk_fpa_to_fp_unsigned

def Z3_mk_fpa_to_fp_unsigned(self, c: Z3_context, rm: Z3_ast, t: Z3_ast, s: Z3_sort) raises -> Z3_ast

Conversion of a 2's complement unsigned bit-vector term into a term of FloatingPoint sort.

Produces a term that represents the conversion of the bit-vector term t into a floating-point term of sort s. The bit-vector t is taken to be in unsigned 2's complement format. If necessary, the result will be rounded according to rounding mode rm.

s must be a FloatingPoint sort, rm must be of RoundingMode sort, t must be of bit-vector sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of bit-vector sort
  • s — floating-point sort

Safe wrapper: Context.mk_fpa_to_fp_unsigned (auto)

Z3_mk_fpa_to_real

def Z3_mk_fpa_to_real(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Conversion of a floating-point term into a real-numbered term.

Produces a term that represents the conversion of the floating-point term t into a real number. Note that this type of conversion will often result in non-linear constraints over real terms.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_to_real (auto)

Z3_mk_fpa_to_sbv

def Z3_mk_fpa_to_sbv(self, c: Z3_context, rm: Z3_ast, t: Z3_ast, sz: UInt32) raises -> Z3_ast

Conversion of a floating-point term into a signed bit-vector.

Produces a term that represents the conversion of the floating-point term t into a bit-vector term of size sz in signed 2's complement format. If necessary, the result will be rounded according to rounding mode rm.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of FloatingPoint sort
  • sz — size of the resulting bit-vector

Safe wrapper: Context.mk_fpa_to_sbv (auto)

Z3_mk_fpa_to_ubv

def Z3_mk_fpa_to_ubv(self, c: Z3_context, rm: Z3_ast, t: Z3_ast, sz: UInt32) raises -> Z3_ast

Conversion of a floating-point term into an unsigned bit-vector.

Produces a term that represents the conversion of the floating-point term t into a bit-vector term of size sz in unsigned 2's complement format. If necessary, the result will be rounded according to rounding mode rm.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • t — term of FloatingPoint sort
  • sz — size of the resulting bit-vector

Safe wrapper: Context.mk_fpa_to_ubv (auto)

Z3_mk_fpa_zero

def Z3_mk_fpa_zero(self, c: Z3_context, s: Z3_sort, negative: Bool) raises -> Z3_ast

Create a floating-point zero of sort s.

When negative is true, -zero will be generated instead of +zero.

Parameters:

  • c — logical context
  • s — target sort
  • negative — indicates whether the result should be negative

See also: Z3_mk_fpa_inf, Z3_mk_fpa_is_zero, Z3_mk_fpa_nan

Safe wrapper: Context.mk_fpa_zero (auto)

Z3-specific floating-point extensions (20)

Z3_fpa_get_ebits

def Z3_fpa_get_ebits(self, c: Z3_context, s: Z3_sort) raises -> UInt32

Retrieves the number of bits reserved for the exponent in a FloatingPoint sort.

Parameters:

  • c — logical context
  • s — FloatingPoint sort

See also: Z3_fpa_get_sbits

Safe wrapper: Context.fpa_get_ebits (auto)

Z3_fpa_get_numeral_exponent_bv

def Z3_fpa_get_numeral_exponent_bv(self, c: Z3_context, t: Z3_ast, biased: Bool) raises -> Z3_ast

Retrieves the exponent of a floating-point literal as a bit-vector expression.

Remarks: This function extracts the exponent in t, without normalization. NaN is an invalid arguments.

Parameters:

  • c — logical context
  • t — a floating-point numeral
  • biased — flag to indicate whether the result is in biased representation

Safe wrapper: Context.fpa_get_numeral_exponent_bv (auto)

Z3_fpa_get_numeral_exponent_int64

def Z3_fpa_get_numeral_exponent_int64(self, c: Z3_context, t: Z3_ast, n: Pointer[mut=True, Int64, _], biased: Bool) raises -> Bool

Return the exponent value of a floating-point numeral as a signed 64-bit integer

Remarks: This function extracts the exponent in t, without normalization. NaN is an invalid argument.

Parameters:

  • c — logical context
  • t — a floating-point numeral
  • n — exponent
  • biased — flag to indicate whether the result is in biased representation

Returns: true if t corresponds to a floating point numeral, otherwise invokes exception handler or returns false

Safe wrapper: Context.fpa_get_numeral_exponent_int64 (auto)

Z3_fpa_get_numeral_exponent_string

def Z3_fpa_get_numeral_exponent_string(self, c: Z3_context, t: Z3_ast, biased: Bool) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the exponent value of a floating-point numeral as a string.

Remarks: This function extracts the exponent in t, without normalization. NaN is an invalid argument.

Parameters:

  • c — logical context
  • t — a floating-point numeral
  • biased — flag to indicate whether the result is in biased representation

Returns: true if t corresponds to a floating point numeral, otherwise invokes exception handler or returns false

Safe wrapper: Context.fpa_get_numeral_exponent_string (auto)

Z3_fpa_get_numeral_sign

def Z3_fpa_get_numeral_sign(self, c: Z3_context, t: Z3_ast, sgn: Pointer[mut=True, UInt8, _]) raises -> Bool

Retrieves the sign of a floating-point literal.

Remarks: sets sgn to false if t' is positive and totrue` otherwise, except for NaN, which is an invalid argument.

Parameters:

  • c — logical context
  • t — a floating-point numeral
  • sgn — the retrieved sign

Returns: true if t corresponds to a floating point numeral, otherwise invokes exception handler or returns false

Safe wrapper: Context.fpa_get_numeral_sign (auto)

Z3_fpa_get_numeral_sign_bv

def Z3_fpa_get_numeral_sign_bv(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Retrieves the sign of a floating-point literal as a bit-vector expression.

Remarks: NaN is an invalid argument.

Parameters:

  • c — logical context
  • t — a floating-point numeral

Safe wrapper: Context.fpa_get_numeral_sign_bv (auto)

Z3_fpa_get_numeral_significand_bv

def Z3_fpa_get_numeral_significand_bv(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Retrieves the significand of a floating-point literal as a bit-vector expression.

Remarks: NaN is an invalid argument.

Parameters:

  • c — logical context
  • t — a floating-point numeral

Safe wrapper: Context.fpa_get_numeral_significand_bv (auto)

Z3_fpa_get_numeral_significand_string

def Z3_fpa_get_numeral_significand_string(self, c: Z3_context, t: Z3_ast) raises -> Pointer[Int8, MutUntrackedOrigin]

Return the significand value of a floating-point numeral as a string.

Remarks: The significand s is always 0.0 <= s < 2.0; the resulting string is long enough to represent the real significand precisely.

Parameters:

  • c — logical context
  • t — a floating-point numeral

Returns: true if t corresponds to a floating point numeral, otherwise invokes exception handler or returns false

Safe wrapper: Context.fpa_get_numeral_significand_string (auto)

Z3_fpa_get_numeral_significand_uint64

def Z3_fpa_get_numeral_significand_uint64(self, c: Z3_context, t: Z3_ast, n: Pointer[mut=True, UInt64, _]) raises -> Bool

Return the significand value of a floating-point numeral as a uint64.

Remarks: This function extracts the significand bits in t, without the hidden bit or normalization. Sets the Z3_INVALID_ARG error code if the significand does not fit into a uint64. NaN is an invalid argument.

Parameters:

  • c — logical context
  • t — a floating-point numeral
  • n — pointer to output uint64

Safe wrapper: Context.fpa_get_numeral_significand_uint64 (auto)

Z3_fpa_get_sbits

def Z3_fpa_get_sbits(self, c: Z3_context, s: Z3_sort) raises -> UInt32

Retrieves the number of bits reserved for the significand in a FloatingPoint sort.

Parameters:

  • c — logical context
  • s — FloatingPoint sort

See also: Z3_fpa_get_ebits

Safe wrapper: Context.fpa_get_sbits (auto)

Z3_fpa_is_numeral

def Z3_fpa_is_numeral(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given ast is a floating-point numeral.

Z3_fpa_is_numeral_inf

def Z3_fpa_is_numeral_inf(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given floating-point numeral is a +oo or -oo.

Parameters:

  • c — logical context
  • t — a floating-point numeral

See also: Z3_fpa_is_numeral_nan, Z3_fpa_is_numeral_normal, Z3_fpa_is_numeral_subnormal, Z3_fpa_is_numeral_zero

Safe wrapper: Context.fpa_is_numeral_inf (auto)

Z3_fpa_is_numeral_nan

def Z3_fpa_is_numeral_nan(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given floating-point numeral is a NaN.

Parameters:

  • c — logical context
  • t — a floating-point numeral

See also: Z3_fpa_is_numeral_inf, Z3_fpa_is_numeral_normal, Z3_fpa_is_numeral_subnormal, Z3_fpa_is_numeral_zero

Safe wrapper: Context.fpa_is_numeral_nan (auto)

Z3_fpa_is_numeral_negative

def Z3_fpa_is_numeral_negative(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given floating-point numeral is negative.

Parameters:

  • c — logical context
  • t — a floating-point numeral

See also: Z3_fpa_is_numeral_positive

Safe wrapper: Context.fpa_is_numeral_negative (auto)

Z3_fpa_is_numeral_normal

def Z3_fpa_is_numeral_normal(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given floating-point numeral is normal.

Parameters:

  • c — logical context
  • t — a floating-point numeral

See also: Z3_fpa_is_numeral_inf, Z3_fpa_is_numeral_nan, Z3_fpa_is_numeral_subnormal, Z3_fpa_is_numeral_zero

Safe wrapper: Context.fpa_is_numeral_normal (auto)

Z3_fpa_is_numeral_positive

def Z3_fpa_is_numeral_positive(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given floating-point numeral is positive.

Parameters:

  • c — logical context
  • t — a floating-point numeral

See also: Z3_fpa_is_numeral_negative

Safe wrapper: Context.fpa_is_numeral_positive (auto)

Z3_fpa_is_numeral_subnormal

def Z3_fpa_is_numeral_subnormal(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given floating-point numeral is subnormal.

Parameters:

  • c — logical context
  • t — a floating-point numeral

See also: Z3_fpa_is_numeral_inf, Z3_fpa_is_numeral_nan, Z3_fpa_is_numeral_normal, Z3_fpa_is_numeral_zero

Safe wrapper: Context.fpa_is_numeral_subnormal (auto)

Z3_fpa_is_numeral_zero

def Z3_fpa_is_numeral_zero(self, c: Z3_context, t: Z3_ast) raises -> Bool

Checks whether a given floating-point numeral is +zero or -zero.

Parameters:

  • c — logical context
  • t — a floating-point numeral

See also: Z3_fpa_is_numeral_inf, Z3_fpa_is_numeral_nan, Z3_fpa_is_numeral_normal, Z3_fpa_is_numeral_subnormal

Safe wrapper: Context.fpa_is_numeral_zero (auto)

Z3_mk_fpa_to_fp_int_real

def Z3_mk_fpa_to_fp_int_real(self, c: Z3_context, rm: Z3_ast, exp: Z3_ast, sig: Z3_ast, s: Z3_sort) raises -> Z3_ast

Conversion of a real-sorted significand and an integer-sorted exponent into a term of FloatingPoint sort.

Produces a term that represents the conversion of sig * 2^exp into a floating-point term of sort s. If necessary, the result will be rounded according to rounding mode rm.

s must be a FloatingPoint sort, rm must be of RoundingMode sort, exp must be of int sort, sig must be of real sort.

Parameters:

  • c — logical context
  • rm — term of RoundingMode sort
  • exp — exponent term of Int sort
  • sig — significand term of Real sort
  • s — FloatingPoint sort

Safe wrapper: Context.mk_fpa_to_fp_int_real (auto)

Z3_mk_fpa_to_ieee_bv

def Z3_mk_fpa_to_ieee_bv(self, c: Z3_context, t: Z3_ast) raises -> Z3_ast

Conversion of a floating-point term into a bit-vector term in IEEE 754-2008 format.

t must have FloatingPoint sort. The size of the resulting bit-vector is automatically determined.

Note that IEEE 754-2008 allows multiple different representations of NaN. This conversion knows only one NaN and it will always produce the same bit-vector representation of that NaN.

Parameters:

  • c — logical context
  • t — term of FloatingPoint sort

Safe wrapper: Context.mk_fpa_to_ieee_bv (auto)

z3_optimization.h (30 functions)

Optimization facilities (28)

Z3_mk_optimize

def Z3_mk_optimize(self, c: Z3_context) raises -> Z3_optimize

Create a new optimize context.

Note: User must use Z3_optimize_inc_ref and Z3_optimize_dec_ref to manage optimize objects. Even if the context was created using Z3_mk_context instead of Z3_mk_context_rc.

Safe wrapper: Optimize.create (manual)

Z3_optimize_assert

def Z3_optimize_assert(self, c: Z3_context, o: Z3_optimize, a: Z3_ast) raises

Assert hard constraint to the optimization context.

Z3_optimize_assert_and_track

def Z3_optimize_assert_and_track(self, c: Z3_context, o: Z3_optimize, a: Z3_ast, t: Z3_ast) raises

Assert tracked hard constraint to the optimization context.

Z3_optimize_assert_soft

def Z3_optimize_assert_soft(self, c: Z3_context, o: Z3_optimize, a: Z3_ast, weight: Pointer[Int8, _], id: Z3_symbol) raises -> UInt32

Assert soft constraint to the optimization context.

Parameters:

  • c — - context
  • o — - optimization context
  • a — - formula
  • weight — - a penalty for violating soft constraint. Negative weights convert into rewards.
  • id — - optional identifier to group soft constraints

See also: Z3_optimize_assert, Z3_optimize_assert_and_track

Safe wrapper: Optimize.assert_soft (manual)

Z3_optimize_check

def Z3_optimize_check(self, c: Z3_context, o: Z3_optimize, num_assumptions: UInt32, assumptions: Pointer[Z3_ast, _]) raises -> Lbool

Check consistency and produce optimal values.

Parameters:

  • c — - context
  • o — - optimization context
  • num_assumptions — - number of additional assumptions
  • assumptions — - the additional assumptions

See also: Z3_optimize_get_reason_unknown, Z3_optimize_get_model, Z3_optimize_get_statistics, Z3_optimize_get_unsat_core

Safe wrapper: Optimize.check (manual)

Z3_optimize_from_file

def Z3_optimize_from_file(self, c: Z3_context, o: Z3_optimize, s: Pointer[Int8, _]) raises

Parse an SMT-LIB2 file with assertions, soft constraints and optimization objectives. Add the parsed constraints and objectives to the optimization context.

Parameters:

  • c — - context.
  • o — - optimize context.
  • s — - path to file containing SMT2 specification.

See also: Z3_optimize_from_string, Z3_optimize_to_string

Safe wrapper: Optimize.from_file (auto)

Z3_optimize_from_string

def Z3_optimize_from_string(self, c: Z3_context, o: Z3_optimize, s: Pointer[Int8, _]) raises

Parse an SMT-LIB2 string with assertions, soft constraints and optimization objectives. Add the parsed constraints and objectives to the optimization context.

Parameters:

  • c — - context.
  • o — - optimize context.
  • s — - string containing SMT2 specification.

See also: Z3_optimize_from_file, Z3_optimize_to_string

Safe wrapper: Optimize.from_string (auto)

Z3_optimize_get_assertions

def Z3_optimize_get_assertions(self, c: Z3_context, o: Z3_optimize) raises -> Z3_ast_vector

Return the set of asserted formulas on the optimization context.

Safe wrapper: Optimize.get_assertions (auto)

Z3_optimize_get_help

def Z3_optimize_get_help(self, c: Z3_context, t: Z3_optimize) raises -> Pointer[Int8, MutUntrackedOrigin]

Return a string containing a description of parameters accepted by optimize.

Z3_optimize_get_lower

def Z3_optimize_get_lower(self, c: Z3_context, o: Z3_optimize, idx: UInt32) raises -> Z3_ast

Retrieve lower bound value or approximation for the i'th optimization objective.

An attained, certified irrational algebraic optimum is returned as an exact algebraic numeral by both Z3_optimize_get_lower and Z3_optimize_get_upper. Use Z3_get_algebraic_number_lower and Z3_get_algebraic_number_upper to obtain rational approximations.

A certified finite limit that is not attained includes an infinitesimal term: for example, sqrt(2) - epsilon for a supremum. The finite part can be algebraic even though the whole expression is not an algebraic numeral. Use Z3_optimize_get_lower_as_vector to inspect the finite part and the infinitesimal coefficient separately.

Parameters:

  • c — - context
  • o — - optimization context
  • idx — - index of optimization objective

See also: Z3_optimize_get_upper, Z3_optimize_get_lower_as_vector, Z3_optimize_get_upper_as_vector

Safe wrapper: Optimize.get_lower (manual)

Z3_optimize_get_lower_as_vector

def Z3_optimize_get_lower_as_vector(self, c: Z3_context, o: Z3_optimize, idx: UInt32) raises -> Z3_ast_vector

Retrieve lower bound value or approximation for the i'th optimization objective. The returned vector is of length 3. Its entries are coefficients a, b, c and encode the result of Z3_optimize_get_lower a * infinity + b + c * epsilon. The coefficients a and c are rational numerals. The finite part b is a rational numeral or an exact irrational algebraic numeral when such a bound has been certified. For a finite attained optimum, a and c are zero. A finite open limit has a equal to zero and a nonzero infinitesimal coefficient c, even when b is algebraic.

Parameters:

  • c — - context
  • o — - optimization context
  • idx — - index of optimization objective

See also: Z3_optimize_get_lower, Z3_optimize_get_upper, Z3_optimize_get_upper_as_vector

Safe wrapper: Optimize.get_lower_as_vector (auto)

Z3_optimize_get_model

def Z3_optimize_get_model(self, c: Z3_context, o: Z3_optimize) raises -> Z3_model

Retrieve the model for the last Z3_optimize_check

The error handler is invoked if a model is not available because the commands above were not invoked for the given optimization solver, or if the result was Z3_L_FALSE.

Safe wrapper: Optimize.get_model (manual)

Z3_optimize_get_objectives

def Z3_optimize_get_objectives(self, c: Z3_context, o: Z3_optimize) raises -> Z3_ast_vector

Return objectives on the optimization context. If the objective function is a max-sat objective it is returned as a Pseudo-Boolean (minimization) sum of the form (+ (if f1 w1 0) (if f2 w2 0) ...) If the objective function is entered as a maximization objective, then return the corresponding minimization objective. In this way the resulting objective function is always returned as a minimization objective.

Safe wrapper: Optimize.get_objectives (auto)

Z3_optimize_get_param_descrs

def Z3_optimize_get_param_descrs(self, c: Z3_context, o: Z3_optimize) raises -> Z3_param_descrs

Return the parameter description set for the given optimize object.

Parameters:

  • c — - context
  • o — - optimization context

See also: Z3_optimize_get_help, Z3_optimize_set_params

Safe wrapper: Optimize.get_param_descrs (auto)

Z3_optimize_get_reason_unknown

def Z3_optimize_get_reason_unknown(self, c: Z3_context, d: Z3_optimize) raises -> Pointer[Int8, MutUntrackedOrigin]

Retrieve a string that describes the last status returned by Z3_optimize_check.

Use this method when Z3_optimize_check returns Z3_L_UNDEF.

Safe wrapper: Optimize.get_reason_unknown (auto)

Z3_optimize_get_statistics

def Z3_optimize_get_statistics(self, c: Z3_context, d: Z3_optimize) raises -> Z3_stats

Retrieve statistics information from the last call to Z3_optimize_check

Safe wrapper: Optimize.get_statistics (auto)

Z3_optimize_get_unsat_core

def Z3_optimize_get_unsat_core(self, c: Z3_context, o: Z3_optimize) raises -> Z3_ast_vector

Retrieve the unsat core for the last Z3_optimize_check The unsat core is a subset of the assumptions a.

Safe wrapper: Optimize.get_unsat_core (auto)

Z3_optimize_get_upper

def Z3_optimize_get_upper(self, c: Z3_context, o: Z3_optimize, idx: UInt32) raises -> Z3_ast

Retrieve upper bound value or approximation for the i'th optimization objective.

Certified algebraic optima and finite open limits are returned as described for Z3_optimize_get_lower.

Parameters:

  • c — - context
  • o — - optimization context
  • idx — - index of optimization objective

See also: Z3_optimize_get_lower, Z3_optimize_get_lower_as_vector, Z3_optimize_get_upper_as_vector

Safe wrapper: Optimize.get_upper (manual)

Z3_optimize_get_upper_as_vector

def Z3_optimize_get_upper_as_vector(self, c: Z3_context, o: Z3_optimize, idx: UInt32) raises -> Z3_ast_vector

Retrieve upper bound value or approximation for the i'th optimization objective.

The returned vector has the same coefficient and algebraic-value semantics as Z3_optimize_get_lower_as_vector, and encodes the result of Z3_optimize_get_upper.

Parameters:

  • c — - context
  • o — - optimization context
  • idx — - index of optimization objective

See also: Z3_optimize_get_lower, Z3_optimize_get_upper, Z3_optimize_get_lower_as_vector

Safe wrapper: Optimize.get_upper_as_vector (auto)

Z3_optimize_maximize

def Z3_optimize_maximize(self, c: Z3_context, o: Z3_optimize, t: Z3_ast) raises -> UInt32

Add a maximization constraint.

Parameters:

  • c — - context
  • o — - optimization context
  • t — - arithmetical term

See also: Z3_optimize_minimize

Safe wrapper: Optimize.maximize (manual)

Z3_optimize_minimize

def Z3_optimize_minimize(self, c: Z3_context, o: Z3_optimize, t: Z3_ast) raises -> UInt32

Add a minimization constraint.

Parameters:

  • c — - context
  • o — - optimization context
  • t — - arithmetical term

See also: Z3_optimize_maximize

Safe wrapper: Optimize.minimize (manual)

Z3_optimize_pop

def Z3_optimize_pop(self, c: Z3_context, d: Z3_optimize) raises

Backtrack one level.

Precondition: The number of calls to pop cannot exceed calls to push.

See also: Z3_optimize_push

Safe wrapper: Optimize.pop (manual)

Z3_optimize_push

def Z3_optimize_push(self, c: Z3_context, d: Z3_optimize) raises

Create a backtracking point.

The optimize solver contains a set of rules, added facts and assertions. The set of rules, facts and assertions are restored upon calling Z3_optimize_pop.

See also: Z3_optimize_pop

Safe wrapper: Optimize.push (manual)

Z3_optimize_register_model_eh

def Z3_optimize_register_model_eh(self, c: Z3_context, o: Z3_optimize, m: Z3_model, ctx: Pointer[mut=True, NoneType, _], model_eh: Ptr) raises

register a model event handler for new models.

Safe wrapper: Optimize.set_on_model (manual)

Z3_optimize_set_initial_value

def Z3_optimize_set_initial_value(self, c: Z3_context, o: Z3_optimize, v: Z3_ast, val: Z3_ast) raises

provide an initialization hint to the solver. The initialization hint is used to calibrate an initial value of the expression that represents a variable. If the variable is Boolean, the initial phase is set according to value. If the variable is an integer or real, the initial Simplex tableau is recalibrated to attempt to follow the value assignment.

Safe wrapper: Optimize.set_initial_value (auto)

Z3_optimize_set_params

def Z3_optimize_set_params(self, c: Z3_context, o: Z3_optimize, p: Z3_params) raises

Set parameters on optimization context, including parameters for the underlying SMT solver.

Parameters:

  • c — - context
  • o — - optimization context
  • p — - parameters

See also: Z3_optimize_get_help, Z3_optimize_get_param_descrs

Safe wrapper: Optimize.set_params (manual)

Z3_optimize_to_string

def Z3_optimize_to_string(self, c: Z3_context, o: Z3_optimize) raises -> Pointer[Int8, MutUntrackedOrigin]

Print the current context as a string.

Parameters:

  • c — - context.
  • o — - optimization context.

See also: Z3_optimize_from_file, Z3_optimize_from_string

Safe wrapper: Optimize.to_string (manual)

Z3_optimize_translate

def Z3_optimize_translate(self, c: Z3_context, o: Z3_optimize, target: Z3_context) raises -> Z3_optimize

Copy an optimization context from a source to a target context.

This function allows translating an optimization context from one Z3_context to another. This is useful when working with multiple contexts and needing to transfer optimization problems between them.

Parameters:

  • c — Source context containing the optimization context to translate
  • o — The optimization context to translate from the source context
  • target — Target context where the optimization context will be created

Returns: A new optimization context in the target context with the same state

Safe wrapper: Optimize.translate (auto)

Lifecycle & refcounting (2 functions — handled automatically by RAII)
C Function Mojo CApi Signature
Z3_optimize_dec_ref def Z3_optimize_dec_ref(self, c: Z3_context, d: Z3_optimize)
Z3_optimize_inc_ref def Z3_optimize_inc_ref(self, c: Z3_context, d: Z3_optimize) raises

z3_polynomial.h (1 functions)

Polynomials (1)

Z3_polynomial_subresultants

def Z3_polynomial_subresultants(self, c: Z3_context, p: Z3_ast, q: Z3_ast, x: Z3_ast) raises -> Z3_ast_vector

Return the nonzero subresultants of p and q with respect to the "variable" x.

Precondition: p, q and x are Z3 expressions where p and q are arithmetic terms. Note that, any subterm that cannot be viewed as a polynomial is assumed to be a variable. Example: f(a) is a considered to be a variable in the polynomial f(a)*f(a) + 2*f(a) + 1

Safe wrapper: Context.polynomial_subresultants (auto)

z3_rcf.h (37 functions)

Real Closed Fields (36)

Z3_rcf_add

def Z3_rcf_add(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Z3_rcf_num

Return the value a + b.

Safe wrapper: RcfNum.add (auto)

Z3_rcf_coefficient

def Z3_rcf_coefficient(self, c: Z3_context, a: Z3_rcf_num, i: UInt32) raises -> Z3_rcf_num

Extract a coefficient from an algebraic number.

Precondition: Z3_rcf_is_algebraic(ctx, a);

Safe wrapper: RcfNum.coefficient (auto)

Z3_rcf_div

def Z3_rcf_div(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Z3_rcf_num

Return the value a / b.

Safe wrapper: RcfNum.div (auto)

Z3_rcf_eq

def Z3_rcf_eq(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Bool

Return true if a == b.

Safe wrapper: RcfNum.eq (auto)

Z3_rcf_extension_index

def Z3_rcf_extension_index(self, c: Z3_context, a: Z3_rcf_num) raises -> UInt32

Return the index of a field extension.

Safe wrapper: RcfNum.extension_index (auto)

Z3_rcf_ge

def Z3_rcf_ge(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Bool

Return true if a >= b.

Safe wrapper: RcfNum.ge (auto)

Z3_rcf_get_numerator_denominator

def Z3_rcf_get_numerator_denominator(self, c: Z3_context, a: Z3_rcf_num, n: Pointer[mut=True, Z3_rcf_num, _], d: Pointer[mut=True, Z3_rcf_num, _]) raises

Extract the "numerator" and "denominator" of the given RCF numeral. We have that a = n/d, moreover n and d are not represented using rational functions.

Safe wrapper: RcfNum.numerator_denominator (manual)

Z3_rcf_gt

def Z3_rcf_gt(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Bool

Return true if a > b.

Safe wrapper: RcfNum.gt (auto)

Z3_rcf_infinitesimal_name

def Z3_rcf_infinitesimal_name(self, c: Z3_context, a: Z3_rcf_num) raises -> Z3_symbol

Return the name of an infinitesimal.

Precondition: Z3_rcf_is_infinitesimal(ctx, a);

Safe wrapper: RcfNum.infinitesimal_name (auto)

Z3_rcf_interval

def Z3_rcf_interval(self, c: Z3_context, a: Z3_rcf_num, lower_is_inf: Pointer[mut=True, UInt8, _], lower_is_open: Pointer[mut=True, UInt8, _], lower: Pointer[mut=True, Z3_rcf_num, _], upper_is_inf: Pointer[mut=True, UInt8, _], upper_is_open: Pointer[mut=True, UInt8, _], upper: Pointer[mut=True, Z3_rcf_num, _]) raises -> Int32

Extract an interval from an algebraic number.

Precondition: Z3_rcf_is_algebraic(ctx, a);

Safe wrapper: RcfNum.interval (manual)

Z3_rcf_inv

def Z3_rcf_inv(self, c: Z3_context, a: Z3_rcf_num) raises -> Z3_rcf_num

Return the value 1/a.

Safe wrapper: RcfNum.inv (auto)

Z3_rcf_is_algebraic

def Z3_rcf_is_algebraic(self, c: Z3_context, a: Z3_rcf_num) raises -> Bool

Return true if a represents an algebraic number.

Safe wrapper: RcfNum.is_algebraic (auto)

Z3_rcf_is_infinitesimal

def Z3_rcf_is_infinitesimal(self, c: Z3_context, a: Z3_rcf_num) raises -> Bool

Return true if a represents an infinitesimal.

Safe wrapper: RcfNum.is_infinitesimal (auto)

Z3_rcf_is_rational

def Z3_rcf_is_rational(self, c: Z3_context, a: Z3_rcf_num) raises -> Bool

Return true if a represents a rational number.

Safe wrapper: RcfNum.is_rational (auto)

Z3_rcf_is_transcendental

def Z3_rcf_is_transcendental(self, c: Z3_context, a: Z3_rcf_num) raises -> Bool

Return true if a represents a transcendental number.

Safe wrapper: RcfNum.is_transcendental (auto)

Z3_rcf_le

def Z3_rcf_le(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Bool

Return true if a <= b.

Safe wrapper: RcfNum.le (auto)

Z3_rcf_lt

def Z3_rcf_lt(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Bool

Return true if a < b.

Safe wrapper: RcfNum.lt (auto)

Z3_rcf_mk_e

def Z3_rcf_mk_e(self, c: Z3_context) raises -> Z3_rcf_num

Return e (Euler's constant)

Safe wrapper: Context.mk_rcf_e (manual)

Z3_rcf_mk_infinitesimal

def Z3_rcf_mk_infinitesimal(self, c: Z3_context) raises -> Z3_rcf_num

Return a new infinitesimal that is smaller than all elements in the Z3 field.

Safe wrapper: Context.mk_rcf_infinitesimal (manual)

Z3_rcf_mk_pi

def Z3_rcf_mk_pi(self, c: Z3_context) raises -> Z3_rcf_num

Return Pi

Safe wrapper: Context.mk_rcf_pi (manual)

Z3_rcf_mk_rational

def Z3_rcf_mk_rational(self, c: Z3_context, val: Pointer[Int8, _]) raises -> Z3_rcf_num

Return a RCF rational using the given string.

Safe wrapper: Context.mk_rcf_rational (manual)

Z3_rcf_mk_roots

def Z3_rcf_mk_roots(self, c: Z3_context, n: UInt32, a: Pointer[Z3_rcf_num, _], roots: Pointer[mut=True, Z3_rcf_num, _]) raises -> UInt32

Store in roots the roots of the polynomial a[n-1]*x^{n-1} + ... + a[0]. The output vector roots must have size n. It returns the number of roots of the polynomial.

Precondition: The input polynomial is not the zero polynomial.

Safe wrapper: RcfNum.mk_roots (manual)

Z3_rcf_mk_small_int

def Z3_rcf_mk_small_int(self, c: Z3_context, val: Int32) raises -> Z3_rcf_num

Return a RCF small integer.

Safe wrapper: Context.mk_rcf_int (manual)

Z3_rcf_mul

def Z3_rcf_mul(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Z3_rcf_num

Return the value a * b.

Safe wrapper: RcfNum.mul (auto)

Z3_rcf_neg

def Z3_rcf_neg(self, c: Z3_context, a: Z3_rcf_num) raises -> Z3_rcf_num

Return the value -a.

Safe wrapper: RcfNum.neg (auto)

Z3_rcf_neq

def Z3_rcf_neq(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Bool

Return true if a != b.

Safe wrapper: RcfNum.neq (auto)

Z3_rcf_num_coefficients

def Z3_rcf_num_coefficients(self, c: Z3_context, a: Z3_rcf_num) raises -> UInt32

Return the number of coefficients in an algebraic number.

Precondition: Z3_rcf_is_algebraic(ctx, a);

Safe wrapper: RcfNum.num_coefficients (auto)

Z3_rcf_num_sign_condition_coefficients

def Z3_rcf_num_sign_condition_coefficients(self, c: Z3_context, a: Z3_rcf_num, i: UInt32) raises -> UInt32

Return the number of sign condition polynomial coefficients of an algebraic number.

Precondition: Z3_rcf_is_algebraic(ctx, a);

Safe wrapper: RcfNum.num_sign_condition_coefficients (auto)

Z3_rcf_num_sign_conditions

def Z3_rcf_num_sign_conditions(self, c: Z3_context, a: Z3_rcf_num) raises -> UInt32

Return the number of sign conditions of an algebraic number.

Precondition: Z3_rcf_is_algebraic(ctx, a);

Safe wrapper: RcfNum.num_sign_conditions (auto)

Z3_rcf_num_to_decimal_string

def Z3_rcf_num_to_decimal_string(self, c: Z3_context, a: Z3_rcf_num, prec: UInt32) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert the RCF numeral into a string in decimal notation.

Safe wrapper: RcfNum.to_decimal (manual)

Z3_rcf_num_to_string

def Z3_rcf_num_to_string(self, c: Z3_context, a: Z3_rcf_num, compact: Bool, html: Bool) raises -> Pointer[Int8, MutUntrackedOrigin]

Convert the RCF numeral into a string.

Safe wrapper: RcfNum.to_string (manual)

Z3_rcf_power

def Z3_rcf_power(self, c: Z3_context, a: Z3_rcf_num, k: UInt32) raises -> Z3_rcf_num

Return the value a^k.

Safe wrapper: RcfNum.power (auto)

Z3_rcf_sign_condition_coefficient

def Z3_rcf_sign_condition_coefficient(self, c: Z3_context, a: Z3_rcf_num, i: UInt32, j: UInt32) raises -> Z3_rcf_num

Extract the j-th polynomial coefficient of the i-th sign condition.

Precondition: Z3_rcf_is_algebraic(ctx, a);

Safe wrapper: RcfNum.sign_condition_coefficient (auto)

Z3_rcf_sign_condition_sign

def Z3_rcf_sign_condition_sign(self, c: Z3_context, a: Z3_rcf_num, i: UInt32) raises -> Int32

Extract the sign of a sign condition from an algebraic number.

Precondition: Z3_rcf_is_algebraic(ctx, a);

Safe wrapper: RcfNum.sign_condition_sign (auto)

Z3_rcf_sub

def Z3_rcf_sub(self, c: Z3_context, a: Z3_rcf_num, b: Z3_rcf_num) raises -> Z3_rcf_num

Return the value a - b.

Safe wrapper: RcfNum.sub (auto)

Z3_rcf_transcendental_name

def Z3_rcf_transcendental_name(self, c: Z3_context, a: Z3_rcf_num) raises -> Z3_symbol

Return the name of a transcendental.

Precondition: Z3_rcf_is_transcendtal(ctx, a);

Safe wrapper: RcfNum.transcendental_name (auto)

Lifecycle & refcounting (1 functions — handled automatically by RAII)
C Function Mojo CApi Signature
Z3_rcf_del def Z3_rcf_del(self, c: Z3_context, a: Z3_rcf_num)

z3_spacer.h (11 functions)

Spacer facilities (11)

Z3_fixedpoint_add_invariant

def Z3_fixedpoint_add_invariant(self, c: Z3_context, d: Z3_fixedpoint, pred: Z3_func_decl, property: Z3_ast) raises

Add an invariant for the predicate pred. Add an assumed invariant of predicate pred.

Note: this functionality is Spacer specific.

Safe wrapper: Fixedpoint.add_invariant (auto)

Z3_fixedpoint_get_ground_sat_answer

def Z3_fixedpoint_get_ground_sat_answer(self, c: Z3_context, d: Z3_fixedpoint) raises -> Z3_ast

Retrieve a bottom-up (from query) sequence of ground facts

The previous call to Z3_fixedpoint_query must have returned Z3_L_TRUE.

Safe wrapper: Fixedpoint.get_ground_sat_answer (auto)

Z3_fixedpoint_get_reachable

def Z3_fixedpoint_get_reachable(self, c: Z3_context, d: Z3_fixedpoint, pred: Z3_func_decl) raises -> Z3_ast

Retrieve reachable states of a predicate. Note: this functionality is Spacer specific.

Safe wrapper: Fixedpoint.get_reachable (auto)

Z3_fixedpoint_get_rule_names_along_trace

def Z3_fixedpoint_get_rule_names_along_trace(self, c: Z3_context, d: Z3_fixedpoint) raises -> Z3_symbol

Obtain the list of rules along the counterexample trace.

Z3_fixedpoint_get_rules_along_trace

def Z3_fixedpoint_get_rules_along_trace(self, c: Z3_context, d: Z3_fixedpoint) raises -> Z3_ast_vector

Obtain the list of rules along the counterexample trace.

Safe wrapper: Fixedpoint.get_rules_along_trace (auto)

Z3_fixedpoint_query_from_lvl

def Z3_fixedpoint_query_from_lvl(self, c: Z3_context, d: Z3_fixedpoint, query: Z3_ast, lvl: UInt32) raises -> Lbool

Pose a query against the asserted rules at the given level.

query ::= (exists (bound-vars) query)
      |  literals

query returns

  • Z3_L_FALSE if the query is unsatisfiable.
  • Z3_L_TRUE if the query is satisfiable. Obtain the answer by calling Z3_fixedpoint_get_answer.
  • Z3_L_UNDEF if the query was interrupted, timed out or otherwise failed.

Safe wrapper: Fixedpoint.query_from_lvl (auto)

Z3_model_extrapolate

def Z3_model_extrapolate(self, c: Z3_context, m: Z3_model, fml: Z3_ast) raises -> Z3_ast

Extrapolates a model of a formula

Safe wrapper: Model.extrapolate (auto)

Z3_qe_lite

def Z3_qe_lite(self, c: Z3_context, vars: Z3_ast_vector, body: Z3_ast) raises -> Z3_ast

Best-effort quantifier elimination

Safe wrapper: Context.qe_lite (auto)

Z3_qe_model_project

def Z3_qe_model_project(self, c: Z3_context, m: Z3_model, num_bounds: UInt32, bound: Pointer[Z3_app, _], body: Z3_ast) raises -> Z3_ast

Project variables given a model

Safe wrapper: Context.qe_model_project (auto)

Z3_qe_model_project_skolem

def Z3_qe_model_project_skolem(self, c: Z3_context, m: Z3_model, num_bounds: UInt32, bound: Pointer[Z3_app, _], body: Z3_ast, map: Z3_ast_map) raises -> Z3_ast

Project variables given a model

Safe wrapper: Context.qe_model_project_skolem (auto)

Z3_qe_model_project_with_witness

def Z3_qe_model_project_with_witness(self, c: Z3_context, m: Z3_model, num_bounds: UInt32, bound: Pointer[Z3_app, _], body: Z3_ast, map: Z3_ast_map) raises -> Z3_ast

Project with witness extraction.

The returned map contains a binding of variables to terms that such that when the binding is used for the formula, it remains true within the model.

z3_mojo v5.3.3.0 for Mojo 1.2 and Z3 5.3.3 · Apache License 2.0 with LLVM Exceptions · Source on GitHub