Add new simplification rule
This adds the rule “not not F === F” to the simplification rule tableau.
This commit is contained in:
parent
b18ddcc575
commit
1c5851441d
@ -379,9 +379,34 @@ struct SimplificationRuleSubsumptionInBiconditionals
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct SimplificationRuleDoubleNegation
|
||||||
|
{
|
||||||
|
static constexpr const auto Description = "not not F === F";
|
||||||
|
|
||||||
|
static SimplificationResult apply(ast::Formula &formula)
|
||||||
|
{
|
||||||
|
if (!formula.is<ast::Not>())
|
||||||
|
return SimplificationResult::Unchanged;
|
||||||
|
|
||||||
|
auto ¬_ = formula.get<ast::Not>();
|
||||||
|
|
||||||
|
if (!not_.argument.is<ast::Not>())
|
||||||
|
return SimplificationResult::Unchanged;
|
||||||
|
|
||||||
|
auto ¬Not = not_.argument.get<ast::Not>();
|
||||||
|
|
||||||
|
formula = std::move(notNot.argument);
|
||||||
|
|
||||||
|
return SimplificationResult::Simplified;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
const auto simplifyWithDefaultRules =
|
const auto simplifyWithDefaultRules =
|
||||||
simplify
|
simplify
|
||||||
<
|
<
|
||||||
|
SimplificationRuleDoubleNegation,
|
||||||
SimplificationRuleTrivialAssignmentInExists,
|
SimplificationRuleTrivialAssignmentInExists,
|
||||||
SimplificationRuleAssignmentInExists,
|
SimplificationRuleAssignmentInExists,
|
||||||
SimplificationRuleEmptyConjunction,
|
SimplificationRuleEmptyConjunction,
|
||||||
|
@ -103,9 +103,10 @@ TEST_CASE("[hidden predicate elimination] Hidden predicates are correctly elimin
|
|||||||
"#show a/1.";
|
"#show a/1.";
|
||||||
anthem::translate("input", input, context);
|
anthem::translate("input", input, context);
|
||||||
|
|
||||||
|
// TODO: simplify further
|
||||||
CHECK(output.str() ==
|
CHECK(output.str() ==
|
||||||
"forall V1 (a(V1) <-> not d(V1))\n"
|
"forall V1 (a(V1) <-> not d(V1))\n"
|
||||||
"forall V2 (d(V2) <-> not not d(V2))\n"
|
"forall V2 (d(V2) <-> d(V2))\n"
|
||||||
"forall V3 (e(V3) <-> e(V3))\n");
|
"forall V3 (e(V3) <-> e(V3))\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user