-
Notifications
You must be signed in to change notification settings - Fork 44
Implication #2210
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
Implication #2210
Conversation
I updated your test to show how variables can be captured. |
claim | ||
freeVars = foldMap freeVariables (OrPattern.toPatterns newRight) | ||
:: FreeVariables RewritingVariableName | ||
assertBool "Variable was captured" (not $ isFreeVariable (inject $ variableName x) freeVars) |
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.
assertBool "Variable was captured" (not $ isFreeVariable (inject $ variableName x) freeVars) | |
assertBool "Expected variable is not captured" (not $ isFreeVariable (inject $ variableName x) freeVars) |
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.
@ttuegel Shouldn't the assert message go like "Expected variable IS captured" because that message is what gets shown when the assertion fails.
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.
Our other tests take the form:
assert... "a statement that should be true" arguments...
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.
How about a compromise that follows the style in Test.Kore.Equation.Sentence
, that is "Expected -something that should have been true-" (In this case "Expected the expected variable to not be captured")?
kore/src/Kore/Step/Implication.hs
Outdated
-> Implication modality | ||
renameExistentials rename implication'@Implication { right, existentials } = | ||
implication' | ||
{ right = OrPattern.substitute subst right |
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.
subst
needs to be restricted to variables that actually appear in the existentials
list.
renameExistentials (Map.fromList [("x", "u"), ("y", "v")])
Implication { existentials = ["x"], right = {- "y" occurs free -} }
If this is only used internally, it should be fine to have an assertion that every key in the map appears in existentials
.
kore/src/Kore/Step/Implication.hs
Outdated
:: HasCallStack | ||
=> Map | ||
(SomeVariableName RewritingVariableName) | ||
(SomeVariable RewritingVariableName) |
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.
Since this is used internally, it is fine to keep the type as it is, but we should add an assertion that the sorts of variables do not change.
kore/src/Kore/Step/Implication.hs
Outdated
OrPattern.map | ||
(Pattern.mapVariables resetConfigVariable) |
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.
Let's introduce a mapVariables
function in Kore.Internal.OrPattern
which combines OrPattern.map
and Pattern.mapVariables
. I'm sure this combination is used elsewhere, too.
Co-authored-by: Thomas Tuegel <[email protected]>
New Implication type tying together the definitions and functions of Claim and Rule that diverged.
See Issue #2192
Reviewer checklist
stack test --coverage
stack haddock