3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-02 09:20:22 +00:00

adding simplifiers layer

simplifiers layer is a common substrate for global non-incremental and incremental processing.
The first two layers are new, but others are to be ported form tactics.

- bv::slice - rewrites equations to cut-dice-slice bit-vector extractions until they align. It creates opportunities for rewriting portions of bit-vectors to common sub-expressions, including values.
- euf::completion - generalizes the KB simplifcation from asserted formulas to use the E-graph to establish a global and order-independent canonization.

The interface dependent_expr_simplifier is amenable to forming tactics. Plugins for asserted-formulas is also possible but not yet realized.
This commit is contained in:
Nikolaj Bjorner 2022-11-02 08:51:30 -07:00
parent 1646a41b2f
commit e57674490f
16 changed files with 1024 additions and 2 deletions

View file

@ -0,0 +1,75 @@
/*++
Copyright (c) 2022 Microsoft Corporation
Module Name:
dependent_expr.h
Abstract:
Container class for dependent expressions.
They represent how assertions are tracked in goals.
Author:
Nikolaj Bjorner (nbjorner) 2022-11-2.
--*/
#pragma once
#include "ast/ast.h"
class dependent_expr {
ast_manager& m;
expr* m_fml;
expr_dependency* m_dep;
public:
dependent_expr(ast_manager& m, expr* fml, expr_dependency* d):
m(m),
m_fml(fml),
m_dep(d) {
SASSERT(fml);
m.inc_ref(fml);
m.inc_ref(d);
}
dependent_expr& operator=(dependent_expr const& other) {
SASSERT(&m == &other.m);
if (this != &other) {
m.inc_ref(other.m_fml);
m.inc_ref(other.m_dep);
m.dec_ref(m_fml);
m.dec_ref(m_dep);
m_fml = other.m_fml;
m_dep = other.m_dep;
}
return *this;
}
dependent_expr(dependent_expr const& other):
m(other.m),
m_fml(other.m_fml),
m_dep(other.m_dep) {
m.inc_ref(m_fml);
m.inc_ref(m_dep);
}
dependent_expr(dependent_expr && other) noexcept :
m(other.m),
m_fml(nullptr),
m_dep(nullptr) {
std::swap(m_fml, other.m_fml);
std::swap(m_dep, other.m_dep);
}
~dependent_expr() {
m.dec_ref(m_fml);
m.dec_ref(m_dep);
m_fml = nullptr;
m_dep = nullptr;
}
std::tuple<expr*, expr_dependency*> operator()() const {
return { m_fml, m_dep };
}
};