File: conditional-eqsubst-all.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 (388 lines) | stat: -rw-r--r-- 17,239 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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
; 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")
(include-book "conditional-eqsubst")
(%interactive)


(%autoadmit tactic.conditional-eqsubst-all-okp)
(%autoadmit tactic.conditional-eqsubst-all-env-okp)

(%autoprove booleanp-of-tactic.conditional-eqsubst-all-okp
            (%enable default tactic.conditional-eqsubst-all-okp))

(%autoprove booleanp-of-tactic.conditional-eqsubst-all-env-okp
            (%enable default tactic.conditional-eqsubst-all-env-okp))

(defthm forcing-logic.term-list-list-atblp-of-multicons
  ;; BOZO unlocalize
  (implies (force (and (logic.term-atblp a atbl)
                       (logic.term-list-list-atblp x atbl)))
           (equal (logic.term-list-list-atblp (multicons a x) atbl)
                  t))
  :hints(("Goal" :induct (cdr-induction x))))

(%autoprove forcing-logic.term-list-list-atblp-of-multicons
            (%cdr-induction x))


(%autoadmit tactic.conditional-eqsubst-all-tac)

(%autoprove forcing-tactic.skeletonp-of-tactic.conditional-eqsubst-all-tac
            (%enable default tactic.conditional-eqsubst-all-tac))

(%autoprove forcing-tactic.conditional-eqsubst-all-okp-of-tactic.conditional-eqsubst-all-tac
            (%enable default
                     tactic.conditional-eqsubst-all-tac
                     tactic.conditional-eqsubst-all-okp))

(%autoprove forcing-tactic.conditional-eqsubst-all-env-okp-of-tactic.conditional-eqsubst-all-tac
            (%enable default
                     tactic.conditional-eqsubst-all-tac
                     tactic.conditional-eqsubst-all-env-okp))


(%autoadmit tactic.conditional-eqsubst-list-bldr)

(encapsulate
 ()
 (defthmd lemma-1-for-tactic.conditional-eqsubst-list-bldr
   (implies (not (consp orig-goals))
            (equal (TACTIC.CONDITIONAL-EQSUBST-LIST-BLDR P ORIG-GOALS PROOF1 PROOFS2 PROOFS3 LHS RHS)
                   nil))
   :hints(("Goal" :in-theory (enable TACTIC.CONDITIONAL-EQSUBST-LIST-BLDR))))

 (defthmd lemma-2-for-tactic.conditional-eqsubst-list-bldr
   (equal (TACTIC.CONDITIONAL-EQSUBST-LIST-BLDR P (cons a ORIG-GOALS) PROOF1 PROOFS2 PROOFS3 LHS RHS)
          (CONS (TACTIC.CONDITIONAL-EQSUBST-BLDR P a
                                                 PROOF1 (CAR PROOFS2)
                                                 (CAR PROOFS3)
                                                 LHS RHS)
                (TACTIC.CONDITIONAL-EQSUBST-LIST-BLDR P ORIG-GOALS
                                                      PROOF1 (CDR PROOFS2)
                                                      (CDR PROOFS3)
                                                      LHS RHS)))
   :hints(("Goal" :in-theory (enable tactic.conditional-eqsubst-list-bldr))))

 (%autoprove lemma-1-for-tactic.conditional-eqsubst-list-bldr
             (%restrict default TACTIC.CONDITIONAL-EQSUBST-LIST-BLDR (equal orig-goals 'orig-goals)))

 (%autoprove lemma-2-for-tactic.conditional-eqsubst-list-bldr
             (%restrict default TACTIC.CONDITIONAL-EQSUBST-LIST-BLDR (equal orig-goals '(cons a orig-goals))))

 (local (%enable default
                 lemma-1-for-tactic.conditional-eqsubst-list-bldr
                 lemma-2-for-tactic.conditional-eqsubst-list-bldr))

 (%autoprove forcing-logic.appeal-listp-of-tactic.conditional-eqsubst-list-bldr
             (%autoinduct tactic.conditional-eqsubst-list-bldr))

 (%autoprove forcing-logic.strip-conclusions-of-tactic.conditional-eqsubst-list-bldr
             (%autoinduct tactic.conditional-eqsubst-list-bldr))

 (%autoprove forcing-logic.proof-listp-of-tactic.conditional-eqsubst-list-bldr
             (%autoinduct tactic.conditional-eqsubst-list-bldr)))





(encapsulate
 ()
 (set-well-founded-relation ord<)
 (set-measure-function rank)
 (defun firstn-firstn-induct (n x y)
   (declare (xargs :measure (nfix n)))
   (if (zp n)
       nil
     (if (not (consp x))
         nil
       (if (not (consp y))
           nil
         (firstn-firstn-induct (- n 1) (cdr x) (cdr y)))))))

(defthm lemma-0-for-tactic.conditional-eqsubst-all-compile
  ;; NOTE: switched order of 1/len x, inc blimit to 1
  (implies (not (cdr x))
           (equal (equal 1 (len x))
                  (consp x)))
  :rule-classes ((:rewrite :backchain-limit-lst 1)))

(defthm lemma-1-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (logic.disjoin-each-formula-list (logic.term-list-list-formulas goals))
                  (logic.strip-conclusions proofs))
           (equal (logic.conclusion (first proofs))
                  (logic.disjoin-formulas (logic.term-list-formulas (car goals))))))

(defthm lemma-2-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (logic.disjoin-each-formula-list (logic.term-list-list-formulas goals))
                  (logic.strip-conclusions proofs))
           (equal (logic.strip-conclusions (firstn n proofs))
                  (logic.disjoin-each-formula-list (logic.term-list-list-formulas (firstn n goals)))))
  :hints(("Goal" :in-theory (enable firstn))))

(defthm lemma-3-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (logic.disjoin-each-formula-list (logic.term-list-list-formulas goals))
                  (logic.strip-conclusions proofs))
           (equal (logic.strip-conclusions (restn n proofs))
                  (logic.disjoin-each-formula-list (logic.term-list-list-formulas (restn n goals)))))
  :hints(("Goal" :in-theory (enable restn))))

