Skip to content

Commit

Permalink
Add minimal reproducible example for freshUInt / *Int normalization i…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas MT committed Aug 9, 2023
1 parent 9efecd8 commit bf65a68
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/foundry/normalization-lemmas.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
requires "foundry.md"

module NORMALIZATION-LEMMAS
imports FOUNDRY

rule A *Int B => B *Int A [concrete(A), symbolic(B), simplification(40)]

endmodule
2 changes: 2 additions & 0 deletions tests/foundry/reproduce.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kevm foundry-kompile --verbose --require normalization-lemmas.k --module-import FreshIntTest:NORMALIZATION-LEMMAS --regen --with-llvm-library
kevm foundry-prove --test FreshIntTest.test_uint256 --verbose --reinit --kore-rpc-command "kore-rpc-booster --simplify-after-exec --llvm-backend-library out/kompiled-llvm/interpreter.so"
5 changes: 5 additions & 0 deletions tests/foundry/test/FreshInt.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ contract FreshIntTest is Test, KEVMCheats {
int128 constant min = -170141183460469231731687303715884105728;
int128 constant max = 170141183460469231731687303715884105727;

function test_uint256() public {
kevm.infiniteGas();
uint256 fresh_uint256 = kevm.freshUInt(32);
}

function test_uint128() public {
kevm.infiniteGas();
uint256 fresh_uint128 = uint256(kevm.freshUInt(32));
Expand Down

0 comments on commit bf65a68

Please sign in to comment.