File: bcv-collected-frames-are-strictly-ordered.lisp

package info (click to toggle)
acl2 8.6%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 1,111,420 kB
  • sloc: lisp: 17,818,294; java: 125,359; python: 28,122; javascript: 23,458; cpp: 18,851; ansic: 11,569; perl: 7,678; xml: 5,591; sh: 3,976; makefile: 3,833; ruby: 2,633; yacc: 1,126; ml: 763; awk: 295; csh: 233; lex: 197; php: 178; tcl: 49; asm: 23; haskell: 17
file content (331 lines) | stat: -rw-r--r-- 13,664 bytes parent folder | download | duplicates (2)
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
(in-package "BCV")
(include-book "typechecker")
(include-book "typechecker-ext")
(include-book "typechecker-simple")
(include-book "bcv-base")



(defthm extract-frame-pc-subset-extract-pc
  (implies (member pc (extract-frame-pc 
                       (collect-sig-frame-vector env mergedcode stackmap)))
           (member pc (extract-pc (extract-code mergedcode))))
  :hints (("Goal" :in-theory (disable instructionIsTypeSafe
                                      instructionSatisfiesHandlers
                                      instrOffset
                                      jvm::inst-size
                                      next-pc
                                      sig-do-inst
                                      isstackmap
                                      makestackmap
                                      allinstructions
                                      isEnd
                                      mapFrame
                                      getMap 
                                      mapOffset
                                      frameIsAssignable
                                      isInstruction
                                      isStackMap))))

;;;
;;; need a good library of is-suffix and is-subsequence 
;;;

;; (defthm ordered-implies-ordered2 
;;   (iff  (ordered l)
;;         (ordered2 l)))

(defthm subsetp-extract-code-l
  (subsetp (extract-code l) l))


(defthm member-x-member-extract-pc
  (implies (and (member x (extract-pc l1))
                (subsetp l1 l2)
                (wff-merged-code-weak l2))
           (member x (extract-pc l2))))


(defthm subsetp-cdr-subsetp
  (implies (subsetp l1 l2)
           (subsetp (cdr l1) l2)))

(defthm member-x-mermber-extract-pc
  (implies (and (member x l)
                (isInstruction x)
                (wff-merged-code-weak l))
           (member (instrOffset x) (extract-pc l)))
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable isInstruction isStackMap
                               isEnd instrOffset
                               mapOffset))))


(defthm member-x-mermber-extract-pc-2
  (implies (and (member x l)
                (isStackMap x)
                (wff-merged-code-weak l))
           (member (mapOffset (getMap x)) (extract-pc l)))
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable isInstruction isStackMap
                               isEnd instrOffset
                               getMap
                               mapOffset))))

(defthm subsetp-subsetp-extract-pc
  (implies (and (subsetp l1 l2)
                (wff-merged-code-weak l2))
           (subsetp (extract-pc l1) (extract-pc l2)))
  :hints (("Goal" :in-theory (disable isInstruction isStackMap
                                      isEnd instrOffset getMap
                                      mapOffset)
           :do-not '(generalize))))


(defthm all-no-less-than-subsetp
  (implies (and (all-no-less-than x s2)
                (subsetp s1 s2))
           (all-no-less-than x s1)))

(defthm all-no-less-than-all-no-less-than
  (implies (and (all-no-less-than y l)
                (< x y))
           (all-no-less-than x l)))


(defthm pc-wff-mergedcode1-all-no-less
  (implies (pc-wff-mergedcode1 pc mergedcode)
           (all-no-less-than pc (extract-pc mergedcode)))
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable isInstruction isStackMap
                               isEnd getMap instrOffset
                               mapOffset
                               jvm::inst-size))))
;; above not necessary!! 

(defthm pc-wff-mergedcode1-ordered-pc
  (implies (pc-wff-mergedcode1 pc mergedcode)
           (ordered (extract-pc mergedcode)))
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable isInstruction isStackMap
                                      isEnd getMap instrOffset
                                      mapOffset
                                      jvm::inst-size))))


