Skip to main content

z3++

Project description

z4

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:

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]]

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

z4_solver-2022.12.18.0.tar.gz (15.2 kB view hashes)

Uploaded Source

Built Distribution

z4_solver-2022.12.18.0-py3-none-any.whl (15.0 kB view hashes)

Uploaded Python 3

Supported by

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