-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1303 from GaloisInc/primitive-scanl
Primitive scanl
- Loading branch information
Showing
14 changed files
with
143 additions
and
48 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Cryptol::Reference as Ref | ||
|
||
// NB, using subtraction here because is is not commutative or associative | ||
|
||
property foldl_eq (z:Integer) (xs:[10]Integer) = | ||
foldl (-) z xs == Ref::foldl (-) z xs | ||
|
||
property scanl_eq (z:Integer) (xs:[10]Integer) = | ||
scanl (-) z xs == Ref::scanl (-) z xs | ||
|
||
property iterate_eq (z:Integer) (i:[8]) = | ||
(iterate (\x -> x + 1) z)@i == (Ref::iterate (\x -> x + 1) z)@i |
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,10 @@ | ||
:l reference.cry | ||
|
||
:set tests=1000 | ||
:check | ||
|
||
:set prover=sbv-z3 | ||
:prove | ||
|
||
:set prover=w4-z3 | ||
:prove |
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,22 @@ | ||
Loading module Cryptol | ||
Loading module Cryptol | ||
Loading module Cryptol::Reference | ||
Loading module Main | ||
property foldl_eq Using random testing. | ||
Testing... Passed 1000 tests. | ||
property scanl_eq Using random testing. | ||
Testing... Passed 1000 tests. | ||
property iterate_eq Using random testing. | ||
Testing... Passed 1000 tests. | ||
:prove foldl_eq | ||
Q.E.D. | ||
:prove scanl_eq | ||
Q.E.D. | ||
:prove iterate_eq | ||
Q.E.D. | ||
:prove foldl_eq | ||
Q.E.D. | ||
:prove scanl_eq | ||
Q.E.D. | ||
:prove iterate_eq | ||
Q.E.D. |
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