;; (skip-proofs 
;;  (defthm pc-wff-mergedcode1-ordered-pc-2
;;    (implies (pc-wff-mergedcode1 pc mergedcode)
;;             (ordered2 (extract-pc mergedcode)))
;;    :hints (("Goal" :in-theory (disable isInstruction isStackMap
;;                                        isEnd
;;                                        jvm::inst-size)))
;;    :rule-classes :forward-chaining))

                 
                 



;; (defthm ordered-ordered-extract-code
;;   (implies (ordered2 (extract-pc l))
;;            (ordered2 (extract-pc (extract-code l))))
;;   :hints (("Goal" :in-theory (disable isInstruction isStackMap 
;;                                       instrOffset)
;;            :do-not '(generalize))))
                                      

(defthm all-strictly-less-if-less-than-first-orderred
  (implies (and (ordered l)
                (< pc (car l)))
           (all-strictly-less-than pc l)))


(defthm pc-wff-mergedcode1-isInstruction-then-next-pc-is-greater-lemma
   (implies (and (pc-wff-mergedcode1 pc mergedcode)
                 (consp mergedcode)
                (isInstruction (car mergedcode)))
           (all-strictly-less-than pc (extract-pc (cdr mergedcode))))
    :hints (("Goal" :do-not '(generalize)
             :do-not-induct t
             :use ((:instance all-strictly-less-if-less-than-first-orderred
                              (l (extract-pc (cdr mergedcode)))))
             :in-theory (disable instructionIsTypeSafe
                                 instructionSatisfiesHandlers
                                 instrOffset
                                 ;;ordered-implies-ordered2 
                                 all-strictly-less-if-less-than-first-orderred
                                 pc-wff-mergedcode1-ordered-pc
                                 jvm::inst-size
                                 next-pc
                                 sig-do-inst
                                 isstackmap
                                 makestackmap
                                 allinstructions
                                 isEnd
                                 mapFrame
                                 getMap 
                                 mapOffset
                                 frameIsAssignable
                                 isInstruction
                                 isStackMap))
            ("Subgoal 2" :use ((:instance pc-wff-mergedcode1-ordered-pc
                                          (pc (+ (JVM::INST-SIZE (car MERGEDCODE))
                                                 (INSTROFFSET (car MERGEDCODE))))
                                          (mergedcode (cdr mergedcode)))))
            ("Subgoal 1" :expand (PC-WFF-MERGEDCODE1 (+ (JVM::INST-SIZE MERGEDCODE1)
                                                        (INSTROFFSET MERGEDCODE1))
                                                     MERGEDCODE2))))
        


(defthm all-strictly-less-than-subsetp
  (implies (and (all-strictly-less-than x s2)
                (subsetp s1 s2))
           (all-strictly-less-than x s1)))



(defthm pc-wff-mergedcode1-isInstruction-then-next-pc-is-greater
   (implies (and (pc-wff-mergedcode1 pc mergedcode)
                 (consp mergedcode)
                 (isInstruction (car mergedcode)))
           (all-strictly-less-than (instroffset (car mergedcode))
                                   (extract-pc (extract-code (cdr mergedcode)))))
    :hints (("Goal" :do-not '(generalize)
             :do-not-induct t
             :in-theory (disable instructionIsTypeSafe
                                 instructionSatisfiesHandlers
                                 instrOffset
                                 ;;ordered-implies-ordered2 
                                 all-strictly-less-if-less-than-first-orderred
                                 pc-wff-mergedcode1-ordered-pc
                                 jvm::inst-size
                                 next-pc
                                 sig-do-inst
                                 isstackmap
                                 makestackmap
                                 allinstructions
                                 isEnd
                                 mapFrame
                                 getMap 
                                 mapOffset
                                 frameIsAssignable
                                 isInstruction
                                 isStackMap)
             :use ((:instance all-strictly-less-than-subsetp
                              (s2 (extract-pc (cdr mergedcode)))
                              (s1 (extract-pc (extract-code (cdr mergedcode))))
                              (x pc))))))


(defthm pc-wff-mergedcode1-isInstruction-then-next-pc-is-greater-specific
   (implies (and (PC-WFF-MERGEDCODE1 (+ (JVM::INST-SIZE MERGEDCODE1)
                                        (INSTROFFSET MERGEDCODE1))
                                     MERGEDCODE2)
                 (<= 1  (JVM::INST-SIZE MERGEDCODE1))
                 (isInstruction mergedcode1))
           (all-strictly-less-than (instroffset mergedcode1)
                                   (extract-pc (extract-code mergedcode2))))
    :hints (("Goal" :do-not '(generalize)
             :do-not-induct t
             :in-theory (disable instructionIsTypeSafe
                                 instructionSatisfiesHandlers
                                 instrOffset
                                 ;;ordered-implies-ordered2 
                                 all-strictly-less-if-less-than-first-orderred
                                 pc-wff-mergedcode1-ordered-pc
                                 jvm::inst-size
                                 next-pc
                                 sig-do-inst
                                 isstackmap
                                 makestackmap
                                 allinstructions
                                 isEnd
                                 mapFrame
                                 getMap 
                                 mapOffset
                                 frameIsAssignable
                                 isInstruction
                                 isStackMap)
             :use ((:instance
                    pc-wff-mergedcode1-isInstruction-then-next-pc-is-greater
                    (pc (instrOffset mergedcode1))
                    (mergedcode (cons mergedcode1
                                      mergedcode2)))))))


(defthm subset-cons
  (implies (subsetp x l)
           (subsetp x (cons y l))))


(defthm subsetp-extract-frame-pc-subset-pc
  (subsetp (extract-frame-pc (collect-sig-frame-vector env mergedcode frame))
           (extract-pc (extract-code mergedcode)))
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable instructionIsTypeSafe
                               instructionSatisfiesHandlers
                               instrOffset
                               jvm::inst-size
                               next-pc
                               sig-do-inst
                               isstackmap
                               makestackmap
                               allinstructions
                               isEnd
                               mapFrame
                               getMap 
                               mapOffset
                               frameIsAssignable
                               isInstruction
                               isStackMap))))


