112 "succs (Goto b) pc = [nat (int pc + b)]" |
112 "succs (Goto b) pc = [nat (int pc + b)]" |
113 "succs Return pc = [pc]" |
113 "succs Return pc = [pc]" |
114 "succs (Invoke C mn fpTs) pc = [pc+1]" |
114 "succs (Invoke C mn fpTs) pc = [pc+1]" |
115 |
115 |
116 |
116 |
117 lemma 1: "2 < length a ==> (\<exists>l l' l'' ls. a = l#l'#l''#ls)" |
117 lemma 1: "Suc (Suc 0) < length a ==> (\<exists>l l' l'' ls. a = l#l'#l''#ls)" |
118 proof (cases a) |
118 proof (cases a) |
119 fix x xs assume "a = x#xs" "2 < length a" |
119 fix x xs assume "a = x#xs" "Suc (Suc 0) < length a" |
120 thus ?thesis by - (cases xs, simp, cases "tl xs", auto) |
120 thus ?thesis by - (cases xs, simp, cases "tl xs", auto) |
121 qed auto |
121 qed auto |
122 |
122 |
123 lemma 2: "\<not>(2 < length a) ==> a = [] \<or> (\<exists> l. a = [l]) \<or> (\<exists> l l'. a = [l,l'])" |
123 lemma 2: "\<not>(Suc (Suc 0) < length a) ==> a = [] \<or> (\<exists> l. a = [l]) \<or> (\<exists> l l'. a = [l,l'])" |
124 proof -; |
124 proof -; |
125 assume "\<not>(2 < length a)" |
125 assume "\<not>(Suc (Suc 0) < length a)" |
126 hence "length a < (Suc 2)" by simp |
126 hence "length a < Suc (Suc (Suc 0))" by simp |
127 hence * : "length a = 0 \<or> length a = 1' \<or> length a = 2" |
127 hence * : "length a = 0 \<or> length a = Suc 0 \<or> length a = Suc (Suc 0)" |
128 by (auto simp add: less_Suc_eq) |
128 by (auto simp add: less_Suc_eq) |
129 |
129 |
130 { |
130 { |
131 fix x |
131 fix x |
132 assume "length x = 1'" |
132 assume "length x = Suc 0" |
133 hence "\<exists> l. x = [l]" by - (cases x, auto) |
133 hence "\<exists> l. x = [l]" by - (cases x, auto) |
134 } note 0 = this |
134 } note 0 = this |
135 |
135 |
136 have "length a = 2 ==> \<exists>l l'. a = [l,l']" by (cases a, auto dest: 0) |
136 have "length a = Suc (Suc 0) ==> \<exists>l l'. a = [l,l']" by (cases a, auto dest: 0) |
137 with * show ?thesis by (auto dest: 0) |
137 with * show ?thesis by (auto dest: 0) |
138 qed |
138 qed |
139 |
139 |
140 text {* |
140 text {* |
141 \medskip |
141 \medskip |
150 "(app (Load idx) G maxs rT (Some s)) = (idx < length (snd s) \<and> (snd s) ! idx \<noteq> Err \<and> maxs < length (fst s))" |
150 "(app (Load idx) G maxs rT (Some s)) = (idx < length (snd s) \<and> (snd s) ! idx \<noteq> Err \<and> maxs < length (fst s))" |
151 by (simp add: app_def) |
151 by (simp add: app_def) |
152 |
152 |
153 lemma appStore[simp]: |
153 lemma appStore[simp]: |
154 "(app (Store idx) G maxs rT (Some s)) = (\<exists> ts ST LT. s = (ts#ST,LT) \<and> idx < length LT)" |
154 "(app (Store idx) G maxs rT (Some s)) = (\<exists> ts ST LT. s = (ts#ST,LT) \<and> idx < length LT)" |
155 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
155 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
156 |
156 |
157 lemma appLitPush[simp]: |
157 lemma appLitPush[simp]: |
158 "(app (LitPush v) G maxs rT (Some s)) = (maxs < length (fst s) \<and> typeof (\<lambda>v. None) v \<noteq> None)" |
158 "(app (LitPush v) G maxs rT (Some s)) = (maxs < length (fst s) \<and> typeof (\<lambda>v. None) v \<noteq> None)" |
159 by (cases s, simp add: app_def) |
159 by (cases s, simp add: app_def) |
160 |
160 |
161 lemma appGetField[simp]: |
161 lemma appGetField[simp]: |
162 "(app (Getfield F C) G maxs rT (Some s)) = |
162 "(app (Getfield F C) G maxs rT (Some s)) = |
163 (\<exists> oT vT ST LT. s = (oT#ST, LT) \<and> is_class G C \<and> |
163 (\<exists> oT vT ST LT. s = (oT#ST, LT) \<and> is_class G C \<and> |
164 field (G,C) F = Some (C,vT) \<and> G \<turnstile> oT \<preceq> (Class C))" |
164 field (G,C) F = Some (C,vT) \<and> G \<turnstile> oT \<preceq> (Class C))" |
165 by (cases s, cases "2 < length (fst s)", auto dest!: 1 2 simp add: app_def) |
165 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest!: 1 2 simp add: app_def) |
166 |
166 |
167 lemma appPutField[simp]: |
167 lemma appPutField[simp]: |
168 "(app (Putfield F C) G maxs rT (Some s)) = |
168 "(app (Putfield F C) G maxs rT (Some s)) = |
169 (\<exists> vT vT' oT ST LT. s = (vT#oT#ST, LT) \<and> is_class G C \<and> |
169 (\<exists> vT vT' oT ST LT. s = (vT#oT#ST, LT) \<and> is_class G C \<and> |
170 field (G,C) F = Some (C, vT') \<and> G \<turnstile> oT \<preceq> (Class C) \<and> G \<turnstile> vT \<preceq> vT')" |
170 field (G,C) F = Some (C, vT') \<and> G \<turnstile> oT \<preceq> (Class C) \<and> G \<turnstile> vT \<preceq> vT')" |
171 by (cases s, cases "2 < length (fst s)", auto dest!: 1 2 simp add: app_def) |
171 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest!: 1 2 simp add: app_def) |
172 |
172 |
173 lemma appNew[simp]: |
173 lemma appNew[simp]: |
174 "(app (New C) G maxs rT (Some s)) = (is_class G C \<and> maxs < length (fst s))" |
174 "(app (New C) G maxs rT (Some s)) = (is_class G C \<and> maxs < length (fst s))" |
175 by (simp add: app_def) |
175 by (simp add: app_def) |
176 |
176 |
179 by (cases s, cases "fst s", simp add: app_def) |
179 by (cases s, cases "fst s", simp add: app_def) |
180 (cases "hd (fst s)", auto simp add: app_def) |
180 (cases "hd (fst s)", auto simp add: app_def) |
181 |
181 |
182 lemma appPop[simp]: |
182 lemma appPop[simp]: |
183 "(app Pop G maxs rT (Some s)) = (\<exists>ts ST LT. s = (ts#ST,LT))" |
183 "(app Pop G maxs rT (Some s)) = (\<exists>ts ST LT. s = (ts#ST,LT))" |
184 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
184 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
185 |
185 |
186 |
186 |
187 lemma appDup[simp]: |
187 lemma appDup[simp]: |
188 "(app Dup G maxs rT (Some s)) = (\<exists>ts ST LT. s = (ts#ST,LT) \<and> maxs < Suc (length ST))" |
188 "(app Dup G maxs rT (Some s)) = (\<exists>ts ST LT. s = (ts#ST,LT) \<and> maxs < Suc (length ST))" |
189 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
189 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
190 |
190 |
191 |
191 |
192 lemma appDup_x1[simp]: |
192 lemma appDup_x1[simp]: |
193 "(app Dup_x1 G maxs rT (Some s)) = (\<exists>ts1 ts2 ST LT. s = (ts1#ts2#ST,LT) \<and> maxs < Suc (Suc (length ST)))" |
193 "(app Dup_x1 G maxs rT (Some s)) = (\<exists>ts1 ts2 ST LT. s = (ts1#ts2#ST,LT) \<and> maxs < Suc (Suc (length ST)))" |
194 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
194 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
195 |
195 |
196 |
196 |
197 lemma appDup_x2[simp]: |
197 lemma appDup_x2[simp]: |
198 "(app Dup_x2 G maxs rT (Some s)) = (\<exists>ts1 ts2 ts3 ST LT. s = (ts1#ts2#ts3#ST,LT) \<and> maxs < Suc (Suc (Suc (length ST))))" |
198 "(app Dup_x2 G maxs rT (Some s)) = (\<exists>ts1 ts2 ts3 ST LT. s = (ts1#ts2#ts3#ST,LT) \<and> maxs < Suc (Suc (Suc (length ST))))" |
199 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
199 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
200 |
200 |
201 |
201 |
202 lemma appSwap[simp]: |
202 lemma appSwap[simp]: |
203 "app Swap G maxs rT (Some s) = (\<exists>ts1 ts2 ST LT. s = (ts1#ts2#ST,LT))" |
203 "app Swap G maxs rT (Some s) = (\<exists>ts1 ts2 ST LT. s = (ts1#ts2#ST,LT))" |
204 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
204 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
205 |
205 |
206 |
206 |
207 lemma appIAdd[simp]: |
207 lemma appIAdd[simp]: |
208 "app IAdd G maxs rT (Some s) = (\<exists> ST LT. s = (PrimT Integer#PrimT Integer#ST,LT))" |
208 "app IAdd G maxs rT (Some s) = (\<exists> ST LT. s = (PrimT Integer#PrimT Integer#ST,LT))" |
209 (is "?app s = ?P s") |
209 (is "?app s = ?P s") |
236 |
236 |
237 |
237 |
238 lemma appIfcmpeq[simp]: |
238 lemma appIfcmpeq[simp]: |
239 "app (Ifcmpeq b) G maxs rT (Some s) = (\<exists>ts1 ts2 ST LT. s = (ts1#ts2#ST,LT) \<and> |
239 "app (Ifcmpeq b) G maxs rT (Some s) = (\<exists>ts1 ts2 ST LT. s = (ts1#ts2#ST,LT) \<and> |
240 ((\<exists> p. ts1 = PrimT p \<and> ts2 = PrimT p) \<or> (\<exists>r r'. ts1 = RefT r \<and> ts2 = RefT r')))" |
240 ((\<exists> p. ts1 = PrimT p \<and> ts2 = PrimT p) \<or> (\<exists>r r'. ts1 = RefT r \<and> ts2 = RefT r')))" |
241 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
241 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
242 |
242 |
243 |
243 |
244 lemma appReturn[simp]: |
244 lemma appReturn[simp]: |
245 "app Return G maxs rT (Some s) = (\<exists>T ST LT. s = (T#ST,LT) \<and> (G \<turnstile> T \<preceq> rT))" |
245 "app Return G maxs rT (Some s) = (\<exists>T ST LT. s = (T#ST,LT) \<and> (G \<turnstile> T \<preceq> rT))" |
246 by (cases s, cases "2 < length (fst s)", auto dest: 1 2 simp add: app_def) |
246 by (cases s, cases "Suc (Suc 0) < length (fst s)", auto dest: 1 2 simp add: app_def) |
247 |
247 |
248 lemma appGoto[simp]: |
248 lemma appGoto[simp]: |
249 "app (Goto branch) G maxs rT (Some s) = True" |
249 "app (Goto branch) G maxs rT (Some s) = True" |
250 by (simp add: app_def) |
250 by (simp add: app_def) |
251 |
251 |