(defthm lemma-4-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (logic.disjoin-each-formula-list (logic.term-list-list-formulas goals))
                  (logic.strip-conclusions proofs))
           (equal (logic.strip-conclusions (firstn n (cdr proofs)))
                  (logic.disjoin-each-formula-list (logic.term-list-list-formulas (firstn n (cdr goals)))))))

(defthm lemma-5-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (logic.disjoin-each-formula-list (logic.term-list-list-formulas goals))
                  (logic.strip-conclusions proofs))
           (equal (logic.strip-conclusions (restn n (cdr proofs)))
                  (logic.disjoin-each-formula-list (logic.term-list-list-formulas (restn n (cdr goals)))))))

(defthm lemma-6-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (app a b) x)
           (equal (firstn (len a) x)
                  (list-fix a))))

(defthm lemma-7-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (app a b) x)
           (equal (restn (len a) x)
                  (list-fix b))))

(defthm lemma-8-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (app a (app b c)) x)
           (equal (firstn (len b) (restn (len a) x))
                  (list-fix b))))

(defthm lemma-9-for-tactic.conditional-eqsubst-all-compile
  (implies (equal (logic.disjoin-each-formula-list (logic.term-list-list-formulas goals))
                  (logic.strip-conclusions proofs))
           (equal (consp proofs)
                  (consp goals))))

(defthm lemma-10-for-tactic.conditional-eqsubst-all-compile
  (implies (EQUAL (APP (MULTICONS (FIRST (TACTIC.SKELETON->EXTRAS X)) (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X))) Y)
                  (CDR (TACTIC.SKELETON->GOALS X)))
           (EQUAL (FIRSTN (LEN (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X)))
                          (CDR (TACTIC.SKELETON->GOALS X)))
                  (MULTICONS (FIRST (TACTIC.SKELETON->EXTRAS X))
                             (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X)))))
  :hints(("Goal" :use ((:instance lemma-6-for-tactic.conditional-eqsubst-all-compile
                                  (a (MULTICONS (FIRST (TACTIC.SKELETON->EXTRAS X)) (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X))))
                                  (b y)
                                  (x (CDR (TACTIC.SKELETON->GOALS X))))))))

