Skip to content
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

Lemmas on Boolean reasoning, set reasoning, map lookup #2037

Merged
merged 104 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
d833339
lemmas on Boolean reasoning, set reasoning, map lookup, and keccak
PetarMax Aug 24, 2023
ea5f6f8
Set Version: 1.0.277
Aug 24, 2023
26fea22
removing keccak lemmas that should not be upstreamed
PetarMax Aug 24, 2023
fdae25d
addressing comments
PetarMax Aug 24, 2023
837c105
Set Version: 1.0.278
Aug 24, 2023
78cd2a8
Merge branch 'master' into lemmas
PetarMax Aug 24, 2023
25c1cc8
Set Version: 1.0.278
Aug 24, 2023
b8fe221
corrections
PetarMax Aug 24, 2023
dd3b023
removing ==Bool from expected files
PetarMax Aug 24, 2023
10936f5
Set Version: 1.0.279
Aug 24, 2023
62c53fe
Merge branch 'master' into lemmas
PetarMax Aug 24, 2023
30bdcea
Set Version: 1.0.279
Aug 24, 2023
821d161
merge with master
PetarMax Oct 2, 2023
13379bf
Set Version: 1.0.309
Oct 2, 2023
b45d996
Merge branch 'master' into lemmas
PetarMax Oct 3, 2023
582e241
Set Version: 1.0.311
Oct 3, 2023
98ad20f
updating expected outputs
PetarMax Oct 3, 2023
0cf3579
Merge remote-tracking branch 'origin/master' into lemmas
PetarMax Oct 3, 2023
aaaba23
Set Version: 1.0.312
Oct 3, 2023
d69786b
merge with master
PetarMax Oct 30, 2023
314804d
Set Version: 1.0.330
Oct 30, 2023
16f0a29
Merge branch 'master' into lemmas
PetarMax Nov 1, 2023
f996c51
Set Version: 1.0.334
Nov 1, 2023
ddb393f
revisiting set simplifications
PetarMax Nov 2, 2023
167361b
--amend
PetarMax Nov 2, 2023
0416011
--amend
PetarMax Nov 2, 2023
efed1fc
--amend
PetarMax Nov 2, 2023
61fac3d
streamlining lookup simplifications
PetarMax Nov 2, 2023
69624a0
streamlining set simplifications
PetarMax Nov 2, 2023
100cc35
removing set reasoning entirely
PetarMax Nov 3, 2023
ff5bc7b
Merge branch 'master' into lemmas
PetarMax Nov 3, 2023
8cfae18
Set Version: 1.0.336
Nov 3, 2023
9d47df1
concretising set simplifications:
PetarMax Nov 3, 2023
700fdd5
streamlining set simplifications
PetarMax Nov 4, 2023
d4dd82e
Merge branch 'master' into lemmas
PetarMax Nov 6, 2023
0fcd1ae
Set Version: 1.0.337
Nov 6, 2023
f30641d
even more concrete set simplifications
PetarMax Nov 7, 2023
94b72df
bringing old simplifications back
PetarMax Nov 7, 2023
c2a4e05
Merge branch 'master' into lemmas
PetarMax Nov 7, 2023
510a255
Set Version: 1.0.340
Nov 7, 2023
5e1ed01
resolving parsing ambiguities
PetarMax Nov 7, 2023
dbb8ab7
--amend
PetarMax Nov 7, 2023
59555fc
--amend
PetarMax Nov 7, 2023
ea7ee66
Merge branch 'master' into lemmas
PetarMax Nov 8, 2023
dd1f82c
Set Version: 1.0.341
Nov 8, 2023
54f998a
Merge branch 'master' into lemmas
PetarMax Nov 8, 2023
74b2257
Set Version: 1.0.342
Nov 8, 2023
0b339b0
merge with master
PetarMax Nov 8, 2023
9fb651a
Set Version: 1.0.343
Nov 8, 2023
ddc72fc
correction
PetarMax Nov 8, 2023
9eb0a3a
syntax
PetarMax Nov 8, 2023
fb0623e
--amend
PetarMax Nov 8, 2023
fe85753
merge with master
PetarMax Nov 9, 2023
f038da7
Set Version: 1.0.349
Nov 9, 2023
257d2ff
Merge branch 'master' into lemmas
PetarMax Nov 13, 2023
5174e84
Set Version: 1.0.355
Nov 13, 2023
322e886
Merge branch 'master' into lemmas
PetarMax Nov 13, 2023
c5e70a5
Set Version: 1.0.356
Nov 13, 2023
326d016
Merge branch 'master' into lemmas
PetarMax Nov 14, 2023
7511a25
Set Version: 1.0.357
Nov 14, 2023
5f20200
Correctly ordered arguments in `typed_args` (#2174)
palinatolmach Nov 15, 2023
52365cc
Inject `ccopts` directly into `kevm_kompile` and fix some tests (#2164)
ehildenb Nov 15, 2023
41162f0
Fix circular import (#2179)
tothtamas28 Nov 16, 2023
c2a643f
Move `--port` arguments to `rpc_args` (#2178)
palinatolmach Nov 16, 2023
9b5099e
Update dependency: deps/pyk_release (#2175)
rv-jenkins Nov 16, 2023
e28b5f3
Update dependency: deps/pyk_release (#2181)
rv-jenkins Nov 17, 2023
42b4bb9
merge with master
PetarMax Nov 20, 2023
6a78025
Set Version: 1.0.364
Nov 20, 2023
fb0e8be
Set Version: 1.0.364
Nov 20, 2023
422f665
Set Version: 1.0.365
Nov 20, 2023
d2a9626
merge with master
PetarMax Nov 24, 2023
95284d8
Set Version: 1.0.372
Nov 24, 2023
1091f9a
merge with master
PetarMax Dec 1, 2023
f1758b6
Set Version: 1.0.379
Dec 1, 2023
1d71a17
adding tests
PetarMax Dec 1, 2023
b13b069
Merge branch 'master' into lemmas
PetarMax Dec 1, 2023
51d907e
Set Version: 1.0.381
Dec 1, 2023
c74c8e1
normalising comparisons, adding keccak
PetarMax Dec 3, 2023
a904099
reverting normalisation
PetarMax Dec 3, 2023
e2c99d6
removing equality simplification
PetarMax Dec 4, 2023
778f6d7
Set Version: 1.0.382
Dec 4, 2023
f6f7654
merge with master
PetarMax Dec 4, 2023
2290b66
Set Version: 1.0.382
Dec 4, 2023
8d0cc99
bringing back comparison (but not equality) normalisation
PetarMax Dec 4, 2023
06b1ccf
bringing back equality normalisation
PetarMax Dec 4, 2023
cfa562d
Merge branch 'master' into lemmas
PetarMax Dec 13, 2023
1e90210
Set Version: 1.0.394
Dec 13, 2023
b4e121e
Merge branch 'master' into lemmas
palinatolmach Dec 15, 2023
55b8e00
Set Version: 1.0.396
Dec 15, 2023
4adc1ac
Merge branch 'master' into lemmas
PetarMax Dec 17, 2023
1a42294
Set Version: 1.0.398
Dec 17, 2023
400a36b
removing unsound keccak simplifying assumptions
PetarMax Dec 18, 2023
71da1b1
Merge remote-tracking branch 'origin/master' into lemmas
PetarMax Dec 19, 2023
ad8986d
Set Version: 1.0.399
Dec 19, 2023
39b7d7a
Merge branch 'master' into lemmas
PetarMax Dec 19, 2023
9c7dde3
Set Version: 1.0.400
Dec 19, 2023
a740a3d
Merge branch 'master' into lemmas
PetarMax Dec 21, 2023
c4221ea
Set Version: 1.0.406
Dec 21, 2023
f269633
Merge branch 'master' into lemmas
PetarMax Dec 22, 2023
3e3fbb5
Set Version: 1.0.407
Dec 22, 2023
d293951
adding tests for comparison normalisation, removing keccak
PetarMax Dec 22, 2023
ac6b6ec
Update kevm-pyk/src/kevm_pyk/kproj/evm-semantics/serialization.md
PetarMax Dec 22, 2023
474877e
----- alignment
PetarMax Dec 22, 2023
06c1a16
Update kevm-pyk/src/kevm_pyk/kproj/evm-semantics/lemmas/lemmas.k
ehildenb Dec 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kevm-pyk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kevm-pyk"
version = "1.0.342"
version = "1.0.343"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/src/kevm_pyk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from typing import Final


VERSION: Final = '1.0.342'
VERSION: Final = '1.0.343'
20 changes: 13 additions & 7 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/lemmas/lemmas.k
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module LEMMAS [symbolic]
rule chop(_V) <Int pow256 => true [simplification]

rule X *Int Y <Int pow256 => true requires Y <=Int maxUInt256 /Int X [simplification]
rule #if B #then C +Int C1 #else C +Int C2 #fi => C +Int #if B #then C1 #else C2 #fi [simplification]
rule #if B #then C +Int C1 #else C +Int C2 #fi => C +Int #if B #then C1 #else C2 #fi [simplification]

// ########################
// Set Reasoning
Expand All @@ -37,6 +37,9 @@ module LEMMAS [symbolic]
rule X in (SetItem(Y) _ ) => true requires X ==Int Y [simplification]
rule X in (SetItem(Y) REST) => X in REST requires X =/=Int Y [simplification]

rule ( S:Set |Set SetItem ( X ) ) |Set SetItem( X ) => S [simplification]
rule ( ( S:Set |Set SetItem ( X ) ) |Set SetItem ( Y ) ) |Set SetItem( X ) => S [simplification]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these too ad-hoc now? @ehildenb

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, I don't see why these would be valid. There's nothing here guaranteeing that X or Y are already in S

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it supposed to be S SetItem(X) instead of S |Set SetItem(X)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, oh wow, so many changes, and I've lost track of what's happening, it's the LHS


// ########################
// Word Reasoning
// ########################
Expand All @@ -56,8 +59,6 @@ module LEMMAS [symbolic]
rule bool2Word(_B) |Int 1 => 1 [simplification]
rule bool2Word( B) &Int 1 => bool2Word(B) [simplification]

rule notBool notBool B => B [simplification]

// #newAddr range
rule 0 <=Int #newAddr(_,_) => true [simplification]
rule #newAddr(_,_) <Int pow160 => true [simplification]
Expand All @@ -80,12 +81,13 @@ module LEMMAS [symbolic]
// Map Reasoning
// ########################

rule #lookup ( _M:Map [ K1 <- V1 ] , K2 ) => #lookup ( K1 |-> V1 , K1 ) requires K1 ==Int K2 [simplification]
rule #lookup ( M:Map [ K1 <- _ ] , K2 ) => #lookup ( M , K2 ) requires K1 =/=Int K2 [simplification]

rule 0 <=Int #lookup( _M:Map , _ ) => true [simplification, smt-lemma]
rule #lookup( _M:Map , _ ) <Int pow256 => true [simplification, smt-lemma]

rule #lookup ( _M:Map [ K1 <- V1 ] , K2 ) => #lookup ( K1 |-> V1 , K1 ) requires K1 ==Int K2 [simplification]
rule #lookup ( M:Map [ K1 <- _ ] , K2 ) => #lookup ( M , K2 ) requires K1 =/=Int K2 [simplification]
rule #lookup ( (K1:Int |-> _) M:Map, K2:Int) => #lookup ( M, K2 ) requires K1 =/=Int K2 [simplification]
ehildenb marked this conversation as resolved.
Show resolved Hide resolved

rule M:Map [ I1:Int <- V1:Int ] [ I2:Int <- V2:Int ] ==K M:Map [ I2 <- V2 ] [ I1 <- V1 ] => true
requires I1 =/=Int I2
[simplification]
Expand Down Expand Up @@ -217,6 +219,10 @@ module LEMMAS-HASKELL [symbolic, kore]
// Boolean Logic
// ########################

rule B ==Bool false => notBool B [simplification]
rule B ==Bool true => B [simplification, comm]
rule B ==Bool false => notBool B [simplification, comm]

rule notBool notBool B => B [simplification]

rule (notBool (A andBool B)) andBool A => (notBool B) andBool A [simplification]
endmodule
2 changes: 1 addition & 1 deletion kevm-pyk/src/kevm_pyk/kproj/evm-semantics/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Address/Hash Helpers
- `keccak` serves as a wrapper around the `Keccak256` in `KRYPTO`.

```k
syntax Int ::= keccak ( Bytes ) [function, total, smtlib(smt_keccak)]
syntax Int ::= keccak ( Bytes ) [function, total, injective, smtlib(smt_keccak)]
// -------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
syntax Int ::= keccak ( Bytes ) [function, total, injective, smtlib(smt_keccak)]
// -------------------------------------------------------------------------
syntax Int ::= keccak ( Bytes ) [function, total, injective, smtlib(smt_keccak)]
// ------------------------------------------------------------------------------------

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How strange, I thought this was taken care of...

rule [keccak]: keccak(WS) => #parseHexWord(Keccak256bytes(WS)) [concrete]
```
Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.342
1.0.343
Loading