mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
add cnf/nnf simplifier
This commit is contained in:
parent
e3e2c21632
commit
e5984dd397
2 changed files with 15 additions and 5 deletions
|
@ -18,17 +18,20 @@ Author:
|
|||
#pragma once
|
||||
|
||||
#include "ast/simplifiers/dependent_expr_state.h"
|
||||
#include "ast/normal_forms/pull_quant.h"
|
||||
#include "ast/normal_forms/nnf.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
|
||||
|
||||
class cnf_nnf_simplifier : public dependent_expr_simplifier {
|
||||
|
||||
defined_names m_defined_names;
|
||||
th_rewriter m_rewriter;
|
||||
|
||||
public:
|
||||
cnf_nnf_simplifier(ast_manager& m, params_ref const& p, dependent_expr_state& fmls):
|
||||
dependent_expr_simplifier(m, fmls),
|
||||
m_pull(m) {
|
||||
m_defined_names(m),
|
||||
m_rewriter(m, p){
|
||||
}
|
||||
|
||||
char const* name() const override { return "cnf-nnf"; }
|
||||
|
@ -41,17 +44,21 @@ public:
|
|||
expr_ref r(m);
|
||||
unsigned sz = qtail();
|
||||
for (unsigned i = qhead(); i < sz && m.inc(); ++i) {
|
||||
auto d = m_fmls[idx];
|
||||
auto d = m_fmls[i];
|
||||
push_todo.reset();
|
||||
push_todo_prs.reset();
|
||||
apply_nnf(d.fml(), push_todo, push_todo_prs, r, pr);
|
||||
m_fmls.update(i, dependent_expr(m, r, d.dep()));
|
||||
for (expr* f : m_push_todo) {
|
||||
for (expr* f : push_todo) {
|
||||
if (!m.inc())
|
||||
break;
|
||||
m_rewriter(f, r, pr);
|
||||
m_fmls.add(i, depdendent_expr(m, r, d.dep()));
|
||||
m_fmls.add(dependent_expr(m, r, d.dep()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void push() override { dependent_expr_simplifier::push(); m_defined_names.push(); }
|
||||
|
||||
void pop(unsigned n) override { dependent_expr_simplifier::pop(n); m_defined_names.pop(n); }
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue