diff --git a/include/anthem/Body.h b/include/anthem/Body.h index feb57bf..b7e774d 100644 --- a/include/anthem/Body.h +++ b/include/anthem/Body.h @@ -40,7 +40,7 @@ ast::Comparison::Operator translate(Clingo::AST::ComparisonOperator comparisonOp //////////////////////////////////////////////////////////////////////////////////////////////////// -ast::Variable makeAuxiliaryBodyVariable(const int i) +ast::Variable makeAuxiliaryBodyVariable(int i) { auto variableName = std::string(AuxiliaryBodyVariablePrefix) + std::to_string(i); @@ -94,28 +94,28 @@ struct BodyTermTranslateVisitor variables.reserve(function.arguments.size()); for (size_t i = 0; i < function.arguments.size(); i++) - variables.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID + i)); + variables.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID + i)); ast::And conjunction; for (size_t i = 0; i < function.arguments.size(); i++) { const auto &argument = function.arguments[i]; - conjunction.arguments.emplace_back(ast::Formula::make(makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID + i), translate(argument, context))); + conjunction.arguments.emplace_back(ast::Formula::make(makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID + i), translate(argument, context))); } ast::Predicate predicate(std::string(function.name)); predicate.arguments.reserve(function.arguments.size()); for (size_t i = 0; i < function.arguments.size(); i++) - predicate.arguments.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID + i)); + predicate.arguments.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID + i)); if (literal.sign == Clingo::AST::Sign::None) conjunction.arguments.emplace_back(std::move(predicate)); else conjunction.arguments.emplace_back(ast::Formula::make(std::move(predicate))); - context.auxiliaryBodyLiteralID += function.arguments.size(); + context.auxiliaryBodyVariableID += function.arguments.size(); return ast::Formula::make(std::move(variables), std::move(conjunction)); } @@ -154,16 +154,16 @@ struct BodyLiteralTranslateVisitor std::vector variables; variables.reserve(2); - variables.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID)); - variables.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID + 1)); + variables.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID)); + variables.emplace_back(makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID + 1)); ast::And conjunction; conjunction.arguments.reserve(3); - conjunction.arguments.emplace_back(ast::Formula::make(makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID), translate(comparison.left, context))); - conjunction.arguments.emplace_back(ast::Formula::make(makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID + 1), translate(comparison.right, context))); - conjunction.arguments.emplace_back(ast::Formula::make(operator_, makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID), makeAuxiliaryBodyVariable(context.auxiliaryBodyLiteralID + 1))); + conjunction.arguments.emplace_back(ast::Formula::make(makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID), translate(comparison.left, context))); + conjunction.arguments.emplace_back(ast::Formula::make(makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID + 1), translate(comparison.right, context))); + conjunction.arguments.emplace_back(ast::Formula::make(operator_, makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID), makeAuxiliaryBodyVariable(context.auxiliaryBodyVariableID + 1))); - context.auxiliaryBodyLiteralID += 2; + context.auxiliaryBodyVariableID += 2; return ast::Formula::make(std::move(variables), std::move(conjunction)); } diff --git a/include/anthem/Context.h b/include/anthem/Context.h index 702b1e0..7867ef1 100644 --- a/include/anthem/Context.h +++ b/include/anthem/Context.h @@ -21,7 +21,7 @@ struct Context headTerms.clear(); isChoiceRule = false; numberOfHeadLiterals = 0; - auxiliaryBodyLiteralID = 1; + auxiliaryBodyVariableID = 1; } output::Logger logger; @@ -29,7 +29,7 @@ struct Context std::vector headTerms; bool isChoiceRule = false; size_t numberOfHeadLiterals = 0; - size_t auxiliaryBodyLiteralID = 1; + size_t auxiliaryBodyVariableID = 1; bool simplify = false; };