(This year, I'm trying a new SMT solver -- CVC4. This is a pretty good solver, and it's completely open-source. However, if you do a project using an SMT solver, you might also consider trying Z3 , which is generally considered the fastest, best SMT solver. The full version is free for non-commercial use, but runs only under Windows, and there isn't enough Windows compute power generally available as a departmental resource. You can always go to the SMT Competition website to see lists of solvers, the logics they support, and how they did in competition.)
Please email me your sorting program (in any convenient procedural language, or pseudo-code), your program for generating the CVC4 scripts (preferably in C, C++, Perl, etc. -- basically, anything that will run easily under Linux), your generated CVC4 scripts, and a brief description of what you thought of the assignment. (BTW, please send this to me as plain ASCII text. Not as a PDF, not as a Word file, etc. And please don't email me the binaries.)
OK, so what is the assignment? The goal of this assignment is to give you an understanding of how to write a symbolic execution engine to verify software with an SMT solver, but to save you (and me) the pain of writing a symbolic execution engine. Instead, you will:
The SMT solver we'll use for this assignment is called CVC4 . This is a completely free, open-source SMT solver, written by some of the very well-established people in the SMT community. CVC4 traces its history back to the solvers that launched the recent interest and success of SMT solvers, but for a long time, the earlier solvers (CVC, CVC-Lite, CVC3) had a reputation for being flexible, but slow. CVC4 seems to be much faster than CVC3, so hopefully, you'll have a good experience this year.
You can download
pre-built binaries (for Linux and Windows, too), from the
CVC4 downloads page.
You can also download source and build your own copy, if you'd like.
I have a 64-bit Linux version on the departmental machines
This will only run on departmental Linux machines. See
for a list of servers available to you.
(Or use your own machines, or from your research labs...)
There's pretty good
on-line documentation at the CVC4 homepage.
In particular, the
is a must-read, as well as the
description of CVC4's input language
Before you start the assignment itself, you'll probably want to
play with the solver a bit.
You'll want to use the
-im options to put the solver
in incremental mode as well as allow it to generate counter-examples
(By the way, for those of you new to Unix/Linux, ask or read up about symbolic links. You'll probably want to create a link to the CVC4 solver, so you don't have to keep typing the full pathname.) You can do things like ask whether 1 plus 1 equals 2:
QUERY (1 + 1 = 2);
a, b, c: INT;
ASSERT (a < b);
ASSERT (b < c);
QUERY (a < c);
QUERY (c <= a);
example in pseudo-C that sorts three integers.
(You may want to use an array for more data entries, instead
of separately named variables as I did here.)
here's an example of a CVC4 script
that would be
appropriate for that example.
(Note that CVC4 wants input files to have the extension
.cvc if the input language is the CVC native language.)
You'll probably want to play with this example a bit, to get
used to the syntax, and CVC4, before you start writing your
That's it! I hope this is fun!
By the way, I have always intended to make this assignment just like Assignment 2, where you (or actually, I) would write a symbolic execution engine for a simple programming language, and this would generate queries to the SMT solver. Then, I would give you a sorting program written in that simple programming language, and you'd use the symbolic execution engine to generate SMT queries, and solve them with the SMT solver. However, this would require me to make up a simple programming language and write up a parser and interpreter for it, and I keep running out of time. Fortunately, each time I have used this assignment, student feedback has actually been quite positive. Furthermore, using scripts to generate inputs to other programs is actually a common and useful way to tackle problems, so it's fun to give that a go, too. I'll appreciate your feedback on whether you think I should make the time to do the assignment more like Assignment 2 in future years.