veribool


Nameveribool JSON
Version 0.0.0 PyPI version JSON
download
home_pageNone
SummaryVerify various properties of boolean expressions using a concise DSL.
upload_time2024-07-22 07:32:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2024 Ronak Badhe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \Software\), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \AS IS\, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords compiler verification dsl boolean logic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # VeriBool

Verify properties of boolean expressions using a concise DSL.

<p align="center">
<img src="./assets/logo.webp" alt="logo" />
</p>

> I _know_ you just want to press that button

## Installation

```shell
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](https://github.com/r2dev2)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "veribool",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "compiler, verification, dsl, boolean, logic",
    "author": null,
    "author_email": "Ronak Badhe <ronak.badhe@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/6b/3d/71a32a117d0958d726d23ae567b1ec98d91162be36691d9b87eebcdffb85/veribool-0.0.0.tar.gz",
    "platform": null,
    "description": "# VeriBool\n\nVerify properties of boolean expressions using a concise DSL.\n\n<p align=\"center\">\n<img src=\"./assets/logo.webp\" alt=\"logo\" />\n</p>\n\n> I _know_ you just want to press that button\n\n## Installation\n\n```shell\npython3 -m pip install veribool\n```\n\n## Usage\n\n```\n# directly compile the expression to a python lambda expression\n# add the -i/--interactive flag to drop into a python interpreter with\n# fn = <the boolean expression as a lambda>\n$: veribool compile \"x'y' + x'z + xyz\"\nlambda x, y, z, **_kwargs: (((not x) and (not y)) or (((not x) and z) or (x and y and z)))\n\n# find a diverging input for two boolean expressions\n$: veribool diff \"x xnor (yz)\" \"x'y' + x'z + xyz\"\n[0, 1, 0] - True vs False\n\n# $? == 0 if expressions match\n$: veribool diff \"x xnor (yz)\" \"x'y' + x'z' + xyz\" && echo equal\nequal\n\n# generate truth table\n$: veribool truth \"x xnor (yz)\"\n[0, 0, 0] - True\n[0, 0, 1] - True\n[0, 1, 0] - True\n[0, 1, 1] - False\n[1, 0, 0] - False\n[1, 0, 1] - False\n[1, 1, 0] - False\n[1, 1, 1] - True\n```\n\n### DSL\n\nThis project implements a compiler for a boolean expression DSL closely modeling mathematical\nboolean algebra notation.\n\nRules:\n* each variable is 1 case-sensitive alphabetical character\n* parenthesis exist\n* `x'` is the complement of `x`\n* `xy` is the `and` of `x` and `y`\n* `x + y` is the `or` of `x` and `y`\n* `x ^ y` and `x xor y` are the `xor` of `x` and `y`\n* `x xnor y` is the `xnor` of `x` and `y`\n* order of operations is: `parenthesis`, `not`, `and` followed by the rest of the operators\n\n## Roadmap\n\n- [ ] use z3 as a backend\n- [ ] add some basic simplifications\n- [ ] output to verilog / other languages\n\n\n## Developers\n\nDeveloped by [Ronak Badhe](https://github.com/r2dev2)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Ronak Badhe  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \\Software\\), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \\AS IS\\, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  ",
    "summary": "Verify various properties of boolean expressions using a concise DSL.",
    "version": "0.0.0",
    "project_urls": {
        "Homepage": "https://github.com/r2dev2/veribool",
        "Issues": "https://github.com/r2dev2/veribool/issues",
        "Repository": "https://github.com/r2dev2/veribool"
    },
    "split_keywords": [
        "compiler",
        " verification",
        " dsl",
        " boolean",
        " logic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c6715b4f9608d4180bd8fa0e3b65bef826258fe22ca5fe8965e7e54b8c8a32d",
                "md5": "c60b3f433c4389db8641ddc5c35c6b74",
                "sha256": "636741041a5573fc3ca7ada33e68f29c4ff8ca7d10f059ed15320aaf703a188f"
            },
            "downloads": -1,
            "filename": "veribool-0.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c60b3f433c4389db8641ddc5c35c6b74",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 7429,
            "upload_time": "2024-07-22T07:32:12",
            "upload_time_iso_8601": "2024-07-22T07:32:12.658692Z",
            "url": "https://files.pythonhosted.org/packages/1c/67/15b4f9608d4180bd8fa0e3b65bef826258fe22ca5fe8965e7e54b8c8a32d/veribool-0.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b3d71a32a117d0958d726d23ae567b1ec98d91162be36691d9b87eebcdffb85",
                "md5": "2b6774f1eec9718aa860d315d97c63ac",
                "sha256": "e204d7ef6bc19127afcf27f84c504909d420bf874c565def075040dac10b78fc"
            },
            "downloads": -1,
            "filename": "veribool-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2b6774f1eec9718aa860d315d97c63ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 6909,
            "upload_time": "2024-07-22T07:32:14",
            "upload_time_iso_8601": "2024-07-22T07:32:14.162043Z",
            "url": "https://files.pythonhosted.org/packages/6b/3d/71a32a117d0958d726d23ae567b1ec98d91162be36691d9b87eebcdffb85/veribool-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-22 07:32:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "r2dev2",
    "github_project": "veribool",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "veribool"
}
        
Elapsed time: 0.54676s