Zee3 (zee3 v0.5.0)

Copy Markdown

The main entry point for the Zee3 functionality.

Summary

Functions

Asserts a constraint inside a stateful solver.

Check for satisfiability and get the model in case it is actually satisfiable.

Check for satisfiability and get the model in case it is actually satisfiable. Raises on error.

Check for satisfiability and get the model in case it is actually satisfiable.

Check for satisfiability and get the model in case it is actually satisfiable. Raises on error.

Gets the PID for the current Z3 process. This function only works if called inside a function that was invokes inside a Zee3.program/2 block.

Declares a constant inside a stateful solver.

Declares datatypes inside a stateful solver.

Declares an uninterpreted function inside a stateful solver.

Declares an relation for the fixpoint datalog engine.

Declares a variable which can be used in rules in the datalog engine.

Return an entity id from a value

Runs raw SMT-LIB2 code in the current solver. Resturns {:ok, data} if there are no errors and {:error, data} if there is at least an error. The payload data is the raw output of the solver, parsed into a list of %Smt.XXX values.

Pops the last context from a stateful solver.

Runs code inside the Z3 solver with the given solver_pid using an optimized elixir DSL.

Pushes a new context into a stateful solver.

Query a datalog relation to return all valid pairs.

Query a datalog relation to return all valid pairs. Raises on error.

Declares a rule for the datalog fixpoint engine.

Starts a new stateful solver process.

Stops the stateful solver process.

Functions

assert(solver_pid, constraint)

@spec assert(pid(), binary()) :: :ok

Asserts a constraint inside a stateful solver.

check_sat(solver_pid, opts \\ [])

@spec check_sat(
  pid(),
  keyword()
) :: {:ok, :sat | :unsat | :unknown} | {:error, any()}
@spec check_sat(
  pid(),
  keyword()
) :: :sat | :unsat | :unknown

Check for satisfiability and get the model in case it is actually satisfiable.

check_sat!(solver_pid, opts \\ [])

Check for satisfiability and get the model in case it is actually satisfiable. Raises on error.

check_sat_and_get_model(solver_pid, opts \\ [])

@spec check_sat_and_get_model(
  pid(),
  keyword()
) :: {:ok, any()} | {:error, any()}

Check for satisfiability and get the model in case it is actually satisfiable.

check_sat_and_get_model!(solver_pid, opts \\ [])

@spec check_sat_and_get_model!(
  pid(),
  keyword()
) :: {:sat, any()} | :unsat | :unknown

Check for satisfiability and get the model in case it is actually satisfiable. Raises on error.

current_z3_pid!()

Gets the PID for the current Z3 process. This function only works if called inside a function that was invokes inside a Zee3.program/2 block.

declare_const(solver_pid, name, type_string)

@spec declare_const(pid(), binary(), binary()) :: :ok

Declares a constant inside a stateful solver.

declare_datatypes(solver_pid, smt_declaration, constructor_atoms)

@spec declare_datatypes(pid(), binary(), [atom()]) :: :ok

Declares datatypes inside a stateful solver.

declare_fun(solver_pid, name, param_types, return_type)

@spec declare_fun(pid(), binary(), [binary()], binary()) :: :ok

Declares an uninterpreted function inside a stateful solver.

declare_rel(solver_pid, name, param_types)

@spec declare_rel(pid(), binary(), [binary()]) :: :ok

Declares an relation for the fixpoint datalog engine.

declare_var(solver_pid, name, param_types)

@spec declare_var(pid(), binary(), binary()) :: :ok

Declares a variable which can be used in rules in the datalog engine.

entity_id(solver_pid, value)

Return an entity id from a value

eval_smt2_code(solver_pid, raw_smt2_code)

Runs raw SMT-LIB2 code in the current solver. Resturns {:ok, data} if there are no errors and {:error, data} if there is at least an error. The payload data is the raw output of the solver, parsed into a list of %Smt.XXX values.

pop(pid)

@spec pop(pid()) :: :ok

Pops the last context from a stateful solver.

program(solver_pid, list)

(macro)

Runs code inside the Z3 solver with the given solver_pid using an optimized elixir DSL.

This macro doen't assume its contents are special in any way and it does not assume we want to push a new context. If you want to create or remove a context, you must call push() and pop() inside the body of the macro.

push(pid)

@spec push(pid()) :: :ok

Pushes a new context into a stateful solver.

query(solver_pid, opts \\ [])

Query a datalog relation to return all valid pairs.

query!(solver_pid, opts \\ [])

Query a datalog relation to return all valid pairs. Raises on error.

rule(solver_pid, body)

Declares a rule for the datalog fixpoint engine.

start_solver()

@spec start_solver() :: GenServer.on_start()

Starts a new stateful solver process.

When the solver is started, it automatically pushes a new context.

stop_solver(pid)

@spec stop_solver(pid()) :: :ok

Stops the stateful solver process.