Skip to main content

Verify various properties of boolean expressions using a concise DSL.

Project description

VeriBool

Verify properties of boolean expressions using a concise DSL.

logo

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 of x
  • xy is the and of x and y
  • x + y is the or of x and y
  • x ^ y and x xor y are the xor of x and y
  • x xnor y is the xnor of x and y
  • order of operations is: parenthesis, not, and followed 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veribool-0.0.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

veribool-0.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for veribool-0.0.0.tar.gz
Algorithm Hash digest
SHA256 e204d7ef6bc19127afcf27f84c504909d420bf874c565def075040dac10b78fc
MD5 2b6774f1eec9718aa860d315d97c63ac
BLAKE2b-256 6b3d71a32a117d0958d726d23ae567b1ec98d91162be36691d9b87eebcdffb85

See more details on using hashes here.

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

Hashes for veribool-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 636741041a5573fc3ca7ada33e68f29c4ff8ca7d10f059ed15320aaf703a188f
MD5 c60b3f433c4389db8641ddc5c35c6b74
BLAKE2b-256 1c6715b4f9608d4180bd8fa0e3b65bef826258fe22ca5fe8965e7e54b8c8a32d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page