-
Notifications
You must be signed in to change notification settings - Fork 0
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
271 recursive simplification of constraints during evaluation #455
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
bc69b4e
Integration tests for recursive simplification
jberthold fd0bc0a
Recursive constraint evaluation when applying equations (old code)
jberthold 4da300c
remove old commented code, omit redundant KJTop in simplify response
jberthold 1fcf7eb
allow SERVER variable to have more than one word (use first for suffix)
jberthold 2f58a36
run simplify integration test with booster-dev
jberthold 5324e14
describe simplification tests, adjust one of the tests
jberthold 7be2728
add simplification loop test (would loop in kore-rpc-[dev|booster])
jberthold d205497
add simplification-loop test description to README
jberthold b852e68
different fix for script error with server arguments
jberthold e0ad588
WIP recursion limit (hard-coded: 5) checked separately
jberthold 1422e6c
Evaluate conditions with fresh term stack/change flag, other tweaks
jberthold bee753f
Merge remote-tracking branch 'origin/main' into 271-bring-back-recurs…
jberthold 8b2881a
Merge branch 'main' into 271-bring-back-recursive-simplification
jberthold d097d60
add test for and-simplification , tweak simplify.kompile
jberthold 6c2557c
Merge remote-tracking branch 'origin/main' into 271-recursive-simplif…
jberthold 15212c8
Merge branch 'jb/tmp-branchpoint-for-kevm-testing' into 271-recursive…
jberthold 575a1c8
Merge remote-tracking branch 'origin/main' into 271-recursive-simplif…
jberthold 6b054de
adapt #if-then-else sort error responses to current main
jberthold 71bb397
adapt if-then-else-eval for running without llvm backend
jberthold 8e03140
Use tables in README, add if-then-else test descriptions
jberthold 6a579c2
hlint
jberthold 679f582
adjust comments in simplify.k
jberthold 010ae25
Merge remote-tracking branch 'origin/main' into 271-recursive-simplif…
jberthold 551f445
rename fallBackToP -> fallBackToUnsimplified
jberthold b6a179d
adjust comment about checkConstraint
jberthold 8ee9e1e
Merge branch 'main' into 271-recursive-simplification-reprise
jberthold 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 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 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 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 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 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 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 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,50 @@ | ||
# Tests for simplification in `booster` (executed with `booster-dev` only) | ||
|
||
This integration test runs a few simplification requests with `Int` | ||
expressions. It is expected that known rules from `domains.md` apply, | ||
which will, e.g., move symbolic terms in additions and subtractions to | ||
the left. | ||
|
||
Since `booster-dev` is used without an llvm backend library, no | ||
integer evaluation is expected in the results. | ||
|
||
Some additional functions and predicates were defined to test the | ||
behaviour for recursive evaluation (when an evaluation or | ||
simplification has a requirement which must be simplified/evaluated | ||
before it is found to be true). See `simplify.k` for details. | ||
|
||
* Integer evaluation and simplification | ||
|
||
| Name | Input | Expected output | rules in `domains.md` which | | ||
|-------------------------- | ----------------- | ----------------- |---------------------------- | | ||
| _no-simplification_ | `123` | `123` | n/a | | ||
| _plus-null-removed_ | `0 + f(34)` | `f(34)` | remove the zero addition | | ||
| _symbolic-first_ | `12 + f(34)` | `f(34) + 12` | move symbolic values left | | ||
| _symbolic-first-of-3_ | `12 + f(34) + 56` | `f(34) + 12 + 56` | move symbolic values left | | ||
| _evaluate-under-function_ | `f(12 + 0)` | `f(12)` | remove the zero addition | | ||
|
||
- _with-logging_ is the same as _symbolic-first-of-3_ but with simplification logging enabled. | ||
|
||
|
||
* Recursive evaluation of equation constraints | ||
|
||
| Name | Input | Expected output | because | | ||
|-------------------------- | -------- | --------------- |-------------------------------------- | | ||
| _evaluate-two-stage-fail_ | `g(2)` | `g(2)` | no evaluation rule applies | | ||
| _evaluate-two-stage_ | `g(1)` | `1` | applying rule `eval-g` | | ||
| | | | after evaluating `p3(1)` to `true` | | ||
| _simplification-loop_ | `p1(42)` | `p1(42)` | simplification attempt detects a loop | | ||
| | | | and returns the original | | ||
|
||
- **The _simplification_loop_ test loops forever in `kore-rpc-booster` and `kore-rpc-dev`.** | ||
|
||
* Tests for the `#if-#then-#else` hook | ||
|
||
| Name | Input (paraphrased) | Expected output | | ||
|----------------------------- | -------------------------------------- | --------------- | | ||
| _if-then-else-true_ | `#if true #then 1 #else 0 #fi` | `1` | | ||
| _if-then-else-false_ | `#if false #then 1 #else 0 #fi` | `0` | | ||
| _if-then-else-eval_ | `#if (false => X) #then 1 #else 0 #fi` | `1` | | ||
| _if-then-else-indeterminate_ | `#if true #then 1 #else 0 #fi` | `1` | | ||
| _if-then-else-sort-error_ | `#if 42 #then 1 #else 0 #fi` | _Error (sort)_ | | ||
| _if-then-else-arity-error_ | `#if_#then_#else(true, 0)` | _Error (arity)_ | |
26 changes: 26 additions & 0 deletions
26
test/rpc-integration/test-simplify/response-evaluate-two-stage-fail.json
This file contains 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,26 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result": { | ||
"state": { | ||
"format": "KORE", | ||
"version": 1, | ||
"term": { | ||
"tag": "App", | ||
"name": "Lblg", | ||
"sorts": [], | ||
"args": [ | ||
{ | ||
"tag": "DV", | ||
"sort": { | ||
"tag": "SortApp", | ||
"name": "SortInt", | ||
"args": [] | ||
}, | ||
"value": "2" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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.
nice!