~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/coi/nary/rewrite-equal-hint.lisp

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#|-*-Lisp-*-=================================================================|#
2
 
#|                                                                           |#
3
 
#| coi: Computational Object Inference                                       |#
4
 
#|                                                                           |#
5
 
#|===========================================================================|#
 
1
; Computational Object Inference
 
2
; Copyright (C) 2005-2014 Kookamara LLC
 
3
;
 
4
; Contact:
 
5
;
 
6
;   Kookamara LLC
 
7
;   11410 Windermere Meadows
 
8
;   Austin, TX 78759, USA
 
9
;   http://www.kookamara.com/
 
10
;
 
11
; License: (An MIT/X11-style license)
 
12
;
 
13
;   Permission is hereby granted, free of charge, to any person obtaining a
 
14
;   copy of this software and associated documentation files (the "Software"),
 
15
;   to deal in the Software without restriction, including without limitation
 
16
;   the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
17
;   and/or sell copies of the Software, and to permit persons to whom the
 
18
;   Software is furnished to do so, subject to the following conditions:
 
19
;
 
20
;   The above copyright notice and this permission notice shall be included in
 
21
;   all copies or substantial portions of the Software.
 
22
;
 
23
;   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
24
;   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
25
;   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
26
;   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
27
;   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
28
;   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
29
;   DEALINGS IN THE SOFTWARE.
 
30
 
6
31
(in-package "ACL2")
7
32
 
8
33
(defthm not-hide-forward
59
84
      (let ((term (car clause)))
60
85
        (let ((term (equiv-term equivs term)))
61
86
          (if term
62
 
              (rewrite-equiv-hint once (cons `(not (hide (rewrite-equiv ,(optimize-equiv-term term)))) 
 
87
              (rewrite-equiv-hint once (cons `(not (hide (rewrite-equiv ,(optimize-equiv-term term))))
63
88
                                             cases) equivs (cdr clause))
64
89
            (rewrite-equiv-hint once cases equivs (cdr clause)))))
65
90
    (if cases
96
121
      (let ((term (car clause)))
97
122
        (let ((term (equiv-term equivs term)))
98
123
          (if term
99
 
              (rewrite-equiv-hint once (cons `(not (hide (rewrite-equiv ,(optimize-equiv-term term)))) 
 
124
              (rewrite-equiv-hint once (cons `(not (hide (rewrite-equiv ,(optimize-equiv-term term))))
100
125
                                             cases) equivs (cdr clause))
101
126
            (rewrite-equiv-hint once cases equivs (cdr clause)))))
102
127
    (if (and stable cases)
147
172
      (let ((term (car clause)))
148
173
        (let ((term (equiv-var-term equivs term)))
149
174
          (if term
150
 
              (slow-rewrite-equiv-hint once (cons `(not (hide (rewrite-equiv ,(optimize-equiv-term term)))) 
 
175
              (slow-rewrite-equiv-hint once (cons `(not (hide (rewrite-equiv ,(optimize-equiv-term term))))
151
176
                                             cases) equivs (cdr clause))
152
177
            (slow-rewrite-equiv-hint once cases equivs (cdr clause)))))
153
178
    (if cases
159
184
 
160
185
(defun slow-rewrite-equiv-hint (stbl once equivs clause)
161
186
  (declare (type t clause))
162
 
  (if stbl 
 
187
  (if stbl
163
188
      (let ((term (find-equiv equivs clause)))
164
 
        (if term 
 
189
        (if term
165
190
            (if once nil
166
191
              (let ((term `(not (hide (rewrite-equiv ,(optimize-equiv-term term))))))
167
 
                `(:computed-hint-replacement 
 
192
                `(:computed-hint-replacement
168
193
                  ((slow-rewrite-equiv-hint stable-under-simplificationp 't ',equivs clause))
169
194
                  :cases (,term))))
170
195
          (if once
171
 
              `(:computed-hint-replacement  
 
196
              `(:computed-hint-replacement
172
197
                ((slow-rewrite-equiv-hint stable-under-simplificationp 'nil ',equivs clause)) :cases (t))
173
198
            nil)))
174
199
    nil))
180
205
  `(slow-rewrite-equiv-hint stable-under-simplificationp nil '(equal) clause))
181
206
 
182
207
(local
183
 
 (encapsulate 
 
208
 (encapsulate
184
209
  ()
185
210
 
186
211
(defstub foo (x) nil)
201
226
   (fred (+ 3 (goo x))))
202
227
 
203
228
 )
204
 
 
 
229
 
205
230
;;
206
231
;; This theorem does not prove without the rewrite-with-equality hint ..
207
232
;;
234
259
  ()
235
260
 
236
261
  (defun equiv (x y) (equal x y))
237
 
  
 
262
 
238
263
  (defequiv equiv)
239
264
 
240
265
  (defcong equiv equal (fred x) 1)
267
292
    :rule-classes nil
268
293
    :hints ((slow-rewrite-with-equiv equiv)))
269
294
 
270
 
  ))
 
295
  ))
 
 
b'\\ No newline at end of file'