-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fresh, assert and assume to WISL, tweak while
- Loading branch information
1 parent
d63f731
commit 6621fa0
Showing
6 changed files
with
107 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function llen(x) { | ||
if (x = null) { | ||
n := 0 | ||
} else { | ||
t := [x+1]; | ||
n := llen(t); | ||
n := n + 1 | ||
}; | ||
return n | ||
} | ||
|
||
function build_list(size) { | ||
i := 0; | ||
l := null; | ||
while (i < size) { | ||
n := new(2); | ||
[n] := size - i; | ||
[n + 1] := l; | ||
l := n; | ||
i := i + 1 | ||
}; | ||
return l | ||
} | ||
|
||
function main() { | ||
fresh x; | ||
assume (x >= 2); | ||
assume (x <= 3); | ||
l := build_list(x); | ||
size := llen(l); | ||
assert (size = 2); | ||
return null | ||
} |
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
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