How to use certify simple ACL2 books, take advantage of parallel builds, and manage the dependency scanner.
Let's use
;; inc.lisp | ;; prop.lisp (in-package "ACL2") | (in-package "ACL2") (defun inc (x) | (include-book "inc") (+ 1 x)) | | (defthm natp-of-inc | (implies (natp x) | (natp (inc x)))
We can now certify either book by just running
$ cert.pl inc ACL2 executable is /home/jared/bin/acl2 System books directory is /home/jared/acl2/books/ Making /home/jared/acl2/books/tmp/inc.cert on 25-Oct-2013 21:49:11 Successfully built /home/jared/acl2/books/tmp/inc.cert -rw-rw-r-- 1 jared logic 378 Oct 25 21:49 inc.cert
If we run
We might now run
$ cert.pl prop ACL2 executable is /home/jared/bin/acl2 System books directory is /home/jared/acl2/books/ Making /home/jared/acl2/books/tmp/prop.cert on 26-Oct-2013 07:55:16 Successfully built /home/jared/acl2/books/tmp/prop.cert -rw-rw-r-- 1 jared logic 465 Oct 26 07:55 prop.cert
An
$ ls inc.cert inc.lisp Makefile-tmp prop.cert.out prop.lx64fsl inc.cert.out inc.lx64fsl prop.cert prop.lisp
We can delete the generated files with clean.pl, a companion script
of
$ clean.pl clean.pl: scanning for generated files clean.pl: found 7 targets (0 seconds) clean.pl: deleted 7 files (0 seconds) $ ls inc.lisp prop.lisp
If we now tell
$ cert.pl prop ACL2 executable is /home/jared/bin/acl2 System books directory is /home/jared/acl2/books/ Making /home/jared/acl2/books/tmp/inc.cert on 26-Oct-2013 07:59:41 Successfully built /home/jared/acl2/books/tmp/inc.cert -rw-rw-r-- 1 jared logic 378 Oct 26 07:59 inc.cert Making /home/jared/acl2/books/tmp/prop.cert on 26-Oct-2013 07:59:42 Successfully built /home/jared/acl2/books/tmp/prop.cert -rw-rw-r-- 1 jared logic 465 Oct 26 07:59 prop.cert
You can tell
$ cert.pl foo bar baz
will try to certify
You don't have to include a
$ cert.pl foo $ cert.pl foo.lisp $ cert.pl foo.cert
The
$ cert.pl *.lisp
You can tell
$ cert.pl -j 2 foo # for a dual-core system $ cert.pl -j 4 foo # for a 4-core system $ cert.pl -j 8 foo # for an 8-core system
Warning: setting
# in the laptop's .bashrc: alias cj="cert.pl -j 2" # in the server's .bashrc: alias cj="cert.pl -j 16"
This way, just running
Warning: the CPU count is not the only factor to consider when
choosing a
Like
Occasionally this may not be what you want. You might have made a change that you know will break several books. One way to find out what's broken is to just try to build everything. The default behavior—stopping as soon as anything is broken—will only let you find one broken book at a time.
In this situation, you may want to instead do, e.g.,
$ cert.pl -j 4 top.cert -k
This is identical to
Sometimes you want to work on a particular book, which you know won't
certify (e.g., because you're only part-way through a proof). Before you begin
working on the book again, you may want to rebuild any supporting books it
depends on. The
$ cert.pl -p mybook
won't try to certify
Keep in mind that
(include-book ;; newline to fool dependency scanner "bar")
This is documented behavior that you may rely on.
For instance, sometimes we put multi-line comments in books with performance comparisons or other kinds of examples or testing code. This code might need additional include-books to work. By putting in newlines, we can hide these books from the dependency scanner, to avoid slowing down our build with unnecessary dependencies. For instance:
(defun my-function ...) #|| ;; this benchmark says my-function is 3x faster than yours: (include-book ;; fool dependency scanner "your-function") :q (time (loop for i fixnum from 1 to 100000 do (my-function ...))) (time (loop for i fixnum from 1 to 100000 do (your-function ...))) ||# (defthm my-lemma ...)
You can also trick
(in-package "ACL2") (include-book "module1") (include-book "module2") (include-book "module3") #|| ;; trick cert.pl into running the unit tests: (include-book "module1-tests") (include-book "module2-tests") (include-book "module3-tests") ||#