diff options
author | Haniel Barbosa <hanielbbarbosa@gmail.com> | 2021-06-11 18:29:19 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-11 21:29:19 +0000 |
commit | 8ddd5e82c8e896977d5573b639524264c7207d85 (patch) | |
tree | ee6a94468288397e290cb3db60db76dbdf69e978 /src/parser/smt2/smt2.cpp | |
parent | f10087c3b347da6ef625a2ad92846551ad324d73 (diff) |
Better support for HOL parsing and set up (#6697)
This commit adds a new parser option, --hol, which marks that HOL is being used. This option has the effect of prepending the problem's logic with "HO_", which teels the solver that the logic is higher order. The parser builder, base parser, and SMT2 and TPTP parsers are all updated to work with this new setting, as is the logic info class.
For now this parser option is enabling the --uf-ho option for internal use, since for now higher-order solving relies it. In a future PR this dependency will be removed (since this information is already given to the SMT solver via the logic).
Diffstat (limited to 'src/parser/smt2/smt2.cpp')
-rw-r--r-- | src/parser/smt2/smt2.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/parser/smt2/smt2.cpp b/src/parser/smt2/smt2.cpp index 5961de587..56aebdcf7 100644 --- a/src/parser/smt2/smt2.cpp +++ b/src/parser/smt2/smt2.cpp @@ -315,10 +315,7 @@ bool Smt2::isTheoryEnabled(theory::TheoryId theory) const return d_logic.isTheoryEnabled(theory); } -bool Smt2::isHoEnabled() const -{ - return getLogic().isHigherOrder() && options::getUfHo(d_solver->getOptions()); -} +bool Smt2::isHoEnabled() const { return d_logic.isHigherOrder(); } bool Smt2::logicIsSet() { return d_logicSet; @@ -505,8 +502,7 @@ Command* Smt2::setLogic(std::string name, bool fromCommand) d_logicSet = true; d_logic = name; - // if sygus is enabled, we must enable UF, datatypes, integer arithmetic and - // higher-order + // if sygus is enabled, we must enable UF, datatypes, and integer arithmetic if(sygus()) { if (!d_logic.isQuantified()) { @@ -772,7 +768,7 @@ void Smt2::checkLogicAllowsFunctions() parseError( "Functions (of non-zero arity) cannot " "be declared in logic " - + d_logic.getLogicString() + " unless option --uf-ho is used"); + + d_logic.getLogicString() + ". Try adding the prefix HO_."); } } @@ -1012,8 +1008,6 @@ api::Term Smt2::applyParseOp(ParseOp& p, std::vector<api::Term>& args) } } } - // Second phase: apply the arguments to the parse op - const Options& opts = d_solver->getOptions(); // handle special cases if (p.d_kind == api::CONST_ARRAY && !p.d_type.isNull()) { @@ -1102,17 +1096,17 @@ api::Term Smt2::applyParseOp(ParseOp& p, std::vector<api::Term>& args) } else if (isBuiltinOperator) { - if (!options::getUfHo(opts) - && (kind == api::EQUAL || kind == api::DISTINCT)) + if (!isHoEnabled() && (kind == api::EQUAL || kind == api::DISTINCT)) { - // need --uf-ho if these operators are applied over function args + // need hol if these operators are applied over function args for (std::vector<api::Term>::iterator i = args.begin(); i != args.end(); ++i) { if ((*i).getSort().isFunction()) { parseError( - "Cannot apply equalty to functions unless --uf-ho is set."); + "Cannot apply equalty to functions unless logic is prefixed by " + "HO_."); } } } @@ -1155,9 +1149,11 @@ api::Term Smt2::applyParseOp(ParseOp& p, std::vector<api::Term>& args) unsigned arity = argt.getFunctionArity(); if (args.size() - 1 < arity) { - if (!options::getUfHo(opts)) + if (!isHoEnabled()) { - parseError("Cannot partially apply functions unless --uf-ho is set."); + parseError( + "Cannot partially apply functions unless logic is prefixed by " + "HO_."); } Debug("parser") << "Partial application of " << args[0]; Debug("parser") << " : #argTypes = " << arity; |