-
Notifications
You must be signed in to change notification settings - Fork 152
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
13 changed files
with
185 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
true | ||
#Equals | ||
Z:MyId in_keys ( MAP | ||
( Y:MyId |-> 1 ) ) | ||
( Y:MyId |-> 2 ) ) | ||
} | ||
#And | ||
{ | ||
|
5 changes: 5 additions & 0 deletions
5
k-distribution/tests/regression-new/unification-lemmas/Makefile
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,5 @@ | ||
DEF=test | ||
TESTDIR=. | ||
KOMPILE_BACKEND=haskell | ||
|
||
include ../../../include/kframework/ktest.mak |
12 changes: 12 additions & 0 deletions
12
k-distribution/tests/regression-new/unification-lemmas/test-spec.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,12 @@ | ||
// Copyright (c) 2022 K Team. All Rights Reserved. | ||
|
||
requires "test.k" | ||
|
||
module TEST-SPEC | ||
imports TEST | ||
|
||
claim <k> makeLookup(B) => 1 ... </k> | ||
requires lookup(#hashedLocation(B .IntList)) ==Int 1 | ||
andBool #rangeUInt(B) | ||
|
||
endmodule |
1 change: 1 addition & 0 deletions
1
k-distribution/tests/regression-new/unification-lemmas/test-spec.k.out
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 @@ | ||
#Top |
44 changes: 44 additions & 0 deletions
44
k-distribution/tests/regression-new/unification-lemmas/test.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,44 @@ | ||
// Copyright (c) 2020 K Team. All Rights Reserved. | ||
|
||
module TEST-SYNTAX | ||
endmodule | ||
|
||
module TEST | ||
imports TEST-SYNTAX | ||
imports BOOL | ||
imports INT | ||
imports MAP | ||
imports STRING | ||
imports MAP-SYMBOLIC | ||
|
||
configuration <k> $PGM:KItem </k> | ||
|
||
syntax KItem ::= makeLookup(Int) | ||
rule makeLookup(B) => lookup(#hash(B)) | ||
|
||
syntax Int ::= lookup(Hash) [function, no-evaluators] | ||
| #lookupMemory ( Map , Int ) [function, functional, smtlib(lookupMemory)] | ||
syntax Int ::= "pow256" [alias] /* 2 ^Int 256 */ | ||
rule pow256 => 115792089237316195423570985008687907853269984665640564039457584007913129639936 | ||
|
||
syntax KItem ::= runLemma(Int) | doneLemma(Int) | ||
rule runLemma(T) => doneLemma(T) | ||
|
||
// ------------------------------------------- | ||
syntax IntList ::= List{Int, ""} | ||
|
||
syntax Bool ::= #rangeUInt(Int) [function, no-evaluators] | ||
|
||
syntax Hash ::= #hash(Int) | ||
| #hashedLocation( IntList ) [function] | ||
|
||
rule #hashedLocation( .IntList) => #hash(0) | ||
rule #hashedLocation(OFFSET .IntList) => #hash(OFFSET) | ||
requires #rangeUInt(OFFSET) | ||
|
||
rule [#lookupMemory.some]: #lookupMemory( (KEY |-> VAL:Int) _M, KEY ) => VAL modInt 256 | ||
rule [#lookupMemory.none]: #lookupMemory( M, KEY ) => 0 requires notBool KEY in_keys(M) | ||
//Impossible case, for completeness | ||
rule [#lookupMemory.notInt]: #lookupMemory( (KEY |-> VAL ) _M, KEY ) => 0 requires notBool isInt(VAL) | ||
|
||
endmodule |
10 changes: 10 additions & 0 deletions
10
k-distribution/tests/regression-new/unification-lemmas/test2-spec.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,10 @@ | ||
// Copyright (c) 2022 K Team. All Rights Reserved. | ||
|
||
requires "test.k" | ||
|
||
module TEST2-SPEC | ||
imports TEST | ||
|
||
claim <k> runLemma ( #lookupMemory(( KEY |-> 33) (_KEY' |-> 728) (_KEY'' |-> (pow256 +Int 5)) (_KEY''' |-> "hello"), KEY) ) => doneLemma ( 33 ) ... </k> | ||
|
||
endmodule |
1 change: 1 addition & 0 deletions
1
k-distribution/tests/regression-new/unification-lemmas/test2-spec.k.out
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 @@ | ||
#Top |
5 changes: 5 additions & 0 deletions
5
k-distribution/tests/regression-new/unification-lemmas2/Makefile
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,5 @@ | ||
DEF=with-config | ||
TESTDIR=. | ||
KOMPILE_BACKEND=haskell | ||
|
||
include ../../../include/kframework/ktest.mak |
14 changes: 14 additions & 0 deletions
14
k-distribution/tests/regression-new/unification-lemmas2/owise-spec.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,14 @@ | ||
requires "with-config.k" | ||
|
||
module OWISE-SPEC | ||
imports WITH-CONFIG | ||
|
||
claim <k> a(AID) => 0 </k> | ||
<accounts> | ||
<account> | ||
<accountID> BID </accountID> | ||
<freeBalance> 30 </freeBalance> | ||
</account> | ||
</accounts> | ||
requires AID =/=K BID | ||
endmodule |
1 change: 1 addition & 0 deletions
1
k-distribution/tests/regression-new/unification-lemmas2/owise-spec.k.out
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 @@ | ||
#Top |
39 changes: 39 additions & 0 deletions
39
k-distribution/tests/regression-new/unification-lemmas2/with-config.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,39 @@ | ||
module WITH-CONFIG | ||
imports INT | ||
imports COLLECTIONS | ||
imports K-EQUAL | ||
|
||
configuration | ||
<set-balance> | ||
<k> $PGM:KItem </k> | ||
<accounts> | ||
<account multiplicity="*" type="Map"> | ||
<accountID> .AccountId:AccountId </accountID> | ||
<freeBalance> 0 </freeBalance> | ||
</account> | ||
</accounts> | ||
</set-balance> | ||
|
||
syntax KItem ::= Int | ||
|
||
syntax AccountId ::= ".AccountId" | Int | ||
// --------------------------------------- | ||
|
||
syntax Int ::= "total_balance" "(" AccountId ")" [function, functional] | ||
// ----------------------------------------------------------------------- | ||
rule total_balance(WHO) => 0 [owise] | ||
rule [[ total_balance(WHO) => FREE_BALANCE ]] | ||
<account> | ||
<accountID> WHO </accountID> | ||
<freeBalance> FREE_BALANCE </freeBalance> | ||
</account> | ||
|
||
// for one-spec | ||
syntax KItem ::= "aa" "(" AccountId ")" | ||
rule aa(AID) => total_balance(AID) | ||
|
||
// for owise-spec | ||
syntax KItem ::= "a" "(" AccountId ")" | ||
rule a(AID) => total_balance(AID) | ||
|
||
endmodule |