Z3 Theorem Prover

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by LiberatorG (talk | contribs) at 22:20, 28 January 2021 (version 4.8.10 released). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Z3 Theorem Prover
Original author(s)Microsoft Research
Developer(s)Microsoft
Initial release2012; 12 years ago (2012)
Stable release
z3-4.8.10 / January 20, 2021; 3 years ago (2021-01-20)[1]
Repositorygithub.com/Z3Prover/z3
Written inC++
Operating systemWindows, FreeBSD, Linux (Debian, Ubuntu), macOS
PlatformIA-32, x86-64
TypeTheorem prover
LicenseMIT License
Websitegithub.com/Z3Prover

Z3 Theorem Prover is a cross-platform satisfiability modulo theories (SMT) solver by Microsoft.[2]

Overview

Z3 was developed in the Research in Software Engineering (RiSE) group at Microsoft Research and is targeted at solving problems that arise in software verification and software analysis. Z3 supports arithmetic, fixed-size bit-vectors, extensional arrays, datatypes, uninterpreted functions, and quantifiers. Its main applications are extended static checking, test case generation, and predicate abstraction.

In 2015, it received the Programming Languages Software Award from ACM SIGPLAN.[3][4] In 2018, Z3 received the Test of Time Award from the European Joint Conferences on Theory and Practice of Software (ETAPS).[5] Microsoft researchers Nikolaj Bjørner and Leonardo de Moura received the 2019 Herbrand Award for Distinguished Contributions to Automated Reasoning in recognition of their work in advancing theorem proving with Z3.[6][7]

Z3 was open sourced in the beginning of 2015.[8] The source code is licensed under MIT License and hosted on GitHub.[9] The solver can be built using Visual Studio, a Makefile or using CMake and runs on Windows, FreeBSD, Linux, and macOS.

It has bindings for various programming languages including C, C++, Java, Haskell, OCaml, Python, WebAssembly, and .NET/Mono. The default input format is SMTLIB2.

Examples

Propositional and predicate logic

In this example propositional logic assertions are checked using functions to represent the propositions a and b. The following Z3 script checks to see if ¬(a ∧ b ) ≡ (¬ a ∨ ¬ b):

(declare-fun a () Bool)
(declare-fun b () Bool)
(assert (not (= (not (and a b)) (or (not a)(not b)))))
(check-sat)

Result:

unsat

Note that the script asserts the negation of the proposition of interest. The unsat result means that the negated proposition is not satisfiable, thus proving the desired result (De Morgan's laws).

Solving equations

The following script solves the two given equations, finding suitable values for the variables a and b:

(declare-const a Int)
(declare-const b Int)
(assert (= (+ a b) 20))
(assert (= (+ a (* 2 b)) 10))
(check-sat)
(get-model)

Result:

sat
(model 
  (define-fun b () Int
    -10)
  (define-fun a () Int
    30)
)

See also

References

  1. ^ https://github.com/Z3Prover/z3/releases/tag/z3-4.8.10
  2. ^ http://lim.univ-reunion.fr/staff/fred/Enseignement/AlgoAvancee/Exos/Z3-exercises.pdf
  3. ^ "Programming Languages Software Award". www.sigplan.org.
  4. ^ Microsoft Z3 Theorem Prover Wins Award
  5. ^ ETAPS 2018 Test of Time Award
  6. ^ The inner magic behind the Z3 theorem prover - Microsoft Research
  7. ^ Herbrand Award
  8. ^ "Microsoft's Visual Studio timeline and Z3 Theorem Prover, Google Cloud Launcher, Facebook's Fresco—SD Times news digest: March 27, 2015". March 27, 2015.
  9. ^ "GitHub - Z3Prover/z3: The Z3 Theorem Prover". December 1, 2019 – via GitHub.

Further reading

External links