(defthm lemma-11-for-tactic.conditional-eqsubst-all-compile
  (implies (EQUAL (APP (MULTICONS (FIRST (TACTIC.SKELETON->EXTRAS X)) (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X))) Y)
                  (CDR (TACTIC.SKELETON->GOALS X)))
           (EQUAL (RESTN (LEN (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X)))
                         (CDR (TACTIC.SKELETON->GOALS X)))
                  (list-fix Y)))
  :hints(("Goal" :use ((:instance lemma-7-for-tactic.conditional-eqsubst-all-compile
                                  (a (MULTICONS (FIRST (TACTIC.SKELETON->EXTRAS X)) (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X))))
                                  (b y)
                                  (x (CDR (TACTIC.SKELETON->GOALS X))))))))

(defthm lemma-12-for-tactic.conditional-eqsubst-all-compile
  (implies (cons-listp x)
           (LOGIC.ALL-DISJUNCTIONSP (LOGIC.DISJOIN-EACH-FORMULA-LIST (LOGIC.TERM-LIST-LIST-FORMULAS (MULTICONS a x)))))
  :hints(("Goal" :induct (cdr-induction x))))

(defthm lemma-13-for-tactic.conditional-eqsubst-all-compile
  (implies (cons-listp x)
           (equal (LOGIC.VLHSES (LOGIC.DISJOIN-EACH-FORMULA-LIST (LOGIC.TERM-LIST-LIST-FORMULAS (MULTICONS a x))))
                  (repeat (logic.term-formula a) (len x))))
  :hints(("Goal" :induct (cdr-induction x))))

(defthm lemma-14-for-tactic.conditional-eqsubst-all-compile
  (implies (cons-listp x)
           (equal (LOGIC.VRHSES (LOGIC.DISJOIN-EACH-FORMULA-LIST (LOGIC.TERM-LIST-LIST-FORMULAS (MULTICONS a x))))
                  (logic.disjoin-each-formula-list (logic.term-list-list-formulas x))))
  :hints(("Goal" :induct (cdr-induction x))))







(%autoprove lemma-0-for-tactic.conditional-eqsubst-all-compile)
(%autoprove lemma-1-for-tactic.conditional-eqsubst-all-compile)


