Also incorporates into sygus term database. For SyMO, oracle function symbols act analogously to recursive function definitions; the oracle checker is used to rewrite terms in the same contexts as when recursive function definitions are evaluated.
void SetDefaults::setDefaultsPre(Options& opts)
{
+
+ if (opts.quantifiers.oracles)
+ {
+ throw OptionException(std::string("Oracles not yet supported"));
+ }
// implied options
if (opts.smt.debugCheckModels)
{
return os;
}
-TermDbSygus::TermDbSygus(Env& env, QuantifiersState& qs)
+TermDbSygus::TermDbSygus(Env& env, QuantifiersState& qs, OracleChecker* oc)
: EnvObj(env),
d_qstate(qs),
d_syexp(new SygusExplain(this)),
d_funDefEval(new FunDefEvaluator(env)),
- d_eval_unfold(new SygusEvalUnfold(env, this))
+ d_eval_unfold(new SygusEvalUnfold(env, this)),
+ d_ochecker(oc)
{
d_true = NodeManager::currentNM()->mkConst( true );
d_false = NodeManager::currentNM()->mkConst( false );
Node TermDbSygus::rewriteNode(Node n) const
{
+ Trace("sygus-rewrite") << "Rewrite node: " << n << std::endl;
Node res;
if (options().datatypes.sygusRewriter == options::SygusRewriterMode::EXTENDED)
{
{
res = rewrite(n);
}
+ Trace("sygus-rewrite") << "Rewrite node post-rewrite: " << res << std::endl;
if (res.isConst())
{
// constant, we are done
Node fres = d_funDefEval->evaluateDefinitions(res);
if (!fres.isNull())
{
- return fres;
+ res = fres;
}
// It may have failed, in which case there are undefined symbols in res or
// we reached the limit of evaluations. In this case, we revert to the
// result of rewriting in the return statement below.
}
+ Trace("sygus-rewrite") << "Rewrite node post-rec-fun: " << res << std::endl;
+ }
+ if (d_ochecker != nullptr)
+ {
+ // evaluate oracles
+ res = d_ochecker->evaluate(res);
+ Trace("sygus-rewrite") << "Rewrite node post-oracles: " << res << std::endl;
}
return res;
}
#include "smt/env_obj.h"
#include "theory/quantifiers/extended_rewrite.h"
#include "theory/quantifiers/fun_def_evaluator.h"
+#include "theory/quantifiers/oracle_checker.h"
#include "theory/quantifiers/sygus/sygus_eval_unfold.h"
#include "theory/quantifiers/sygus/sygus_explain.h"
#include "theory/quantifiers/sygus/type_info.h"
class TermDbSygus : protected EnvObj
{
public:
- TermDbSygus(Env& env, QuantifiersState& qs);
+ TermDbSygus(Env& env, QuantifiersState& qs, OracleChecker* oc = nullptr);
~TermDbSygus() {}
/** Finish init, which sets the inference manager */
void finishInit(QuantifiersInferenceManager* qim);
FunDefEvaluator* getFunDefEvaluator() { return d_funDefEval.get(); }
/** evaluation unfolding utility */
SygusEvalUnfold* getEvalUnfold() { return d_eval_unfold.get(); }
+ /** get the oracle checker */
+ OracleChecker* getOracleChecker() { return d_ochecker; }
//------------------------------end utilities
//------------------------------enumerators
SygusTypeInfo& getTypeInfo(TypeNode tn);
/**
* Rewrite the given node using the utilities in this class. This may
- * involve (recursive function) evaluation.
+ * involve (recursive function) evaluation, and oracle evaluation.
*/
Node rewriteNode(Node n) const;
std::unique_ptr<FunDefEvaluator> d_funDefEval;
/** evaluation function unfolding utility */
std::unique_ptr<SygusEvalUnfold> d_eval_unfold;
+ /** Pointer to the oracle checker */
+ OracleChecker* d_ochecker;
//------------------------------end utilities
//------------------------------enumerators
#include "theory/quantifiers/first_order_model.h"
#include "theory/quantifiers/fmf/first_order_model_fmc.h"
#include "theory/quantifiers/ho_term_database.h"
+#include "theory/quantifiers/oracle_checker.h"
#include "theory/quantifiers/quantifiers_attributes.h"
#include "theory/quantifiers/quantifiers_state.h"
#include "theory/quantifiers/term_util.h"
: new TermDb(env, qs, qr)),
d_echeck(new EntailmentCheck(env, qs, *d_termDb.get())),
d_sygusTdb(nullptr),
+ d_ochecker(nullptr),
d_qmodel(nullptr)
{
+ if (options().quantifiers.oracles)
+ {
+ d_ochecker.reset(new OracleChecker(env));
+ }
if (options().quantifiers.sygus || options().quantifiers.sygusInst)
{
// must be constructed here since it is required for datatypes finistInit
- d_sygusTdb.reset(new TermDbSygus(env, qs));
+ d_sygusTdb.reset(new TermDbSygus(env, qs, d_ochecker.get()));
}
Trace("quant-engine-debug") << "Initialize quantifiers engine." << std::endl;
Trace("quant-engine-debug")
return d_sygusTdb.get();
}
+OracleChecker* TermRegistry::getOracleChecker() const
+{
+ return d_ochecker.get();
+}
+
EntailmentCheck* TermRegistry::getEntailmentCheck() const
{
return d_echeck.get();
namespace quantifiers {
class FirstOrderModel;
+class OracleChecker;
/**
* Term Registry, which manages notifying modules within quantifiers about
TermDb* getTermDatabase() const;
/** get term database sygus */
TermDbSygus* getTermDatabaseSygus() const;
+ /** get oracle checker */
+ OracleChecker* getOracleChecker() const;
/** get entailment check utility */
EntailmentCheck* getEntailmentCheck() const;
/** get term enumeration utility */
std::unique_ptr<EntailmentCheck> d_echeck;
/** sygus term database */
std::unique_ptr<TermDbSygus> d_sygusTdb;
+ /** oracle checker */
+ std::unique_ptr<OracleChecker> d_ochecker;
/** extended model object */
FirstOrderModel* d_qmodel;
};