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
Metadata
Release files for veribool 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| veribool-0.0.0.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| veribool-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / veribool-0.0.0.tar.gz
| Download URL | veribool-0.0.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e204d7ef6bc19127afcf27f84c504909d420bf874c565def075040dac10b78fc
|
|
BLAKE2b-256 checksum How to use checksums |
6b3d71a32a117d0958d726d23ae567b1ec98d91162be36691d9b87eebcdffb85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|
Release files / veribool-0.0.0-py3-none-any.whl
| Download URL | veribool-0.0.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
636741041a5573fc3ca7ada33e68f29c4ff8ca7d10f059ed15320aaf703a188f
|
|
BLAKE2b-256 checksum How to use checksums |
1c6715b4f9608d4180bd8fa0e3b65bef826258fe22ca5fe8965e7e54b8c8a32d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.14
|