;;; no need to go through these troubles!!! 

(defthm all-strictly-less-than-subsetp-specific
  (implies (all-strictly-less-than x (extract-pc (extract-code mergedcode)))
           (all-strictly-less-than x (extract-frame-pc
                                      (collect-sig-frame-vector env mergedcode
                                                                init-frame))))
  :hints (("Goal" :in-theory (disable extract-frame-pc extract-pc extract-code
                                      all-strictly-less-than collect-sig-frame-vector))))
        

(defthm pc-wff-mergedcode1-pc-wff-merged-code1
  (implies (and (PC-WFF-MERGEDCODE1 pc MERGEDCODE2)
                (case-split (not (isEnd (car mergedcode2)))))
           (pc-wff-mergedcode1 (next-pc mergedcode2) mergedcode2))
  :hints (("Goal" :in-theory (disable isInstruction instrOffset
                                      isStackMap mapOffset
                                      jvm::inst-size
                                      isEnd)
           :do-not '(generalize))))


(defthm collect-sig-frame-vector-return-ordered-list
  (implies (pc-wff-mergedcode1 (next-pc mergedcode) mergedcode)
           (strictly-ordered (extract-frame-pc 
                              (collect-sig-frame-vector env
                                                        mergedcode init-frame))))
    :hints (("Goal" :do-not '(generalize)
           :in-theory (disable instructionIsTypeSafe
                               instructionSatisfiesHandlers
                               instrOffset
                               jvm::inst-size
                               next-pc
                               sig-do-inst
                               isstackmap
                               makestackmap
                               allinstructions
                               isEnd
                               mapFrame
                               getMap 
                               mapOffset
                               frameIsAssignable
                               isInstruction
                               isStackMap)
           :induct (collect-sig-frame-vector env mergedcode init-frame))))