File: crewrite-start.lisp

package info (click to toggle)
acl2 8.5dfsg-5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 991,452 kB
  • sloc: lisp: 15,567,759; javascript: 22,820; cpp: 13,929; ansic: 12,092; perl: 7,150; java: 4,405; xml: 3,884; makefile: 3,507; sh: 3,187; ruby: 2,633; ml: 763; python: 746; yacc: 723; awk: 295; csh: 186; php: 171; lex: 154; tcl: 49; asm: 23; haskell: 17
file content (306 lines) | stat: -rw-r--r-- 10,750 bytes parent folder | download | duplicates (8)
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
; Milawa - A Reflective Theorem Prover
; Copyright (C) 2005-2009 Kookamara LLC
;
; Contact:
;
;   Kookamara LLC
;   11410 Windermere Meadows
;   Austin, TX 78759, USA
;   http://www.kookamara.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@kookamara.com>

(in-package "MILAWA")
(%interactive)

(%rwn 1000)
(%urwn 1000)

(local (%max-proof-size 0))

(%autoadmit four-nats-measure)

(%autoprove ordp-of-four-nats-measure
            (%enable default four-nats-measure)
            (%restrict default ordp
                       (memberp x '((CONS (CONS '3 (+ '1 A))
                                          (CONS (CONS '2 (+ '1 B))
                                                (CONS (CONS '1 (+ '1 C)) (NFIX D))))
                                    (CONS (CONS '2 (+ '1 B))
                                          (CONS (CONS '1 (+ '1 C)) (NFIX D)))
                                    (CONS (CONS '1 (+ '1 C)) (NFIX D))))))

(%autoprove ord<-of-four-nats-measure
            (%enable default four-nats-measure)
            (%restrict default ord<
                       (memberp x '((CONS (CONS '3 (+ '1 A1))
                                          (CONS (CONS '2 (+ '1 B1))
                                                (CONS (CONS '1 (+ '1 C1)) (NFIX D1))))
                                    (CONS (CONS '2 (+ '1 B1))
                                          (CONS (CONS '1 (+ '1 C1)) (NFIX D1)))
                                    (CONS (CONS '1 (+ '1 C1)) (NFIX D1))))))


(defsection rw.cresult
  (%autoadmit rw.cresult)
  (%autoadmit rw.cresult->data)
  (%autoadmit rw.cresult->cache)
  (%autoadmit rw.cresult->alimitedp)

  (local (%enable default
                  rw.cresult
                  rw.cresult->data
                  rw.cresult->cache
                  rw.cresult->alimitedp))

  (%autoprove rw.cresult-under-iff)
  (%autoprove rw.cresult->data-of-rw.cresult)
  (%autoprove rw.cresult->cache-of-rw.cresult)
  (%autoprove rw.cresult->alimitedp-of-rw.cresult))


(defsection rw.hypresult
  (%autoadmit rw.hypresult)
  (%autoadmit rw.hypresult->successp)
  (%autoadmit rw.hypresult->traces)
  (%autoadmit rw.hypresult->cache)
  (%autoadmit rw.hypresult->alimitedp)

  (local (%enable default
                  rw.hypresult
                  rw.hypresult->successp
                  rw.hypresult->traces
                  rw.hypresult->cache
                  rw.hypresult->alimitedp))

  (%autoprove rw.hypresult-under-iff)
  (%autoprove rw.hypresult->successp-of-rw.hypresult)
  (%autoprove rw.hypresult->traces-of-rw.hypresult)
  (%autoprove rw.hypresult->cache-of-rw.hypresult)
  (%autoprove rw.hypresult->alimitedp-of-rw.hypresult))



(%autoadmit rw.flag-crewrite)



