This directory contains solutions to all of the exercises in

 Computer-Aided Reasoning:  An Approach, by Kaufmann, Manolios, and Moore,
 Kluwer Academic Publishers, June, 2000.

Structure of This Directory

This directory has seven subdirectories, named chap3, chap4, chap5,
chap6, chap7, chap10, and chap11.  Except for chap10, each
subdirectory corresponds to a chapter in the book that contains
exercises; those subdirectories contain our solutions to the
corresponding exercises.  Chapter 10 of the book contains no exercises
for the reader but presents solved exercises and descriptions of our
solutions.  The corresponding subdirectory here contains the ACL2
scripts for our solutions.

The following files (or extensions) may be present on this directory
or its subdirectories, depending on the subdirectory, the host Common
Lisp, and whether the ACL2 books among our solutions have been
certified.

README     - guide to contents of the directory
index.html - html guide to location of solutions (this directory only)
Makefile   - Unix file for recertifying the ACL2 books on the directory
             (present on all but chap7, which contains no books)

*.lisp     - certifiable ACL2 book containing solutions to exercises
*.txt      - solutions to exercises not amenable to ACL2 formulation
*.acl2     - driver used by Makefile to recertify some *.lisp files

*.cert     - certificate indicating that *.lisp has been certified
*.date     - date of beginning of recertification run
*.log      - output of make
*.out      - output produced by ACL2 during certification
*.o        - compiled version of *.lisp file in some Common Lisps
*.fasl     - compiled version of *.lisp file in some Common Lisps

Any file with the extension ``.lisp'' is a certifiable book that can
be included into your ACL2 session with include-book.

To recertify all the books, stand in this directory and type make.  To
recertify the books in a particular chapter, stand in the appropriate
subdirectory and type make.

Location of Solutions to Particular Exercises

For an HTML presentation of the following information, see index.html
on this directory.  Some explanatory notes follow.  

   1 Introduction (no exercises)

   I Preliminaries
   2 Overview (no exercises)

  II Programming
   3 The Language
     Exercises 3.1 - 3.9: chap3/solutions.txt
     Exercises 3.10 - 3.23: chap3/programs.lisp
   4 Programming Exercises
     Exercises 4.1 - 4.21 in :program mode (see note 4):
       chap4/solutions-program-mode.lisp
     Exercises 4.1 - 4.21 in :logic mode (see note 4):
       chap4/solutions-logic-mode.lisp
   5 Macros
     Exercises 5.1 - 5.7: chap5/solutions.lisp

 III Reasoning
   6 The Logic
     Exercises 6.1 - 6.25 with pencil and paper (see note 6):
       chap6/solutions.txt
     Exercises 6.3, 6.4, 6.6 - 6.8, 6.11 - 6.16 with ACL2 (see note 6):
       chap6/selected-solutions.lisp
   7 Proof Examples
     Exercises 7.1 - 7.9: chap7/solutions.txt

  IV Gaming
   8 The Mechanical Theorem Prover (no exercises)
   9 How to Use the Theorem Prover (no exercises)
  10 Theorem Prover Examples 
     10.1 Factorial: chap10/fact.lisp
     10.2 Associative and Commutative Functions: chap10/ac-example.lisp
     10.3 Insertion Sort: chap10/insertion-sort.lisp
     10.4 Tree Manipulation: chap10/tree.lisp
     10.5 Binary Adder and Multiplier: chap10/adder.lisp
     10.6 Compiler for Stack Machine: chap10/compiler.lisp and
          chap10/compiler.acl2 for the relevant package definition.
  11 Theorem Prover Exercises 
     Exercises 11.1-11.4: chap11/starters.lisp
     Exercise 11.5: chap11/perm.lisp
     Exercises 11.6 - 11.7: chap11/perm-append.lisp
     Exercises 11.8 - 11.14: chap11/qsort.lisp
     Exercises 11.15 - 11.16: chap11/mergesort.lisp
     Exercises 11.17 - 11.25: chap11/compress.lisp
     Exercises 11.26 - 11.33: chap11/summations.lisp
     Exercises 11.26 - 11.33, using an arithmetic book:
       chap11/summations-book.lisp
     Exercises 11.34 - 11.41: chap11/tautology.lisp
     Exercises 11.42 - 11.46: chap11/encap.lisp
     Exercises 11.47 - 11.51 via approach 1: chap11/how-many-soln1.lisp
     Exercises 11.47 - 11.51 via approach 2: chap11/how-many-soln2.lisp
     Exercise  11.52 via approach 1: chap11/xtr.lisp
     Exercise  11.52 via approach 2: chap11/xtr2.lisp
     Exercises 11.53 - 11.57: chap11/finite-sets.lisp

---------------------------------------------------------------------------
NOTES

Note 4

At the beginning of Chapter 4, Programming Exercises, we say that all
of these exercises may be done in program mode.  We also suggest that
once you have learned to use the ACL2 theorem prover, you do these
exercises again, this time operating in logic mode and adding and
verifying guards.

We therefore have two solution files.  In the first, we use
:program mode whenever ACL2 cannot automatically admit our
definitions.  In the second, we use :logic mode (where possible), we
include guards with our definitions, and we verify the guards.

---------------------------------------------------------------------------

Note 6

Many of the exercises in Chapter 6 require you to present formal
proofs in terms of the primitive rules of inference or require set
theoretic or other metatheoretic arguments.  Such exercises do not
readily admit solutions expressed as ACL2 commands.

However, a few of the exercises do admit solution with ACL2, even
though you -- the reader -- are not actually expected to do them this
way.  Indeed, upon your first reading of Chapter 6, you will probably
not be able to use the theorem prover well enough to do these proofs.
But you might eventually return to these exercises with the theorem
prover behind you and appreciate these solutions.

---------------------------------------------------------------------------

Note 10

Chapter 10 contains no exercises for the reader.  It presents
exercises and describes our solutions.  We provide the scripts for
those solutions here.

---------------------------------------------------------------------------

Note 11

We provide more than one solution for some exercises.  This is just a
matter of taste.  Different authors prefer different styles.
Sometimes, one solution is less elegant than another but more clearly
indicates how the solution was discovered.

---------------------------------------------------------------------------
