1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
; ACL2 Customization File for The Standard Approach to Using ACL2
; Copyright (C) 2009-2013 Centaur Technology
;
; Contact:
; Centaur Technology Formal Verification Group
; 7600-C N. Capital of Texas Highway, Suite 300, Austin, TX 78731, USA.
; http://www.centtech.com/
;
; License: (An MIT/X11-style license)
;
; Permission is hereby granted, free of charge, to any person obtaining a
; copy of this software and associated documentation files (the "Software"),
; to deal in the Software without restriction, including without limitation
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
; and/or sell copies of the Software, and to permit persons to whom the
; Software is furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
; DEALINGS IN THE SOFTWARE.
;
; Original author: Jared Davis <jared@centtech.com>
; Contributing author: David Rager <ragerdl@defthm.com>
; The easiest way to use this file is to just add an acl2-customization.lsp
; file to your home directory that says:
;
; (ld "std/std-customization.lsp" :dir :system)
;
; You can, of course, put whatever additional customization you want in your
; own customization file, then.
; There's no in-package here, because it could screw up packages loaded by
; custom acl2-customization.lsp files. Instead we use the #!ACL2 syntax to try
; to make sure this file can be read from any package.
; This file is mentioned in books/doc/practices.lisp.
#!ACL2
(set-deferred-ttag-notes t state)
#!ACL2
(set-inhibit-output-lst '(proof-tree))
#!ACL2
(with-output
:off (summary event)
(progn
(defmacro d (name)
;; A handy macro that lets you write :d fn to disassemble a function. I
;; mostly have this because my fingers always type ":diassemble$" instead of
;; ":disassemble$"
(cond ((symbolp name)
`(disassemble$ ',name :recompile nil))
((and (quotep name)
(symbolp (unquote name)))
`(disassemble$ ',(unquote name) :recompile nil))
((and (quotep name)
(quotep (unquote name))
(symbolp (unquote (unquote name))))
`(disassemble$ ',(unquote (unquote name)) :recompile nil))
(t
(er hard? 'd "Not a symbol or quoted symbol: ~x0~%" name))))
(defmacro why (rule)
;; A handy macro that lets you figure out why a rule isn't firing.
;; This is useful to me because I can never remember the :monitor
;; syntax.
`(er-progn
(brr t)
(monitor '(:rewrite ,rule) ''(:eval :go t))))
(defun explain-fn (state)
(declare (xargs :stobjs (state)
:mode :program))
(mv-let (clause ttree)
(clausify-type-alist (get-brr-local 'type-alist state)
(list (cddr (get-brr-local 'failure-reason state)))
(ens state) (w state) nil nil)
(declare (ignore ttree))
(prettyify-clause clause
nil
(w state))))
(defmacro explain ()
`(prog2$ (cw "Printing target with hyps derived from type-alist~%")
(explain-fn state)))
(defmacro why-explain (rule)
`(er-progn
(brr t)
(monitor '(:rewrite ,rule) ''(:eval
:ok-if (brr@ :wonp)
(explain)))))
(defmacro with-redef (&rest forms)
;; A handy macro you can use to temporarily enable redefinition, but then
;; keep it disabled for the rest of the session
`(progn
(defttag with-redef)
(progn!
(set-ld-redefinition-action '(:doit . :overwrite) state)
(progn . ,forms)
(set-ld-redefinition-action nil state))))))
; XDOC SUPPORT
;
; - Always load the xdoc package, which is pretty fast.
;
; - Unless :SUPPRESS-PRELOAD-XDOC has been assigned, also get the xdoc
; database preloaded so that :XDOC commands are very fast and never
; leave any nonsense in your history.
;
; The second part is somewhat slow and makes ACL2 take noticeably longer to
; boot up. However, for me, on the par, it seems worth it to make :xdoc much
; more useful.
;
; The suppress-preload-xdoc mechanism can be used to make sure that xdoc does
; NOT get preloaded. Why would you want to do this?
;
; Well, a few libraries (e.g., str) have some files (package definitions,
; str::cat, etc.) that are included in the xdoc implementation code that gets
; loaded by (xdoc::colon-xdoc-init). When you're hacking on these libraries,
; it's very easy to, e.g., change something that causes xdoc to be completely
; unloadable until you recertify everything.
;
; At any rate, if for this (or some other reason) you don't want to
; automatically do this xdoc initialization, you can just add:
;
; (assign :suppress-preload-xdoc t)
;
; Before loading std-customization.lsp.
#!ACL2
(with-output
:off (summary event)
(ld "std/package.lsp" :dir :system))
#!ACL2
(make-event
(if (not (boundp-global :suppress-preload-xdoc state))
`(progn
(include-book "xdoc/top" :dir :system)
(include-book "xdoc/debug" :dir :system)
(xdoc::colon-xdoc-init))
`(value-triple nil)))
; maybe actually report correct times
(assign get-internal-time-as-realtime t)
|