(%autoprove lemma-2-for-tactic.conditional-eqsubst-all-compile
            (%autoinduct firstn-firstn-induct n proofs goals)
            (%forcingp nil)
            (%restrict default firstn (equal n 'n)))

(%autoprove lemma-3-for-tactic.conditional-eqsubst-all-compile
            (%autoinduct firstn-firstn-induct n proofs goals)
            (%forcingp nil)
            (%restrict default restn (equal n 'n)))

(%autoprove lemma-4-for-tactic.conditional-eqsubst-all-compile)
(%autoprove lemma-5-for-tactic.conditional-eqsubst-all-compile)
(%autoprove lemma-6-for-tactic.conditional-eqsubst-all-compile)
(%autoprove lemma-7-for-tactic.conditional-eqsubst-all-compile)
(%autoprove lemma-8-for-tactic.conditional-eqsubst-all-compile)
(%autoprove lemma-9-for-tactic.conditional-eqsubst-all-compile)

(%autoprove lemma-10-for-tactic.conditional-eqsubst-all-compile
            (%use (%instance (%thm lemma-6-for-tactic.conditional-eqsubst-all-compile)
                             (a (MULTICONS (FIRST (TACTIC.SKELETON->EXTRAS X)) (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X))))
                             (b y)
                             (x (CDR (TACTIC.SKELETON->GOALS X))))))

(%autoprove lemma-11-for-tactic.conditional-eqsubst-all-compile
            (%use (%instance (%thm lemma-7-for-tactic.conditional-eqsubst-all-compile)
                             (a (MULTICONS (FIRST (TACTIC.SKELETON->EXTRAS X)) (TACTIC.SKELETON->GOALS (TACTIC.SKELETON->HISTORY X))))
                             (b y)
                             (x (CDR (TACTIC.SKELETON->GOALS X))))))

(%autoprove lemma-12-for-tactic.conditional-eqsubst-all-compile
            (%cdr-induction x))

(%autoprove lemma-13-for-tactic.conditional-eqsubst-all-compile
            (%cdr-induction x))

(%autoprove lemma-14-for-tactic.conditional-eqsubst-all-compile
            (%cdr-induction x)
            (%forcingp nil))


(%autoadmit tactic.conditional-eqsubst-all-compile)

(local (%enable default
                tactic.conditional-eqsubst-all-okp
                tactic.conditional-eqsubst-all-env-okp
                tactic.conditional-eqsubst-all-compile
                logic.term-formula))

(local (%disable default
                 expensive-arithmetic-rules
                 expensive-arithmetic-rules-two
                 unusual-memberp-rules
                 unusual-subsetp-rules
                 type-set-like-rules))

(%autoprove forcing-logic.appeal-listp-of-tactic.conditional-eqsubst-all-compile

            (%forcingp nil)
            (%auto :strategy (cleanup split urewrite))

            (%car-cdr-elim proofs)
            (%crewrite default first)
            (%generalize (car proofs) proof1)
            (%generalize (cdr proofs) proofs2)
            (%auto :strategy (cleanup split urewrite crewrite dist))

            (%disable default
                      expensive-term/formula-inference
                      formula-decomposition)

            (%forcingp t)
            (%waterfall default 40))

(%autoprove forcing-logic.strip-conclusions-of-tactic.conditional-eqsubst-all-compile

            (%forcingp nil)
            (%auto :strategy (cleanup split urewrite))

            (%car-cdr-elim proofs)
            (%crewrite default first)
            (%generalize (car proofs) proof1)
            (%generalize (cdr proofs) proofs2)
            (%auto :strategy (cleanup split urewrite crewrite dist))

            (%disable default
                      expensive-term/formula-inference
                      formula-decomposition)

            (%forcingp t)
            (%waterfall default 40))


(%autoprove forcing-logic.proof-listp-of-tactic.conditional-eqsubst-all-compile

            (%forcingp nil)
            (%auto :strategy (cleanup split urewrite))

            (%car-cdr-elim proofs)
            (%crewrite default first)
            (%generalize (car proofs) proof1)
            (%generalize (cdr proofs) proofs2)
            (%auto :strategy (cleanup split urewrite crewrite dist))

            (%disable default
                      expensive-term/formula-inference
                      formula-decomposition)

            (%forcingp t)
            (%waterfall default 40))


(in-theory (disable lemma-0-for-tactic.conditional-eqsubst-all-compile
                    lemma-1-for-tactic.conditional-eqsubst-all-compile
                    lemma-2-for-tactic.conditional-eqsubst-all-compile
                    lemma-3-for-tactic.conditional-eqsubst-all-compile
                    lemma-4-for-tactic.conditional-eqsubst-all-compile
                    lemma-5-for-tactic.conditional-eqsubst-all-compile
                    lemma-6-for-tactic.conditional-eqsubst-all-compile
                    lemma-7-for-tactic.conditional-eqsubst-all-compile
                    lemma-8-for-tactic.conditional-eqsubst-all-compile
                    lemma-9-for-tactic.conditional-eqsubst-all-compile
                    lemma-10-for-tactic.conditional-eqsubst-all-compile
                    lemma-11-for-tactic.conditional-eqsubst-all-compile
                    lemma-12-for-tactic.conditional-eqsubst-all-compile
                    lemma-13-for-tactic.conditional-eqsubst-all-compile
                    lemma-14-for-tactic.conditional-eqsubst-all-compile))

(%disable default
          lemma-0-for-tactic.conditional-eqsubst-all-compile
          lemma-1-for-tactic.conditional-eqsubst-all-compile
          lemma-2-for-tactic.conditional-eqsubst-all-compile
          lemma-3-for-tactic.conditional-eqsubst-all-compile
          lemma-4-for-tactic.conditional-eqsubst-all-compile
          lemma-5-for-tactic.conditional-eqsubst-all-compile
          lemma-6-for-tactic.conditional-eqsubst-all-compile
          lemma-7-for-tactic.conditional-eqsubst-all-compile
          lemma-8-for-tactic.conditional-eqsubst-all-compile
          lemma-9-for-tactic.conditional-eqsubst-all-compile
          lemma-10-for-tactic.conditional-eqsubst-all-compile
          lemma-11-for-tactic.conditional-eqsubst-all-compile
          lemma-12-for-tactic.conditional-eqsubst-all-compile
          lemma-13-for-tactic.conditional-eqsubst-all-compile
          lemma-14-for-tactic.conditional-eqsubst-all-compile)

(%ensure-exactly-these-rules-are-missing "../../tactics/conditional-eqsubst-all")