Skip to content
0:00 / 0:00

#z3#smtsolver#haskell

Analyzing Programs with Z3

Compose Conference

2.9K subscribers • 31 videos on Hallway

YouTube
  • Recommended by 4 people: 2 on Hacker News, 1 on Lobsters and 1 in engineering communities.
  • Presented by Tikhon Jelvis, software engineer

Intermediate. Assumes working knowledge.

24K views10 years ago4 recommendations

Computer scienceSystems programmingFormal methods and verificationCompilers and interpretersAlgorithms

Tikhon Jelvis demonstrates how to compile a simple imperative language to SMT formulas and verify program invariants using the Z3 solver.

Tikhon Jelvis C◦mp◦se :: Conference composeconference.org/ February 5, 2016 SMT solvers are widely used in research to analyze and verify programs. This lets us check invariants and compare programs against a spec exhaustively, with bounds on the number of loop iterations and the size of the heap. SMT solvers are also useful for other sorts of analysis including sophisticated type checking (like refinement types in Liquid Haskell) and fields other than program analysis (like security research where they can be used to analyze cryptographic algorithms and protocols). I’ll demonstrate how to compile a simple language to an SMT formula and analyze programs using the Haskell Z3 bindings. Z3 has bindings in other languages including OCaml and .NET, so these ideas will be immediately useful to everyone even if the details are slightly different from the Haskell code. The underlying ideas will also help people approach other problems with Z3.

Why it's here

4 people recommend this

What people say. Recommended as an approachable entry point to program verification and SMT solvers.

u/mightybytein r/haskell • Recommends

Compose Conference: Analyzing Programs with Z3

craigstuntzon Lobsters • Recommends

Analyzing Programs with Z3

tikhonjon Hacker News • Recommends

On “Z3 SMT solver interactive tutorial”

If you want a fun example of using Z3, I gave a talk recently that walks you through verifying programs in a tiny little imperative language by compiling them to Z3 formulas. It's easier than it sounds! It was recorded 1 and I have example code and additional resources (papers, etc) on my site 2. 1: link to this video 2: link If you want to do more, you can extend the same process to synthesizing programs, not just verifying them. It doesn't scale too far, but otherwise it's like magic.

buckieon Hacker News • Recommends

On “Show HN: Dharma – Programmable Peer-To-Peer Loans Using Ethereum Smart Contracts”

…se are few and far between. My paper on it is soup to nuts for how we do it in Pact which, while technical, should be somewhat approachable for most devs to grasp (I tried at least -- representing a program as equations is just an abstract concept). Until it comes out, the best one I've found as an entry point was the approach they use in Cryptol: link to this video . Cryptol, generally is a great project to look to for guidance. We're not going with the interactive approach. An EDSL in the docstrings is our approach so that you can pull a contract from the chain (pact is interpreted so the code on chain is the code that executes... well after it gets inlined and validated) and do the verification for…

u/tikhonjelvisin r/haskell • Mentions

On “Learning Haskell, what type of side projects to do in Haskell to get some practice”

I love writing programming language tools in Haskell. A fun option is to implement your own little language interpreter along with bounded verification or even program synthesis using Z3. Blowing my own horn a bit, I gave a tutorial talk that's a good starting point for writing that sort of thing in Haskell: Analyzing Programs with Z3.

philzookon Hacker News • Mentions

On “Software Verification and Analysis Using Z3”

These are other good resources: - rise4fun link - link - Programming Z3 - link - Nikolaj Bjorner's tutorial link - Hakank's examples link - Yurichev's book "SMT by Example" link - link - link to this video Tikhon Jelvis - Analyzing Programs with Z3 - link - Nadia Polykarpova on Z3 - SAT SMT school link - Emina Torlak's course link - Lindsey Kuper - SMT Solving and Solver-Aided Systems link - link