File: base-consistent-state-lookupfield-bcv.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 (266 lines) | stat: -rw-r--r-- 11,105 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
(in-package "DJVM")
(include-book "../../M6-DJVM-shared/jvm-linker")
(include-book "../../M6-DJVM-shared/jvm-class-table")
(include-book "../../M6-DJVM-shared/jvm-object-type-hierachy")
(include-book "../../DJVM/consistent-state")
(include-book "../../DJVM/consistent-state-to-sig-state")


(defthm bcv-class-is-interface-normalize
  (equal (bcv::classIsInterface
          (BCV::CLASS-BY-NAME name (BCV::SCL-JVM2BCV SCL)))
         (mem '*interface* (accessflags-s 
                            (mv-nth 1 (class-by-name-s name scl)))))
  :hints (("Goal" :in-theory (enable bcv::classisinterface
                                     BCV::MAKE-CLASS-TERM
                                     bcv::class-by-name
                                     classname-s
                                     accessflags-s
                                     bcv::classclassname
                                     )
           :do-not '(generalize))))


(defthm classIsInterface-implies-isInterface
  (implies (and (class-table-is-loaded-from cl scl)
                (bcv::classIsInterface 
                 (bcv::class-by-name name 
                                    (bcv::scl-jvm2bcv scl)))
                (class-by-name name cl))
           (isInterface (class-by-name name cl)))
  :hints (("Goal" :in-theory (e/d ( isInterface 
                                    bcv::classIsInterface
                                    class-exists?)
                                  (class-accessflags))
           :do-not '(generalize))))

;; Tue Jun 21 16:28:22 2005


(encapsulate () 
  (local (include-book "base-consistent-state-lookupfield-support"))
  (defthm consistent-state-implie-super-of-interface-is-java-lang-Object
    (implies (and (consistent-state s)
                  (isInterface (class-by-name name (instance-class-table s))))
             (equal (super (class-by-name name (instance-class-table s)))
                    "java.lang.Object"))
    :hints (("Goal" :in-theory (e/d () (consistent-state
                                        WFF-CLASS-REP-STATIC-STRONG
                                        JVM::WFF-STATIC-CP-OK-S))))))


(defthm consistent-class-decl-interface-implies-no-fields
  (implies (and (consistent-class-decl class-rep cl hp)
                (isInterface class-rep))
           (equal (fields class-rep) nil)))


(defthm consistent-class-decls-class-by-name
  (implies (and (consistent-class-decls cl1 cl hp)
                (class-by-name name cl1))
           (consistent-class-decl (class-by-name name cl1) cl hp))
  :hints (("Goal" :in-theory (disable consistent-class-decl))))

(defthm isInterface-type-class-by-name
  (implies (isInterface (class-by-name name cl))
           (class-by-name name cl)))


(defthm consistent-state-implies-consistent-class-decl
  (implies (consistent-state s)
           (consistent-class-decls (instance-class-table s)
                                   (instance-class-table s)
                                   (heap s))))
  


(defthm consistent-state-interface-implies-no-fields
  (implies (and (consistent-state s)
                (isInterface (class-by-name name (instance-class-table s))))
           (equal (fields (class-by-name name (instance-class-table s))) nil))
  :hints (("Goal" :in-theory (e/d () (fields consistent-state))
           :cases ((consistent-class-decl (class-by-name name
                                                         (instance-class-table
                                                          s))
                                          (instance-class-table s)
                                          (heap s))))))



(encapsulate ()
  (local (include-book "base-consistent-state-lookupfield-support"))
  (defthm consistent-state-implies-java-lang-Object-not-fields
    (implies (consistent-state s)
             (not (fields (class-by-name "java.lang.Object" (instance-class-table s)))))))



(encapsulate ()
 (local (include-book "base-loader-preserve-consistent-state"))
 (defthm consistent-state-super-java-lang-object
   (implies (consistent-state s)
            (equal (super (class-by-name "java.lang.Object"
                                         (instance-class-table s)))
                   ""))))



(defthm consistent-state-lookfield-java-lang-Object-nil
  (implies (consistent-state s)
           (not (lookupField (make-field-ptr "java.lang.Object"
                                             anyname
                                             anytype)
                             s)))
  :hints (("Goal" :in-theory (e/d (lookupField 
                                   searchfields
                                   deref-field) (consistent-state))
           :expand (lookupField (make-field-ptr "java.lang.Object"
                                             anyname
                                             anytype)
                             s))))
                                   
            






(defthm consistent-state-implies-if-found-field-then-not-interface-lemma
  (implies (and (consistent-state s)
                (isInterface (class-by-name (field-ptr-classname field-ptr)
                                            (instance-class-table s))))
           (not  (LOOKUPFIELD field-ptr s)))
  :hints (("Goal" :in-theory (e/d (lookupfield 
                                   deref-field 
                                   searchfields) (fields
                                                  consistent-state
                                                  )))))


(defthm consistent-state-implies-if-class-not-found-not-nil
  (implies (and (consistent-state s)
                (not (class-by-name (field-ptr-classname field-ptr) 
                                    (instance-class-table s))))
           (not  (LOOKUPFIELD field-ptr s)))
  :hints (("Goal" :in-theory (e/d (lookupfield 
                                   deref-field 
                                   searchfields) 
                                  (fields
                                   consistent-state)))))
                                   


(defthm consistent-state-implies-class-table-loaded-from
  (implies (and (equal (env-class-table (env s)) scl)
                (consistent-state s))
           (CLASS-TABLE-IS-LOADED-FROM
            (INSTANCE-CLASS-TABLE s)
            scl))
  :hints (("Goal" :in-theory (enable consistent-state))))


(defthm classtable-from-env-sig-normalize
  (equal (BCV::CLASSTABLEENVIRONMENT (ENV-SIG s))
         (bcv::scl-jvm2bcv (env-class-table (env s))))
  :hints (("Goal" :in-theory (enable env-sig bcv::classtableenvironment
                                     makeEnvironment))))



(encapsulate () 
   (local (include-book "base-consistent-state-load-class"))
   (defthm resolveClassReference-preserve-consistency
     (implies (consistent-state s)
              (consistent-state (resolveClassReference any s)))))

(defthm env-resolveClassReference-no-change
   (equal (env (resolveClassReference any s))
          (env s)))


;;(i-am-here)

(defthm consistent-state-implies-if-found-field-then-not-interface
  (implies (and (consistent-state s)
                (LOOKUPFIELD (FIELDCP-TO-FIELD-PTR fieldcp) 
                             (RESOLVECLASSREFERENCE (FIELDCP-CLASSNAME fieldcp)
                                                    S)))
             (not (bcv::ClassIsInterface  (bcv::class-by-name 
                                         (fieldcp-classname fieldcp)
                                         (BCV::CLASSTABLEENVIRONMENT
                                          (ENV-SIG S))))))
  :hints (("Goal" 
           :in-theory (e/d (env-sig)
                           (bcv::classisinterface
                            fieldcp-classname
                            resolveclassreference
                            consistent-state))
           :cases ((consistent-state (resolveclassreference 
                                      (FIELDCP-CLASSNAME fieldcp)
                                      s))))
          ("Subgoal 1"  :use ((:instance classIsInterface-implies-isInterface
                                         (cl (instance-class-table 
                                              (resolveclassreference 
                                               (FIELDCP-CLASSNAME fieldcp) s)))
                                         (scl (env-class-table 
                                               (env (resolveclassreference 
                                                     (FIELDCP-CLASSNAME
                                                     fieldcp) s))))
                                         (name (fieldcp-classname
                                                fieldcp)))))))


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


(defthm bcv-class-by-name-is-normalize
  (implies (car (class-by-name-s name scl))
           (equal (bcv::class-by-name name (bcv::scl-jvm2bcv scl))
                  (bcv::make-class-def (mv-nth 1 (class-by-name-s name scl)))))
  :hints (("Goal" :in-theory (e/d (bcv::make-class-term
                                   bcv::classclassname
                                   classname-s
                                   bcv::class-by-name) ()))))


(defthm class-not-bound-in-bcv-class-table-not-bound-in-internal-table
  (implies (and (class-table-is-loaded-from cl scl)
                ;;(wff-static-class-table-strong scl)
                (class-by-name name cl))
           (bcv::class-by-name name (bcv::scl-jvm2bcv scl)))
  :hints (("Goal" :in-theory (e/d (classname 
                                   bcv::make-class-term
                                   classname-s
                                   bcv::class-by-name
                                   bcv::classclassname) (isClassTerm))
           :do-not '(generalize))))


(defthm if-not-found-not-lookupfield
  (implies (and (consistent-state s)
                (not (class-by-name (fieldcp-classname fieldcp)
                                    (instance-class-table s))))
           (not (lookupfield (fieldcp-to-field-ptr fieldcp) s)))
  :hints (("Goal" :in-theory (e/d () (consistent-state)))))


(defthm consistent-state-implies-if-found-field-then-class-found
  (implies (and (consistent-state s)
                (LOOKUPFIELD (FIELDCP-TO-FIELD-PTR fieldcp) 
                             (resolveclassreference (fieldcp-classname fieldcp) s)))
           (BCV::CLASS-BY-NAME (fieldcp-classname fieldcp)
                               (BCV::CLASSTABLEENVIRONMENT (ENV-SIG S))))
  :hints (("Goal" :in-theory (e/d () (consistent-state 
                                      resolveclassreference
                                      fieldcp-classname))
           :use ((:instance
                  class-not-bound-in-bcv-class-table-not-bound-in-internal-table
                  (cl (instance-class-table (resolveclassreference
                                             (fieldcp-classname fieldcp) s)))
                  (scl (env-class-table (env s)))
                  (name (fieldcp-classname fieldcp)))))))