author | streckem |
Wed, 23 Oct 2002 16:09:02 +0200 | |
changeset 13672 | b95d12325b51 |
parent 12911 | 704713ca07ea |
child 14045 | a34d89ce6097 |
permissions | -rw-r--r-- |
8011 | 1 |
(* Title: HOL/MicroJava/J/WellType.thy |
2 |
ID: $Id$ |
|
3 |
Author: David von Oheimb |
|
4 |
Copyright 1999 Technische Universitaet Muenchen |
|
11070 | 5 |
*) |
8011 | 6 |
|
12911 | 7 |
header {* \isaheader{Well-typedness Constraints} *} |
8011 | 8 |
|
11070 | 9 |
theory WellType = Term + WellForm: |
10 |
||
11 |
text {* |
|
8011 | 12 |
the formulation of well-typedness of method calls given below (as well as |
13 |
the Java Specification 1.0) is a little too restrictive: Is does not allow |
|
14 |
methods of class Object to be called upon references of interface type. |
|
15 |
||
11070 | 16 |
\begin{description} |
17 |
\item[simplifications:]\ \\ |
|
18 |
\begin{itemize} |
|
19 |
\item the type rules include all static checks on expressions and statements, |
|
20 |
e.g.\ definedness of names (of parameters, locals, fields, methods) |
|
21 |
\end{itemize} |
|
22 |
\end{description} |
|
23 |
*} |
|
12517 | 24 |
|
25 |
text "local variables, including method parameters and This:" |
|
26 |
types |
|
27 |
lenv = "vname \<leadsto> ty" |
|
28 |
'c env = "'c prog \<times> lenv" |
|
8011 | 29 |
|
30 |
syntax |
|
10061
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
31 |
prg :: "'c env => 'c prog" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
32 |
localT :: "'c env => (vname \<leadsto> ty)" |
8011 | 33 |
|
12517 | 34 |
translations |
10061
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
35 |
"prg" => "fst" |
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
36 |
"localT" => "snd" |
8011 | 37 |
|
38 |
consts |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
39 |
more_spec :: "'c prog => (ty \<times> 'x) \<times> ty list => |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
40 |
(ty \<times> 'x) \<times> ty list => bool" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
41 |
appl_methds :: "'c prog => cname => sig => ((ty \<times> ty) \<times> ty list) set" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
42 |
max_spec :: "'c prog => cname => sig => ((ty \<times> ty) \<times> ty list) set" |
8011 | 43 |
|
44 |
defs |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
45 |
more_spec_def: "more_spec G == \<lambda>((d,h),pTs). \<lambda>((d',h'),pTs'). G\<turnstile>d\<preceq>d' \<and> |
12517 | 46 |
list_all2 (\<lambda>T T'. G\<turnstile>T\<preceq>T') pTs pTs'" |
8011 | 47 |
|
12517 | 48 |
-- "applicable methods, cf. 15.11.2.1" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
49 |
appl_methds_def: "appl_methds G C == \<lambda>(mn, pTs). |
12517 | 50 |
{((Class md,rT),pTs') |md rT mb pTs'. |
51 |
method (G,C) (mn, pTs') = Some (md,rT,mb) \<and> |
|
52 |
list_all2 (\<lambda>T T'. G\<turnstile>T\<preceq>T') pTs pTs'}" |
|
8011 | 53 |
|
12517 | 54 |
-- "maximally specific methods, cf. 15.11.2.2" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
55 |
max_spec_def: "max_spec G C sig == {m. m \<in>appl_methds G C sig \<and> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
56 |
(\<forall>m'\<in>appl_methds G C sig. |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
57 |
more_spec G m' m --> m' = m)}" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
58 |
|
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
59 |
lemma max_spec2appl_meths: |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
60 |
"x \<in> max_spec G C sig ==> x \<in> appl_methds G C sig" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
61 |
apply (unfold max_spec_def) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
62 |
apply (fast) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
63 |
done |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
64 |
|
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
65 |
lemma appl_methsD: |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
66 |
"((md,rT),pTs')\<in>appl_methds G C (mn, pTs) ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
67 |
\<exists>D b. md = Class D \<and> method (G,C) (mn, pTs') = Some (D,rT,b) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
68 |
\<and> list_all2 (\<lambda>T T'. G\<turnstile>T\<preceq>T') pTs pTs'" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
69 |
apply (unfold appl_methds_def) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
70 |
apply (fast) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
71 |
done |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
72 |
|
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
73 |
lemmas max_spec2mheads = insertI1 [THEN [2] equalityD2 [THEN subsetD], |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
74 |
THEN max_spec2appl_meths, THEN appl_methsD] |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
75 |
|
10061
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
76 |
|
8011 | 77 |
consts |
10042 | 78 |
typeof :: "(loc => ty option) => val => ty option" |
8011 | 79 |
|
80 |
primrec |
|
12517 | 81 |
"typeof dt Unit = Some (PrimT Void)" |
82 |
"typeof dt Null = Some NT" |
|
83 |
"typeof dt (Bool b) = Some (PrimT Boolean)" |
|
84 |
"typeof dt (Intg i) = Some (PrimT Integer)" |
|
85 |
"typeof dt (Addr a) = dt a" |
|
8011 | 86 |
|
12517 | 87 |
lemma is_type_typeof [rule_format (no_asm), simp]: |
88 |
"(\<forall>a. v \<noteq> Addr a) --> (\<exists>T. typeof t v = Some T \<and> is_type G T)" |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
89 |
apply (rule val.induct) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
90 |
apply auto |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
91 |
done |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
92 |
|
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
93 |
lemma typeof_empty_is_type [rule_format (no_asm)]: |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
94 |
"typeof (\<lambda>a. None) v = Some T \<longrightarrow> is_type G T" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
95 |
apply (rule val.induct) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
96 |
apply auto |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
97 |
done |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
98 |
|
13672 | 99 |
lemma typeof_default_val: "\<exists>T. (typeof dt (default_val ty) = Some T) \<and> G\<turnstile> T \<preceq> ty" |
100 |
apply (case_tac ty) |
|
101 |
apply (case_tac prim_ty) |
|
102 |
apply auto |
|
103 |
done |
|
104 |
||
8011 | 105 |
types |
12517 | 106 |
java_mb = "vname list \<times> (vname \<times> ty) list \<times> stmt \<times> expr" |
107 |
-- "method body with parameter names, local variables, block, result expression." |
|
108 |
-- "local variables might include This, which is hidden anyway" |
|
8011 | 109 |
|
110 |
consts |
|
13672 | 111 |
ty_expr :: "(java_mb env \<times> expr \<times> ty ) set" |
112 |
ty_exprs:: "(java_mb env \<times> expr list \<times> ty list) set" |
|
113 |
wt_stmt :: "(java_mb env \<times> stmt ) set" |
|
8011 | 114 |
|
11372 | 115 |
syntax (xsymbols) |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
116 |
ty_expr :: "java_mb env => [expr , ty ] => bool" ("_ \<turnstile> _ :: _" [51,51,51]50) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
117 |
ty_exprs:: "java_mb env => [expr list, ty list] => bool" ("_ \<turnstile> _ [::] _" [51,51,51]50) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
118 |
wt_stmt :: "java_mb env => stmt => bool" ("_ \<turnstile> _ \<surd>" [51,51 ]50) |
8011 | 119 |
|
11372 | 120 |
syntax |
10061
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
121 |
ty_expr :: "java_mb env => [expr , ty ] => bool" ("_ |- _ :: _" [51,51,51]50) |
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
122 |
ty_exprs:: "java_mb env => [expr list, ty list] => bool" ("_ |- _ [::] _" [51,51,51]50) |
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
123 |
wt_stmt :: "java_mb env => stmt => bool" ("_ |- _ [ok]" [51,51 ]50) |
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
124 |
|
8011 | 125 |
|
126 |
translations |
|
13672 | 127 |
"E\<turnstile>e :: T" == "(E,e,T) \<in> ty_expr" |
128 |
"E\<turnstile>e[::]T" == "(E,e,T) \<in> ty_exprs" |
|
129 |
"E\<turnstile>c \<surd>" == "(E,c) \<in> wt_stmt" |
|
8011 | 130 |
|
13672 | 131 |
inductive "ty_expr" "ty_exprs" "wt_stmt" intros |
12517 | 132 |
|
133 |
NewC: "[| is_class (prg E) C |] ==> |
|
134 |
E\<turnstile>NewC C::Class C" -- "cf. 15.8" |
|
8011 | 135 |
|
12517 | 136 |
-- "cf. 15.15" |
137 |
Cast: "[| E\<turnstile>e::Class C; is_class (prg E) D; |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
138 |
prg E\<turnstile>C\<preceq>? D |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
139 |
E\<turnstile>Cast D e::Class D" |
8011 | 140 |
|
12517 | 141 |
-- "cf. 15.7.1" |
142 |
Lit: "[| typeof (\<lambda>v. None) x = Some T |] ==> |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
143 |
E\<turnstile>Lit x::T" |
8011 | 144 |
|
9240 | 145 |
|
12517 | 146 |
-- "cf. 15.13.1" |
147 |
LAcc: "[| localT E v = Some T; is_type (prg E) T |] ==> |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
148 |
E\<turnstile>LAcc v::T" |
9240 | 149 |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
150 |
BinOp:"[| E\<turnstile>e1::T; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
151 |
E\<turnstile>e2::T; |
10061
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
152 |
if bop = Eq then T' = PrimT Boolean |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
153 |
else T' = T \<and> T = PrimT Integer|] ==> |
11645
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
154 |
E\<turnstile>BinOp bop e1 e2::T'" |
9240 | 155 |
|
12517 | 156 |
-- "cf. 15.25, 15.25.1" |
11645
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
157 |
LAss: "[| v ~= This; |
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
158 |
E\<turnstile>LAcc v::T; |
13672 | 159 |
E\<turnstile>e::T'; |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
160 |
prg E\<turnstile>T'\<preceq>T |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
161 |
E\<turnstile>v::=e::T'" |
8011 | 162 |
|
12517 | 163 |
-- "cf. 15.10.1" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
164 |
FAcc: "[| E\<turnstile>a::Class C; |
10061
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
165 |
field (prg E,C) fn = Some (fd,fT) |] ==> |
11645
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
166 |
E\<turnstile>{fd}a..fn::fT" |
8011 | 167 |
|
12517 | 168 |
-- "cf. 15.25, 15.25.1" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
169 |
FAss: "[| E\<turnstile>{fd}a..fn::T; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
170 |
E\<turnstile>v ::T'; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
171 |
prg E\<turnstile>T'\<preceq>T |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
172 |
E\<turnstile>{fd}a..fn:=v::T'" |
8011 | 173 |
|
174 |
||
12517 | 175 |
-- "cf. 15.11.1, 15.11.2, 15.11.3" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
176 |
Call: "[| E\<turnstile>a::Class C; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
177 |
E\<turnstile>ps[::]pTs; |
10061
fe82134773dc
added HTML syntax; added spaces in normal syntax for better documents
kleing
parents:
10042
diff
changeset
|
178 |
max_spec (prg E) C (mn, pTs) = {((md,rT),pTs')} |] ==> |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
179 |
E\<turnstile>{C}a..mn({pTs'}ps)::rT" |
8011 | 180 |
|
12517 | 181 |
-- "well-typed expression lists" |
8011 | 182 |
|
12517 | 183 |
-- "cf. 15.11.???" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
184 |
Nil: "E\<turnstile>[][::][]" |
8011 | 185 |
|
12517 | 186 |
-- "cf. 15.11.???" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
187 |
Cons:"[| E\<turnstile>e::T; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
188 |
E\<turnstile>es[::]Ts |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
189 |
E\<turnstile>e#es[::]T#Ts" |
8011 | 190 |
|
12517 | 191 |
-- "well-typed statements" |
8011 | 192 |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
193 |
Skip:"E\<turnstile>Skip\<surd>" |
8011 | 194 |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
195 |
Expr:"[| E\<turnstile>e::T |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
196 |
E\<turnstile>Expr e\<surd>" |
8011 | 197 |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
198 |
Comp:"[| E\<turnstile>s1\<surd>; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
199 |
E\<turnstile>s2\<surd> |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
200 |
E\<turnstile>s1;; s2\<surd>" |
8011 | 201 |
|
12517 | 202 |
-- "cf. 14.8" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
203 |
Cond:"[| E\<turnstile>e::PrimT Boolean; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
204 |
E\<turnstile>s1\<surd>; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
205 |
E\<turnstile>s2\<surd> |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
206 |
E\<turnstile>If(e) s1 Else s2\<surd>" |
8011 | 207 |
|
12517 | 208 |
-- "cf. 14.10" |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
209 |
Loop:"[| E\<turnstile>e::PrimT Boolean; |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
210 |
E\<turnstile>s\<surd> |] ==> |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
211 |
E\<turnstile>While(e) s\<surd>" |
8011 | 212 |
|
13672 | 213 |
|
8011 | 214 |
constdefs |
215 |
||
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
216 |
wf_java_mdecl :: "java_mb prog => cname => java_mb mdecl => bool" |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
217 |
"wf_java_mdecl G C == \<lambda>((mn,pTs),rT,(pns,lvars,blk,res)). |
12517 | 218 |
length pTs = length pns \<and> |
12888 | 219 |
distinct pns \<and> |
12517 | 220 |
unique lvars \<and> |
11645
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
221 |
This \<notin> set pns \<and> This \<notin> set (map fst lvars) \<and> |
12517 | 222 |
(\<forall>pn\<in>set pns. map_of lvars pn = None) \<and> |
223 |
(\<forall>(vn,T)\<in>set lvars. is_type G T) & |
|
224 |
(let E = (G,map_of lvars(pns[\<mapsto>]pTs)(This\<mapsto>Class C)) in |
|
225 |
E\<turnstile>blk\<surd> \<and> (\<exists>T. E\<turnstile>res::T \<and> G\<turnstile>T\<preceq>rT))" |
|
8011 | 226 |
|
11645
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
227 |
syntax |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
228 |
wf_java_prog :: "java_mb prog => bool" |
11645
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
229 |
translations |
09a1876e739b
- declared wf_java_prog as syntax (previously: definition)
streckem
parents:
11372
diff
changeset
|
230 |
"wf_java_prog" == "wf_prog wf_java_mdecl" |
8011 | 231 |
|
13672 | 232 |
lemma wf_java_prog_wf_java_mdecl: "\<lbrakk> |
233 |
wf_java_prog G; (C, D, fds, mths) \<in> set G; jmdcl \<in> set mths \<rbrakk> |
|
234 |
\<Longrightarrow> wf_java_mdecl G C jmdcl" |
|
235 |
apply (simp add: wf_prog_def) |
|
236 |
apply (simp add: wf_cdecl_def) |
|
237 |
apply (erule conjE)+ |
|
238 |
apply (drule bspec, assumption) |
|
239 |
apply simp |
|
240 |
apply (erule conjE)+ |
|
241 |
apply (drule bspec, assumption) |
|
242 |
apply (simp add: wf_mdecl_def split_beta) |
|
243 |
done |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
244 |
|
13672 | 245 |
lemma wt_is_type: "(E\<turnstile>e::T \<longrightarrow> wf_prog wf_mb (prg E) \<longrightarrow> is_type (prg E) T) \<and> |
246 |
(E\<turnstile>es[::]Ts \<longrightarrow> wf_prog wf_mb (prg E) \<longrightarrow> Ball (set Ts) (is_type (prg E))) \<and> |
|
247 |
(E\<turnstile>c \<surd> \<longrightarrow> True)" |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
248 |
apply (rule ty_expr_ty_exprs_wt_stmt.induct) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
249 |
apply auto |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
250 |
apply ( erule typeof_empty_is_type) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
251 |
apply ( simp split add: split_if_asm) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
252 |
apply ( drule field_fields) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
253 |
apply ( drule (1) fields_is_type) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
254 |
apply ( simp (no_asm_simp)) |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
255 |
apply (assumption) |
12517 | 256 |
apply (auto dest!: max_spec2mheads method_wf_mdecl is_type_rTI |
257 |
simp add: wf_mdecl_def) |
|
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
258 |
done |
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
259 |
|
13672 | 260 |
lemmas ty_expr_is_type = wt_is_type [THEN conjunct1,THEN mp, rule_format] |
11026
a50365d21144
converted to Isar, simplifying recursion on class hierarchy
oheimb
parents:
10763
diff
changeset
|
261 |
|
8011 | 262 |
end |