mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +00:00
model refactor (#4723)
* refactor model fixing Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * missing cond macro Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * file Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * file Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * add macros dependency Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * deps and debug Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * add dependency to normal forms Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * build issues Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * compile Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fix leal regression * complete model fixer Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * fold back private functionality to model_finder Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * avoid duplicate fixed callbacks Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
6cc52e04c3
commit
fa58a36b9f
42 changed files with 2060 additions and 1494 deletions
78
src/sat/smt/q_model_fixer.h
Normal file
78
src/sat/smt/q_model_fixer.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*++
|
||||
Copyright (c) 2020 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
q_model_fixer.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Model-based quantifier instantiation model-finder plugin
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj Bjorner (nbjorner) 2020-10-02
|
||||
|
||||
Notes:
|
||||
|
||||
Derives from smt/smt_model_finder.cpp
|
||||
|
||||
Contains exclusively functionality that adjusts a model to make it
|
||||
easier to satisfy relevant universally quantified literals.
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
||||
#include "sat/smt/sat_th.h"
|
||||
#include "solver/solver.h"
|
||||
#include "model/model_macro_solver.h"
|
||||
|
||||
namespace euf {
|
||||
class solver;
|
||||
}
|
||||
|
||||
namespace q {
|
||||
|
||||
class solver;
|
||||
|
||||
typedef obj_hashtable<func_decl> func_decl_set;
|
||||
|
||||
class projection_function {
|
||||
public:
|
||||
virtual ~projection_function() {}
|
||||
virtual void sort(ptr_buffer<expr>& values) = 0;
|
||||
virtual expr* mk_lt(expr* a, expr* b) = 0;
|
||||
};
|
||||
|
||||
class model_fixer : public quantifier2macro_infos {
|
||||
euf::solver& ctx;
|
||||
solver& m_qs;
|
||||
ast_manager& m;
|
||||
obj_map<quantifier, quantifier_macro_info*> m_q2info;
|
||||
func_decl_dependencies m_dependencies;
|
||||
obj_map<sort, projection_function*> m_projections;
|
||||
|
||||
void add_projection_functions(model& mdl, ptr_vector<quantifier> const& qs);
|
||||
void add_projection_functions(model& mdl, func_decl* f);
|
||||
expr_ref add_projection_function(model& mdl, func_decl* f, unsigned idx);
|
||||
void collect_partial_functions(ptr_vector<quantifier> const& qs, func_decl_set& fns);
|
||||
projection_function* get_projection(sort* srt);
|
||||
|
||||
public:
|
||||
|
||||
model_fixer(euf::solver& ctx, solver& qs);
|
||||
~model_fixer() override {}
|
||||
|
||||
/**
|
||||
* Update model in order to best satisfy quantifiers.
|
||||
* For the array property fragment, update the model
|
||||
* such that the range of functions behaves monotonically
|
||||
* based on regions over the inputs.
|
||||
*/
|
||||
void operator()(model& mdl);
|
||||
|
||||
quantifier_macro_info* operator()(quantifier* q);
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue