/usr/share/acl2-8.0dfsg/books/acl2s/custom.lisp is in acl2-books-source 8.0dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | #|$ACL2s-Preamble$;
(include-book ;; Newline to fool ACL2/cert.pl dependency scanner
"portcullis")
(begin-book t :ttags :all);$ACL2s-Preamble$|#
(in-package "ACL2S")
;; (defun allp (x)
;; (declare (ignore x)
;; (xargs :guard t))
;; t)
(program)
;***** CHECK and CHECK= macros for Peter Dillinger & Pete Manolios & Northeastern CSU290 *****
(defmacro check (form)
`(with-output
:stack :push
:off :all
(make-event
(with-output
:stack :pop
; (state-global-let*
; ((guard-checking-on :none))
(er-let*
((eval-result (acl2::trans-eval
'(if ,form
(value nil)
(er soft 'check "Check failed (returned NIL)."))
'check
state t)))
(if (second eval-result)
(mv t nil state)
(value '(value-triple :passed)))))
:check-expansion t)))
(defmacro check= (form1 form2)
`(with-output
:stack :push
:off :all
(make-event
(with-output
:stack :pop
;(state-global-let*
;((guard-checking-on :none))
(er-let*
((eval-result1 (acl2::trans-eval ',form1 'check= state t))
(eval-result2 (acl2::trans-eval ',form2 'check= state t)))
(cond ((not (equal (car eval-result1)
(car eval-result2)))
(er soft 'check=
"Forms return different number or stobj types of ~
results; thus, they should not be considered equal."))
((not (equal (cdr eval-result1)
(cdr eval-result2)))
(er soft 'check=
"Check failed (values not equal).~%First value: ~x0~%~
Second value: ~x1" (cdr eval-result1) (cdr eval-result2)))
(t
(value '(value-triple :passed))))))
:check-expansion t)))
;***** DEFUNT macro for Pete Manolios & Northeastern CSU290 *****
(defun defunt-make-sym (s suf)
; Returns the symbol s-suf.
(declare (xargs :guard (and (symbolp s) (symbolp suf))))
(intern-in-package-of-symbol
(concatenate 'string
(symbol-name s)
"-"
(symbol-name suf))
s))
(defun defunt-make-code-list (l)
(if (or (null l)
(and (consp l)
(consp (car l))
(not (eq 'lambda (caar l)))))
l
(list l)))
(defun defunt-declarations-prefix (args)
(if (or (atom args)
(atom (car args))
(not (eq 'declare (caar args))))
nil
(cons (car args)
(defunt-declarations-prefix (cdr args)))))
(defun defunt-after-declarations (args)
(if (or (atom args)
(atom (car args))
(not (eq 'declare (caar args))))
args
(defunt-after-declarations (cdr args))))
(defmacro defunt (&rest def)
; A function definition that has a declare followed by a list of the
; form ((thm) commands), where commands can be anything that you would
; give to a defthm (look at defthm documentation), specifically it is:
; :rule-classes rule-classes
; :instructions instructions
; :hints hints
; :otf-flg otf-flg
; :doc doc-string
(let* ((name-lst (and (consp def)
(symbolp (car def))
(list (car def))))
(ll-lst (and (consp (cdr def))
(symbol-listp (cadr def))
(list (cadr def))))
(rst1 (cddr def))
(doc-lst (and (stringp (car rst1)) (list (car rst1))))
(rst2 (if (stringp (car rst1)) (cdr rst1) rst1))
(body-lst (last rst2))
(rst3 (butlast rst2 1))
(decls-before-type-thm (defunt-declarations-prefix rst3))
(thm-stuff (defunt-make-code-list (car rst3)))
(rst4 (cdr rst3))
(decls (defunt-declarations-prefix rst4))
(kruft (defunt-after-declarations rst4)))
(if (and name-lst
ll-lst
body-lst
thm-stuff
(not decls-before-type-thm)
(not kruft))
(if (consp (car thm-stuff))
`(progn
(defun ,@name-lst ,@ll-lst
,@doc-lst
,@decls
. ,body-lst)
(defthm ,(defunt-make-sym (car name-lst) 'type)
. ,thm-stuff))
`(er soft 'defunt
"The type theorem specified to DEFUNT, ~x0, is silly. You should ~
specify a more interesting type theorem or just use DEFUN."
',(car thm-stuff)))
`(er soft 'defunt
"Malformed call to DEFUNT. Most uses of DEFUNT will take the form~%~%~
(defunt <name> <params>~% <type-theorem>~% <function body>)~%~%~
where <type-theorem> is either a theorem term or (<theorem-term> <defthm-keyword-args...>) ~
where <defthm-keyword-args> are keyword arguments to defthm, such as :rule-classes or :hints.~%~%~
More generally, it may take the form:~%~%~
(defunt <name> <params>~% <optional-doc-string>~% <type-theorem>~% <optional-declarations...>~% <function body>)~%"))))
(defmacro acl2-user::defunt (&rest def)
`(defunt . ,def))
(logic)
;;; When things have stabilized under simplification, enable non-linear
;;; arithmetic for one round (goal being simplified) only.
#!ACL2
(defun my-nonlinearp-default-hint (stable-under-simplificationp hist pspv)
;; (declare (xargs :guard (and (consp pspv)
;; (consp (car pspv))
;; (consp (caar pspv))
;; (consp (cdaar pspv))
;; (consp (cddaar pspv))
;; (consp (cdr (cddaar pspv)))
;; (consp (cddr (cddaar pspv)))
;; (consp (cdddr (cddaar pspv)))
;; (consp (cddddr (cddaar pspv))))))
(cond (stable-under-simplificationp
(if (not (access rewrite-constant
(access prove-spec-var pspv :rewrite-constant)
:nonlinearp))
(prog2$
nil ;;harshrc 14Jan2012- The following gives a nasty error when run inside of ld
;; (observation-cw 'my-nonlinearp-default-hint
;; "~%~%[Note: We now enable non-linear arithmetic.]~%~%")
'(:computed-hint-replacement t
:nonlinearp t))
nil))
((access rewrite-constant
(access prove-spec-var pspv :rewrite-constant)
:nonlinearp)
(if (and (consp hist)
(consp (car hist))
;; Without this, we would loop forever. But
;; whenever I try to write an explanation, I get
;; confused about why it works. I stumbled across
;; this by trial and error and observing the output
;; of tracing. Some day I should figure out what I
;; am doing.
(not (equal (caar hist) 'SETTLED-DOWN-CLAUSE)))
(prog2$
nil ;;The following gives a nasty error when run inside of ld
;; (observation-cw 'my-nonlinearp-default-hint
;; "~%~%[Note: We now disable non-linear arithmetic.]~%~%")
'(:computed-hint-replacement t
:nonlinearp nil))
nil))
(t
nil)))#|ACL2s-ToDo-Line|#
; Common books to all modes.
(include-book "cgen/top" :ttags :all)
(include-book "defunc" :ttags :all)
#!ACL2
(defmacro acl2s-common-settings ()
`(progn
(make-event
(er-progn
(assign checkpoint-processors
(set-difference-eq (@ checkpoint-processors)
'(ELIMINATE-DESTRUCTORS-CLAUSE)))
;;CCG settings
(set-ccg-print-proofs nil)
(set-ccg-inhibit-output-lst
'(QUERY BASICS PERFORMANCE BUILD/REFINE SIZE-CHANGE))
;;Misc
(set-guard-checking :nowarn)
(value '(value-triple :invisible))))
(set-default-hints '((my-nonlinearp-default-hint stable-under-simplificationp hist pspv)))
;; Other events:
(set-well-founded-relation l<)
(make-event ; use ruler-extenders if available
(if (member-eq 'ruler-extenders-lst
(getprop 'put-induction-info 'formals nil
'current-acl2-world (w state)))
(value '(set-ruler-extenders :all))
(value '(value-triple :invisible))))
;;CCG events
(set-termination-method :ccg)
(set-ccg-time-limit nil)
(dont-print-thanks-message-override-hint)
;;Cgen settings
(acl2s::acl2s-defaults :set acl2s::testing-enabled t)
(acl2s::acl2s-defaults :set acl2s::num-trials 500)
))
#!ACL2
(defmacro acl2s-beginner-settings ()
`(er-progn
; Non-events:
(acl2::set-guard-checking :all)
(set-backchain-limit '(50 100))
(set-rewrite-stack-limit 500)
(acl2s-defaults :set cgen-timeout 20)
(table acl2s::defunc-defaults-table :skip-tests nil :put)
(table acl2s::defunc-defaults-table :timeout 60 :put)
(set-irrelevant-formals-ok :warn)
(set-bogus-mutual-recursion-ok :warn)
(set-ignore-ok :warn)
(assign evalable-ld-printingp t)
(assign evalable-printing-abstractions '(list cons))
(assign triple-print-prefix "; ")
))
#!ACL2
(defmacro acl2s-bare-bones-settings ()
`(er-progn
(set-irrelevant-formals-ok :warn)
(set-bogus-mutual-recursion-ok :warn)
(set-ignore-ok :warn)
(set-backchain-limit '(50 100))
(set-rewrite-stack-limit 500)
(table acl2s::defunc-defaults-table :skip-tests nil :put)
(table acl2s::defunc-defaults-table :timeout 60 :put)
(assign evalable-ld-printingp t)
(assign evalable-printing-abstractions '(list cons))
(assign triple-print-prefix "; ")
; Non-events:
(acl2::set-guard-checking :all)
))
#!ACL2
(defmacro acl2s-theorem-proving-beginner-settings ()
`(er-progn
(set-backchain-limit '(50 100))
(set-rewrite-stack-limit 500)
(set-irrelevant-formals-ok :warn)
(set-bogus-mutual-recursion-ok :warn)
(set-ignore-ok :warn)
(set-guard-checking :all)
(table acl2s::defunc-defaults-table :skip-tests nil :put)
(table acl2s::defunc-defaults-table :timeout 60 :put)
;(set-verify-guards-eagerness 0)
(assign evalable-ld-printingp t)
(assign evalable-printing-abstractions '(list cons))
(assign triple-print-prefix "; ")
))
|