Skip to content

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

Merged
merged 16 commits into from
Nov 11, 2020
Merged

Implication #2210

merged 16 commits into from
Nov 11, 2020

Conversation

MirceaS
Copy link
Contributor

@MirceaS MirceaS commented Oct 20, 2020


New Implication type tying together the definitions and functions of Claim and Rule that diverged.
See Issue #2192

Reviewer checklist
  • Test coverage: stack test --coverage
  • Public API documentation: stack haddock

@MirceaS MirceaS linked an issue Oct 20, 2020 that may be closed by this pull request
5 tasks
@ttuegel ttuegel self-requested a review October 27, 2020 14:03
@ttuegel
Copy link
Contributor

ttuegel commented Oct 27, 2020

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertBool "Variable was captured" (not $ isFreeVariable (inject $ variableName x) freeVars)
assertBool "Expected variable is not captured" (not $ isFreeVariable (inject $ variableName x) freeVars)

Copy link
Contributor Author

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.

Copy link
Contributor

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...

Copy link
Contributor Author

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")?

@ttuegel ttuegel self-requested a review November 2, 2020 15:04
-> Implication modality
renameExistentials rename implication'@Implication { right, existentials } =
implication'
{ right = OrPattern.substitute subst right
Copy link
Contributor

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.

:: HasCallStack
=> Map
(SomeVariableName RewritingVariableName)
(SomeVariable RewritingVariableName)
Copy link
Contributor

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.

@ttuegel ttuegel self-requested a review November 9, 2020 15:02
Comment on lines 404 to 405
OrPattern.map
(Pattern.mapVariables resetConfigVariable)
Copy link
Contributor

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.

@ttuegel ttuegel removed a link to an issue Nov 10, 2020
5 tasks
@MirceaS MirceaS merged commit 2dee3f5 into master Nov 11, 2020
@ana-pantilie ana-pantilie deleted the 2192 branch May 25, 2022 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants