Skip to main content

Overview

Z3 parameters allow you to fine-tune solver behavior, control search strategies, and enable specific features. The parameter system provides a flexible way to configure solvers, tactics, and simplifiers without recompiling.

Core Parameter Types

Z3 supports several parameter types:
  • Boolean - Enable/disable features (e.g., proof, model)
  • Unsigned Integer - Numeric limits and thresholds (e.g., timeout, max_memory)
  • Double - Floating-point values for heuristics
  • Symbol - Named options (e.g., smt.logic, sat.phase)

Creating and Managing Parameters

Basic Parameter Operations

Common Parameter Categories

Timeout and Resource Limits

Control solver execution time and resource consumption:

Proof and Model Generation

Enable proof generation and model production:

SAT Solver Parameters

Configure the underlying SAT solver:

Parameter Discovery

Listing Available Parameters

Query which parameters a solver accepts:

Parameter Validation

Validate parameters before applying them:

Parameter Scopes

Parameters can be set at different levels:

Global Parameters

Set globally via configuration:

Solver Parameters

Set per-solver instance:

Tactic and Simplifier Parameters

Apply parameters to tactics and simplifiers:

Performance Tuning Parameters

SMT Solver Options

Best Practices

When to Use Parameters

Use parameters when you need to:
  • Set timeout limits for production systems
  • Optimize for specific problem domains
  • Enable debugging features (proofs, unsat cores)
  • Ensure reproducible results (set random seeds)
  • Tune performance for large problems

Parameter Naming Conventions

Z3 uses a hierarchical naming scheme:
  • timeout - Global timeout
  • sat.restart - SAT solver restart strategy
  • smt.arith.solver - SMT arithmetic solver selection
  • rewriter.flat - Rewriter flattening option

Common Pitfalls

  1. Setting proof parameters after context creation: Proof generation must be enabled when creating the context
  2. Invalid parameter names: Use parameter discovery to find valid names
  3. Type mismatches: Ensure you use the correct setter for each parameter type
  4. Forgetting reference counting: Always pair inc_ref with dec_ref

Performance Considerations

Memory vs. Time Trade-offs

Reproducibility

API Reference

Parameter Set Management

  • Z3_mk_params - Create a parameter set
  • Z3_params_inc_ref - Increment reference counter (api_params.cpp:42)
  • Z3_params_dec_ref - Decrement reference counter (api_params.cpp:53)
  • Z3_params_to_string - Convert parameters to string (api_params.cpp:113)

Setting Parameters

  • Z3_params_set_bool - Set boolean parameter (api_params.cpp:64)
  • Z3_params_set_uint - Set unsigned integer parameter (api_params.cpp:76)
  • Z3_params_set_double - Set double parameter (api_params.cpp:88)
  • Z3_params_set_symbol - Set symbol parameter (api_params.cpp:100)

Parameter Discovery

  • Z3_solver_get_param_descrs - Get available parameters (api_solver.cpp:413)
  • Z3_param_descrs_size - Number of parameters (api_params.cpp:164)
  • Z3_param_descrs_get_name - Get parameter name (api_params.cpp:172)
  • Z3_param_descrs_get_kind - Get parameter type (api_params.cpp:147)
  • Z3_param_descrs_get_documentation - Get parameter documentation (api_params.cpp:185)

Parameter Validation

  • Z3_params_validate - Validate parameters (api_params.cpp:123)

See Also