PyWiSE: A Python Twin of the Verified Symbolic Bug Finder WiSE
PyWiSE is a re-implementation of the (verified) Coq version of WiSE in Python. It features a command-line interface and parser to symbolically execute IMP programs. All code, with the exception of the parser and CLI code, closely mirror the Coq implementation. To demonstrate this, the original Coq code is provided as inline-comments close to the code mirroring it.
The relevant files are:
streams.py, mirroringstreams.v—a small library for infinite streams.imp.py, mirroringimp.v—the IMP programming language.symex.py, mirroringsymex.v—symbolic evaluation of expressions.bugfinder.py, mirroringbugfinder.v—the implementation of the bug finder.
Macros
For convenience, PyWiSE supports simple macro definitions which are inlined in the IMP program. Macros must be defined at the beginning of an IMP file and are not separated by semicolons either from each other or the remaining program. They can call other macros defined before (which implies that they cannot be (mutually) recursive). An example program using a macro is:
macro subadd1(x, y)
begin
x = x - y;
x = x + 1
end
subadd1(a, b);
x = 17
which expands to
a = a - b;
a = a + a;
x = 17
Note that macro "calls" are "statements," so you cannot invoke a macro inside an expression.
Installation
PyWiSE project requires Python 3.10 or higher. It is on PyPi; a simple
pip install wise-se suffices to install the symbolic executor in the current Python
environment.
If you want to build the project locally, we recommend using a virtual environment:
cd /path/to/PyWiSE
python3.10 -m venv venv
source venv/bin/activate
pip install .[dev,test]
Either way, the wise command should now be available on your command line. You can
test it on the examples in the examples/ directory, e.g.:
$ wise examples/gcd_buggy.imp
Analyzing file examples/gcd_buggy.imp
BUG FOUND
Path: a <= 0
Example Input: a := 0
Store: {}
BUG FOUND
Path: not (a <= 0) and b <= 0
Example Input: a := 1, b := 0
Store: {}
BUG FOUND
Path: not (a <= 0) and not (b <= 0) and not (a == b) and not (a <= b) and not (0 <= (a + b) and 0 <= b and b <= 0 and not (b == 0))
Example Input: a := 2, b := 1
Store: {}{old_a -> a}{old_b -> b}{a -> (a + b)}
...
The first two bugs are failing assertions on the input; the third one is a "real" bug.
For some examples, you might have to increase the number of generated symbolic states,
as in wise -n 100 ....
Enter wise -h for a short help text on the available options.
Copyright and License
Copyright © 2023 Arthur Correnson and Dominic Steinhöfel.
PyWiSE is released under the GNU General Public License v3.0 (see COPYING).
Metadata
Release files for wise-se 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| wise-se-0.0.7.tar.gz | 60.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wise_se-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 106.4 kB
Release files / wise-se-0.0.7.tar.gz
| Download URL | wise-se-0.0.7.tar.gz |
|---|---|
| Size | 60.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69abcb15d901a279230987e39f2743a9577aff84d584aac56214572077c4f6d4
|
|
BLAKE2b-256 checksum How to use checksums |
381a1e294fb0f41186c4467bc583cdf03c776f6073960eef72fcd917ed7f6a48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / wise_se-0.0.7-py3-none-any.whl
| Download URL | wise_se-0.0.7-py3-none-any.whl |
|---|---|
| Size | 46.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfb7a34f51410d37dca6dd4e47e5799abfccca7f59ce8f944d18bcfe7e6ee1bc
|
|
BLAKE2b-256 checksum How to use checksums |
02e02b08ee525801520e49a98c950e18942589e55d19f5c9a372ce7d3e400763
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for wise-se 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.