pyfcstm.solver
Public solver helpers for Z3-backed FCSTM analysis.
The solver package is the pure symbolic layer shared by verification
algorithms and future reachability/search work. It translates model
expressions and operation blocks into Z3 formulas, but it does not import
pyfcstm.verify, diagnostics, registries, lifecycle rules, or inspect
policy. FCSTM runtime semantics that need states, transitions, declaration
order, or lifecycle phases live in pyfcstm.verify.
Module map:
Module |
Public entry |
Purpose |
|---|---|---|
|
Translate expressions and declared variables into Z3 values. |
|
|
Return expression values together with runtime-definedness constraints such as non-zero divisors. |
|
|
Parse and symbolically execute operation blocks, including
path-sensitive execution through |
|
|
Wrap small satisfiability, validity, and overlap checks. |
|
Optional safety classifiers |
Provide advisory classification for downstream policy layers; raw verification algorithms do not use it as a default gate. |
|
|
Enumerate satisfying assignments for caller-supplied constraints. |
Example:
>>> import z3
>>> from pyfcstm.model.expr import BinaryOp, Integer, Variable
>>> from pyfcstm.solver import expr_to_z3, solve
>>> # The package-level imports keep the historical simple solver API.
>>> z3_vars = {"x": z3.Int("x")}
>>> expr = BinaryOp(x=Variable("x"), op="+", y=Integer(5))
>>> z3_expr = expr_to_z3(expr, z3_vars)
>>> result = solve([z3_expr == 10], max_solutions=1)
>>> result.status
'sat'
>>> result.solutions[0]["x"]
5
>>> from pyfcstm.solver.domain import translate_expr_domain
>>> # Domain-aware translation also reports runtime preconditions.
>>> div_expr = BinaryOp(x=Variable("x"), op="/", y=Integer(2))
>>> domain = translate_expr_domain(div_expr, z3_vars)
>>> domain.failure is None
True
>>> len(domain.definedness_constraints)
1
- pyfcstm.solver.domain
- pyfcstm.solver.expr
- pyfcstm.solver.logical
- pyfcstm.solver.operation
- pyfcstm.solver.safety
- pyfcstm.solver.solve
__all__
- pyfcstm.solver.__all__ = ['SolveResult', 'create_z3_vars_from_models', 'execute_operations', 'expr_to_z3', 'parse_operations', 'solve']
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.