-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
saw-core: Fix handling of atWithDefault for infinite bit sequences
When calling `atWithDefault n d v i`, `d` should be returned if `i` is greater than or equal to `n`. `atWithDefault` is implemented as a primitive, so we must ensure that this is done in `saw-core`'s `atWithDefaultOp` function. While `atWithDefaultOp` was handling this correctly for generic infinite sequences, it was _not_ correctly handling the special case of infinite bit sequences. This led to the issues reported in #1768. This patch fixes #1768 by introducing a `bpBvAtWithDefault` combinator that implements the defaulting behavior above in terms of `bpBvAt`. I've added a test case to demonstrate that the test case from #1768 now works as expected.
- Loading branch information
1 parent
bde217a
commit 339a906
Showing
4 changed files
with
31 additions
and
2 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,4 @@ | ||
f : [2] -> [10] | ||
f x = take y | ||
where | ||
y = x # y |
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 @@ | ||
import "test.cry"; | ||
print {{ f 0b11 }}; | ||
print {{ f 0b10 }}; | ||
print {{ f 0b00 }}; | ||
sat z3 {{ \x -> f x == zero }}; |
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,3 @@ | ||
set -e | ||
|
||
$SAW test.saw |
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