Skip to content

Add Z3 Tactics Support via Configuration Options - #748

Open
baierd wants to merge 4 commits into
masterfrom
z3_tactics_support
Open

baierd wants to merge 4 commits into
masterfrom
z3_tactics_support

Conversation

@baierd

@baierd baierd commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Add Z3 tactics via a context based option to the Z3 ProverEnvironment (TheoremProver).

The new option solver.z3.tactics takes a list of Z3 tactic names that are combined in the given order into the solving strategy of each ProverEnvironment.
Unknown tactics, as well as combinations with solver.z3.logic or solver.z3.engine (which Z3 rejects for most tactics), cause an InvalidConfigurationException.
Provers based on tactics do not set the per-solver random seed, as Z3 rejects it for tactics without randomness; the global seed still applies to e.g. 'smt'.

Z3's Native.propagateInit ignores errors, e.g., for tactics without support for
user propagators. We therefore do not allow user propagators if tactics are used. registerUserPropagator
returns false in such cases, and the JavaDoc has been extended to explain it to users.
We also throw SolverExceptions now from registerUserPropagator for critical errors, e.g. for some logics in Z3.

This PR depends on #747 being merged first.

…and add some tests for them, as simplifiers can't be used with unsat-cores or assumption solving currently
…ment. Tactics can not be used with engine/logic options or the user propagator
Z3 only accepts user propagators for tactics ending with 'smt', and the
tactic 'smt' uses them only in the first satisfiability check after their
registration. Other tactics make Z3 fail with an error that its Java API
does not report, and the state of Z3 after such errors is not guaranteed
to be safe. registerUserPropagator() now returns false for provers that
use tactics. Document this in the option solver.z3.tactics and in the
JavaDoc of registerUserPropagator().
registerUserPropagator() now throws a SolverException if the solver fails
to register the user propagator, instead of returning false and thereby
hiding the error. For Z3, this happens e.g. for the logic QF_FD, whose
solver does not support user propagators (and currently also rejects the
parameter 'logic' that we set). Returning false is still used for solvers
and configurations that do not support user propagators at all, e.g. Z3
with tactics. This adds a checked exception to the public API.
@baierd baierd self-assigned this Nov 23, 2026
@baierd baierd added this to the Release 8.0.0 milestone Nov 23, 2026
@baierd baierd added the Z3 label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant