mirror of
https://github.com/Z3Prover/z3
synced 2025-06-14 01:46:15 +00:00
Formatting, mostly tabs.
Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
parent
cad841cff4
commit
0381e4317a
10 changed files with 1448 additions and 1478 deletions
|
@ -3197,7 +3197,7 @@ void fpa2bv_converter::mk_rounding_mode(func_decl * f, expr_ref & result)
|
||||||
|
|
||||||
void fpa2bv_converter::dbg_decouple(const char * prefix, expr_ref & e) {
|
void fpa2bv_converter::dbg_decouple(const char * prefix, expr_ref & e) {
|
||||||
#ifdef Z3DEBUG
|
#ifdef Z3DEBUG
|
||||||
// return;
|
return;
|
||||||
// CMW: This works only for quantifier-free formulas.
|
// CMW: This works only for quantifier-free formulas.
|
||||||
expr_ref new_e(m);
|
expr_ref new_e(m);
|
||||||
new_e = m.mk_fresh_const(prefix, m.get_sort(e));
|
new_e = m.mk_fresh_const(prefix, m.get_sort(e));
|
||||||
|
|
|
@ -172,8 +172,7 @@ namespace Duality {
|
||||||
Term b(ctx);
|
Term b(ctx);
|
||||||
std::vector<Term> v;
|
std::vector<Term> v;
|
||||||
RedVars(child, b, v);
|
RedVars(child, b, v);
|
||||||
for (unsigned i = 0; i < args.size(); i++)
|
for (unsigned i = 0; i < args.size(); i++) {
|
||||||
{
|
|
||||||
if (eq(args[i].get_sort(), ctx.bool_sort()))
|
if (eq(args[i].get_sort(), ctx.bool_sort()))
|
||||||
args[i] = ctx.make(Iff, args[i], v[i]);
|
args[i] = ctx.make(Iff, args[i], v[i]);
|
||||||
else
|
else
|
||||||
|
@ -231,8 +230,7 @@ namespace Duality {
|
||||||
res = it->second;
|
res = it->second;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -242,18 +240,15 @@ namespace Duality {
|
||||||
if (rit != e->relMap.end())
|
if (rit != e->relMap.end())
|
||||||
res = RedDualRela(e, args, (rit->second));
|
res = RedDualRela(e, args, (rit->second));
|
||||||
else {
|
else {
|
||||||
if (args.size() == 0 && f.get_decl_kind() == Uninterpreted && !ls->is_constant(f))
|
if (args.size() == 0 && f.get_decl_kind() == Uninterpreted && !ls->is_constant(f)) {
|
||||||
{
|
|
||||||
res = HideVariable(t, e->number);
|
res = HideVariable(t, e->number);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
res = f(args.size(), &args[0]);
|
res = f(args.size(), &args[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (t.is_quantifier())
|
else if (t.is_quantifier()) {
|
||||||
{
|
|
||||||
std::vector<expr> pats;
|
std::vector<expr> pats;
|
||||||
t.get_patterns(pats);
|
t.get_patterns(pats);
|
||||||
for (unsigned i = 0; i < pats.size(); i++)
|
for (unsigned i = 0; i < pats.size(); i++)
|
||||||
|
@ -353,8 +348,7 @@ namespace Duality {
|
||||||
std::pair<hash_map<ast,Term>::iterator, bool> bar = memo.insert(foo);
|
std::pair<hash_map<ast,Term>::iterator, bool> bar = memo.insert(foo);
|
||||||
Term &res = bar.first->second;
|
Term &res = bar.first->second;
|
||||||
if(!bar.second) return res;
|
if(!bar.second) return res;
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -362,8 +356,7 @@ namespace Duality {
|
||||||
args.push_back(SubstRec(memo, t.arg(i)));
|
args.push_back(SubstRec(memo, t.arg(i)));
|
||||||
res = f(args.size(), &args[0]);
|
res = f(args.size(), &args[0]);
|
||||||
}
|
}
|
||||||
else if (t.is_quantifier())
|
else if (t.is_quantifier()) {
|
||||||
{
|
|
||||||
std::vector<expr> pats;
|
std::vector<expr> pats;
|
||||||
t.get_patterns(pats);
|
t.get_patterns(pats);
|
||||||
for (unsigned i = 0; i < pats.size(); i++)
|
for (unsigned i = 0; i < pats.size(); i++)
|
||||||
|
@ -382,8 +375,7 @@ namespace Duality {
|
||||||
std::pair<hash_map<ast,Term>::iterator, bool> bar = memo.insert(foo);
|
std::pair<hash_map<ast,Term>::iterator, bool> bar = memo.insert(foo);
|
||||||
Term &res = bar.first->second;
|
Term &res = bar.first->second;
|
||||||
if(!bar.second) return res;
|
if(!bar.second) return res;
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -394,8 +386,7 @@ namespace Duality {
|
||||||
f = it->second;
|
f = it->second;
|
||||||
res = f(args.size(), &args[0]);
|
res = f(args.size(), &args[0]);
|
||||||
}
|
}
|
||||||
else if (t.is_quantifier())
|
else if (t.is_quantifier()) {
|
||||||
{
|
|
||||||
std::vector<expr> pats;
|
std::vector<expr> pats;
|
||||||
t.get_patterns(pats);
|
t.get_patterns(pats);
|
||||||
for (unsigned i = 0; i < pats.size(); i++)
|
for (unsigned i = 0; i < pats.size(); i++)
|
||||||
|
@ -655,14 +646,12 @@ namespace Duality {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Z3User::Term Z3User::RemoveRedundancyRec(hash_map<ast, Term> &memo, hash_map<ast, Term> &smemo, const Term &t)
|
Z3User::Term Z3User::RemoveRedundancyRec(hash_map<ast, Term> &memo, hash_map<ast, Term> &smemo, const Term &t) {
|
||||||
{
|
|
||||||
std::pair<ast, Term> foo(t, expr(ctx));
|
std::pair<ast, Term> foo(t, expr(ctx));
|
||||||
std::pair<hash_map<ast, Term>::iterator, bool> bar = memo.insert(foo);
|
std::pair<hash_map<ast, Term>::iterator, bool> bar = memo.insert(foo);
|
||||||
Term &res = bar.first->second;
|
Term &res = bar.first->second;
|
||||||
if (!bar.second) return res;
|
if (!bar.second) return res;
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -684,8 +673,7 @@ namespace Duality {
|
||||||
res = f(args.size(), &args[0]);
|
res = f(args.size(), &args[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (t.is_quantifier())
|
else if (t.is_quantifier()) {
|
||||||
{
|
|
||||||
Term body = RemoveRedundancyRec(memo, smemo, t.body());
|
Term body = RemoveRedundancyRec(memo, smemo, t.body());
|
||||||
res = CloneQuantAndSimp(t, body);
|
res = CloneQuantAndSimp(t, body);
|
||||||
}
|
}
|
||||||
|
@ -706,14 +694,12 @@ namespace Duality {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Z3User::Term Z3User::IneqToEqRec(hash_map<ast, Term> &memo, const Term &t)
|
Z3User::Term Z3User::IneqToEqRec(hash_map<ast, Term> &memo, const Term &t) {
|
||||||
{
|
|
||||||
std::pair<ast, Term> foo(t, expr(ctx));
|
std::pair<ast, Term> foo(t, expr(ctx));
|
||||||
std::pair<hash_map<ast, Term>::iterator, bool> bar = memo.insert(foo);
|
std::pair<hash_map<ast, Term>::iterator, bool> bar = memo.insert(foo);
|
||||||
Term &res = bar.first->second;
|
Term &res = bar.first->second;
|
||||||
if (!bar.second) return res;
|
if (!bar.second) return res;
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -736,8 +722,7 @@ namespace Duality {
|
||||||
}
|
}
|
||||||
res = f(args.size(), &args[0]);
|
res = f(args.size(), &args[0]);
|
||||||
}
|
}
|
||||||
else if (t.is_quantifier())
|
else if (t.is_quantifier()) {
|
||||||
{
|
|
||||||
Term body = IneqToEqRec(memo, t.body());
|
Term body = IneqToEqRec(memo, t.body());
|
||||||
res = clone_quantifier(t, body);
|
res = clone_quantifier(t, body);
|
||||||
}
|
}
|
||||||
|
@ -750,14 +735,12 @@ namespace Duality {
|
||||||
return IneqToEqRec(memo,t);
|
return IneqToEqRec(memo,t);
|
||||||
}
|
}
|
||||||
|
|
||||||
Z3User::Term Z3User::SubstRecHide(hash_map<ast, Term> &memo, const Term &t, int number)
|
Z3User::Term Z3User::SubstRecHide(hash_map<ast, Term> &memo, const Term &t, int number) {
|
||||||
{
|
|
||||||
std::pair<ast, Term> foo(t, expr(ctx));
|
std::pair<ast, Term> foo(t, expr(ctx));
|
||||||
std::pair<hash_map<ast, Term>::iterator, bool> bar = memo.insert(foo);
|
std::pair<hash_map<ast, Term>::iterator, bool> bar = memo.insert(foo);
|
||||||
Term &res = bar.first->second;
|
Term &res = bar.first->second;
|
||||||
if (!bar.second) return res;
|
if (!bar.second) return res;
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -855,11 +838,9 @@ namespace Duality {
|
||||||
root->Annotation.Formula = annot;
|
root->Annotation.Formula = annot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPFP::DecodeTree(Node *root, TermTree *interp, int persist)
|
void RPFP::DecodeTree(Node *root, TermTree *interp, int persist) {
|
||||||
{
|
|
||||||
std::vector<TermTree *> &ic = interp->getChildren();
|
std::vector<TermTree *> &ic = interp->getChildren();
|
||||||
if (ic.size() > 0)
|
if (ic.size() > 0) {
|
||||||
{
|
|
||||||
std::vector<Node *> &nc = root->Outgoing->Children;
|
std::vector<Node *> &nc = root->Outgoing->Children;
|
||||||
for (unsigned i = 0; i < nc.size(); i++)
|
for (unsigned i = 0; i < nc.size(); i++)
|
||||||
DecodeTree(nc[i], ic[i], persist);
|
DecodeTree(nc[i], ic[i], persist);
|
||||||
|
@ -926,8 +907,7 @@ namespace Duality {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
expr RPFP::GetEdgeFormula(Edge *e, int persist, bool with_children, bool underapprox)
|
expr RPFP::GetEdgeFormula(Edge *e, int persist, bool with_children, bool underapprox) {
|
||||||
{
|
|
||||||
if (e->dual.null()) {
|
if (e->dual.null()) {
|
||||||
timer_start("ReducedDualEdge");
|
timer_start("ReducedDualEdge");
|
||||||
e->dual = ReducedDualEdge(e);
|
e->dual = ReducedDualEdge(e);
|
||||||
|
@ -970,8 +950,7 @@ namespace Duality {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void RPFP::AssertEdge(Edge *e, int persist, bool with_children, bool underapprox)
|
void RPFP::AssertEdge(Edge *e, int persist, bool with_children, bool underapprox) {
|
||||||
{
|
|
||||||
if (eq(e->F.Formula, ctx.bool_val(true)) && (!with_children || e->Children.empty()))
|
if (eq(e->F.Formula, ctx.bool_val(true)) && (!with_children || e->Children.empty()))
|
||||||
return;
|
return;
|
||||||
expr fmla = GetEdgeFormula(e, persist, with_children, underapprox);
|
expr fmla = GetEdgeFormula(e, persist, with_children, underapprox);
|
||||||
|
@ -1215,8 +1194,7 @@ namespace Duality {
|
||||||
|
|
||||||
void RPFP::AssertNode(Node *n)
|
void RPFP::AssertNode(Node *n)
|
||||||
{
|
{
|
||||||
if (n->dual.null())
|
if (n->dual.null()) {
|
||||||
{
|
|
||||||
n->dual = GetUpperBound(n);
|
n->dual = GetUpperBound(n);
|
||||||
stack.back().nodes.push_back(n);
|
stack.back().nodes.push_back(n);
|
||||||
slvr_add(n->dual);
|
slvr_add(n->dual);
|
||||||
|
@ -1225,8 +1203,7 @@ namespace Duality {
|
||||||
|
|
||||||
// caching version of above
|
// caching version of above
|
||||||
void RPFP_caching::AssertNodeCache(Node *n, std::vector<Term> lits){
|
void RPFP_caching::AssertNodeCache(Node *n, std::vector<Term> lits){
|
||||||
if (n->dual.null())
|
if (n->dual.null()) {
|
||||||
{
|
|
||||||
n->dual = GetUpperBound(n);
|
n->dual = GetUpperBound(n);
|
||||||
stack.back().nodes.push_back(n);
|
stack.back().nodes.push_back(n);
|
||||||
GetAssumptionLits(n->dual, lits);
|
GetAssumptionLits(n->dual, lits);
|
||||||
|
@ -1373,8 +1350,7 @@ namespace Duality {
|
||||||
timer_start("interpolate_tree");
|
timer_start("interpolate_tree");
|
||||||
lbool res = ls_interpolate_tree(tree, interpolant, dualModel,goals,true);
|
lbool res = ls_interpolate_tree(tree, interpolant, dualModel,goals,true);
|
||||||
timer_stop("interpolate_tree");
|
timer_stop("interpolate_tree");
|
||||||
if (res == l_false)
|
if (res == l_false) {
|
||||||
{
|
|
||||||
DecodeTree(root, interpolant->getChildren()[0], persist);
|
DecodeTree(root, interpolant->getChildren()[0], persist);
|
||||||
delete interpolant;
|
delete interpolant;
|
||||||
}
|
}
|
||||||
|
@ -1419,8 +1395,7 @@ namespace Duality {
|
||||||
timer_start("interpolate_tree");
|
timer_start("interpolate_tree");
|
||||||
lbool res = ls_interpolate_tree(tree, interpolant, dualModel,0,true);
|
lbool res = ls_interpolate_tree(tree, interpolant, dualModel,0,true);
|
||||||
timer_stop("interpolate_tree");
|
timer_stop("interpolate_tree");
|
||||||
if (res == l_false)
|
if (res == l_false) {
|
||||||
{
|
|
||||||
DecodeTree(node, interpolant->getChildren()[0], 0);
|
DecodeTree(node, interpolant->getChildren()[0], 0);
|
||||||
delete interpolant;
|
delete interpolant;
|
||||||
}
|
}
|
||||||
|
@ -1461,8 +1436,7 @@ namespace Duality {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
check_result RPFP::Check(Node *root, std::vector<Node *> underapproxes, std::vector<Node *> *underapprox_core )
|
check_result RPFP::Check(Node *root, std::vector<Node *> underapproxes, std::vector<Node *> *underapprox_core) {
|
||||||
{
|
|
||||||
timer_start("Check");
|
timer_start("Check");
|
||||||
ClearProofCore();
|
ClearProofCore();
|
||||||
// if (dualModel != null) dualModel.Dispose();
|
// if (dualModel != null) dualModel.Dispose();
|
||||||
|
@ -1942,8 +1916,7 @@ namespace Duality {
|
||||||
if (resolve_ite_memo.find(t) != resolve_ite_memo.end())
|
if (resolve_ite_memo.find(t) != resolve_ite_memo.end())
|
||||||
return resolve_ite_memo[t];
|
return resolve_ite_memo[t];
|
||||||
Term res;
|
Term res;
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -2085,15 +2058,13 @@ namespace Duality {
|
||||||
params simp_params;
|
params simp_params;
|
||||||
|
|
||||||
VariableProjector(Z3User &_user, std::vector<Term> &keep_vec) :
|
VariableProjector(Z3User &_user, std::vector<Term> &keep_vec) :
|
||||||
Z3User(_user), simp_params()
|
Z3User(_user), simp_params() {
|
||||||
{
|
|
||||||
num_vars = 0;
|
num_vars = 0;
|
||||||
for (unsigned i = 0; i < keep_vec.size(); i++) {
|
for (unsigned i = 0; i < keep_vec.size(); i++) {
|
||||||
keep.insert(keep_vec[i]);
|
keep.insert(keep_vec[i]);
|
||||||
var_ord[keep_vec[i]] = num_vars++;
|
var_ord[keep_vec[i]] = num_vars++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int VarNum(const Term &v) {
|
int VarNum(const Term &v) {
|
||||||
if (var_ord.find(v) == var_ord.end())
|
if (var_ord.find(v) == var_ord.end())
|
||||||
var_ord[v] = num_vars++;
|
var_ord[v] = num_vars++;
|
||||||
|
@ -2122,8 +2093,7 @@ namespace Duality {
|
||||||
std::pair<hash_map<ast, int>::iterator, bool> bar = memo.insert(foo);
|
std::pair<hash_map<ast, int>::iterator, bool> bar = memo.insert(foo);
|
||||||
// int &res = bar.first->second;
|
// int &res = bar.first->second;
|
||||||
if (!bar.second) return;
|
if (!bar.second) return;
|
||||||
if (t.is_app())
|
if (t.is_app()) {
|
||||||
{
|
|
||||||
func_decl f = t.decl();
|
func_decl f = t.decl();
|
||||||
std::vector<Term> args;
|
std::vector<Term> args;
|
||||||
int nargs = t.num_args();
|
int nargs = t.num_args();
|
||||||
|
@ -2508,7 +2478,7 @@ namespace Duality {
|
||||||
expr junct = negate ? Negate(f) : f;
|
expr junct = negate ? Negate(f) : f;
|
||||||
lits.push_back(junct);
|
lits.push_back(junct);
|
||||||
}
|
}
|
||||||
}
|
}|
|
||||||
|
|
||||||
struct TermLt {
|
struct TermLt {
|
||||||
bool operator()(const expr &x, const expr &y){
|
bool operator()(const expr &x, const expr &y){
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Duality {
|
||||||
if(rpfp)
|
if(rpfp)
|
||||||
dealloc(rpfp);
|
dealloc(rpfp);
|
||||||
if(ls)
|
if(ls)
|
||||||
dealloc(ls);
|
(ls);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue