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

Time limits for SystemTests #80

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
var Gamma_R0: bool;
var Gamma_R31: bool;
var Gamma_R8: bool;
var Gamma_R9: bool;
var Gamma_mem: [bv64]bool;
var Gamma_stack: [bv64]bool;
var R0: bv64;
var R31: bv64;
var R8: bv64;
var R9: bv64;
var mem: [bv64]bv8;
var stack: [bv64]bv8;
const $arr_addr: bv64;
axiom ($arr_addr == 69684bv64);
function L(memory: [bv64]bv8, index: bv64) returns (bool) {
(if ((index == bvadd64($arr_addr, 4bv64)) || (index == bvadd64($arr_addr, 0bv64))) then false else false)
}

function {:bvbuiltin "bvadd"} bvadd64(bv64, bv64) returns (bv64);
function gamma_load32(gammaMap: [bv64]bool, index: bv64) returns (bool) {
(gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index])))
}

function gamma_load64(gammaMap: [bv64]bool, index: bv64) returns (bool) {
(gammaMap[bvadd64(index, 7bv64)] && (gammaMap[bvadd64(index, 6bv64)] && (gammaMap[bvadd64(index, 5bv64)] && (gammaMap[bvadd64(index, 4bv64)] && (gammaMap[bvadd64(index, 3bv64)] && (gammaMap[bvadd64(index, 2bv64)] && (gammaMap[bvadd64(index, 1bv64)] && gammaMap[index])))))))
}

function gamma_store32(gammaMap: [bv64]bool, index: bv64, value: bool) returns ([bv64]bool) {
gammaMap[index := value][bvadd64(index, 1bv64) := value][bvadd64(index, 2bv64) := value][bvadd64(index, 3bv64) := value]
}

function memory_load32_le(memory: [bv64]bv8, index: bv64) returns (bv32) {
(memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index])))
}

function memory_load64_le(memory: [bv64]bv8, index: bv64) returns (bv64) {
(memory[bvadd64(index, 7bv64)] ++ (memory[bvadd64(index, 6bv64)] ++ (memory[bvadd64(index, 5bv64)] ++ (memory[bvadd64(index, 4bv64)] ++ (memory[bvadd64(index, 3bv64)] ++ (memory[bvadd64(index, 2bv64)] ++ (memory[bvadd64(index, 1bv64)] ++ memory[index])))))))
}

function memory_load8_le(memory: [bv64]bv8, index: bv64) returns (bv8) {
memory[index]
}

function memory_store32_le(memory: [bv64]bv8, index: bv64, value: bv32) returns ([bv64]bv8) {
memory[index := value[8:0]][bvadd64(index, 1bv64) := value[16:8]][bvadd64(index, 2bv64) := value[24:16]][bvadd64(index, 3bv64) := value[32:24]]
}

function {:bvbuiltin "zero_extend 32"} zero_extend32_32(bv32) returns (bv64);
procedure rely();
modifies mem, Gamma_mem;
ensures (forall i: bv64 :: (((mem[i] == old(mem[i])) ==> (Gamma_mem[i] == old(Gamma_mem[i])))));
ensures true;

procedure rely_transitive()
modifies mem, Gamma_mem;
ensures true;
{
call rely();
call rely();
}

procedure rely_reflexive()
{
assert true;
}

procedure guarantee_reflexive()
modifies mem, Gamma_mem;
{
assert (memory_load32_le(mem, bvadd64($arr_addr, 0bv64)) == memory_load32_le(mem, bvadd64($arr_addr, 0bv64)));
}

procedure main()
modifies Gamma_R0, Gamma_R31, Gamma_R8, Gamma_R9, Gamma_mem, Gamma_stack, R0, R31, R8, R9, mem, stack;
requires (Gamma_R0 == false);
free requires (memory_load8_le(mem, 1932bv64) == 1bv8);
free requires (memory_load8_le(mem, 1933bv64) == 0bv8);
free requires (memory_load8_le(mem, 1934bv64) == 2bv8);
free requires (memory_load8_le(mem, 1935bv64) == 0bv8);
free requires (memory_load8_le(mem, 69552bv64) == 208bv8);
free requires (memory_load8_le(mem, 69553bv64) == 13bv8);
free requires (memory_load8_le(mem, 69554bv64) == 1bv8);
free requires (memory_load8_le(mem, 69555bv64) == 0bv8);
free requires (memory_load8_le(mem, 69556bv64) == 0bv8);
free requires (memory_load8_le(mem, 69557bv64) == 0bv8);
free requires (memory_load8_le(mem, 69558bv64) == 0bv8);
free requires (memory_load8_le(mem, 69559bv64) == 0bv8);
free requires (memory_load8_le(mem, 69560bv64) == 0bv8);
free requires (memory_load8_le(mem, 69561bv64) == 0bv8);
free requires (memory_load8_le(mem, 69562bv64) == 0bv8);
free requires (memory_load8_le(mem, 69563bv64) == 0bv8);
free requires (memory_load8_le(mem, 69564bv64) == 0bv8);
free requires (memory_load8_le(mem, 69565bv64) == 0bv8);
free requires (memory_load8_le(mem, 69566bv64) == 0bv8);
free requires (memory_load8_le(mem, 69567bv64) == 0bv8);
free requires (memory_load8_le(mem, 69568bv64) == 0bv8);
free requires (memory_load8_le(mem, 69569bv64) == 0bv8);
free requires (memory_load8_le(mem, 69570bv64) == 0bv8);
free requires (memory_load8_le(mem, 69571bv64) == 0bv8);
free requires (memory_load8_le(mem, 69572bv64) == 0bv8);
free requires (memory_load8_le(mem, 69573bv64) == 0bv8);
free requires (memory_load8_le(mem, 69574bv64) == 0bv8);
free requires (memory_load8_le(mem, 69575bv64) == 0bv8);
free requires (memory_load8_le(mem, 69576bv64) == 0bv8);
free requires (memory_load8_le(mem, 69577bv64) == 0bv8);
free requires (memory_load8_le(mem, 69578bv64) == 0bv8);
free requires (memory_load8_le(mem, 69579bv64) == 0bv8);
free requires (memory_load8_le(mem, 69580bv64) == 0bv8);
free requires (memory_load8_le(mem, 69581bv64) == 0bv8);
free requires (memory_load8_le(mem, 69582bv64) == 0bv8);
free requires (memory_load8_le(mem, 69583bv64) == 0bv8);
free requires (memory_load8_le(mem, 69584bv64) == 84bv8);
free requires (memory_load8_le(mem, 69585bv64) == 7bv8);
free requires (memory_load8_le(mem, 69586bv64) == 0bv8);
free requires (memory_load8_le(mem, 69587bv64) == 0bv8);
free requires (memory_load8_le(mem, 69588bv64) == 0bv8);
free requires (memory_load8_le(mem, 69589bv64) == 0bv8);
free requires (memory_load8_le(mem, 69590bv64) == 0bv8);
free requires (memory_load8_le(mem, 69591bv64) == 0bv8);
free requires (memory_load8_le(mem, 69592bv64) == 52bv8);
free requires (memory_load8_le(mem, 69593bv64) == 16bv8);
free requires (memory_load8_le(mem, 69594bv64) == 1bv8);
free requires (memory_load8_le(mem, 69595bv64) == 0bv8);
free requires (memory_load8_le(mem, 69596bv64) == 0bv8);
free requires (memory_load8_le(mem, 69597bv64) == 0bv8);
free requires (memory_load8_le(mem, 69598bv64) == 0bv8);
free requires (memory_load8_le(mem, 69599bv64) == 0bv8);
free requires (memory_load8_le(mem, 69600bv64) == 0bv8);
free requires (memory_load8_le(mem, 69601bv64) == 0bv8);
free requires (memory_load8_le(mem, 69602bv64) == 0bv8);
free requires (memory_load8_le(mem, 69603bv64) == 0bv8);
free requires (memory_load8_le(mem, 69604bv64) == 0bv8);
free requires (memory_load8_le(mem, 69605bv64) == 0bv8);
free requires (memory_load8_le(mem, 69606bv64) == 0bv8);
free requires (memory_load8_le(mem, 69607bv64) == 0bv8);
free requires (memory_load8_le(mem, 69664bv64) == 0bv8);
free requires (memory_load8_le(mem, 69665bv64) == 0bv8);
free requires (memory_load8_le(mem, 69666bv64) == 0bv8);
free requires (memory_load8_le(mem, 69667bv64) == 0bv8);
free requires (memory_load8_le(mem, 69668bv64) == 0bv8);
free requires (memory_load8_le(mem, 69669bv64) == 0bv8);
free requires (memory_load8_le(mem, 69670bv64) == 0bv8);
free requires (memory_load8_le(mem, 69671bv64) == 0bv8);
free requires (memory_load8_le(mem, 69672bv64) == 40bv8);
free requires (memory_load8_le(mem, 69673bv64) == 16bv8);
free requires (memory_load8_le(mem, 69674bv64) == 1bv8);
free requires (memory_load8_le(mem, 69675bv64) == 0bv8);
free requires (memory_load8_le(mem, 69676bv64) == 0bv8);
free requires (memory_load8_le(mem, 69677bv64) == 0bv8);
free requires (memory_load8_le(mem, 69678bv64) == 0bv8);
free requires (memory_load8_le(mem, 69679bv64) == 0bv8);
free ensures (Gamma_R31 == old(Gamma_R31));
free ensures (R31 == old(R31));
{
var arr$0_old: bv32;
lmain:
R31, Gamma_R31 := bvadd64(R31, 18446744073709551600bv64), Gamma_R31;
R9, Gamma_R9 := 65536bv64, true;
R9, Gamma_R9 := memory_load64_le(mem, bvadd64(R9, 4056bv64)), (gamma_load64(Gamma_mem, bvadd64(R9, 4056bv64)) || L(mem, bvadd64(R9, 4056bv64)));
stack, Gamma_stack := memory_store32_le(stack, bvadd64(R31, 12bv64), R0[32:0]), gamma_store32(Gamma_stack, bvadd64(R31, 12bv64), Gamma_R0);
R8, Gamma_R8 := zero_extend32_32(memory_load32_le(stack, bvadd64(R31, 12bv64))), gamma_load32(Gamma_stack, bvadd64(R31, 12bv64));
call rely();
assert (L(mem, bvadd64(R9, 4bv64)) ==> Gamma_R8);
arr$0_old := memory_load32_le(mem, bvadd64($arr_addr, 0bv64));
mem, Gamma_mem := memory_store32_le(mem, bvadd64(R9, 4bv64), R8[32:0]), gamma_store32(Gamma_mem, bvadd64(R9, 4bv64), Gamma_R8);
assert (arr$0_old == memory_load32_le(mem, bvadd64($arr_addr, 0bv64)));
R0, Gamma_R0 := 0bv64, true;
R31, Gamma_R31 := bvadd64(R31, 16bv64), Gamma_R31;
return;
}
Loading