Z3 Theorem Prover Explained

Z3 Theorem Prover
Logo Size:75px
Author:Microsoft Research
Developer:Microsoft
Programming Language:C++
Operating System:Windows, FreeBSD, Linux (Debian, Ubuntu), macOS
Platform:IA-32, x86-64, WebAssembly, arm64
Genre:Theorem prover
License:MIT License

Z3, also known as the Z3 Theorem Prover, is a satisfiability modulo theories (SMT) solver developed by Microsoft.[1]

Overview

Z3 was developed in the Research in Software Engineering (RiSE) group at Microsoft Research Redmond and is targeted at solving problems that arise in software verification and program 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.

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

The default input format for Z3 is SMTLIB2.It also has officially supported bindings for several programming languages, including C, C++, Python, .NET, Java, and OCaml.[4]

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

\overline{a\landb}\equiv\overline{a}\lor\overline{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 law).

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

Awards

In 2015, Z3 received the Programming Languages Software Award from ACM SIGPLAN.[5] [6] In 2018, Z3 received the Test of Time Award from the European Joint Conferences on Theory and Practice of Software (ETAPS).[7] 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.[8] [9]

See also

Further reading

External links

Notes and References

  1. Web site: Using the SMT solver Z3 . 2019-12-01 . 2020-11-17 . https://web.archive.org/web/20201117164223/http://lim.univ-reunion.fr/staff/fred/Enseignement/AlgoAvancee/Exos/Z3-exercises.pdf . dead.
  2. Web site: 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.
  3. Web site: GitHub - Z3Prover/z3: The Z3 Theorem Prover. December 1, 2019. GitHub.
  4. Web site: Bjørner . Nikolaj . de Moura . Leonardo . Nachmanson . Lev . Wintersteiger . Christoph . 2019 . Programming Z3 . live . https://web.archive.org/web/20230209065233/https://z3prover.github.io/papers/programmingz3.html . February 9, 2023 . May 21, 2023 . Programming Z3.
  5. Web site: Programming Languages Software Award. www.sigplan.org.
  6. https://www.i-programmer.info/news/112-theory/8722-microsoft-z3-theorem-prover-wins-award-.html Microsoft Z3 Theorem Prover Wins Award
  7. https://www.etaps.org/about/test-of-time-award/test-of-time-award-2018 ETAPS 2018 Test of Time Award
  8. https://www.microsoft.com/en-us/research/blog/the-inner-magic-behind-the-z3-theorem-prover/ The inner magic behind the Z3 theorem prover - Microsoft Research
  9. http://www.cadeinc.org/Herbrand-Award Herbrand Award