3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-04 14:25:46 +00:00

Add simplification customization for SMTLIB2

Add the ability to customize incremental pre-processing simplification for the SMTLIB2 front-end. The main new capability is to use pre-processing tactics in incremental mode that were previously not available. The main new capabilities are
- solve-eqs
- reduce-args
- elim-unconstrained
There are several more. Documentation and exposed simplifiers are populated incrementally. The current set of supported simplifiers can be inspected by using z3 with the --simplifiers flag or referring to https://microsoft.github.io/z3guide/docs/strategies/simplifiers

Some pending features are:
- add the ability to update parameters to simplifiers similar to how tactics can be controlled using parameters.
- expose simplification solvers over the binary API.
This commit is contained in:
Nikolaj Bjorner 2023-01-30 22:38:51 -08:00
parent dd0decfe5d
commit 6022c17131
32 changed files with 370 additions and 69 deletions

View file

@ -7,7 +7,7 @@ Module Name:
Abstract:
Collection of tactics & probes
Collection of tactics, simplifiers & probes
Author:
@ -19,8 +19,21 @@ Notes:
#include "cmd_context/tactic_manager.h"
tactic_manager::~tactic_manager() {
finalize_tactic_cmds();
finalize_probes();
finalize_tactic_manager();
}
void tactic_manager::finalize_tactic_manager() {
std::for_each(m_tactics.begin(), m_tactics.end(), delete_proc<tactic_cmd>());
m_tactics.reset();
m_name2tactic.reset();
std::for_each(m_simplifiers.begin(), m_simplifiers.end(), delete_proc<simplifier_cmd>());
m_simplifiers.reset();
m_name2simplifier.reset();
std::for_each(m_probes.begin(), m_probes.end(), delete_proc<probe_info>());
m_probes.reset();
m_name2probe.reset();
}
void tactic_manager::insert(tactic_cmd * c) {
@ -30,6 +43,13 @@ void tactic_manager::insert(tactic_cmd * c) {
m_tactics.push_back(c);
}
void tactic_manager::insert(simplifier_cmd * c) {
symbol const & s = c->get_name();
SASSERT(!m_name2simplifier.contains(s));
m_name2simplifier.insert(s, c);
m_simplifiers.push_back(c);
}
void tactic_manager::insert(probe_info * p) {
symbol const & s = p->get_name();
SASSERT(!m_name2probe.contains(s));
@ -43,20 +63,15 @@ tactic_cmd * tactic_manager::find_tactic_cmd(symbol const & s) const {
return c;
}
simplifier_cmd * tactic_manager::find_simplifier_cmd(symbol const & s) const {
simplifier_cmd * c = nullptr;
m_name2simplifier.find(s, c);
return c;
}
probe_info * tactic_manager::find_probe(symbol const & s) const {
probe_info * p = nullptr;
m_name2probe.find(s, p);
return p;
}
void tactic_manager::finalize_tactic_cmds() {
std::for_each(m_tactics.begin(), m_tactics.end(), delete_proc<tactic_cmd>());
m_tactics.reset();
m_name2tactic.reset();
}
void tactic_manager::finalize_probes() {
std::for_each(m_probes.begin(), m_probes.end(), delete_proc<probe_info>());
m_probes.reset();
m_name2probe.reset();
}