mirror of
https://github.com/Z3Prover/z3
synced 2025-08-04 18:30:24 +00:00
Store uncomputable symbols in synth_solver
This commit is contained in:
parent
3df12a641f
commit
272cb14b19
3 changed files with 41 additions and 17 deletions
|
@ -41,6 +41,8 @@ namespace synth {
|
|||
name = "synthesiz3";
|
||||
break;
|
||||
case OP_DECLARE_GRAMMAR:
|
||||
name = "uncomputable";
|
||||
break;
|
||||
default:
|
||||
NOT_IMPLEMENTED_YET();
|
||||
}
|
||||
|
@ -51,6 +53,7 @@ namespace synth {
|
|||
void plugin::get_op_names(svector<builtin_name> & op_names, symbol const & logic) {
|
||||
if (logic == symbol::null) {
|
||||
op_names.push_back(builtin_name("synthesiz3", OP_DECLARE_OUTPUT));
|
||||
op_names.push_back(builtin_name("uncomputable", OP_DECLARE_GRAMMAR));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,10 @@ namespace synth {
|
|||
|
||||
}
|
||||
|
||||
bool solver::contains_uncomputable(expr* e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool solver::synthesize(app* e) {
|
||||
|
||||
if (e->get_num_args() == 0)
|
||||
|
@ -101,6 +105,17 @@ namespace synth {
|
|||
// where we collect statistics (number of invocations?)
|
||||
void solver::collect_statistics(statistics& st) const {}
|
||||
|
||||
void solver::add_uncomputable(app* e) {
|
||||
for (unsigned i = 0; i < e->get_num_args(); ++i) {
|
||||
expr* a = e->get_arg(i);
|
||||
if (is_app(a)) {
|
||||
func_decl* f = to_app(a)->get_decl();
|
||||
m_uncomputable.insert(f);
|
||||
ctx.push(insert_obj_trail(m_uncomputable, f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// recognize synthesis objectives here.
|
||||
sat::literal solver::internalize(expr* e, bool sign, bool root) {
|
||||
internalize(e);
|
||||
|
@ -119,6 +134,8 @@ namespace synth {
|
|||
synth::util util(m);
|
||||
if (util.is_synthesiz3(e))
|
||||
ctx.push_vec(m_synth, to_app(e));
|
||||
if (util.is_grammar(e))
|
||||
add_uncomputable(to_app(e));
|
||||
}
|
||||
|
||||
// display current state (eg. current set of realizers)
|
||||
|
|
|
@ -14,6 +14,7 @@ Author:
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "muz/spacer/spacer_util.h"
|
||||
#include "sat/smt/sat_th.h"
|
||||
#include "solver/solver.h"
|
||||
|
||||
|
@ -45,8 +46,11 @@ namespace synth {
|
|||
|
||||
private:
|
||||
bool synthesize(app* e);
|
||||
void add_uncomputable(app* e);
|
||||
bool contains_uncomputable(expr* e);
|
||||
|
||||
ptr_vector<app> m_synth;
|
||||
spacer::func_decl_set m_uncomputable;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue