-
Notifications
You must be signed in to change notification settings - Fork 44
Symbolic execution and search should apply rules correctly #2234
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
Symbolic execution and search should apply rules correctly #2234
Conversation
… a total clean-up
--strategy all
is ignored…fallback' into strategy-all-ignored
kore/app/exec/Main.hs
Outdated
[ ("any", Any) | ||
, ("all", All) |
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.
Because this uses an enumeration type now, there is no reason to keep the String
part of the tuple.
kore/src/Kore/Exec.hs
Outdated
-> ([Rewrite] -> [Strategy (Prim Rewrite)]) | ||
-- ^ The strategy to use for execution; see examples in "Kore.Step.Step" | ||
-> ExecutionMode | ||
-- ^ The execution mode |
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 don't think this documentation is helpful. The reader can always jump to the documentation for ExecutionMode
!
-- ^ The execution mode |
kore/src/Kore/Step.hs
Outdated
data Prim rewrite = Simplify | Rewrite !rewrite | ||
{- | The program's state during symbolic execution. | ||
-} | ||
data ProgramState a = Start !a | Rewritten !a | Remaining !a |
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 you please add documentation for each constructor?
kore/src/Kore/Step.hs
Outdated
data Prim | ||
= Begin | ||
| Simplify | ||
| ApplyRewrites |
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.
Unless this name is already taken, I suggest changing to a simple imperative verb to match the other constructors:
| ApplyRewrites | |
| Rewrite |
kore/src/Kore/Step.hs
Outdated
transitionRuleWorker All ApplyRewrites (Remaining patt) = | ||
transitionAllRewrite patt | ||
transitionRuleWorker All ApplyRewrites (Start patt) = | ||
transitionAllRewrite patt | ||
transitionRuleWorker Any ApplyRewrites (Remaining patt) = | ||
transitionAnyRewrite patt | ||
transitionRuleWorker Any ApplyRewrites (Start patt) = | ||
transitionAnyRewrite patt | ||
transitionRuleWorker _ ApplyRewrites state = pure state |
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.
We can reduce duplication with a simple helper function. Explicitly matching on all the ProgramState
constructors makes the logic clearer and protects us if we ever add constructors to ProgramState
.
transitionRuleWorker All ApplyRewrites (Remaining patt) = | |
transitionAllRewrite patt | |
transitionRuleWorker All ApplyRewrites (Start patt) = | |
transitionAllRewrite patt | |
transitionRuleWorker Any ApplyRewrites (Remaining patt) = | |
transitionAnyRewrite patt | |
transitionRuleWorker Any ApplyRewrites (Start patt) = | |
transitionAnyRewrite patt | |
transitionRuleWorker _ ApplyRewrites state = pure state | |
transitionRuleWorker mode ApplyRewrites (Remaining patt) = | |
transitionRewrite mode patt | |
transitionRuleWorker mode ApplyRewrites (Start patt) = | |
transitionRewrite mode patt | |
transitionRuleWorker _ ApplyRewrites state@(Rewritten patt) = pure state | |
transitionRewrite All = transitionAllRewrite | |
transitionRewrite Any = transitionAnyRewrite |
Fixes #2205
Needs #2231Needs #2261Reviewer checklist
stack test --coverage
stack haddock