(defsection elimination-of-irrelevant-arguments

  (local (%forcingp nil))
  (local (%betamode nil))

  (%autoprove rw.flag-crewrite-of-term-reduction
              (%restrict default rw.flag-crewrite (and (equal flag ''term) (equal x 'x))))

  (%autoprove rw.flag-crewrite-of-list-reduction
              (%restrict default rw.flag-crewrite (and (equal flag ''list) (equal x 'x))))

  (%autoprove rw.flag-crewrite-of-rule-reduction
              (%restrict default rw.flag-crewrite (and (equal flag ''rule) (equal x 'x))))

  (%autoprove rw.flag-crewrite-of-rules-reduction
              (%restrict default rw.flag-crewrite (and (equal flag ''rules) (equal x 'x))))

  (%autoprove rw.flag-crewrite-of-hyp-reduction
              (%restrict default rw.flag-crewrite (and (equal flag ''hyp) (equal x 'x))))

  (%autoprove rw.flag-crewrite-of-hyps-reduction
              (%restrict default rw.flag-crewrite (and (equal flag ''hyps) (equal x 'x)))))



(defsection flag-function-wrappers

  (%autoadmit rw.crewrite-core)
  (%autoadmit rw.crewrite-core-list)
  (%autoadmit rw.crewrite-try-rule)
  (%autoadmit rw.crewrite-try-rules)
  (%autoadmit rw.crewrite-try-match)
  (%autoadmit rw.crewrite-try-matches)
  (%autoadmit rw.crewrite-relieve-hyp)
  (%autoadmit rw.crewrite-relieve-hyps)

  (local (%forcingp nil))
  (local (%enable default
                  rw.crewrite-core
                  rw.crewrite-core-list
                  rw.crewrite-try-rule
                  rw.crewrite-try-rules
                  rw.crewrite-try-match
                  rw.crewrite-try-matches
                  rw.crewrite-relieve-hyp
                  rw.crewrite-relieve-hyps))

  (%autoprove rw.flag-crewrite-of-term
              (%use (%thm rw.flag-crewrite-of-term-reduction)))

  (%autoprove rw.flag-crewrite-of-list
              (%use (%thm rw.flag-crewrite-of-list-reduction)))

  (%autoprove rw.flag-crewrite-of-rule
              (%use (%thm rw.flag-crewrite-of-rule-reduction)))

  (%autoprove rw.flag-crewrite-of-rules
              (%use (%thm rw.flag-crewrite-of-rules-reduction)))

  (%autoprove rw.flag-crewrite-of-match)
  (%autoprove rw.flag-crewrite-of-matches)

  (%autoprove rw.flag-crewrite-of-hyp
              (%use (%thm rw.flag-crewrite-of-hyp-reduction)))

  (%autoprove rw.flag-crewrite-of-hyps
              (%use (%thm rw.flag-crewrite-of-hyps-reduction))))




(%autoprove equal-with-quoted-list-of-nil)

(defsection proper-definitions-for-flag-wrappers
  (local (%forcingp nil))
  (local (%rwn 2000))
  (local (%disable default
                   formula-decomposition
                   expensive-term/formula-inference
                   expensive-arithmetic-rules
                   expensive-arithmetic-rules-two
                   type-set-like-rules
                   unusual-consp-rules
                   unusual-memberp-rules
                   unusual-subsetp-rules
                   same-length-prefixes-equal-cheap
                   ;; ---
                   lookup-when-not-consp
                   rw.trace-list-rhses-when-not-consp
                   forcing-logic.function-of-logic.function-name-and-logic.function-args-free))

  (%autoprove definition-of-rw.crewrite-core
              (%use (%instance (%thm rw.flag-crewrite) (flag 'term)))
              (%betamode nil)
              (%auto)
              (%betamode once))

  (%autoprove definition-of-rw.crewrite-core-list
              (%use (%instance (%thm rw.flag-crewrite) (flag 'list)))
              (%betamode nil)
              (%auto)
              (%betamode once))

  (%autoprove definition-of-rw.crewrite-try-rule
              (%use (%instance (%thm rw.flag-crewrite) (flag 'rule)))
              (%betamode nil)
              (%auto)
              (%betamode once))

  (%autoprove definition-of-rw.crewrite-try-rules
              (%use (%instance (%thm rw.flag-crewrite) (flag 'rules)))
              (%betamode nil)
              (%auto)
              (%betamode once))

  (%autoprove definition-of-rw.crewrite-try-match
              (%use (%instance (%thm rw.flag-crewrite) (flag 'match)))
              (%betamode nil)
              (%auto)
              (%betamode once))

  (%autoprove definition-of-rw.crewrite-try-matches
              (%use (%instance (%thm rw.flag-crewrite) (flag 'matches)))
              (%betamode nil)
              (%auto)
              (%betamode once))

  (%autoprove definition-of-rw.crewrite-relieve-hyp
              (%use (%instance (%thm rw.flag-crewrite) (flag 'hyp)))
              (%betamode nil)
              (%auto)
              (%betamode once))

  (%autoprove definition-of-rw.crewrite-relieve-hyps
              (%use (%instance (%thm rw.flag-crewrite) (flag 'hyps)))
              (%betamode nil)
              (%auto)
              (%betamode once)))





(%autoprove rw.crewrite-core-list-when-not-consp
            (%restrict default definition-of-rw.crewrite-core-list (equal x 'x)))

(%autoprove rw.crewrite-core-list-of-cons
            (%restrict default definition-of-rw.crewrite-core-list (equal x '(cons a x))))

(%autoprove true-listp-of-rw.cresult->data-of-rw.crewrite-core-list
            (%induct (rank x)
                     ((not (consp x))
                      nil)
                     ((consp x)
                      (((x     (cdr x))
                        (cache (rw.cresult->cache
                                (rw.crewrite-core assms (car x) cache iffp blimit rlimit anstack control))))))))

(%autoprove len-of-rw.cresult->data-of-rw.crewrite-core-list$
            (%induct (rank x)
                     ((not (consp x))
                      nil)
                     ((consp x)
                      (((x     (cdr x))
                        (cache (rw.cresult->cache
                                (rw.crewrite-core assms (car x) cache iffp blimit rlimit anstack control))))))))




(%autoprove rw.crewrite-try-rules-when-not-consp
            (%restrict default definition-of-rw.crewrite-try-rules (equal rule[s] 'rule[s])))

(%autoprove rw.crewrite-try-rules-of-cons
            (%restrict default definition-of-rw.crewrite-try-rules (equal rule[s] '(cons rule rules))))



(%autoprove rw.crewrite-try-matches-when-not-consp
            (%restrict default definition-of-rw.crewrite-try-matches (equal sigma[s] 'sigma[s])))

(%autoprove rw.crewrite-try-matches-of-cons
            (%restrict default definition-of-rw.crewrite-try-matches (equal sigma[s] '(cons sigma sigmas))))



(%autoprove rw.crewrite-relieve-hyps-when-not-consp
            (%restrict default definition-of-rw.crewrite-relieve-hyps (equal x 'x)))

(%autoprove rw.crewrite-relieve-hyps-of-cons
            (%restrict default definition-of-rw.crewrite-relieve-hyps (equal x '(cons a x))))

(%autoprove booleanp-of-rw.hypresult->successp-of-rw.crewrite-relieve-hyps
            (%use (%thm definition-of-rw.crewrite-relieve-hyps)))



(%autoprove zp-of-one-plus)