File: bcv-searchStackFrame-reduce-support-2.lisp

package info (click to toggle)
acl2 8.6%2Bdfsg-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,138,276 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,978; makefile: 3,840; ruby: 2,633; yacc: 1,126; ml: 763; awk: 295; csh: 233; lex: 197; php: 178; tcl: 49; asm: 23; haskell: 17
file content (279 lines) | stat: -rw-r--r-- 11,281 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
(in-package "BCV")
(include-book "typechecker")
(include-book "typechecker-ext")
(include-book "typechecker-simple")
(include-book "bcv-base")


;----------------------------------------------------------------------

(encapsulate () 
  (local (include-book "bcv-collected-frames-are-strictly-ordered"))
  (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)))))))


(defthm pc-wff-mergedcode1-strictly-ordered-extract-pc-extract-code
  (implies (pc-wff-mergedcode1 pc mergedcode)
           (strictly-ordered (extract-pc (extract-code mergedcode))))
  :hints (("Goal" :in-theory (disable isInstruction
                                      isstackmap
                                      jvm::inst-size
                                      mapOffset getMap
                                      instroffset
                                      isEnd))))

;----------------------------------------------------------------------

;----------------------------------------------------------------------

(defthm strictly-ordered-next-inst
  (implies (and (strictly-ordered (extract-pc (extract-code mergedcode)))
                (wff-merged-code-weak mergedcode)
                (member inst mergedcode)
                (isInstruction inst)
                (isInstruction (next-inst inst mergedcode)))
           (< (instroffset inst)
              (instroffset (next-inst inst mergedcode))))
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable isInstruction
                               isstackmap
                               jvm::inst-size
                               mapOffset
                               getMap
                               instroffset
                               isEnd))))
;;;
;;; well this is proved by induction!!! 
;;;
;;; although we usually don't want to prove such things using induction
;;; directly!!
;;;

;;            :use ((:instance member-suffix-then-strictly-greater
;;                             (x (instroffset inst))
;;                             (y (instroffset (next-inst inst mergedcode)))
;;                             (l (extract-pc (extract-code mergedcode))))
;;                  (:instance
;;                   member-code-isInstruction-implies-member-extract-pc-general
;;                   (inst (next-inst inst mergedcode))
;;                   (pc-list (cdr (suffix (instroffset inst)
;;                                         (extract-pc (extract-code
;;                                                      mergedcode)))))
;;                   (mergedcode (cdr (suffix inst mergedcode))))
;;                  (:instance member-inst-implies-consp
;;                             (inst (next-inst inst mergedcode))
;;                             (mergedcode (cdr (suffix inst mergedcode)))))
;;            :do-not-induct t)))

;----------------------------------------------------------------------

;; (defthm pc-wff-mergedcode1-implies-wff-merged-code-weak
;;   (implies (pc-wff-mergedcode1 pc mergedcode)
;;           (wff-merged-code-weak mergedcode))
;;   :rule-classes :forward-chaining
;;   :hints (("Goal" :do-not '(generalize)
;;            :in-theory (disable isInstruction
;;                                isstackmap
;;                                jvm::inst-size
;;                                mapOffset
;;                                getMap
;;                                instroffset
;;                                isEnd))))
;;; in bcv-base.lisp
;;

(defthm next-inst-never-occur-before
  (implies (and (member inst mergedcode)
                (pc-wff-mergedcode1 pc mergedcode)
                (isInstruction (next-inst inst mergedcode))
                (isInstruction inst))
           (< (instroffset inst)
              (instroffset (next-inst inst mergedcode))))
  :rule-classes :linear
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable isInstruction
                               isstackmap
                               jvm::inst-size
                               mapOffset
                               getMap
                               instroffset
                               isEnd))))


(defthm member-inst-pc-no-less-than
  (implies (and (member inst mergedcode)
                (pc-wff-mergedcode1 pc mergedcode)
                (isInstruction inst))
           (<= pc (instroffset inst)))
  :rule-classes :linear
  :hints (("Goal" :do-not '(generalize)
           :in-theory (disable isInstruction
                               isstackmap
                               jvm::inst-size
                               mapOffset
                               getMap
                               instroffset
                               isEnd))))




(defthm member-inst-pc-no-less-than-specific
   (implies (and (member inst mergedcode)
                 (pc-wff-mergedcode1 pc mergedcode)
                 (isInstruction inst)
                 (isInstruction (next-inst inst mergedcode)))
            (< pc (instroffset (next-inst inst mergedcode))))
   :rule-classes :linear
   :hints (("Goal" :in-theory (disable instroffset isInstruction
                                       pc-wff-mergedcode1
                                       next-inst member))))
           

