-
Notifications
You must be signed in to change notification settings - Fork 44
Inefficient Equation renaming #2438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inefficient Equation renaming #2438
Conversation
attemptEquation | ||
sideCondition | ||
(not . freeEquationVariableName >>= assert -> termLike) | ||
equation | ||
= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attemptEquation | |
sideCondition | |
(not . freeEquationVariableName >>= assert -> termLike) | |
equation | |
= | |
attemptEquation sideCondition termLike equation = | |
assert (not $ freeEquationVariableName termLike) $ |
freeEquationVariableName | ||
:: HasFreeVariables pat RewritingVariableName => pat -> Bool | ||
freeEquationVariableName pat = | ||
any | ||
isSomeEquationVariableName | ||
(from @_ @(Set.Set _) . freeVariables @_ @RewritingVariableName $ pat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest naming this function hasFreeEquationVariables
.
|
||
assertNoFreeEquationVariableName | ||
:: Condition RewritingVariableName | ||
-> Condition RewritingVariableName | ||
assertNoFreeEquationVariableName (Conditional () predicate substitution) = | ||
let | ||
predicate' = | ||
assert (not . freeEquationVariableName $ predicate) predicate | ||
substitution' = | ||
mapTerms | ||
(\t -> assert (not . freeEquationVariableName $ t) t) | ||
substitution | ||
in | ||
Conditional () predicate' substitution' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion should appear in Kore.Equation.Application
after matching and unification on function arguments.
…m:kframework/kore into initialize-equations-EquationVariableName
…m:kframework/kore into initialize-equations-EquationVariableName
assert (not . hasFreeEquationVariableName $ equation') | ||
$ assert (not . hasFreeEquationVariableName $ predicate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be factored out? I think it's a little too verbose and it takes longer to read than necessary.
@@ -156,6 +157,7 @@ attemptEquation | |||
-> Equation RewritingVariableName | |||
-> simplifier (AttemptEquationResult RewritingVariableName) | |||
attemptEquation sideCondition termLike equation = | |||
assert (not $ hasFreeEquationVariableName termLike) $ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever use hasFreeEquationVariableName
on its own (without negating it)? Could we just turn hasFreeEquationVariableName
into withoutFreeEquationVariables
?
Fixes #2120
This pull request addresses the last two checkboxes, but
Target
was already removed in #2344.Review checklist
The author performs the actions on the checklist. The reviewer evaluates the work and checks the boxes as they are completed.