Add new simplification rule
This adds the rule “not not F === F” to the simplification rule tableau.
This commit is contained in:
parent
6d7b91c391
commit
23624007ec
@ -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 =
|
||||
simplify
|
||||
<
|
||||
SimplificationRuleDoubleNegation,
|
||||
SimplificationRuleTrivialAssignmentInExists,
|
||||
SimplificationRuleAssignmentInExists,
|
||||
SimplificationRuleEmptyConjunction,
|
||||
|
@ -103,9 +103,10 @@ TEST_CASE("[hidden predicate elimination] Hidden predicates are correctly elimin
|
||||
"#show a/1.";
|
||||
anthem::translate("input", input, context);
|
||||
|
||||
// TODO: simplify further
|
||||
CHECK(output.str() ==
|
||||
"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");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user