Metadata-Version: 2.1
Name: z4-solver
Version: 2022.12.18.0
Summary: z3++
Home-page: https://github.com/Tyilo/z4
License: GPL-3.0-only
Author: Asger Hautop Drewsen
Author-email: asgerdrewsen@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: z3-solver (>=4.8,<5.0)
Project-URL: Repository, https://github.com/Tyilo/z4
Description-Content-Type: text/markdown

# z4

[z3](https://github.com/Z3Prover/z3) with some improvements:
* Change the right shift operation on `BitVec`'s to be logical instead of arithmetic
* Extend the `*` operation on `BoolRef`'s to work between two `BoolRef`'s.
* Add additional operations to `BoolRef`'s:
  * `+`, returning an Int kind such that e.g `True+True+False==2`
  * `&`, utilizing `And()`
  * `|`, utilizing `Or()`
  * `~`, utilizing `Not()`
* Add the `ByteVec` class
* Some helper methods for solving:
  * `easy_solve`
  * `find_all_solutions`
  * `easy_prove`
* Add some helper functions for z3 variables/constants:
  * `BoolToInt`
  * `Sgn`
  * `Abs`
  * `TruncDiv`

## Usage
Install with `pip install z4-solver`.

Standard usage:

```python3
import z4

a, b = z4.Ints("a b")
print(*z4.find_all_solutions([a > 0, b > 0, a % b == 3, a > b, a + b == 19]), sep="\n")
```

Output:
```
[b = 4, a = 15, div0 = [else -> 3], mod0 = [else -> 3]]
[b = 8, a = 11, div0 = [else -> 1], mod0 = [else -> 3]]
```

