Skip to content

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 4 commits into from
Mar 13, 2019
Merged

Conversation

eviefp
Copy link

@eviefp eviefp commented Mar 13, 2019

Reviewer checklist
  • Test coverage: stack test --coverage
  • Public API documentation: stack haddock
  • Style conformance: stylish-haskell

@eviefp eviefp requested a review from ttuegel March 13, 2019 15:13
@ttuegel ttuegel merged commit 425e5ea into runtimeverification:master Mar 13, 2019
@eviefp eviefp deleted the feature/lts-13.12 branch April 2, 2019 20:11
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants