Copyright © 2018 by Pete Manolios 
CS 4820 Fall 2018

Homework 1.
Due: 9/12 (Midnight)

Instructions:

Perform the steps below.

When done, send me an email (follow the submission instructions
above). In the email state that you were able to successfully complete
all the steps (nothing else is required). If you complete all steps
you get 100. Please do this ASAP in case you run into problems.

Use piazza if you have questions.

1. Install ACL2s.

2. Install SBCL or Clozure Common Lisp (links can be found on the
   syllabus).

3. Install and familiarize yourself with emacs. A good place to start is
   https://www.gnu.org/software/emacs/tour/. Make sure to read about
   shell buffers and create and use a shell in emacs.

   Make sure you create a .emacs file in your home directory. Here is
   an example of what you might put in this file:

   (load "$HOME/.emacs-acl2.el")
   (put 'match 'lisp-indent-function 'defun)
   (setq line-number-mode t)
   (setq column-number-mode t)
   (setq visible-bell t)
   (setq fill-column 70)
   (setq default-major-mode 'text-mode)
   (setq text-mode-hook
         '(lambda () (auto-fill-mode 1)))
   (add-hook 'text-mode 'turn-on-auto-fill)
   (show-paren-mode 1)
   (put 'upcase-region 'disabled nil)
   (put 'downcase-region 'disabled nil)


4. You can use the acl2 emacs bindings from here
   https://github.com/acl2/acl2/blob/master/emacs/emacs-acl2.el

   Add this to your .emacs file (included in the example .emacs file shown above)
   
   (load "$HOME/.emacs-acl2.el")

5. Create an acl2s image.

   Here's how.

   Let acl2s-dir be the directory that contains the run_acl2 script
   (or the saved_acl2.bat script in Windows). In my case that
   directory is:
   /Applications/acl2s.app/Contents/Eclipse/plugins/acl2_image.macosx.x86_64_8.0.0/

   Start up emacs and start a shell. In the shell, go to the directory
   where you want your acl2s executable to reside. (I have a ~/bin
   directory where I put my acl2s executable and this directory is in
   my path so that I can easily start acl2s.) In that directory,
   execute the following commands, where you replace *acl2s-dir* with
   the appropriate directory. Once you start acl2, you can use emacs
   to submit the forms, one after another to acl2 running in the shell
   buffer, using the bindings in emacs-acl2.el. Do that.
   
   *acl2s-dir*/run_acl2 (or *acl2s-dir*/saved_acl2.bat on Windows)
   (add-include-book-dir :acl2s-modes "*acl2s-dir*/books/acl2s/")
   (ld "acl2s-mode.lsp" :dir :acl2s-modes)
   (acl2s-defaults :set verbosity-level 1)
   (set-inhibit-warnings! "Invariant-risk" "theory")
   (reset-prehistory t)
   (in-package "ACL2S")
   :q
   (defun print-ttag-note (val active-book-name include-bookp deferred-p state)
     (declare (xargs :stobjs state)
              (ignore val active-book-name include-bookp deferred-p))
     state)
   (defun print-deferred-ttag-notes-summary (state)
     state)
   (save-exec "acl2s" "ACL2s Mode")

   You can now run acl2s in a terminal and in an emacs shell buffer.
   Feel free to look at the contents of the files in the
   acl2s-dir/books/acl2s directory.

6. Run the ACL2s code from lecture 1 on both the eclipse version of
   ACL2s and the emacs version and make sure there are no problems.
   Make sure to use the key bindings (not cut and paste!) when in
   emacs. You can get the code from the syllabus (go to the bottom of
   the page where the schedule is).