-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into release
- Loading branch information
Showing
12 changed files
with
559 additions
and
26 deletions.
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
54 changes: 54 additions & 0 deletions
54
booster/test/rpc-integration/resources/use-path-condition-in-equations.k
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,54 @@ | ||
module USE-PATH-CONDITION-IN-EQUATIONS | ||
imports INT | ||
imports BOOL | ||
|
||
syntax State ::= test1Init() | ||
| test1State1() | ||
| test1State2() | ||
|
||
| test2Init() | ||
| test2State1() | ||
| test2State2() | ||
|
||
syntax Int ::= test1F ( Int ) [function, total, no-evaluators] | ||
| test2F ( Int ) [function, total, no-evaluators] | ||
|
||
configuration <k> $PGM:State ~> .K </k> | ||
<int> 0:Int </int> | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
// Here the simplification's side condition is syntactically present // | ||
// in the path condition and is not checked. // | ||
// Result: Stuck at depth 2 in state test1State2() // | ||
// after applying rules test1-init,test1-1-2 // | ||
//////////////////////////////////////////////////////////////////////////////// | ||
rule [test1-init]: <k> test1Init() => test1State1() ... </k> | ||
<int> _ => ?X </int> | ||
ensures ?X ==Int 42 | ||
|
||
rule [test1-1-2]: <k> test1State1() => test1State2() ... </k> | ||
<int> X </int> | ||
requires test1F(X) >Int 0 | ||
|
||
rule [test1F-simplify]: test1F(X:Int) => X requires X ==Int 42 [simplification] | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
// Here the simplification's side condition is implied by the path condition, // | ||
// but we need an SMT solver to establish that. // | ||
// Result: Aborted at depth 1 due to indeterminate condition of rule test2-1-2 // | ||
//////////////////////////////////////////////////////////////////////////////// | ||
rule [test2-init]: <k> test2Init() => test2State1() ... </k> | ||
<int> _ => ?X </int> | ||
ensures ?X ==Int 42 | ||
|
||
rule [test2-1-2]: <k> test2State1() => test2State2() ... </k> | ||
<int> X </int> | ||
requires test2F(X) >Int 0 | ||
|
||
rule [test2F-simplify]: test2F(X:Int) => X requires X >Int 0 [simplification] | ||
|
||
// to produce input state: | ||
// krun --output kore --depth 1 -cPGM='test1Init()' | kore-parser test-kompiled/definition.kore --module TEST --pattern /dev/stdin --print-pattern-json > state-test1Init.json | ||
// then edit state-test1Init.json to substitute test1State1() for test1Init() | ||
|
||
endmodule |
4 changes: 4 additions & 0 deletions
4
booster/test/rpc-integration/resources/use-path-condition-in-equations.kompile
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,4 @@ | ||
echo "kompiling use-path-condition-in-equations.k" | ||
kompile --backend haskell use-path-condition-in-equations.k | ||
cp use-path-condition-in-equations-kompiled/definition.kore use-path-condition-in-equations.kore | ||
rm -r use-path-condition-in-equations-kompiled |
3 changes: 3 additions & 0 deletions
3
booster/test/rpc-integration/test-use-path-condition-in-equations/README.md
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,3 @@ | ||
# Test the use of the known path condition when applying simplifications | ||
|
||
See `../resourses/use-path-condition-in-equations.k`. |
148 changes: 148 additions & 0 deletions
148
booster/test/rpc-integration/test-use-path-condition-in-equations/response-test1.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,148 @@ | ||
{ | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result": { | ||
"reason": "stuck", | ||
"depth": 2, | ||
"state": { | ||
"term": { | ||
"format": "KORE", | ||
"version": 1, | ||
"term": { | ||
"tag": "App", | ||
"name": "Lbl'-LT-'generatedTop'-GT-'", | ||
"sorts": [], | ||
"args": [ | ||
{ | ||
"tag": "App", | ||
"name": "Lbl'-LT-'k'-GT-'", | ||
"sorts": [], | ||
"args": [ | ||
{ | ||
"tag": "App", | ||
"name": "kseq", | ||
"sorts": [], | ||
"args": [ | ||
{ | ||
"tag": "App", | ||
"name": "inj", | ||
"sorts": [ | ||
{ | ||
"tag": "SortApp", | ||
"name": "SortState", | ||
"args": [] | ||
}, | ||
{ | ||
"tag": "SortApp", | ||
"name": "SortKItem", | ||
"args": [] | ||
} | ||
], | ||
"args": [ | ||
{ | ||
"tag": "App", | ||
"name": "Lbltest1State2'LParRParUnds'USE-PATH-CONDITION-IN-EQUATIONS'Unds'State", | ||
"sorts": [], | ||
"args": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"tag": "App", | ||
"name": "dotk", | ||
"sorts": [], | ||
"args": [] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"tag": "App", | ||
"name": "Lbl'-LT-'int'-GT-'", | ||
"sorts": [], | ||
"args": [ | ||
{ | ||
"tag": "EVar", | ||
"name": "Var'Ques'X", | ||
"sort": { | ||
"tag": "SortApp", | ||
"name": "SortInt", | ||
"args": [] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"tag": "App", | ||
"name": "Lbl'-LT-'generatedCounter'-GT-'", | ||
"sorts": [], | ||
"args": [ | ||
{ | ||
"tag": "DV", | ||
"sort": { | ||
"tag": "SortApp", | ||
"name": "SortInt", | ||
"args": [] | ||
}, | ||
"value": "0" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"predicate": { | ||
"format": "KORE", | ||
"version": 1, | ||
"term": { | ||
"tag": "Equals", | ||
"argSort": { | ||
"tag": "SortApp", | ||
"name": "SortBool", | ||
"args": [] | ||
}, | ||
"sort": { | ||
"tag": "SortApp", | ||
"name": "SortGeneratedTopCell", | ||
"args": [] | ||
}, | ||
"first": { | ||
"tag": "DV", | ||
"sort": { | ||
"tag": "SortApp", | ||
"name": "SortBool", | ||
"args": [] | ||
}, | ||
"value": "true" | ||
}, | ||
"second": { | ||
"tag": "App", | ||
"name": "Lbl'UndsEqlsEqls'Int'Unds'", | ||
"sorts": [], | ||
"args": [ | ||
{ | ||
"tag": "EVar", | ||
"name": "Var'Ques'X", | ||
"sort": { | ||
"tag": "SortApp", | ||
"name": "SortInt", | ||
"args": [] | ||
} | ||
}, | ||
{ | ||
"tag": "DV", | ||
"sort": { | ||
"tag": "SortApp", | ||
"name": "SortInt", | ||
"args": [] | ||
}, | ||
"value": "42" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.