;----------------------------------------------------------------------

;; (defthm member-del-x-member
;;   (implies (and (member x l)
;;                 (member y l)
;;                 (not (equal x y)))
;;            (member x (del y l))))


;; (defthm strictly-ordered-list-del-member
;;   (implies (strictly-ordered l)
;;            (not (member x (del x l)))))


;; (defthm member-member-pc
;;   (implies (and (member inst mergedcode)
;;                 (wff-merged-code-weak mergedcode)
;;                 (isInstruction inst))
;;            (member (instroffset inst) 
;;                    (extract-pc (extract-code mergedcode)))))

;; (defthm extract-pc-del-is-del-extract-pc
;;   (implies (and ;; (strictly-ordered (extract-pc (extract-code mergedcode)))
;;                 (unique 
;;                 (member inst mergedcode)
;;                 (isInstruction inst))
;;            (equal (extract-pc (extract-code (del inst mergedcode)))
;;                   (del (instroffset inst) (extract-pc (extract-code
;;                                                        mergedcode)))))
;;     :hints (("Goal" :do-not '(generalize)
;;            :in-theory (disable isInstruction
;;                                isstackmap
;;                                jvm::inst-size
;;                                mapOffset
;;                                getMap
;;                                instroffset
;;                                isEnd))))


           

(defthm strictly-ordered-next-inst-specific
  (implies (and (equal (instroffset inst2)
                       (instroffset inst1))
                (member inst1 mergedcode)
                (member inst2 mergedcode)
                (strictly-ordered (extract-pc (extract-code mergedcode)))
                (wff-merged-code-weak mergedcode)
                (isInstruction inst1)
                (isInstruction inst2))
           (equal inst2 inst1))
   :rule-classes :forward-chaining
   :hints (("Goal" :do-not '(generalize fertilize)
            :in-theory (disable isInstruction
                                isstackmap
                                jvm::inst-size
                                mapOffset
                                getMap
                                instroffset
                                isEnd))))


(defthm pc-wff-mergedcode1-all-greater-than
  (implies (and (pc-wff-mergedcode1 pc mergedcode)
                (member inst mergedcode)
                (isInstruction inst))
           (<= pc (instroffset inst)))
  :rule-classes :linear
  :hints (("Goal" :do-not '(generalize fertilize)
           :in-theory (disable isInstruction
                               isstackmap
                               jvm::inst-size
                               mapOffset
                               getMap
                               instroffset
                               isEnd))))


                 
(defthm not-pc-wff-mergecode1-if-member
  (implies (and (< 0 x)
                (member inst mergedcode2)
                (isInstruction inst))
           (not (PC-WFF-MERGEDCODE1 (+ x
                                       (INSTROFFSET INST))
                                    MERGEDCODE2)))
     :hints (("Goal" :do-not '(generalize fertilize)
              :do-not-induct t
              :use ((:instance pc-wff-mergedcode1-all-greater-than
                               (pc (+ x (instroffset inst)))
                               (mergedcode mergedcode2)))
              :in-theory (disable isInstruction
                                  isstackmap
                                  jvm::inst-size
                                  mapOffset
                                  getMap
                                  instroffset
                                  isEnd))))


;----------------------------------------------------------------------
;----------------------------------------------------------------------

(defthm mergecodeIsTypeSafe-implies-collect-sig-vector-compatible-1
  (implies (and (mergedcodeIsTypeSafe env mergecode stackframe)
                (member inst mergecode)
                (isInstruction inst)
                (isInstruction (next-inst inst mergecode))
                (pc-wff-mergedcode1 (next-pc mergecode) mergecode))
           (equal (car (sig-do-inst inst
                                    env
                                    (searchStackFrame (instroffset inst)
                                                      (stack-map-wrap
                                                       (collect-sig-frame-vector
                                                        env mergecode
                                                        stackframe)))))
                  (searchStackFrame (instroffset (next-inst inst mergecode))
                                    (stack-map-wrap (collect-sig-frame-vector
                                                     env mergecode
                                                     stackframe)))))
  :hints (("Goal" :do-not '(generalize fertilize)
           :in-theory (disable instructionIsTypeSafe
                               instructionSatisfiesHandlers
                               instrOffset
                               jvm::inst-size
                               sig-do-inst
                               isstackmap
                               makestackmap
                               allinstructions
                               isEnd
                               mapFrame
                               getMap 
                               mapOffset
                               frameIsAssignable
                               isInstruction
                               isStackMap))))