ArticleslgStudy

computer science

Z3 Theorem Prover

Z3 Theorem Prover is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Z3 Theorem Prover rather than just read about it. In short: Z3, also known as the Z3 Theorem Prover, is a satisfiability modulo theories (SMT) solver developed by Microsoft. 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 Theorem Prover — main illustration
Z3 Theorem Prover — illustration

Key takeaways

  • Z3 Theorem Prover belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Z3 Theorem Prover to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Z3 Theorem Prover from memory before moving on to harder problems.

Reference excerpt

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

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. The source code is licensed under MIT License and hosted on GitHub. 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. Z3 also provides a strategy language that lets users control how the solver attacks a problem. Strategies are built from tactics, which transform a goal into a set of subgoals (for example by simplification, Gaussian elimination, or bit-blasting); tacticals, combinators such as sequencing, alternation, repetition, timeouts and parallel composition that build compound tactics from simpler ones; and probes, which measure properties of a goal so that a strategy can branch on them. The design adapts the tactic framework of LCF-style interactive theorem provers to SMT solving, allowing users to tailor the solver's heuristics to specific classes of problems.

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 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. In 2018, Z3 received the Test of Time Award from the European Joint Conferences on Theory and Practice of Software (ETAPS). 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.

See also

Formal verification

References

Further reading Leonardo De Moura; Nikolaj Bjørner (2008). "Z3: an efficient SMT solver". Tools and Algorithms for the Construction and Analysis of Systems. 4963: 337–340. The inner magic behind the Z3 theorem prover

External links Official website Official playground

Worked examples

Example 1 — a first encounter with Z3 Theorem Prover

Start with the simplest possible case. Write down what Z3 Theorem Prover claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Z3 Theorem Prover before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Z3 Theorem Prover ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Z3 Theorem Prover

In research
Z3 Theorem Prover appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Z3 Theorem Prover in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Z3 Theorem Prover is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2012 software, Free software programmed in C++, Microsoft Research, so understanding it makes those chapters shorter.
In everyday life
Look for Z3 Theorem Prover outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Z3 Theorem Prover” →

How to study Z3 Theorem Prover in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Z3 Theorem Prover means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Z3 Theorem Prover out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Z3 Theorem Prover in simple terms?

Z3, also known as the Z3 Theorem Prover, is a satisfiability modulo theories (SMT) solver developed by Microsoft. 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…

Why does Z3 Theorem Prover matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Z3 Theorem Prover?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Z3 Theorem Prover.

Tags

  • 2012 software
  • Free software programmed in C++
  • Microsoft Research
  • Microsoft free software
  • Satisfiability modulo theories solvers
  • Software using the MIT license

Keep exploring