-
Notifications
You must be signed in to change notification settings - Fork 43
Booster implies: discharge leftover consequent obligations under the antecedent via SMT #4156
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
adbe4f8
kore-rpc-types, booster/Pattern/Implies, kore/JsonRpc: add indetermin…
ehildenb 6831148
booster/test/rpc-integration/{resources/implies-smt,test-implies-smt}…
ehildenb c3178ba
booster/Pattern/Implies, test/rpc-integration/{test-implies-smt,test-…
ehildenb 30a1f48
booster/Pattern/Implies: consolidate ImpliesResult construction into …
ehildenb 792eebf
kore-rpc-types/JsonRpc/Types, booster/Pattern/Implies, kore/JsonRpc, …
ehildenb dc4ece6
booster/test/rpc-integration/test-implies-smt: add README with an ove…
ehildenb 188cff5
booster/Proxy: escalate implies to kore on an indeterminate booster v…
ehildenb 6e1bd44
booster/test/rpc-integration/test-implies-smt: add escalation test fo…
ehildenb 6473f41
test/rpc-server/implies: migrate response goldens to the status field
ehildenb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Minimal definition for exercising booster's `implies` check against | ||
| // integer / boolean obligations that need SMT discharge. | ||
| // | ||
| // The test claims send raw KORE `implies` requests whose antecedent and | ||
| // consequent share identical configurations (so the matcher returns | ||
| // MatchSuccess) but differ in their attached path-condition predicates. | ||
| // The interesting cases are the ones where the leftover consequent | ||
| // predicate is *implied* by the antecedent under linear-integer reasoning | ||
| // (e.g. `X <Int 1000` from `X <Int 100`), so an SMT-aware discharge | ||
| // step would close them as `valid : true`. | ||
| // | ||
| // The configuration is a single `<k>` cell containing an `Int` — enough | ||
| // to give us a kompiled definition with `_<Int_`, `andBool`, `true`, and | ||
| // the standard cell wrappers without any extra ceremony. | ||
|
|
||
| module IMPLIES-SMT | ||
| imports INT | ||
| imports BOOL | ||
|
|
||
| configuration <k> $PGM:Int </k> | ||
|
|
||
| endmodule |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| name=$(basename "$0" .kompile) | ||
| kompile --backend haskell "$name.k" --syntax-module IMPLIES-SMT | ||
| cp "$name-kompiled/definition.kore" "./$name.kore" | ||
| rm -r "$name-kompiled" |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # test-implies-smt | ||
|
|
||
| Exercises booster's `implies` endpoint on integer/boolean obligations that need SMT discharge. | ||
|
|
||
| Each test sends a raw KORE `implies` request whose antecedent and consequent share an identical `<k>` configuration — so the matcher returns `MatchSuccess` — but differ in their attached path-condition predicates. | ||
| The leftover consequent predicate is then simplified under the antecedent and any residue is SMT-closed, so the verdict turns on linear-integer reasoning rather than syntactic matching. | ||
| The definition (`resources/implies-smt.k`) is just `configuration <k> $PGM:Int </k>` over `INT`/`BOOL`. | ||
|
|
||
| The cases cover each arm of the discharge logic, and `002` deliberately diverges between the two engines: booster's SMT cannot refute the obligation and returns `indeterminate` (the signal for a recover-mode client to escalate), whereas kore decides it. | ||
| `005` is the same query as `002` but with `assume-defined: true`, which makes the proxy run booster first and then escalate the `indeterminate` verdict to kore — so the booster-dev server reports `indeterminate` while the full proxy reports kore's `invalid`. | ||
|
|
||
| | test | antecedent ⟹ consequent | booster-dev `status` | proxy/kore `status` | arm exercised | | ||
| |---------------------------|--------------------------------------|----------------------|---------------------|--------------------------------------------------| | ||
| | 001-bound-weakening | `X <Int 100` ⟹ `X <Int 1000` | valid | valid | SMT discharges a weaker bound (`IsValid`) | | ||
| | 002-does-not-imply | `X <Int 100` ⟹ `X <Int 10` | indeterminate | invalid | SMT cannot refute → `IsUnknown` | | ||
| | 003-vacuous-antecedent | contradictory antecedent ⟹ _any_ | valid | valid | unsat ground truth (`InconsistentGroundTruth`) | | ||
| | 004-address-bound | address-range bounds ⟹ weaker bound | valid | valid | conjunctive bound discharge over 2^160 / 2^256 | | ||
| | 005-escalate-indeterminate| `X <Int 100` ⟹ `X <Int 10`, assume-defined | indeterminate | invalid | proxy escalates booster `indeterminate` to kore | | ||
|
|
||
| Responses are checked against `response-<test>.json` (kore / default server) and `response-<test>.booster-dev` (booster-dev server). |
63 changes: 63 additions & 0 deletions
63
booster/test/rpc-integration/test-implies-smt/response-001-bound-weakening.booster-dev
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| { | ||
| "jsonrpc": "2.0", | ||
| "id": "implies-smt-001", | ||
| "result": { | ||
| "status": "valid", | ||
| "implication": { | ||
| "format": "KORE", | ||
| "version": 1, | ||
| "term": { | ||
| "tag": "Implies", | ||
| "sort": { | ||
| "tag": "SortApp", | ||
| "name": "SortInt", | ||
| "args": [] | ||
| }, | ||
| "first": { | ||
| "tag": "EVar", | ||
| "name": "VarX", | ||
| "sort": { | ||
| "tag": "SortApp", | ||
| "name": "SortInt", | ||
| "args": [] | ||
| } | ||
| }, | ||
| "second": { | ||
| "tag": "EVar", | ||
| "name": "VarX", | ||
| "sort": { | ||
| "tag": "SortApp", | ||
| "name": "SortInt", | ||
| "args": [] | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "condition": { | ||
| "substitution": { | ||
| "format": "KORE", | ||
| "version": 1, | ||
| "term": { | ||
| "tag": "Top", | ||
| "sort": { | ||
| "tag": "SortApp", | ||
| "name": "SortInt", | ||
| "args": [] | ||
| } | ||
| } | ||
| }, | ||
| "predicate": { | ||
| "format": "KORE", | ||
| "version": 1, | ||
| "term": { | ||
| "tag": "Top", | ||
| "sort": { | ||
| "tag": "SortApp", | ||
| "name": "SortInt", | ||
| "args": [] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
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.
Would be good to add a README.md with an overview table of the four tests.
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.
Done: dc4ece6 — added test-implies-smt/README.md with a table covering each test's antecedent⟹consequent, the expected booster vs kore status, and which discharge arm it exercises.