File: waterfall-main.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 (278 lines) | stat: -rw-r--r-- 11,587 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
; 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 "waterfall-steps")
(%interactive)

(%autoadmit rw.flag-waterfall)
(%autoadmit rw.waterfall)
(%autoadmit rw.waterfall-list)

(%autoprove definition-of-rw.waterfall
            (%restrict default rw.flag-waterfall (and (equal x 'x) (equal steps 'steps)))
            (%enable default rw.waterfall rw.waterfall-list))

(%autoprove definition-of-rw.waterfall-list
            (%restrict default rw.flag-waterfall (and (equal x 'x) (equal steps 'steps)))
            (%enable default rw.waterfall rw.waterfall-list))

(%autoprove rw.flag-waterfall-of-clause
            (%enable default rw.waterfall))

(%autoprove rw.flag-waterfall-of-list
            (%enable default rw.waterfall-list))

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

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

(%defprojection :list (rw.waterfall-list x theoryname cfastp ufastp world steps strategy n)
                :element (rw.waterfall x theoryname cfastp ufastp world steps strategy n)
                :nil-preservingp nil)


;; BOZO.  Wow, these, uh, completely do not belong here at all...

(%autoprove true-listp-of-clause.make-clause-from-arbitrary-formula
            (%enable default clause.make-clause-from-arbitrary-formula))

(%autoprove true-list-listp-of-clause.make-clauses-from-arbitrary-formulas
            (%autoinduct clause.make-clauses-from-arbitrary-formulas)
            (%restrict default clause.make-clauses-from-arbitrary-formulas (equal x 'x)))


(%autoprove lemma-2-for-rw.waterstepp-of-rw.waterfall
            ;; disabled!
            (%enable default
                     rw.make-crewrite-clause-plan
                     rw.crewrite-clause-plan->clause-prime))

(%autoprove lemma-for-rw.waterstepp-of-rw.waterfall
            (%autoinduct rw.flag-waterfall)
            (%forcingp nil)
            (%waterfall default 40)
            (%restrict default definition-of-rw.waterfall (and (equal x 'x)
                                                               (equal steps 'steps)))
            (%enable default lemma-2-for-rw.waterstepp-of-rw.waterfall)
            (%waterfall default 40))

(%autoprove rw.waterstepp-of-rw.waterfall
            (%use (%instance (%thm lemma-for-rw.waterstepp-of-rw.waterfall)
                             (flag 'clause))))

(%autoprove rw.waterstep-listp-of-rw.waterfall-list
            (%use (%instance (%thm lemma-for-rw.waterstepp-of-rw.waterfall)
                             (flag 'list))))


(%autoprove lemma-1-for-rw.waterstep-atblp-of-rw.waterfall
            (%enable default rw.ccstep->clause-prime))

(%autoprove lemma-2-for-rw.waterstep-atblp-of-rw.waterfall
            (%autoinduct rw.ccstep-list-gather-traces)
            (%restrict default rw.ccstep-list-gather-traces (equal x 'x))
            (%enable default rw.ccstep->provedp rw.ccstep->contradiction))

(%autoprove lemma-3-for-rw.waterstep-atblp-of-rw.waterfall
            (%autoinduct rw.ccstep-list-hypboxes)
            (%restrict default rw.ccstep-list-hypboxes (equal x 'x)))

(%autoprove lemma-4-for-rw.waterstep-atblp-of-rw.waterfall
            (%enable default lemma-1-for-rw.waterstep-atblp-of-rw.waterfall))

(%autoprove lemma-5-for-rw.waterstep-atblp-of-rw.waterfall
            (%enable default
                     rw.crewrite-clause-planp
                     rw.crewrite-clause-plan-atblp
                     rw.crewrite-clause-plan-okp
                     rw.crewrite-clause-plan->clause
                     rw.crewrite-clause-plan->clause-prime
                     lemma-1-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-2-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-3-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-4-for-rw.waterstep-atblp-of-rw.waterfall)
            ;; huh.. acl2 had to fertilize? we don't?
            )


;; The acl2 proof below uses restrict hints to fix problems with free var matching
;; our system doesn't work quite the same -- we'll introduce alt-rules instead.

(defthmd lemma-5-for-rw.waterstep-atblp-of-rw.waterfall-alt
  (implies (force (and (tactic.worldp world)
                       (rw.crewrite-clause-planp x)
                       (rw.crewrite-clause-plan-atblp x atbl)
                       (rw.crewrite-clause-plan-okp x world)
                       (tactic.world-atblp world atbl)
                       (equal (cdr (lookup 'not atbl)) 1)
                       (equal (cdr (lookup 'equal atbl)) 2)
                       (equal (cdr (lookup 'iff atbl)) 2)
                       (equal (cdr (lookup 'if atbl)) 3)))
           (equal (logic.term-list-atblp
                   (rw.crewrite-clause-plan->clause-prime x)
                   atbl)
                  t))
  :hints(("goal" :in-theory (enable lemma-5-for-rw.waterstep-atblp-of-rw.waterfall))))

(%autoprove lemma-5-for-rw.waterstep-atblp-of-rw.waterfall-alt
            (%enable default lemma-5-for-rw.waterstep-atblp-of-rw.waterfall))

(defthm logic.formula-list-atblp-of-rw.crewrite-clause-plan->forced-goals-alt
  (implies (force (and (tactic.worldp world)
                       (rw.crewrite-clause-planp x)
                       (rw.crewrite-clause-plan-okp x world)
                       (rw.crewrite-clause-plan-atblp x atbl)
                       (tactic.world-atblp world atbl)
                       (equal (cdr (lookup 'not atbl)) 1)
                       (equal (cdr (lookup 'equal atbl)) 2)
                       (equal (cdr (lookup 'iff atbl)) 2)
                       (equal (cdr (lookup 'if atbl)) 3)))
           (equal (logic.formula-list-atblp
                   (rw.crewrite-clause-plan->forced-goals x)
                   atbl)
                  t)))

(%autoprove logic.formula-list-atblp-of-rw.crewrite-clause-plan->forced-goals-alt)



(%autoprove lemma-for-rw.waterstep-atblp-of-rw.waterfall
            (%autoinduct rw.flag-waterfall)
            (%forcingp nil)

            (%disable default
                      expensive-term/formula-inference
                      formula-decomposition
                      unusual-memberp-rules
                      unusual-subsetp-rules
                      unusual-consp-rules
                      type-set-like-rules
                      expensive-arithmetic-rules
                      expensive-arithmetic-rules-two
                      same-length-prefixes-equal-cheap)

            (%waterfall default 40)

            (%enable default
                     lemma-1-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-2-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-3-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-4-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-5-for-rw.waterstep-atblp-of-rw.waterfall
                     lemma-5-for-rw.waterstep-atblp-of-rw.waterfall-alt
                     lemma-2-for-rw.waterstepp-of-rw.waterfall)

            (%restrict default definition-of-rw.waterfall (and (equal x 'x) (equal steps 'steps)))
            (%waterfall default 40))

(%autoprove rw.waterstep-atblp-of-rw.waterfall
            (%use (%instance (%thm lemma-for-rw.waterstep-atblp-of-rw.waterfall)
                             (flag 'clause))))

(%autoprove rw.waterstep-list-atblp-of-rw.waterfall-list
            (%use (%instance (%thm lemma-for-rw.waterstep-atblp-of-rw.waterfall)
                             (flag 'list))))

(%autoprove lemma-for-rw.waterstep->clause-of-rw.waterfall
            (%autoinduct rw.flag-waterfall)
            (%forcingp nil)
            (%waterfall default 40)
            (%restrict default definition-of-rw.waterfall (and (equal x 'x) (equal steps 'steps))))

(%autoprove rw.waterstep->clause-of-rw.waterfall
            (%use (%instance (%thm lemma-for-rw.waterstep->clause-of-rw.waterfall)
                             (flag 'clause))))

(%autoprove rw.waterstep-list->clauses-of-rw.waterfall-list
            (%use (%instance (%thm lemma-for-rw.waterstep->clause-of-rw.waterfall)
                             (flag 'list))))



(%autoprove lemma-for-rw.waterstep-okp-of-rw.waterfall

            (%autoinduct rw.flag-waterfall)
            (%forcingp nil)

            (%disable default
                      expensive-term/formula-inference
                      formula-decomposition
                      unusual-memberp-rules
                      unusual-subsetp-rules
                      unusual-consp-rules
                      type-set-like-rules
                      expensive-arithmetic-rules
                      expensive-arithmetic-rules-two
                      same-length-prefixes-equal-cheap)

            (%waterfall default 40)

            (%restrict default definition-of-rw.waterfall (and (equal x 'x) (equal steps 'steps)))
            (%waterfall default 40)

            (%enable default
                     definition-of-rw.waterstep-okp
                     rw.stop-waterstep-okp
                     rw.crewrite-waterstep-okp
                     rw.split-waterstep-okp
                     rw.urewrite-waterstep-okp
                     lemma-2-for-rw.waterstepp-of-rw.waterfall)
            (%waterfall default 40)

            (%forcingp t)
            (%enable default
                     expensive-term/formula-inference
                     formula-decomposition
                     unusual-memberp-rules
                     unusual-subsetp-rules
                     unusual-consp-rules
                     type-set-like-rules
                     expensive-arithmetic-rules
                     expensive-arithmetic-rules-two
                     same-length-prefixes-equal-cheap)

            (%auto))

(%autoprove rw.waterstep-okp-of-rw.waterfall
            (%use (%instance (%thm lemma-for-rw.waterstep-okp-of-rw.waterfall)
                             (flag 'clause))))

(%autoprove rw.waterstep-list-okp-of-rw.waterfall-list
            (%use (%instance (%thm lemma-for-rw.waterstep-okp-of-rw.waterfall)
                             (flag 'list))))