Verify various properties of boolean expressions using a concise DSL.
Project description
VeriBool
Verify properties of boolean expressions using a concise DSL.
I know you just want to press that button
Installation
python3 -m pip install veribool
Usage
# directly compile the expression to a python lambda expression
# add the -i/--interactive flag to drop into a python interpreter with
# fn = <the boolean expression as a lambda>
$: veribool compile "x'y' + x'z + xyz"
lambda x, y, z, **_kwargs: (((not x) and (not y)) or (((not x) and z) or (x and y and z)))
# find a diverging input for two boolean expressions
$: veribool diff "x xnor (yz)" "x'y' + x'z + xyz"
[0, 1, 0] - True vs False
# $? == 0 if expressions match
$: veribool diff "x xnor (yz)" "x'y' + x'z' + xyz" && echo equal
equal
# generate truth table
$: veribool truth "x xnor (yz)"
[0, 0, 0] - True
[0, 0, 1] - True
[0, 1, 0] - True
[0, 1, 1] - False
[1, 0, 0] - False
[1, 0, 1] - False
[1, 1, 0] - False
[1, 1, 1] - True
DSL
This project implements a compiler for a boolean expression DSL closely modeling mathematical boolean algebra notation.
Rules:
- each variable is 1 case-sensitive alphabetical character
- parenthesis exist
x'is the complement ofxxyis theandofxandyx + yis theorofxandyx ^ yandx xor yare thexorofxandyx xnor yis thexnorofxandy- order of operations is:
parenthesis,not,andfollowed by the rest of the operators
Roadmap
- use z3 as a backend
- add some basic simplifications
- output to verilog / other languages
Developers
Developed by Ronak Badhe
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file veribool-0.0.0.tar.gz.
File metadata
- Download URL: veribool-0.0.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e204d7ef6bc19127afcf27f84c504909d420bf874c565def075040dac10b78fc
|
|
| MD5 |
2b6774f1eec9718aa860d315d97c63ac
|
|
| BLAKE2b-256 |
6b3d71a32a117d0958d726d23ae567b1ec98d91162be36691d9b87eebcdffb85
|
File details
Details for the file veribool-0.0.0-py3-none-any.whl.
File metadata
- Download URL: veribool-0.0.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
636741041a5573fc3ca7ada33e68f29c4ff8ca7d10f059ed15320aaf703a188f
|
|
| MD5 |
c60b3f433c4389db8641ddc5c35c6b74
|
|
| BLAKE2b-256 |
1c6715b4f9608d4180bd8fa0e3b65bef826258fe22ca5fe8965e7e54b8c8a32d
|