-
Notifications
You must be signed in to change notification settings - Fork 44
Feature/lts 13.12 #502
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
Feature/lts 13.12 #502
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ttuegel
approved these changes
Mar 13, 2019
jberthold
added a commit
that referenced
this pull request
Apr 10, 2024
## Stronger `Map` matching Previously, only fully concrete maps (all keys and values identical) would have matched, which is highly unlikely when matching simplification rules. Now we compare the key sets for (syntactic) equality after substituting with the current substitution, and then try to perform matching on the remainder if a solution is at all possible. Most importantly, maps of fully-concrete keys can now be handled, matching the contained values. In addition, the case of matching a single unknown key out of a singleton map (i.e., without opaque rest in the subject map) is now possible. Any ambiguous case is still rejected as `MatchIndeterminate` but some cases can be decided as `MatchFailed` immediately. ## Selected hooks for `Map` This change implements 3 crucial hooks for internalised `Map`s: * `lookup`: partial function that looks up a value for a given key in a map. Returns no result when the key is not present. * `lookupOrDefault`: total function that looks up a value for a given key in a map. If the key is not present, it returns a given default value instead. The implemented hook won't return any result when the presence of the key cannot be decided. * `in_keys`: predicate that checks whether a given key is present in a map. The implemented hook won't return any result if the presence of the key cannot be decided. All three hooks are conservative, not returning any results when they find unevaluated (parts of the) arguments. These hooks, together with the enhanced `Map`-matching of #502, avoid a fall-back to legacy `kore-rpc` in an issue reported in #498. Alternatively, [more suitable rules for `in_keys` could be added to `domains.md`, and the rules for `lookup` and `lookupOrDefault` could be marked as `preserves-definedness`](runtimeverification/k#3987) so `booster` will use them. Fixes #498
jberthold
added a commit
that referenced
this pull request
Apr 10, 2024
## Stronger `Map` matching Previously, only fully concrete maps (all keys and values identical) would have matched, which is highly unlikely when matching simplification rules. Now we compare the key sets for (syntactic) equality after substituting with the current substitution, and then try to perform matching on the remainder if a solution is at all possible. Most importantly, maps of fully-concrete keys can now be handled, matching the contained values. In addition, the case of matching a single unknown key out of a singleton map (i.e., without opaque rest in the subject map) is now possible. Any ambiguous case is still rejected as `MatchIndeterminate` but some cases can be decided as `MatchFailed` immediately. ## Selected hooks for `Map` This change implements 3 crucial hooks for internalised `Map`s: * `lookup`: partial function that looks up a value for a given key in a map. Returns no result when the key is not present. * `lookupOrDefault`: total function that looks up a value for a given key in a map. If the key is not present, it returns a given default value instead. The implemented hook won't return any result when the presence of the key cannot be decided. * `in_keys`: predicate that checks whether a given key is present in a map. The implemented hook won't return any result if the presence of the key cannot be decided. All three hooks are conservative, not returning any results when they find unevaluated (parts of the) arguments. These hooks, together with the enhanced `Map`-matching of #502, avoid a fall-back to legacy `kore-rpc` in an issue reported in #498. Alternatively, [more suitable rules for `in_keys` could be added to `domains.md`, and the rules for `lookup` and `lookupOrDefault` could be marked as `preserves-definedness`](runtimeverification/k#3987) so `booster` will use them. Fixes #498
jberthold
added a commit
that referenced
this pull request
Apr 10, 2024
## Stronger `Map` matching Previously, only fully concrete maps (all keys and values identical) would have matched, which is highly unlikely when matching simplification rules. Now we compare the key sets for (syntactic) equality after substituting with the current substitution, and then try to perform matching on the remainder if a solution is at all possible. Most importantly, maps of fully-concrete keys can now be handled, matching the contained values. In addition, the case of matching a single unknown key out of a singleton map (i.e., without opaque rest in the subject map) is now possible. Any ambiguous case is still rejected as `MatchIndeterminate` but some cases can be decided as `MatchFailed` immediately. ## Selected hooks for `Map` This change implements 3 crucial hooks for internalised `Map`s: * `lookup`: partial function that looks up a value for a given key in a map. Returns no result when the key is not present. * `lookupOrDefault`: total function that looks up a value for a given key in a map. If the key is not present, it returns a given default value instead. The implemented hook won't return any result when the presence of the key cannot be decided. * `in_keys`: predicate that checks whether a given key is present in a map. The implemented hook won't return any result if the presence of the key cannot be decided. All three hooks are conservative, not returning any results when they find unevaluated (parts of the) arguments. These hooks, together with the enhanced `Map`-matching of #502, avoid a fall-back to legacy `kore-rpc` in an issue reported in #498. Alternatively, [more suitable rules for `in_keys` could be added to `domains.md`, and the rules for `lookup` and `lookupOrDefault` could be marked as `preserves-definedness`](runtimeverification/k#3987) so `booster` will use them. Fixes #498
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reviewer checklist
stack test --coverage
stack haddock
stylish-haskell